8000 SymfonyLevelSetList::UP_TO_SYMFONY_43 is too aggressive toward `CacheInterface` · Issue #390 · rectorphp/rector-symfony · GitHub
[go: up one dir, main page]

Skip to content

SymfonyLevelSetList::UP_TO_SYMFONY_43 is too aggressive toward CacheInterface #390

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

Closed
8000
Jean85 opened this issue Apr 17, 2023 · 7 comments · Fixed by #574
Closed

SymfonyLevelSetList::UP_TO_SYMFONY_43 is too aggressive toward CacheInterface #390

Jean85 opened this issue Apr 17, 2023 · 7 comments · Fixed by #574

Comments

@Jean85
Copy link
Contributor
Jean85 commented Apr 17, 2023

The SymfonyLevelSetList::UP_TO_SYMFONY_43 level set includes a RenameClassRector configuration for PSR-6's CacheInterface, which is definitely too aggressive:

'Psr\SimpleCache\CacheInterface' => 'Symfony\Contracts\Cache\CacheInterface',

This acts on any possible PSR-16 that I may have in my codebase, breaking them; also, since it's a RenameClassRector and not a specific rector, I cannot disable it in any way, apart from loosing any other possible rename RenameClassRector on that class.

Is there any workaround? What can I do?

@TomasVotruba
Copy link
Member

Hi, thanks for reporting. What was the original change in Symfony that invoke this?

@Jean85
Copy link
Contributor Author
Jean85 commented Apr 17, 2023

The set reports symfony/symfony#29236 a few rows above as a comment. That change makes some sense in a Symfony-only context, but if my code is to stay interoperable leveraging PSR-16, this rule will break that interop.

@TomasVotruba
Copy link
Member
TomasVotruba commented Apr 17, 2023

I see. This is a pickle as Rector can upgrade only A → B deterministics cases, so it will require bit hacking to get through :)

If you need to upgrade Symfony, but just somewhere, you can comment out this line, apply the upgrade set for Symfony 4.3, then change the cache classes yourself where needed. Then remove the Symfony 4.3 upgrade set and continue to Symfony 4.4 👍

@Jean85
Copy link
Contributor Author
Jean85 commented Apr 17, 2023

Thank you for the suggestion. Is there though a way to remove the 4.3 set without having to renounce to the whole UP_TO_SYMFONY_* LevelSets?

@TomasVotruba
Copy link
Member

If you need different behavior. Not really.

The best practice is to use those sets only for upgrade, not in long-term.

@TomasVotruba
Copy link
Member

This will help avoid these issues: rectorphp/rector-src#5477

@TomasVotruba
Copy link
Member

Resolved inhttps://github.com//pull/574

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 a pull request may close this issue.

2 participants
0