Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phpcs: Missing parameter comment

I have the following code:

/**
 * @param TranscodingJob $transcodingJob
 *
 * @return TranscodingJob
 * @throws \Lexik\Bundle\WorkflowBundle\Exception\WorkflowException
 */
public function onTranscodingJobError(TranscodingJob $transcodingJob) { ...

... and I find that when I hover over the annotation, this note appears:

phpcs: Missing parameter comment

How can I modify my annotations to make the complaint go away?

(I have tried simply adding text above the annotation for the parameter, and that doesn't seem to fix it.)

like image 855
Patrick Avatar asked Aug 07 '18 09:08

Patrick


People also ask

What is the use of phpcs?

PHPCS is a command-line utility which can output varying levels of detail and evaluate one file, a whole directory, or a pattern match of target files. Its output is a list of flaws found, with an error message and line number supplied. By default PHPCS comes pre-installed with a number of coding standard definitions.

How do I run PHP_codesniffer?

Then run PHP_CodeSniffer like this: phpcs --standard=/path/to/mystandard.xml /path/to/code Having your own ruleset lets you do a lot of things, including changing error messages, changing the severity or type of a message, including checks from other standards, and setting global ignore rules.

How do I install phpcs?

There are two main ways of installing PHPCS: directly, or via PEAR. Using the PEAR repositories is recommended and adapts to all the various platforms. It's also probably very familiar to all PHP developers!

How do I add a Doc comment to a file?

A file doc comment is placed at the top of the file, above any include statements and contains pretty much the same information as the class doc comment. When added to your application your document structure might look like this.


1 Answers

You need to add comment for your @param variable

Change your code as

 /**
 * @param TranscodingJob $transcodingJob comment about this variable
 *
 * @return TranscodingJob
 * @throws \Lexik\Bundle\WorkflowBundle\Exception\WorkflowException
 */
like image 156
Akeel ahamed Avatar answered Sep 30 '22 17:09

Akeel ahamed