From eb3f6c6efb4cb65413e1f5229806bb19af239fff Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 11 Feb 2014 08:51:18 +0100 Subject: [PATCH] fixed various inconsistencies --- .../Security/User/EntityUserProvider.php | 3 ++- .../Tests/Fixtures/AssociationEntity.php | 2 +- .../Compiler/CompilerDebugDumpPass.php | 2 +- .../Tests/CacheWarmer/TemplateFinderTest.php | 2 +- .../DependencyInjection/ConfigurationTest.php | 6 ++--- .../Tests/Functional/WebTestCase.php | 2 +- .../Tests/Functional/app/AppKernel.php | 2 +- .../Tests/Functional/WebTestCase.php | 2 +- .../Tests/Functional/app/AppKernel.php | 2 +- .../DependencyInjection/ConfigurationTest.php | 2 +- .../ClassLoader/XcacheClassLoader.php | 3 ++- .../Console/Helper/ProgressHelper.php | 2 +- .../Console/Tests/ApplicationTest.php | 8 +++---- .../Parser/Handler/NumberHandlerTest.php | 3 +-- .../Debug/Tests/ExceptionHandlerTest.php | 2 +- .../DependencyInjection/Dumper/PhpDumper.php | 2 +- .../Tests/EventDispatcherTest.php | 1 + .../EventDispatcher/Tests/EventTest.php | 2 +- .../DependencyInjectionExtension.php | 5 +--- .../Form/Test/FormPerformanceTestCase.php | 2 +- .../Form/Tests/FormFactoryBuilderTest.php | 6 ++--- .../File/MimeType/ExtensionGuesser.php | 9 +++---- .../HttpFoundation/Tests/RequestTest.php | 8 +++---- .../HttpFoundation/Tests/ResponseTest.php | 2 +- .../Storage/NativeSessionStorageTest.php | 4 ++-- .../Storage/PhpBridgeSessionStorageTest.php | 2 +- .../Controller/ControllerResolver.php | 2 +- .../Profiler/MemcacheProfilerStorage.php | 2 +- .../Profiler/MemcachedProfilerStorage.php | 2 +- .../Profiler/RedisProfilerStorage.php | 2 +- .../Component/HttpKernel/Tests/ClientTest.php | 1 + .../DataCollector/TimeDataCollectorTest.php | 4 ++-- .../AbstractNumberFormatterTest.php | 6 +++-- .../Process/Tests/NonStopableProcess.php | 2 +- .../Routing/Loader/AnnotationFileLoader.php | 5 ++-- .../Dumper/DumperPrefixCollectionTest.php | 4 ++-- .../Tests/Acl/Permission/MaskBuilderTest.php | 2 +- .../DaoAuthenticationProviderTest.php | 18 +++++++------- ...uthenticatedAuthenticationProviderTest.php | 6 ++--- .../Tests/Core/Util/SecureRandomTest.php | 4 ++-- .../AbstractRememberMeServicesTest.php | 22 ++++++++--------- ...istentTokenBasedRememberMeServicesTest.php | 24 +++++++++---------- .../Http/RememberMe/ResponseListenerTest.php | 2 +- .../TokenBasedRememberMeServicesTest.php | 18 +++++++------- .../Normalizer/CustomNormalizer.php | 2 +- .../Tests/Encoder/JsonEncoderTest.php | 6 ++--- .../Tests/Encoder/XmlEncoderTest.php | 12 +++++----- .../Tests/Normalizer/CustomNormalizerTest.php | 14 +++++------ .../Normalizer/GetSetMethodNormalizerTest.php | 6 ++--- .../Serializer/Tests/SerializerTest.php | 10 ++++---- .../Component/Stopwatch/StopwatchEvent.php | 4 +++- .../Component/Templating/Asset/Package.php | 2 +- .../Tests/Loader/CacheLoaderTest.php | 5 ++-- .../Templating/Tests/Loader/LoaderTest.php | 3 +-- .../Constraints/AbstractComparison.php | 2 +- .../AbstractComparisonValidator.php | 2 +- .../Validator/Tests/ConstraintTest.php | 4 ++-- .../Tests/Mapping/ElementMetadataTest.php | 2 +- src/Symfony/Component/Validator/Validator.php | 2 +- 59 files changed, 143 insertions(+), 145 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php index 487b1d69b0..e957731a3e 100644 --- a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php +++ b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php @@ -92,7 +92,8 @@ class EntityUserProvider implements UserProviderInterface ); } - if (null === $refreshedUser = $this->repository->find($id)) { + $refreshedUser = $this->repository->find($id); + if (null === $refreshedUser) { throw new UsernameNotFoundException(sprintf('User with id %s not found', json_encode($id))); } } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/AssociationEntity.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/AssociationEntity.php index 9a33435ff2..eda2ce85da 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/AssociationEntity.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/AssociationEntity.php @@ -11,7 +11,7 @@ namespace Symfony\Bridge\Doctrine\Tests\Fixtures; -use Doctrine\ORM\Mapping AS ORM; +use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php index 20591c89ca..62884df180 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php @@ -22,7 +22,7 @@ class CompilerDebugDumpPass implements CompilerPassInterface { $filesystem = new Filesystem(); $filesystem->dumpFile( - $this->getCompilerLogFilename($container), + self::getCompilerLogFilename($container), implode("\n", $container->getCompiler()->getLog()), 0666 & ~umask() ); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php index f2e756ab3b..d58dde29bc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php @@ -37,7 +37,7 @@ class TemplateFinderTest extends TestCase ->will($this->returnValue(array('BaseBundle' => new BaseBundle()))) ; - $parser = new TemplateFilenameParser($kernel); + $parser = new TemplateFilenameParser(); $finder = new TemplateFinder($kernel, $parser, __DIR__.'/../Fixtures/Resources'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 598622a1da..939703d8ab 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -33,7 +33,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase public function testValidTrustedProxies($trustedProxies, $processedProxies) { $processor = new Processor(); - $configuration = new Configuration(array()); + $configuration = new Configuration(); $config = $processor->processConfiguration($configuration, array(array( 'secret' => 's3cr3t', 'trusted_proxies' => $trustedProxies @@ -62,7 +62,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase public function testInvalidTypeTrustedProxies() { $processor = new Processor(); - $configuration = new Configuration(array()); + $configuration = new Configuration(); $processor->processConfiguration($configuration, array( array( 'secret' => 's3cr3t', @@ -77,7 +77,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase public function testInvalidValueTrustedProxies() { $processor = new Processor(); - $configuration = new Configuration(array()); + $configuration = new Configuration(); $processor->processConfiguration($configuration, array( array( 'secret' => 's3cr3t', diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php index 8cf0dfead7..6b8fe0ace6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php @@ -46,7 +46,7 @@ class WebTestCase extends BaseWebTestCase { require_once __DIR__.'/app/AppKernel.php'; - return 'Symfony\Bundle\FrameworkBundle\Tests\Functional\AppKernel'; + return 'Symfony\Bundle\FrameworkBundle\Tests\Functional\app\AppKernel'; } protected static function createKernel(array $options = array()) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php index caf2fd8f12..12747e6dc2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; +namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\app; // get the autoload file $dir = __DIR__; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php index b4b906f172..e1c96d32e4 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php @@ -46,7 +46,7 @@ class WebTestCase extends BaseWebTestCase { require_once __DIR__.'/app/AppKernel.php'; - return 'Symfony\Bundle\SecurityBundle\Tests\Functional\AppKernel'; + return 'Symfony\Bundle\SecurityBundle\Tests\Functional\app\AppKernel'; } protected static function createKernel(array $options = array()) diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php index 0979db4229..57816ccef9 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Bundle\SecurityBundle\Tests\Functional; +namespace Symfony\Bundle\SecurityBundle\Tests\Functional\app; // get the autoload file $dir = __DIR__; diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php index 8d47caf4c6..5f022dd600 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -22,7 +22,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase public function testConfigTree($options, $results) { $processor = new Processor(); - $configuration = new Configuration(array()); + $configuration = new Configuration(); $config = $processor->processConfiguration($configuration, array($options)); $this->assertEquals($results, $config); diff --git a/src/Symfony/Component/ClassLoader/XcacheClassLoader.php b/src/Symfony/Component/ClassLoader/XcacheClassLoader.php index 31bb00684b..662e36f436 100644 --- a/src/Symfony/Component/ClassLoader/XcacheClassLoader.php +++ b/src/Symfony/Component/ClassLoader/XcacheClassLoader.php @@ -116,7 +116,8 @@ class XcacheClassLoader if (xcache_isset($this->prefix.$class)) { $file = xcache_get($this->prefix.$class); } else { - xcache_set($this->prefix.$class, $file = $this->classFinder->findFile($class)); + $file = $this->classFinder->findFile($class); + xcache_set($this->prefix.$class, $file); } return $file; diff --git a/src/Symfony/Component/Console/Helper/ProgressHelper.php b/src/Symfony/Component/Console/Helper/ProgressHelper.php index 9563d289d8..ea0f503a63 100644 --- a/src/Symfony/Component/Console/Helper/ProgressHelper.php +++ b/src/Symfony/Component/Console/Helper/ProgressHelper.php @@ -352,7 +352,7 @@ class ProgressHelper extends Helper $vars = array(); $percent = 0; if ($this->max > 0) { - $percent = (double) $this->current / $this->max; + $percent = (float) $this->current / $this->max; } if (isset($this->formatVars['bar'])) { diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index e45464a177..1952de43f1 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -417,7 +417,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase public function testAsText() { $application = new Application(); - $application->add(new \FooCommand); + $application->add(new \FooCommand()); $this->ensureStaticCommandHelp($application); $this->assertStringEqualsFile(self::$fixturesPath.'/application_astext1.txt', $this->normalizeLineBreaks($application->asText()), '->asText() returns a text representation of the application'); $this->assertStringEqualsFile(self::$fixturesPath.'/application_astext2.txt', $this->normalizeLineBreaks($application->asText('foo')), '->asText() returns a text representation of the application'); @@ -426,7 +426,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase public function testAsXml() { $application = new Application(); - $application->add(new \FooCommand); + $application->add(new \FooCommand()); $this->ensureStaticCommandHelp($application); $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application'); $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application'); @@ -450,7 +450,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase $tester->run(array('command' => 'list', '--foo' => true), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception2.txt', $tester->getDisplay(true), '->renderException() renders the command synopsis when an exception occurs in the context of a command'); - $application->add(new \Foo3Command); + $application->add(new \Foo3Command()); $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo3:bar'), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); @@ -797,7 +797,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase protected function getDispatcher() { - $dispatcher = new EventDispatcher; + $dispatcher = new EventDispatcher(); $dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) { $event->getOutput()->write('before.'); }); diff --git a/src/Symfony/Component/CssSelector/Tests/Parser/Handler/NumberHandlerTest.php b/src/Symfony/Component/CssSelector/Tests/Parser/Handler/NumberHandlerTest.php index e7a7a1f937..675fd05b43 100644 --- a/src/Symfony/Component/CssSelector/Tests/Parser/Handler/NumberHandlerTest.php +++ b/src/Symfony/Component/CssSelector/Tests/Parser/Handler/NumberHandlerTest.php @@ -14,7 +14,6 @@ namespace Symfony\Component\CssSelector\Tests\Parser\Handler; use Symfony\Component\CssSelector\Parser\Handler\NumberHandler; use Symfony\Component\CssSelector\Parser\Token; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; -use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; class NumberHandlerTest extends AbstractHandlerTest { @@ -46,6 +45,6 @@ class NumberHandlerTest extends AbstractHandlerTest { $patterns = new TokenizerPatterns(); - return new NumberHandler($patterns, new TokenizerEscaping($patterns)); + return new NumberHandler($patterns); } } diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php index f187e2d099..f5dbf94cdd 100644 --- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php @@ -64,6 +64,6 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase public function testNestedExceptions() { $handler = new ExceptionHandler(true); - $response = $handler->createResponse(new \RuntimeException('Foo', null, new \RuntimeException('Bar'))); + $response = $handler->createResponse(new \RuntimeException('Foo', 0, new \RuntimeException('Bar'))); } } diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 63ff7424b3..d7d5a8a619 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -66,7 +66,7 @@ class PhpDumper extends Dumper { parent::__construct($container); - $this->inlinedDefinitions = new \SplObjectStorage; + $this->inlinedDefinitions = new \SplObjectStorage(); } /** diff --git a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php index 097c3e4800..f1053cfe1d 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php @@ -238,6 +238,7 @@ class EventDispatcherTest extends \PHPUnit_Framework_TestCase public function testEventReceivesTheDispatcherInstance() { $test = $this; + $dispatcher = null; $this->dispatcher->addListener('test', function ($event) use (&$dispatcher) { $dispatcher = $event->getDispatcher(); }); diff --git a/src/Symfony/Component/EventDispatcher/Tests/EventTest.php b/src/Symfony/Component/EventDispatcher/Tests/EventTest.php index 0600ac2aea..7a20fe6bf3 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/EventTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/EventTest.php @@ -35,7 +35,7 @@ class EventTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->event = new Event; + $this->event = new Event(); $this->dispatcher = new EventDispatcher(); } diff --git a/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php b/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php index 6637ac8c63..2d78f80830 100644 --- a/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php +++ b/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php @@ -19,14 +19,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface; class DependencyInjectionExtension implements FormExtensionInterface { private $container; - private $typeServiceIds; - private $guesserServiceIds; - private $guesser; - private $guesserLoaded = false; + private $typeExtensionServiceIds; public function __construct(ContainerInterface $container, array $typeServiceIds, array $typeExtensionServiceIds, diff --git a/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php b/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php index 573f4e913c..b57aa9da8d 100644 --- a/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php +++ b/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php @@ -55,7 +55,7 @@ abstract class FormPerformanceTestCase extends FormIntegrationTestCase if (is_integer($maxRunningTime) && $maxRunningTime >= 0) { $this->maxRunningTime = $maxRunningTime; } else { - throw new \InvalidArgumentException; + throw new \InvalidArgumentException(); } } diff --git a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php index a1292dbe72..2c3ab000ff 100644 --- a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php +++ b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php @@ -27,12 +27,12 @@ class FormFactoryBuilderTest extends \PHPUnit_Framework_TestCase $this->registry->setAccessible(true); $this->guesser = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface'); - $this->type = new FooType; + $this->type = new FooType(); } public function testAddType() { - $factoryBuilder = new FormFactoryBuilder; + $factoryBuilder = new FormFactoryBuilder(); $factoryBuilder->addType($this->type); $factory = $factoryBuilder->getFormFactory(); @@ -46,7 +46,7 @@ class FormFactoryBuilderTest extends \PHPUnit_Framework_TestCase public function testAddTypeGuesser() { - $factoryBuilder = new FormFactoryBuilder; + $factoryBuilder = new FormFactoryBuilder(); $factoryBuilder->addTypeGuesser($this->guesser); $factory = $factoryBuilder->getFormFactory(); diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php index cc646180c8..fe66543e18 100644 --- a/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php +++ b/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php @@ -82,18 +82,15 @@ class ExtensionGuesser implements ExtensionGuesserInterface * value. * * @param string $mimeType The mime type + * * @return string The guessed extension or NULL, if none could be guessed */ public function guess($mimeType) { foreach ($this->guessers as $guesser) { - $extension = $guesser->guess($mimeType); - - if (null !== $extension) { - break; + if (null !== $extension = $guesser->guess($mimeType)) { + return $extension; } } - - return $extension; } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 13efc4300b..3b1a8906b9 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -881,14 +881,14 @@ class RequestTest extends \PHPUnit_Framework_TestCase public function testGetContentWorksTwiceInDefaultMode() { - $req = new Request; + $req = new Request(); $this->assertEquals('', $req->getContent()); $this->assertEquals('', $req->getContent()); } public function testGetContentReturnsResource() { - $req = new Request; + $req = new Request(); $retval = $req->getContent(true); $this->assertInternalType('resource', $retval); $this->assertEquals("", fread($retval, 1)); @@ -901,7 +901,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase */ public function testGetContentCantBeCalledTwiceWithResources($first, $second) { - $req = new Request; + $req = new Request(); $req->getContent($first); $req->getContent($second); } @@ -1339,7 +1339,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase */ public function testUrlencodedStringPrefix($string, $prefix, $expect) { - $request = new Request; + $request = new Request(); $me = new \ReflectionMethod($request, 'getUrlencodedPrefix'); $me->setAccessible(true); diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 2f48ed85c3..6de11dc0d0 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -652,7 +652,7 @@ class ResponseTest extends ResponseTestCase 'setCharset' => 'UTF-8', 'setPublic' => null, 'setPrivate' => null, - 'setDate' => new \DateTime, + 'setDate' => new \DateTime(), 'expire' => null, 'setMaxAge' => 1, 'setSharedMaxAge' => 1, diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index c7f5ab8fa5..b91ddee4c4 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -59,7 +59,7 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase protected function getStorage(array $options = array()) { $storage = new NativeSessionStorage($options); - $storage->registerBag(new AttributeBag); + $storage->registerBag(new AttributeBag()); return $storage; } @@ -158,7 +158,7 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase public function testSetSaveHandlerException() { $storage = $this->getStorage(); - $storage->setSaveHandler(new \stdClass); + $storage->setSaveHandler(new \stdClass()); } public function testSetSaveHandler53() diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php index cad917e62a..0510f3fe9a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php @@ -53,7 +53,7 @@ class PhpBridgeSessionStorageTest extends \PHPUnit_Framework_TestCase protected function getStorage() { $storage = new PhpBridgeSessionStorage(); - $storage->registerBag(new AttributeBag); + $storage->registerBag(new AttributeBag()); return $storage; } diff --git a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php index 047ade1062..d10b4a12c9 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php @@ -70,7 +70,7 @@ class ControllerResolver implements ControllerResolverInterface if (false === strpos($controller, ':')) { if (method_exists($controller, '__invoke')) { - return new $controller; + return new $controller(); } elseif (function_exists($controller)) { return $controller; } diff --git a/src/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php index a78cec0c8a..2034a19db1 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php @@ -42,7 +42,7 @@ class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage $host = $matches[1] ?: $matches[2]; $port = $matches[3]; - $memcache = new Memcache; + $memcache = new Memcache(); $memcache->addServer($host, $port); $this->memcache = $memcache; diff --git a/src/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php index f7f6842358..31f3136390 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php @@ -42,7 +42,7 @@ class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage $host = $matches[1] ?: $matches[2]; $port = $matches[3]; - $memcached = new Memcached; + $memcached = new Memcached(); //disable compression to allow appending $memcached->setOption(Memcached::OPT_COMPRESSION, false); diff --git a/src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php index de2decfbf5..67678d6f15 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php @@ -214,7 +214,7 @@ class RedisProfilerStorage implements ProfilerStorageInterface throw new \RuntimeException('RedisProfilerStorage requires that the redis extension is loaded.'); } - $redis = new \Redis; + $redis = new \Redis(); $redis->connect($data['host'], $data['port']); if (isset($data['path'])) { diff --git a/src/Symfony/Component/HttpKernel/Tests/ClientTest.php b/src/Symfony/Component/HttpKernel/Tests/ClientTest.php index 755d7f614c..8e1b6c1e6f 100644 --- a/src/Symfony/Component/HttpKernel/Tests/ClientTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/ClientTest.php @@ -121,6 +121,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase new UploadedFile($source, 'original', 'mime/original', 123, UPLOAD_ERR_OK, true), ); + $file = null; foreach ($files as $file) { $client->request('POST', '/', array(), array('foo' => $file)); diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php index 13abb67696..f757b32e3d 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php @@ -26,7 +26,7 @@ class TimeDataCollectorTest extends \PHPUnit_Framework_TestCase public function testCollect() { - $c = new TimeDataCollector; + $c = new TimeDataCollector(); $request = new Request(); $request->server->set('REQUEST_TIME', 1); @@ -42,7 +42,7 @@ class TimeDataCollectorTest extends \PHPUnit_Framework_TestCase $this->assertEquals(2000, $c->getStartTime()); $request = new Request(); - $c->collect($request, new Response); + $c->collect($request, new Response()); $this->assertEquals(0, $c->getStartTime()); $kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface'); diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php index 9b11d5af0a..e41252c497 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php @@ -347,6 +347,7 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase { $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); + $attributeRet = null; if (null !== $fractionDigits) { $attributeRet = $formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, $fractionDigits); } @@ -355,7 +356,7 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase $this->assertSame($expected, $formattedValue); $this->assertSame($expectedFractionDigits, $formatter->getAttribute(NumberFormatter::FRACTION_DIGITS)); - if (isset($attributeRet)) { + if (null !== $attributeRet) { $this->assertTrue($attributeRet); } } @@ -379,6 +380,7 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase { $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); + $attributeRet = null; if (null !== $groupingUsed) { $attributeRet = $formatter->setAttribute(NumberFormatter::GROUPING_USED, $groupingUsed); } @@ -387,7 +389,7 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase $this->assertSame($expected, $formattedValue); $this->assertSame($expectedGroupingUsed, $formatter->getAttribute(NumberFormatter::GROUPING_USED)); - if (isset($attributeRet)) { + if (null !== $attributeRet) { $this->assertTrue($attributeRet); } } diff --git a/src/Symfony/Component/Process/Tests/NonStopableProcess.php b/src/Symfony/Component/Process/Tests/NonStopableProcess.php index a4db838256..d81abf4040 100644 --- a/src/Symfony/Component/Process/Tests/NonStopableProcess.php +++ b/src/Symfony/Component/Process/Tests/NonStopableProcess.php @@ -25,7 +25,7 @@ function handleSignal($signal) echo "received signal $name\n"; } -declare(ticks=1); +declare(ticks = 1); pcntl_signal(SIGTERM, 'handleSignal'); pcntl_signal(SIGINT, 'handleSignal'); diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index 33776fdc86..e54a0181c7 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -31,17 +31,16 @@ class AnnotationFileLoader extends FileLoader * * @param FileLocatorInterface $locator A FileLocator instance * @param AnnotationClassLoader $loader An AnnotationClassLoader instance - * @param string|array $paths A path or an array of paths where to look for resources * * @throws \RuntimeException */ - public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader, $paths = array()) + public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader) { if (!function_exists('token_get_all')) { throw new \RuntimeException('The Tokenizer extension is required for the routing annotation loaders.'); } - parent::__construct($locator, $paths); + parent::__construct($locator); $this->loader = $loader; } diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/DumperPrefixCollectionTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/DumperPrefixCollectionTest.php index 7b4565c403..de01a75d0b 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/DumperPrefixCollectionTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/DumperPrefixCollectionTest.php @@ -20,7 +20,7 @@ class DumperPrefixCollectionTest extends \PHPUnit_Framework_TestCase { public function testAddPrefixRoute() { - $coll = new DumperPrefixCollection; + $coll = new DumperPrefixCollection(); $coll->setPrefix(''); $route = new DumperRoute('bar', new Route('/foo/bar')); @@ -66,7 +66,7 @@ EOF; public function testMergeSlashNodes() { - $coll = new DumperPrefixCollection; + $coll = new DumperPrefixCollection(); $coll->setPrefix(''); $route = new DumperRoute('bar', new Route('/foo/bar')); diff --git a/src/Symfony/Component/Security/Tests/Acl/Permission/MaskBuilderTest.php b/src/Symfony/Component/Security/Tests/Acl/Permission/MaskBuilderTest.php index dc86755c44..de034e3185 100644 --- a/src/Symfony/Component/Security/Tests/Acl/Permission/MaskBuilderTest.php +++ b/src/Symfony/Component/Security/Tests/Acl/Permission/MaskBuilderTest.php @@ -76,7 +76,7 @@ class MaskBuilderTest extends \PHPUnit_Framework_TestCase public function testGetPattern() { - $builder = new MaskBuilder; + $builder = new MaskBuilder(); $this->assertEquals(MaskBuilder::ALL_OFF, $builder->getPattern()); $builder->add('view'); diff --git a/src/Symfony/Component/Security/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php b/src/Symfony/Component/Security/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php index 8b270615dc..d5d6067d75 100644 --- a/src/Symfony/Component/Security/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php @@ -115,7 +115,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase ->method('isPasswordValid') ; - $provider = $this->getProvider(false, false, $encoder); + $provider = $this->getProvider(null, null, $encoder); $method = new \ReflectionMethod($provider, 'checkAuthentication'); $method->setAccessible(true); @@ -142,7 +142,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(true)) ; - $provider = $this->getProvider(false, false, $encoder); + $provider = $this->getProvider(null, null, $encoder); $method = new \ReflectionMethod($provider, 'checkAuthentication'); $method->setAccessible(true); @@ -171,7 +171,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(false)) ; - $provider = $this->getProvider(false, false, $encoder); + $provider = $this->getProvider(null, null, $encoder); $method = new \ReflectionMethod($provider, 'checkAuthentication'); $method->setAccessible(true); @@ -206,7 +206,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue('newFoo')) ; - $provider = $this->getProvider(false, false, null); + $provider = $this->getProvider(); $reflection = new \ReflectionMethod($provider, 'checkAuthentication'); $reflection->setAccessible(true); $reflection->invoke($provider, $dbUser, $token); @@ -231,7 +231,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue('foo')) ; - $provider = $this->getProvider(false, false, null); + $provider = $this->getProvider(); $reflection = new \ReflectionMethod($provider, 'checkAuthentication'); $reflection->setAccessible(true); $reflection->invoke($provider, $dbUser, $token); @@ -245,7 +245,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(true)) ; - $provider = $this->getProvider(false, false, $encoder); + $provider = $this->getProvider(null, null, $encoder); $method = new \ReflectionMethod($provider, 'checkAuthentication'); $method->setAccessible(true); @@ -270,17 +270,17 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase return $mock; } - protected function getProvider($user = false, $userChecker = false, $passwordEncoder = null) + protected function getProvider($user = null, $userChecker = null, $passwordEncoder = null) { $userProvider = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface'); - if (false !== $user) { + if (null !== $user) { $userProvider->expects($this->once()) ->method('loadUserByUsername') ->will($this->returnValue($user)) ; } - if (false === $userChecker) { + if (null === $userChecker) { $userChecker = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface'); } diff --git a/src/Symfony/Component/Security/Tests/Core/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php b/src/Symfony/Component/Security/Tests/Core/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php index f7ffb1e509..8ad4549510 100644 --- a/src/Symfony/Component/Security/Tests/Core/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Tests/Core/Authentication/Provider/PreAuthenticatedAuthenticationProviderTest.php @@ -114,17 +114,17 @@ class PreAuthenticatedAuthenticationProviderTest extends \PHPUnit_Framework_Test return $token; } - protected function getProvider($user = false, $userChecker = false) + protected function getProvider($user = null, $userChecker = null) { $userProvider = $this->getMock('Symfony\Component\Security\Core\User\UserProviderInterface'); - if (false !== $user) { + if (null !== $user) { $userProvider->expects($this->once()) ->method('loadUserByUsername') ->will($this->returnValue($user)) ; } - if (false === $userChecker) { + if (null === $userChecker) { $userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface'); } diff --git a/src/Symfony/Component/Security/Tests/Core/Util/SecureRandomTest.php b/src/Symfony/Component/Security/Tests/Core/Util/SecureRandomTest.php index 38e91212f4..05b4b02ab3 100644 --- a/src/Symfony/Component/Security/Tests/Core/Util/SecureRandomTest.php +++ b/src/Symfony/Component/Security/Tests/Core/Util/SecureRandomTest.php @@ -111,8 +111,8 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase { $b = $this->getBitSequence($secureRandom, 20000); - $longestRun = 0; - $currentRun = $lastBit = null; + $longestRun = $currentRun = 0; + $lastBit = null; for ($i = 0; $i < 20000; $i++) { if ($lastBit === $b[$i]) { $currentRun += 1; diff --git a/src/Symfony/Component/Security/Tests/Http/RememberMe/AbstractRememberMeServicesTest.php b/src/Symfony/Component/Security/Tests/Http/RememberMe/AbstractRememberMeServicesTest.php index 857168643c..02ca8d2519 100644 --- a/src/Symfony/Component/Security/Tests/Http/RememberMe/AbstractRememberMeServicesTest.php +++ b/src/Symfony/Component/Security/Tests/Http/RememberMe/AbstractRememberMeServicesTest.php @@ -50,7 +50,7 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase public function testAutoLoginThrowsExceptionWhenImplementationDoesNotReturnUserInterface() { $service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null)); - $request = new Request; + $request = new Request(); $request->cookies->set('foo', 'foo'); $service @@ -113,8 +113,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase public function testLoginSuccessIsNotProcessedWhenTokenDoesNotContainUserInterfaceImplementation() { $service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null)); - $request = new Request; - $response = new Response; + $request = new Request(); + $response = new Response(); $account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $token @@ -136,8 +136,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase public function testLoginSuccessIsNotProcessedWhenRememberMeIsNotRequested() { $service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => false, 'remember_me_parameter' => 'foo', 'path' => null, 'domain' => null)); - $request = new Request; - $response = new Response; + $request = new Request(); + $response = new Response(); $account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $token @@ -160,8 +160,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase public function testLoginSuccessWhenRememberMeAlwaysIsTrue() { $service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null)); - $request = new Request; - $response = new Response; + $request = new Request(); + $response = new Response(); $account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $token @@ -186,9 +186,9 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase { $service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => false, 'remember_me_parameter' => 'foo[bar]', 'path' => null, 'domain' => null)); - $request = new Request; + $request = new Request(); $request->request->set('foo', array('bar' => $value)); - $response = new Response; + $response = new Response(); $account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $token @@ -213,9 +213,9 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase { $service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => false, 'remember_me_parameter' => 'foo', 'path' => null, 'domain' => null)); - $request = new Request; + $request = new Request(); $request->request->set('foo', $value); - $response = new Response; + $response = new Response(); $account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $token diff --git a/src/Symfony/Component/Security/Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php b/src/Symfony/Component/Security/Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php index 7fc3021c8f..26a878f009 100644 --- a/src/Symfony/Component/Security/Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php +++ b/src/Symfony/Component/Security/Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php @@ -43,7 +43,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test public function testAutoLoginThrowsExceptionOnInvalidCookie() { $service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => false, 'remember_me_parameter' => 'foo')); - $request = new Request; + $request = new Request(); $request->request->set('foo', 'true'); $request->cookies->set('foo', 'foo'); @@ -54,7 +54,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test public function testAutoLoginThrowsExceptionOnNonExistentToken() { $service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => false, 'remember_me_parameter' => 'foo')); - $request = new Request; + $request = new Request(); $request->request->set('foo', 'true'); $request->cookies->set('foo', $this->encodeCookie(array( $series = 'fooseries', @@ -77,7 +77,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test { $userProvider = $this->getProvider(); $service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600, 'secure' => false, 'httponly' => false)); - $request = new Request; + $request = new Request(); $request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue'))); $tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface'); @@ -102,7 +102,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test { $userProvider = $this->getProvider(); $service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true)); - $request = new Request; + $request = new Request(); $request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue'))); $tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface'); @@ -132,7 +132,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test public function testAutoLoginDoesNotAcceptAnExpiredCookie() { $service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600)); - $request = new Request; + $request = new Request(); $request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue'))); $tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface'); @@ -166,7 +166,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test ; $service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'secure' => false, 'httponly' => false, 'always_remember_me' => true, 'lifetime' => 3600)); - $request = new Request; + $request = new Request(); $request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue'))); $tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface'); @@ -214,8 +214,8 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test public function testLogoutSimplyIgnoresNonSetRequestCookie() { $service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null)); - $request = new Request; - $response = new Response; + $request = new Request(); + $response = new Response(); $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface'); @@ -236,9 +236,9 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test public function testLogoutSimplyIgnoresInvalidCookie() { $service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null)); - $request = new Request; + $request = new Request(); $request->cookies->set('foo', 'somefoovalue'); - $response = new Response; + $response = new Response(); $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface'); @@ -266,8 +266,8 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test public function testLoginSuccessSetsCookieWhenLoggedInWithNonRememberMeTokenInterfaceImplementation() { $service = $this->getService(null, array('name' => 'foo', 'domain' => 'myfoodomain.foo', 'path' => '/foo/path', 'secure' => true, 'httponly' => true, 'lifetime' => 3600, 'always_remember_me' => true)); - $request = new Request; - $response = new Response; + $request = new Request(); + $response = new Response(); $account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); $account diff --git a/src/Symfony/Component/Security/Tests/Http/RememberMe/ResponseListenerTest.php b/src/Symfony/Component/Security/Tests/Http/RememberMe/ResponseListenerTest.php index cbd3f1f9af..8b4667d865 100644 --- a/src/Symfony/Component/Security/Tests/Http/RememberMe/ResponseListenerTest.php +++ b/src/Symfony/Component/Security/Tests/Http/RememberMe/ResponseListenerTest.php @@ -56,7 +56,7 @@ class ResponseListenerTest extends \PHPUnit_Framework_TestCase { $listener = new ResponseListener(); - $this->assertSame(array(KernelEvents::RESPONSE => 'onKernelResponse'), $listener->getSubscribedEvents()); + $this->assertSame(array(KernelEvents::RESPONSE => 'onKernelResponse'), ResponseListener::getSubscribedEvents()); } private function getRequest(array $attributes = array()) diff --git a/src/Symfony/Component/Security/Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php b/src/Symfony/Component/Security/Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php index 4699257fa3..3ff2ea648f 100644 --- a/src/Symfony/Component/Security/Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php +++ b/src/Symfony/Component/Security/Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php @@ -39,7 +39,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase public function testAutoLoginThrowsExceptionOnInvalidCookie() { $service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => false, 'remember_me_parameter' => 'foo')); - $request = new Request; + $request = new Request(); $request->request->set('foo', 'true'); $request->cookies->set('foo', 'foo'); @@ -51,7 +51,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase { $userProvider = $this->getProvider(); $service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600)); - $request = new Request; + $request = new Request(); $request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass')); $userProvider @@ -68,7 +68,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase { $userProvider = $this->getProvider(); $service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600)); - $request = new Request; + $request = new Request(); $request->cookies->set('foo', base64_encode('class:'.base64_encode('foouser').':123456789:fooHash')); $user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); @@ -93,7 +93,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase { $userProvider = $this->getProvider(); $service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600)); - $request = new Request; + $request = new Request(); $request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() - 1, 'foopass')); $user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); @@ -137,7 +137,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase ; $service = $this->getService($userProvider, array('name' => 'foo', 'always_remember_me' => true, 'lifetime' => 3600)); - $request = new Request; + $request = new Request(); $request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass')); $returnedToken = $service->autoLogin($request); @@ -179,8 +179,8 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase public function testLoginSuccessIgnoresTokensWhichDoNotContainAnUserInterfaceImplementation() { $service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null)); - $request = new Request; - $response = new Response; + $request = new Request(); + $response = new Response(); $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $token ->expects($this->once()) @@ -200,8 +200,8 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase public function testLoginSuccess() { $service = $this->getService(null, array('name' => 'foo', 'domain' => 'myfoodomain.foo', 'path' => '/foo/path', 'secure' => true, 'httponly' => true, 'lifetime' => 3600, 'always_remember_me' => true)); - $request = new Request; - $response = new Response; + $request = new Request(); + $response = new Response(); $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); $user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface'); diff --git a/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php index 0ebe00fda5..645224129e 100644 --- a/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/CustomNormalizer.php @@ -29,7 +29,7 @@ class CustomNormalizer extends SerializerAwareNormalizer implements NormalizerIn */ public function denormalize($data, $class, $format = null, array $context = array()) { - $object = new $class; + $object = new $class(); $object->denormalize($this->serializer, $data, $format, $context); return $object; diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php index b5ec1a2352..87f685c667 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php @@ -19,13 +19,13 @@ class JsonEncoderTest extends \PHPUnit_Framework_TestCase { protected function setUp() { - $this->encoder = new JsonEncoder; + $this->encoder = new JsonEncoder(); $this->serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder())); } public function testEncodeScalar() { - $obj = new \stdClass; + $obj = new \stdClass(); $obj->foo = "foo"; $expected = '{"foo":"foo"}'; @@ -68,7 +68,7 @@ class JsonEncoderTest extends \PHPUnit_Framework_TestCase protected function getObject() { - $obj = new \stdClass; + $obj = new \stdClass(); $obj->foo = 'foo'; $obj->bar = array('a', 'b'); $obj->baz = array('key' => 'val', 'key2' => 'val', 'A B' => 'bar', 'item' => array(array('title' => 'title1'), array('title' => 'title2')), 'Barry' => array('FooBar' => array('Baz' => 'Ed', '@id' => 1))); diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index 71da72f8e0..2540254779 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -24,14 +24,14 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->encoder = new XmlEncoder; + $this->encoder = new XmlEncoder(); $serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder())); $this->encoder->setSerializer($serializer); } public function testEncodeScalar() { - $obj = new ScalarDummy; + $obj = new ScalarDummy(); $obj->xmlFoo = "foo"; $expected = ''."\n". @@ -42,7 +42,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase public function testSetRootNodeName() { - $obj = new ScalarDummy; + $obj = new ScalarDummy(); $obj->xmlFoo = "foo"; $this->encoder->setRootNodeName('test'); @@ -63,7 +63,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase public function testAttributes() { - $obj = new ScalarDummy; + $obj = new ScalarDummy(); $obj->xmlFoo = array( 'foo-bar' => array( '@id' => 1, @@ -92,7 +92,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase public function testElementNameValid() { - $obj = new ScalarDummy; + $obj = new ScalarDummy(); $obj->xmlFoo = array( 'foo-bar' => 'a', 'foo_bar' => 'a', @@ -345,7 +345,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase protected function getObject() { - $obj = new Dummy; + $obj = new Dummy(); $obj->foo = 'foo'; $obj->bar = array('a', 'b'); $obj->baz = array('key' => 'val', 'key2' => 'val', 'A B' => 'bar', 'item' => array(array('title' => 'title1'), array('title' => 'title2')), 'Barry' => array('FooBar' => array('Baz' => 'Ed', '@id' => 1))); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php index 7b4b4ae28d..0aeaba472a 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php @@ -19,13 +19,13 @@ class CustomNormalizerTest extends \PHPUnit_Framework_TestCase { protected function setUp() { - $this->normalizer = new CustomNormalizer; - $this->normalizer->setSerializer(new Serializer); + $this->normalizer = new CustomNormalizer(); + $this->normalizer->setSerializer(new Serializer()); } public function testSerialize() { - $obj = new ScalarDummy; + $obj = new ScalarDummy(); $obj->foo = 'foo'; $obj->xmlFoo = 'xml'; $this->assertEquals('foo', $this->normalizer->normalize($obj, 'json')); @@ -34,19 +34,19 @@ class CustomNormalizerTest extends \PHPUnit_Framework_TestCase public function testDeserialize() { - $obj = $this->normalizer->denormalize('foo', get_class(new ScalarDummy), 'xml'); + $obj = $this->normalizer->denormalize('foo', get_class(new ScalarDummy()), 'xml'); $this->assertEquals('foo', $obj->xmlFoo); $this->assertNull($obj->foo); - $obj = $this->normalizer->denormalize('foo', get_class(new ScalarDummy), 'json'); + $obj = $this->normalizer->denormalize('foo', get_class(new ScalarDummy()), 'json'); $this->assertEquals('foo', $obj->foo); $this->assertNull($obj->xmlFoo); } public function testSupportsNormalization() { - $this->assertTrue($this->normalizer->supportsNormalization(new ScalarDummy)); - $this->assertFalse($this->normalizer->supportsNormalization(new \stdClass)); + $this->assertTrue($this->normalizer->supportsNormalization(new ScalarDummy())); + $this->assertFalse($this->normalizer->supportsNormalization(new \stdClass())); } public function testSupportsDenormalization() diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php index 42846166e4..f3bf9694d2 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -17,13 +17,13 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase { protected function setUp() { - $this->normalizer = new GetSetMethodNormalizer; + $this->normalizer = new GetSetMethodNormalizer(); $this->normalizer->setSerializer($this->getMock('Symfony\Component\Serializer\Serializer')); } public function testNormalize() { - $obj = new GetSetDummy; + $obj = new GetSetDummy(); $obj->setFoo('foo'); $obj->setBar('bar'); $obj->setCamelCase('camelcase'); @@ -118,7 +118,7 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase { $this->normalizer->setIgnoredAttributes(array('foo', 'bar', 'camelCase')); - $obj = new GetSetDummy; + $obj = new GetSetDummy(); $obj->setFoo('foo'); $obj->setBar('bar'); diff --git a/src/Symfony/Component/Serializer/Tests/SerializerTest.php b/src/Symfony/Component/Serializer/Tests/SerializerTest.php index 3c189461f2..c2a231b11e 100644 --- a/src/Symfony/Component/Serializer/Tests/SerializerTest.php +++ b/src/Symfony/Component/Serializer/Tests/SerializerTest.php @@ -28,20 +28,20 @@ class SerializerTest extends \PHPUnit_Framework_TestCase public function testNormalizeNoMatch() { $this->serializer = new Serializer(array($this->getMock('Symfony\Component\Serializer\Normalizer\CustomNormalizer'))); - $this->serializer->normalize(new \stdClass, 'xml'); + $this->serializer->normalize(new \stdClass(), 'xml'); } public function testNormalizeTraversable() { $this->serializer = new Serializer(array(), array('json' => new JsonEncoder())); - $result = $this->serializer->serialize(new TraversableDummy, 'json'); + $result = $this->serializer->serialize(new TraversableDummy(), 'json'); $this->assertEquals('{"foo":"foo","bar":"bar"}', $result); } public function testNormalizeGivesPriorityToInterfaceOverTraversable() { - $this->serializer = new Serializer(array(new CustomNormalizer), array('json' => new JsonEncoder())); - $result = $this->serializer->serialize(new NormalizableTraversableDummy, 'json'); + $this->serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder())); + $result = $this->serializer->serialize(new NormalizableTraversableDummy(), 'json'); $this->assertEquals('{"foo":"normalizedFoo","bar":"normalizedBar"}', $result); } @@ -51,7 +51,7 @@ class SerializerTest extends \PHPUnit_Framework_TestCase public function testNormalizeOnDenormalizer() { $this->serializer = new Serializer(array(new TestDenormalizer()), array()); - $this->assertTrue($this->serializer->normalize(new \stdClass, 'json')); + $this->assertTrue($this->serializer->normalize(new \stdClass(), 'json')); } /** diff --git a/src/Symfony/Component/Stopwatch/StopwatchEvent.php b/src/Symfony/Component/Stopwatch/StopwatchEvent.php index 7adfdf0bb8..e87f20f9c4 100644 --- a/src/Symfony/Component/Stopwatch/StopwatchEvent.php +++ b/src/Symfony/Component/Stopwatch/StopwatchEvent.php @@ -163,7 +163,9 @@ class StopwatchEvent */ public function getEndTime() { - return ($count = count($this->periods)) ? $this->periods[$count - 1]->getEndTime() : 0; + $count = count($this->periods); + + return $count ? $this->periods[$count - 1]->getEndTime() : 0; } /** diff --git a/src/Symfony/Component/Templating/Asset/Package.php b/src/Symfony/Component/Templating/Asset/Package.php index f693fd519a..58d6ef45c4 100644 --- a/src/Symfony/Component/Templating/Asset/Package.php +++ b/src/Symfony/Component/Templating/Asset/Package.php @@ -27,7 +27,7 @@ class Package implements PackageInterface * @param string $version The package version * @param string $format The format used to apply the version */ - public function __construct($version = null, $format = null) + public function __construct($version = null, $format = '') { $this->version = $version; $this->format = $format ?: '%s?%s'; diff --git a/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php index 6db7fecbff..1eabaeb3c8 100644 --- a/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php +++ b/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php @@ -14,7 +14,6 @@ namespace Symfony\Component\Templating\Tests\Loader; use Symfony\Component\Templating\Loader\Loader; use Symfony\Component\Templating\Loader\CacheLoader; use Symfony\Component\Templating\Storage\StringStorage; -use Symfony\Component\Templating\TemplateNameParser; use Symfony\Component\Templating\TemplateReferenceInterface; use Symfony\Component\Templating\TemplateReference; @@ -22,7 +21,7 @@ class CacheLoaderTest extends \PHPUnit_Framework_TestCase { public function testConstructor() { - $loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(new TemplateNameParser()), sys_get_temp_dir()); + $loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(), sys_get_temp_dir()); $this->assertTrue($loader->getLoader() === $varLoader, '__construct() takes a template loader as its first argument'); $this->assertEquals(sys_get_temp_dir(), $loader->getDir(), '__construct() takes a directory where to store the cache as its second argument'); } @@ -31,7 +30,7 @@ class CacheLoaderTest extends \PHPUnit_Framework_TestCase { $dir = sys_get_temp_dir().DIRECTORY_SEPARATOR.rand(111111, 999999); mkdir($dir, 0777, true); - $loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(new TemplateNameParser()), $dir); + $loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(), $dir); $loader->setDebugger($debugger = new \Symfony\Component\Templating\Tests\Fixtures\ProjectTemplateDebugger()); $this->assertFalse($loader->load(new TemplateReference('foo', 'php')), '->load() returns false if the embed loader is not able to load the template'); $loader->load(new TemplateReference('index')); diff --git a/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php index 5964f59625..27c8d16974 100644 --- a/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php +++ b/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php @@ -12,14 +12,13 @@ namespace Symfony\Component\Templating\Tests\Loader; use Symfony\Component\Templating\Loader\Loader; -use Symfony\Component\Templating\TemplateNameParser; use Symfony\Component\Templating\TemplateReferenceInterface; class LoaderTest extends \PHPUnit_Framework_TestCase { public function testGetSetDebugger() { - $loader = new ProjectTemplateLoader4(new TemplateNameParser()); + $loader = new ProjectTemplateLoader4(); $loader->setDebugger($debugger = new \Symfony\Component\Templating\Tests\Fixtures\ProjectTemplateDebugger()); $this->assertTrue($loader->getDebugger() === $debugger, '->setDebugger() sets the debugger instance'); } diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparison.php b/src/Symfony/Component/Validator/Constraints/AbstractComparison.php index b1d9ec67fe..fdf080b206 100644 --- a/src/Symfony/Component/Validator/Constraints/AbstractComparison.php +++ b/src/Symfony/Component/Validator/Constraints/AbstractComparison.php @@ -29,7 +29,7 @@ abstract class AbstractComparison extends Constraint */ public function __construct($options = null) { - if (!isset($options['value'])) { + if (is_array($options) && !isset($options['value'])) { throw new ConstraintDefinitionException(sprintf( 'The %s constraint requires the "value" option to be set.', get_class($this) diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php index 6b76fc80b2..65753051db 100644 --- a/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php +++ b/src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php @@ -30,7 +30,7 @@ abstract class AbstractComparisonValidator extends ConstraintValidator return; } - if (!$this->compareValues($value, $constraint->value, $constraint)) { + if (!$this->compareValues($value, $constraint->value)) { $this->context->addViolation($constraint->message, array( '{{ value }}' => $this->valueToString($constraint->value), '{{ compared_value }}' => $this->valueToString($constraint->value), diff --git a/src/Symfony/Component/Validator/Tests/ConstraintTest.php b/src/Symfony/Component/Validator/Tests/ConstraintTest.php index 007bb1e3a2..f1f73fca06 100644 --- a/src/Symfony/Component/Validator/Tests/ConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/ConstraintTest.php @@ -117,14 +117,14 @@ class ConstraintTest extends \PHPUnit_Framework_TestCase public function testGetTargetsCanBeString() { - $constraint = new ClassConstraint; + $constraint = new ClassConstraint(); $this->assertEquals('class', $constraint->getTargets()); } public function testGetTargetsCanBeArray() { - $constraint = new ConstraintA; + $constraint = new ConstraintA(); $this->assertEquals(array('property', 'class'), $constraint->getTargets()); } diff --git a/src/Symfony/Component/Validator/Tests/Mapping/ElementMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/ElementMetadataTest.php index eb01d118a7..8cf3e6dec4 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/ElementMetadataTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/ElementMetadataTest.php @@ -21,7 +21,7 @@ class ElementMetadataTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->metadata = new TestElementMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); + $this->metadata = new TestElementMetadata(); } protected function tearDown() diff --git a/src/Symfony/Component/Validator/Validator.php b/src/Symfony/Component/Validator/Validator.php index 476c8141bc..a7bcc3a0a6 100644 --- a/src/Symfony/Component/Validator/Validator.php +++ b/src/Symfony/Component/Validator/Validator.php @@ -108,7 +108,7 @@ class Validator implements ValidatorInterface ? '"'.$containingValue.'"' : 'the value of type '.gettype($containingValue); - throw new ValidatorException(sprintf('The metadata for '.$valueAsString.' does not support properties.')); + throw new ValidatorException(sprintf('The metadata for %s does not support properties.', $valueAsString)); } foreach ($this->resolveGroups($groups) as $group) {