Skip to content

Commit 08c0866

Browse files
fafiebignicolas-grekas
authored andcommitted
[Lock] 7.0 remove deprecations in Lock Component
1 parent d9a0912 commit 08c0866

31 files changed

+39
-575
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ CHANGELOG
55
---
66

77
* Add argument `$reflector` to `ArgumentResolverInterface::getArguments()` and `ArgumentMetadataFactoryInterface::createArgumentMetadata()`
8+
* Remove `ArgumentValueResolverInterface`, use `ValueResolverInterface` instead
9+
* Remove `StreamedResponseListener`
10+
* Remove `AbstractSurrogate::$phpEscapeMap`
11+
* Remove `HttpKernelInterface::MASTER_REQUEST`
12+
* Remove `terminate_on_cache_hit` option from `HttpCache`
813

914
6.4
1015
---
1116

17+
* `BundleInterface` no longer extends `ContainerAwareInterface`
1218
* Add optional `$className` parameter to `ControllerEvent::getAttributes()`
1319

1420
6.3

Controller/ArgumentResolver.php

+2-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestAttributeValueResolver;
1919
use Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestValueResolver;
2020
use Symfony\Component\HttpKernel\Controller\ArgumentResolver\SessionValueResolver;
21-
use Symfony\Component\HttpKernel\Controller\ArgumentResolver\TraceableValueResolver;
2221
use Symfony\Component\HttpKernel\Controller\ArgumentResolver\VariadicValueResolver;
2322
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactory;
2423
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactoryInterface;
@@ -37,7 +36,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
3736
private ?ContainerInterface $namedResolvers;
3837

3938
/**
40-
* @param iterable<mixed, ArgumentValueResolverInterface|ValueResolverInterface> $argumentValueResolvers
39+
* @param iterable<mixed, ValueResolverInterface> $argumentValueResolvers
4140
*/
4241
public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = [], ContainerInterface $namedResolvers = null)
4342
{
@@ -79,9 +78,6 @@ public function getArguments(Request $request, callable $controller, \Reflection
7978
}
8079

8180
foreach ($argumentValueResolvers as $name => $resolver) {
82-
if ((!$resolver instanceof ValueResolverInterface || $resolver instanceof TraceableValueResolver) && !$resolver->supports($request, $metadata)) {
83-
continue;
84-
}
8581
if (isset($disabledResolvers[\is_int($name) ? $resolver::class : $name])) {
8682
continue;
8783
}
@@ -100,10 +96,6 @@ public function getArguments(Request $request, callable $controller, \Reflection
10096
// continue to the next controller argument
10197
continue 2;
10298
}
103-
104-
if (!$resolver instanceof ValueResolverInterface) {
105-
throw new \InvalidArgumentException(sprintf('"%s::resolve()" must yield at least one value.', get_debug_type($resolver)));
106-
}
10799
}
108100

109101
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
113105
}
114106

115107
/**
116-
* @return iterable<int, ArgumentValueResolverInterface>
108+
* @return iterable<int, ValueResolverInterface>
117109
*/
118110
public static function getDefaultArgumentValueResolvers(): iterable
119111
{

Controller/ArgumentResolver/BackedEnumValueResolver.php

+1-24
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver;
1313

1414
use Symfony\Component\HttpFoundation\Request;
15-
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
1615
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
1716
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
1817
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -23,30 +22,8 @@
2322
*
2423
* @author Maxime Steinhausser <[email protected]>
2524
*/
26-
final class BackedEnumValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface
25+
final class BackedEnumValueResolver implements ValueResolverInterface
2726
{
28-
/**
29-
* @deprecated since Symfony 6.2, use resolve() instead
30-
*/
31-
public function supports(Request $request, ArgumentMetadata $argument): bool
32-
{
33-
@trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__);
34-
35-
if (!is_subclass_of($argument->getType(), \BackedEnum::class)) {
36-
return false;
37-
}
38-
39-
if ($argument->isVariadic()) {
40-
// only target route path parameters, which cannot be variadic.
41-
return false;
42-
}
43-
44-
// do not support if no value can be resolved at all
45-
// letting the \Symfony\Component\HttpKernel\Controller\ArgumentResolver\DefaultValueResolver be used
46-
// or \Symfony\Component\HttpKernel\Controller\ArgumentResolver fail with a meaningful error.
47-
return $request->attributes->has($argument->getName());
48-
}
49-
5027
public function resolve(Request $request, ArgumentMetadata $argument): iterable
5128
{
5229
if (!is_subclass_of($argument->getType(), \BackedEnum::class)) {

Controller/ArgumentResolver/DateTimeValueResolver.php

+1-12
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Psr\Clock\ClockInterface;
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpKernel\Attribute\MapDateTime;
17-
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
1817
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
1918
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
2019
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -25,23 +24,13 @@
2524
* @author Benjamin Eberlei <[email protected]>
2625
* @author Tim Goudriaan <[email protected]>
2726
*/
28-
final class DateTimeValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface
27+
final class DateTimeValueResolver implements ValueResolverInterface
2928
{
3029
public function __construct(
3130
private readonly ?ClockInterface $clock = null,
3231
) {
3332
}
3433

35-
/**
36-
* @deprecated since Symfony 6.2, use resolve() instead
37-
*/
38-
public function supports(Request $request, ArgumentMetadata $argument): bool
39-
{
40-
@trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__);
41-
42-
return is_a($argument->getType(), \DateTimeInterface::class, true) && $request->attributes->has($argument->getName());
43-
}
44-
4534
public function resolve(Request $request, ArgumentMetadata $argument): array
4635
{
4736
if (!is_a($argument->getType(), \DateTimeInterface::class, true) || !$request->attributes->has($argument->getName())) {

Controller/ArgumentResolver/DefaultValueResolver.php

+1-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver;
1313

1414
use Symfony\Component\HttpFoundation\Request;
15-
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
1615
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
1716
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
1817

@@ -21,18 +20,8 @@
2120
*
2221
* @author Iltar van der Berg <[email protected]>
2322
*/
24-
final class DefaultValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface
23+
final class DefaultValueResolver implements ValueResolverInterface
2524
{
26-
/**
27-
* @deprecated since Symfony 6.2, use resolve() instead
28-
*/
29-
public function supports(Request $request, ArgumentMetadata $argument): bool
30-
{
31-
@trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__);
32-
33-
return $argument->hasDefaultValue() || (null !== $argument->getType() && $argument->isNullable() && !$argument->isVariadic());
34-
}
35-
3625
public function resolve(Request $request, ArgumentMetadata $argument): array
3726
{
3827
if ($argument->hasDefaultValue()) {

Controller/ArgumentResolver/NotTaggedControllerValueResolver.php

+4-33
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Psr\Container\ContainerInterface;
1515
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1616
use Symfony\Component\HttpFoundation\Request;
17-
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
1817
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
1918
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
2019

@@ -23,39 +22,11 @@
2322
*
2423
* @author Simeon Kolev <[email protected]>
2524
*/
26-
final class NotTaggedControllerValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface
25+
final class NotTaggedControllerValueResolver implements ValueResolverInterface
2726
{
28-
private ContainerInterface $container;
29-
30-
public function __construct(ContainerInterface $container)
31-
{
32-
$this->container = $container;
33-
}
34-
35-
/**
36-
* @deprecated since Symfony 6.2, use resolve() instead
37-
*/
38-
public function supports(Request $request, ArgumentMetadata $argument): bool
39-
{
40-
@trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__);
41-
42-
$controller = $request->attributes->get('_controller');
43-
44-
if (\is_array($controller) && \is_callable($controller, true) && \is_string($controller[0])) {
45-
$controller = $controller[0].'::'.$controller[1];
46-
} elseif (!\is_string($controller) || '' === $controller) {
47-
return false;
48-
}
49-
50-
if ('\\' === $controller[0]) {
51-
$controller = ltrim($controller, '\\');
52-
}
53-
54-
if (!$this->container->has($controller) && false !== $i = strrpos($controller, ':')) {
55-
$controller = substr($controller, 0, $i).strtolower(substr($controller, $i));
56-
}
57-
58-
return false === $this->container->has($controller);
27+
public function __construct(
28+
private ContainerInterface $container,
29+
) {
5930
}
6031

6132
public function resolve(Request $request, ArgumentMetadata $argument): array

Controller/ArgumentResolver/RequestAttributeValueResolver.php

+1-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver;
1313

1414
use Symfony\Component\HttpFoundation\Request;
15-
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
1615
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
1716
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
1817

@@ -21,18 +20,8 @@
2120
*
2221
* @author Iltar van der Berg <[email protected]>
2322
*/
24-
final class RequestAttributeValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface
23+
final class RequestAttributeValueResolver implements ValueResolverInterface
2524
{
26-
/**
27-
* @deprecated since Symfony 6.2, use resolve() instead
28-
*/
29-
public function supports(Request $request, ArgumentMetadata $argument): bool
30-
{
31-
@trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__);
32-
33-
return !$argument->isVariadic() && $request->attributes->has($argument->getName());
34-
}
35-
3625
public function resolve(Request $request, ArgumentMetadata $argument): array
3726
{
3827
return !$argument->isVariadic() && $request->attributes->has($argument->getName()) ? [$request->attributes->get($argument->getName())] : [];

Controller/ArgumentResolver/RequestValueResolver.php

+1-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver;
1313

1414
use Symfony\Component\HttpFoundation\Request;
15-
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
1615
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
1716
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
1817

@@ -21,18 +20,8 @@
2120
*
2221
* @author Iltar van der Berg <[email protected]>
2322
*/
24-
final class RequestValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface
23+
final class RequestValueResolver implements ValueResolverInterface
2524
{
26-
/**
27-
* @deprecated since Symfony 6.2, use resolve() instead
28-
*/
29-
public function supports(Request $request, ArgumentMetadata $argument): bool
30-
{
31-
@trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__);
32-
33-
return Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class);
34-
}
35-
3625
public function resolve(Request $request, ArgumentMetadata $argument): array
3726
{
3827
return Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class) ? [$request] : [];

Controller/ArgumentResolver/ServiceValueResolver.php

+1-28
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Psr\Container\ContainerInterface;
1515
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1616
use Symfony\Component\HttpFoundation\Request;
17-
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
1817
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
1918
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
2019

@@ -23,7 +22,7 @@
2322
*
2423
* @author Nicolas Grekas <[email protected]>
2524
*/
26-
final class ServiceValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface
25+
final class ServiceValueResolver implements ValueResolverInterface
2726
{
2827
private ContainerInterface $container;
2928

@@ -32,32 +31,6 @@ public function __construct(ContainerInterface $container)
3231
$this->container = $container;
3332
}
3433

35-
/**
36-
* @deprecated since Symfony 6.2, use resolve() instead
37-
*/
38-
public function supports(Request $request, ArgumentMetadata $argument): bool
39-
{
40-
@trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__);
41-
42-
$controller = $request->attributes->get('_controller');
43-
44-
if (\is_array($controller) && \is_callable($controller, true) && \is_string($controller[0])) {
45-
$controller = $controller[0].'::'.$controller[1];
46-
} elseif (!\is_string($controller) || '' === $controller) {
47-
return false;
48-
}
49-
50-
if ('\\' === $controller[0]) {
51-
$controller = ltrim($controller, '\\');
52-
}
53-
54-
if (!$this->container->has($controller) && false !== $i = strrpos($controller, ':')) {
55-
$controller = substr($controller, 0, $i).strtolower(substr($controller, $i));
56-
}
57-
58-
return $this->container->has($controller) && $this->container->get($controller)->has($argument->getName());
59-
}
60-
6134
public function resolve(Request $request, ArgumentMetadata $argument): array
6235
{
6336
$controller = $request->attributes->get('_controller');

Controller/ArgumentResolver/SessionValueResolver.php

+1-21
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\HttpFoundation\Request;
1515
use Symfony\Component\HttpFoundation\Session\SessionInterface;
16-
use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
1716
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
1817
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
1918

@@ -22,27 +21,8 @@
2221
*
2322
* @author Iltar van der Berg <[email protected]>
2423
*/
25-
final class SessionValueResolver implements ArgumentValueResolverInterface, ValueResolverInterface
24+
final class SessionValueResolver implements ValueResolverInterface
2625
{
27-
/**
28-
* @deprecated since Symfony 6.2, use resolve() instead
29-
*/
30-
public function supports(Request $request, ArgumentMetadata $argument): bool
31-
{
32-
@trigger_deprecation('symfony/http-kernel', '6.2', 'The "%s()" method is deprecated, use "resolve()" instead.', __METHOD__);
33-
34-
if (!$request->hasSession()) {
35-
return false;
36-
}
37-
38-
$type = $argument->getType();
39-
if (SessionInterface::class !== $type && !is_subclass_of($type, SessionInterface::class)) {
40-
return false;
41-
}
42-
43-
return $request->getSession() instanceof $type;
44-
}
45-
4626
public function resolve(Request $request, ArgumentMetadata $argument): array
4727
{
4828
if (!$request->hasSession()) {

0 commit comments

Comments
 (0)