Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee5e796

Browse files
committed
Add annotation -> attribute aliases
1 parent b228261 commit ee5e796

File tree

142 files changed

+809
-603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+809
-603
lines changed

src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/SerializerModelFixture.php

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

33
namespace Symfony\Bridge\Twig\Tests\Extension\Fixtures;
44

5-
use Symfony\Component\Serializer\Annotation\Groups;
5+
use Symfony\Component\Serializer\Attribute\Groups;
66

77
/**
88
* @author Jesse Rushlow <[email protected]>

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/RoutingConditionServiceBundle/Controller/DefaultController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\RoutingConditionServiceBundle\Controller;
1313

1414
use Symfony\Component\HttpFoundation\Response;
15-
use Symfony\Component\Routing\Annotation\Route;
15+
use Symfony\Component\Routing\Attribute\Route;
1616

1717
class DefaultController
1818
{

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php

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

1414
use Symfony\Component\HttpFoundation\Request;
1515
use Symfony\Component\HttpFoundation\Response;
16-
use Symfony\Component\Routing\Annotation\Route;
16+
use Symfony\Component\Routing\Attribute\Route;
1717

1818
class AnnotatedController
1919
{

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/UidController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller;
1313

1414
use Symfony\Component\HttpFoundation\Response;
15-
use Symfony\Component\Routing\Annotation\Route;
15+
use Symfony\Component\Routing\Attribute\Route;
1616
use Symfony\Component\Uid\Ulid;
1717
use Symfony\Component\Uid\UuidV1;
1818

src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/flex-style/src/FlexStyleMicroKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Symfony\Component\Filesystem\Filesystem;
1919
use Symfony\Component\HttpFoundation\Response;
2020
use Symfony\Component\HttpKernel\Kernel;
21-
use Symfony\Component\Routing\Annotation\Route;
21+
use Symfony\Component\Routing\Attribute\Route;
2222
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
2323

2424
class FlexStyleMicroKernel extends Kernel

src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php

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

1212
namespace Symfony\Component\PropertyInfo\Tests\Fixtures;
1313

14-
use Symfony\Component\Serializer\Annotation\Groups;
14+
use Symfony\Component\Serializer\Attribute\Groups;
1515

1616
/**
1717
* @author Kévin Dunglas <[email protected]>

src/Symfony/Component/PropertyInfo/Tests/Fixtures/IgnorePropertyDummy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\PropertyInfo\Tests\Fixtures;
1313

14-
use Symfony\Component\Serializer\Annotation\Groups;
15-
use Symfony\Component\Serializer\Annotation\Ignore;
14+
use Symfony\Component\Serializer\Attribute\Groups;
15+
use Symfony\Component\Serializer\Attribute\Ignore;
1616

1717
/**
1818
* @author Vadim Borodavko <[email protected]>

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

Lines changed: 5 additions & 237 deletions
Original file line numberDiff line numberDiff line change
@@ -11,245 +11,13 @@
1111

1212
namespace Symfony\Component\Routing\Annotation;
1313

14-
/**
15-
* Annotation class for @Route().
16-
*
17-
* @Annotation
18-
* @NamedArgumentConstructor
19-
* @Target({"CLASS", "METHOD"})
20-
*
21-
* @author Fabien Potencier <[email protected]>
22-
* @author Alexander M. Turek <[email protected]>
23-
*/
24-
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)]
25-
class Route
26-
{
27-
private ?string $path = null;
28-
private array $localizedPaths = [];
29-
private array $methods;
30-
private array $schemes;
31-
32-
/**
33-
* @param array<string|\Stringable> $requirements
34-
* @param string[]|string $methods
35-
* @param string[]|string $schemes
36-
*/
37-
public function __construct(
38-
string|array $path = null,
39-
private ?string $name = null,
40-
private array $requirements = [],
41-
private array $options = [],
42-
private array $defaults = [],
43-
private ?string $host = null,
44-
array|string $methods = [],
45-
array|string $schemes = [],
46-
private ?string $condition = null,
47-
private ?int $priority = null,
48-
string $locale = null,
49-
string $format = null,
50-
bool $utf8 = null,
51-
bool $stateless = null,
52-
private ?string $env = null
53-
) {
54-
if (\is_array($path)) {
55-
$this->localizedPaths = $path;
56-
} else {
57-
$this->path = $path;
58-
}
59-
$this->setMethods($methods);
60-
$this->setSchemes($schemes);
61-
62-
if (null !== $locale) {
63-
$this->defaults['_locale'] = $locale;
64-
}
65-
66-
if (null !== $format) {
67-
$this->defaults['_format'] = $format;
68-
}
69-
70-
if (null !== $utf8) {
71-
$this->options['utf8'] = $utf8;
72-
}
73-
74-
if (null !== $stateless) {
75-
$this->defaults['_stateless'] = $stateless;
76-
}
77-
}
78-
79-
/**
80-
* @return void
81-
*/
82-
public function setPath(string $path)
83-
{
84-
$this->path = $path;
85-
}
86-
87-
/**
88-
* @return string|null
89-
*/
90-
public function getPath()
91-
{
92-
return $this->path;
93-
}
94-
95-
/**
96-
* @return void
97-
*/
98-
public function setLocalizedPaths(array $localizedPaths)
99-
{
100-
$this->localizedPaths = $localizedPaths;
101-
}
102-
103-
public function getLocalizedPaths(): array
104-
{
105-
return $this->localizedPaths;
106-
}
107-
108-
/**
109-
* @return void
110-
*/
111-
public function setHost(string $pattern)
112-
{
113-
$this->host = $pattern;
114-
}
115-
116-
/**
117-
* @return string|null
118-
*/
119-
public function getHost()
120-
{
121-
return $this->host;
122-
}
123-
124-
/**
125-
* @return void
126-
*/
127-
public function setName(string $name)
128-
{
129-
$this->name = $name;
130-
}
131-
132-
/**
133-
* @return string|null
134-
*/
135-
public function getName()
136-
{
137-
return $this->name;
138-
}
139-
140-
/**
141-
* @return void
142-
*/
143-
public function setRequirements(array $requirements)
144-
{
145-
$this->requirements = $requirements;
146-
}
147-
148-
/**
149-
* @return array
150-
*/
151-
public function getRequirements()
152-
{
153-
return $this->requirements;
154-
}
14+
// do not deprecate in 6.4/7.0, to make it easier for the ecosystem to support 6.4, 7.4 and 8.0 simultaneously
15515

156-
/**
157-
* @return void
158-
*/
159-
public function setOptions(array $options)
160-
{
161-
$this->options = $options;
162-
}
163-
164-
/**
165-
* @return array
166-
*/
167-
public function getOptions()
168-
{
169-
return $this->options;
170-
}
171-
172-
/**
173-
* @return void
174-
*/
175-
public function setDefaults(array $defaults)
176-
{
177-
$this->defaults = $defaults;
178-
}
179-
180-
/**
181-
* @return array
182-
*/
183-
public function getDefaults()
184-
{
185-
return $this->defaults;
186-
}
187-
188-
/**
189-
* @return void
190-
*/
191-
public function setSchemes(array|string $schemes)
192-
{
193-
$this->schemes = (array) $schemes;
194-
}
195-
196-
/**
197-
* @return array
198-
*/
199-
public function getSchemes()
200-
{
201-
return $this->schemes;
202-
}
203-
204-
/**
205-
* @return void
206-
*/
207-
public function setMethods(array|string $methods)
208-
{
209-
$this->methods = (array) $methods;
210-
}
211-
212-
/**
213-
* @return array
214-
*/
215-
public function getMethods()
216-
{
217-
return $this->methods;
218-
}
219-
220-
/**
221-
* @return void
222-
*/
223-
public function setCondition(?string $condition)
224-
{
225-
$this->condition = $condition;
226-
}
227-
228-
/**
229-
* @return string|null
230-
*/
231-
public function getCondition()
232-
{
233-
return $this->condition;
234-
}
235-
236-
public function setPriority(int $priority): void
237-
{
238-
$this->priority = $priority;
239-
}
240-
241-
public function getPriority(): ?int
242-
{
243-
return $this->priority;
244-
}
245-
246-
public function setEnv(?string $env): void
247-
{
248-
$this->env = $env;
249-
}
16+
class_exists(\Symfony\Component\Routing\Attribute\Route::class);
25017

251-
public function getEnv(): ?string
18+
if (false) {
19+
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)]
20+
class Route
25221
{
253-
return $this->env;
25422
}
25523
}

0 commit comments

Comments
 (0)