8000 Remove some more legacy code by nicolas-grekas · Pull Request #16516 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Remove some more legacy code #16516

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
Nov 10, 2015
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 @@ -55,11 +55,7 @@ public function loadUserByUsername($username)
$user = $this->repository->findOneBy(array($this->property => $username));
} else {
if (!$this->repository instanceof UserLoaderInterface) {
if (!$this->repository instanceof UserProviderInterface) {
throw new \InvalidArgumentException(sprintf('The Doctrine repository "%s" must implement Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface.', get_class($this->repository)));
}

@trigger_error('Implementing loadUserByUsername from Symfony\Component\Security\Core\User\UserProviderInterface is deprecated since version 2.8 and will be removed in 3.0. Implement the Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface instead.', E_USER_DEPRECATED);
throw new \InvalidArgumentException(sprintf('The Doctrine repository "%s" must implement Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface.', get_class($this->repository)));
}

$user = $this->repository->loadUserByUsername($username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="form.csrf_provider" class="Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfTokenManagerAdapter">
<argument type="service" id="security.csrf.token_manager" />
<deprecated>The "%service_id%" service is deprecated since Symfony 2.4 and will be removed in 3.0. Use the "security.csrf.token_manager" service instead.</deprecated>
</service>

<service id="form.type_extension.csrf" class="Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension">
<tag name="form.type_extension" extended-type="Symfony\Component\Form\Extension\Core\Type\FormType" />
<argument type="service" id="security.csrf.token_manager" />
Expand Down
11 changes: 0 additions & 11 deletions src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@
<argument>%validator.mapping.cache.prefix%</argument>
</service>

<service id="validator.mapping.cache.doctrine.apc" class="Symfony\Component\Validator\Mapping\Cache\DoctrineCache" public="false">
<argument type="service">
<service class="Doctrine\Common\Cache\ApcCache">
<call method="setNamespace">
<argument>%validator.mapping.cache.prefix%</argument>
</call>
</service>
</argument>
<deprecated>The "%service_id%" service is deprecated since Symfony 2.8 and will be removed in 3.0.</deprecated>
</service>

<service id="validator.validator_factory" class="Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory" public="false">
<argument type="service" id="service_container" />
<argument type="collection" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,6 @@ public function __construct(UrlGeneratorInterface $router)
$this->generator = $router;
}

/**
* Generates a URL from the given parameters.
*
* @param string $name The name of the route
* @param mixed $parameters An array of parameters
* @param int $referenceType The type of reference (one of the constants in UrlGeneratorInterface)
*
* @return string The generated URL
*
* @see UrlGeneratorInterface
*/
public function generate($name, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0. Use the "path" or "url" method instead.', E_USER_DEPRECATED);

return $this->generator->generate($name, $parameters, $referenceType);
}

/**
* Generates a URL reference (as an absolute or relative path) to the route with the given parameters.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ protected function setUp()
$this->params = array('foo' => 'bar');
}

private function getConstraintViolation($code = null, $constraint = null)
private function getConstraintViolation($code = null)
{
return new ConstraintViolation($this->message, $this->messageTemplate, $this->params, null, 'prop.path', null, null, $code, $constraint);
return new ConstraintViolation($this->message, $this->messageTemplate, $this->params, null, 'prop.path', null, null, $code, new Form());
}

private function getBuilder($name = 'name', $propertyPath = nu 8000 ll, $dataClass = null)
Expand All @@ -93,7 +93,7 @@ private function getMockForm()
// More specific mapping tests can be found in ViolationMapperTest
public function testMapViolation()
{
$violation = $this->getConstraintViolation(null, new Form());
$violation = $this->getConstraintViolation();
$form = $this->getForm('street');

$this->validator->expects($this->once())
Expand All @@ -109,28 +109,7 @@ public function testMapViolation()

public function testMapViolationAllowsNonSyncIfInvalid()
{
$violation = $this->getConstraintViolation(Form::NOT_SYNCHRONIZED_ERROR, new Form());
$form = $this->getForm('street');

$this->validator->expects($this->once())
->method('validate')
->will($this->returnValue(array($violation)));

$this->violationMapper->expects($this->once())
->method('mapViolation')
// pass true now
->with($violation, $form, true);

$this->listener->validateForm(new FormEvent($form, null));
}

public function testMapViolationAllowsNonSyncIfInvalidWithoutConstraintReference()
{
// constraint violations have no reference to the constraint if they are created by
// Symfony\Component\Validator\ExecutionContext
// which is deprecated in favor of
// Symfony\Component\Validator\Context\ExecutionContext
$violation = $this->getConstraintViolation(Form::NOT_SYNCHRONIZED_ERROR, null);
$violation = $this->getConstraintViolation(Form::NOT_SYNCHRONIZED_ERROR);
$form = $this->getForm('street');

$this->validator->expects($this->once())
Expand Down
1 change: 0 additions & 1 deletion src/Symfony/Component/Routing/RouteCollectionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ public function build()
$route->setDefaults(array_merge($this->defaults, $route->getDefaults()));
$route->setOptions(array_merge($this->options, $route->getOptions()));

// we're extra careful here to avoid re-setting deprecated _method and _scheme
foreach ($this->requirements as $key => $val) {
if (!$route->hasRequirement($key)) {
$route->setRequirement($key, $val);
Expand Down
5 changes: 1 addition & 4 deletions src/Symfony/Component/Yaml/Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,7 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter

// a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >)
if ($output && ('@' === $output[0] || '`' === $output[0] || '|' === $output[0] || '>' === $output[0])) {
@trigger_error(sprintf('Not quoting a scalar starting with "%s" is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', $output[0]), E_USER_DEPRECATED);

// to be thrown in 3.0
// throw new ParseException(sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]));
throw new ParseException(sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]));
}

if ($evaluate) {
Expand Down
5 changes: 1 addition & 4 deletions src/Symfony/Component/Yaml/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,7 @@ private function parseValue($value, $exceptionOnInvalidType, $objectSupport, $ob
}

if ('mapping' === $context && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && false !== strpos($value, ': ')) {
@trigger_error(sprintf('Using a colon in an unquoted mapping value in line %d is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', $this->getRealCurrentLineNb() + 1), E_USER_DEPRECATED);

// to be thrown in 3.0
// throw new ParseException('A colon cannot be used in an unquoted mapping value.');
throw new ParseException('A colon cannot be used in an unquoted mapping value.');
}

try {
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Yaml/Tests/InlineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ public function testParseUnquotedAsteriskFollowedByAComment()
}

/**
* @group legacy
* @dataProvider getReservedIndicators
* throws \Symfony\Component\Yaml\Exception\ParseException in 3.0
* @expectedException Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage cannot start a plain scalar; you need to quote the scalar.
*/
public function testParseUnquotedScalarStartingWithReservedIndicator($indicator)
{
Expand All @@ -204,9 +204,9 @@ public function getReservedIndicators()
}

/**
* @group legacy
* @dataProvider getScalarIndicators
* throws \Symfony\Component\Yaml\Exception\ParseException in 3.0
* @expectedException Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage cannot start a plain scalar; you need to quote the scalar.
*/
public function testParseUnquotedScalarStartingWithScalarIndicator($indicator)
{
Expand Down
16 changes: 2 additions & 14 deletions src/Symfony/Component/Yaml/Tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -785,28 +785,16 @@ public function testFloatKeys()
}

/**
* @group legacy
* throw ParseException in Symfony 3.0
* @expectedException Symfony\Component\Yaml\Exception\ParseException
* @expectedExceptionMessage A colon cannot be used in an unquoted mapping value.
*/
public function testColonInMappingValueException()
{
$yaml = <<<EOF
foo: bar: baz
EOF;

$deprecations = array();
set_error_handler(function ($type, $msg) use (&$deprecations) {
if (E_USER_DEPRECATED === $type) {
$deprecations[] = $msg;
}
});

$this->parser->parse($yaml);

$this->assertCount(1, $deprecations);
$this->assertContains('Using a colon in an unquoted mapping value in line 1 is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', $deprecations[0]);

restore_error_handler();
}
}

Expand Down
0