-
Notifications
You must be signed in to change notification settings - Fork 550
Fix ignore comment handling for multiple traits in a single file #4804
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
base: 2.1.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?php declare(strict_types = 1); | ||
|
|
||
| namespace Bug13945Two; | ||
|
|
||
| trait Foo { | ||
| public function baz(): void { | ||
| $this->myProperty = "a"; // @phpstan-ignore property.notFound | ||
| } | ||
| } | ||
|
|
||
| trait Baz { | ||
| } | ||
|
|
||
| class HelloWorld | ||
| { | ||
| use Baz; | ||
| use Foo; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?php declare(strict_types = 1); | ||
|
|
||
| namespace Bug13945; | ||
|
|
||
| trait Foo { | ||
| public function baz(): void { | ||
| $this->myProperty = "a"; // @phpstan-ignore property.notFound | ||
| } | ||
| } | ||
|
|
||
| trait Baz { | ||
| } | ||
|
|
||
| class HelloWorld | ||
| { | ||
| use Foo; | ||
| use Baz; | ||
|
Comment on lines
+16
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in phpstan/phpstan#13945 its reported that the errors emitted depend on the order of this use-statements. I think it would be good than, to additional test this with
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a test case |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain what's happening here?
$scope->getFileDescription()should be unique per trait usage.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value of
$scope->getFileDescription()contains:uses the traitIt does not contain trait name, so is not necessarily unique when a file has two or more traits.