Skip to content

[Config] Remove $isBound usage as cause empty configuration on RectorConfig#4880

Merged
samsonasik merged 1 commit intomainfrom
remove-is-bound
Aug 29, 2023
Merged

[Config] Remove $isBound usage as cause empty configuration on RectorConfig#4880
samsonasik merged 1 commit intomainfrom
remove-is-bound

Conversation

@samsonasik
Copy link
Copy Markdown
Member

@TomasVotruba as I guess last week at PR:

that you replaced at PR:

the $isBound usage will make invalid, reproduced in rector-doctrine repo:

With isBound

array {}

Without isBound

array(5) {
  [0]=>
  string(10) "Doctrine\*"
  [1]=>
  string(7) "Gedmo\*"
  [2]=>
  string(5) "Knp\*"
  [3]=>
  string(8) "DateTime"
  [4]=>
  string(17) "DateTimeInterface"
}

see rectorphp/rector-doctrine#221 (comment)

The singleTon() is actually verify service registered once :)

@samsonasik
Copy link
Copy Markdown
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it to test in rector-doctrine with revert ::class on string class name.

@samsonasik samsonasik merged commit ea2252a into main Aug 29, 2023
@samsonasik samsonasik deleted the remove-is-bound branch August 29, 2023 16:35
@samsonasik
Copy link
Copy Markdown
Member Author

@TomasVotruba this is due to new Laravel Container release

https://github.com/laravel/framework/releases/tag/v10.21.0

that make $isBound no longer works on this rector-doctrine use case

@samsonasik samsonasik changed the title [Config] Remove $isBound usage as cause empty configuration on RectorConfig [Config] Remove $isBound usage as cause empty configuration on RectorConfig due to new Laravel Container release Aug 29, 2023
@TomasVotruba
Copy link
Copy Markdown
Member

I see, thanks for the update 🙂

@TomasVotruba
Copy link
Copy Markdown
Member

Do you know which PR exactly it is in Laravel? I could not find it in release notes

@samsonasik
Copy link
Copy Markdown
Member Author

I don't know, or probably the issue already persist before, just not touch rector-doctrine yet in a while before today, as I see, singleton() means the service only registered once.

@samsonasik
Copy link
Copy Markdown
Member Author

@TomasVotruba looking at the diff, the laravel container updated to 10.21.0, but it doesn't change anything in container namespace, so the bug seems already persist before

rectorphp/rector@dd35feb#diff-134cdda2651140171fadec5357839abe6bf05d517ce78dafc69476f024bf6b6a

@samsonasik samsonasik changed the title [Config] Remove $isBound usage as cause empty configuration on RectorConfig due to new Laravel Container release [Config] Remove $isBound usage as cause empty configuration on RectorConfig Aug 29, 2023
samsonasik referenced this pull request in rectorphp/rector Aug 29, 2023
@samsonasik
Copy link
Copy Markdown
Member Author

samsonasik commented Aug 29, 2023

@TomasVotruba ok, it seems the $isBound override is due to

https://github.com/rectorphp/rector-doctrine/blob/fabb3005d16e62ebf334332a3a17fe5115fcbf3e/rector.php#L22

which import LevelSetList::UP_TO_PHP_81 that already has StringClassNameToClassConstantRector inside sets with empty $classesToSkip configuration, then override after on specific class:

https://github.com/rectorphp/rector-doctrine/blob/fabb3005d16e62ebf334332a3a17fe5115fcbf3e/rector.php#L32

        'Doctrine\*',
        'Gedmo\*',
        'Knp\*',
        'DateTime',
        'DateTimeInterface',

then, the bug shown, as it only detect the first one (empty array), not merge due to inside sets vs single ruleWithConfiguration

The removal of $isBound check handle it.

@samsonasik
Copy link
Copy Markdown
Member Author

samsonasik commented Aug 29, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants