Skip to content

Commit 3225a15

Browse files
committed
Deprecate using XML routing configuration files
1 parent 2491a28 commit 3225a15

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

UPGRADE-7.3.md

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

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

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

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
;

0 commit comments

Comments
 (0)