From 26f933e7bd4c500cc5a4a1ebf04d26caf2c1c7b9 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 1 May 2012 14:46:26 +0200 Subject: [PATCH] fixed CS --- check_cs | 1 + .../Propel1/Tests/Fixtures/ReadOnlyItem.php | 2 - .../views/Form/form_div_layout.html.twig | 2 +- .../FrameworkExtension.php | 2 +- .../Resources/views/Form/attributes.html.php | 2 +- .../views/Form/choice_options.html.php | 2 +- .../views/Form/container_attributes.html.php | 2 +- .../views/Form/field_enctype.html.php | 2 +- .../views/Form/field_errors.html.php | 2 +- .../Resources/views/Form/field_label.html.php | 2 +- .../Resources/views/Form/field_rest.html.php | 2 +- .../Resources/views/Form/field_row.html.php | 2 +- .../Resources/views/Form/field_rows.html.php | 2 +- .../views/Form/field_widget.html.php | 2 +- .../views/Form/form_widget_compound.html.php | 2 +- .../views/FormTable/form_errors.html.php | 2 +- .../views/Profiler/toolbar_style.html.twig | 2 +- .../Resources/views/Router/panel.html.twig | 2 +- .../ClassLoader/ClassCollectionLoader.php | 1 + .../Component/ClassLoader/ClassLoader.php | 2 +- .../ClassLoader/DebugClassLoader.php | 2 +- .../Tests/ClassCollectionLoaderTest.php | 2 +- src/Symfony/Component/Console/README.md | 2 +- .../DependencyInjection/Container.php | 2 +- .../DependencyInjection/Dumper/YamlDumper.php | 33 +++-- .../IntrospectableContainerInterface.php | 6 +- .../Component/DependencyInjection/README.md | 4 +- .../Tests/Fixtures/php/services9.php | 1 + .../Tests/Fixtures/yaml/services9.yml | 4 +- src/Symfony/Component/Finder/Finder.php | 2 +- .../Component/Finder/Tests/FinderTest.php | 14 +-- .../MultiplePcreFilterIteratorTest.php | 2 +- src/Symfony/Component/Form/CHANGELOG.md | 2 +- src/Symfony/Component/Form/DefaultOptions.php | 2 +- src/Symfony/Component/Form/LazyOption.php | 2 +- src/Symfony/Component/Form/Options.php | 50 ++++---- .../Form/Tests/DefaultOptionsTest.php | 2 +- ...ollectionListenerCustomArrayObjectTest.php | 4 +- .../Form/Tests/Fixtures/AuthorType.php | 2 - .../Form/Tests/Fixtures/CustomArrayObject.php | 114 +++++++++--------- .../Component/Form/Tests/OptionsTest.php | 8 +- .../Handler/MemcacheSessionHandler.php | 1 + .../Storage/Handler/MongoDbSessionHandler.php | 2 +- .../HttpFoundation/Tests/RequestTest.php | 2 +- .../Handler/MongoDbSessionHandlerTest.php | 2 +- .../Tests/Profiler/Mock/MemcacheMock.php | 18 +++ .../Tests/Profiler/Mock/MemcachedMock.php | 14 +++ .../Tests/Profiler/Mock/RedisMock.php | 13 ++ .../Matcher/Dumper/PhpMatcherDumper.php | 6 +- .../Tests/Fixtures/dumper/url_matcher1.php | 20 +++ .../Tests/Fixtures/dumper/url_matcher2.php | 25 ++++ .../Tests/Fixtures/dumper/url_matcher3.php | 1 + .../Tests/Acl/Domain/ObjectIdentityTest.php | 20 +-- .../Tests/Core/Util/ClassUtilsTest.php | 4 +- .../Normalizer/GetSetMethodNormalizerTest.php | 1 + .../Validator/Constraints/EmailValidator.php | 6 +- .../Component/Validator/ExecutionContext.php | 6 +- 57 files changed, 276 insertions(+), 163 deletions(-) diff --git a/check_cs b/check_cs index fea3419fb2..7d079be518 100755 --- a/check_cs +++ b/check_cs @@ -28,6 +28,7 @@ $finder ->name('*.yml') ->in(__DIR__.'/src') ->notName(basename(__FILE__)) + ->notName('sfTests.yml') ->exclude('.git') ->exclude('vendor') ; diff --git a/src/Symfony/Bridge/Propel1/Tests/Fixtures/ReadOnlyItem.php b/src/Symfony/Bridge/Propel1/Tests/Fixtures/ReadOnlyItem.php index 034c1678f5..fbedf25a57 100644 --- a/src/Symfony/Bridge/Propel1/Tests/Fixtures/ReadOnlyItem.php +++ b/src/Symfony/Bridge/Propel1/Tests/Fixtures/ReadOnlyItem.php @@ -11,8 +11,6 @@ namespace Symfony\Bridge\Propel1\Tests\Fixtures; -use \PropelPDO; - class ReadOnlyItem extends \BaseObject { public function getName() diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index 468423b66d..ded3034106 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -326,4 +326,4 @@ {% block field_enctype %}{{ block('form_enctype') }}{% endblock %} {% block field_errors %}{{ block('form_errors') }}{% endblock %} {% block field_rest %}{{ block('form_rest') }}{% endblock %} -{% block field_rows %}{{ block('form_rows') }}{% endblock %} \ No newline at end of file +{% block field_rows %}{{ block('form_rows') }}{% endblock %} diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index d497756688..6fd52fa15c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -644,7 +644,7 @@ class FrameworkExtension extends Extension ->replaceArgument(2, $config['debug']) ; $container->setAlias('annotation_reader', 'annotations.file_cache_reader'); - } else if('none' !== $config['cache']) { + } elseif ('none' !== $config['cache']) { $container ->getDefinition('annotations.cached_reader') ->replaceArgument(1, new Reference($config['cache'])) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php index 12366d6e44..632b311cdf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php @@ -1 +1 @@ -renderBlock('widget_attributes') ?> \ No newline at end of file +renderBlock('widget_attributes') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php index 298df7b300..eae0d92827 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php @@ -1 +1 @@ -renderBlock('choice_widget_options') ?> \ No newline at end of file +renderBlock('choice_widget_options') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php index e132ed73c4..3edfa44eef 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php @@ -1 +1 @@ -renderBlock('widget_container_attributes') ?> \ No newline at end of file +renderBlock('widget_container_attributes') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_enctype.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_enctype.html.php index aa4ff39bba..baab129372 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_enctype.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_enctype.html.php @@ -1 +1 @@ -renderBlock('form_enctype') ?> \ No newline at end of file +renderBlock('form_enctype') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_errors.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_errors.html.php index d7b87ea2bc..d4cbe1b721 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_errors.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_errors.html.php @@ -1 +1 @@ -renderBlock('form_errors') ?> \ No newline at end of file +renderBlock('form_errors') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_label.html.php index 7c0c1b7559..71d055cf61 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_label.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_label.html.php @@ -1 +1 @@ -renderBlock('form_label') ?> \ No newline at end of file +renderBlock('form_label') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_rest.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_rest.html.php index a570b1045a..fe9bae0c55 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_rest.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_rest.html.php @@ -1 +1 @@ -renderBlock('form_rest') ?> \ No newline at end of file +renderBlock('form_rest') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_row.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_row.html.php index c91dcb5543..8077ff3162 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_row.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_row.html.php @@ -1 +1 @@ -renderBlock('form_row') ?> \ No newline at end of file +renderBlock('form_row') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_rows.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_rows.html.php index ef0bf384a6..b9a07bc466 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_rows.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_rows.html.php @@ -1 +1 @@ -renderBlock('form_rows') ?> \ No newline at end of file +renderBlock('form_rows') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_widget.html.php index bad67a85e2..9bce25bd9d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/field_widget.html.php @@ -1 +1 @@ -renderBlock('form_widget_single_control') ?> \ No newline at end of file +renderBlock('form_widget_single_control') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_widget_compound.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_widget_compound.html.php index ee349d1bd7..705664b4b9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_widget_compound.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_widget_compound.html.php @@ -1,4 +1,4 @@
renderBlock('widget_container_attributes') ?>> renderBlock('form_rows') ?> rest($form) ?> -
\ No newline at end of file + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_errors.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_errors.html.php index 1a889760ca..5149209e35 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_errors.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_errors.html.php @@ -48,4 +48,4 @@ - \ No newline at end of file + diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig index 039da02a41..8c0ed59c27 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig @@ -263,4 +263,4 @@ display: none; } } - \ No newline at end of file + diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Router/panel.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Router/panel.html.twig index d5e8623229..ab0eaf6518 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Router/panel.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Router/panel.html.twig @@ -41,4 +41,4 @@ Note: The above matching is based on the configuration for the current router which might differ from the configuration used while routing this request. - \ No newline at end of file + diff --git a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php index 64ea1af68a..017d5506a3 100644 --- a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -154,6 +154,7 @@ class ClassCollectionLoader $inNamespace = false; --$i; } else { + $output = rtrim($output); $output .= "\n{"; $inNamespace = true; } diff --git a/src/Symfony/Component/ClassLoader/ClassLoader.php b/src/Symfony/Component/ClassLoader/ClassLoader.php index c249347db5..7a8a6fcf82 100644 --- a/src/Symfony/Component/ClassLoader/ClassLoader.php +++ b/src/Symfony/Component/ClassLoader/ClassLoader.php @@ -143,7 +143,7 @@ class ClassLoader * Loads the given class or interface. * * @param string $class The name of the class - * + * * @return Boolean|null True, if loaded */ public function loadClass($class) diff --git a/src/Symfony/Component/ClassLoader/DebugClassLoader.php b/src/Symfony/Component/ClassLoader/DebugClassLoader.php index 568063ea05..da7d289df2 100644 --- a/src/Symfony/Component/ClassLoader/DebugClassLoader.php +++ b/src/Symfony/Component/ClassLoader/DebugClassLoader.php @@ -73,7 +73,7 @@ class DebugClassLoader * Loads the given class or interface. * * @param string $class The name of the class - * + * * @return Boolean|null True, if loaded */ public function loadClass($class) diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php index cd1c439c41..5f4db1f06e 100644 --- a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php @@ -43,7 +43,7 @@ namespace Foo { class Foo {} } -namespace Bar +namespace Bar { class Foo {} } diff --git a/src/Symfony/Component/Console/README.md b/src/Symfony/Component/Console/README.md index 0eb7d95410..bfbfb91b6c 100644 --- a/src/Symfony/Component/Console/README.md +++ b/src/Symfony/Component/Console/README.md @@ -48,7 +48,7 @@ You can run the unit tests with the following command: phpunit -c src/Symfony/Component/Console Resources ---------- +--------- [The Console Component](http://symfony.com/doc/current/components/console.html) diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index cf29685c60..50cef155e6 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -265,7 +265,7 @@ class Container implements IntrospectableContainerInterface throw new ServiceNotFoundException($id); } } - + /** * Returns true if the given service has actually been initialized * diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php index 5768c1e927..6186202c64 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -11,11 +11,12 @@ namespace Symfony\Component\DependencyInjection\Dumper; -use Symfony\Component\Yaml\Yaml; +use Symfony\Component\Yaml\Dumper as YmlDumper; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Parameter; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\ContainerBuilder; /** * YamlDumper dumps a service container as a YAML string. @@ -26,6 +27,22 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; */ class YamlDumper extends Dumper { + private $dumper; + + /** + * Constructor. + * + * @param ContainerBuilder $container The service container to dump + * + * @api + */ + public function __construct(ContainerBuilder $container) + { + parent::__construct($container); + + $this->dumper = new YmlDumper(); + } + /** * Dumps the service container as an YAML string. * @@ -60,11 +77,11 @@ class YamlDumper extends Dumper foreach ($tags as $attributes) { $att = array(); foreach ($attributes as $key => $value) { - $att[] = sprintf('%s: %s', Yaml::dump($key), Yaml::dump($value)); + $att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value)); } $att = $att ? ', '.implode(' ', $att) : ''; - $tagsCode .= sprintf(" - { name: %s%s }\n", Yaml::dump($name), $att); + $tagsCode .= sprintf(" - { name: %s%s }\n", $this->dumper->dump($name), $att); } } if ($tagsCode) { @@ -84,15 +101,15 @@ class YamlDumper extends Dumper } if ($definition->getArguments()) { - $code .= sprintf(" arguments: %s\n", Yaml::dump($this->dumpValue($definition->getArguments()), 0)); + $code .= sprintf(" arguments: %s\n", $this->dumper->dump($this->dumpValue($definition->getArguments()), 0)); } if ($definition->getProperties()) { - $code .= sprintf(" properties: %s\n", Yaml::dump($this->dumpValue($definition->getProperties()), 0)); + $code .= sprintf(" properties: %s\n", $this->dumper->dump($this->dumpValue($definition->getProperties()), 0)); } if ($definition->getMethodCalls()) { - $code .= sprintf(" calls:\n %s\n", str_replace("\n", "\n ", Yaml::dump($this->dumpValue($definition->getMethodCalls()), 1))); + $code .= sprintf(" calls:\n%s\n", $this->dumper->dump($this->dumpValue($definition->getMethodCalls()), 1, 12)); } if (ContainerInterface::SCOPE_CONTAINER !== $scope = $definition->getScope()) { @@ -108,7 +125,7 @@ class YamlDumper extends Dumper } } - $code .= sprintf(" configurator: %s\n", Yaml::dump($callable, 0)); + $code .= sprintf(" configurator: %s\n", $this->dumper->dump($callable, 0)); } return $code; @@ -171,7 +188,7 @@ class YamlDumper extends Dumper $parameters = $this->container->getParameterBag()->all(); } - return Yaml::dump(array('parameters' => $parameters), 2); + return $this->dumper->dump(array('parameters' => $parameters), 2); } /** diff --git a/src/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php b/src/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php index 726652c05e..0ffc7297bb 100644 --- a/src/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php +++ b/src/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php @@ -24,10 +24,10 @@ interface IntrospectableContainerInterface extends ContainerInterface * Check for whether or not a service has been initialized. * * @param string $id - * + * * @return Boolean true if the service has been initialized, false otherwise * */ function initialized($id); - -} \ No newline at end of file + +} diff --git a/src/Symfony/Component/DependencyInjection/README.md b/src/Symfony/Component/DependencyInjection/README.md index 06ebe3dfa2..3eb1a3b1f6 100644 --- a/src/Symfony/Component/DependencyInjection/README.md +++ b/src/Symfony/Component/DependencyInjection/README.md @@ -48,8 +48,8 @@ If your service is retrieved by calling a static method: File Include: -For some services, especially those that are difficult or impossible to -autoload, you may need the container to include a file before +For some services, especially those that are difficult or impossible to +autoload, you may need the container to include a file before instantiating your class. $sc = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index 5ab7bab8e9..c1513b63ea 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -104,6 +104,7 @@ class ProjectServiceContainer extends Container protected function getFooBarService() { $class = $this->getParameter('foo_class'); + return $this->services['foo_bar'] = new $class(); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml index 2aa47a5d99..0fd2ae37bf 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml @@ -15,7 +15,7 @@ services: calls: - [setBar, ['@bar']] - [initialize, { }] - + scope: prototype configurator: sc_configure bar: @@ -36,7 +36,7 @@ services: - [setBar, ['@?foo2']] - [setBar, ['@?foo3']] - [setBar, ['@?foobaz']] - + factory_service: factory_method: getInstance factory_service: foo.baz diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index 0f5dd17f36..1f8d7f1993 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -558,7 +558,7 @@ class Finder implements \IteratorAggregate, \Countable throw new \InvalidArgumentException('Finder::append() method wrong argument type.'); } } - + /** * Counts all the results collected by the iterators. * diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php index fe29424bb2..6595528e1c 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -320,33 +320,33 @@ class FinderTest extends Iterator\RealIteratorTestCase $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator()); } - + public function testCountDirectories() { $finder = new Finder(); $directory = $finder->directories()->in(self::$tmpDir); $i = 0; - + foreach ($directory as $dir) { $i++; } - + $this->assertCount($i, $directory); } - + public function testCountFiles() { $finder = new Finder(); $files = $finder->files()->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'); $i = 0; - + foreach ($files as $file) { $i++; } - + $this->assertCount($i, $files); } - + public function testCountWithoutIn() { $finder = new Finder(); diff --git a/src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php index 46c94a4191..74414465ce 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php @@ -62,4 +62,4 @@ class TestMultiplePcreFilterIterator extends MultiplePcreFilterIterator { throw new \BadFunctionCallException('Not implemented'); } -} \ No newline at end of file +} diff --git a/src/Symfony/Component/Form/CHANGELOG.md b/src/Symfony/Component/Form/CHANGELOG.md index 818b43e969..1e056e978f 100644 --- a/src/Symfony/Component/Form/CHANGELOG.md +++ b/src/Symfony/Component/Form/CHANGELOG.md @@ -69,4 +69,4 @@ CHANGELOG * added method `guessPattern` to FormTypeGuesserInterface to guess which pattern to use in the HTML5 attribute "pattern" * deprecated method `guessMinLength` in favor of `guessPattern` * labels don't display field attributes anymore. Label attributes can be - passed in the "label_attr" option/variable \ No newline at end of file + passed in the "label_attr" option/variable diff --git a/src/Symfony/Component/Form/DefaultOptions.php b/src/Symfony/Component/Form/DefaultOptions.php index 4d77a7db47..9dba4b9e9d 100644 --- a/src/Symfony/Component/Form/DefaultOptions.php +++ b/src/Symfony/Component/Form/DefaultOptions.php @@ -317,4 +317,4 @@ class DefaultOptions } } } -} \ No newline at end of file +} diff --git a/src/Symfony/Component/Form/LazyOption.php b/src/Symfony/Component/Form/LazyOption.php index 060d77bdfa..69365ec996 100644 --- a/src/Symfony/Component/Form/LazyOption.php +++ b/src/Symfony/Component/Form/LazyOption.php @@ -70,4 +70,4 @@ class LazyOption return $this->closure->__invoke($options, $this->previousValue); } -} \ No newline at end of file +} diff --git a/src/Symfony/Component/Form/Options.php b/src/Symfony/Component/Form/Options.php index 028e4ac19b..ef2254f7a3 100644 --- a/src/Symfony/Component/Form/Options.php +++ b/src/Symfony/Component/Form/Options.php @@ -203,8 +203,8 @@ class Options implements ArrayAccess, Iterator */ public function offsetExists($option) { - return isset($this->options[$option]); - } + return isset($this->options[$option]); + } /** * Returns the value of the given option. @@ -220,7 +220,7 @@ class Options implements ArrayAccess, Iterator * between two lazy options. * * @see ArrayAccess::offsetGet() - */ + */ public function offsetGet($option) { if (!array_key_exists($option, $this->options)) { @@ -243,8 +243,8 @@ class Options implements ArrayAccess, Iterator $this->lock[$option] = false; } - return $this->options[$option]; - } + return $this->options[$option]; + } /** * Sets the value of a given option. @@ -259,7 +259,7 @@ class Options implements ArrayAccess, Iterator * * @see DefaultOptions::add() * @see ArrayAccess::offsetSet() - */ + */ public function offsetSet($option, $value) { // Setting is not possible once an option is read, because then lazy @@ -288,7 +288,7 @@ class Options implements ArrayAccess, Iterator } $this->options[$option] = $newValue; - } + } /** * Removes an option with the given name. @@ -300,7 +300,7 @@ class Options implements ArrayAccess, Iterator * becomes immutable. * * @see ArrayAccess::offsetUnset() - */ + */ public function offsetUnset($option) { if ($this->resolved) { @@ -308,8 +308,8 @@ class Options implements ArrayAccess, Iterator } unset($this->options[$option]); - unset($this->allowedValues[$option]); - unset($this->lock[$option]); + unset($this->allowedValues[$option]); + unset($this->lock[$option]); } /** @@ -324,41 +324,41 @@ class Options implements ArrayAccess, Iterator /** * @see Iterator::current() - */ + */ public function current() { - return $this->offsetGet($this->key()); - } + return $this->offsetGet($this->key()); + } /** * @see Iterator::next() - */ + */ public function next() { - next($this->options); - } + next($this->options); + } /** * @see Iterator::key() - */ + */ public function key() { - return key($this->options); - } + return key($this->options); + } /** * @see Iterator::valid() - */ + */ public function valid() { - return null !== $this->key(); - } + return null !== $this->key(); + } /** * @see Iterator::rewind() - */ + */ public function rewind() { - reset($this->options); + reset($this->options); } -} \ No newline at end of file +} diff --git a/src/Symfony/Component/Form/Tests/DefaultOptionsTest.php b/src/Symfony/Component/Form/Tests/DefaultOptionsTest.php index 9f32b72cf1..e22131d563 100644 --- a/src/Symfony/Component/Form/Tests/DefaultOptionsTest.php +++ b/src/Symfony/Component/Form/Tests/DefaultOptionsTest.php @@ -73,4 +73,4 @@ class DefaultOptionsTest extends \PHPUnit_Framework_TestCase 'foo' => 'bam', )); } -} \ No newline at end of file +} diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php index 368cdb6aaa..9557216aa8 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php @@ -10,8 +10,8 @@ */ namespace Symfony\Component\Form\Tests\Extension\Core\EventListener; - -use Symfony\Component\Form\Tests\Fixtures\CustomArrayObject; + +use Symfony\Component\Form\Tests\Fixtures\CustomArrayObject; class MergeCollectionListenerCustomArrayObjectTest extends MergeCollectionListenerTest { diff --git a/src/Symfony/Component/Form/Tests/Fixtures/AuthorType.php b/src/Symfony/Component/Form/Tests/Fixtures/AuthorType.php index 43569843f0..5d9ee35c65 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/AuthorType.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/AuthorType.php @@ -2,8 +2,6 @@ namespace Symfony\Component\Form\Tests\Fixtures; -use Symfony\Component\Form\FormInterface; - use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilder; diff --git a/src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php b/src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php index b4224b3f3e..950f677fd0 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php @@ -11,60 +11,60 @@ namespace Symfony\Component\Form\Tests\Fixtures; -/** - * This class is a hand written simplified version of PHP native `ArrayObject` - * class, to show that it behaves differently than the PHP native implementation. - */ -class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable -{ - private $array; - - public function __construct(array $array = null) - { - $this->array = $array ?: array(); - } - - public function offsetExists($offset) - { - return array_key_exists($offset, $this->array); - } - - public function offsetGet($offset) - { - return $this->array[$offset]; - } - - public function offsetSet($offset, $value) - { - if (null === $offset) { - $this->array[] = $value; - } else { - $this->array[$offset] = $value; - } - } - - public function offsetUnset($offset) - { - unset($this->array[$offset]); - } - - public function getIterator() - { - return new \ArrayIterator($this->array); - } - - public function count() - { - return count($this->array); - } - - public function serialize() - { - return serialize($this->array); - } - - public function unserialize($serialized) - { - $this->array = (array) unserialize((string) $serialized); - } -} \ No newline at end of file +/** + * This class is a hand written simplified version of PHP native `ArrayObject` + * class, to show that it behaves differently than the PHP native implementation. + */ +class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable +{ + private $array; + + public function __construct(array $array = null) + { + $this->array = $array ?: array(); + } + + public function offsetExists($offset) + { + return array_key_exists($offset, $this->array); + } + + public function offsetGet($offset) + { + return $this->array[$offset]; + } + + public function offsetSet($offset, $value) + { + if (null === $offset) { + $this->array[] = $value; + } else { + $this->array[$offset] = $value; + } + } + + public function offsetUnset($offset) + { + unset($this->array[$offset]); + } + + public function getIterator() + { + return new \ArrayIterator($this->array); + } + + public function count() + { + return count($this->array); + } + + public function serialize() + { + return serialize($this->array); + } + + public function unserialize($serialized) + { + $this->array = (array) unserialize((string) $serialized); + } +} diff --git a/src/Symfony/Component/Form/Tests/OptionsTest.php b/src/Symfony/Component/Form/Tests/OptionsTest.php index 89b0a07f7f..2590adb396 100644 --- a/src/Symfony/Component/Form/Tests/OptionsTest.php +++ b/src/Symfony/Component/Form/Tests/OptionsTest.php @@ -40,9 +40,9 @@ class OptionsTest extends \PHPUnit_Framework_TestCase $this->assertFalse(isset($this->options['bar'])); $this->assertEquals(0, $this->options['foo']); } - - /** - * @expectedException \OutOfBoundsException + + /** + * @expectedException \OutOfBoundsException */ public function testGetNonExisting() { @@ -165,4 +165,4 @@ class OptionsTest extends \PHPUnit_Framework_TestCase $this->options['foo']; } -} \ No newline at end of file +} diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php index fe29832f70..bc21b5f730 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php @@ -120,6 +120,7 @@ class MemcacheSessionHandler implements \SessionHandlerInterface if (!$this->memcache->replace($this->prefix.$sessionId, $data, 0, $this->memcacheOptions['expiretime'])) { return $this->memcache->set($this->prefix.$sessionId, $data, 0, $this->memcacheOptions['expiretime']); } + return true; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 59ea5d7288..6006773c9d 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -142,4 +142,4 @@ class MongoDbSessionHandler implements \SessionHandlerInterface return $this->collection; } -} \ No newline at end of file +} diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 84f19a26c9..e6f5aff7e6 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1053,7 +1053,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase array('fo%2Bo/bar', 'fo+o', 'fo%2Bo'), ); } - + private function stopTrustingProxyData() { $class = new \ReflectionClass('Symfony\\Component\\HttpFoundation\\Request'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index f4e3310e5f..c9eb0b38d6 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -96,4 +96,4 @@ class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase $this->assertEquals(0, $coll->count()); } -} \ No newline at end of file +} diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcacheMock.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcacheMock.php index 2673042b99..2985389a48 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcacheMock.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcacheMock.php @@ -40,8 +40,10 @@ class MemcacheMock { if ('127.0.0.1' == $host && 11211 == $port) { $this->connected = true; + return true; } + return false; } @@ -58,8 +60,10 @@ class MemcacheMock { if ('127.0.0.1' == $host && 11211 == $port) { $this->connected = true; + return true; } + return false; } @@ -82,8 +86,10 @@ class MemcacheMock { if ('127.0.0.1' == $host && 11211 == $port) { $this->connected = true; + return true; } + return false; } @@ -105,8 +111,10 @@ class MemcacheMock if (!isset($this->storage[$key])) { $this->storeData($key, $var); + return true; } + return false; } @@ -127,6 +135,7 @@ class MemcacheMock } $this->storeData($key, $var); + return true; } @@ -148,8 +157,10 @@ class MemcacheMock if (isset($this->storage[$key])) { $this->storeData($key, $var); + return true; } + return false; } @@ -174,6 +185,7 @@ class MemcacheMock $result[] = $this->getData($k); } } + return $result; } @@ -195,8 +207,10 @@ class MemcacheMock if (isset($this->storage[$key])) { unset($this->storage[$key]); + return true; } + return false; } @@ -212,6 +226,7 @@ class MemcacheMock } $this->storage = array(); + return true; } @@ -223,6 +238,7 @@ class MemcacheMock public function close() { $this->connected = false; + return true; } @@ -231,12 +247,14 @@ class MemcacheMock if (isset($this->storage[$key])) { return unserialize($this->storage[$key]); } + return false; } private function storeData($key, $value) { $this->storage[$key] = serialize($value); + return true; } } diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcachedMock.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcachedMock.php index 995258d5e9..4971de1982 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcachedMock.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcachedMock.php @@ -53,8 +53,10 @@ class MemcachedMock { if ('127.0.0.1' == $host && 11211 == $port) { $this->connected = true; + return true; } + return false; } @@ -75,8 +77,10 @@ class MemcachedMock if (!isset($this->storage[$key])) { $this->storeData($key, $value); + return true; } + return false; } @@ -96,6 +100,7 @@ class MemcachedMock } $this->storeData($key, $value); + return true; } @@ -116,8 +121,10 @@ class MemcachedMock if (isset($this->storage[$key])) { $this->storeData($key, $value); + return true; } + return false; } @@ -155,8 +162,10 @@ class MemcachedMock if (isset($this->storage[$key])) { $this->storeData($key, $this->getData($key).$value); + return true; } + return false; } @@ -175,8 +184,10 @@ class MemcachedMock if (isset($this->storage[$key])) { unset($this->storage[$key]); + return true; } + return false; } @@ -192,6 +203,7 @@ class MemcachedMock } $this->storage = array(); + return true; } @@ -200,12 +212,14 @@ class MemcachedMock if (isset($this->storage[$key])) { return unserialize($this->storage[$key]); } + return false; } private function storeData($key, $value) { $this->storage[$key] = serialize($value); + return true; } } diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/RedisMock.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/RedisMock.php index dca419b03d..9db2492815 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/RedisMock.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/Mock/RedisMock.php @@ -41,8 +41,10 @@ class RedisMock { if ('127.0.0.1' == $host && 6379 == $port) { $this->connected = true; + return true; } + return false; } @@ -95,6 +97,7 @@ class RedisMock } $this->storeData($key, $value); + return true; } @@ -115,6 +118,7 @@ class RedisMock if (isset($this->storage[$key])) { return true; } + return false; } @@ -150,8 +154,10 @@ class RedisMock if (isset($this->storage[$key])) { $this->storeData($key, $this->getData($key).$value); + return strlen($this->storage[$key]); } + return false; } @@ -176,13 +182,16 @@ class RedisMock ++$result; } } + return $result; } if (isset($this->storage[$key])) { unset($this->storage[$key]); + return 1; } + return 0; } @@ -198,6 +207,7 @@ class RedisMock } $this->storage = array(); + return true; } @@ -209,6 +219,7 @@ class RedisMock public function close() { $this->connected = false; + return true; } @@ -217,12 +228,14 @@ class RedisMock if (isset($this->storage[$key])) { return unserialize($this->storage[$key]); } + return false; } private function storeData($key, $value) { $this->storage[$key] = serialize($value); + return true; } } diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php index bc26c0cd0f..f589cef03c 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php @@ -231,6 +231,7 @@ EOF; goto $gotoname; } + EOF; } else { $methods = implode("', '", $methods); @@ -240,6 +241,7 @@ EOF; goto $gotoname; } + EOF; } } @@ -250,6 +252,7 @@ EOF; return \$this->redirect(\$pathinfo.'/', '$name'); } + EOF; } @@ -263,6 +266,7 @@ EOF; return \$this->redirect(\$pathinfo, '$name', '$scheme'); } + EOF; } @@ -271,7 +275,7 @@ EOF; $code .= sprintf(" return array_merge(\$this->mergeDefaults(\$matches, %s), array('_route' => '%s'));\n" , str_replace("\n", '', var_export($compiledRoute->getDefaults(), true)), $name); } elseif (true === $matches) { - $code .= sprintf(" \$matches['_route'] = '%s';\n", $name); + $code .= sprintf(" \$matches['_route'] = '%s';\n\n", $name); $code .= " return \$matches;\n"; } elseif ($compiledRoute->getDefaults()) { $code .= sprintf(" return %s;\n", str_replace("\n", '', var_export(array_merge($compiledRoute->getDefaults(), array('_route' => $name)), true))); diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php index 2c764d0df3..87ac0d10a0 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php @@ -36,7 +36,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher $allow = array_merge($allow, array('GET', 'HEAD')); goto not_bar; } + $matches['_route'] = 'bar'; + return $matches; } not_bar: @@ -47,7 +49,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher $allow = array_merge($allow, array('GET', 'HEAD')); goto not_barhead; } + $matches['_route'] = 'barhead'; + return $matches; } not_barhead: @@ -70,6 +74,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // baz4 if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+?)/$#s', $pathinfo, $matches)) { $matches['_route'] = 'baz4'; + return $matches; } @@ -79,7 +84,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher $allow[] = 'POST'; goto not_baz5; } + $matches['_route'] = 'baz5'; + return $matches; } not_baz5: @@ -90,7 +97,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher $allow[] = 'PUT'; goto not_bazbaz6; } + $matches['_route'] = 'baz.baz6'; + return $matches; } not_bazbaz6: @@ -103,6 +112,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // quoter if (preg_match('#^/(?[\']+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'quoter'; + return $matches; } @@ -116,12 +126,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // foo1 if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo1'; + return $matches; } // bar1 if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'bar1'; + return $matches; } @@ -130,6 +142,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // overriden if (preg_match('#^/a/(?.*)$#s', $pathinfo, $matches)) { $matches['_route'] = 'overriden'; + return $matches; } @@ -137,12 +150,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // foo2 if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo2'; + return $matches; } // bar2 if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'bar2'; + return $matches; } @@ -171,12 +186,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // foo3 if (preg_match('#^/(?<_locale>[^/]+?)/b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo3'; + return $matches; } // bar3 if (preg_match('#^/(?<_locale>[^/]+?)/b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'bar3'; + return $matches; } @@ -188,6 +205,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // foo4 if (0 === strpos($pathinfo, '/aba') && preg_match('#^/aba/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo4'; + return $matches; } @@ -201,12 +219,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // b if (preg_match('#^/a/b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'b'; + return $matches; } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'c'; + return $matches; } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php index 4b9af5c5a1..4e8af42f5b 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php @@ -36,7 +36,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec $allow = array_merge($allow, array('GET', 'HEAD')); goto not_bar; } + $matches['_route'] = 'bar'; + return $matches; } not_bar: @@ -47,7 +49,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec $allow = array_merge($allow, array('GET', 'HEAD')); goto not_barhead; } + $matches['_route'] = 'barhead'; + return $matches; } not_barhead: @@ -67,6 +71,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (substr($pathinfo, -1) !== '/') { return $this->redirect($pathinfo.'/', 'baz3'); } + return array('_route' => 'baz3'); } @@ -75,7 +80,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (substr($pathinfo, -1) !== '/') { return $this->redirect($pathinfo.'/', 'baz4'); } + $matches['_route'] = 'baz4'; + return $matches; } @@ -85,7 +92,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec $allow[] = 'POST'; goto not_baz5; } + $matches['_route'] = 'baz5'; + return $matches; } not_baz5: @@ -96,7 +105,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec $allow[] = 'PUT'; goto not_bazbaz6; } + $matches['_route'] = 'baz.baz6'; + return $matches; } not_bazbaz6: @@ -109,6 +120,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // quoter if (preg_match('#^/(?[\']+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'quoter'; + return $matches; } @@ -122,12 +134,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // foo1 if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo1'; + return $matches; } // bar1 if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'bar1'; + return $matches; } @@ -136,6 +150,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // overriden if (preg_match('#^/a/(?.*)$#s', $pathinfo, $matches)) { $matches['_route'] = 'overriden'; + return $matches; } @@ -143,12 +158,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // foo2 if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo2'; + return $matches; } // bar2 if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'bar2'; + return $matches; } @@ -172,6 +189,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (substr($pathinfo, -1) !== '/') { return $this->redirect($pathinfo.'/', 'hey'); } + return array('_route' => 'hey'); } @@ -180,12 +198,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // foo3 if (preg_match('#^/(?<_locale>[^/]+?)/b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo3'; + return $matches; } // bar3 if (preg_match('#^/(?<_locale>[^/]+?)/b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'bar3'; + return $matches; } @@ -197,6 +217,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // foo4 if (0 === strpos($pathinfo, '/aba') && preg_match('#^/aba/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo4'; + return $matches; } @@ -210,12 +231,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // b if (preg_match('#^/a/b/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'b'; + return $matches; } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'c'; + return $matches; } @@ -228,6 +251,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if ($this->context->getScheme() !== 'https') { return $this->redirect($pathinfo, 'secure', 'https'); } + return array('_route' => 'secure'); } @@ -236,6 +260,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if ($this->context->getScheme() !== 'http') { return $this->redirect($pathinfo, 'nonsecure', 'http'); } + return array('_route' => 'nonsecure'); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php index 3373931ba6..ae59f11941 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php @@ -34,6 +34,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // dynamic if (preg_match('#^/rootprefix/(?[^/]+?)$#s', $pathinfo, $matches)) { $matches['_route'] = 'dynamic'; + return $matches; } diff --git a/src/Symfony/Component/Security/Tests/Acl/Domain/ObjectIdentityTest.php b/src/Symfony/Component/Security/Tests/Acl/Domain/ObjectIdentityTest.php index 20c74d5eeb..7aa3cf21bb 100644 --- a/src/Symfony/Component/Security/Tests/Acl/Domain/ObjectIdentityTest.php +++ b/src/Symfony/Component/Security/Tests/Acl/Domain/ObjectIdentityTest.php @@ -12,13 +12,13 @@ namespace Symfony\Component\Security\Tests\Acl\Domain { use Symfony\Component\Security\Acl\Domain\ObjectIdentity; - + class ObjectIdentityTest extends \PHPUnit_Framework_TestCase { public function testConstructor() { $id = new ObjectIdentity('fooid', 'footype'); - + $this->assertEquals('fooid', $id->getIdentifier()); $this->assertEquals('footype', $id->getType()); } @@ -31,7 +31,7 @@ namespace Symfony\Component\Security\Tests\Acl\Domain $this->assertEquals('fooid', $id->getIdentifier()); $this->assertEquals('Acme\DemoBundle\Proxy\__CG__\Symfony\Component\Security\Tests\Acl\Domain\TestDomainObject', $id->getType()); } - + public function testFromDomainObjectPrefersInterfaceOverGetId() { $domainObject = $this->getMock('Symfony\Component\Security\Acl\Model\DomainObjectInterface'); @@ -45,11 +45,11 @@ namespace Symfony\Component\Security\Tests\Acl\Domain ->method('getId') ->will($this->returnValue('getId()')) ; - + $id = ObjectIdentity::fromDomainObject($domainObject); $this->assertEquals('getObjectIdentifier()', $id->getIdentifier()); } - + public function testFromDomainObjectWithoutInterface() { $id = ObjectIdentity::fromDomainObject(new TestDomainObject()); @@ -63,7 +63,7 @@ namespace Symfony\Component\Security\Tests\Acl\Domain $this->assertEquals('getId()', $id->getIdentifier()); $this->assertEquals('Symfony\Component\Security\Tests\Acl\Domain\TestDomainObject', $id->getType()); } - + /** * @dataProvider getCompareData */ @@ -75,7 +75,7 @@ namespace Symfony\Component\Security\Tests\Acl\Domain $this->assertFalse($oid1->equals($oid2)); } } - + public function getCompareData() { return array( @@ -85,7 +85,7 @@ namespace Symfony\Component\Security\Tests\Acl\Domain array(new ObjectIdentity('1', 'bla'), new ObjectIdentity('1', 'blub'), false), ); } - + protected function setUp() { if (!class_exists('Doctrine\DBAL\DriverManager')) { @@ -93,14 +93,14 @@ namespace Symfony\Component\Security\Tests\Acl\Domain } } } - + class TestDomainObject { public function getObjectIdentifier() { return 'getObjectIdentifier()'; } - + public function getId() { return 'getId()'; diff --git a/src/Symfony/Component/Security/Tests/Core/Util/ClassUtilsTest.php b/src/Symfony/Component/Security/Tests/Core/Util/ClassUtilsTest.php index 7a6e698754..16378a646b 100644 --- a/src/Symfony/Component/Security/Tests/Core/Util/ClassUtilsTest.php +++ b/src/Symfony/Component/Security/Tests/Core/Util/ClassUtilsTest.php @@ -3,7 +3,7 @@ namespace Symfony\Component\Security\Tests\Core\Util { use Symfony\Component\Security\Core\Util\ClassUtils; - + class ClassUtilsTest extends \PHPUnit_Framework_TestCase { static public function dataGetClass() @@ -18,7 +18,7 @@ namespace Symfony\Component\Security\Tests\Core\Util array(new \Acme\DemoBundle\Proxy\__CG__\Symfony\Component\Security\Tests\Core\Util\TestObject(), 'Symfony\Component\Security\Tests\Core\Util\TestObject'), ); } - + /** * @dataProvider dataGetClass */ diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php index fd0c5daf03..0637532894 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -134,6 +134,7 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase foreach ($bars as $bar) { $foos .= $bar->getFoo(); } + return $foos; }, ), diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index e1e713e74c..cf59c6f69e 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -54,7 +54,7 @@ class EmailValidator extends ConstraintValidator // Check for host DNS resource records if ($valid && $constraint->checkMX) { $valid = $this->checkMX($host); - } else if ($valid && $constraint->checkHost) { + } elseif ($valid && $constraint->checkHost) { $valid = $this->checkHost($host); } } @@ -75,12 +75,12 @@ class EmailValidator extends ConstraintValidator { return checkdnsrr($host, 'MX'); } - + /** * Check if one of MX, A or AAAA DNS RR exists. * * @param string $host Hostname - * + * * @return Boolean */ private function checkHost($host) diff --git a/src/Symfony/Component/Validator/ExecutionContext.php b/src/Symfony/Component/Validator/ExecutionContext.php index 9023efb83e..528baf04b2 100644 --- a/src/Symfony/Component/Validator/ExecutionContext.php +++ b/src/Symfony/Component/Validator/ExecutionContext.php @@ -56,7 +56,7 @@ class ExecutionContext * @param string $message The error message. * @param array $params The parameters parsed into the error message. * @param mixed $invalidValue The invalid, validated value. - * @param integer|null $pluralization The number to use to pluralize of the message. + * @param integer|null $pluralization The number to use to pluralize of the message. * * @api */ @@ -81,7 +81,7 @@ class ExecutionContext * @param string $message The error message. * @param array $params The parameters parsed into the error message. * @param mixed $invalidValue The invalid, validated value. - * @param integer|null $pluralization The number to use to pluralize of the message. + * @param integer|null $pluralization The number to use to pluralize of the message. */ public function addViolationAtPath($propertyPath, $message, array $params = array(), $invalidValue = null, $pluralization = null) { @@ -104,7 +104,7 @@ class ExecutionContext * @param string $message The error message. * @param array $params The parameters parsed into the error message. * @param mixed $invalidValue The invalid, validated value. - * @param integer|null $pluralization The number to use to pluralize of the message. + * @param integer|null $pluralization The number to use to pluralize of the message. */ public function addViolationAtSubPath($subPath, $message, array $params = array(), $invalidValue = null, $pluralization = null) {