You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When scanning a class containing properties with PHP native union or intersection types, these will always be flagged as not having a docblock even when a docblock is present.
Code sample
classFoo
{
/** * This is fine. * * @var string|integer */public$correct_not_missing_docblock_union;
/** * This snippet gets flagged with "Missing member variable doc comment (Squiz.Commenting.VariableComment.Missing)" * * @var string|integer */publicstring|int$BUG_missing_docblock_with_union_type;
/** * This is fine * * @var InterfaceA&InterfacB */public$correct_not_missing_docblock_intersection;
/** * This snippet gets flagged with "Missing member variable doc comment (Squiz.Commenting.VariableComment.Missing)" * * @var InterfaceA&InterfacB */publicInterfaceA&InterfacB$BUG_missing_docblock_intersection;
}
To reproduce
Steps to reproduce the behavior:
Create a file called test.php with the code sample above...
Run phpcs test.php --standard=squiz --sniffs=squiz.commenting.variablecomment
See error message displayed
---------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------
17 | ERROR | Missing member variable doc comment (Squiz.Commenting.VariableComment.Missing)
31 | ERROR | Missing member variable doc comment (Squiz.Commenting.VariableComment.Missing)
---------------------------------------------------------------------------------------------
Expected behavior
That the docblocks would be recognized correctly and no "missing docblock" errors would be thrown.
Versions (please complete the following information)
Describe the bug
When scanning a class containing properties with PHP native union or intersection types, these will always be flagged as not having a docblock even when a docblock is present.
Code sample
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php --standard=squiz --sniffs=squiz.commenting.variablecomment
Expected behavior
That the docblocks would be recognized correctly and no "missing docblock" errors would be thrown.
Versions (please complete the following information)
master
Additional context
PR squizlabs/PHP_CodeSniffer#3757 may contain a partial fix for this.
Please confirm:
master
branch of PHP_CodeSniffer.The text was updated successfully, but these errors were encountered: