8000 [Lock] 7.0 remove deprecations in Lock Component · symfony/symfony@3a75f43 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a75f43

Browse files
fafiebignicolas-grekas
authored andcommitted
[Lock] 7.0 remove deprecations in Lock Component
1 parent 9e248b8 commit 3a75f43

File tree

149 files changed

+356
-1879
lines changed
  • < EA86 div id="_R_3dje6tn5ddab_" class="PRIVATE_TreeView-item-content prc-TreeView-TreeViewItemContent-RKsCI">Controller
  • RememberMe
  • Tests
  • Validator
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    149 files changed

    +356
    -1879
    lines changed

    .github/expected-missing-return-types.diff

    Lines changed: 10 additions & 17 deletions
    Original file line numberDiff line numberDiff line change
    @@ -2389,10 +2389,10 @@ index cecce6c01b..f2e0c7fdf5 100644
    23892389
    {
    23902390
    parent::newLine($count);
    23912391
    diff --git a/src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php b/src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php
    2392-
    index 6ad89dc522..40020baee7 100644
    2392+
    index 10bed7d031..e26109851f 100644
    23932393
    --- a/src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php
    23942394
    +++ b/src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php
    2395-
    @@ -141,5 +141,5 @@ class NonStringInput extends Input
    2395+
    @@ -128,5 +128,5 @@ class NonStringInput extends Input
    23962396
    }
    23972397

    23982398
    - public function parse()
    @@ -9981,17 +9981,17 @@ index eabfe17bba..5a41823338 100644
    99819981
    {
    99829982
    throw new \BadMethodCallException('Cannot add attribute to NullToken.');
    99839983
    diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/Storage/TokenStorage.php b/src/Symfony/Component/Security/Core/Authentication/Token/Storage/TokenStorage.php
    9984-
    index 0ec6b1cfb9..2e235a6069 100644
    9984+
    index 8acc31bca2..25779a31b5 100644
    99859985
    --- a/src/Symfony/Component/Security/Core/Authentication/Token/Storage/TokenStorage.php
    99869986
    +++ b/src/Symfony/Component/Security/Core/Authentication/Token/Storage/TokenStorage.php
    99879987
    @@ -41,5 +41,5 @@ class TokenStorage implements TokenStorageInterface, ResetInterface
    99889988
    * @return void
    99899989
    */
    9990-
    - public function setToken(TokenInterface $token = null)
    9991-
    + public function setToken(TokenInterface $token = null): void
    9990+
    - public function setToken(?TokenInterface $token)
    9991+
    + public function setToken(?TokenInterface $token): void
    99929992
    {
    9993-
    if (1 > \func_num_args()) {
    9994-
    @@ -64,5 +64,5 @@ class TokenStorage implements TokenStorageInterface, ResetInterface
    9993+
    if ($token) {
    9994+
    @@ -60,5 +60,5 @@ class TokenStorage implements TokenStorageInterface, ResetInterface
    99959995
    * @return void
    99969996
    */
    99979997
    - public function reset()
    @@ -10172,23 +10172,16 @@ index a493b00e79..377dcacc09 100644
    1017210172
    {
    1017310173
    }
    1017410174
    diff --git a/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php b/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php
    10175-
    index e0aef90a14..651578d1f1 100644
    10175+
    index 13441bc758..e2bc96ff48 100644
    1017610176
    --- a/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php
    1017710177
    +++ b/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php
    10178-
    @@ -55,5 +55,5 @@ class InMemoryUserProvider implements UserProviderInterface
    10179-
    * @throws \LogicException
    10178+
    @@ -53,5 +53,5 @@ class InMemoryUserProvider implements UserProviderInterface
    10179+
    * @return void
    1018010180
    */
    1018110181
    - public function createUser(UserInterface $user)
    1018210182
    + public function createUser(UserInterface $user): void
    1018310183
    {
    1018410184
    if (!$user instanceof InMemoryUser) {
    10185-
    @@ -100,5 +100,5 @@ class InMemoryUserProvider implements UserProviderInterface
    10186-
    * @throws UserNotFoundException if user whose given username does not exist
    10187-
    */
    10188-
    - private function getUser(string $username): UserInterface
    10189-
    + private function getUser(string $username): InMemoryUser
    10190-
    {
    10191-
    if (!isset($this->users[strtolower($username)])) {
    1019210185
    diff --git a/src/Symfony/Component/Security/Core/User/UserCheckerInterface.php b/src/Symfony/Component/Security/Core/User/UserCheckerInterface.php
    1019310186
    index 91f21c71d0..95e818392e 100644
    1019410187
    --- a/src/Symfony/Component/Security/Core/User/UserCheckerInterface.php

    .github/patch-types.php

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -24,6 +24,7 @@
    2424
    // no break;
    2525
    case false !== strpos($file, '/vendor/'):
    2626
    case false !== strpos($file, '/src/Symfony/Bridge/PhpUnit/'):
    27+
    case false !== strpos($file, '/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/ContainerAwareController.php'):
    2728
    case false !== strpos($file, '/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Article.php'):
    2829
    case false !== strpos($file, '/src/Symfony/Component/Cache/Tests/Fixtures/DriverWrapper.php'):
    2930
    case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/BadFileName.php'):

    UPGRADE-6.4.md

    Lines changed: 20 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,6 +1,11 @@
    11
    UPGRADE FROM 6.3 to 6.4
    22
    =======================
    33

    4+
    Cache
    5+
    -----
    6+
    7+
    * `EarlyExpirationHandler` no longer implements `MessageHandlerInterface`, rely on `AsMessageHandler` instead
    8+
    49
    DependencyInjection
    510
    -------------------
    611

    @@ -14,6 +19,11 @@ DoctrineBridge
    1419
    * Deprecate `DoctrineDataCollector::addLogger()`, use a `DebugDataHolder` instead
    1520
    * Deprecate `ContainerAwareLoader`, use dependency injection in your fixtures instead
    1621

    22+
    ErrorHandler
    23+
    ------------
    24+
    25+
    * `FlattenExceptionNormalizer` no longer implements `ContextAwareNormalizerInterface`
    26+
    1727
    Form
    1828
    ----
    1929

    @@ -24,3 +34,13 @@ HttpFoundation
    2434
    --------------
    2535

    2636
    * Make `HeaderBag::getDate()`, `Response::getDate()`, `getExpires()` and `getLastModified()` return a `DateTimeImmutable`
    37+
    38+
    HttpKernel
    39+
    ----------
    40+
    41+
    * `BundleInterface` no longer extends `ContainerAwareInterface`
    42+
    43+
    Security
    44+
    --------
    45+
    46+
    * `UserValueResolver` no longer implements `ArgumentValueResolverInterface`

    UPGRADE-7.0.md

    Lines changed: 121 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -4,6 +4,7 @@ UPGRADE FROM 6.4 to 7.0
    44
    Symfony 6.4 and Symfony 7.0 will be released simultaneously at the end of November 2023. According to the Symfony
    55
    release process, both versions will have the same features, but Symfony 7.0 won't include any deprecated features.
    66
    To upgrade, make sure to resolve all deprecation notices.
    7+
    Read more about this in the [Symfony documentation](https://symfony.com/doc/current/setup/upgrade_major.html).
    78

    89
    Cache
    910
    -----
    @@ -14,6 +15,32 @@ Console
    1415
    -------
    1516

    1617
    * Remove `Command::$defaultName` and `Command::$defaultDescription`, use the `AsCommand` attribute instead
    18+
    19+
    *Before*
    20+
    ```php
    21+
    use Symfony\Component\Console\Command\Command;
    22+
    23+
    class CreateUserCommand extends Command
    24+
    {
    25+
    protected static $defaultName = 'app:create-user';
    26+
    protected static $defaultDescription = 'Creates users';
    27+
    28+
    // ...
    29+
    }
    30+
    ```
    31+
    32+
    *After*
    33+
    ```php
    34+
    use Symfony\Component\Console\Attribute\AsCommand;
    35+
    use Symfony\Component\Console\Command\Command;
    36+
    37+
    #[AsCommand(name: 'app:create-user', description: 'Creates users')]
    38+
    class CreateUserCommand extends Command
    39+
    {
    40+
    // ...
    41+
    }
    42+
    ```
    43+
    1744
    * Passing null to `*Command::setApplication()`, `*FormatterStyle::setForeground/setBackground()`, `Helper::setHelpSet()`, `Input*::setDefault()` and `Question::setAutocompleterCallback/setValidator()` must be done explicitly
    1845
    * Remove `StringInput::REGEX_STRING`
    1946
    * Add method `__toString()` to `InputInterface`
    @@ -45,6 +72,11 @@ DoctrineBridge
    4572
    * DoctrineBridge now requires `doctrine/event-manager:^2`
    4673
    * Add parameter `$isSameDatabase` to `DoctrineTokenProvider::configureSchema()`
    4774

    75+
    ExpressionLanguage
    76+
    ------------------
    77+
    78+
    * The `in` and `not in` operators now use strict comparison
    79+
    4880
    Filesystem
    4981
    ----------
    5082

    @@ -68,21 +100,38 @@ HttpFoundation
    68100
    * Remove `Request::getContentType()`, use `Request::getContentTypeFormat()` instead
    69101
    * Throw an `InvalidArgumentException` when calling `Request::create()` with a malformed URI
    70102

    103+
    HttpClient
    104+
    ----------
    105+
    106+
    * Remove implementing `Http\Message\RequestFactory` from `HttplugClient`
    107+
    71108
    HttpKernel
    72109
    ----------
    73110

    74111
    * Add argument `$reflector` to `ArgumentResolverInterface::getArguments()` and `ArgumentMetadataFactoryInterface::createArgumentMetadata()`
    112+
    * Remove `ArgumentValueResolverInterface`, use `ValueResolverInterface` instead
    113+
    * Remove `StreamedResponseListener`
    114+
    * Remove `AbstractSurrogate::$phpEscapeMap`
    115+
    * Remove `HttpKernelInterface::MASTER_REQUEST`
    116+
    * Remove `terminate_on_cache_hit` option from `HttpCache`
    75117

    76118
    Lock
    77119
    ----
    78120

    79121
    * Add parameter `$isSameDatabase` to `DoctrineDbalStore::configureSchema()`
    122+
    * Remove the `gcProbablity` (notice the typo) option, use `gcProbability` instead
    80123

    81124
    Messenger
    82125
    ---------
    83126

    84127
    * Add parameter `$isSameDatabase` to `DoctrineTransport::configureSchema()`
    85128

    129+
    Mime
    130+
    ----
    131+
    132+
    * Remove `Email::attachPart()` method, use `Email::addPart()` instead
    133+
    * Parameter `$body` is now required (at least null) in `Message::setBody()`
    134+
    86135
    PropertyAccess
    87136
    --------------
    88137

    @@ -107,17 +156,83 @@ Security
    107156
    SecurityBundle
    108157
    --------------
    109158

    110-
    * Enabling SecurityBundle and not configuring it is not allowed
    159+
    * Enabling SecurityBundle and not configuring it is not allowed, either remove the bundle or configure at least one firewall
    111160

    112161
    Serializer
    113162
    ----------
    114163

    115164
    * Add method `getSupportedTypes()` to `DenormalizerInterface` and `NormalizerInterface`
    116165
    * Remove denormalization support for `AbstractUid` in `UidNormalizer`, use one of `AbstractUid` child class instead
    117166
    * Denormalizing to an abstract class in `UidNormalizer` now throws an `\Error`
    118-
    * Remove `ContextAwareDenormalizerInterface`, use `DenormalizerInterface` instead
    119-
    * Remove `ContextAwareNormalizerInterface`, use `NormalizerInterface` instead
    167+
    * Remove `ContextAwareDenormalizerInterface` and `ContextAwareNormalizerInterface`, use `DenormalizerInterface` and `NormalizerInterface` instead
    168+
    169+
    *Before*
    170+
    ```php
    171+
    use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
    172+
    173+
    class TopicNormalizer implements ContextAwareNormalizerInterface
    174+
    {
    175+
    public function normalize($topic, string $format = null, array $context = [])
    176+
    {
    177+
    }
    178+
    }
    179+
    ```
    180+
    181+
    *After*
    182+
    ```php
    183+
    use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
    184+
    185+
    class TopicNormalizer implements NormalizerInterface
    186+
    {
    187+
    public function normalize($topic, string $format = null, array $context = [])
    188+
    {
    189+
    }
    190+
    }
    191+
    ```
    120192
    * Remove `CacheableSupportsMethodInterface`, use `NormalizerInterface` and `DenormalizerInterface` instead
    193+
    194+
    *Before*
    195+
    ```php
    196+
    use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
    197+
    use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
    198+
    199+
    class TopicNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface
    200+
    {
    201+
    public function supportsNormalization($data, string $format = null, array $context = []): bool
    202+
    {
    203+
    return $data instanceof Topic;
    204+
    }
    205+
    206+
    public function hasCacheableSupportsMethod(): bool
    207+
    {
    208+
    return true;
    209+
    }
    210+
    211+
    // ...
    212+
    }
    213+
    ```
    214+
    215+
    *After*
    216+
    ```php
    217+
    use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
    218+
    219+
    class TopicNormalizer implements NormalizerInterface
    220+
    {
    221+
    public function supportsNormalization($data, string $format = null, array $context = []): bool
    222+
    {
    223+
    return $data instanceof Topic;
    224+
    }
    225+
    226+
    public function getSupportedTypes(?string $format): array
    227+
    {
    228+
    return [
    229+
    Topic::class => true,
    230+
    ];
    231+
    }
    232+
    233+
    // ...
    234+
    }
    235+
    ```
    121236
    * First argument of `AttributeMetadata::setSerializedName()` is now required
    122237
    * Add argument `$context` to `NormalizerInterface::supportsNormalization()` and `DenormalizerInterface::supportsDenormalization()`
    123238

    @@ -127,6 +242,9 @@ Validator
    127242
    * Add methods `getConstraint()`, `getCause()` and `__toString()` to `ConstraintViolationInterface`
    128243
    * Add method `__toString()` to `ConstraintViolationListInterface`
    129244
    * Add method `disableTranslation()` to `ConstraintViolationBuilderInterface`
    245+
    * Remove static property `$errorNames` from all constraints, use const `ERROR_NAMES` instead
    246+
    * Remove `VALIDATION_MODE_LOOSE` from `Email` constraint, use `VALIDATION_MODE_HTML5` instead
    247+
    * Remove constraint `ExpressionLanguageSyntax`, use `ExpressionSyntax` instead
    130248

    131249
    VarDumper
    132250
    ---------

    src/Symfony/Bridge/Doctrine/Tests/Middleware/Debug/MiddlewareTest.php

    Lines changed: 2 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -275,5 +275,7 @@ public function testWithoutStopwatch(callable $sqlMethod, callable $endTransacti
    275275
    $this->conn->beginTransaction();
    276276
    $sqlMethod($this->conn, 'SELECT * FROM products');
    277277
    $endTransactionMethod($this->conn);
    278+
    279+
    $this->addToAssertionCount(1);
    278280
    }
    279281
    }

    src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php

    Lines changed: 0 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -39,11 +39,6 @@ class UniqueEntity extends Constraint
    3939
    public $errorPath;
    4040
    public $ignoreNull = true;
    4141

    42-
    /**
    43-
    * @deprecated since Symfony 6.1, use const ERROR_NAMES instead
    44-
    */
    45-
    protected static $errorNames = self::ERROR_NAMES;
    46-
    4742
    /**
    4843
    * @param array|string $fields The combination of fields that must contain unique values or a set of options
    4944
    * @param bool|array|string $ignoreNull The combination of fields that ignore null values

    src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

    Lines changed: 0 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -95,7 +95,6 @@
    9595
    use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
    9696
    use Symfony\Component\HttpKernel\Controller\ArgumentResolver\BackedEnumValueResolver;
    9797
    use Symfony\Component\HttpKernel\Controller\ArgumentResolver\UidValueResolver;
    98-
    use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
    9998
    use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
    10099
    use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
    101100
    use Symfony\Component\HttpKernel\DependencyInjection\Extension;
    @@ -596,8 +595,6 @@ public function load(array $configs, ContainerBuilder $container): void
    596595
    ->addTag('container.service_locator');
    597596
    $container->registerForAutoconfiguration(ServiceSubscriberInterface::class)
    598597
    ->addTag('container.service_subscriber');
    599-
    $container->registerForAutoconfiguration(ArgumentValueResolverInterface::class)
    600-
    ->addTag('controller.argument_value_resolver');
    601598
    $container->registerForAutoconfiguration(ValueResolverInterface::class)
    602599
    ->addTag('controller.argument_value_resolver');
    603600
    $container->registerForAutoconfiguration(AbstractController::class)

    src/Symfony/Bundle/SecurityBundle/CHANGELOG.md

    Lines changed: 6 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -5,6 +5,12 @@ CHANGELOG
    55
    ---
    66

    77
    * Enabling SecurityBundle and not configuring it is not allowed
    8+
    * Remove configuration options `enable_authenticator_manager` and `csrf_token_generator`
    9+
    10+
    6.4
    11+
    ---
    12+
    13+
    * Deprecate `Security::ACCESS_DENIED_ERROR`, `AUTHENTICATION_ERROR` and `LAST_USERNAME` constants, use the ones on `SecurityRequestAttributes` instead
    814

    915
    6.3
    1016
    ---

    src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php

    Lines changed: 0 additions & 16 deletions
    Original file line numberDiff line numberDiff line change
    @@ -65,7 +65,6 @@ public function getConfigTreeBuilder(): TreeBuilder
    6565
    ->end()
    6666
    ->booleanNode('hide_user_not_found')->defaultTrue()->end()
    6767
    ->booleanNode('erase_credentials')->defaultTrue()->end()
    68-
    ->booleanNode('enable_authenticator_manager')->setDeprecated('symfony/security-bundle', '6.2', 'The "%node%" option at "%path%" is deprecated.')->defaultTrue()->end()
    6968
    ->arrayNode('access_decision_manager')
    7069
    ->addDefaultsIfNotSet()
    7170
    ->children()
    @@ -216,14 +215,6 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
    216215
    ->arrayNode('logout')
    217216
    ->treatTrueLike([])
    218217
    ->canBeUnset()
    219-
    ->beforeNormalization()
    220-
    ->ifTrue(fn ($v): bool => isset($v['csrf_token_generator']) && !isset($v['csrf_token_manager']))
    221-
    ->then(function (array $v): array {
    222-
    $v['csrf_token_manager'] = $v['csrf_token_generator'];
    223-
    224-
    return $v;
    225-
    })
    226-
    ->end()
    227218
    ->beforeNormalization()
    228219
    ->ifTrue(fn ($v): bool => \is_array($v) && (isset($v['csrf_token_manager']) xor isset($v['enable_csrf'])))
    229220
    ->then(function (array $v): array {
    @@ -240,13 +231,6 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
    240231
    ->booleanNode('enable_csrf')->defaultNull()->end()
    241232
    ->scalarNode('csrf_token_id')->defaultValue('logout')->end()
    242233
    ->scalarNode('csrf_parameter')->defaultValue('_csrf_token')->end()
    243-
    ->scalarNode('csrf_token_generator')
    244-
    ->setDeprecated(
    245-
    'symfony/security-bundle',
    246-
    '6.3',
    247-
    'The "%node%" option is deprecated. Use "csrf_token_manager" instead.'
    248-
    )
    249-
    ->end()
    250234
    ->scalarNode('csrf_token_manager')->end()
    251235
    ->scalarNode('path')->defaultValue('/logout')->end()
    252236
    ->scalarNode('target')->defaultValue('/')->end()

    0 commit comments

    Comments
     (0)
    0