Skip to content

Commit 153ae98

Browse files
[Routing][Serializer] Remove annotation aliases and getters and setters in favor of public properties on attributes
1 parent 87482ff commit 153ae98

File tree

21 files changed

+9
-493
lines changed

21 files changed

+9
-493
lines changed

UPGRADE-8.0.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ Routing
353353

354354
* Providing a non-array `_query` parameter to `UrlGenerator` causes an `InvalidParameterException`
355355
* Remove the protected `AttributeClassLoader::$routeAnnotationClass` property and the `setRouteAnnotationClass()` method, use `AttributeClassLoader::setRouteAttributeClass()` instead
356-
* Remove `getEnv()` and `setEnv()` methods of the `Route` attribute; use the plurialized `getEnvs()` and `setEnvs()` methods instead
356+
* Remove class aliases in the `Annotation` namespace, use attributes instead
357+
* Remove getters and setters in attribute classes in favor of public properties
357358

358359
Security
359360
--------
@@ -462,6 +463,8 @@ Serializer
462463
```
463464
* Remove `AdvancedNameConverterInterface`, use `NameConverterInterface` instead
464465
* Remove the `CompiledClassMetadataFactory` and `CompiledClassMetadataCacheWarmer` classes
466+
* Remove class aliases in the `Annotation` namespace, use attributes instead
467+
* Remove getters in attribute classes in favor of public properties
465468

466469
Translation
467470
-----------

src/Symfony/Component/Routing/Annotation/Route.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Symfony/Component/Routing/Attribute/DeprecatedAlias.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,4 @@ public function __construct(
2323
public readonly string $message = '',
2424
) {
2525
}
26-
27-
#[\Deprecated('Use the "message" property instead', 'symfony/routing:7.4')]
28-
public function getMessage(): string
29-
{
30-
return $this->message;
31-
}
32-
33-
#[\Deprecated('Use the "aliasName" property instead', 'symfony/routing:7.4')]
34-
public function getAliasName(): string
35-
{
36-
return $this->aliasName;
37-
}
38-
39-
#[\Deprecated('Use the "package" property instead', 'symfony/routing:7.4')]
40-
public function getPackage(): string
41-
{
42-
return $this->package;
43-
}
44-
45-
#[\Deprecated('Use the "version" property instead', 'symfony/routing:7.4')]
46-
public function getVersion(): string
47-
{
48-
return $this->version;
49-
}
5026
}

src/Symfony/Component/Routing/Attribute/Route.php

Lines changed: 0 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -88,177 +88,4 @@ public function __construct(
8888
$this->defaults['_stateless'] = $stateless;
8989
}
9090
}
91-
92-
#[\Deprecated('Use the "path" property instead', 'symfony/routing:7.4')]
93-
public function setPath(string $path): void
94-
{
95-
$this->path = $path;
96-
}
97-
98-
#[\Deprecated('Use the "path" property instead', 'symfony/routing:7.4')]
99-
public function getPath(): ?string
100-
{
101-
return \is_array($this->path) ? null : $this->path;
102-
}
103-
104-
#[\Deprecated('Use the "path" property instead', 'symfony/routing:7.4')]
105-
public function setLocalizedPaths(array $localizedPaths): void
106-
{
107-
$this->path = $localizedPaths;
108-
}
109-
110-
#[\Deprecated('Use the "path" property instead', 'symfony/routing:7.4')]
111-
public function getLocalizedPaths(): array
112-
{
113-
return \is_array($this->path) ? $this->path : [];
114-
}
115-
116-
#[\Deprecated('Use the "host" property instead', 'symfony/routing:7.4')]
117-
public function setHost(string $pattern): void
118-
{
119-
$this->host = $pattern;
120-
}
121-
122-
#[\Deprecated('Use the "host" property instead', 'symfony/routing:7.4')]
123-
public function getHost(): ?string
124-
{
125-
return $this->host;
126-
}
127-
128-
#[\Deprecated('Use the "name" property instead', 'symfony/routing:7.4')]
129-
public function setName(string $name): void
130-
{
131-
$this->name = $name;
132-
}
133-
134-
#[\Deprecated('Use the "name" property instead', 'symfony/routing:7.4')]
135-
public function getName(): ?string
136-
{
137-
return $this->name;
138-
}
139-
140-
#[\Deprecated('Use the "requirements" property instead', 'symfony/routing:7.4')]
141-
public function setRequirements(array $requirements): void
142-
{
143-
$this->requirements = $requirements;
144-
}
145-
146-
#[\Deprecated('Use the "requirements" property instead', 'symfony/routing:7.4')]
147-
public function getRequirements(): array
148-
{
149-
return $this->requirements;
150-
}
151-
152-
#[\Deprecated('Use the "options" property instead', 'symfony/routing:7.4')]
153-
public function setOptions(array $options): void
154-
{
155-
$this->options = $options;
156-
}
157-
158-
#[\Deprecated('Use the "options" property instead', 'symfony/routing:7.4')]
159-
public function getOptions(): array
160-
{
161-
return $this->options;
162-
}
163-
164-
#[\Deprecated('Use the "defaults" property instead', 'symfony/routing:7.4')]
165-
public function setDefaults(array $defaults): void
166-
{
167-
$this->defaults = $defaults;
168-
}
169-
170-
#[\Deprecated('Use the "defaults" property instead', 'symfony/routing:7.4')]
171-
public function getDefaults(): array
172-
{
173-
return $this->defaults;
174-
}
175-
176-
#[\Deprecated('Use the "schemes" property instead', 'symfony/routing:7.4')]
177-
public function setSchemes(array|string $schemes): void
178-
{
179-
$this->schemes = (array) $schemes;
180-
}
181-
182-
#[\Deprecated('Use the "schemes" property instead', 'symfony/routing:7.4')]
183-
public function getSchemes(): array
184-
{
185-
return $this->schemes;
186-
}
187-
188-
#[\Deprecated('Use the "methods" property instead', 'symfony/routing:7.4')]
189-
public function setMethods(array|string $methods): void
190-
{
191-
$this->methods = (array) $methods;
192-
}
193-
194-
#[\Deprecated('Use the "methods" property instead', 'symfony/routing:7.4')]
195-
public function getMethods(): array
196-
{
197-
return $this->methods;
198-
}
199-
200-
#[\Deprecated('Use the "condition" property instead', 'symfony/routing:7.4')]
201-
public function setCondition(?string $condition): void
202-
{
203-
$this->condition = $condition;
204-
}
205-
206-
#[\Deprecated('Use the "condition" property instead', 'symfony/routing:7.4')]
207-
public function getCondition(): ?string
208-
{
209-
return $this->condition;
210-
}
211-
212-
#[\Deprecated('Use the "priority" property instead', 'symfony/routing:7.4')]
213-
public function setPriority(int $priority): void
214-
{
215-
$this->priority = $priority;
216-
}
217-
218-
#[\Deprecated('Use the "priority" property instead', 'symfony/routing:7.4')]
219-
public function getPriority(): ?int
220-
{
221-
return $this->priority;
222-
}
223-
224-
#[\Deprecated('Use the "envs" property instead', 'symfony/routing:7.4')]
225-
public function setEnv(?string $env): void
226-
{
227-
$this->envs = (array) $env;
228-
}
229-
230-
#[\Deprecated('Use the "envs" property instead', 'symfony/routing:7.4')]
231-
public function getEnv(): ?string
232-
{
233-
if (!$this->envs) {
234-
return null;
235-
}
236-
if (\count($this->envs) > 1) {
237-
throw new LogicException(\sprintf('The "env" property has %d environments. Use "getEnvs()" to get all of them.', \count($this->envs)));
238-
}
239-
240-
return $this->envs[0];
241-
}
242-
243-
/**
244-
* @return (string|DeprecatedAlias)[]
245-
*/
246-
#[\Deprecated('Use the "aliases" property instead', 'symfony/routing:7.4')]
247-
public function getAliases(): array
248-
{
249-
return $this->aliases;
250-
}
251-
252-
/**
253-
* @param string|DeprecatedAlias|(string|DeprecatedAlias)[] $aliases
254-
*/
255-
#[\Deprecated('Use the "aliases" property instead', 'symfony/routing:7.4')]
256-
public function setAliases(string|DeprecatedAlias|array $aliases): void
257-
{
258-
$this->aliases = \is_array($aliases) ? $aliases : [$aliases];
259-
}
260-
}
261-
262-
if (!class_exists(\Symfony\Component\Routing\Annotation\Route::class, false)) {
263-
class_alias(Route::class, \Symfony\Component\Routing\Annotation\Route::class);
26491
}

src/Symfony/Component/Routing/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ CHANGELOG
66

77
* Providing a non-array `_query` parameter to `UrlGenerator` causes an `InvalidParameterException`
88
* Remove the protected `AttributeClassLoader::$routeAnnotationClass` property and the `setRouteAnnotationClass()` method, use `AttributeClassLoader::setRouteAttributeClass()` instead
9-
* Remove `getEnv()` and `setEnv()` methods of the `Route` attribute; use the plurialized `getEnvs()` and `setEnvs()` methods instead
9+
* Remove class aliases in the `Annotation` namespace, use attributes instead
10+
* Remove getters and setters in attribute classes in favor of public properties
1011

1112
7.4
1213
---

src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/RouteWithPriorityController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures;
44

5-
use Symfony\Component\Routing\Annotation\Route;
5+
use Symfony\Component\Routing\Attribute\Route;
66

77
class RouteWithPriorityController
88
{

src/Symfony/Component/Serializer/Annotation/Context.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Symfony/Component/Serializer/Annotation/DiscriminatorMap.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/Symfony/Component/Serializer/Annotation/Groups.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/Symfony/Component/Serializer/Annotation/Ignore.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)