From 580c8fa8758d8c5a6f9dd8639654d165527e23f4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 18 Apr 2012 10:41:11 +0200 Subject: [PATCH 1/2] fixed CS --- .../DependencyInjection/TwigExtensionTest.php | 2 +- .../Locale/Resources/stubs/functions.php | 15 ++++++++++----- src/Symfony/Component/Routing/RouteCompiler.php | 1 + .../Matcher/Dumper/ApacheMatcherDumperTest.php | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php index 88e2399b3f..17fc9bcb35 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php @@ -66,7 +66,7 @@ class TwigExtensionTest extends TestCase // Yaml and Php specific configs if (in_array($format, array('yml', 'php'))) { - $this->assertEquals('bad', $calls[2][1][0], '->load() registers variables as Twig globals'); + $this->assertEquals('bad', $calls[2][1][0], '->load() registers variables as Twig globals'); $this->assertEquals(array('key' => 'foo'), $calls[2][1][1], '->load() registers variables as Twig globals'); } diff --git a/src/Symfony/Component/Locale/Resources/stubs/functions.php b/src/Symfony/Component/Locale/Resources/stubs/functions.php index 2444c3735a..571a265aab 100644 --- a/src/Symfony/Component/Locale/Resources/stubs/functions.php +++ b/src/Symfony/Component/Locale/Resources/stubs/functions.php @@ -19,7 +19,8 @@ use Symfony\Component\Locale\Stub\StubIntl; * @return Boolean Whether the error code indicates an error * @see Symfony\Component\Locale\Stub\StubIntl::isFailure */ -function intl_is_failure($errorCode) { +function intl_is_failure($errorCode) +{ return StubIntl::isFailure($errorCode); } @@ -31,9 +32,11 @@ function intl_is_failure($errorCode) { * StubIntl::U_ZERO_ERROR if no error occurred * @see Symfony\Component\Locale\Stub\StubIntl::getErrorCode */ -function intl_get_error_code() { +function intl_get_error_code() +{ return StubIntl::getErrorCode(); } + /** * Stub implementation for the intl_get_error_code function of the intl extension * @@ -42,7 +45,8 @@ function intl_get_error_code() { * "U_ZERO_ERROR" if no error occurred * @see Symfony\Component\Locale\Stub\StubIntl::getErrorMessage */ -function intl_get_error_message() { +function intl_get_error_message() +{ return StubIntl::getErrorMessage(); } @@ -53,6 +57,7 @@ function intl_get_error_message() { * * @see Symfony\Component\Locale\Stub\StubIntl::getErrorName */ -function intl_error_name($errorCode) { +function intl_error_name($errorCode) +{ return StubIntl::getErrorName($errorCode); -} \ No newline at end of file +} diff --git a/src/Symfony/Component/Routing/RouteCompiler.php b/src/Symfony/Component/Routing/RouteCompiler.php index e816de4954..aab9329aa6 100644 --- a/src/Symfony/Component/Routing/RouteCompiler.php +++ b/src/Symfony/Component/Routing/RouteCompiler.php @@ -120,6 +120,7 @@ class RouteCompiler implements RouteCompilerInterface $regexp .= str_repeat(")?", $nbTokens - $firstOptional); } } + return $regexp; } } diff --git a/tests/Symfony/Tests/Component/Routing/Matcher/Dumper/ApacheMatcherDumperTest.php b/tests/Symfony/Tests/Component/Routing/Matcher/Dumper/ApacheMatcherDumperTest.php index 537fcf3834..d29dfd1909 100644 --- a/tests/Symfony/Tests/Component/Routing/Matcher/Dumper/ApacheMatcherDumperTest.php +++ b/tests/Symfony/Tests/Component/Routing/Matcher/Dumper/ApacheMatcherDumperTest.php @@ -116,4 +116,4 @@ class ApacheMatcherDumperTest extends \PHPUnit_Framework_TestCase return $collection; } -} \ No newline at end of file +} From 29a41ec13bfc4f717cac8e0e4ff131edf7b40828 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 18 Apr 2012 11:42:27 +0200 Subject: [PATCH 2/2] Revert "merged branch jakzal/2.0-StaticMethodLoaderFix (PR #3937)" This reverts commit 0078faa84b90e194221871c8adf27e48e20f8653, reversing changes made to 098b93441001911d0d8a4370c89ab7531347c17e. --- .../Validator/Mapping/Loader/StaticMethodLoader.php | 2 +- .../Mapping/Loader/StaticMethodLoaderTest.php | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php index 3e90fe91b5..a74ffbb429 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php @@ -37,7 +37,7 @@ class StaticMethodLoader implements LoaderInterface throw new MappingException(sprintf('The method %s::%s should be static', $reflClass->getName(), $this->methodName)); } - if ($reflClass->isAbstract() || $reflMethod->getDeclaringClass()->getName() != $reflClass->getName()) { + if ($reflMethod->getDeclaringClass()->getName() != $reflClass->getName()) { return false; } diff --git a/tests/Symfony/Tests/Component/Validator/Mapping/Loader/StaticMethodLoaderTest.php b/tests/Symfony/Tests/Component/Validator/Mapping/Loader/StaticMethodLoaderTest.php index 6d4493a753..daaf89f6e9 100644 --- a/tests/Symfony/Tests/Component/Validator/Mapping/Loader/StaticMethodLoaderTest.php +++ b/tests/Symfony/Tests/Component/Validator/Mapping/Loader/StaticMethodLoaderTest.php @@ -35,14 +35,6 @@ class StaticMethodLoaderTest extends \PHPUnit_Framework_TestCase $this->assertFalse($loader->loadClassMetadata($metadata)); } - public function testLoadClassMetadataReturnsFalseIfMethodIsAbstract() - { - $loader = new StaticMethodLoader('loadMetadata'); - $metadata = new ClassMetadata(__NAMESPACE__.'\AbstractStaticLoaderEntity'); - - $this->assertFalse($loader->loadClassMetadata($metadata)); - } - public function testLoadClassMetadata() { $loader = new StaticMethodLoader('loadMetadata'); @@ -88,8 +80,3 @@ class BaseStaticLoaderDocument $metadata->addConstraint(new ConstraintA()); } } - -abstract class AbstractStaticLoaderEntity -{ - abstract public static function loadMetadata(ClassMetadata $metadata); -}