-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
Ensure autoloader is loaded in globally installed Rector #1683
Conversation
Seems that the unit tests dont like me :-( But this fix does work... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find!
@PhilETaylor I rebased your branch |
@TomasVotruba it seems there is error in CI that unrelated to it: Run vendor/bin/easy-ci validate-file-length packages rules src tests
Error: ] Class "Symplify\EasyCI\ValueObject\Option" not found even happen on automated PR #1682 |
@TomasVotruba it seems
It resolved by temporary pin |
Thank you @PhilETaylor |
@PhilETaylor it somehow make e2e error on rector/rector, ref https://github.com/rectorphp/rector/runs/4829814122?check_suite_focus=true I will check if it related to it. |
@PhilETaylor it seems indeed cause error on e2e, revert it seems solve it, the possible solution possibly mention in the documentation about it. |
Strange that the error is a PHP syntax error though, seems unrelated. In bed now but will dig further tomorrow |
I'm actually surprised that this was the approved way to load the project autoloader to being with: $this->loadIfExistsAndNotLoadedYet(__DIR__ . '/../../../autoload.php'); Given that Rector could be run from theoretically anywhere starting from Surely there is some cleaner way to identify "project root", or "folder containing composer.json"? |
The test seem to also be loading from a non standard location involving ../../bin/rector
|
@MGatner that's trade off for using it globally as far as I know. I created PR #1685 to revert it with additional doc for using it globally (while not recommended) while we wait if there is possible solution for it. |
I am with Sebastian Bergmann on static analysis tools not being included as project dependencies. It introduces unnecessary extra files and the opportunity for collisions. Rector does an amazing job of running separate from the project code - why restrict external execution? It seems like with all its project knowledge the executable ought to be able to locate autoload.php no matter where it is called from. |
Fixes rectorphp/rector#6903
When running a globally installed Rector, autoloading of the projects vendors is not happening
This PR changes that
To replicate the problem
Before this PR:
After this PR
Tagging @MGatner