phpcs: Missing parameter comment
Asked Answered
V

2

7

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

Veii answered 7/8, 2018 at 9:3 Comment(2)
@param TranscodingJob $transcodingJob My comment -- like that.Thoracotomy
Huh. That didn't seem to work before, but it does now. Thanks!Veii
R
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
 */
Regazzi answered 12/11, 2018 at 5:48 Comment(0)
C
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;
}
Casserole answered 5/5, 2023 at 7:0 Comment(1)
Hi, please try to add some value if the question has an already accepted answer; and your content uses quit another codeAugustusaugy

© 2022 - 2024 — McMap. All rights reserved.