| 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.
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 -----------
Rector should not change anything here! Because this change is incorrect and against styling rules.
Thanks for repoting. I cannot see in the demo link though. Could you update it to show the error?
@TomasVotruba No problem. Here is: https://getrector.org/demo/7d36a3bc-a02b-4dd4-8bec-d813f9c9c97b

I still can't see it there.
Let me put it this way: when using annotations like @anything, Rector will fail because it says the closing bracket is wrong and you should change identation of it. And it causes CI failure.
---------- begin diff ----------
--- Original
+++ New
@@ -25,7 +25,7 @@
{
$this->output = $output;
//@anything
- }
+}
----------- end diff -----------
Compare this two:
With annotation: https://getrector.org/demo/7d36a3bc-a02b-4dd4-8bec-d813f9c9c97b
Without annotation: https://getrector.org/demo/dbc8776b-460e-4767-a6f6-481bff3ba7b0
So the demo isn't showing the bug at all?
No, demo will remove the last two closing brackets and annotation as well.
It's not removing it. It just show parts of the code.
Look at this example: https://getrector.org/demo/65bb3e16-0968-459b-8bb7-fd2eea1b3f59#result
It doesn't remove first 2 lines with use there. It just doesn't show them, because nothing changed those lines.
Ah ok. So you should check the diff I posted. Apparently it can't be reproduced via demo and I reported it because it was the reason of CI failure couple of times. So I leave it to you to confirm or close this issue.
BTW, I know you just rely on demo because it is the right and safe way to save time and figure out situation, but you can see our CI log to understand the problem we had:
https://travis-ci.org/github/nunomaduro/phpinsights/jobs/673751065
Failing CI is perfect :+1: . I see there more issues with Rector.
Thanks, I'm looking at it
I cannot find the rector.yaml there though. Could you link me to the PR so I can replicate Rector run locally?
This commit fixes

Awesome, this is the PR: https://github.com/nunomaduro/phpinsights/pull/393
I got there, but didn't find added rector.yaml.
I'm using this version https://github.com/nunomaduro/phpinsights/blob/master/rector.yaml - is that correct?
If so, the annotaion is kept.

Try the PR again with current dev-master Rector on that repository. It seems fixed.
Thanks!
:+1:
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).