-
-
Notifications
You must be signed in to change notification settings - Fork 742
Closed
Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/620f804d-18f8-4fbf-a592-0a7e3a032253
<?php
final class DemoFile
{
public function run( $args ) {
if ( ! empty( $args['bar'] ) ) {
/*$hello = (object) array(
'a' => 'b',
);*/
} else {
$hello = new Hello( $args );
}
}
}Uncomment the code block to get
<?php
final class DemoFile
{
public function run( $args ) {
if ( ! empty( $args['bar'] ) ) {
$hello = (object) array(
'a' => 'b',
);
} else {
$hello = new Hello( $args );
}
}
}which results in error:
"Analyze error: "Class Hello was not found while trying to analyse it - discovering symbols is probably not configured properly.". Include your files in "$rectorConfig->autoloadPaths([...]);" or "$rectorConfig->bootstrapFiles([...]);" in "rector.php" config.\nSee https://github.com/rectorphp/rector#configuration",
https://getrector.com/demo/e27f2e9d-9412-40d6-a345-a6be2334496d
(obviously in the online demo I cannot autoloadPaths, but locally I did but still got this error)
Responsible rules
Issue seems to be independent of rules used
This is also the reproducer you requested for
- --debug behaves differently than non-debug #9325 - when I run the above code with
--debug, it works without error - parallel processing causing class not found error #9326 - when I
->disableParallel()it works without error
Expected Behavior
- (object) array typecast should not modify class load behavior
- (object) array typecast causes classes loaded with autoloadPaths (and probably also bootstrapFiles?) to not be found
- (object) array typecast should be consistent independent of whether
--debugis used or not - (object) array typecast should be consistent independent of whether
->disableParallel()is used or not
Reactions are currently unavailable