Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5aa44ee

Browse filesBrowse files
committed
removed the Validator BC layer for PHP < 5.3.9
1 parent a4139c0 commit 5aa44ee
Copy full SHA for 5aa44ee

File tree

Expand file treeCollapse file tree

65 files changed

+46
-1515
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

65 files changed

+46
-1515
lines changed

‎src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidator2Dot4ApiTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidator2Dot4ApiTest.php
-26Lines changed: 0 additions & 26 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
503503
// API version already during container configuration
504504
// (to adjust service classes etc.)
505505
// See https://github.com/symfony/symfony/issues/11580
506-
$v['validation']['api'] = PHP_VERSION_ID < 50309
507-
? '2.4'
508-
: '2.5-bc';
506+
$v['validation']['api'] = '2.5-bc';
509507

510508
return $v;
511509
})

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+7-13Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -744,19 +744,13 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
744744
$validatorBuilder->addMethodCall('setMetadataCache', array(new Reference($config['cache'])));
745745
}
746746

747-
switch ($config['api']) {
748-
case '2.4':
749-
$api = Validation::API_VERSION_2_4;
750-
break;
751-
case '2.5':
752-
$api = Validation::API_VERSION_2_5;
753-
// the validation class needs to be changed only for the 2.5 api since the deprecated interface is
754-
// set as the default interface
755-
$container->setParameter('validator.class', 'Symfony\Component\Validator\Validator\ValidatorInterface');
756-
break;
757-
default:
758-
$api = Validation::API_VERSION_2_5_BC;
759-
break;
747+
if ('2.5' === $config['api']) {
748+
$api = Validation::API_VERSION_2_5;
749+
} else {
750+
// 2.4 is now the same as 2.5 BC
751+
$api = Validation::API_VERSION_2_5_BC;
752+
// the validation class needs to be changed for BC
753+
$container->setParameter('validator.class', 'Symfony\Component\Validator\ValidatorInterface');
760754
}
761755

762756
$validatorBuilder->addMethodCall('setApiVersion', array($api));

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
66

77
<parameters>
8-
<parameter key="validator.class">Symfony\Component\Validator\ValidatorInterface</parameter>
8+
<parameter key="validator.class">Symfony\Component\Validator\Validator\ValidatorInterface</parameter>
99
<parameter key="validator.builder.class">Symfony\Component\Validator\ValidatorBuilderInterface</parameter>
1010
<parameter key="validator.builder.factory.class">Symfony\Component\Validator\Validation</parameter>
1111
<parameter key="validator.mapping.cache.apc.class">Symfony\Component\Validator\Mapping\Cache\ApcCache</parameter>

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ protected static function getBundleDefaultConfig()
131131
'static_method' => array('loadValidatorMetadata'),
132132
'translation_domain' => 'validators',
133133
'strict_email' => false,
134-
'api' => PHP_VERSION_ID < 50309 ? '2.4' : '2.5-bc',
134+
'api' => '2.5-bc',
135135
),
136136
'annotations' => array(
137137
'cache' => 'file',

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_2_4_api.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_2_4_api.php
-9Lines changed: 0 additions & 9 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_2_4_api.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_2_4_api.xml
-12Lines changed: 0 additions & 12 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_2_4_api.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_2_4_api.yml
-5Lines changed: 0 additions & 5 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+2-26Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -382,22 +382,6 @@ public function testValidationNoStaticMethod()
382382
// no cache, no annotations, no static methods
383383
}
384384

385-
public function testValidation2Dot4Api()
386-
{
387-
$container = $this->createContainerFromFile('validation_2_4_api');
388-
389-
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
390-
391-
$this->assertCount(6, $calls);
392-
$this->assertSame('addXmlMappings', $calls[3][0]);
393-
$this->assertSame('addMethodMapping', $calls[4][0]);
394-
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
395-
$this->assertSame('setApiVersion', $calls[5][0]);
396-
$this->assertSame(array(Validation::API_VERSION_2_4), $calls[5][1]);
397-
$this->assertSame('Symfony\Component\Validator\ValidatorInterface', $container->getParameter('validator.class'));
398-
// no cache, no annotations
399-
}
400-
401385
public function testValidation2Dot5Api()
402386
{
403387
$container = $this->createContainerFromFile('validation_2_5_api');
@@ -443,11 +427,7 @@ public function testValidationImplicitApi()
443427
$this->assertSame('setApiVersion', $calls[5][0]);
444428
// no cache, no annotations
445429

446-
if (PHP_VERSION_ID < 50309) {
447-
$this->assertSame(array(Validation::API_VERSION_2_4), $calls[5][1]);
448-
} else {
449-
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
450-
}
430+
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
451431
}
452432

453433
/**
@@ -467,11 +447,7 @@ public function testValidationAutoApi()
467447
$this->assertSame('setApiVersion', $calls[5][0]);
468448
// no cache, no annotations
469449

470-
if (PHP_VERSION_ID < 50309) {
471-
$this->assertSame(array(Validation::API_VERSION_2_4), $calls[5][1]);
472-
} else {
473-
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
474-
}
450+
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
475451
}
476452

477453
public function testFormsCanBeEnabledWithoutCsrfProtection()

‎src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php
+3-9Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,12 @@ function () { throw new TransformationFailedException(); }
224224

225225
$this->validator->validate($form, new Form());
226226

227-
$is2Dot4Api = Validation::API_VERSION_2_4 === $this->getApiVersion();
228-
229227
$this->buildViolation('invalid_message_key')
230228
->setParameter('{{ value }}', 'foo')
231229
->setParameter('{{ foo }}', 'bar')
232230
->setInvalidValue('foo')
233231
->setCode(Form::NOT_SYNCHRONIZED_ERROR)
234-
->setCause($is2Dot4Api ? null : $form->getTransformationFailure())
232+
->setCause($form->getTransformationFailure())
235233
->assertRaised();
236234
}
237235

@@ -261,14 +259,12 @@ function () { throw new TransformationFailedException(); }
261259

262260
$this->validator->validate($form, new Form());
263261

264-
$is2Dot4Api = Validation::API_VERSION_2_4 === $this->getApiVersion();
265-
266262
$this->buildViolation('invalid_message_key')
267263
->setParameter('{{ value }}', 'foo')
268264
->setParameter('{{ foo }}', 'bar')
269265
->setInvalidValue('foo')
270266
->setCode(Form::NOT_SYNCHRONIZED_ERROR)
271-
->setCause($is2Dot4Api ? null : $form->getTransformationFailure())
267+
->setCause($form->getTransformationFailure())
272268
->assertRaised();
273269
}
274270

@@ -298,13 +294,11 @@ function () { throw new TransformationFailedException(); }
298294

299295
$this->validator->validate($form, new Form());
300296

301-
$is2Dot4Api = Validation::API_VERSION_2_4 === $this->getApiVersion();
302-
303297
$this->buildViolation('invalid_message_key')
304298
->setParameter('{{ value }}', 'foo')
305299
->setInvalidValue('foo')
306300
->setCode(Form::NOT_SYNCHRONIZED_ERROR)
307-
->setCause($is2Dot4Api ? null : $form->getTransformationFailure())
301+
->setCause($form->getTransformationFailure())
308302
->assertRaised();
309303
}
310304

‎src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/LegacyFormValidator2Dot4ApiTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/LegacyFormValidator2Dot4ApiTest.php
-26Lines changed: 0 additions & 26 deletions
This file was deleted.

‎src/Symfony/Component/Security/Core/Tests/Validator/Constraints/LegacyUserPasswordValidator2Dot4ApiTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Tests/Validator/Constraints/LegacyUserPasswordValidator2Dot4ApiTest.php
-26Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.