[Php] Fix filter cache on PolyfillPackagesProvider#5390
Merged
samsonasik merged 3 commits intomainfrom Dec 25, 2023
Merged
Conversation
samsonasik
commented
Dec 25, 2023
| private function filterPolyfillPackages(array $require): array | ||
| { | ||
| return array_filter($require, static fn (string $packageName): bool => ! str_starts_with( | ||
| return array_filter(array_keys($require), static fn (string $packageName): bool => str_starts_with( |
Member
Author
There was a problem hiding this comment.
here only key is needed, when we define in composer.json
"require": {
"symfony/polyfill-php80" => "*"
}then, filter the str_starts_with() one instead, so it get data:
array('symfony/polyfill-php80')to compare with in_array() on PhpVersionedFilter
rector-src/packages/VersionBonding/PhpVersionedFilter.php
Lines 32 to 37 in 6ebab94
Member
Author
There was a problem hiding this comment.
I created e2e test for it:
samsonasik
commented
Dec 25, 2023
| if (! file_exists($projectComposerJson)) { | ||
| return []; | ||
| // already cached, even only empty array | ||
| if ($this->cachedPolyfillPackages !== null) { |
Member
Author
There was a problem hiding this comment.
here compare no null = already cached.
Member
Author
|
All checks have passed 🎉 @TomasVotruba I am merging it ;) |
Member
|
Awesome, thanks for catching the glitches 👌 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ref #5388 (review)