Closed ItsReddi closed 1 month ago
It seems due to different namespace, on same namespace, it seems skipped as expected https://getrector.com/demo/c0a2b73f-3195-4332-8a06-208df86f8f6c
I see, that's due to one\DemoFile
locate existing two
, which you should add:
use one;
without that, you will get:
Fatal error: Uncaught Error: Class "two\one\DemoFile" not found in /in/LeXsi:13
here the fixed version: https://3v4l.org/mkB72 see https://getrector.com/demo/f13d109a-1d4f-4c54-a0a3-8ce5da11cba0
Thanks. Then in our case we have some issues with the rector autoloading. Have to check that. Might be because the composer autoload does not contain these classes since they are loaded via the framework / application at runtime and rector does not start the application.
But should rector not raise error if classes can not be found? How can i debug which classes are not loaded?
My suggestion is to have phpstan setup on your project so you're detecting autoload early by it in case of class not found, see
Thank i can confirm its an autoload issue in our end. Adding:
"autoload": {
"psr-4": {
"data_hub\\": "common/modules/data_hub/src",
"game\\": "common/modules/game/src",
"basics\\common\\module\\": "common/modules/base/src"
}
},
works as expected. but if i try to not to modify composer.json
and the it via rector config, not.
Is that expected? Did i understood anything wrong?
That is not working:
return RectorConfig::configure()
->withBootstrapFiles([
__DIR__ . '/vendor/yiisoft/yii2/Yii.php'
])
->withAutoloadPaths([
__DIR__ . "/common/modules/game/src",
__DIR__ . "/common/modules/base/src"
])
Bug Report
Minimal PHP Code Causing Issue
See https://getrector.com/demo/09564344-3758-456b-943f-783aa029f409
Responsible rules
RemoveParentCallWithoutParentRector
Expected Behavior
Should not remove the parent::init call.