Automattic / phpcs-neutron-standard

A set of phpcs sniffs for PHP >7 development
MIT License
94 stars 7 forks source link

Return type is missing #60

Closed widoz closed 6 years ago

widoz commented 6 years ago

I get a Return type is missing for https://github.com/widoz/unprefix/blob/refactor-php7/src/Template/Model/HeaderBackground.php#L47 and many other methods/functions even thought I explictly set the return type hint.

Installed Packages:

automattic/phpcs-neutron-standard            v1.5.0 
object-calisthenics/phpcs-calisthenics-rules v3.2.1  
squizlabs/php_codesniffer                    3.3.0  
wp-coding-standards/wpcs                     0.14.1 

The issue seems become from neutron standard because removing it by https://github.com/widoz/unprefix/blob/refactor-php7/ruleset.xml#L61 and also trying to explicitly set the standard when run phpcs command.

sirbrillig commented 6 years ago

🤔 I believe you, but I am having trouble replicating the issue. I downloaded the file you linked, and ran NeutronStandard on it, and this is what I get:

$ phpcs -s --standard=NeutronStandard HeaderBackground.php

FILE: /Users/payton/Test/HeaderBackground.php
-------------------------------------------------------------------------------------------------------------------------------
FOUND 32 ERRORS AFFECTING 14 LINES
-------------------------------------------------------------------------------------------------------------------------------
  2 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
  2 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 49 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 49 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 53 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 56 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 56 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 56 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 56 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 60 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 60 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 61 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 61 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 61 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 61 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 64 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 65 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 65 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 65 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 65 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 66 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 67 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 75 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 75 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 75 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 75 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 76 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 76 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 90 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 90 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 98 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)
 98 | ERROR | [x] Parenthesis content must be padded by a space (NeutronStandard.Whitespace.RequireParenthesisSpacing.Missing)

I wonder if there's some way it could be interacting with the other standards...

Can you try the same command (or something similar, but the -s is important so you can see the sniff names) on your machine and send me the results?

sirbrillig commented 6 years ago

Ah, this might be because of #62

sirbrillig commented 6 years ago

@widoz I think the v1.5.2 release should fix your issue. It was an upstream change in phpcs that broke these sniffs which is why I didn't notice it until now.

Let me know if it still doesn't work!