Skip to content

Commit f37932c

Browse files
committed
feature symfony#16516 Remove some more legacy code (nicolas-grekas)
This PR was merged into the 3.0-dev branch. Discussion ---------- Remove some more legacy code | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 5aa4a3b Remove some more legacy code
2 parents 4e98d89 + 5aa4a3b commit f37932c

File tree

10 files changed

+13
-91
lines changed

10 files changed

+13
-91
lines changed

src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ public function loadUserByUsername($username)
5555
$user = $this->repository->findOneBy(array($this->property => $username));
5656
} else {
5757
if (!$this->repository instanceof UserLoaderInterface) {
58-
if (!$this->repository instanceof UserProviderInterface) {
59-
throw new \InvalidArgumentException(sprintf('The Doctrine repository "%s" must implement Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface.', get_class($this->repository)));
60-
}
61-
62-
@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);
58+
throw new \InvalidArgumentException(sprintf('The Doctrine repository "%s" must implement Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface.', get_class($this->repository)));
6359
}
6460

6561
$user = $this->repository->loadUserByUsername($username);

src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
66

77
<services>
8-
<service id="form.csrf_provider" class="Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfTokenManagerAdapter">
9-
<argument type="service" id="security.csrf.token_manager" />
10-
<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>
11-
</service>
12-
138
<service id="form.type_extension.csrf" class="Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension">
149
<tag name="form.type_extension" extended-type="Symfony\Component\Form\Extension\Core\Type\FormType" />
1510
<argument type="service" id="security.csrf.token_manager" />

src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,6 @@
3232
<argument>%validator.mapping.cache.prefix%</argument>
3333
</service>
3434

35-
<service id="validator.mapping.cache.doctrine.apc" class="Symfony\Component\Validator\Mapping\Cache\DoctrineCache" public="false">
36-
<argument type="service">
37-
<service class="Doctrine\Common\Cache\ApcCache">
38-
<call method="setNamespace">
39-
<argument>%validator.mapping.cache.prefix%</argument>
40-
</call>
41-
</service>
42-
</argument>
43-
<deprecated>The "%service_id%" service is deprecated since Symfony 2.8 and will be removed in 3.0.</deprecated>
44-
</service>
45-
4635
<service id="validator.validator_factory" class="Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory" public="false">
4736
<argument type="service" id="service_container" />
4837
<argument type="collection" />

src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RouterHelper.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,6 @@ public function __construct(UrlGeneratorInterface $router)
3333
$this->generator = $router;
3434
}
3535

36-
/**
37-
* Generates a URL from the given parameters.
38-
*
39-
* @param string $name The name of the route
40-
* @param mixed $parameters An array of parameters
41-
* @param int $referenceType The type of reference (one of the constants in UrlGeneratorInterface)
42-
*
43-
* @return string The generated URL
44-
*
45-
* @see UrlGeneratorInterface
46-
*/
47-
public function generate($name, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
48-
{
49-
@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);
50-
51-
return $this->generator->generate($name, $parameters, $referenceType);
52-
}
53-
5436
/**
5537
* Generates a URL reference (as an absolute or relative path) to the route with the given parameters.
5638
*

src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ protected function setUp()
6464
$this->params = array('foo' => 'bar');
6565
}
6666

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

7272
private function getBuilder($name = 'name', $propertyPath = null, $dataClass = null)
@@ -93,7 +93,7 @@ private function getMockForm()
9393
// More specific mapping tests can be found in ViolationMapperTest
9494
public function testMapViolation()
9595
{
96-
$violation = $this->getConstraintViolation(null, new Form());
96+
$violation = $this->getConstraintViolation();
9797
$form = $this->getForm('street');
9898

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

110110
public function testMapViolationAllowsNonSyncIfInvalid()
111111
{
112-
$violation = $this->getConstraintViolation(Form::NOT_SYNCHRONIZED_ERROR, new Form());
113-
$form = $this->getForm('street');
114-
115-
$this->validator->expects($this->once())
116-
->method('validate')
117-
->will($this->returnValue(array($violation)));
118-
119-
$this->violationMapper->expects($this->once())
120-
->method('mapViolation')
121-
// pass true now
122-
->with($violation, $form, true);
123-
124-
$this->listener->validateForm(new FormEvent($form, null));
125-
}
126-
127-
public function testMapViolationAllowsNonSyncIfInvalidWithoutConstraintReference()
128-
{
129-
// constraint violations have no reference to the constraint if they are created by
130-
// Symfony\Component\Validator\ExecutionContext
131-
// which is deprecated in favor of
132-
// Symfony\Component\Validator\Context\ExecutionContext
133-
$violation = $this->getConstraintViolation(Form::NOT_SYNCHRONIZED_ERROR, null);
112+
$violation = $this->getConstraintViolation(Form::NOT_SYNCHRONIZED_ERROR);
134113
$form = $this->getForm('street');
135114

136115
$this->validator->expects($this->once())

src/Symfony/Component/Routing/RouteCollectionBuilder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ public function build()
267267
$route->setDefaults(array_merge($this->defaults, $route->getDefaults()));
268268
$route->setOptions(array_merge($this->options, $route->getOptions()));
269269

270-
// we're extra careful here to avoid re-setting deprecated _method and _scheme
271270
foreach ($this->requirements as $key => $val) {
272271
if (!$route->hasRequirement($key)) {
273272
$route->setRequirement($key, $val);

src/Symfony/Component/Yaml/Inline.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,7 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter
238238

239239
// a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >)
240240
if ($output && ('@' === $output[0] || '`' === $output[0] || '|' === $output[0] || '>' === $output[0])) {
241-
@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);
242-
243-
// to be thrown in 3.0
244-
// throw new ParseException(sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]));
241+
throw new ParseException(sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]));
245242
}
246243

247244
if ($evaluate) {

src/Symfony/Component/Yaml/Parser.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,7 @@ private function parseValue($value, $exceptionOnInvalidType, $objectSupport, $ob
472472
}
473473

474474
if ('mapping' === $context && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && false !== strpos($value, ': ')) {
475-
@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);
476-
477-
// to be thrown in 3.0
478-
// throw new ParseException('A colon cannot be used in an unquoted mapping value.');
475+
throw new ParseException('A colon cannot be used in an unquoted mapping value.');
479476
}
480477

481478
try {

src/Symfony/Component/Yaml/Tests/InlineTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ public function testParseUnquotedAsteriskFollowedByAComment()
189189
}
190190

191191
/**
192-
* @group legacy
193192
* @dataProvider getReservedIndicators
194-
* throws \Symfony\Component\Yaml\Exception\ParseException in 3.0
193+
* @expectedException Symfony\Component\Yaml\Exception\ParseException
194+
* @expectedExceptionMessage cannot start a plain scalar; you need to quote the scalar.
195195
*/
196196
public function testParseUnquotedScalarStartingWithReservedIndicator($indicator)
197197
{
@@ -204,9 +204,9 @@ public function getReservedIndicators()
204204
}
205205

206206
/**
207-
* @group legacy
208207
* @dataProvider getScalarIndicators
209-
* throws \Symfony\Component\Yaml\Exception\ParseException in 3.0
208+
* @expectedException Symfony\Component\Yaml\Exception\ParseException
209+
* @expectedExceptionMessage cannot start a plain scalar; you need to quote the scalar.
210210
*/
211211
public function testParseUnquotedScalarStartingWithScalarIndicator($indicator)
212212
{

src/Symfony/Component/Yaml/Tests/ParserTest.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -785,28 +785,16 @@ public function testFloatKeys()
785785
}
786786

787787
/**
788-
* @group legacy
789-
* throw ParseException in Symfony 3.0
788+
* @expectedException Symfony\Component\Yaml\Exception\ParseException
789+
* @expectedExceptionMessage A colon cannot be used in an unquoted mapping value.
790790
*/
791791
public function testColonInMappingValueException()
792792
{
793793
$yaml = <<<EOF
794794
foo: bar: baz
795795
EOF;
796796

797-
$deprecations = array();
798-
set_error_handler(function ($type, $msg) use (&$deprecations) {
799-
if (E_USER_DEPRECATED === $type) {
800-
$deprecations[] = $msg;
801-
}
802-
});
803-
804797
$this->parser->parse($yaml);
805-
806-
$this->assertCount(1, $deprecations);
807-
$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]);
808-
809-
restore_error_handler();
810798
}
811799
}
812800

0 commit comments

Comments
 (0)