-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Describe the bug
Using PHP8 promoted constructror properties by themselves works fine, but adding phpdoc to them leads to some false errors.
Code sample
<?php
declare(strict_types=1);
namespace Test;
class Test
{
public function __construct(
/**
* @var int
*/
public int $test,
) {
}
}Custom ruleset
I am using --standard=PSR12
To reproduce
Steps to reproduce the behavior:
- Create a file called
test.phpwith the code sample above... - Run
phpcs test.php ... - See error message displayed
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
11 | ERROR | [x] Multi-line function declaration not indented correctly; expected 8 spaces but found 0 (Squiz.Functions.MultiLineFunctionDeclaration.Indent)
12 | ERROR | [x] Multi-line function declaration not indented correctly; expected 8 spaces but found 0 (Squiz.Functions.MultiLineFunctionDeclaration.Indent)
13 | ERROR | [x] The first parameter of a multi-line function declaration must be on the line after the opening bracket
| | (Squiz.Functions.MultiLineFunctionDeclaration.FirstParamSpacing)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 31ms; Memory: 8MB
Expected behavior
The test class looks fine, I expected phpcs to not complain about it. The error message also points towards bugs, there are clearly more than 0 spaces:
expected 8 spaces but found 0
Versions (please complete the following information):
- OS: Ubuntu 20.04
- PHP: 8.0.3
- PHPCS: 3.6.0
- Standard: PSR12
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels