You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if ('' === $strategy || !\is_callable([$this, $strategyMethod])) {
51
-
thrownew \InvalidArgumentException(sprintf('The strategy "%s" is not supported.', $strategy));
73
+
$this->voters = $voters;
74
+
if (\is_string($strategy)) {
75
+
trigger_deprecation('symfony/security-core', '5.4', 'Passing the access decision strategy as a string is deprecated, pass an instance of "%s" instead.', AccessDecisionStrategyInterface::class);
thrownew \TypeError(sprintf('"%s": Parameter #2 ($strategy) is expected to be an instance of "%s" or null, "%s" given.', __METHOD__, AccessDecisionStrategyInterface::class, get_debug_type($strategy)));
if (!\is_int($result) || !(self::VALID_VOTES[$result] ?? false)) {
96
116
trigger_deprecation('symfony/security-core', '5.3', 'Returning "%s" in "%s::vote()" is deprecated, return one of "%s" constants: "ACCESS_GRANTED", "ACCESS_DENIED" or "ACCESS_ABSTAIN".', var_export($result, true), get_debug_type($voter), VoterInterface::class);
97
117
}
98
-
}
99
118
100
-
if ($deny > 0) {
101
-
returnfalse;
119
+
yield$result;
102
120
}
103
-
104
-
return$this->allowIfAllAbstainDecisions;
105
121
}
106
122
107
123
/**
108
-
* Grants access if there is consensus of granted against denied responses.
109
-
*
110
-
* Consensus means majority-rule (ignoring abstains) rather than unanimous
111
-
* agreement (ignoring abstains). If you require unanimity, see
112
-
* UnanimousBased.
113
-
*
114
-
* If there were an equal number of grant and deny votes, the decision will
115
-
* be based on the allowIfEqualGrantedDeniedDecisions property value
116
-
* (defaults to true).
117
-
*
118
-
* If all voters abstained from voting, the decision will be based on the
119
-
* allowIfAllAbstainDecisions property value (defaults to false).
124
+
* @throws \InvalidArgumentException if the $strategy is invalid
trigger_deprecation('symfony/security-core', '5.3', 'Returning "%s" in "%s::vote()" is deprecated, return one of "%s" constants: "ACCESS_GRANTED", "ACCESS_DENIED" or "ACCESS_ABSTAIN".', var_export($result, true), get_debug_type($voter), VoterInterface::class);
trigger_deprecation('symfony/security-core', '5.3', 'Returning "%s" in "%s::vote()" is deprecated, return one of "%s" constants: "ACCESS_GRANTED", "ACCESS_DENIED" or "ACCESS_ABSTAIN".', var_export($result, true), get_debug_type($voter), VoterInterface::class);
173
-
}
174
-
}
175
-
}
176
-
177
-
// no deny votes
178
-
if ($grant > 0) {
179
-
returntrue;
180
-
}
181
-
182
-
return$this->allowIfAllAbstainDecisions;
139
+
thrownew \InvalidArgumentException(sprintf('The strategy "%s" is not supported.', $strategy));
183
140
}
184
141
185
142
/**
186
-
* Grant or deny access depending on the first voter that does not abstain.
187
-
* The priority of voters can be used to overrule a decision.
188
-
*
189
-
* If all voters abstained from voting, the decision will be based on the
190
-
* allowIfAllAbstainDecisions property value (defaults to false).
trigger_deprecation('symfony/security-core', '5.3', 'Returning "%s" in "%s::vote()" is deprecated, return one of "%s" constants: "ACCESS_GRANTED", "ACCESS_DENIED" or "ACCESS_ABSTAIN".', var_export($result, true), get_debug_type($voter), VoterInterface::class);
0 commit comments