Remove some more legacy code
This commit is contained in:
parent
4e98d89f28
commit
5aa4a3b64c
@ -55,11 +55,7 @@ class EntityUserProvider implements UserProviderInterface
|
||||
$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);
|
||||
|
@ -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" />
|
||||
|
@ -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" />
|
||||
|
@ -33,24 +33,6 @@ class RouterHelper extends Helper
|
||||
$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.
|
||||
*
|
||||
|
@ -64,9 +64,9 @@ class ValidationListenerTest extends \PHPUnit_Framework_TestCase
|
||||
$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 = null, $dataClass = null)
|
||||
@ -93,7 +93,7 @@ class ValidationListenerTest extends \PHPUnit_Framework_TestCase
|
||||
// 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())
|
||||
@ -109,28 +109,7 @@ class ValidationListenerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
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())
|
||||
|
@ -267,7 +267,6 @@ class RouteCollectionBuilder
|
||||
$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);
|
||||
|
@ -238,10 +238,7 @@ class Inline
|
||||
|
||||
// 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) {
|
||||
|
@ -472,10 +472,7 @@ class Parser
|
||||
}
|
||||
|
||||
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 {
|
||||
|
@ -189,9 +189,9 @@ class InlineTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
@ -204,9 +204,9 @@ class InlineTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
|
@ -785,8 +785,8 @@ EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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()
|
||||
{
|
||||
@ -794,19 +794,7 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user