Skip to content

Commit 60d27c1

Browse files
committed
[Routing] Remove deprecated AttributeClassLoader property and setter
1 parent bdd79bd commit 60d27c1

File tree

3 files changed

+12
-21
lines changed

3 files changed

+12
-21
lines changed

UPGRADE-8.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,11 @@ PropertyInfo
285285
}
286286
```
287287

288+
Routing
289+
-------
290+
291+
* Remove the protected `AttributeClassLoader::$routeAnnotationClass` property and the `setRouteAnnotationClass()` method, use `AttributeClassLoader::setRouteAttributeClass()` instead
292+
288293
Security
289294
--------
290295

src/Symfony/Component/Routing/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
8.0
5+
---
6+
7+
* Remove the protected `AttributeClassLoader::$routeAnnotationClass` property and the `setRouteAnnotationClass()` method, use `AttributeClassLoader::setRouteAttributeClass()` instead
8+
49
7.4
510
---
611

src/Symfony/Component/Routing/Loader/AttributeClassLoader.php

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@
5555
*/
5656
abstract class AttributeClassLoader implements LoaderInterface
5757
{
58-
/**
59-
* @deprecated since Symfony 7.2, use "setRouteAttributeClass()" instead.
60-
*/
61-
protected string $routeAnnotationClass = RouteAttribute::class;
6258
private string $routeAttributeClass = RouteAttribute::class;
6359
protected int $defaultRouteIndex = 0;
6460

@@ -67,24 +63,11 @@ public function __construct(
6763
) {
6864
}
6965

70-
/**
71-
* @deprecated since Symfony 7.2, use "setRouteAttributeClass(string $class)" instead
72-
*
73-
* Sets the annotation class to read route properties from.
74-
*/
75-
public function setRouteAnnotationClass(string $class): void
76-
{
77-
trigger_deprecation('symfony/routing', '7.2', 'The "%s()" method is deprecated, use "%s::setRouteAttributeClass()" instead.', __METHOD__, self::class);
78-
79-
$this->setRouteAttributeClass($class);
80-
}
81-
8266
/**
8367
* Sets the attribute class to read route properties from.
8468
*/
8569
public function setRouteAttributeClass(string $class): void
8670
{
87-
$this->routeAnnotationClass = $class;
8871
$this->routeAttributeClass = $class;
8972
}
9073

@@ -293,8 +276,7 @@ protected function getGlobals(\ReflectionClass $class): array
293276
{
294277
$globals = $this->resetGlobals();
295278

296-
// to be replaced in Symfony 8.0 by $this->routeAttributeClass
297-
if ($attribute = $class->getAttributes($this->routeAnnotationClass, \ReflectionAttribute::IS_INSTANCEOF)[0] ?? null) {
279+
if ($attribute = $class->getAttributes($this->routeAttributeClass, \ReflectionAttribute::IS_INSTANCEOF)[0] ?? null) {
298280
$attr = $attribute->newInstance();
299281

300282
if (null !== $attr->getName()) {
@@ -381,8 +363,7 @@ abstract protected function configureRoute(Route $route, \ReflectionClass $class
381363
*/
382364
private function getAttributes(\ReflectionClass|\ReflectionMethod $reflection): iterable
383365
{
384-
// to be replaced in Symfony 8.0 by $this->routeAttributeClass
385-
foreach ($reflection->getAttributes($this->routeAnnotationClass, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
366+
foreach ($reflection->getAttributes($this->routeAttributeClass, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
386367
yield $attribute->newInstance();
387368
}
388369
}

0 commit comments

Comments
 (0)