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
Attempt to fix incorrect doctrine table attribute values on php 8.1 #2699
Conversation
Thank you for the PR. The rector-doctrine now passed well 👍 One Rector run is still failing though. Could you fix it? |
Well I tried to debug and fix it but I don't understand it 😅 The |
Have you tried to dump the line it refers? "Rector\Core\PhpParser\Node\Value\ValueResolver::resolveClassConstFetch()":264" Then I'd try to narrow down what file or code is causing it. bin/rector p packages/Exact/File.php Then dump the node before last crash and you'll see the broken code snippet. |
Debug infoThat's indeed what I did but I don't understand why it fails.
The error is throw in this part of the code rector-src/src/PhpParser/Node/Value/ValueResolver.php Lines 248 to 268 in ff524c5
I've dumped the resolved
And therefor the Or does rector try to convert the private property to a constant as it is not used anymore to assign a value? But it fails somehow EDIT: Changing it a constant instead of a property does indeed seem to fix it! |
Great job 👍 Could you push the feature and fix commits separately? I'm curious what is the fix for next time this happens :) |
Done! |
Thanks 👍 it's interesting, that should not be a problem for Rector. I'll check this one later and merge this along with it, so I don't forget the bug in another rule 👍 Thank you |
The solution is on the way 😀 👍 |
Reverted some changes of #1850 as they resulted in incorrect doctrine
Table
attribute values on php 8.1 (indexes
anduniqueConstraints
can't be initialized inline) + some extra needed fixesFixes rectorphp/rector#7163 and partial fix of rectorphp/rector-doctrine#116 (point 1 and 2)
I've updated the failing test of rector-doctrine in rectorphp/rector-doctrine#118