8000 Removed legacy code and cleanup by yceruto · Pull Request #32160 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Removed legacy code and cleanup #32160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

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
Expand Down Expand Up @@ -1689,32 +1688,9 @@ public function testDateTimeWithWidgetSingleText()
);
}

/**
* @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()
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/SecurityBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Form/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
7 changes: 1 addition & 6 deletions src/Symfony/Component/Form/FormError.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/HttpFoundation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
7 changes: 1 addition & 6 deletions src/Symfony/Component/HttpFoundation/RedirectResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/Symfony/Component/OptionsResolver/OptionsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,6 @@ public function offsetGet($option, bool $triggerDeprecation = true)
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])) {
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Security/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,6 @@
*/
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}
*/
Expand All @@ -48,10 +31,6 @@ public function isAnonymous(TokenInterface $token = null)
return false;
}

if (null !== $this->anonymousClass) {
return $token instanceof $this->anonymousClass;
}

return $token instanceof AnonymousToken;
}

Expand All @@ -64,10 +43,6 @@ public function isRememberMe(TokenInterface $token = null)
return false;
}

if (null !== $this->rememberMeClass) {
return $token instanceof $this->rememberMeClass;
}

return $token instanceof RememberMeToken;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,39 +55,6 @@ public function testisFullFledged()
$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();
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Validator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
7 changes: 1 addition & 6 deletions src/Symfony/Component/Validator/ConstraintViolation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
0