Skip to content

Commit c0e076b

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [Console] Restore psr/log >= 3.0 conflict [Security] Make the abstract Voter class implement CacheableVoterInterface Add generic types to traversable implementations [Security] Fix TypeError message [Security] Fix deprecation layer [FrameworkBundle] Add completion for workflow:dump Fix cancel button Fix misleading error on missing provider with authenticator manager Don't limit retries of toolbar loading
2 parents f721c77 + 57ff35e commit c0e076b

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

Authorization/TraceableAccessDecisionManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function getStrategy(): string
9797
}
9898

9999
/**
100-
* @return iterable|VoterInterface[]
100+
* @return iterable<int, VoterInterface>
101101
*/
102102
public function getVoters(): iterable
103103
{

Authorization/Voter/Voter.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @author Roman Marintšenko <inoryy@gmail.com>
2020
* @author Grégoire Pineau <lyrixx@lyrixx.info>
2121
*/
22-
abstract class Voter implements VoterInterface
22+
abstract class Voter implements VoterInterface, CacheableVoterInterface
2323
{
2424
/**
2525
* {@inheritdoc}
@@ -54,6 +54,26 @@ public function vote(TokenInterface $token, mixed $subject, array $attributes):
5454
return $vote;
5555
}
5656

57+
/**
58+
* Return false if your voter doesn't support the given attribute. Symfony will cache
59+
* that decision and won't call your voter again for that attribute.
60+
*/
61+
public function supportsAttribute(string $attribute): bool
62+
{
63+
return true;
64+
}
65+
66+
/**
67+
* Return false if your voter doesn't support the given subject type. Symfony will cache
68+
* that decision and won't call your voter again for that subject type.
69+
*
70+
* @param string $subjectType The type of the subject inferred by `get_class()` or `get_debug_type()`
71+
*/
72+
public function supportsType(string $subjectType): bool
73+
{
74+
return true;
75+
}
76+
5777
/**
5878
* Determines if the attribute and subject are supported by this voter.
5979
*

User/ChainUserProvider.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public function __construct(iterable $providers)
3434
$this->providers = $providers;
3535
}
3636

37+
/**
38+
* @return UserProviderInterface[]
39+
*/
3740
public function getProviders(): array
3841
{
3942
if ($this->providers instanceof \Traversable) {

0 commit comments

Comments
 (0)