8000 Deprecate using XML routing configuration files · symfony/symfony@2a5aa45 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2a5aa45

Browse files
committed
Deprecate using XML routing configuration files
1 parent 2491a28 commit 2a5aa45

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed

UPGRADE-7.3.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,33 @@ FrameworkBundle
7676
public function __construct(#[Autowire('@serializer.normalizer.object')] NormalizerInterface $normalizer) {}
7777
```
7878

79+
* The XML routing configuration files (`errors.xml` and `webhook.xml`) are
80+
deprecated, use their PHP equivalent ones:
81+
82+
*Before*
83+
```yaml
84+
when@dev:
85+
_errors:
86+
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
87+
prefix: /_error
88+
89+
webhook:
90+
resource: '@FrameworkBundle/Resources/config/routing/webhook.xml'
91+
prefix: /webhook
92+
```
93+
94+
*After*
95+
```yaml
96+
when@dev:
97+
_errors:
98+
resource: '@FrameworkBundle/Resources/config/routing/errors.php'
99+
prefix: /_error
100+
101+
webhook:
102+
resource: '@FrameworkBundle/Resources/config/routing/webhook.php'
103+
prefix: /webhook
104+
```
105+
79106
HttpFoundation
80107
--------------
81108
@@ -112,6 +139,36 @@ PropertyInfo
112139
* Deprecate the `PropertyTypeExtractorInterface::getTypes()` method, use `PropertyTypeExtractorInterface::getType()` instead
113140
* Deprecate the `ConstructorArgumentTypeExtractorInterface::getTypesFromConstructor()` method, use `ConstructorArgumentTypeExtractorInterface::getTypeFromConstructor()` instead
114141

142+
Routing
143+
-------
144+
145+
* The XML routing configuration files (`profiler.xml` and `wdt.xml`) are
146+
deprecated, use their PHP equivalent ones:
147+
148+
*Before*
149+
```yaml
150+
when@dev:
151+
web_profiler_wdt:
152+
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
153+
prefix: /_wdt
154+
155+
web_profiler_profiler:
156+
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
157+
prefix: /_profiler
158+
```
159+
160+
*After*
161+
```yaml
162+
when@dev:
163+
web_profiler_wdt:
164+
resource: '@WebProfilerBundle/Resources/config/routing/wdt.php'
165+
prefix: /_wdt
166+
167+
web_profiler_profiler:
168+
resource: '@WebProfilerBundle/Resources/config/routing/profiler.php
169+
prefix: /_profiler
170+
```
171+
115172
Security
116173
--------
117174

src/Symfony/Bundle/WebProfilerBundle/Resources/config/routing/profiler.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,19 @@
1010
*/
1111

1212
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
13+
use Symfony\Component\Routing\Loader\XmlFileLoader;
1314

1415
return function (RoutingConfigurator $routes): void {
16+
foreach (debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT) as $trace) {
17+
if (isset($trace['object']) && $trace['object'] instanceof XmlFileLoader && 'doImport' === $trace['function']) {
18+
if (__DIR__ === dirname(realpath($trace['args'][3]))) {
19+
trigger_deprecation('symfony/routing', '7.3', 'The "profiler.xml" routing configuration file is deprecated, import "profile.php" instead.');
20+
21+
break;
22+
}
23+
}
24+
}
25+
1526
$routes->add('_profiler_home', '/')
1627
->controller('web_profiler.controller.profiler::homeAction')
1728
;

src/Symfony/Bundle/WebProfilerBundle/Resources/config/routing/wdt.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,19 @@
1010
*/
1111

1212
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
13+
use Symfony\Component\Routing\Loader\XmlFileLoader;
1314

1415
return function (RoutingConfigurator $routes): void {
16+
foreach (debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT) as $trace) {
17+
if (isset($trace['object']) && $trace['object'] instanceof XmlFileLoader && 'doImport' === $trace['function']) {
18+
if (__DIR__ === dirname(realpath($trace['args'][3]))) {
19+
trigger_deprecation('symfony/routing', '7.3', 'The "xdt.xml" routing configuration file is deprecated, import "xdt.php" instead.');
20+
21+
break;
22+
}
23+
}
24+
}
25+
1526
$routes->add('_wdt_stylesheet', '/styles')
1627
->controller('web_profiler.controller.profiler::toolbarStylesheetAction')
1728
;

src/Symfony/Bundle/WebProfilerBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"php": ">=8.2",
2020
"composer-runtime-api": ">=2.1",
2121
"symfony/config": "^7.3",
22+
"symfony/deprecation-contracts": "^2.5|^3",
2223
"symfony/framework-bundle": "^6.4|^7.0",
2324
"symfony/http-kernel": "^6.4|^7.0",
2425
"symfony/routing": "^6.4|^7.0",

0 commit comments

Comments
 (0)
0