From 16fcdda18ed8c00b1fdc61527229e6436b1ccf6f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 3 Jul 2021 22:54:12 +0200 Subject: [PATCH] [HttpKernel] remove deprecated features --- .../FrameworkBundle/Test/TestContainer.php | 2 +- .../DependencyInjection/Container.php | 2 +- .../DependencyInjection/Dumper/PhpDumper.php | 2 +- .../schema/dic/services/services-1.0.xsd | 5 +-- ...efinitions_without_package_and_version.xml | 10 ----- .../Tests/Loader/XmlFileLoaderTest.php | 10 ----- .../Attribute/ArgumentInterface.php | 23 ----------- src/Symfony/Component/HttpKernel/CHANGELOG.md | 9 +++++ .../ContainerControllerResolver.php | 10 ----- .../Controller/ControllerResolver.php | 11 +----- .../ControllerMetadata/ArgumentMetadata.php | 16 -------- .../ControllerArgumentValueResolverPass.php | 25 +++--------- .../FragmentRendererPass.php | 19 ++------- ...RegisterControllerArgumentLocatorsPass.php | 39 ++++++------------- .../RegisterLocaleAwareServicesPass.php | 21 ++-------- ...oveEmptyControllerArgumentLocatorsPass.php | 13 +------ .../ResettableServicePass.php | 15 +------ .../HttpKernel/Event/KernelEvent.php | 14 ------- .../Exception/AccessDeniedHttpException.php | 13 +------ .../Exception/BadRequestHttpException.php | 13 +------ .../Exception/ConflictHttpException.php | 13 +------ .../Exception/GoneHttpException.php | 13 +------ .../HttpKernel/Exception/HttpException.php | 18 +-------- .../Exception/LengthRequiredHttpException.php | 13 +------ .../MethodNotAllowedHttpException.php | 18 +-------- .../Exception/NotAcceptableHttpException.php | 13 +------ .../Exception/NotFoundHttpException.php | 13 +------ .../PreconditionFailedHttpException.php | 13 +------ .../PreconditionRequiredHttpException.php | 13 +------ .../ServiceUnavailableHttpException.php | 13 +------ .../TooManyRequestsHttpException.php | 13 +------ .../Exception/UnauthorizedHttpException.php | 18 +-------- .../UnprocessableEntityHttpException.php | 13 +------ .../UnsupportedMediaTypeHttpException.php | 13 +------ .../Component/HttpKernel/HttpKernel.php | 1 - src/Symfony/Component/HttpKernel/Kernel.php | 6 +-- .../Component/HttpKernel/KernelInterface.php | 12 ++++-- .../ContainerControllerResolverTest.php | 33 ---------------- .../ResettableServicePassTest.php | 2 +- .../Component/HttpKernel/composer.json | 1 - src/Symfony/Component/Ldap/Entry.php | 6 +-- .../Component/Runtime/Tests/phpt/kernel.php | 2 +- 42 files changed, 73 insertions(+), 459 deletions(-) delete mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/deprecated_alias_definitions_without_package_and_version.xml delete mode 100644 src/Symfony/Component/HttpKernel/Attribute/ArgumentInterface.php diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php b/src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php index f5bb77c20acdb..7ccb549973901 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php @@ -106,7 +106,7 @@ public function has(string $id): bool /** * {@inheritdoc} */ - public function get(string $id, int $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1): ?object + public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE): ?object { return $this->getPrivateContainer()->has($id) ? $this->getPrivateContainer()->get($id) : $this->getPublicContainer()->get($id, $invalidBehavior); } diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 8a18259903251..c074e402e9afe 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -240,7 +240,7 @@ private function make(string $id, int $invalidBehavior) unset($this->loading[$id]); } - if (/* self::EXCEPTION_ON_INVALID_REFERENCE */ 1 === $invalidBehavior) { + if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) { if (!$id) { throw new ServiceNotFoundException($id); } diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 54f22116a1067..fe57f2e29c6f6 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1940,7 +1940,7 @@ private function getServiceCall(string $id, Reference $reference = null): string return 'null'; } if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE < $reference->getInvalidBehavior()) { - $code = sprintf('$this->get(%s, /* ContainerInterface::NULL_ON_INVALID_REFERENCE */ %d)', $this->doExport($id), ContainerInterface::NULL_ON_INVALID_REFERENCE); + $code = sprintf('$this->get(%s, ContainerInterface::NULL_ON_INVALID_REFERENCE)', $this->doExport($id)); } else { $code = sprintf('$this->get(%s)', $this->doExport($id)); } diff --git a/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd b/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd index 3c30002542e94..295b63b9d4ec6 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd +++ b/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd @@ -219,9 +219,8 @@ - - - + + diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/deprecated_alias_definitions_without_package_and_version.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/deprecated_alias_definitions_without_package_and_version.xml deleted file mode 100644 index 0c4401712d196..0000000000000 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/deprecated_alias_definitions_without_package_and_version.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - The "%alias_id%" service alias is deprecated. You should stop using it, as it will be removed in the future. - - - diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index 341b997882037..fcc3677b1bfce 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -466,16 +466,6 @@ public function testDeprecatedAliases() $this->assertSame($message, $container->getAlias('alias_for_foobar')->getDeprecation('alias_for_foobar')['message']); } - public function testDeprecatedAliaseWithoutPackageAndVersion() - { - $container = new ContainerBuilder(); - $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); - - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessageMatches('/^Missing attribute "package" at node "deprecated" in "[^"]*".$/'); - $loader->load('deprecated_alias_definitions_without_package_and_version.xml'); - } - public function testConvertDomElementToArray() { $doc = new \DOMDocument('1.0'); diff --git a/src/Symfony/Component/HttpKernel/Attribute/ArgumentInterface.php b/src/Symfony/Component/HttpKernel/Attribute/ArgumentInterface.php deleted file mode 100644 index 78769f1ac0bd2..0000000000000 --- a/src/Symfony/Component/HttpKernel/Attribute/ArgumentInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\Attribute; - -trigger_deprecation('symfony/http-kernel', '5.3', 'The "%s" interface is deprecated.', ArgumentInterface::class); - -/** - * Marker interface for controller argument attributes. - * - * @deprecated since Symfony 5.3 - */ -interface ArgumentInterface -{ -} diff --git a/src/Symfony/Component/HttpKernel/CHANGELOG.md b/src/Symfony/Component/HttpKernel/CHANGELOG.md index ed36ac8cbfbaa..f95e44f41a964 100644 --- a/src/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/src/Symfony/Component/HttpKernel/CHANGELOG.md @@ -1,6 +1,15 @@ CHANGELOG ========= +6.0 +--- + + * Remove `ArgumentInterface` + * Remove `ArgumentMetadata::getAttribute()`, use `getAttributes()` instead + * Remove support for returning a `ContainerBuilder` from `KernelInterface::registerContainerConfiguration()` + * Remove `KernelEvent::isMasterRequest()`, use `isMainRequest()` instead + * Remove support for `service:action` syntax to reference controllers, use `serviceOrFqcn::method` instead + 5.4 --- diff --git a/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php index 3b9468465c52c..8b7064313aa45 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php @@ -32,16 +32,6 @@ public function __construct(ContainerInterface $container, LoggerInterface $logg parent::__construct($logger); } - protected function createController(string $controller) - { - if (1 === substr_count($controller, ':')) { - $controller = str_replace(':', '::', $controller); - trigger_deprecation('symfony/http-kernel', '5.1', 'Referencing controllers with a single colon is deprecated. Use "%s" instead.', $controller); - } - - return parent::createController($controller); - } - /** * {@inheritdoc} */ diff --git a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php index 37d2a27f7b684..b0bf578759135 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php @@ -48,15 +48,8 @@ public function getController(Request $request) try { $controller[0] = $this->instantiateController($controller[0]); } catch (\Error | \LogicException $e) { - try { - // We cannot just check is_callable but have to use reflection because a non-static method - // can still be called statically in PHP but we don't want that. This is deprecated in PHP 7, so we - // could simplify this with PHP 8. - if ((new \ReflectionMethod($controller[0], $controller[1]))->isStatic()) { - return $controller; - } - } catch (\ReflectionException $reflectionException) { - throw $e; + if (\is_callable($controller)) { + return $controller; } throw $e; diff --git a/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadata.php b/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadata.php index 462d76f8939a9..cfc2f8974482d 100644 --- a/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadata.php +++ b/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadata.php @@ -11,8 +11,6 @@ namespace Symfony\Component\HttpKernel\ControllerMetadata; -use Symfony\Component\HttpKernel\Attribute\ArgumentInterface; - /** * Responsible for storing metadata of an argument. * @@ -114,20 +112,6 @@ public function getDefaultValue() return $this->defaultValue; } - /** - * Returns the attribute (if any) that was set on the argument. - */ - public function getAttribute(): ?ArgumentInterface - { - trigger_deprecation('symfony/http-kernel', '5.3', 'Method "%s()" is deprecated, use "getAttributes()" instead.', __METHOD__); - - if (!$this->attributes) { - return null; - } - - return $this->attributes[0] instanceof ArgumentInterface ? $this->attributes[0] : null; - } - /** * @return object[] */ diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/ControllerArgumentValueResolverPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/ControllerArgumentValueResolverPass.php index d925ed6b0eacb..281a7782953a0 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/ControllerArgumentValueResolverPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/ControllerArgumentValueResolverPass.php @@ -28,40 +28,25 @@ class ControllerArgumentValueResolverPass implements CompilerPassInterface { use PriorityTaggedServiceTrait; - private $argumentResolverService; - private $argumentValueResolverTag; - private $traceableResolverStopwatch; - - public function __construct(string $argumentResolverService = 'argument_resolver', string $argumentValueResolverTag = 'controller.argument_value_resolver', string $traceableResolverStopwatch = 'debug.stopwatch') - { - if (0 < \func_num_args()) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); - } - - $this->argumentResolverService = $argumentResolverService; - $this->argumentValueResolverTag = $argumentValueResolverTag; - $this->traceableResolverStopwatch = $traceableResolverStopwatch; - } - public function process(ContainerBuilder $container) { - if (!$container->hasDefinition($this->argumentResolverService)) { + if (!$container->hasDefinition('argument_resolver')) { return; } - $resolvers = $this->findAndSortTaggedServices($this->argumentValueResolverTag, $container); + $resolvers = $this->findAndSortTaggedServices('controller.argument_value_resolver', $container); - if ($container->getParameter('kernel.debug') && class_exists(Stopwatch::class) && $container->has($this->traceableResolverStopwatch)) { + if ($container->getParameter('kernel.debug') && class_exists(Stopwatch::class) && $container->has('debug.stopwatch')) { foreach ($resolvers as $resolverReference) { $id = (string) $resolverReference; $container->register("debug.$id", TraceableValueResolver::class) ->setDecoratedService($id) - ->setArguments([new Reference("debug.$id.inner"), new Reference($this->traceableResolverStopwatch)]); + ->setArguments([new Reference("debug.$id.inner"), new Reference('debug.stopwatch')]); } } $container - ->getDefinition($this->argumentResolverService) + ->getDefinition('argument_resolver') ->replaceArgument(1, new IteratorArgument($resolvers)) ; } diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/FragmentRendererPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/FragmentRendererPass.php index f26baeca9d0a7..ced62ae38078a 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/FragmentRendererPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/FragmentRendererPass.php @@ -25,28 +25,15 @@ */ class FragmentRendererPass implements CompilerPassInterface { - private $handlerService; - private $rendererTag; - - public function __construct(string $handlerService = 'fragment.handler', string $rendererTag = 'kernel.fragment_renderer') - { - if (0 < \func_num_args()) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); - } - - $this->handlerService = $handlerService; - $this->rendererTag = $rendererTag; - } - public function process(ContainerBuilder $container) { - if (!$container->hasDefinition($this->handlerService)) { + if (!$container->hasDefinition('fragment.handler')) { return; } - $definition = $container->getDefinition($this->handlerService); + $definition = $container->getDefinition('fragment.handler'); $renderers = []; - foreach ($container->findTaggedServiceIds($this->rendererTag, true) as $id => $tags) { + foreach ($container->findTaggedServiceIds('kernel.fragment_renderer', true) as $id => $tags) { $def = $container->getDefinition($id); $class = $container->getParameterBag()->resolveValue($def->getClass()); diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php index 9bebacd8c41f8..39fa8fc939309 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php @@ -33,26 +33,9 @@ */ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface { - private $resolverServiceId; - private $controllerTag; - private $controllerLocator; - private $notTaggedControllerResolverServiceId; - - public function __construct(string $resolverServiceId = 'argument_resolver.service', string $controllerTag = 'controller.service_arguments', string $controllerLocator = 'argument_resolver.controller_locator', string $notTaggedControllerResolverServiceId = 'argument_resolver.not_tagged_controller') - { - if (0 < \func_num_args()) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); - } - - $this->resolverServiceId = $resolverServiceId; - $this->controllerTag = $controllerTag; - $this->controllerLocator = $controllerLocator; - $this->notTaggedControllerResolverServiceId = $notTaggedControllerResolverServiceId; - } - public function process(ContainerBuilder $container) { - if (false === $container->hasDefinition($this->resolverServiceId) && false === $container->hasDefinition($this->notTaggedControllerResolverServiceId)) { + if (!$container->hasDefinition('argument_resolver.service') && !$container->hasDefinition('argument_resolver.not_tagged_controller')) { return; } @@ -66,7 +49,7 @@ public function process(ContainerBuilder $container) } } - foreach ($container->findTaggedServiceIds($this->controllerTag, true) as $id => $tags) { + foreach ($container->findTaggedServiceIds('controller.service_arguments', true) as $id => $tags) { $def = $container->getDefinition($id); $def->setPublic(true); $class = $def->getClass(); @@ -106,11 +89,11 @@ public function process(ContainerBuilder $container) } foreach (['action', 'argument', 'id'] as $k) { if (!isset($attributes[$k][0])) { - throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "%s" %s for service "%s".', $k, $this->controllerTag, json_encode($attributes, \JSON_UNESCAPED_UNICODE), $id)); + throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "controller.service_arguments" %s for service "%s".', $k, json_encode($attributes, \JSON_UNESCAPED_UNICODE), $id)); } } if (!isset($methods[$action = strtolower($attributes['action'])])) { - throw new InvalidArgumentException(sprintf('Invalid "action" attribute on tag "%s" for service "%s": no public "%s()" method found on class "%s".', $this->controllerTag, $id, $attributes['action'], $class)); + throw new InvalidArgumentException(sprintf('Invalid "action" attribute on tag "controller.service_arguments" for service "%s": no public "%s()" method found on class "%s".', $id, $attributes['action'], $class)); } [$r, $parameters] = $methods[$action]; $found = false; @@ -126,7 +109,7 @@ public function process(ContainerBuilder $container) } if (!$found) { - throw new InvalidArgumentException(sprintf('Invalid "%s" tag for service "%s": method "%s()" has no "%s" argument on class "%s".', $this->controllerTag, $id, $r->name, $attributes['argument'], $class)); + throw new InvalidArgumentException(sprintf('Invalid "controller.service_arguments" tag for service "%s": method "%s()" has no "%s" argument on class "%s".', $id, $r->name, $attributes['argument'], $class)); } } @@ -145,7 +128,7 @@ public function process(ContainerBuilder $container) if ('?' !== $target[0]) { $invalidBehavior = ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE; } elseif ('' === $target = (string) substr($target, 1)) { - throw new InvalidArgumentException(sprintf('A "%s" tag must have non-empty "id" attributes for service "%s".', $this->controllerTag, $id)); + throw new InvalidArgumentException(sprintf('A "controller.service_arguments" tag must have non-empty "id" attributes for service "%s".', $id)); } elseif ($p->allowsNull() && !$p->isOptional()) { $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; } @@ -205,16 +188,16 @@ public function process(ContainerBuilder $container) $controllerLocatorRef = ServiceLocatorTagPass::register($container, $controllers); - if ($container->hasDefinition($this->resolverServiceId)) { - $container->getDefinition($this->resolverServiceId) + if ($container->hasDefinition('argument_resolver.service')) { + $container->getDefinition('argument_resolver.service') ->replaceArgument(0, $controllerLocatorRef); } - if ($container->hasDefinition($this->notTaggedControllerResolverServiceId)) { - $container->getDefinition($this->notTaggedControllerResolverServiceId) + if ($container->hasDefinition('argument_resolver.not_tagged_controller')) { + $container->getDefinition('argument_resolver.not_tagged_controller') ->replaceArgument(0, $controllerLocatorRef); } - $container->setAlias($this->controllerLocator, (string) $controllerLocatorRef); + $container->setAlias('argument_resolver.controller_locator', (string) $controllerLocatorRef); } } diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterLocaleAwareServicesPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterLocaleAwareServicesPass.php index f0b801b8d6481..2141a510d62c0 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterLocaleAwareServicesPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterLocaleAwareServicesPass.php @@ -23,39 +23,26 @@ */ class RegisterLocaleAwareServicesPass implements CompilerPassInterface { - private $listenerServiceId; - private $localeAwareTag; - - public function __construct(string $listenerServiceId = 'locale_aware_listener', string $localeAwareTag = 'kernel.locale_aware') - { - if (0 < \func_num_args()) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); - } - - $this->listenerServiceId = $listenerServiceId; - $this->localeAwareTag = $localeAwareTag; - } - public function process(ContainerBuilder $container) { - if (!$container->hasDefinition($this->listenerServiceId)) { + if (!$container->hasDefinition('locale_aware_listener')) { return; } $services = []; - foreach ($container->findTaggedServiceIds($this->localeAwareTag) as $id => $tags) { + foreach ($container->findTaggedServiceIds('kernel.locale_aware') as $id => $tags) { $services[] = new Reference($id); } if (!$services) { - $container->removeDefinition($this->listenerServiceId); + $container->removeDefinition('locale_aware_listener'); return; } $container - ->getDefinition($this->listenerServiceId) + ->getDefinition('locale_aware_listener') ->setArgument(0, new IteratorArgument($services)) ; } diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php index 2d077a0cb5aa1..cbc92355d6873 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php @@ -21,20 +21,9 @@ */ class RemoveEmptyControllerArgumentLocatorsPass implements CompilerPassInterface { - private $controllerLocator; - - public function __construct(string $controllerLocator = 'argument_resolver.controller_locator') - { - if (0 < \func_num_args()) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); - } - - $this->controllerLocator = $controllerLocator; - } - public function process(ContainerBuilder $container) { - $controllerLocator = $container->findDefinition($this->controllerLocator); + $controllerLocator = $container->findDefinition('argument_resolver.controller_locator'); $controllers = $controllerLocator->getArgument(0); foreach ($controllers as $controller => $argumentRef) { diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/ResettableServicePass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/ResettableServicePass.php index 0cd8e6d7c935c..f6eec50901990 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/ResettableServicePass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/ResettableServicePass.php @@ -23,17 +23,6 @@ */ class ResettableServicePass implements CompilerPassInterface { - private $tagName; - - public function __construct(string $tagName = 'kernel.reset') - { - if (0 < \func_num_args()) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); - } - - $this->tagName = $tagName; - } - /** * {@inheritdoc} */ @@ -45,12 +34,12 @@ public function process(ContainerBuilder $container) $services = $methods = []; - foreach ($container->findTaggedServiceIds($this->tagName, true) as $id => $tags) { + foreach ($container->findTaggedServiceIds('kernel.reset', true) as $id => $tags) { $services[$id] = new Reference($id, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE); foreach ($tags as $attributes) { if (!isset($attributes['method'])) { - throw new RuntimeException(sprintf('Tag "%s" requires the "method" attribute to be set.', $this->tagName)); + throw new RuntimeException(sprintf('Tag "kernel.reset" requires the "method" attribute to be set on service "%s".', $id)); } if (!isset($methods[$id])) { diff --git a/src/Symfony/Component/HttpKernel/Event/KernelEvent.php b/src/Symfony/Component/HttpKernel/Event/KernelEvent.php index 8ede505c71460..bb68cc82559e1 100644 --- a/src/Symfony/Component/HttpKernel/Event/KernelEvent.php +++ b/src/Symfony/Component/HttpKernel/Event/KernelEvent.php @@ -75,18 +75,4 @@ public function isMainRequest(): bool { return HttpKernelInterface::MAIN_REQUEST === $this->requestType; } - - /** - * Checks if this is a master request. - * - * @return bool True if the request is a master request - * - * @deprecated since symfony/http-kernel 5.3, use isMainRequest() instead - */ - public function isMasterRequest() - { - trigger_deprecation('symfony/http-kernel', '5.3', '"%s()" is deprecated, use "isMainRequest()" instead.', __METHOD__); - - return $this->isMainRequest(); - } } diff --git a/src/Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.php b/src/Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.php index 58680a327838c..78e8fe37d69e8 100644 --- a/src/Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.php @@ -17,19 +17,8 @@ */ class AccessDeniedHttpException extends HttpException { - /** - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) + public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - parent::__construct(403, $message, $previous, $headers, $code); } } diff --git a/src/Symfony/Component/HttpKernel/Exception/BadRequestHttpException.php b/src/Symfony/Component/HttpKernel/Exception/BadRequestHttpException.php index f530f7db4927c..c920fbd0d6286 100644 --- a/src/Symfony/Component/HttpKernel/Exception/BadRequestHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/BadRequestHttpException.php @@ -16,19 +16,8 @@ */ class BadRequestHttpException extends HttpException { - /** - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) + public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - parent::__construct(400, $message, $previous, $headers, $code); } } diff --git a/src/Symfony/Component/HttpKernel/Exception/ConflictHttpException.php b/src/Symfony/Component/HttpKernel/Exception/ConflictHttpException.php index 79c36041c3f55..a5a6f8405c187 100644 --- a/src/Symfony/Component/HttpKernel/Exception/ConflictHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/ConflictHttpException.php @@ -16,19 +16,8 @@ */ class ConflictHttpException extends HttpException { - /** - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) + public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - parent::__construct(409, $message, $previous, $headers, $code); } } diff --git a/src/Symfony/Component/HttpKernel/Exception/GoneHttpException.php b/src/Symfony/Component/HttpKernel/Exception/GoneHttpException.php index 9ea65057b38f5..2893f05cbc74e 100644 --- a/src/Symfony/Component/HttpKernel/Exception/GoneHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/GoneHttpException.php @@ -16,19 +16,8 @@ */ class GoneHttpException extends HttpException { - /** - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) + public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - parent::__construct(410, $message, $previous, $headers, $code); } } diff --git a/src/Symfony/Component/HttpKernel/Exception/HttpException.php b/src/Symfony/Component/HttpKernel/Exception/HttpException.php index 249fe366d5b76..bdbf0bbf7be56 100644 --- a/src/Symfony/Component/HttpKernel/Exception/HttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/HttpException.php @@ -21,19 +21,8 @@ class HttpException extends \RuntimeException implements HttpExceptionInterface private $statusCode; private $headers; - public function __construct(int $statusCode, ?string $message = '', \Throwable $previous = null, array $headers = [], ?int $code = 0) + public function __construct(int $statusCode, string $message = '', \Throwable $previous = null, array $headers = [], int $code = 0) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - if (null === $code) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $code to "%s()" is deprecated, pass 0 instead.', __METHOD__); - - $code = 0; - } - $this->statusCode = $statusCode; $this->headers = $headers; @@ -50,11 +39,6 @@ public function getHeaders() return $this->headers; } - /** - * Set response headers. - * - * @param array $headers Response headers - */ public function setHeaders(array $headers) { $this->headers = $headers; diff --git a/src/Symfony/Component/HttpKernel/Exception/LengthRequiredHttpException.php b/src/Symfony/Component/HttpKernel/Exception/LengthRequiredHttpException.php index fcac13785220a..a3dd8b3cd73f1 100644 --- a/src/Symfony/Component/HttpKernel/Exception/LengthRequiredHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/LengthRequiredHttpException.php @@ -16,19 +16,8 @@ */ class LengthRequiredHttpException extends HttpException { - /** - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) + public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - parent::__construct(411, $message, $previous, $headers, $code); } } diff --git a/src/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php b/src/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php index 37576bcacb354..cfbaf5cb02e4f 100644 --- a/src/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php @@ -17,24 +17,10 @@ class MethodNotAllowedHttpException extends HttpException { /** - * @param string[] $allow An array of allowed methods - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int|null $code The internal exception code + * @param string[] $allow An array of allowed methods */ - public function __construct(array $allow, ?string $message = '', \Throwable $previous = null, ?int $code = 0, array $headers = []) + public function __construct(array $allow, string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - if (null === $code) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $code to "%s()" is deprecated, pass 0 instead.', __METHOD__); - - $code = 0; - } - $headers['Allow'] = strtoupper(implode(', ', $allow)); parent::__construct(405, $message, $previous, $headers, $code); diff --git a/src/Symfony/Component/HttpKernel/Exception/NotAcceptableHttpException.php b/src/Symfony/Component/HttpKernel/Exception/NotAcceptableHttpException.php index 5a422406ba715..ec2bb596fc0ea 100644 --- a/src/Symfony/Component/HttpKernel/Exception/NotAcceptableHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/NotAcceptableHttpException.php @@ -16,19 +16,8 @@ */ class NotAcceptableHttpException extends HttpException { - /** - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) + public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - parent::__construct(406, $message, $previous, $headers, $code); } } diff --git a/src/Symfony/Component/HttpKernel/Exception/NotFoundHttpException.php b/src/Symfony/Component/HttpKernel/Exception/NotFoundHttpException.php index a475113c5fe81..0e78fcc155cd8 100644 --- a/src/Symfony/Component/HttpKernel/Exception/NotFoundHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/NotFoundHttpException.php @@ -16,19 +16,8 @@ */ class NotFoundHttpException extends HttpException { - /** - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) + public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - parent::__construct(404, $message, $previous, $headers, $code); } } diff --git a/src/Symfony/Component/HttpKernel/Exception/PreconditionFailedHttpException.php b/src/Symfony/Component/HttpKernel/Exception/PreconditionFailedHttpException.php index e23740a28dcf2..4431f89d03776 100644 --- a/src/Symfony/Component/HttpKernel/Exception/PreconditionFailedHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/PreconditionFailedHttpException.php @@ -16,19 +16,8 @@ */ class PreconditionFailedHttpException extends HttpException { - /** - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) + public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - parent::__construct(412, $message, $previous, $headers, $code); } } diff --git a/src/Symfony/Component/HttpKernel/Exception/PreconditionRequiredHttpException.php b/src/Symfony/Component/HttpKernel/Exception/PreconditionRequiredHttpException.php index 5c31fae822b0c..f75afd3706ad8 100644 --- a/src/Symfony/Component/HttpKernel/Exception/PreconditionRequiredHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/PreconditionRequiredHttpException.php @@ -18,19 +18,8 @@ */ class PreconditionRequiredHttpException extends HttpException { - /** - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) + public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - parent::__construct(428, $message, $previous, $headers, $code); } } diff --git a/src/Symfony/Component/HttpKernel/Exception/ServiceUnavailableHttpException.php b/src/Symfony/Component/HttpKernel/Exception/ServiceUnavailableHttpException.php index 4785347d2c161..d4862bd109d51 100644 --- a/src/Symfony/Component/HttpKernel/Exception/ServiceUnavailableHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/ServiceUnavailableHttpException.php @@ -19,19 +19,8 @@ class ServiceUnavailableHttpException extends HttpException /** * @param int|string|null $retryAfter The number of seconds or HTTP-date after which the request may be retried */ - public function __construct(int|string $retryAfter = null, ?string $message = '', \Throwable $previous = null, ?int $code = 0, array $headers = []) + public function __construct(int|string $retryAfter = null, string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - if (null === $code) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $code to "%s()" is deprecated, pass 0 instead.', __METHOD__); - - $code = 0; - } - if ($retryAfter) { $headers['Retry-After'] = $retryAfter; } diff --git a/src/Symfony/Component/HttpKernel/Exception/TooManyRequestsHttpException.php b/src/Symfony/Component/HttpKernel/Exception/TooManyRequestsHttpException.php index 25621f020bea8..b71fb2508f217 100644 --- a/src/Symfony/Component/HttpKernel/Exception/TooManyRequestsHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/TooManyRequestsHttpException.php @@ -21,19 +21,8 @@ class TooManyRequestsHttpException extends HttpException /** * @param int|string|null $retryAfter The number of seconds or HTTP-date after which the request may be retried */ - public function __construct(int|string $retryAfter = null, ?string $message = '', \Throwable $previous = null, ?int $code = 0, array $headers = []) + public function __construct(int|string $retryAfter = null, string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - if (null === $code) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $code to "%s()" is deprecated, pass 0 instead.', __METHOD__); - - $code = 0; - } - if ($retryAfter) { $headers['Retry-After'] = $retryAfter; } diff --git a/src/Symfony/Component/HttpKernel/Exception/UnauthorizedHttpException.php b/src/Symfony/Component/HttpKernel/Exception/UnauthorizedHttpException.php index aeb9713a3ded6..c86686128100a 100644 --- a/src/Symfony/Component/HttpKernel/Exception/UnauthorizedHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/UnauthorizedHttpException.php @@ -17,24 +17,10 @@ class UnauthorizedHttpException extends HttpException { /** - * @param string $challenge WWW-Authenticate challenge string - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int|null $code The internal exception code + * @param string $challenge WWW-Authenticate challenge string */ - public function __construct(string $challenge, ?string $message = '', \Throwable $previous = null, ?int $code = 0, array $headers = []) + public function __construct(string $challenge, string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - if (null === $code) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $code to "%s()" is deprecated, pass 0 instead.', __METHOD__); - - $code = 0; - } - $headers['WWW-Authenticate'] = $challenge; parent::__construct(401, $message, $previous, $headers, $code); diff --git a/src/Symfony/Component/HttpKernel/Exception/UnprocessableEntityHttpException.php b/src/Symfony/Component/HttpKernel/Exception/UnprocessableEntityHttpException.php index 7b828b1d92ccb..d58af6c2b6677 100644 --- a/src/Symfony/Component/HttpKernel/Exception/UnprocessableEntityHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/UnprocessableEntityHttpException.php @@ -16,19 +16,8 @@ */ class UnprocessableEntityHttpException extends HttpException { - /** - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) + public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - parent::__construct(422, $message, $previous, $headers, $code); } } diff --git a/src/Symfony/Component/HttpKernel/Exception/UnsupportedMediaTypeHttpException.php b/src/Symfony/Component/HttpKernel/Exception/UnsupportedMediaTypeHttpException.php index 7908423f42580..3060f1f91810a 100644 --- a/src/Symfony/Component/HttpKernel/Exception/UnsupportedMediaTypeHttpException.php +++ b/src/Symfony/Component/HttpKernel/Exception/UnsupportedMediaTypeHttpException.php @@ -16,19 +16,8 @@ */ class UnsupportedMediaTypeHttpException extends HttpException { - /** - * @param string|null $message The internal exception message - * @param \Throwable|null $previous The previous exception - * @param int $code The internal exception code - */ - public function __construct(?string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) + public function __construct(string $message = '', \Throwable $previous = null, int $code = 0, array $headers = []) { - if (null === $message) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__); - - $message = ''; - } - parent::__construct(415, $message, $previous, $headers, $code); } } diff --git a/src/Symfony/Component/HttpKernel/HttpKernel.php b/src/Symfony/Component/HttpKernel/HttpKernel.php index 193672ae5707f..db691aa4f2915 100644 --- a/src/Symfony/Component/HttpKernel/HttpKernel.php +++ b/src/Symfony/Component/HttpKernel/HttpKernel.php @@ -33,7 +33,6 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; // Help opcache.preload discover always-needed symbols -class_exists(LegacyEventDispatcherProxy::class); class_exists(ControllerArgumentsEvent::class); class_exists(ControllerEvent::class); class_exists(ExceptionEvent::class); diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 0860d12ec7d48..acd12dc0db281 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -644,11 +644,7 @@ protected function buildContainer() $container = $this->getContainerBuilder(); $container->addObjectResource($this); $this->prepareContainer($container); - - if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) { - trigger_deprecation('symfony/http-kernel', '5.3', 'Returning a ContainerBuilder from "%s::registerContainerConfiguration()" is deprecated.', get_debug_type($this)); - $container->merge($cont); - } + $this->registerContainerConfiguration($this->getContainerLoader($container)); $container->addCompilerPass(new AddAnnotatedClassesToCachePass($this)); diff --git a/src/Symfony/Component/HttpKernel/KernelInterface.php b/src/Symfony/Component/HttpKernel/KernelInterface.php index c1be3aff43ee0..4a848ec022499 100644 --- a/src/Symfony/Component/HttpKernel/KernelInterface.php +++ b/src/Symfony/Component/HttpKernel/KernelInterface.php @@ -20,10 +20,6 @@ * * It manages an environment made of application kernel and bundles. * - * @method string getBuildDir() Returns the build directory - not implementing it is deprecated since Symfony 5.2. - * This directory should be used to store build artifacts, and can be read-only at runtime. - * Caches written at runtime should be stored in the "cache directory" ({@see KernelInterface::getCacheDir()}). - * * @author Fabien Potencier */ interface KernelInterface extends HttpKernelInterface @@ -133,6 +129,14 @@ public function getStartTime(); */ public function getCacheDir(); + /** + * Returns the build directory. + * + * This directory should be used to store build artifacts, and can be read-only at runtime. + * Caches written at runtime should be stored in the "cache directory" ({@see KernelInterface::getCacheDir()}). + */ + public function getBuildDir(): string; + /** * Gets the log directory. * diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php index 9ce7ec467ca8e..c8413caba2984 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php @@ -13,45 +13,12 @@ use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; -use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Controller\ContainerControllerResolver; class ContainerControllerResolverTest extends ControllerResolverTest { - use ExpectDeprecationTrait; - - /** - * @group legacy - */ - public function testGetControllerServiceWithSingleColon() - { - $this->expectDeprecation('Since symfony/http-kernel 5.1: Referencing controllers with a single colon is deprecated. Use "foo::action" instead.'); - - $service = new ControllerTestService('foo'); - - $container = $this->createMockContainer(); - $container->expects($this->once()) - ->method('has') - ->with('foo') - ->willReturn(true); - $container->expects($this->once()) - ->method('get') - ->with('foo') - ->willReturn($service) - ; - - $resolver = $this->createControllerResolver(null, $container); - $request = Request::create('/'); - $request->attributes->set('_controller', 'foo:action'); - - $controller = $resolver->getController($request); - - $this->assertSame($service, $controller[0]); - $this->assertSame('action', $controller[1]); - } - public function testGetControllerService() { $service = new ControllerTestService('foo'); diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php index 4c110e3a26800..67d9174aef0d1 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ResettableServicePassTest.php @@ -59,7 +59,7 @@ public function testCompilerPass() public function testMissingMethod() { $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Tag "kernel.reset" requires the "method" attribute to be set.'); + $this->expectExceptionMessage('Tag "kernel.reset" requires the "method" attribute to be set on service "Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService".'); $container = new ContainerBuilder(); $container->register(ResettableService::class) ->addTag('kernel.reset'); diff --git a/src/Symfony/Component/HttpKernel/composer.json b/src/Symfony/Component/HttpKernel/composer.json index 445d928bf9e3a..20932c82c90ef 100644 --- a/src/Symfony/Component/HttpKernel/composer.json +++ b/src/Symfony/Component/HttpKernel/composer.json @@ -17,7 +17,6 @@ ], "require": { "php": ">=8.0.2", - "symfony/deprecation-contracts": "^2.1", "symfony/error-handler": "^5.4|^6.0", "symfony/event-dispatcher": "^5.4|^6.0", "symfony/http-client-contracts": "^1.1|^2", diff --git a/src/Symfony/Component/Ldap/Entry.php b/src/Symfony/Component/Ldap/Entry.php index 71b675aa7006c..8493208a9e862 100644 --- a/src/Symfony/Component/Ldap/Entry.php +++ b/src/Symfony/Component/Ldap/Entry.php @@ -50,9 +50,8 @@ public function getDn() * * @return bool */ - public function hasAttribute(string $name/* , bool $caseSensitive = true */) + public function hasAttribute(string $name, bool $caseSensitive = true) { - $caseSensitive = 2 > \func_num_args() || true === func_get_arg(1); $attributeKey = $this->getAttributeKey($name, $caseSensitive); if (null === $attributeKey) { @@ -73,9 +72,8 @@ public function hasAttribute(string $name/* , bool $caseSensitive = true */) * * @return array|null */ - public function getAttribute(string $name/* , bool $caseSensitive = true */) + public function getAttribute(string $name, bool $caseSensitive = true) { - $caseSensitive = 2 > \func_num_args() || true === func_get_arg(1); $attributeKey = $this->getAttributeKey($name, $caseSensitive); if (null === $attributeKey) { diff --git a/src/Symfony/Component/Runtime/Tests/phpt/kernel.php b/src/Symfony/Component/Runtime/Tests/phpt/kernel.php index e4ca8366e8abe..99cca87c67fcd 100644 --- a/src/Symfony/Component/Runtime/Tests/phpt/kernel.php +++ b/src/Symfony/Component/Runtime/Tests/phpt/kernel.php @@ -15,7 +15,7 @@ public function __construct(string $var) $this->var = $var; } - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = true) { return new Response('OK Kernel '.$this->var); }