Skip to content

Commit 9c813d2

Browse files
committed
feature #60862 [Routing] Remove deprecated AttributeClassLoader property and setter (mttsch)
This PR was merged into the 8.0 branch. Discussion ---------- [Routing] Remove deprecated AttributeClassLoader property and setter | Q | A | ------------- | --- | Branch? | 8.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Commits ------- 451ddc2 [Routing] Remove deprecated AttributeClassLoader property and setter
2 parents 878201c + 451ddc2 commit 9c813d2

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

UPGRADE-8.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ Routing
299299
-------
300300

301301
* Providing a non-array `_query` parameter to `UrlGenerator` causes an `InvalidParameterException`
302+
* Remove the protected `AttributeClassLoader::$routeAnnotationClass` property and the `setRouteAnnotationClass()` method, use `AttributeClassLoader::setRouteAttributeClass()` instead
302303

303304
Security
304305
--------

src/Symfony/Component/Routing/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Providing a non-array `_query` parameter to `UrlGenerator` causes an `InvalidParameterException`
8+
* Remove the protected `AttributeClassLoader::$routeAnnotationClass` property and the `setRouteAnnotationClass()` method, use `AttributeClassLoader::setRouteAttributeClass()` instead
89

910
7.4
1011
---

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)