You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #24738 [FrameworkBundle][Routing] Use a PSR-11 container in FrameworkBundle Router (ogizanagi)
This PR was merged into the 4.1-dev branch.
Discussion
----------
[FrameworkBundle][Routing] Use a PSR-11 container in FrameworkBundle Router
| Q | A
| ------------- | ---
| Branch? | 4.1 <!-- see comment below -->
| Bug fix? | no
| New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | not yet <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | N/A <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | N/A
~3.4 because~ it allows to make the `routing.loader` service private and add sense into implementing the `ServiceSubscriberInterface` in the `Router` by injecting a ServiceLocator instead of the DI container.
Should we deprecate passing a DI `ContainerInterface` instance without providing the `$paramFetcher` argument?
Move the whole `Router::resolve()` method into a dedicated `callable $paramResolver` ?
Commits
-------
5a2f295 [FrameworkBundle][Routing] Use a PSR-11 container & parameter bag in FrameworkBundle Router
thrownew \LogicException(sprintf('You should either pass a "%s" instance or provide the $parameters argument of the "%s" method.', SymfonyContainerInterface::class, __METHOD__));
60
+
}
51
61
}
52
62
53
63
/**
@@ -142,9 +152,7 @@ private function resolve($value)
142
152
return$value;
143
153
}
144
154
145
-
$container = $this->container;
146
-
147
-
$escapedValue = preg_replace_callback('/%%|%([^%\s]++)%/', function ($match) use ($container, $value) {
155
+
$escapedValue = preg_replace_callback('/%%|%([^%\s]++)%/', function ($match) use ($value) {
148
156
// skip %%
149
157
if (!isset($match[1])) {
150
158
return'%%';
@@ -154,7 +162,7 @@ private function resolve($value)
154
162
thrownewRuntimeException(sprintf('Using "%%%s%%" is not allowed in routing configuration.', $match[1]));
155
163
}
156
164
157
-
$resolved = $container->getParameter($match[1]);
165
+
$resolved = ($this->paramFetcher)($match[1]);
158
166
159
167
if (is_string($resolved) || is_numeric($resolved)) {
0 commit comments