8000 Removed supports{Attribute,Class}() methods · symfony/symfony@6b6de15 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6b6de15

Browse files
committed
Removed supports{Attribute,Class}() methods
1 parent ed610df commit 6b6de15

File tree

4 files changed

+1
-150
lines changed

4 files changed

+1
-150
lines changed

src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -72,38 +72,6 @@ public function decide(TokenInterface $token, array $attributes, $object = null)
7272
return $this->{$this->strategy}($token, $attributes, $object);
7373
}
7474

75-
/**
76-
* {@inheritdoc}
77-
*/
78-
public function supportsAttribute($attribute)
79-
{
80-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.', E_USER_DEPRECATED);
81-
82-
foreach ($this->voters as $voter) {
83-
if ($voter->supportsAttribute($attribute)) {
84-
return true;
85-
}
86-
}
87-
88-
return false;
89-
}
90-
91-
/**
92-
* {@inheritdoc}
93-
*/
94-
public function supportsClass($class)
95-
{
96-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.', E_USER_DEPRECATED);
97-
98-
foreach ($this->voters as $voter) {
99-
if ($voter->supportsClass($class)) {
100-
return true;
101-
}
102-
}
103-
104-
return false;
105-
}
106-
10775
/**
10876
* Grants access if any voter returns an affirmative response.
10977
*

src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,4 @@ interface AccessDecisionManagerInterface
3030
* @return bool true if the access is granted, false otherwise
3131
*/
3232
public function decide(TokenInterface $token, array $attributes, $object = null);
33-
34-
/**
35-
* Checks if the access decision manager supports the given attribute.
36-
*
37-
* @param string $attribute An attribute
38-
*
39-
* @return bool true if this decision manager supports the attribute, false otherwise
40-
*
41-
* @deprecated since version 2.8, to be removed in 3.0.
42-
*/
43-
public function supportsAttribute($attribute);
44-
45-
/**
46-
* Checks if the access decision manager supports the given class.
47-
*
48-
* @param string $class A class name
49-
*
50-
* @return true if this decision manager can process the class
51-
*
52-
* @deprecated since version 2.8, to be removed in 3.0.
53-
*/
54-
public function supportsClass($class);
5533
}

src/Symfony/Component/Security/Core/Authorization/Voter/AbstractVoter.php

Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,6 @@
2121
*/
2222
abstract class AbstractVoter implements VoterInterface
2323
{
24-
/**
25-
* {@inheritdoc}
26-
*/
27-
public function supportsAttribute($attribute)
28-
{
29-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.', E_USER_DEPRECATED);
30-
31-
return in_array($attribute, $this->getSupportedAttributes());
32-
}
33-
34-
/**
35-
* {@inheritdoc}
36-
*/
37-
public function supportsClass($class)
38-
{
39-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.', E_USER_DEPRECATED);
40-
41-
foreach ($this->getSupportedClasses() as $supportedClass) {
42-
if ($supportedClass === $class || is_subclass_of($class, $supportedClass)) {
43-
return true;
44-
}
45-
}
46-
47-
return false;
48-
}
49-
5024
/**
5125
* Iteratively check all given attributes by calling isGranted.
5226
*
@@ -93,35 +67,12 @@ public function vote(TokenInterface $token, $object, array $attributes)
9367
* To determine if the passed class is instance of the supported class, the
9468
* isClassInstanceOf() method can be used.
9569
*
96-
* This method will become abstract in 3.0.
97-
*
9870
* @param string $attribute An attribute
9971
* @param string $class The fully qualified class name of the passed object
10072
*
10173
* @return bool True if the attribute and class is supported, false otherwise
10274
*/
103-
protected function supports($attribute, $class)
104-
{
105-
@trigger_error('The getSupportedClasses and getSupportedAttributes methods are deprecated since version 2.8 and will be removed in version 3.0. Overwrite supports instead.', E_USER_DEPRECATED);
106-
107-
$classIsSupported = false;
108-
foreach ($this->getSupportedClasses() as $supportedClass) {
109-
if ($this->isClassInstanceOf($class, $supportedClass)) {
110-
$classIsSupported = true;
111-
break;
112-
}
113-
}
114-
115-
if (!$classIsSupported) {
116-
return false;
117-
}
118-
119-
if (!in_array($attribute, $this->getSupportedAttributes())) {
120-
return false;
121-
}
122-
123-
return true;
124-
}
75+
abstract protected function supports($attribute, $class);
12576

12677
/**
12778
* A helper method to test if the actual class is instanceof or equal
@@ -137,30 +88,6 @@ protected function isClassInstanceOf($actualClass, $expectedClass)
13788
return $expectedClass === $actualClass || is_subclass_of($actualClass, $expectedClass);
13889
}
13990

140-
/**
141-
* Return an array of supported classes. This will be called by supportsClass.
142-
*
143-
* @return array an array of supported classes, i.e. array('Acme\DemoBundle\Model\Product')
144-
*
145-
* @deprecated since version 2.8, to be removed in 3.0. Use supports() instead.
146-
*/
147-
protected function getSupportedClasses()
148-
{
149-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.', E_USER_DEPRECATED);
150-
}
151-
152-
/**
153-
* Return an array of supported attributes. This will be called by supportsAttribute.
154-
*
155-
* @return array an array of supported attributes, i.e. array('CREATE', 'READ')
156-
*
157-
* @deprecated since version 2.8, to be removed in 3.0. Use supports() instead.
158-
*/
159-
protected function getSupportedAttributes()
160-
{
161-
@trigger_error('The '.__METHOD__.' is deprecated since version 2.8 and will be removed in version 3.0.', E_USER_DEPRECATED);
162-
}
163-
16491
/**
16592
* Perform a single access check operation on a given attribute, object and (optionally) user
16693
* It is safe to assume that $attribute and $object's class pass supportsAttribute/supportsClass

src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,6 @@ interface VoterInterface
2424
const ACCESS_ABSTAIN = 0;
2525
const ACCESS_DENIED = -1;
2626

27-
/**
28-
* Checks if the voter supports the given attribute.
29-
*
30-
* @param string $attribute An attribute
31-
*
32-
* @return bool true if this Voter supports the attribute, false otherwise
33-
*
34-
* @deprecated since version 2.8, to be removed in 3.0.
35-
*/
36-
public function supportsAttribute($attribute);
37-
38-
/**
39-
* Checks if the voter supports the given class.
40-
*
41-
* @param string $class A class name
42-
*
43-
* @return bool true if this Voter can process the class
44-
*
45-
* @deprecated since version 2.8, to be removed in 3.0.
46-
*/
47-
public function supportsClass($class);
48-
4927
/**
5028
* Returns the vote for the given parameters.
5129
*

0 commit comments

Comments
 (0)
0