diff --git a/UPGRADE-7.0.md b/UPGRADE-7.0.md index 4c294b66bffc8..5c9f4feddf0de 100644 --- a/UPGRADE-7.0.md +++ b/UPGRADE-7.0.md @@ -72,6 +72,11 @@ HttpKernel ---------- * Add argument `$reflector` to `ArgumentResolverInterface::getArguments()` and `ArgumentMetadataFactoryInterface::createArgumentMetadata()` + * Remove `ArgumentValueResolverInterface`, use `ValueResolverInterface` instead + * Remove `StreamedResponseListener` + * Remove `AbstractSurrogate::$phpEscapeMap` + * Remove `HttpKernelInterface::MASTER_REQUEST` + * Remove `terminate_on_cache_hit` option from `HttpCache` Lock ---- diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 4b79ab73634fc..f5ddf2fac6aa3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -95,7 +95,6 @@ use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\BackedEnumValueResolver; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\UidValueResolver; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; use Symfony\Component\HttpKernel\DependencyInjection\Extension; @@ -596,8 +595,6 @@ public function load(array $configs, ContainerBuilder $container): void ->addTag('container.service_locator'); $container->registerForAutoconfiguration(ServiceSubscriberInterface::class) ->addTag('container.service_subscriber'); - $container->registerForAutoconfiguration(ArgumentValueResolverInterface::class) - ->addTag('controller.argument_value_resolver'); $container->registerForAutoconfiguration(ValueResolverInterface::class) ->addTag('controller.argument_value_resolver'); $container->registerForAutoconfiguration(AbstractController::class) diff --git a/src/Symfony/Component/HttpKernel/CHANGELOG.md b/src/Symfony/Component/HttpKernel/CHANGELOG.md index 2fa31e8350eb0..9c094bdb0ebc8 100644 --- a/src/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/src/Symfony/Component/HttpKernel/CHANGELOG.md @@ -5,6 +5,11 @@ CHANGELOG --- * Add argument `$reflector` to `ArgumentResolverInterface::getArguments()` and `ArgumentMetadataFactoryInterface::createArgumentMetadata()` + * Remove `ArgumentValueResolverInterface`, use `ValueResolverInterface` instead + * Remove `StreamedResponseListener` + * Remove `AbstractSurrogate::$phpEscapeMap` + * Remove `HttpKernelInterface::MASTER_REQUEST` + * Remove `terminate_on_cache_hit` option from `HttpCache` 6.4 --- diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php index 3b0f89509f65c..58131225a6386 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php @@ -18,7 +18,6 @@ use Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestAttributeValueResolver; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestValueResolver; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\SessionValueResolver; -use Symfony\Component\HttpKernel\Controller\ArgumentResolver\TraceableValueResolver; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\VariadicValueResolver; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactory; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactoryInterface; @@ -37,7 +36,7 @@ final class ArgumentResolver implements ArgumentResolverInterface private ?ContainerInterface $namedResolvers; /** - * @param iterable $argumentValueResolvers + * @param iterable $argumentValueResolvers */ public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = [], ContainerInterface $namedResolvers = null) { @@ -79,9 +78,6 @@ public function getArguments(Request $request, callable $controller, \Reflection } foreach ($argumentValueResolvers as $name => $resolver) { - if ((!$resolver instanceof ValueResolverInterface || $resolver instanceof TraceableValueResolver) && !$resolver->supports($request, $metadata)) { - continue; - } if (isset($disabledResolvers[\is_int($name) ? $resolver::class : $name])) { continue; } @@ -100,10 +96,6 @@ public function getArguments(Request $request, callable $controller, \Reflection // continue to the next controller argument continue 2; } - - if (!$resolver instanceof ValueResolverInterface) { - throw new \InvalidArgumentException(sprintf('"%s::resolve()" must yield at least one value.', get_debug_type($resolver))); - } } throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or there is a non-optional argument after this one.', $this->getPrettyName($controller), $metadata->getName())); @@ -113,7 +105,7 @@ public function getArguments(Request $request, callable $controller, \Reflection } /** - * @return iterable + * @return iterable */ public static function getDefaultArgumentValueResolvers(): iterable { diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/BackedEnumValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/BackedEnumValueResolver.php index 95205dfd0af69..e5c9a91b95da8 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/BackedEnumValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/BackedEnumValueResolver.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -23,30 +22,8 @@ * * @author Maxime Steinhausser */ -final class BackedEnumValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface +final class BackedEnumValueResolver implements ValueResolverInterface { - /** - * @deprecated since Symfony 6.2, use resolve() instead - */ - public function supports(Request $request, ArgumentMetadata $argument): bool - { - @trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__); - - if (!is_subclass_of($argument->getType(), \BackedEnum::class)) { - return false; - } - - if ($argument->isVariadic()) { - // only target route path parameters, which cannot be variadic. - return false; - } - - // do not support if no value can be resolved at all - // letting the \Symfony\Component\HttpKernel\Controller\ArgumentResolver\DefaultValueResolver be used - // or \Symfony\Component\HttpKernel\Controller\ArgumentResolver fail with a meaningful error. - return $request->attributes->has($argument->getName()); - } - public function resolve(Request $request, ArgumentMetadata $argument): iterable { if (!is_subclass_of($argument->getType(), \BackedEnum::class)) { diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DateTimeValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DateTimeValueResolver.php index 0cfd42badc974..981ebf60a7e51 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DateTimeValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DateTimeValueResolver.php @@ -14,7 +14,6 @@ use Psr\Clock\ClockInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Attribute\MapDateTime; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -25,23 +24,13 @@ * @author Benjamin Eberlei * @author Tim Goudriaan */ -final class DateTimeValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface +final class DateTimeValueResolver implements ValueResolverInterface { public function __construct( private readonly ?ClockInterface $clock = null, ) { } - /** - * @deprecated since Symfony 6.2, use resolve() instead - */ - public function supports(Request $request, ArgumentMetadata $argument): bool - { - @trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__); - - return is_a($argument->getType(), \DateTimeInterface::class, true) && $request->attributes->has($argument->getName()); - } - public function resolve(Request $request, ArgumentMetadata $argument): array { if (!is_a($argument->getType(), \DateTimeInterface::class, true) || !$request->attributes->has($argument->getName())) { diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php index eb9769c09ab17..bf114f3f31352 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; @@ -21,18 +20,8 @@ * * @author Iltar van der Berg */ -final class DefaultValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface +final class DefaultValueResolver implements ValueResolverInterface { - /** - * @deprecated since Symfony 6.2, use resolve() instead - */ - public function supports(Request $request, ArgumentMetadata $argument): bool - { - @trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__); - - return $argument->hasDefaultValue() || (null !== $argument->getType() && $argument->isNullable() && !$argument->isVariadic()); - } - public function resolve(Request $request, ArgumentMetadata $argument): array { if ($argument->hasDefaultValue()) { diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php index 26403612880fe..547580e1f8a2f 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php @@ -14,7 +14,6 @@ use Psr\Container\ContainerInterface; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; @@ -23,39 +22,11 @@ * * @author Simeon Kolev */ -final class NotTaggedControllerValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface +final class NotTaggedControllerValueResolver implements ValueResolverInterface { - private ContainerInterface $container; - - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - /** - * @deprecated since Symfony 6.2, use resolve() instead - */ - public function supports(Request $request, ArgumentMetadata $argument): bool - { - @trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__); - - $controller = $request->attributes->get('_controller'); - - if (\is_array($controller) && \is_callable($controller, true) && \is_string($controller[0])) { - $controller = $controller[0].'::'.$controller[1]; - } elseif (!\is_string($controller) || '' === $controller) { - return false; - } - - if ('\\' === $controller[0]) { - $controller = ltrim($controller, '\\'); - } - - if (!$this->container->has($controller) && false !== $i = strrpos($controller, ':')) { - $controller = substr($controller, 0, $i).strtolower(substr($controller, $i)); - } - - return false === $this->container->has($controller); + public function __construct( + private ContainerInterface $container, + ) { } public function resolve(Request $request, ArgumentMetadata $argument): array diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php index 370e414451d21..2a8d48ee30174 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; @@ -21,18 +20,8 @@ * * @author Iltar van der Berg */ -final class RequestAttributeValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface +final class RequestAttributeValueResolver implements ValueResolverInterface { - /** - * @deprecated since Symfony 6.2, use resolve() instead - */ - public function supports(Request $request, ArgumentMetadata $argument): bool - { - @trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__); - - return !$argument->isVariadic() && $request->attributes->has($argument->getName()); - } - public function resolve(Request $request, ArgumentMetadata $argument): array { return !$argument->isVariadic() && $request->attributes->has($argument->getName()) ? [$request->attributes->get($argument->getName())] : []; diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php index 6347f70196681..bf2d2a0af6bc9 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; @@ -21,18 +20,8 @@ * * @author Iltar van der Berg */ -final class RequestValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface +final class RequestValueResolver implements ValueResolverInterface { - /** - * @deprecated since Symfony 6.2, use resolve() instead - */ - public function supports(Request $request, ArgumentMetadata $argument): bool - { - @trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__); - - return Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class); - } - public function resolve(Request $request, ArgumentMetadata $argument): array { return Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class) ? [$request] : []; diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php index 96e0337d6ac3e..5953257ff572b 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php @@ -14,7 +14,6 @@ use Psr\Container\ContainerInterface; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; @@ -23,7 +22,7 @@ * * @author Nicolas Grekas */ -final class ServiceValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface +final class ServiceValueResolver implements ValueResolverInterface { private ContainerInterface $container; @@ -32,32 +31,6 @@ public function __construct(ContainerInterface $container) $this->container = $container; } - /** - * @deprecated since Symfony 6.2, use resolve() instead - */ - public function supports(Request $request, ArgumentMetadata $argument): bool - { - @trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__); - - $controller = $request->attributes->get('_controller'); - - if (\is_array($controller) && \is_callable($controller, true) && \is_string($controller[0])) { - $controller = $controller[0].'::'.$controller[1]; - } elseif (!\is_string($controller) || '' === $controller) { - return false; - } - - if ('\\' === $controller[0]) { - $controller = ltrim($controller, '\\'); - } - - if (!$this->container->has($controller) && false !== $i = strrpos($controller, ':')) { - $controller = substr($controller, 0, $i).strtolower(substr($controller, $i)); - } - - return $this->container->has($controller) && $this->container->get($controller)->has($argument->getName()); - } - public function resolve(Request $request, ArgumentMetadata $argument): array { $controller = $request->attributes->get('_controller'); diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php index c8e7575d5397a..30b7f1d7493c7 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php @@ -13,7 +13,6 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\SessionInterface; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; @@ -22,27 +21,8 @@ * * @author Iltar van der Berg */ -final class SessionValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface +final class SessionValueResolver implements ValueResolverInterface { - /** - * @deprecated since Symfony 6.2, use resolve() instead - */ - public function supports(Request $request, ArgumentMetadata $argument): bool - { - @trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__); - - if (!$request->hasSession()) { - return false; - } - - $type = $argument->getType(); - if (SessionInterface::class !== $type && !is_subclass_of($type, SessionInterface::class)) { - return false; - } - - return $request->getSession() instanceof $type; - } - public function resolve(Request $request, ArgumentMetadata $argument): array { if (!$request->hasSession()) { diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/TraceableValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/TraceableValueResolver.php index 0cb4703b29a16..41fd1d9ae9885 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/TraceableValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/TraceableValueResolver.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; use Symfony\Component\Stopwatch\Stopwatch; @@ -22,34 +21,12 @@ * * @author Iltar van der Berg */ -final class TraceableValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface +final class TraceableValueResolver implements ValueResolverInterface { - private ArgumentValueResolverInterface|ValueResolverInterface $inner; - private Stopwatch $stopwatch; - - public function __construct(ArgumentValueResolverInterface|ValueResolverInterface $inner, Stopwatch $stopwatch) - { - $this->inner = $inner; - $this->stopwatch = $stopwatch; - } - - /** - * @deprecated since Symfony 6.2, use resolve() instead - */ - public function supports(Request $request, ArgumentMetadata $argument): bool - { - if ($this->inner instanceof ValueResolverInterface) { - return true; - } - - $method = $this->inner::class.'::'.__FUNCTION__; - $this->stopwatch->start($method, 'controller.argument_value_resolver'); - - $return = $this->inner->supports($request, $argument); - - $this->stopwatch->stop($method); - - return $return; + public function __construct( + private ValueResolverInterface $inner, + private Stopwatch $stopwatch, + ) { } public function resolve(Request $request, ArgumentMetadata $argument): iterable diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/UidValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/UidValueResolver.php index 437b770a70edf..a6f06b5df4258 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/UidValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/UidValueResolver.php @@ -12,27 +12,13 @@ namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Uid\AbstractUid; -final class UidValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface +final class UidValueResolver implements ValueResolverInterface { - /** - * @deprecated since Symfony 6.2, use resolve() instead - */ - public function supports(Request $request, ArgumentMetadata $argument): bool - { - @trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__); - - return !$argument->isVariadic() - && \is_string($request->attributes->get($argument->getName())) - && null !== $argument->getType() - && is_subclass_of($argument->getType(), AbstractUid::class, true); - } - public function resolve(Request $request, ArgumentMetadata $argument): array { if ($argument->isVariadic() diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php index 4f6cba729e2f6..1297cca42ef0e 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; @@ -21,18 +20,8 @@ * * @author Iltar van der Berg */ -final class VariadicValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface +final class VariadicValueResolver implements ValueResolverInterface { - /** - * @deprecated since Symfony 6.2, use resolve() instead - */ - public function supports(Request $request, ArgumentMetadata $argument): bool - { - @trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__); - - return $argument->isVariadic() && $request->attributes->has($argument->getName()); - } - public function resolve(Request $request, ArgumentMetadata $argument): array { if (!$argument->isVariadic() || !$request->attributes->has($argument->getName())) { diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentValueResolverInterface.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentValueResolverInterface.php deleted file mode 100644 index 9c3b1a016218a..0000000000000 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentValueResolverInterface.php +++ /dev/null @@ -1,35 +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\Controller; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; - -/** - * Responsible for resolving the value of an argument based on its metadata. - * - * @author Iltar van der Berg - * - * @deprecated since Symfony 6.2, implement ValueResolverInterface instead - */ -interface ArgumentValueResolverInterface -{ - /** - * Whether this resolver can resolve the value for the given ArgumentMetadata. - */ - public function supports(Request $request, ArgumentMetadata $argument): bool; - - /** - * Returns the possible value(s). - */ - public function resolve(Request $request, ArgumentMetadata $argument): iterable; -} diff --git a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php index d229ba3be3979..012a45b5bee4e 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php @@ -30,12 +30,8 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte /** * Sets the Kernel associated with this Request. */ - public function setKernel(KernelInterface $kernel = null): void + public function setKernel(KernelInterface $kernel): void { - if (1 > \func_num_args()) { - trigger_deprecation('symfony/http-kernel', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__); - } - $this->kernel = $kernel; } diff --git a/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php b/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php deleted file mode 100644 index 312d5ee23b68e..0000000000000 --- a/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php +++ /dev/null @@ -1,55 +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\EventListener; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpKernel\Event\ResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; - -trigger_deprecation('symfony/http-kernel', '6.1', 'The "%s" class is deprecated.', StreamedResponseListener::class); - -/** - * StreamedResponseListener is responsible for sending the Response - * to the client. - * - * @author Fabien Potencier - * - * @final - * - * @deprecated since Symfony 6.1 - */ -class StreamedResponseListener implements EventSubscriberInterface -{ - /** - * Filters the Response. - */ - public function onKernelResponse(ResponseEvent $event): void - { - if (!$event->isMainRequest()) { - return; - } - - $response = $event->getResponse(); - - if ($response instanceof StreamedResponse) { - $response->send(); - } - } - - public static function getSubscribedEvents(): array - { - return [ - KernelEvents::RESPONSE => ['onKernelResponse', -1024], - ]; - } -} diff --git a/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php b/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php index 95518bed2bbdd..e3f4d9552d7da 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php @@ -25,14 +25,6 @@ abstract class AbstractSurrogate implements SurrogateInterface { protected $contentTypes; - /** - * @deprecated since Symfony 6.3 - */ - protected $phpEscapeMap = [ - ['', '', '', ''], - ]; - /** * @param array $contentTypes An array of content-type that should be parsed for Surrogate information * (default: text/html, text/xml, application/xhtml+xml, and application/xml) diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php index eabacfec6272c..1698c3d21ff85 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php @@ -83,11 +83,6 @@ class HttpCache implements HttpKernelInterface, TerminableInterface * the cache can serve a stale response when an error is encountered (default: 60). * This setting is overridden by the stale-if-error HTTP Cache-Control extension * (see RFC 5861). - * - * * terminate_on_cache_hit Specifies if the kernel.terminate event should be dispatched even when the cache - * was hit (default: true). - * Unless your application needs to process events on cache hits, it is recommended - * to set this to false to avoid having to bootstrap the Symfony framework on a cache hit. */ public function __construct(HttpKernelInterface $kernel, StoreInterface $store, SurrogateInterface $surrogate = null, array $options = []) { @@ -109,7 +104,6 @@ public function __construct(HttpKernelInterface $kernel, StoreInterface $store, 'stale_if_error' => 60, 'trace_level' => 'none', 'trace_header' => 'X-Symfony-Cache', - 'terminate_on_cache_hit' => true, ], $options); if (!isset($options['trace_level'])) { @@ -250,9 +244,7 @@ public function terminate(Request $request, Response $response) // Do not call any listeners in case of a cache hit. // This ensures identical behavior as if you had a separate // reverse caching proxy such as Varnish and the like. - if ($this->options['terminate_on_cache_hit']) { - trigger_deprecation('symfony/http-kernel', '6.2', 'Setting "terminate_on_cache_hit" to "true" is deprecated and will be changed to "false" in Symfony 7.0.'); - } elseif (\in_array('fresh', $this->traces[$this->getTraceKey($request)] ?? [], true)) { + if (\in_array('fresh', $this->traces[$this->getTraceKey($request)] ?? [], true)) { return; } diff --git a/src/Symfony/Component/HttpKernel/HttpKernelInterface.php b/src/Symfony/Component/HttpKernel/HttpKernelInterface.php index f6c017a4c5e4f..e9415677f72f2 100644 --- a/src/Symfony/Component/HttpKernel/HttpKernelInterface.php +++ b/src/Symfony/Component/HttpKernel/HttpKernelInterface.php @@ -24,12 +24,6 @@ interface HttpKernelInterface public const MAIN_REQUEST = 1; public const SUB_REQUEST = 2; - /** - * @deprecated since symfony/http-kernel 5.3, use MAIN_REQUEST instead. - * To ease the migration, this constant won't be removed until Symfony 7.0. - */ - public const MASTER_REQUEST = self::MAIN_REQUEST; - /** * Handles a Request to convert it to a Response. * diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 76205bc0b8312..563b663262484 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -678,30 +678,14 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container } } - $inlineFactories = false; - if (isset($buildParameters['.container.dumper.inline_factories'])) { - $inlineFactories = $buildParameters['.container.dumper.inline_factories']; - } elseif ($container->hasParameter('container.dumper.inline_factories')) { - trigger_deprecation('symfony/http-kernel', '6.3', 'Parameter "%s" is deprecated, use ".%1$s" instead.', 'container.dumper.inline_factories'); - $inlineFactories = $container->getParameter('container.dumper.inline_factories'); - } - - $inlineClassLoader = $this->debug; - if (isset($buildParameters['.container.dumper.inline_class_loader'])) { - $inlineClassLoader = $buildParameters['.container.dumper.inline_class_loader']; - } elseif ($container->hasParameter('container.dumper.inline_class_loader')) { - trigger_deprecation('symfony/http-kernel', '6.3', 'Parameter "%s" is deprecated, use ".%1$s" instead.', 'container.dumper.inline_class_loader'); - $inlineClassLoader = $container->getParameter('container.dumper.inline_class_loader'); - } - $content = $dumper->dump([ 'class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath(), 'as_files' => true, 'debug' => $this->debug, - 'inline_factories' => $inlineFactories, - 'inline_class_loader' => $inlineClassLoader, + 'inline_factories' => $buildParameters['.container.dumper.inline_factories'] ?? false, + 'inline_class_loader' => $buildParameters['.container.dumper.inline_class_loader'] ?? $this->debug, 'build_time' => $container->hasParameter('kernel.container_build_time') ? $container->getParameter('kernel.container_build_time') : time(), 'preload_classes' => array_map('get_class', $this->bundles), ]); diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/BackedEnumValueResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/BackedEnumValueResolverTest.php index 9e2986273653a..5c6b5d065726f 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/BackedEnumValueResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/BackedEnumValueResolverTest.php @@ -21,20 +21,13 @@ class BackedEnumValueResolverTest extends TestCase { /** - * In Symfony 7, keep this test case but remove the call to supports(). - * - * @group legacy - * * @dataProvider provideTestSupportsData */ public function testSupports(Request $request, ArgumentMetadata $metadata, bool $expectedSupport) { $resolver = new BackedEnumValueResolver(); - if (!$expectedSupport) { - $this->assertSame([], $resolver->resolve($request, $metadata)); - } - self::assertSame($expectedSupport, $resolver->supports($request, $metadata)); + $this->assertCount((int) $expectedSupport, $resolver->resolve($request, $metadata)); } public static function provideTestSupportsData(): iterable diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/DateTimeValueResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/DateTimeValueResolverTest.php index 6529ca9f7640b..636c811f98264 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/DateTimeValueResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/DateTimeValueResolverTest.php @@ -50,26 +50,6 @@ public static function getClasses() yield [FooDateTime::class]; } - /** - * @group legacy - */ - public function testSupports() - { - $resolver = new DateTimeValueResolver(); - - $argument = new ArgumentMetadata('dummy', \DateTime::class, false, false, null); - $request = self::requestWithAttributes(['dummy' => 'now']); - $this->assertTrue($resolver->supports($request, $argument)); - - $argument = new ArgumentMetadata('dummy', FooDateTime::class, false, false, null); - $request = self::requestWithAttributes(['dummy' => 'now']); - $this->assertTrue($resolver->supports($request, $argument)); - - $argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null); - $request = self::requestWithAttributes(['dummy' => 'now']); - $this->assertFalse($resolver->supports($request, $argument)); - } - public function testUnsupportedArgument() { $resolver = new DateTimeValueResolver(); diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/NotTaggedControllerValueResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/NotTaggedControllerValueResolverTest.php index e28f8d513092c..3fc74a1d701f5 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/NotTaggedControllerValueResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/NotTaggedControllerValueResolverTest.php @@ -20,23 +20,6 @@ class NotTaggedControllerValueResolverTest extends TestCase { - /** - * @group legacy - */ - public function testDoSupportWhenControllerDoNotExists() - { - $resolver = new NotTaggedControllerValueResolver(new ServiceLocator([])); - $argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null); - $request = $this->requestWithAttributes(['_controller' => 'my_controller']); - - $this->assertTrue($resolver->supports($request, $argument)); - } - - /** - * In Symfony 7, keep this test case but remove the call to supports(). - * - * @group legacy - */ public function testDoNotSupportWhenControllerExists() { $resolver = new NotTaggedControllerValueResolver(new ServiceLocator([ @@ -47,21 +30,14 @@ public function testDoNotSupportWhenControllerExists() $argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null); $request = $this->requestWithAttributes(['_controller' => 'App\\Controller\\Mine::method']); $this->assertSame([], $resolver->resolve($request, $argument)); - $this->assertFalse($resolver->supports($request, $argument)); } - /** - * In Symfony 7, keep this test case but remove the call to supports(). - * - * @group legacy - */ public function testDoNotSupportEmptyController() { $resolver = new NotTaggedControllerValueResolver(new ServiceLocator([])); $argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null); $request = $this->requestWithAttributes(['_controller' => '']); $this->assertSame([], $resolver->resolve($request, $argument)); - $this->assertFalse($resolver->supports($request, $argument)); } public function testController() @@ -104,11 +80,6 @@ public function testControllerNameIsAnArray() $resolver->resolve($request, $argument); } - /** - * In Symfony 7, keep this test case but remove the call to supports(). - * - * @group legacy - */ public function testInvokableController() { $this->expectException(RuntimeException::class); @@ -116,7 +87,6 @@ public function testInvokableController() $resolver = new NotTaggedControllerValueResolver(new ServiceLocator([])); $argument = new ArgumentMetadata('dummy', \stdClass::class, false, false, null); $request = $this->requestWithAttributes(['_controller' => 'App\Controller\Mine']); - $this->assertTrue($resolver->supports($request, $argument)); $resolver->resolve($request, $argument); } diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php index 63a35b41246ae..df248047d0ea1 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php @@ -22,11 +22,6 @@ class ServiceValueResolverTest extends TestCase { - /** - * In Symfony 7, keep this test case but remove the call to supports(). - * - * @group legacy - */ public function testDoNotSupportWhenControllerDoNotExists() { $resolver = new ServiceValueResolver(new ServiceLocator([])); @@ -34,7 +29,6 @@ public function testDoNotSupportWhenControllerDoNotExists() $request = $this->requestWithAttributes(['_controller' => 'my_controller']); $this->assertSame([], $resolver->resolve($request, $argument)); - $this->assertFalse($resolver->supports($request, $argument)); } public function testExistingController() diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/TraceableValueResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/TraceableValueResolverTest.php index bf5c42f8c2cfa..5ede33ccb3974 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/TraceableValueResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/TraceableValueResolverTest.php @@ -14,28 +14,12 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\TraceableValueResolver; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; +use Symfony\Component\HttpKernel\Controller\ValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; use Symfony\Component\Stopwatch\Stopwatch; class TraceableValueResolverTest extends TestCase { - /** - * @group legacy - */ - public function testTimingsInSupports() - { - $stopwatch = new Stopwatch(); - $resolver = new TraceableValueResolver(new ResolverStub(), $stopwatch); - $argument = new ArgumentMetadata('dummy', 'string', false, false, null); - $request = new Request(); - - $this->assertTrue($resolver->supports($request, $argument)); - - $event = $stopwatch->getEvent(ResolverStub::class.'::supports'); - $this->assertCount(1, $event->getPeriods()); - } - public function testTimingsInResolve() { $stopwatch = new Stopwatch(); @@ -64,13 +48,8 @@ public function testTimingsInResolve() } } -class ResolverStub implements ArgumentValueResolverInterface +class ResolverStub implements ValueResolverInterface { - public function supports(Request $request, ArgumentMetadata $argument): bool - { - return true; - } - public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield 'first'; diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/UidValueResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/UidValueResolverTest.php index cc43417508e52..1da4d976a2083 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/UidValueResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/UidValueResolverTest.php @@ -25,19 +25,11 @@ class UidValueResolverTest extends TestCase { /** - * In Symfony 7, keep this test case but remove the call to supports(). - * - * @group legacy - * * @dataProvider provideSupports */ public function testSupports(bool $expected, Request $request, ArgumentMetadata $argument) { - if (!$expected) { - $this->assertSame([], (new UidValueResolver())->resolve($request, $argument)); - } - - $this->assertSame($expected, (new UidValueResolver())->supports($request, $argument)); + $this->assertCount((int) $expected, (new UidValueResolver())->resolve($request, $argument)); } public static function provideSupports() @@ -50,10 +42,8 @@ public static function provideSupports() 'Argument type is not a class' => [false, new Request([], [], ['foo' => (string) $uuidV4]), new ArgumentMetadata('foo', 'string', false, false, null)], 'Argument type is not a subclass of AbstractUid' => [false, new Request([], [], ['foo' => (string) $uuidV4]), new ArgumentMetadata('foo', UlidFactory::class, false, false, null)], 'AbstractUid is not supported' => [false, new Request([], [], ['foo' => (string) $uuidV4]), new ArgumentMetadata('foo', AbstractUid::class, false, false, null)], - 'Custom abstract subclass is supported but will fail in resolve' => [true, new Request([], [], ['foo' => (string) $uuidV4]), new ArgumentMetadata('foo', TestAbstractCustomUid::class, false, false, null)], 'Known subclass' => [true, new Request([], [], ['foo' => (string) $uuidV4]), new ArgumentMetadata('foo', UuidV4::class, false, false, null)], 'Format does not matter' => [true, new Request([], [], ['foo' => (string) $uuidV4]), new ArgumentMetadata('foo', Ulid::class, false, false, null)], - 'Custom subclass' => [true, new Request([], [], ['foo' => '01FPND7BD15ZV07X5VGDXAJ8VD']), new ArgumentMetadata('foo', TestCustomUid::class, false, false, null)], ]; } diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php index ef44f45bae078..34c0028d1511f 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php @@ -21,7 +21,6 @@ use Symfony\Component\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\DefaultValueResolver; use Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestAttributeValueResolver; -use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactory; use Symfony\Component\HttpKernel\Exception\ResolverNotFoundException; use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\ExtendingRequest; @@ -176,25 +175,6 @@ public function testGetVariadicArgumentsWithoutArrayInRequest() self::getResolver()->getArguments($request, $controller); } - /** - * @group legacy - */ - public function testGetArgumentWithoutArray() - { - $this->expectException(\InvalidArgumentException::class); - $valueResolver = $this->createMock(ArgumentValueResolverInterface::class); - $resolver = self::getResolver([$valueResolver]); - - $valueResolver->expects($this->any())->method('supports')->willReturn(true); - $valueResolver->expects($this->any())->method('resolve')->willReturn([]); - - $request = Request::create('/'); - $request->attributes->set('foo', 'foo'); - $request->attributes->set('bar', 'foo'); - $controller = $this->controllerWithFooAndDefaultBar(...); - $resolver->getArguments($request, $controller); - } - public function testIfExceptionIsThrownWhenMissingAnArgument() { $this->expectException(\RuntimeException::class); diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php index ae1ff9e2a54e8..b3e096d11e5d5 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php @@ -37,7 +37,7 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface() // does not implement TerminableInterface $kernel = new TestKernel(); - $httpCache = new HttpCache($kernel, $storeMock, null, ['terminate_on_cache_hit' => false]); + $httpCache = new HttpCache($kernel, $storeMock); $httpCache->terminate(Request::create('/'), new Response()); $this->assertFalse($kernel->terminateCalled, 'terminate() is never called if the kernel class does not implement TerminableInterface'); @@ -51,7 +51,7 @@ public function testTerminateDelegatesTerminationOnlyForTerminableInterface() $kernelMock->expects($this->once()) ->method('terminate'); - $kernel = new HttpCache($kernelMock, $storeMock, null, ['terminate_on_cache_hit' => false]); + $kernel = new HttpCache($kernelMock, $storeMock); $kernel->terminate(Request::create('/'), new Response()); } @@ -101,58 +101,6 @@ public function testDoesNotCallTerminateOnFreshResponse() $this->assertCount(1, $terminateEvents); } - /** - * @group legacy - */ - public function testDoesCallTerminateOnFreshResponseIfConfigured() - { - $this->expectDeprecation('Since symfony/http-kernel 6.2: Setting "terminate_on_cache_hit" to "true" is deprecated and will be changed to "false" in Symfony 7.0.'); - - $terminateEvents = []; - - $eventDispatcher = $this->createMock(EventDispatcher::class); - $eventDispatcher - ->expects($this->any()) - ->method('dispatch') - ->with($this->callback(function ($event) use (&$terminateEvents) { - if ($event instanceof TerminateEvent) { - $terminateEvents[] = $event; - } - - return true; - })); - - $this->setNextResponse( - 200, - [ - 'ETag' => '1234', - 'Cache-Control' => 'public, s-maxage=60', - ], - 'Hello World', - null, - $eventDispatcher - ); - $this->cacheConfig['terminate_on_cache_hit'] = true; - - $this->request('GET', '/'); - $this->assertHttpKernelIsCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('miss'); - $this->assertTraceContains('store'); - $this->cache->terminate($this->request, $this->response); - - sleep(2); - - $this->request('GET', '/'); - $this->assertHttpKernelIsNotCalled(); - $this->assertEquals(200, $this->response->getStatusCode()); - $this->assertTraceContains('fresh'); - $this->assertEquals(2, $this->response->headers->get('Age')); - $this->cache->terminate($this->request, $this->response); - - $this->assertCount(2, $terminateEvents); - } - public function testPassesOnNonGetHeadRequests() { $this->setNextResponse(200); diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php index a5a240a6265ec..7fc0e49ef0c03 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php @@ -51,7 +51,7 @@ public function testRequestStackIsNotBrokenWhenControllerThrowsAnExceptionAndCat $kernel = $this->getHttpKernel(new EventDispatcher(), function () { throw new \RuntimeException(); }, $requestStack); try { - $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true); + $kernel->handle(new Request(), HttpKernelInterface::MAIN_REQUEST, true); } catch (\Throwable $exception) { } @@ -64,7 +64,7 @@ public function testRequestStackIsNotBrokenWhenControllerThrowsAnExceptionAndCat $kernel = $this->getHttpKernel(new EventDispatcher(), function () { throw new \RuntimeException(); }, $requestStack); try { - $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, false); + $kernel->handle(new Request(), HttpKernelInterface::MAIN_REQUEST, false); } catch (\Throwable $exception) { } @@ -77,7 +77,7 @@ public function testRequestStackIsNotBrokenWhenControllerThrowsAnThrowable() $kernel = $this->getHttpKernel(new EventDispatcher(), function () { throw new \Error(); }, $requestStack); try { - $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true); + $kernel->handle(new Request(), HttpKernelInterface::MAIN_REQUEST, true); } catch (\Throwable $exception) { } diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 7ec9fa33133cb..92cb6fcbbf985 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -13,14 +13,11 @@ use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; -use Symfony\Component\Config\ConfigCache; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpFoundation\Request; @@ -39,8 +36,6 @@ class KernelTest extends TestCase { - use ExpectDeprecationTrait; - protected function tearDown(): void { try { @@ -628,45 +623,6 @@ public function getContainerClass(): string $this->assertMatchesRegularExpression('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*TestDebugContainer$/', $kernel->getContainerClass()); } - /** - * @group legacy - */ - public function testKernelWithParameterDeprecation() - { - $kernel = new class('test', true) extends Kernel { - public function __construct(string $env, bool $debug) - { - $this->container = new ContainerBuilder(new ParameterBag(['container.dumper.inline_factories' => true, 'container.dumper.inline_class_loader' => true])); - parent::__construct($env, $debug); - } - - public function registerBundles(): iterable - { - return []; - } - - public function registerContainerConfiguration(LoaderInterface $loader): void - { - } - - public function boot(): void - { - $this->container->compile(); - parent::dumpContainer(new ConfigCache(tempnam(sys_get_temp_dir(), 'symfony-kernel-deprecated-parameter'), true), $this->container, Container::class, $this->getContainerBaseClass()); - } - - public function getContainerClass(): string - { - return parent::getContainerClass(); - } - }; - - $this->expectDeprecation('Since symfony/http-kernel 6.3: Parameter "container.dumper.inline_factories" is deprecated, use ".container.dumper.inline_factories" instead.'); - $this->expectDeprecation('Since symfony/http-kernel 6.3: Parameter "container.dumper.inline_class_loader" is deprecated, use ".container.dumper.inline_class_loader" instead.'); - - $kernel->boot(); - } - /** * Returns a mock for the BundleInterface. */ diff --git a/src/Symfony/Component/HttpKernel/composer.json b/src/Symfony/Component/HttpKernel/composer.json index 2c8475f00b28c..ccebe6d793e2f 100644 --- a/src/Symfony/Component/HttpKernel/composer.json +++ b/src/Symfony/Component/HttpKernel/composer.json @@ -17,7 +17,6 @@ ], "require": { "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", "symfony/error-handler": "^6.4|^7.0", "symfony/event-dispatcher": "^6.4|^7.0", "symfony/http-foundation": "^6.4|^7.0", diff --git a/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php b/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php index 6451d17b47bde..e35c2a73dc0a5 100644 --- a/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php +++ b/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php @@ -33,22 +33,6 @@ public function __construct(TokenStorageInterface $tokenStorage) $this->tokenStorage = $tokenStorage; } - /** - * @deprecated since Symfony 6.2, use resolve() instead - */ - public function supports(Request $request, ArgumentMetadata $argument): bool - { - @trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__); - - // with the attribute, the type can be any UserInterface implementation - // otherwise, the type must be UserInterface - if (UserInterface::class !== $argument->getType() && !$argument->getAttributesOfType(CurrentUser::class, ArgumentMetadata::IS_INSTANCEOF)) { - return false; - } - - return true; - } - public function resolve(Request $request, ArgumentMetadata $argument): array { // with the attribute, the type can be any UserInterface implementation diff --git a/src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php b/src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php index 4e780879b6c2f..7819d32f2723f 100644 --- a/src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php @@ -27,11 +27,6 @@ class UserValueResolverTest extends TestCase { - /** - * In Symfony 7, keep this test case but remove the call to supports(). - * - * @group legacy - */ public function testSupportsFailsWithNoType() { $tokenStorage = new TokenStorage(); @@ -39,14 +34,8 @@ public function testSupportsFailsWithNoType() $metadata = new ArgumentMetadata('foo', null, false, false, null); $this->assertSame([], $resolver->resolve(Request::create('/'), $metadata)); - $this->assertFalse($resolver->supports(Request::create('/'), $metadata)); } - /** - * In Symfony 7, keep this test case but remove the call to supports(). - * - * @group legacy - */ public function testSupportsFailsWhenDefaultValAndNoUser() { $tokenStorage = new TokenStorage(); @@ -54,7 +43,6 @@ public function testSupportsFailsWhenDefaultValAndNoUser() $metadata = new ArgumentMetadata('foo', UserInterface::class, false, true, $default = new InMemoryUser('username', 'password')); $this->assertSame([$default], $resolver->resolve(Request::create('/'), $metadata)); - $this->assertTrue($resolver->supports(Request::create('/'), $metadata)); } public function testResolveSucceedsWithUserInterface() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy