rectorphp / rector-phpunit

Rector upgrade rules for PHPUnit
http://getrector.com
MIT License
61 stars 46 forks source link

Add a blank line after trait for addprophecytraitrector rule #279

Closed eerison closed 8 months ago

eerison commented 8 months ago

is there any way to add a blank like between trait and method?

this rule https://github.com/rectorphp/rector-phpunit/blob/main/docs/rector_rules_overview.md#addprophecytraitrector

Should apply

+    use ProphecyTrait;
+

But it is not adding this blank line after trait.

Should it be handled here or other tool should do it like phpcs?

samsonasik commented 8 months ago

There is NewlineAfterStatementRector rule for that

https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#newlineafterstatementrector

You may need to run twice when apply NewlineAfterStatementRector to ensure everything printed corectly.

samsonasik commented 8 months ago

Oh, it seems that's not cover use trait, in that case, you need to have new Nop() after that, ensure that uses only once.

eerison commented 8 months ago

Ahhh I see, well I do not have code style rule applied. But good to know :), if we have a rule to solve this then this can be closed

Thank you for reply <3

samsonasik commented 8 months ago

In case NewlineAfterStatementRector don't apply on use trait, the feature should be on NewlineAfterStatementRector