We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug A clear and concise description of what the bug is.
Code sample
class MyClass { private function myFunction(ClassA|ClassB|null $param): bool { } }
To reproduce Steps to reproduce the behavior:
\PHP_CodeSniffer\Files\File::getMethodParameters
Actual behavior The Type Hint is detected as ClassA|ClassB|null, but the property "nullable_type" is set to false.
ClassA|ClassB|null
"nullable_type"
Expected behavior PHPCS should be able to detect that the $param parameter is nullable
Versions (please complete the following information):
Additional context The Sniff here https://github.com/spryker/code-sniffer/blob/master/Spryker/Sniffs/Commenting/DocBlockParamAllowDefaultValueSniff.php is using get getMethodParameters method to validate docblock and typehint. Due to wrong input from PHPCS it create a violation where none should be.
getMethodParameters
The text was updated successfully, but these errors were encountered:
This is intentional and was discussed in detail when support for union types was implemented. Please read the discussion here: #2968 (comment)
Sorry, something went wrong.
Hopefully that linked comment from @jrfnl helped explain the behaviour.
No branches or pull requests
Describe the bug
A clear and concise description of what the bug is.
Code sample
To reproduce
Steps to reproduce the behavior:
\PHP_CodeSniffer\Files\File::getMethodParameters
)Actual behavior
The Type Hint is detected as
ClassA|ClassB|null
, but the property"nullable_type"
is set to false.Expected behavior
PHPCS should be able to detect that the $param parameter is nullable
Versions (please complete the following information):
Additional context
The Sniff here https://github.com/spryker/code-sniffer/blob/master/Spryker/Sniffs/Commenting/DocBlockParamAllowDefaultValueSniff.php is using get
getMethodParameters
method to validate docblock and typehint. Due to wrong input from PHPCS it create a violation where none should be.The text was updated successfully, but these errors were encountered: