Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squiz.Commenting.FunctionComment.MissingParamName false positive #535

Open
2 of 4 tasks
simPod opened this issue Jul 5, 2024 · 2 comments
Open
2 of 4 tasks

Squiz.Commenting.FunctionComment.MissingParamName false positive #535

simPod opened this issue Jul 5, 2024 · 2 comments

Comments

@simPod
Copy link

simPod commented Jul 5, 2024

Describe the bug

Squiz.Commenting.FunctionComment.MissingParamName is triggered for valid @param docblock

Code sample

<?php

declare(strict_types=1);

class X
{
    /**
     * @param array{
     *     ud: string
     * } $data
     */
    public function sfsd(array $data): void
    {
    }
}

To reproduce

Steps to reproduce the behavior:

  1. Create a file called test.php with the code sample above...
  2. Run phpcs test.php ...
  3. See error message displayed
phpcs: Squiz.Commenting.FunctionComment.MissingParamName: Missing parameter name

Expected behavior

No error

Versions (please complete the following information)

Operating System [e.g., Windows 10, MacOS 10.15]
PHP version 8.3
PHP_CodeSniffer version 3.10.1
Standard Squiz
Install type composer local

Please confirm

  • I have searched the issue list and am not opening a duplicate issue.
  • I have read the Contribution Guidelines and this is not a support question.
  • I confirm that this bug is a bug in PHP_CodeSniffer and not in one of the external standards.
  • I have verified the issue still exists in the master branch of PHP_CodeSniffer.
@jrfnl
Copy link
Member

jrfnl commented Jul 5, 2024

The Squiz.Commenting.FunctionComment sniff - and other comment related sniffs in PHPCS - do not support the array{...} type format and never have.

Reclassifying this ticket as a feature request, not a bug.

To be honest, I've never seen that format before, so is this a codebase specific format ? Is this a format promoted by some other tool ? Is there any formal specification of that array type format ?

As things are at this time, this issue is not actionable without further information.

Note: I'm not giving an opinion yet whether this is a feature request which would be accepted to be supported...

@simPod
Copy link
Author

simPod commented Jul 5, 2024

I forgot to mention it does work for single line array shape declaration.

It's array shape, widely adopted by php ecosystem https://phpstan.org/writing-php-code/phpdoc-types#array-shapes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants