rector: False positive on annotations
Bug Report
| Subject | Details |
|---|---|
| Rector version | v0.7.11 |
| Installed as | composer dependency |
Hey @TomasVotruba
I get false positive from Rector when using different annotations in the code. The source of problem is from PhpStan required annotations for ignoring some stuff.
Minimal PHP Code Causing Issue
https://getrector.org/demo/453703d2-496e-423d-a9a4-b4ae06699f7e
At first glance it might be OK! But look and the last line. It will be more clear in a diff from Rector itself:
---------- begin diff ----------
--- Original
+++ New
@@ -25,7 +25,7 @@
{
$this->output = $output;
//@anything
- }
+}
----------- end diff -----------
Expected Behaviour
Rector should not change anything here! Because this change is incorrect and against styling rules.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (10 by maintainers)
š
Here is test case that check that: https://github.com/rectorphp/rector/pull/3177/files#diff-b418338cd7c1457fe9847e71e42ed7a4
Also be sure your code has consistent line endings and consistent spaces or tabs. That might be causing troubles (also in all coding standard tools).
Try the PR again with current
dev-masterRector on that repository. It seems fixed.This commit fixes
Failing CI is perfect š . I see there more issues with Rector.
Thanks, Iām looking at it