-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
Additional rectors are ran despite not being referenced in my config #3212
Comments
When the expected rule in my config (here ---------- begin diff ----------
--- Original
+++ New
@@ -1,6 +1,6 @@
<?php declare(strict_types = 1);
-namespace App\Security;
+namespace App\Security\Permission;
use App\Entity\AppUser;
use App\Entity\Company;
----------- end diff -----------
Applied rules:
* Rector\Renaming\Rector\Class_\RenameClassRector You can see the applied rule is written. This brings me to one another thing that could help you: the additional (and unwanted) diffs do not provide the applied rule. 🤔 |
My guess is: one of the parser you use with Rector can't parse properly the annotations and drops some data. |
Also see #2994. |
We need test fixtures here: https://github.com/rectorphp/rector/tree/master/packages/better-php-doc-parser/tests/PhpDocParser |
There are several issues here and it would be mess to address them in parallel here. Better split them to standalone issues. PostRectors are meta-Rectors run after all normal Rectors. They handle removing nodes, adding properties etc. So that's expected. I'll address other issues in newly created tickets. |
Thank you for your answers, I did not find the #2994 issue, I'll subscribe to that one and try to provide some examples. |
@nesk Better create new issues. It's easier to fix 5 smallers one with 5 PRs, than try to fix 1 big with one huge PR. |
Alright, noted! |
Fix for Extra SpacingRector currently can't understand extra spaces, quotes, commas, double collons and equal sings due to lack of php doc reprinting technology. It might take 3-9 months to get there, but with attributes 2 it annotation will be absolete and doesn't make sense anymore to invest into them: https://wiki.php.net/rfc/attributes_v2 To make Rector work properly and preserve format, the code must be manuyll changed to use standard spacing (e.g. the one used in official documentation): /**
* @Route(
* path="/some-endpoint",
- * methods = { "POST" }
+ * methods={"POST"}
* )
public function someAction(Request $request) |
I will do this, thank for the details! |
@nesk I just tested it and same change is needed for the join table: * @ORM\JoinTable(name="PushCampaignCluster",
- * joinColumns = {
+ * joinColumns={
* @ORM\JoinColumn(name="pushCampaignId", referencedColumnName="id")
* },
- * inverseJoinColumns = {
+ * inverseJoinColumns={
* @ORM\JoinColumn(name="clusterId", referencedColumnName="id")
* }
* ) |
rectorphp/rector-src@e35497e [Php81] Allow explicit mixed processed on trait on NullToStrictStringFuncCallArgRector (#3212)
Bug Report
First, thank you so much for this awesome project! I'm currently encountering some issues and hope you could provide some help.
I've created the following config:
If I run
vendor/bin/rector show
, I get something that seems to be the appropriate result:However, when I run
vendor/bin/rector process src --dry-run
, the outputted diffs contain way more modifications than expected (~12 files):Mainly, the additional diffs are avbout code quality (which is good, but I don't want them now), for example:
And sometimes there's some pretty weird changes:
joinColumns
andinverseJoinColumns
?Unfortunately, I'm unable to create a reproducible example, I'm really for this and I know it will not help. 😕
I was hoping maybe you have any idea how this could happen so I can investigate further more? If needed, I can provide more diff examples.
Thank you
The text was updated successfully, but these errors were encountered: