|
11 | 11 |
|
12 | 12 | namespace Symfony\Component\Routing\Annotation;
|
13 | 13 |
|
14 |
| -/** |
15 |
| - * Annotation class for @Route(). |
16 |
| - * |
17 |
| - * @Annotation |
18 |
| - * @NamedArgumentConstructor |
19 |
| - * @Target({"CLASS", "METHOD"}) |
20 |
| - * |
21 |
| - * @author Fabien Potencier <fabien@symfony.com> |
22 |
| - * @author Alexander M. Turek <me@derrabus.de> |
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 |
155 | 15 |
|
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); |
250 | 17 |
|
251 |
| - public function getEnv(): ?string |
| 18 | +if (false) { |
| 19 | + #[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)] |
| 20 | + class Route |
252 | 21 | {
|
253 |
| - return $this->env; |
254 | 22 | }
|
255 | 23 | }
|
0 commit comments