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

FunctionComment.SpacingAfterParamType not working with intersection types #2887

Open
icanhazstring opened this issue Mar 2, 2020 · 1 comment · May be fixed by #2919
Open

FunctionComment.SpacingAfterParamType not working with intersection types #2887

icanhazstring opened this issue Mar 2, 2020 · 1 comment · May be fixed by #2919

Comments

@icanhazstring
Copy link

icanhazstring commented Mar 2, 2020

Hi there,

the given sniff Squiz.Commenting.FunctionComment.SpacingAfterParamType does not work well with intersection type annotations.

Used Version: 3.5.4

It might be related to an older, already fixed issue:
#2530

Given the following code

/**
 * @param ContainerInterface&ServiceManager $container
 * @param array<string, string> $options
 */
public function __invoke(ContainerInterface $container, array $options = []) : Fubar

Expected:
no problem

Actual:

FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 XX | ERROR | [x] Expected 4 spaces after parameter type; 0 found
      (Squiz.Commenting.FunctionComment.SpacingAfterParamType)

Using phpcbf to fix the issue resulted in this line:

* @param ContainerInterface    &ServiceManager $container
* @param array<string, string> $options
@VincentLanglet
Copy link
Contributor

@icanhazstring It's related to #2806

It was fixed for the PEAR standard but not the Squizz one.

Do you want to create the PR ?

I recommend

  • To create a constant or protected method in the src/Standards/PEAR/Sniffs/Commenting/FunctionCommentSniff.php
  • To use this constant/method in the src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php (which is extending the PEAR one)

This way this won't happen again if we update the regex of the PEAR Sniff.

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

Successfully merging a pull request may close this issue.

2 participants