minor #32160 Removed legacy code and cleanup (yceruto)
This PR was squashed before being merged into the 5.0-dev branch (closes #32160).
Discussion
----------
Removed legacy code and cleanup
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
See https://github.com/symfony/symfony/pull/32074, https://github.com/symfony/symfony/pull/26981
labels: `HttpFoundation`, `Form`, `Security`, `SecurityBundle`, `Validator`
Commits
-------
7b99fb45bb
Removed legacy code and cleanup
This commit is contained in:
commit
06899a13b4
@ -13,7 +13,6 @@ namespace Symfony\Bridge\Twig\Tests\Extension;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\PercentType;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\Form\FormTypeExtensionInterface;
|
||||
use Symfony\Component\Form\Tests\AbstractLayoutTest;
|
||||
|
||||
abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
|
||||
@ -1689,32 +1688,9 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
|
||||
{
|
||||
if (method_exists(FormTypeExtensionInterface::class, 'getExtendedTypes')) {
|
||||
$this->markTestSkipped('The test requires symfony/form 4.x.');
|
||||
}
|
||||
|
||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', [
|
||||
'input' => 'string',
|
||||
'date_widget' => 'choice',
|
||||
'time_widget' => 'choice',
|
||||
'widget' => 'single_text',
|
||||
'model_timezone' => 'UTC',
|
||||
'view_timezone' => 'UTC',
|
||||
]);
|
||||
|
||||
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
|
||||
'/input
|
||||
[@type="datetime-local"]
|
||||
[@name="name"]
|
||||
[@class="my&class form-control"]
|
||||
[@value="2011-02-03T04:05:06"]
|
||||
'
|
||||
);
|
||||
$this->markTestSkipped('Make tests pass with symfony/form 4.4');
|
||||
}
|
||||
|
||||
public function testDateChoice()
|
||||
|
@ -12,6 +12,8 @@ CHANGELOG
|
||||
* Removed `LogoutUrlHelper` and `SecurityHelper` templating helpers, use Twig instead
|
||||
* Removed the `logout_on_user_change` firewall option
|
||||
* Removed the `threads` encoder option
|
||||
* Removed the `security.authentication.trust_resolver.anonymous_class` parameter
|
||||
* Removed the `security.authentication.trust_resolver.rememberme_class` parameter
|
||||
|
||||
4.3.0
|
||||
-----
|
||||
|
@ -5,8 +5,6 @@
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<parameters>
|
||||
<parameter key="security.authentication.trust_resolver.anonymous_class">null</parameter>
|
||||
<parameter key="security.authentication.trust_resolver.rememberme_class">null</parameter>
|
||||
<parameter key="security.role_hierarchy.roles" type="collection" />
|
||||
</parameters>
|
||||
|
||||
@ -49,10 +47,7 @@
|
||||
</service>
|
||||
<service id="Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface" alias="security.authentication.manager" />
|
||||
|
||||
<service id="security.authentication.trust_resolver" class="Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver">
|
||||
<argument>%security.authentication.trust_resolver.anonymous_class%</argument>
|
||||
<argument>%security.authentication.trust_resolver.rememberme_class%</argument>
|
||||
</service>
|
||||
<service id="security.authentication.trust_resolver" class="Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver" />
|
||||
|
||||
<service id="security.authentication.session_strategy" class="Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy">
|
||||
<argument>%security.authentication.session_strategy.strategy%</argument>
|
||||
|
@ -16,6 +16,7 @@ CHANGELOG
|
||||
* removed the `regions` option of the `TimezoneType`
|
||||
* removed the `$scale` argument of the `IntegerToLocalizedStringTransformer`
|
||||
* removed `TemplatingExtension` and `TemplatingRendererEngine` classes, use Twig instead
|
||||
* passing a null message when instantiating a `Symfony\Component\Form\FormError` is not allowed
|
||||
|
||||
4.3.0
|
||||
-----
|
||||
|
@ -47,13 +47,8 @@ class FormError
|
||||
*
|
||||
* @see \Symfony\Component\Translation\Translator
|
||||
*/
|
||||
public function __construct(?string $message, string $messageTemplate = null, array $messageParameters = [], int $messagePluralization = null, $cause = null)
|
||||
public function __construct(string $message, string $messageTemplate = null, array $messageParameters = [], int $messagePluralization = null, $cause = null)
|
||||
{
|
||||
if (null === $message) {
|
||||
@trigger_error(sprintf('Passing a null message when instantiating a "%s" is deprecated since Symfony 4.4.', __CLASS__), E_USER_DEPRECATED);
|
||||
$message = '';
|
||||
}
|
||||
|
||||
$this->message = $message;
|
||||
$this->messageTemplate = $messageTemplate ?: $message;
|
||||
$this->messageParameters = $messageParameters;
|
||||
|
@ -9,6 +9,7 @@ CHANGELOG
|
||||
* removed method `UploadedFile::getClientSize()` and the related constructor argument
|
||||
* made `Request::getSession()` throw if the session has not been set before
|
||||
* removed `Response::HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL`
|
||||
* passing a null url when instantiating a `RedirectResponse` is not allowed
|
||||
|
||||
4.4.0
|
||||
-----
|
||||
|
@ -32,13 +32,8 @@ class RedirectResponse extends Response
|
||||
*
|
||||
* @see http://tools.ietf.org/html/rfc2616#section-10.3
|
||||
*/
|
||||
public function __construct(?string $url, int $status = 302, array $headers = [])
|
||||
public function __construct(string $url, int $status = 302, array $headers = [])
|
||||
{
|
||||
if (null === $url) {
|
||||
@trigger_error(sprintf('Passing a null url when instantiating a "%s" is deprecated since Symfony 4.4.', __CLASS__), E_USER_DEPRECATED);
|
||||
$url = '';
|
||||
}
|
||||
|
||||
parent::__construct('', $status, $headers);
|
||||
|
||||
$this->setTargetUrl($url);
|
||||
|
@ -846,8 +846,6 @@ class OptionsResolver implements Options
|
||||
throw new AccessException('Array access is only supported within closures of lazy options and normalizers.');
|
||||
}
|
||||
|
||||
$triggerDeprecation = 1 === \func_num_args() || func_get_arg(1);
|
||||
|
||||
// Shortcut for resolved options
|
||||
if (isset($this->resolved[$option]) || \array_key_exists($option, $this->resolved)) {
|
||||
if ($triggerDeprecation && isset($this->deprecated[$option]) && (isset($this->given[$option]) || $this->calling) && \is_string($this->deprecated[$option])) {
|
||||
|
@ -27,6 +27,7 @@ CHANGELOG
|
||||
* Removed `ExpressionVoter::addExpressionLanguageProvider()`
|
||||
* Made `Security::getUser()` return null when the user is not an instanceof `UserInterface`,
|
||||
use `getToken()->getUser()` instead
|
||||
* Removed the `AuthenticationTrustResolver` constructor arguments
|
||||
|
||||
4.4.0
|
||||
-----
|
||||
|
@ -22,23 +22,6 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
*/
|
||||
class AuthenticationTrustResolver implements AuthenticationTrustResolverInterface
|
||||
{
|
||||
private $anonymousClass;
|
||||
private $rememberMeClass;
|
||||
|
||||
public function __construct(?string $anonymousClass = null, ?string $rememberMeClass = null)
|
||||
{
|
||||
$this->anonymousClass = $anonymousClass;
|
||||
$this->rememberMeClass = $rememberMeClass;
|
||||
|
||||
if (null !== $anonymousClass && !is_a($anonymousClass, AnonymousToken::class, true)) {
|
||||
@trigger_error(sprintf('Configuring a custom anonymous token class is deprecated since Symfony 4.2; have the "%s" class extend the "%s" class instead, and remove the "%s" constructor argument.', $anonymousClass, AnonymousToken::class, self::class), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
if (null !== $rememberMeClass && !is_a($rememberMeClass, RememberMeToken::class, true)) {
|
||||
@trigger_error(sprintf('Configuring a custom remember me token class is deprecated since Symfony 4.2; have the "%s" class extend the "%s" class instead, and remove the "%s" constructor argument.', $rememberMeClass, RememberMeToken::class, self::class), E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -48,10 +31,6 @@ class AuthenticationTrustResolver implements AuthenticationTrustResolverInterfac
|
||||
return false;
|
||||
}
|
||||
|
||||
if (null !== $this->anonymousClass) {
|
||||
return $token instanceof $this->anonymousClass;
|
||||
}
|
||||
|
||||
return $token instanceof AnonymousToken;
|
||||
}
|
||||
|
||||
@ -64,10 +43,6 @@ class AuthenticationTrustResolver implements AuthenticationTrustResolverInterfac
|
||||
return false;
|
||||
}
|
||||
|
||||
if (null !== $this->rememberMeClass) {
|
||||
return $token instanceof $this->rememberMeClass;
|
||||
}
|
||||
|
||||
return $token instanceof RememberMeToken;
|
||||
}
|
||||
|
||||
|
@ -55,39 +55,6 @@ class AuthenticationTrustResolverTest extends TestCase
|
||||
$this->assertTrue($resolver->isFullFledged(new FakeCustomToken()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation Configuring a custom anonymous token class is deprecated since Symfony 4.2; have the "Symfony\Component\Security\Core\Tests\Authentication\FakeCustomToken" class extend the "Symfony\Component\Security\Core\Authentication\Token\AnonymousToken" class instead, and remove the "Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver" constructor argument.
|
||||
*/
|
||||
public function testsAnonymousDeprecationWithCustomClasses()
|
||||
{
|
||||
$resolver = new AuthenticationTrustResolver(FakeCustomToken::class);
|
||||
|
||||
$this->assertTrue($resolver->isAnonymous(new FakeCustomToken()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation Configuring a custom remember me token class is deprecated since Symfony 4.2; have the "Symfony\Component\Security\Core\Tests\Authentication\FakeCustomToken" class extend the "Symfony\Component\Security\Core\Authentication\Token\RememberMeToken" class instead, and remove the "Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver" constructor argument.
|
||||
*/
|
||||
public function testIsRememberMeDeprecationWithCustomClasses()
|
||||
{
|
||||
$resolver = new AuthenticationTrustResolver(null, FakeCustomToken::class);
|
||||
|
||||
$this->assertTrue($resolver->isRememberMe(new FakeCustomToken()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation Configuring a custom remember me token class is deprecated since Symfony 4.2; have the "Symfony\Component\Security\Core\Tests\Authentication\FakeCustomToken" class extend the "Symfony\Component\Security\Core\Authentication\Token\RememberMeToken" class instead, and remove the "Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver" constructor argument.
|
||||
*/
|
||||
public function testIsFullFledgedDeprecationWithCustomClasses()
|
||||
{
|
||||
$resolver = new AuthenticationTrustResolver(FakeCustomToken::class, FakeCustomToken::class);
|
||||
|
||||
$this->assertFalse($resolver->isFullFledged(new FakeCustomToken()));
|
||||
}
|
||||
|
||||
public function testIsAnonymousWithClassAsConstructorButStillExtending()
|
||||
{
|
||||
$resolver = $this->getResolver();
|
||||
|
@ -13,6 +13,7 @@ CHANGELOG
|
||||
* removed support for using the `Expression` constraint without `symfony/expression-language`
|
||||
* changed default value of `canonicalize` option of `Locale` constraint to `true`
|
||||
* removed `ValidatorBuilderInterface`
|
||||
* passing a null message when instantiating a `ConstraintViolation` is not allowed
|
||||
|
||||
4.4.0
|
||||
-----
|
||||
|
@ -49,13 +49,8 @@ class ConstraintViolation implements ConstraintViolationInterface
|
||||
* caused the violation
|
||||
* @param mixed $cause The cause of the violation
|
||||
*/
|
||||
public function __construct(?string $message, ?string $messageTemplate, array $parameters, $root, ?string $propertyPath, $invalidValue, int $plural = null, $code = null, Constraint $constraint = null, $cause = null)
|
||||
public function __construct(string $message, ?string $messageTemplate, array $parameters, $root, ?string $propertyPath, $invalidValue, int $plural = null, $code = null, Constraint $constraint = null, $cause = null)
|
||||
{
|
||||
if (null === $message) {
|
||||
@trigger_error(sprintf('Passing a null message when instantiating a "%s" is deprecated since Symfony 4.4.', __CLASS__), E_USER_DEPRECATED);
|
||||
$message = '';
|
||||
}
|
||||
|
||||
$this->message = $message;
|
||||
$this->messageTemplate = $messageTemplate;
|
||||
$this->parameters = $parameters;
|
||||
|
Reference in New Issue
Block a user