Rule errors are reported doubly when multiple nodes reference the same comment
Opened this issue · 1 comments
EmilMassey commented
In some cases, the same expired comment is reported twice.
Version
phpstan: 1.11.5
phpstan-todo-by: 0.1.27
Code
/**
* TODO: APP-1234 <comment>
*/
#[FirstAttribute]
#[SecondAttribute]
private string $foo;
Configuration (interesting parts)
includes:
- vendor/staabm/phpstan-todo-by/extension.neon
parameters:
todo_by:
ticket:
enabled: true
tracker: jira
resolvedStatuses:
- Done
keyPrefixes:
- APP
jira:
server: https://<host>.atlassian.net
credentialsFilePath: jira-apikey.txt
Command parameters
vendor/bin/phpstan analyse -c phpstan.neon src tests fixtures public/index.php
Output
------ ----------------------------------------------------------------------------------
Line src/File.php
------ ----------------------------------------------------------------------------------
16 Should have been resolved in APP-1234: <comment>
💡 See https://<host>.atlassian.net/browse/APP-1234
16 Should have been resolved in APP-1234: <comment>
💡 See https://<host>.atlassian.net/browse/APP-1234
------ ----------------------------------------------------------------------------------
Additional Info
Collector visits two nodes in a file and both have the same comment: PhpParser\Node\Stmt\Property
and PhpParser\Node\AttributeGroup
- that's probably the cause
Reproducer: EmilMassey@3898c03
staabm commented
I wonder whether this is a expected AST, or whether its a bug in nikic/php-parser