Skip to content

Commit decd902

Browse files
committed
fix the upgrade instructions and trigger deprecations
1 parent cb96291 commit decd902

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,33 @@ CHANGELOG
55
---
66

77
* Add `errors.php` and `webhook.php` routing configuration files (use them instead of their XML equivalent)
8+
9+
Before:
10+
11+
```yaml
12+
when@dev:
13+
_errors:
14+
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
15+
prefix: /_error
16+
17+
webhook:
18+
resource: '@FrameworkBundle/Resources/config/routing/webhook.xml'
19+
prefix: /webhook
20+
```
21+
22+
After:
23+
24+
```yaml
25+
when@dev:
26+
_errors:
27+
resource: '@FrameworkBundle/Resources/config/routing/errors.php'
28+
prefix: /_error
29+
30+
webhook:
31+
resource: '@FrameworkBundle/Resources/config/routing/webhook.php'
32+
prefix: /webhook
33+
```
34+
835
* Add support for the ObjectMapper component
936
* Add support for assets pre-compression
1037
* Rename `TranslationUpdateCommand` to `TranslationExtractCommand`

Resources/config/routing/errors.php

+11
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() 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 "errors.xml" routing configuration file is deprecated, import "errors.php" instead.');
20+
21+
break;
22+
}
23+
}
24+
}
25+
1526
$routes->add('_preview_error', '/{code}.{_format}')
1627
->controller('error_controller::preview')
1728
->defaults(['_format' => 'html'])

Resources/config/routing/webhook.php

+11
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() 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 "webhook.xml" routing configuration file is deprecated, import "webhook.php" instead.');
20+
21+
break;
22+
}
23+
}
24+
}
25+
1526
$routes->add('_webhook_controller', '/{type}')
1627
->controller('webhook_controller::handle')
1728
->requirements(['type' => '.+'])

0 commit comments

Comments
 (0)