Skip to content
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

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

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
6 participants
@Jean85
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

related: #31720

@stof

This comment has been minimized.

Copy link
Member

commented Jun 12, 2019

Psr16Cache::class does not call the autoloader.

@Jean85

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Member

commented Jun 12, 2019

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

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Member

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 nicolas-grekas referenced this pull request Jun 13, 2019

Closed

Add PSR-16 dependency #6

@nicolas-grekas

This comment has been minimized.

Copy link
Member

commented Jun 13, 2019

👎 for the given reasons.

@Jean85 Jean85 closed this Jun 13, 2019

@Jean85 Jean85 deleted the Jean85:patch-3 branch Jun 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.