6

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.)

2 Answers2

22

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
 */
Akeel ahamed
  • 877
  • 11
  • 11
0

This error message suggests that there is a missing parameter comment in your PHP code, which is causing a problem when running the PHP CodeSniffer (phpcs) tool. Here's an example of how you can add a parameter comment for a function:

/**
 * Adds two numbers together.
 *
 * @param int $num1 The first number to add.
 * @param int $num2 The second number to add.
 *
 * @return int The sum of the two numbers.
 */
function addNumbers($num1, $num2) {
    return $num1 + $num2;
}
  • Hi, please try to add some value if the question has an already accepted answer; and your content uses quit another code – pierpy May 05 '23 at 09:28