Skip to content

[Cache] Fix missing requirement to PSR-16 #32004

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
wants to merge 1 commit into from
Closed

Conversation

Jean85
Copy link
Contributor

@Jean85 Jean85 commented Jun 12, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #31720
License MIT

Since 4.3, the PSR-6 adapter is deprecated in favor of the simpler PSR-16; the deprecation notice tries to load the PSR-16 class (due to calling Psr16Cache::class), which in turn breaks the autoloader, since
implements Psr\SimpleCache\CacheInterface, but that package is nowhere required in the entire component:

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', Psr6Cache::class, Psr16Cache::class), E_USER_DEPRECATED);

@derrabus
Copy link
Member

related: #31720

@stof
Copy link
Member

stof commented Jun 12, 2019

Psr16Cache::class does not call the autoloader.

@Jean85
Copy link
Contributor Author

Jean85 commented Jun 12, 2019

@stof obviously you're right, the culprit is extends Psr16Cache

@xabbuh xabbuh added this to the 4.3 milestone Jun 12, 2019
@nicolas-grekas
Copy link
Member

The policy we have in Symfony is to not mandate the dependency for optional features.
This is the case here: psr/simple-cache is an optional feature of symfony/cache
We don't consider removing a dependency a BC break, so we allow them in minor versions.

@Jean85
Copy link
Contributor Author

Jean85 commented Jun 12, 2019

How's that optional? That interface is now used in ANY implementation of the Cache components (due to the deprecation & extends), so whichever implementation I'll use, I'll need it.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jun 12, 2019

It's needed only if you use any PSR 16 implementation. No PSR 6 /SFContracts need it. See Symfony framework bundle: it uses the component but doesn't use PSR 16 at all.

@nicolas-grekas
Copy link
Member

👎 for the given reasons.

@Jean85 Jean85 closed this Jun 13, 2019
@Jean85 Jean85 deleted the patch-3 branch June 13, 2019 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants