From 907bbece010920906044a362c76c47c4e05618d6 Mon Sep 17 00:00:00 2001 From: ogizanagi Date: Thu, 3 Dec 2015 14:16:45 +0100 Subject: [PATCH 1/6] [FrameworkBundle][Validator] Fix apc cache service deprecation --- UPGRADE-2.8.md | 22 +++++++++++++++++++ UPGRADE-3.0.md | 21 ++++++++++++++++++ .../DependencyInjection/Configuration.php | 10 ++++++++- .../Resources/config/validator.xml | 2 +- .../DependencyInjection/Fixtures/php/full.php | 2 +- .../DependencyInjection/Fixtures/xml/full.xml | 2 +- .../DependencyInjection/Fixtures/yml/full.yml | 2 +- .../FrameworkExtensionTest.php | 2 +- 8 files changed, 57 insertions(+), 6 deletions(-) diff --git a/UPGRADE-2.8.md b/UPGRADE-2.8.md index 1166e6ad56..846532b2fd 100644 --- a/UPGRADE-2.8.md +++ b/UPGRADE-2.8.md @@ -453,6 +453,28 @@ FrameworkBundle cookie_httponly: false ``` + * The `validator.mapping.cache.apc` service is deprecated, and will be removed in 3.0. + Use `validator.mapping.cache.doctrine.apc` instead. + + * The ability to pass `apc` as the `framework.validation.cache` configuration key value is deprecated, + and will be removed in 3.0. Use `validator.mapping.cache.doctrine.apc` instead: + + Before: + + ```yaml + framework: + validation: + cache: apc + ``` + + After: + + ```yaml + framework: + validation: + cache: validator.mapping.cache.doctrine.apc + ``` + Security -------- diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 7acdcddfe9..15347075c8 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -481,6 +481,27 @@ UPGRADE FROM 2.x to 3.0 interface. The `security.csrf.token_manager` should be used instead. + * The `validator.mapping.cache.apc` service has been removed in favor of the `validator.mapping.cache.doctrine.apc` one. + + * The ability to pass `apc` as the `framework.validation.cache` configuration key value has been removed. + Use `validator.mapping.cache.doctrine.apc` instead: + + Before: + + ```yaml + framework: + validation: + cache: apc + ``` + + After: + + ```yaml + framework: + validation: + cache: validator.mapping.cache.doctrine.apc + ``` + ### HttpKernel * The `Symfony\Component\HttpKernel\Log\LoggerInterface` has been removed in diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 309cc6c48c..b351039da9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -645,7 +645,15 @@ class Configuration implements ConfigurationInterface ->scalarNode('cache') ->beforeNormalization() // Can be removed in 3.0, once ApcCache support is dropped - ->ifString()->then(function ($v) { return 'apc' === $v ? 'validator.mapping.cache.apc' : $v; }) + ->ifString()->then(function ($v) { + if ('apc' === $v) { + @trigger_error('The ability to pass "apc" as the framework.validation.cache configuration key value is deprecated since version 2.8 and will be removed in 3.0. Use the "validator.mapping.cache.doctrine.apc" service id instead.', E_USER_DEPRECATED); + + return 'validator.mapping.cache.apc'; + } + + return $v; + }) ->end() ->end() ->booleanNode('enable_annotations')->defaultFalse()->end() diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml index de8709ffd1..a18099f973 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml @@ -37,6 +37,7 @@ %validator.mapping.cache.prefix% + The "%service_id%" service is deprecated since Symfony 2.5 and will be removed in 3.0. @@ -47,7 +48,6 @@ - The "%service_id%" service is deprecated since Symfony 2.8 and will be removed in 3.0. diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php index 7c135dfc35..b3e32a5eb5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php @@ -55,7 +55,7 @@ $container->loadFromExtension('framework', array( ), 'validation' => array( 'enabled' => true, - 'cache' => 'apc', + 'cache' => 'validator.mapping.cache.doctrine.apc', ), 'annotations' => array( 'cache' => 'file', diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml index b94f44762f..c0ebb67ea1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml @@ -37,7 +37,7 @@ %kernel.root_dir%/Fixtures/translations - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml index 13ceca12a4..b2693d7e02 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml @@ -43,7 +43,7 @@ framework: paths: ['%kernel.root_dir%/Fixtures/translations'] validation: enabled: true - cache: apc + cache: validator.mapping.cache.doctrine.apc annotations: cache: file debug: true diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 188f421387..88141caaf0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -293,7 +293,7 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertSame('addMethodMapping', $calls[4][0]); $this->assertSame(array('loadValidatorMetadata'), $calls[4][1]); $this->assertSame('setMetadataCache', $calls[5][0]); - $this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]); + $this->assertEquals(array(new Reference('validator.mapping.cache.doctrine.apc')), $calls[5][1]); } /** From b85059a672cffb192aa1df2f7d8c33244cc82f44 Mon Sep 17 00:00:00 2001 From: Stepan Anchugov Date: Wed, 20 Jan 2016 17:10:14 +0500 Subject: [PATCH 2/6] Remove default match from AbstractConfigCommand::findExtension Previously, findExtension would return the first extension that might not even match the $name parameter. --- .../Command/AbstractConfigCommand.php | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php index aee0eb1f00..232d62ffc9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php @@ -48,26 +48,25 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand protected function findExtension($name) { - $extension = null; $bundles = $this->initializeBundles(); foreach ($bundles as $bundle) { + if ($name === $bundle->getName()) { + return $bundle->getContainerExtension(); + } + $extension = $bundle->getContainerExtension(); - - if ($extension && ($name === $extension->getAlias() || $name === $bundle->getName())) { - break; + if ($extension && $name === $extension->getAlias()) { + return $extension; } } - if (!$extension) { + if ('Bundle' !== substr($name, -6)) { + $message = sprintf('No extensions with configuration available for "%s"', $name); + } else { $message = sprintf('No extension with alias "%s" is enabled', $name); - if (preg_match('/Bundle$/', $name)) { - $message = sprintf('No extensions with configuration available for "%s"', $name); - } - - throw new \LogicException($message); } - return $extension; + throw new \LogicException($message); } public function validateConfiguration(ExtensionInterface $extension, $configuration) From 42862c4668561043b9a0aeda37e0785edb1d8d3d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 21 Jan 2016 07:28:40 +0100 Subject: [PATCH 3/6] fixed CS --- .../Extension/TranslationExtensionTest.php | 12 ++-- .../Component/Finder/Tests/FinderTest.php | 3 +- .../Session/Attribute/AttributeBagTest.php | 3 +- .../Attribute/NamespacedAttributeBagTest.php | 3 +- .../Routing/Tests/RouteCompilerTest.php | 68 +++++++++++-------- .../Component/Serializer/Serializer.php | 2 - .../Translation/Tests/fixtures/resources.php | 2 +- src/Symfony/Component/Yaml/Escaper.php | 4 +- 8 files changed, 55 insertions(+), 42 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php index 004cb8f57d..e8826f66a6 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php @@ -88,17 +88,17 @@ class TranslationExtensionTest extends TestCase // transchoice array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0),), + 'There is no apples', array('count' => 0)), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples', array('count' => 5),), + 'There is 5 apples', array('count' => 5)), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony'),), + 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony')), array('{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5),), + 'There is 5 apples (Symfony)', array('count' => 5)), array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0),), + 'There is no apples', array('count' => 0)), array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples',), + 'There is 5 apples'), // trans filter array('{{ "Hello"|trans }}', 'Hello'), diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php index cee8bd7530..aa2e706189 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -517,8 +517,7 @@ class FinderTest extends Iterator\RealIteratorTestCase $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s') ->path('/^dir/'); - $expected = array('r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir', - 'r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat',); + $expected = array('r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir', 'r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat'); $this->assertIterator($this->toAbsoluteFixtures($expected), $finder); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php index 8d0e7a5c13..ca6ce8a386 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php @@ -43,8 +43,9 @@ class AttributeBagTest extends \PHPUnit_Framework_TestCase 'category' => array( 'fishing' => array( 'first' => 'cod', - 'second' => 'sole',), + 'second' => 'sole', ), + ), ); $this->bag = new AttributeBag('_sf2'); $this->bag->initialize($this->array); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php index b8261da5d0..470038fe55 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php @@ -43,8 +43,9 @@ class NamespacedAttributeBagTest extends \PHPUnit_Framework_TestCase 'category' => array( 'fishing' => array( 'first' => 'cod', - 'second' => 'sole',), + 'second' => 'sole', ), + ), ); $this->bag = new NamespacedAttributeBag('_sf2', '/'); $this->bag->initialize($this->array); diff --git a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php index 2b7c17faaa..f0a4aa4aed 100644 --- a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php +++ b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php @@ -38,7 +38,8 @@ class RouteCompilerTest extends \PHPUnit_Framework_TestCase array('/foo'), '/foo', '#^/foo$#s', array(), array( array('text', '/foo'), - ),), + ), + ), array( 'Route with a variable', @@ -46,7 +47,8 @@ class RouteCompilerTest extends \PHPUnit_Framework_TestCase '/foo', '#^/foo/(?P[^/]++)$#s', array('bar'), array( array('variable', '/', '[^/]++', 'bar'), array('text', '/foo'), - ),), + ), + ), array( 'Route with a variable that has a default value', @@ -54,7 +56,8 @@ class RouteCompilerTest extends \PHPUnit_Framework_TestCase '/foo', '#^/foo(?:/(?P[^/]++))?$#s', array('bar'), array( array('variable', '/', '[^/]++', 'bar'), array('text', '/foo'), - ),), + ), + ), array( 'Route with several variables', @@ -63,7 +66,8 @@ class RouteCompilerTest extends \PHPUnit_Framework_TestCase array('variable', '/', '[^/]++', 'foobar'), array('variable', '/', '[^/]++', 'bar'), array('text', '/foo'), - ),), + ), + ), array( 'Route with several variables that have default values', @@ -72,7 +76,8 @@ class RouteCompilerTest extends \PHPUnit_Framework_TestCase array('variable', '/', '[^/]++', 'foobar'), array('variable', '/', '[^/]++', 'bar'), array('text', '/foo'), - ),), + ), + ), array( 'Route with several variables but some of them have no default values', @@ -81,28 +86,32 @@ class RouteCompilerTest extends \PHPUnit_Framework_TestCase array('variable', '/', '[^/]++', 'foobar'), array('variable', '/', '[^/]++', 'bar'), array('text', '/foo'), - ),), + ), + ), array( 'Route with an optional variable as the first segment', array('/{bar}', array('bar' => 'bar')), '', '#^/(?P[^/]++)?$#s', array('bar'), array( array('variable', '/', '[^/]++', 'bar'), - ),), + ), + ), array( 'Route with a requirement of 0', array('/{bar}', array('bar' => null), array('bar' => '0')), '', '#^/(?P0)?$#s', array('bar'), array( array('variable', '/', '0', 'bar'), - ),), + ), + ), array( 'Route with an optional variable as the first segment with requirements', array('/{bar}', array('bar' => 'bar'), array('bar' => '(foo|bar)')), '', '#^/(?P(foo|bar))?$#s', array('bar'), array( array('variable', '/', '(foo|bar)', 'bar'), - ),), + ), + ), array( 'Route with only optional variables', @@ -110,44 +119,49 @@ class RouteCompilerTest extends \PHPUnit_Framework_TestCase '', '#^/(?P[^/]++)?(?:/(?P[^/]++))?$#s', array('foo', 'bar'), array( array('variable', '/', '[^/]++', 'bar'), array('variable', '/', '[^/]++', 'foo'), - ),), + ), + ), array( 'Route with a variable in last position', array('/foo-{bar}'), '/foo', '#^/foo\-(?P[^/]++)$#s', array('bar'), array( - array('variable', '-', '[^/]++', 'bar'), - array('text', '/foo'), - ),), + array('variable', '-', '[^/]++', 'bar'), + array('text', '/foo'), + ), + ), array( 'Route with nested placeholders', array('/{static{var}static}'), '/{static', '#^/\{static(?P[^/]+)static\}$#s', array('var'), array( - array('text', 'static}'), - array('variable', '', '[^/]+', 'var'), - array('text', '/{static'), - ),), + array('text', 'static}'), + array('variable', '', '[^/]+', 'var'), + array('text', '/{static'), + ), + ), array( 'Route without separator between variables', array('/{w}{x}{y}{z}.{_format}', array('z' => 'default-z', '_format' => 'html'), array('y' => '(y|Y)')), '', '#^/(?P[^/\.]+)(?P[^/\.]+)(?P(y|Y))(?:(?P[^/\.]++)(?:\.(?P<_format>[^/]++))?)?$#s', array('w', 'x', 'y', 'z', '_format'), array( - array('variable', '.', '[^/]++', '_format'), - array('variable', '', '[^/\.]++', 'z'), - array('variable', '', '(y|Y)', 'y'), - array('variable', '', '[^/\.]+', 'x'), - array('variable', '/', '[^/\.]+', 'w'), - ),), + array('variable', '.', '[^/]++', '_format'), + array('variable', '', '[^/\.]++', 'z'), + array('variable', '', '(y|Y)', 'y'), + array('variable', '', '[^/\.]+', 'x'), + array('variable', '/', '[^/\.]+', 'w'), + ), + ), array( 'Route with a format', array('/foo/{bar}.{_format}'), '/foo', '#^/foo/(?P[^/\.]++)\.(?P<_format>[^/]++)$#s', array('bar', '_format'), array( - array('variable', '.', '[^/]++', '_format'), - array('variable', '/', '[^/\.]++', 'bar'), - array('text', '/foo'), - ),), + array('variable', '.', '[^/]++', '_format'), + array('variable', '/', '[^/\.]++', 'bar'), + array('text', '/foo'), + ), + ), ); } diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index 1819def5f6..c3e07e821c 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -237,7 +237,6 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz foreach ($this->normalizers as $normalizer) { if ($normalizer instanceof NormalizerInterface && $normalizer->supportsNormalization($object, $format)) { - return $normalizer->normalize($object, $format, $context); } } @@ -271,7 +270,6 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz foreach ($this->normalizers as $normalizer) { if ($normalizer instanceof DenormalizerInterface && $normalizer->supportsDenormalization($data, $class, $format)) { - return $normalizer->denormalize($data, $class, $format, $context); } } diff --git a/src/Symfony/Component/Translation/Tests/fixtures/resources.php b/src/Symfony/Component/Translation/Tests/fixtures/resources.php index c291398539..0cc2bec1d5 100644 --- a/src/Symfony/Component/Translation/Tests/fixtures/resources.php +++ b/src/Symfony/Component/Translation/Tests/fixtures/resources.php @@ -1,5 +1,5 @@ 'bar', ); diff --git a/src/Symfony/Component/Yaml/Escaper.php b/src/Symfony/Component/Yaml/Escaper.php index ac325a2c2f..cb676d0059 100644 --- a/src/Symfony/Component/Yaml/Escaper.php +++ b/src/Symfony/Component/Yaml/Escaper.php @@ -31,13 +31,13 @@ class Escaper "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9",); + "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); private static $escaped = array('\\\\', '\\"', '\\\\', '\\"', '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', - '\\N', '\\_', '\\L', '\\P',); + '\\N', '\\_', '\\L', '\\P'); /** * Determines if a PHP value would require double quoting in YAML. From 6eda9ad834a62f18342c799f4ff46e997e748285 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 21 Jan 2016 09:40:05 +0100 Subject: [PATCH 4/6] fixed test --- src/Symfony/Component/Translation/Tests/fixtures/resources.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Translation/Tests/fixtures/resources.php b/src/Symfony/Component/Translation/Tests/fixtures/resources.php index 0cc2bec1d5..c291398539 100644 --- a/src/Symfony/Component/Translation/Tests/fixtures/resources.php +++ b/src/Symfony/Component/Translation/Tests/fixtures/resources.php @@ -1,5 +1,5 @@ 'bar', ); From 06b958a17e7bf41b2ce11a083c9f1ed4470e1a8a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 21 Jan 2016 09:36:03 +0100 Subject: [PATCH 5/6] fixed CS --- src/Symfony/Component/Debug/DebugClassLoader.php | 2 +- src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php | 6 +++--- .../Component/DependencyInjection/DefinitionDecorator.php | 1 - src/Symfony/Component/Filesystem/LockHandler.php | 2 +- src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php | 2 +- .../OptionsResolver/Tests/OptionsResolver2Dot6Test.php | 4 ++-- src/Symfony/Component/Routing/Tests/RouteCompilerTest.php | 2 +- .../Serializer/Tests/Normalizer/PropertyNormalizerTest.php | 1 - .../Component/Validator/ConstraintViolationInterface.php | 1 - .../VarDumper/Tests/Test/VarDumperTestTraitRequire54.php | 2 +- .../VarDumper/Tests/Test/VarDumperTestTraitTest.php | 1 - 11 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index 95ccc8798e..c3882fba64 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -224,7 +224,7 @@ class DebugClassLoader $i = count($tail) - 1; $j = count($real) - 1; - while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) { + while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) { --$i; --$j; } diff --git a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php index 2f948d7572..50ffa7fd3c 100644 --- a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php +++ b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php @@ -175,7 +175,7 @@ class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase */ public function testDeprecatedSuper($class, $super, $type) { - set_error_handler(function() { return false; }); + set_error_handler(function () { return false; }); $e = error_reporting(0); trigger_error('', E_USER_DEPRECATED); @@ -205,7 +205,7 @@ class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase public function testDeprecatedSuperInSameNamespace() { - set_error_handler(function() { return false; }); + set_error_handler(function () { return false; }); $e = error_reporting(0); trigger_error('', E_USER_NOTICE); @@ -231,7 +231,7 @@ class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('PHP7 already prevents using reserved names.'); } - set_error_handler(function() { return false; }); + set_error_handler(function () { return false; }); $e = error_reporting(0); trigger_error('', E_USER_NOTICE); diff --git a/src/Symfony/Component/DependencyInjection/DefinitionDecorator.php b/src/Symfony/Component/DependencyInjection/DefinitionDecorator.php index 334127a379..fd5b00cd20 100644 --- a/src/Symfony/Component/DependencyInjection/DefinitionDecorator.php +++ b/src/Symfony/Component/DependencyInjection/DefinitionDecorator.php @@ -78,7 +78,6 @@ class DefinitionDecorator extends Definition /** * {@inheritdoc} - * */ public function setFactoryClass($class) { diff --git a/src/Symfony/Component/Filesystem/LockHandler.php b/src/Symfony/Component/Filesystem/LockHandler.php index b53d9f4d52..67e6f8f522 100644 --- a/src/Symfony/Component/Filesystem/LockHandler.php +++ b/src/Symfony/Component/Filesystem/LockHandler.php @@ -69,7 +69,7 @@ class LockHandler } // Silence error reporting - set_error_handler(function() {}); + set_error_handler(function () {}); if (!$this->handle = fopen($this->file, 'r')) { if ($this->handle = fopen($this->file, 'x')) { diff --git a/src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php b/src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php index 857dd5d5a7..6ada02f1ee 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php @@ -16,7 +16,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; /** * @author Paráda József - */ + */ class ChoiceSubType extends AbstractType { /** diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php index 9158c5ba06..2dc4362375 100644 --- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php +++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolver2Dot6Test.php @@ -1102,7 +1102,7 @@ class OptionsResolver2Dot6Test extends \PHPUnit_Framework_TestCase $this->resolver->setNormalizer('catcher', function (Options $options) { try { return $options['thrower']; - } catch(\Exception $e) { + } catch (\Exception $e) { return false; } }); @@ -1126,7 +1126,7 @@ class OptionsResolver2Dot6Test extends \PHPUnit_Framework_TestCase $this->resolver->setDefault('catcher', function (Options $options) { try { return $options['thrower']; - } catch(\Exception $e) { + } catch (\Exception $e) { return false; } }); diff --git a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php index f0a4aa4aed..b4b4f45a83 100644 --- a/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php +++ b/src/Symfony/Component/Routing/Tests/RouteCompilerTest.php @@ -160,7 +160,7 @@ class RouteCompilerTest extends \PHPUnit_Framework_TestCase array('variable', '.', '[^/]++', '_format'), array('variable', '/', '[^/\.]++', 'bar'), array('text', '/foo'), - ), + ), ), ); } diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php index 381936ad00..a2d1a063d3 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php @@ -510,4 +510,3 @@ class StaticPropertyDummy { private static $property = 'value'; } - diff --git a/src/Symfony/Component/Validator/ConstraintViolationInterface.php b/src/Symfony/Component/Validator/ConstraintViolationInterface.php index 1ed09b3d96..ecd07e32b0 100644 --- a/src/Symfony/Component/Validator/ConstraintViolationInterface.php +++ b/src/Symfony/Component/Validator/ConstraintViolationInterface.php @@ -60,7 +60,6 @@ interface ConstraintViolationInterface * that appear in the message template. * * @see getMessageTemplate() - * * @deprecated since version 2.7, to be replaced by getParameters() in 3.0. */ public function getMessageParameters(); diff --git a/src/Symfony/Component/VarDumper/Tests/Test/VarDumperTestTraitRequire54.php b/src/Symfony/Component/VarDumper/Tests/Test/VarDumperTestTraitRequire54.php index 240cc926aa..54f86a59db 100644 --- a/src/Symfony/Component/VarDumper/Tests/Test/VarDumperTestTraitRequire54.php +++ b/src/Symfony/Component/VarDumper/Tests/Test/VarDumperTestTraitRequire54.php @@ -14,7 +14,7 @@ namespace Symfony\Component\VarDumper\Tests\Test; use Symfony\Component\VarDumper\Test\VarDumperTestCase; use Symfony\Component\VarDumper\Test\VarDumperTestTrait; -class VarDumperTestTraitTest extends VarDumperTestCase +class VarDumperTestTraitRequire54 extends VarDumperTestCase { use VarDumperTestTrait; diff --git a/src/Symfony/Component/VarDumper/Tests/Test/VarDumperTestTraitTest.php b/src/Symfony/Component/VarDumper/Tests/Test/VarDumperTestTraitTest.php index 2be2f8c2a4..a87476be75 100644 --- a/src/Symfony/Component/VarDumper/Tests/Test/VarDumperTestTraitTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Test/VarDumperTestTraitTest.php @@ -13,4 +13,3 @@ if (PHP_VERSION_ID >= 50400) { require __DIR__.'/VarDumperTestTraitRequire54.php'; } - From 3aafa78f4d449a329c6d8a58d3088cc4183de7b8 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 21 Jan 2016 10:24:53 +0100 Subject: [PATCH 6/6] fixed CS --- src/Symfony/Bridge/PhpUnit/ClockMock.php | 1 - .../Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php | 2 +- .../FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php | 2 +- .../DependencyInjection/Compiler/PropertyInfoPassTest.php | 2 +- .../SecurityBundle/DataCollector/SecurityDataCollector.php | 2 +- .../DependencyInjection/Security/UserProvider/LdapFactory.php | 2 +- src/Symfony/Component/Config/ResourceCheckerInterface.php | 1 - src/Symfony/Component/Console/Style/SymfonyStyle.php | 4 ++-- src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php | 2 +- .../Component/DependencyInjection/Dumper/PhpDumper.php | 1 - src/Symfony/Component/Filesystem/Tests/FilesystemTest.php | 1 - .../Component/Process/Tests/ProcessFailedExceptionTest.php | 2 +- src/Symfony/Component/Security/Core/User/LdapUserProvider.php | 1 - .../Component/Translation/Catalogue/TargetOperation.php | 2 +- .../Translation/Tests/Catalogue/TargetOperationTest.php | 1 - src/Symfony/Component/Yaml/Unescaper.php | 2 +- 16 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/ClockMock.php b/src/Symfony/Bridge/PhpUnit/ClockMock.php index b81fee9658..fe5cd85125 100644 --- a/src/Symfony/Bridge/PhpUnit/ClockMock.php +++ b/src/Symfony/Bridge/PhpUnit/ClockMock.php @@ -109,5 +109,4 @@ EOPHP ); } } - } diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php index e1ec80608c..193e1e1f79 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php @@ -74,7 +74,7 @@ class ProxyDumper implements DumperInterface if (defined('Symfony\Component\DependencyInjection\ContainerInterface::SCOPE_CONTAINER') && ContainerInterface::SCOPE_CONTAINER !== $scope = $definition->getScope(false)) { $instantiation .= " \$this->scopedServices['$scope']['$id'] ="; } - } + } $methodName = 'get'.Container::camelize($id).'Service'; $proxyClass = $this->getProxyClassName($definition); diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index 47e46bc8e1..209c01ed22 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -199,7 +199,7 @@ class MarkdownDescriptor extends Descriptor $output .= "\n".'- Autowired: '.($definition->isAutowired() ? 'yes' : 'no'); foreach ($definition->getAutowiringTypes() as $autowiringType) { - $output .= "\n".'- Autowiring Type: `'.$autowiringType.'`'; + $output .= "\n".'- Autowiring Type: `'.$autowiringType.'`'; } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php index 3d41fb12b0..74f0b607bd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php @@ -53,7 +53,7 @@ class PropertyInfoPassTest extends \PHPUnit_Framework_TestCase { $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder', array('findTaggedServiceIds')); - $container->expects($this->any()) + $container->expects($this->any()) ->method('findTaggedServiceIds') ->will($this->returnValue(array())); diff --git a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php index 7b3e111974..0fff7552e8 100644 --- a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php +++ b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php @@ -89,7 +89,7 @@ class SecurityDataCollector extends DataCollector if (null !== $this->logoutUrlGenerator) { $logoutUrl = $this->logoutUrlGenerator->getLogoutPath(); } - } catch(\Exception $e) { + } catch (\Exception $e) { // fail silently when the logout URL cannot be generated } diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/LdapFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/LdapFactory.php index 068cda6a1f..8aea9074bd 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/LdapFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/LdapFactory.php @@ -52,7 +52,7 @@ class LdapFactory implements UserProviderFactoryInterface ->scalarNode('search_dn')->end() ->scalarNode('search_password')->end() ->arrayNode('default_roles') - ->beforeNormalization()->ifString()->then(function($v) { return preg_split('/\s*,\s*/', $v); })->end() + ->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end() ->requiresAtLeastOneElement() ->prototype('scalar')->end() ->end() diff --git a/src/Symfony/Component/Config/ResourceCheckerInterface.php b/src/Symfony/Component/Config/ResourceCheckerInterface.php index aaa5c5065e..27a04745a8 100644 --- a/src/Symfony/Component/Config/ResourceCheckerInterface.php +++ b/src/Symfony/Component/Config/ResourceCheckerInterface.php @@ -45,5 +45,4 @@ interface ResourceCheckerInterface * @return bool True if the resource has not changed since the given timestamp, false otherwise. */ public function isFresh(ResourceInterface $resource, $timestamp); - } diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index c69b0dc61d..47d7d1249d 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -151,7 +151,7 @@ class SymfonyStyle extends OutputStyle $messages = is_array($message) ? array_values($message) : array($message); foreach ($messages as $message) { - $this->writeln(sprintf(' %s', $message)); + $this->writeln(sprintf(' %s', $message)); } } @@ -164,7 +164,7 @@ class SymfonyStyle extends OutputStyle $messages = is_array($message) ? array_values($message) : array($message); foreach ($messages as $message) { - $this->writeln(sprintf(' // %s', $message)); + $this->writeln(sprintf(' // %s', $message)); } } diff --git a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php index 7973f14b51..a5ce693078 100644 --- a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php +++ b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php @@ -205,7 +205,7 @@ class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase public function testInterfaceExtendsDeprecatedInterface() { - set_error_handler(function() { return false; }); + set_error_handler(function () { return false; }); $e = error_reporting(0); trigger_error('', E_USER_NOTICE); diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 23697cbf42..32fa6036e4 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -622,7 +622,6 @@ EOF; * * This service is autowired. EOF; - } if ($definition->isLazy()) { diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index 73695fb7ab..7341536e4f 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -1005,7 +1005,6 @@ class FilesystemTest extends FilesystemTestCase // The compress.zlib:// stream does not support mode x: creates the file, errors "failed to open stream: operation failed" and returns false $this->filesystem->tempnam($dirname, 'bar'); - } public function testTempnamWithPHPTempSchemeFails() diff --git a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php index 0d763a470d..963bbb3010 100644 --- a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php @@ -132,7 +132,7 @@ class ProcessFailedExceptionTest extends \PHPUnit_Framework_TestCase ->method('isOutputDisabled') ->will($this->returnValue(true)); - $process->expects($this->once()) + $process->expects($this->once()) ->method('getWorkingDirectory') ->will($this->returnValue($workingDirectory)); diff --git a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php index 988a595f58..15935648ab 100644 --- a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php +++ b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php @@ -105,5 +105,4 @@ class LdapUserProvider implements UserProviderInterface { return $class === 'Symfony\Component\Security\Core\User\User'; } - } diff --git a/src/Symfony/Component/Translation/Catalogue/TargetOperation.php b/src/Symfony/Component/Translation/Catalogue/TargetOperation.php index eea1fefe2f..e081e139a3 100644 --- a/src/Symfony/Component/Translation/Catalogue/TargetOperation.php +++ b/src/Symfony/Component/Translation/Catalogue/TargetOperation.php @@ -42,7 +42,7 @@ class TargetOperation extends AbstractOperation // // For 'obsolete' messages, the code can't be simplifed as ``array_diff_assoc($this->source->all($domain), $this->target->all($domain))`` // because doing so will not exclude messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback} - + foreach ($this->source->all($domain) as $id => $message) { if ($this->target->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; diff --git a/src/Symfony/Component/Translation/Tests/Catalogue/TargetOperationTest.php b/src/Symfony/Component/Translation/Tests/Catalogue/TargetOperationTest.php index 0217162aea..271d17fb8f 100644 --- a/src/Symfony/Component/Translation/Tests/Catalogue/TargetOperationTest.php +++ b/src/Symfony/Component/Translation/Tests/Catalogue/TargetOperationTest.php @@ -79,5 +79,4 @@ class TargetOperationTest extends AbstractOperationTest { return new TargetOperation($source, $target); } - } diff --git a/src/Symfony/Component/Yaml/Unescaper.php b/src/Symfony/Component/Yaml/Unescaper.php index d2f5054ad2..bb3301615b 100644 --- a/src/Symfony/Component/Yaml/Unescaper.php +++ b/src/Symfony/Component/Yaml/Unescaper.php @@ -34,7 +34,7 @@ class Unescaper /** * Regex fragment that matches an escaped character in a double quoted string. */ - const REGEX_ESCAPED_CHARACTER = "\\\\(x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.)"; + const REGEX_ESCAPED_CHARACTER = '\\\\(x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.)'; /** * Unescapes a single quoted string.