From c5123d6881a010680cfb0370507a3f8cbad5adf7 Mon Sep 17 00:00:00 2001 From: Gregor Harlan Date: Tue, 31 Mar 2015 01:07:44 +0200 Subject: [PATCH 01/11] CS: Pre incrementation/decrementation should be used if possible --- .../Doctrine/Tests/Logger/DbalLoggerTest.php | 2 +- .../Bridge/Twig/Extension/CodeExtension.php | 2 +- .../Command/ContainerDebugCommand.php | 2 +- .../Templating/Helper/CodeHelper.php | 2 +- .../FrameworkBundle/Translation/PhpExtractor.php | 2 +- .../Bundle/TwigBundle/Command/LintCommand.php | 2 +- .../Component/ClassLoader/ClassMapGenerator.php | 2 +- src/Symfony/Component/Config/Loader/FileLoader.php | 2 +- src/Symfony/Component/Console/Application.php | 2 +- .../Component/Console/Helper/DialogHelper.php | 4 ++-- .../Component/Console/Helper/TableHelper.php | 4 ++-- src/Symfony/Component/Console/Input/ArgvInput.php | 2 +- .../Component/CssSelector/Parser/TokenStream.php | 2 +- .../XPath/Extension/FunctionExtension.php | 2 +- .../Debug/Tests/Exception/FlattenExceptionTest.php | 6 +++--- .../EventDispatcher/Tests/EventDispatcherTest.php | 2 +- src/Symfony/Component/Filesystem/Filesystem.php | 2 +- src/Symfony/Component/Finder/Expression/Glob.php | 2 +- src/Symfony/Component/Finder/Glob.php | 2 +- src/Symfony/Component/Finder/Tests/FinderTest.php | 4 ++-- .../Finder/Tests/Iterator/FilterIteratorTest.php | 4 ++-- src/Symfony/Component/HttpFoundation/IpUtils.php | 2 +- .../Component/HttpFoundation/ParameterBag.php | 2 +- src/Symfony/Component/HttpFoundation/Request.php | 2 +- .../HttpFoundation/Tests/HeaderBagTest.php | 2 +- .../HttpFoundation/Tests/ParameterBagTest.php | 2 +- .../Tests/Session/Attribute/AttributeBagTest.php | 2 +- .../Tests/Session/Flash/FlashBagTest.php | 2 +- .../HttpFoundation/Tests/Session/SessionTest.php | 2 +- .../DataCollector/LoggerDataCollector.php | 2 +- .../HttpCache/EsiResponseCacheStrategy.php | 2 +- .../Tests/Profiler/AbstractProfilerStorageTest.php | 10 +++++----- .../Tests/Profiler/FileProfilerStorageTest.php | 4 ++-- .../Tests/Profiler/MongoDbProfilerStorageTest.php | 2 +- .../AbstractNumberFormatterTest.php | 4 ++-- .../Component/Process/Tests/SignalListener.php | 2 +- .../Routing/Loader/AnnotationClassLoader.php | 2 +- .../Routing/Loader/AnnotationFileLoader.php | 2 +- .../Routing/Matcher/Dumper/ApacheMatcherDumper.php | 2 +- src/Symfony/Component/Routing/RouteCompiler.php | 4 ++-- .../Component/Security/Acl/Dbal/AclProvider.php | 8 ++++---- .../Security/Acl/Dbal/MutableAclProvider.php | 12 ++++++------ src/Symfony/Component/Security/Acl/Domain/Acl.php | 8 ++++---- .../Security/Acl/Permission/MaskBuilder.php | 2 +- .../Core/Encoder/MessageDigestPasswordEncoder.php | 2 +- .../Core/Encoder/Pbkdf2PasswordEncoder.php | 4 ++-- .../Component/Security/Core/Util/StringUtils.php | 2 +- .../RememberMe/TokenBasedRememberMeServices.php | 2 +- .../Tests/Acl/Dbal/AclProviderBenchmarkTest.php | 8 ++++---- .../Security/Tests/Acl/Dbal/AclProviderTest.php | 2 +- .../Tests/Acl/Domain/DoctrineAclCacheTest.php | 2 +- .../Authorization/AccessDecisionManagerTest.php | 6 +++--- .../Core/Encoder/BCryptPasswordEncoderTest.php | 2 +- .../Security/Tests/Core/Util/SecureRandomTest.php | 14 +++++++------- .../Component/Translation/Loader/MoFileLoader.php | 2 +- .../Translation/Tests/PluralizationRulesTest.php | 2 +- .../Validator/Tests/Fixtures/FilesLoader.php | 2 +- 57 files changed, 93 insertions(+), 93 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php index 269367872eaa..872779c2f841 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php @@ -121,7 +121,7 @@ public function testLogUTF8LongString() $shortString = ''; $longString = ''; - for ($i = 1; $i <= DbalLogger::MAX_STRING_LENGTH; $i++) { + for ($i = 1; $i <= DbalLogger::MAX_STRING_LENGTH; ++$i) { $shortString .= $testStringArray[$i % $testStringCount]; $longString .= $testStringArray[$i % $testStringCount]; } diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php index b5f619d327a0..49bb72844607 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -141,7 +141,7 @@ public function fileExcerpt($file, $line) $content = preg_split('#
#', $code); $lines = array(); - for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; $i++) { + for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) { $lines[] = ''.self::fixCodeMarkup($content[$i - 1]).''; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index d58031fb7de0..a10760a1b9c2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -143,7 +143,7 @@ protected function validateInput(InputInterface $input) $optionsCount = 0; foreach ($options as $option) { if ($input->getOption($option)) { - $optionsCount++; + ++$optionsCount; } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php index e7042e0dc353..bb7e0298cbf5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php @@ -135,7 +135,7 @@ public function fileExcerpt($file, $line) $content = preg_split('#
#', $code); $lines = array(); - for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; $i++) { + for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) { $lines[] = ''.self::fixCodeMarkup($content[$i - 1]).''; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php index 5007a86bcaa0..8084b0fd7ada 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php @@ -148,7 +148,7 @@ protected function parseTokens($tokens, MessageCatalogue $catalog) { $tokenIterator = new \ArrayIterator($tokens); - for ($key = 0; $key < $tokenIterator->count(); $key++) { + for ($key = 0; $key < $tokenIterator->count(); ++$key) { foreach ($this->sequences as $sequence) { $message = ''; $tokenIterator->seek($key); diff --git a/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php b/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php index 308d53b54eca..f2e9324010f2 100644 --- a/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php +++ b/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php @@ -142,7 +142,7 @@ protected function getContext($template, $line, $context = 3) $result = array(); while ($position < $max) { $result[$position + 1] = $lines[$position]; - $position++; + ++$position; } return $result; diff --git a/src/Symfony/Component/ClassLoader/ClassMapGenerator.php b/src/Symfony/Component/ClassLoader/ClassMapGenerator.php index 4c2aeab3ac79..112bee87bddc 100644 --- a/src/Symfony/Component/ClassLoader/ClassMapGenerator.php +++ b/src/Symfony/Component/ClassLoader/ClassMapGenerator.php @@ -95,7 +95,7 @@ private static function findClasses($path) $classes = array(); $namespace = ''; - for ($i = 0, $max = count($tokens); $i < $max; $i++) { + for ($i = 0, $max = count($tokens); $i < $max; ++$i) { $token = $tokens[$i]; if (is_string($token)) { diff --git a/src/Symfony/Component/Config/Loader/FileLoader.php b/src/Symfony/Component/Config/Loader/FileLoader.php index c1add20cea5d..2f3cc3bd08f7 100644 --- a/src/Symfony/Component/Config/Loader/FileLoader.php +++ b/src/Symfony/Component/Config/Loader/FileLoader.php @@ -91,7 +91,7 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe } $resources = is_array($resource) ? $resource : array($resource); - for ($i = 0; $i < $resourcesCount = count($resources); $i++) { + for ($i = 0; $i < $resourcesCount = count($resources); ++$i) { if (isset(self::$loading[$resources[$i]])) { if ($i == $resourcesCount - 1) { throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading)); diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 9daff3f3019b..b4c710901298 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -759,7 +759,7 @@ public function renderException($e, $output) 'args' => array(), )); - for ($i = 0, $count = count($trace); $i < $count; $i++) { + for ($i = 0, $count = count($trace); $i < $count; ++$i) { $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : ''; $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : ''; $function = $trace[$i]['function']; diff --git a/src/Symfony/Component/Console/Helper/DialogHelper.php b/src/Symfony/Component/Console/Helper/DialogHelper.php index 7c00cb82f501..4b395d9a7f71 100644 --- a/src/Symfony/Component/Console/Helper/DialogHelper.php +++ b/src/Symfony/Component/Console/Helper/DialogHelper.php @@ -131,7 +131,7 @@ public function ask(OutputInterface $output, $question, $default = null, array $ // Backspace Character if ("\177" === $c) { if (0 === $numMatches && 0 !== $i) { - $i--; + --$i; // Move cursor backwards $output->write("\033[1D"); } @@ -184,7 +184,7 @@ public function ask(OutputInterface $output, $question, $default = null, array $ } else { $output->write($c); $ret .= $c; - $i++; + ++$i; $numMatches = 0; $ofs = 0; diff --git a/src/Symfony/Component/Console/Helper/TableHelper.php b/src/Symfony/Component/Console/Helper/TableHelper.php index 90357cc21408..0904a1016953 100644 --- a/src/Symfony/Component/Console/Helper/TableHelper.php +++ b/src/Symfony/Component/Console/Helper/TableHelper.php @@ -334,7 +334,7 @@ private function renderRowSeparator() } $markup = $this->crossingChar; - for ($column = 0; $column < $count; $column++) { + for ($column = 0; $column < $count; ++$column) { $markup .= str_repeat($this->horizontalBorderChar, $this->getColumnWidth($column)) .$this->crossingChar ; @@ -366,7 +366,7 @@ private function renderRow(array $row, $cellFormat) } $this->renderColumnSeparator(); - for ($column = 0, $count = $this->getNumberOfColumns(); $column < $count; $column++) { + for ($column = 0, $count = $this->getNumberOfColumns(); $column < $count; ++$column) { $this->renderCell($row, $column, $cellFormat); $this->renderColumnSeparator(); } diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index f5cc5d136bd3..97b0cfc05d21 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -123,7 +123,7 @@ private function parseShortOption($token) private function parseShortOptionSet($name) { $len = strlen($name); - for ($i = 0; $i < $len; $i++) { + for ($i = 0; $i < $len; ++$i) { if (!$this->definition->hasShortcut($name[$i])) { throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i])); } diff --git a/src/Symfony/Component/CssSelector/Parser/TokenStream.php b/src/Symfony/Component/CssSelector/Parser/TokenStream.php index 8184b832b3c2..c0525d7a8336 100644 --- a/src/Symfony/Component/CssSelector/Parser/TokenStream.php +++ b/src/Symfony/Component/CssSelector/Parser/TokenStream.php @@ -100,7 +100,7 @@ public function getNext() throw new InternalErrorException('Unexpected token stream end.'); } - return $this->tokens[$this->cursor ++]; + return $this->tokens[$this->cursor++]; } /** diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php index 0086240c81fd..41ece8a42208 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php @@ -84,7 +84,7 @@ public function translateNthChild(XPathExpr $xpath, FunctionNode $function, $las if ($last) { $expr = 'last() - '.$expr; - $b--; + --$b; } if (0 !== $b) { diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php index 923c47ffa073..99eaf497d5b4 100644 --- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php +++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php @@ -189,9 +189,9 @@ public function testRecursionInArguments() public function testTooBigArray() { $a = array(); - for ($i = 0; $i < 20; $i++) { - for ($j = 0; $j < 50; $j++) { - for ($k = 0; $k < 10; $k++) { + for ($i = 0; $i < 20; ++$i) { + for ($j = 0; $j < 50; ++$j) { + for ($k = 0; $k < 10; ++$k) { $a[$i][$j][$k] = 'value'; } } diff --git a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php index b543de5eff41..839e8ea611cf 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php @@ -125,7 +125,7 @@ public function testDispatchForClosure() { $invoked = 0; $listener = function () use (&$invoked) { - $invoked++; + ++$invoked; }; $this->dispatcher->addListener('pre.foo', $listener); $this->dispatcher->addListener('post.foo', $listener); diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index b7ae31bb7198..de5cafc46bec 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -324,7 +324,7 @@ public function makePathRelative($endPath, $startPath) // Find for which directory the common path stops $index = 0; while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) { - $index++; + ++$index; } // Determine how deep the start path is relative to the common path (ie, "web/bundles" = 2 levels) diff --git a/src/Symfony/Component/Finder/Expression/Glob.php b/src/Symfony/Component/Finder/Expression/Glob.php index 3023ceea69a3..a6984b82e393 100644 --- a/src/Symfony/Component/Finder/Expression/Glob.php +++ b/src/Symfony/Component/Finder/Expression/Glob.php @@ -105,7 +105,7 @@ public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true) $inCurlies = 0; $regex = ''; $sizeGlob = strlen($this->pattern); - for ($i = 0; $i < $sizeGlob; $i++) { + for ($i = 0; $i < $sizeGlob; ++$i) { $car = $this->pattern[$i]; if ($firstByte) { if ($strictLeadingDot && '.' !== $car) { diff --git a/src/Symfony/Component/Finder/Glob.php b/src/Symfony/Component/Finder/Glob.php index c2030c9232fd..fedcc5e708ec 100644 --- a/src/Symfony/Component/Finder/Glob.php +++ b/src/Symfony/Component/Finder/Glob.php @@ -51,7 +51,7 @@ public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardS $inCurlies = 0; $regex = ''; $sizeGlob = strlen($glob); - for ($i = 0; $i < $sizeGlob; $i++) { + for ($i = 0; $i < $sizeGlob; ++$i) { $car = $glob[$i]; if ($firstByte) { if ($strictLeadingDot && '.' !== $car) { diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php index 67625e968162..61c2a6ab3c8a 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -466,7 +466,7 @@ public function testCountDirectories() $i = 0; foreach ($directory as $dir) { - $i++; + ++$i; } $this->assertCount($i, $directory); @@ -478,7 +478,7 @@ public function testCountFiles() $i = 0; foreach ($files as $file) { - $i++; + ++$i; } $this->assertCount($i, $files); diff --git a/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php index 029a266b7be6..41e05a0a7b39 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php @@ -31,7 +31,7 @@ public function testFilterFilesystemIterators() $c = 0; foreach ($i as $item) { - $c++; + ++$c; } $this->assertEquals(1, $c); @@ -40,7 +40,7 @@ public function testFilterFilesystemIterators() $c = 0; foreach ($i as $item) { - $c++; + ++$c; } // This would fail with \FilterIterator but works with Symfony\Component\Finder\Iterator\FilterIterator diff --git a/src/Symfony/Component/HttpFoundation/IpUtils.php b/src/Symfony/Component/HttpFoundation/IpUtils.php index ea68e2ea8ba9..68e9421d942a 100644 --- a/src/Symfony/Component/HttpFoundation/IpUtils.php +++ b/src/Symfony/Component/HttpFoundation/IpUtils.php @@ -110,7 +110,7 @@ public static function checkIp6($requestIp, $ip) $bytesAddr = unpack('n*', inet_pton($address)); $bytesTest = unpack('n*', inet_pton($requestIp)); - for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) { + for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; ++$i) { $left = $netmask - 16 * ($i - 1); $left = ($left <= 16) ? $left : 16; $mask = ~(0xffff >> $left) & 0xffff; diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index 7c13866d8c09..26ca7986370e 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -113,7 +113,7 @@ public function get($path, $default = null, $deep = false) $value = $this->parameters[$root]; $currentKey = null; - for ($i = $pos, $c = strlen($path); $i < $c; $i++) { + for ($i = $pos, $c = strlen($path); $i < $c; ++$i) { $char = $path[$i]; if ('[' === $char) { diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 75ef72d0c750..25e195068dd6 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1557,7 +1557,7 @@ public function getLanguages() $lang = $codes[1]; } } else { - for ($i = 0, $max = count($codes); $i < $max; $i++) { + for ($i = 0, $max = count($codes); $i < $max; ++$i) { if ($i === 0) { $lang = strtolower($codes[0]); } else { diff --git a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php index 9b925d70f038..ada9ac0d1eaa 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php @@ -196,7 +196,7 @@ public function testGetIterator() $i = 0; foreach ($headerBag as $key => $val) { - $i++; + ++$i; $this->assertEquals(array($headers[$key]), $val); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php index fdbab026b798..2044d97a6fcb 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php @@ -233,7 +233,7 @@ public function testGetIterator() $i = 0; foreach ($bag as $key => $val) { - $i++; + ++$i; $this->assertEquals($parameters[$key], $val); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php index d291590fd9e4..5515003b4073 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php @@ -177,7 +177,7 @@ public function testGetIterator() $i = 0; foreach ($this->bag as $key => $val) { $this->assertEquals($this->array[$key], $val); - $i++; + ++$i; } $this->assertEquals(count($this->array), $i); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php index 6b529ab41f5d..c424591755e0 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php @@ -145,7 +145,7 @@ public function testGetIterator() $i = 0; foreach ($this->bag as $key => $val) { $this->assertEquals(array($flashes[$key]), $val); - $i++; + ++$i; } $this->assertEquals(count($flashes), $i); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php index 4e1667cf9e5b..385df1e46a95 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -203,7 +203,7 @@ public function testGetIterator() $i = 0; foreach ($this->session as $key => $val) { $this->assertEquals($attributes[$key], $val); - $i++; + ++$i; } $this->assertEquals(count($attributes), $i); diff --git a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php index 2c0e907ec0dd..c0a95f51f7aa 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php @@ -116,7 +116,7 @@ private function computeDeprecationCount() $count = 0; foreach ($this->logger->getLogs() as $log) { if (isset($log['context']['type']) && ErrorHandler::TYPE_DEPRECATION === $log['context']['type']) { - $count++; + ++$count; } } diff --git a/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php b/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php index 6384af9660a8..4b28acff4af8 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php @@ -45,7 +45,7 @@ public function add(Response $response) $this->maxAges[] = $response->getMaxAge(); } - $this->embeddedResponses++; + ++$this->embeddedResponses; } /** diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php index 07dff696d60f..aa2b31dbc381 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php @@ -17,7 +17,7 @@ abstract class AbstractProfilerStorageTest extends \PHPUnit_Framework_TestCase { public function testStore() { - for ($i = 0; $i < 10; $i++) { + for ($i = 0; $i < 10; ++$i) { $profile = new Profile('token_'.$i); $profile->setIp('127.0.0.1'); $profile->setUrl('http://foo.bar'); @@ -159,7 +159,7 @@ public function testStoreTime() $dt = new \DateTime('now'); $start = $dt->getTimestamp(); - for ($i = 0; $i < 3; $i++) { + for ($i = 0; $i < 3; ++$i) { $dt->modify('+1 minute'); $profile = new Profile('time_'.$i); $profile->setIp('127.0.0.1'); @@ -181,7 +181,7 @@ public function testStoreTime() public function testRetrieveByEmptyUrlAndIp() { - for ($i = 0; $i < 5; $i++) { + for ($i = 0; $i < 5; ++$i) { $profile = new Profile('token_'.$i); $profile->setMethod('GET'); $this->getStorage()->write($profile); @@ -193,7 +193,7 @@ public function testRetrieveByEmptyUrlAndIp() public function testRetrieveByMethodAndLimit() { foreach (array('POST', 'GET') as $method) { - for ($i = 0; $i < 5; $i++) { + for ($i = 0; $i < 5; ++$i) { $profile = new Profile('token_'.$i.$method); $profile->setMethod($method); $this->getStorage()->write($profile); @@ -233,7 +233,7 @@ public function testPurge() public function testDuplicates() { - for ($i = 1; $i <= 5; $i++) { + for ($i = 1; $i <= 5; ++$i) { $profile = new Profile('foo'.$i); $profile->setIp('127.0.0.1'); $profile->setUrl('http://example.net/'); diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php index 6c7462141978..d5edc7003286 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php @@ -62,7 +62,7 @@ protected function getStorage() public function testMultiRowIndexFile() { $iteration = 3; - for ($i = 0; $i < $iteration; $i++) { + for ($i = 0; $i < $iteration; ++$i) { $profile = new Profile('token'.$i); $profile->setIp('127.0.0.'.$i); $profile->setUrl('http://foo.bar/'.$i); @@ -74,7 +74,7 @@ public function testMultiRowIndexFile() } $handle = fopen(self::$tmpDir.'/index.csv', 'r'); - for ($i = 0; $i < $iteration; $i++) { + for ($i = 0; $i < $iteration; ++$i) { $row = fgetcsv($handle); $this->assertEquals('token'.$i, $row[0]); $this->assertEquals('127.0.0.'.$i, $row[1]); diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php index c72732563c67..29525fe6bdf7 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php @@ -100,7 +100,7 @@ public function getDsns() public function testCleanup() { $dt = new \DateTime('-2 day'); - for ($i = 0; $i < 3; $i++) { + for ($i = 0; $i < 3; ++$i) { $dt->modify('-1 day'); $profile = new Profile('time_'.$i); $profile->setTime($dt->getTimestamp()); diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php index c172653d5bb4..a2b90324f514 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php @@ -490,7 +490,7 @@ public function testGetSymbol() $r->setAccessible(true); $expected = $r->getValue('Symfony\Component\Intl\NumberFormatter\NumberFormatter'); - for ($i = 0; $i <= 17; $i++) { + for ($i = 0; $i <= 17; ++$i) { $this->assertSame($expected[1][$i], $decimalFormatter->getSymbol($i)); $this->assertSame($expected[2][$i], $currencyFormatter->getSymbol($i)); } @@ -505,7 +505,7 @@ public function testGetTextAttribute() $r->setAccessible(true); $expected = $r->getValue('Symfony\Component\Intl\NumberFormatter\NumberFormatter'); - for ($i = 0; $i <= 5; $i++) { + for ($i = 0; $i <= 5; ++$i) { $this->assertSame($expected[1][$i], $decimalFormatter->getTextAttribute($i)); $this->assertSame($expected[2][$i], $currencyFormatter->getTextAttribute($i)); } diff --git a/src/Symfony/Component/Process/Tests/SignalListener.php b/src/Symfony/Component/Process/Tests/SignalListener.php index 335ac6027e8e..bd4d138b0476 100644 --- a/src/Symfony/Component/Process/Tests/SignalListener.php +++ b/src/Symfony/Component/Process/Tests/SignalListener.php @@ -10,7 +10,7 @@ // ticks require activity to work - sleep(4); does not work while ($n < 400) { usleep(10000); - $n++; + ++$n; } return; diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index 82fe6abd9531..e35f807b4c39 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -237,7 +237,7 @@ protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMetho if ($this->defaultRouteIndex > 0) { $name .= '_'.$this->defaultRouteIndex; } - $this->defaultRouteIndex++; + ++$this->defaultRouteIndex; return $name; } diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index e54a0181c786..8ce57ac18ca5 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -88,7 +88,7 @@ protected function findClass($file) $class = false; $namespace = false; $tokens = token_get_all(file_get_contents($file)); - for ($i = 0, $count = count($tokens); $i < $count; $i++) { + for ($i = 0, $count = count($tokens); $i < $count; ++$i) { $token = $tokens[$i]; if (!is_array($token)) { diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php index 219f2fc03608..84b1944926a9 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php @@ -55,7 +55,7 @@ public function dump(array $options = array()) if (null !== $hostRegex && $prevHostRegex !== $hostRegex) { $prevHostRegex = $hostRegex; - $hostRegexUnique++; + ++$hostRegexUnique; $rule = array(); diff --git a/src/Symfony/Component/Routing/RouteCompiler.php b/src/Symfony/Component/Routing/RouteCompiler.php index e998b93e938a..f6637da666b8 100644 --- a/src/Symfony/Component/Routing/RouteCompiler.php +++ b/src/Symfony/Component/Routing/RouteCompiler.php @@ -145,7 +145,7 @@ private static function compilePattern(Route $route, $pattern, $isHost) // find the first optional token $firstOptional = PHP_INT_MAX; if (!$isHost) { - for ($i = count($tokens) - 1; $i >= 0; $i--) { + for ($i = count($tokens) - 1; $i >= 0; --$i) { $token = $tokens[$i]; if ('variable' === $token[0] && $route->hasDefault($token[3])) { $firstOptional = $i; @@ -157,7 +157,7 @@ private static function compilePattern(Route $route, $pattern, $isHost) // compute the matching regexp $regexp = ''; - for ($i = 0, $nbToken = count($tokens); $i < $nbToken; $i++) { + for ($i = 0, $nbToken = count($tokens); $i < $nbToken; ++$i) { $regexp .= self::computeRegexp($tokens, $i, $firstOptional); } diff --git a/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php b/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php index 750a304d37a5..7c512adc7c86 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php +++ b/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php @@ -104,7 +104,7 @@ public function findAcls(array $oids, array $sids = array()) $currentBatch = array(); $oidLookup = array(); - for ($i = 0, $c = count($oids); $i < $c; $i++) { + for ($i = 0, $c = count($oids); $i < $c; ++$i) { $oid = $oids[$i]; $oidLookupKey = $oid->getIdentifier().$oid->getType(); $oidLookup[$oidLookupKey] = $oid; @@ -280,7 +280,7 @@ protected function getAncestorLookupSql(array $batch) $types = array(); $count = count($batch); - for ($i = 0; $i < $count; $i++) { + for ($i = 0; $i < $count; ++$i) { if (!isset($types[$batch[$i]->getType()])) { $types[$batch[$i]->getType()] = true; @@ -295,7 +295,7 @@ protected function getAncestorLookupSql(array $batch) if (1 === count($types)) { $ids = array(); - for ($i = 0; $i < $count; $i++) { + for ($i = 0; $i < $count; ++$i) { $ids[] = $this->connection->quote($batch[$i]->getIdentifier()); } @@ -306,7 +306,7 @@ protected function getAncestorLookupSql(array $batch) ); } else { $where = '(o.object_identifier = %s AND c.class_type = %s)'; - for ($i = 0; $i < $count; $i++) { + for ($i = 0; $i < $count; ++$i) { $sql .= sprintf( $where, $this->connection->quote($batch[$i]->getIdentifier()), diff --git a/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php b/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php index 74f52ce32151..30772b46bf81 100644 --- a/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php +++ b/src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php @@ -786,7 +786,7 @@ private function updateNewFieldAceProperty($name, array $changes) $sids = new \SplObjectStorage(); $classIds = new \SplObjectStorage(); foreach ($changes[1] as $field => $new) { - for ($i = 0, $c = count($new); $i < $c; $i++) { + for ($i = 0, $c = count($new); $i < $c; ++$i) { $ace = $new[$i]; if (null === $ace->getId()) { @@ -827,7 +827,7 @@ private function updateOldFieldAceProperty($name, array $changes) { $currentIds = array(); foreach ($changes[1] as $field => $new) { - for ($i = 0, $c = count($new); $i < $c; $i++) { + for ($i = 0, $c = count($new); $i < $c; ++$i) { $ace = $new[$i]; if (null !== $ace->getId()) { @@ -837,7 +837,7 @@ private function updateOldFieldAceProperty($name, array $changes) } foreach ($changes[0] as $old) { - for ($i = 0, $c = count($old); $i < $c; $i++) { + for ($i = 0, $c = count($old); $i < $c; ++$i) { $ace = $old[$i]; if (!isset($currentIds[$ace->getId()])) { @@ -860,7 +860,7 @@ private function updateNewAceProperty($name, array $changes) $sids = new \SplObjectStorage(); $classIds = new \SplObjectStorage(); - for ($i = 0, $c = count($new); $i < $c; $i++) { + for ($i = 0, $c = count($new); $i < $c; ++$i) { $ace = $new[$i]; if (null === $ace->getId()) { @@ -901,7 +901,7 @@ private function updateOldAceProperty($name, array $changes) list($old, $new) = $changes; $currentIds = array(); - for ($i = 0, $c = count($new); $i < $c; $i++) { + for ($i = 0, $c = count($new); $i < $c; ++$i) { $ace = $new[$i]; if (null !== $ace->getId()) { @@ -909,7 +909,7 @@ private function updateOldAceProperty($name, array $changes) } } - for ($i = 0, $c = count($old); $i < $c; $i++) { + for ($i = 0, $c = count($old); $i < $c; ++$i) { $ace = $old[$i]; if (!isset($currentIds[$ace->getId()])) { diff --git a/src/Symfony/Component/Security/Acl/Domain/Acl.php b/src/Symfony/Component/Security/Acl/Domain/Acl.php index 63a58c733d2f..365fc376d623 100644 --- a/src/Symfony/Component/Security/Acl/Domain/Acl.php +++ b/src/Symfony/Component/Security/Acl/Domain/Acl.php @@ -415,7 +415,7 @@ private function deleteAce($property, $index) $this->$property = array_values($this->$property); $this->onPropertyChanged($property, $oldValue, $this->$property); - for ($i = $index, $c = count($this->$property); $i < $c; $i++) { + for ($i = $index, $c = count($this->$property); $i < $c; ++$i) { $this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i + 1, $i); } } @@ -441,7 +441,7 @@ private function deleteFieldAce($property, $index, $field) $aces[$field] = array_values($aces[$field]); $this->onPropertyChanged($property, $oldValue, $this->$property); - for ($i = $index, $c = count($aces[$field]); $i < $c; $i++) { + for ($i = $index, $c = count($aces[$field]); $i < $c; ++$i) { $this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i + 1, $i); } } @@ -486,7 +486,7 @@ private function insertAce($property, $index, $mask, SecurityIdentityInterface $ array_slice($this->$property, $index) ); - for ($i = $index, $c = count($this->$property) - 1; $i < $c; $i++) { + for ($i = $index, $c = count($this->$property) - 1; $i < $c; ++$i) { $this->onEntryPropertyChanged($aces[$i + 1], 'aceOrder', $i, $i + 1); } } @@ -544,7 +544,7 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti array_slice($aces[$field], $index) ); - for ($i = $index, $c = count($aces[$field]) - 1; $i < $c; $i++) { + for ($i = $index, $c = count($aces[$field]) - 1; $i < $c; ++$i) { $this->onEntryPropertyChanged($aces[$field][$i + 1], 'aceOrder', $i, $i + 1); } } diff --git a/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php b/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php index c45e2f9741ce..45d89aa71064 100644 --- a/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php +++ b/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php @@ -128,7 +128,7 @@ public function getPattern() $length = strlen($pattern); $bitmask = str_pad(decbin($this->mask), $length, '0', STR_PAD_LEFT); - for ($i = $length - 1; $i >= 0; $i--) { + for ($i = $length - 1; $i >= 0; --$i) { if ('1' === $bitmask[$i]) { try { $pattern[$i] = self::getCode(1 << ($length - $i - 1)); diff --git a/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php index 03de2284ac94..1706fc86a8eb 100644 --- a/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php @@ -55,7 +55,7 @@ public function encodePassword($raw, $salt) $digest = hash($this->algorithm, $salted, true); // "stretch" hash - for ($i = 1; $i < $this->iterations; $i++) { + for ($i = 1; $i < $this->iterations; ++$i) { $digest = hash($this->algorithm, $digest.$salted, true); } diff --git a/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php index dac1cad6000e..6f24c4f1e279 100644 --- a/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.php @@ -87,11 +87,11 @@ private function hashPbkdf2($algorithm, $password, $salt, $iterations, $length = $blocks = ceil($length / strlen(hash($algorithm, null, true))); $digest = ''; - for ($i = 1; $i <= $blocks; $i++) { + for ($i = 1; $i <= $blocks; ++$i) { $ib = $block = hash_hmac($algorithm, $salt.pack('N', $i), $password, true); // Iterations - for ($j = 1; $j < $iterations; $j++) { + for ($j = 1; $j < $iterations; ++$j) { $ib ^= ($block = hash_hmac($algorithm, $block, $password, true)); } diff --git a/src/Symfony/Component/Security/Core/Util/StringUtils.php b/src/Symfony/Component/Security/Core/Util/StringUtils.php index e68347f3935d..343585c88c50 100644 --- a/src/Symfony/Component/Security/Core/Util/StringUtils.php +++ b/src/Symfony/Component/Security/Core/Util/StringUtils.php @@ -60,7 +60,7 @@ public static function equals($knownString, $userInput) $result = 0; - for ($i = 0; $i < $knownLen; $i++) { + for ($i = 0; $i < $knownLen; ++$i) { $result |= (ord($knownString[$i]) ^ ord($userInput[$i])); } diff --git a/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php index 8283a7c28701..3d2cf12cb075 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php +++ b/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php @@ -82,7 +82,7 @@ private function compareHashes($hash1, $hash2) } $result = 0; - for ($i = 0; $i < $c; $i++) { + for ($i = 0; $i < $c; ++$i) { $result |= ord($hash1[$i]) ^ ord($hash2[$i]); } diff --git a/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderBenchmarkTest.php b/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderBenchmarkTest.php index 265700167cbd..0c354758e82a 100644 --- a/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderBenchmarkTest.php +++ b/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderBenchmarkTest.php @@ -92,7 +92,7 @@ protected function generateTestData() $this->insertEntryStmt = $this->con->prepare('INSERT INTO acl_entries (id, class_id, object_identity_id, field_name, ace_order, security_identity_id, mask, granting, granting_strategy, audit_success, audit_failure) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); $this->insertOidAncestorStmt = $this->con->prepare('INSERT INTO acl_object_identity_ancestors (object_identity_id, ancestor_id) VALUES (?, ?)'); - for ($i = 0; $i < 40000; $i++) { + for ($i = 0; $i < 40000; ++$i) { $this->generateAclHierarchy(); } } @@ -107,7 +107,7 @@ protected function generateAclHierarchy() protected function generateAclLevel($depth, $parentId, $ancestors) { $level = count($ancestors); - for ($i = 0, $t = rand(1, 10); $i < $t; $i++) { + for ($i = 0, $t = rand(1, 10); $i < $t; ++$i) { $id = $this->generateAcl($this->chooseClassId(), $parentId, $ancestors); if ($level < $depth) { @@ -178,7 +178,7 @@ protected function generateAces($classId, $objectId) $sids = array(); $fieldOrder = array(); - for ($i = 0; $i <= 30; $i++) { + for ($i = 0; $i <= 30; ++$i) { $fieldName = rand(0, 1) ? null : $this->getRandomString(rand(10, 20)); do { @@ -226,7 +226,7 @@ protected function generateMask() while ($i <= 30) { $mask |= 1 << rand(0, 30); - $i++; + ++$i; } return $mask; diff --git a/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderTest.php b/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderTest.php index d701e226cefc..ecd53db122d0 100644 --- a/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderTest.php +++ b/src/Symfony/Component/Security/Tests/Acl/Dbal/AclProviderTest.php @@ -130,7 +130,7 @@ public function testFindAcl() $i = 0; foreach ($aces as $index => $ace) { $this->assertEquals($i, $index); - $i++; + ++$i; } $sid = $aces[0]->getSecurityIdentity(); diff --git a/src/Symfony/Component/Security/Tests/Acl/Domain/DoctrineAclCacheTest.php b/src/Symfony/Component/Security/Tests/Acl/Domain/DoctrineAclCacheTest.php index 93c87c149444..54f932d4561e 100644 --- a/src/Symfony/Component/Security/Tests/Acl/Domain/DoctrineAclCacheTest.php +++ b/src/Symfony/Component/Security/Tests/Acl/Domain/DoctrineAclCacheTest.php @@ -72,7 +72,7 @@ protected function getAcl($depth = 0) $acl->insertClassFieldAce('foo', $sid, 1); $acl->insertObjectAce($sid, 1); $acl->insertObjectFieldAce('foo', $sid, 1); - $id++; + ++$id; if ($depth > 0) { $acl->setParentAcl($this->getAcl($depth - 1)); diff --git a/src/Symfony/Component/Security/Tests/Core/Authorization/AccessDecisionManagerTest.php b/src/Symfony/Component/Security/Tests/Core/Authorization/AccessDecisionManagerTest.php index cbb39c4052ca..b416e9577cdc 100644 --- a/src/Symfony/Component/Security/Tests/Core/Authorization/AccessDecisionManagerTest.php +++ b/src/Symfony/Component/Security/Tests/Core/Authorization/AccessDecisionManagerTest.php @@ -145,13 +145,13 @@ public function getStrategyTests() protected function getVoters($grants, $denies, $abstains) { $voters = array(); - for ($i = 0; $i < $grants; $i++) { + for ($i = 0; $i < $grants; ++$i) { $voters[] = $this->getVoter(VoterInterface::ACCESS_GRANTED); } - for ($i = 0; $i < $denies; $i++) { + for ($i = 0; $i < $denies; ++$i) { $voters[] = $this->getVoter(VoterInterface::ACCESS_DENIED); } - for ($i = 0; $i < $abstains; $i++) { + for ($i = 0; $i < $abstains; ++$i) { $voters[] = $this->getVoter(VoterInterface::ACCESS_ABSTAIN); } diff --git a/src/Symfony/Component/Security/Tests/Core/Encoder/BCryptPasswordEncoderTest.php b/src/Symfony/Component/Security/Tests/Core/Encoder/BCryptPasswordEncoderTest.php index 61e2afef18c2..3f8ba8646700 100644 --- a/src/Symfony/Component/Security/Tests/Core/Encoder/BCryptPasswordEncoderTest.php +++ b/src/Symfony/Component/Security/Tests/Core/Encoder/BCryptPasswordEncoderTest.php @@ -40,7 +40,7 @@ public function testCostAboveRange() public function testCostInRange() { - for ($cost = 4; $cost <= 31; $cost++) { + for ($cost = 4; $cost <= 31; ++$cost) { new BCryptPasswordEncoder($cost); } } diff --git a/src/Symfony/Component/Security/Tests/Core/Util/SecureRandomTest.php b/src/Symfony/Component/Security/Tests/Core/Util/SecureRandomTest.php index 316b049166b8..9fd1c163b351 100644 --- a/src/Symfony/Component/Security/Tests/Core/Util/SecureRandomTest.php +++ b/src/Symfony/Component/Security/Tests/Core/Util/SecureRandomTest.php @@ -35,17 +35,17 @@ public function testPoker($secureRandom) { $b = $this->getBitSequence($secureRandom, 20000); $c = array(); - for ($i = 0; $i <= 15; $i++) { + for ($i = 0; $i <= 15; ++$i) { $c[$i] = 0; } - for ($j = 1; $j <= 5000; $j++) { + for ($j = 1; $j <= 5000; ++$j) { $k = 4 * $j - 1; ++$c[8 * $b[$k - 3] + 4 * $b[$k - 2] + 2 * $b[$k - 1] + $b[$k]]; } $f = 0; - for ($i = 0; $i <= 15; $i++) { + for ($i = 0; $i <= 15; ++$i) { $f += $c[$i] * $c[$i]; } @@ -64,7 +64,7 @@ public function testRun($secureRandom) $b = $this->getBitSequence($secureRandom, 20000); $runs = array(); - for ($i = 1; $i <= 6; $i++) { + for ($i = 1; $i <= 6; ++$i) { $runs[$i] = 0; } @@ -78,7 +78,7 @@ public function testRun($secureRandom) $currentRun = 0; $lastBit = null; - for ($i = 0; $i < 20000; $i++) { + for ($i = 0; $i < 20000; ++$i) { if ($lastBit === $b[$i]) { ++$currentRun; } else { @@ -113,7 +113,7 @@ public function testLongRun($secureRandom) $longestRun = $currentRun = 0; $lastBit = null; - for ($i = 0; $i < 20000; $i++) { + for ($i = 0; $i < 20000; ++$i) { if ($lastBit === $b[$i]) { ++$currentRun; } else { @@ -142,7 +142,7 @@ public function testSerialCorrelation($secureRandom) $b = $this->getBitSequence($secureRandom, 20000); $Z = 0; - for ($i = 0; $i < 5000; $i++) { + for ($i = 0; $i < 5000; ++$i) { $Z += $b[$i] === $b[$i + $shift] ? 1 : 0; } diff --git a/src/Symfony/Component/Translation/Loader/MoFileLoader.php b/src/Symfony/Component/Translation/Loader/MoFileLoader.php index 9cab3f0d8da7..728a810b28dc 100644 --- a/src/Symfony/Component/Translation/Loader/MoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/MoFileLoader.php @@ -113,7 +113,7 @@ private function parse($resource) $messages = array(); - for ($i = 0; $i < $count; $i++) { + for ($i = 0; $i < $count; ++$i) { $singularId = $pluralId = null; $translated = null; diff --git a/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php b/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php index 1e8ee704fa95..066e07f5ab3f 100644 --- a/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php +++ b/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php @@ -112,7 +112,7 @@ protected function generateTestData($plural, $langCodes) { $matrix = array(); foreach ($langCodes as $langCode) { - for ($count = 0; $count < 200; $count++) { + for ($count = 0; $count < 200; ++$count) { $plural = PluralizationRules::get($count, $langCode); $matrix[$langCode][$count] = $plural; } diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php b/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php index 59d8ee8b3973..a4d6a6ab474a 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php @@ -27,7 +27,7 @@ public function __construct(array $paths, LoaderInterface $loader) protected function getFileLoaderInstance($file) { - $this->timesCalled++; + ++$this->timesCalled; return $this->loader; } From 139bae7047f5045f9e5f684ca0d1166d5af96949 Mon Sep 17 00:00:00 2001 From: Diego Saint Esteben Date: Mon, 11 May 2015 23:26:17 -0300 Subject: [PATCH 02/11] Fix tests in HHVM --- .../Authentication/DefaultAuthenticationFailureHandlerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Tests/Http/Authentication/DefaultAuthenticationFailureHandlerTest.php b/src/Symfony/Component/Security/Tests/Http/Authentication/DefaultAuthenticationFailureHandlerTest.php index accc45d82b25..38072d6fc6f7 100644 --- a/src/Symfony/Component/Security/Tests/Http/Authentication/DefaultAuthenticationFailureHandlerTest.php +++ b/src/Symfony/Component/Security/Tests/Http/Authentication/DefaultAuthenticationFailureHandlerTest.php @@ -38,7 +38,7 @@ protected function setUp() $this->session = $this->getMock('Symfony\Component\HttpFoundation\Session\SessionInterface'); $this->request = $this->getMock('Symfony\Component\HttpFoundation\Request'); $this->request->expects($this->any())->method('getSession')->will($this->returnValue($this->session)); - $this->exception = $this->getMock('Symfony\Component\Security\Core\Exception\AuthenticationException'); + $this->exception = $this->getMock('Symfony\Component\Security\Core\Exception\AuthenticationException', array('getMessage')); } public function testForward() From e56a619efbc1cc70de21108156f7bea1024e198c Mon Sep 17 00:00:00 2001 From: ogizanagi Date: Fri, 8 May 2015 19:52:59 +0200 Subject: [PATCH 03/11] [FrameworkBundle] Applied new styles to the config:debug & config:dump-reference commands --- .../Command/AbstractConfigCommand.php | 24 +++++++++---------- .../Command/ConfigDebugCommand.php | 4 +++- .../Command/ConfigDumpReferenceCommand.php | 2 ++ .../Bundle/FrameworkBundle/composer.json | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php index ff2b515a94f9..aee0eb1f00d8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php @@ -14,6 +14,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\StyleInterface; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; /** @@ -27,24 +28,21 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand { protected function listBundles(OutputInterface $output) { - $output->writeln('Available registered bundles with their extension alias if available:'); - - if (class_exists('Symfony\Component\Console\Helper\Table')) { - $table = new Table($output); - } else { - $table = $this->getHelperSet()->get('table'); - } - - $table->setHeaders(array('Bundle name', 'Extension alias')); + $headers = array('Bundle name', 'Extension alias'); + $rows = array(); foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) { $extension = $bundle->getContainerExtension(); - $table->addRow(array($bundle->getName(), $extension ? $extension->getAlias() : '')); + $rows[] = array($bundle->getName(), $extension ? $extension->getAlias() : ''); } - if (class_exists('Symfony\Component\Console\Helper\Table')) { - $table->render(); + $message = 'Available registered bundles with their extension alias if available:'; + if ($output instanceof StyleInterface) { + $output->writeln(' '.$message); + $output->table($headers, $rows); } else { - $table->render($output); + $output->writeln($message); + $table = new Table($output); + $table->setHeaders($headers)->setRows($rows)->render($output); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php index e34b5eb09524..67ab40e0e911 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php @@ -15,6 +15,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Yaml\Yaml; /** @@ -57,8 +58,9 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { + $output = new SymfonyStyle($input, $output); if (false !== strpos($input->getFirstArgument(), ':d')) { - $output->writeln('The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.'); + $output->caution('The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.'); } $name = $input->getArgument('name'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php index 98dc9109ccf7..c28ff22004ea 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php @@ -17,6 +17,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; /** * A console command for dumping available configuration reference. @@ -66,6 +67,7 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { + $output = new SymfonyStyle($input, $output); $name = $input->getArgument('name'); if (empty($name)) { diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 84c380085b11..d56a84ed1d5f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -35,7 +35,7 @@ "require-dev": { "symfony/phpunit-bridge": "~2.7", "symfony/browser-kit": "~2.4", - "symfony/console": "~2.6", + "symfony/console": "~2.7", "symfony/css-selector": "~2.0,>=2.0.5", "symfony/dom-crawler": "~2.0,>=2.0.5", "symfony/finder": "~2.0,>=2.0.5", From 8cb2abbd269574caa1cd76b73c8efdcd6cc470b2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 13 May 2015 12:14:36 +0200 Subject: [PATCH 04/11] [DebugBundle] Always collect dumps --- .../HttpKernel/DataCollector/DumpDataCollector.php | 14 +++++--------- .../Tests/DataCollector/DumpDataCollectorTest.php | 4 ++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 0327a46f7170..c4101e2d6291 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -123,11 +123,11 @@ public function dump(Data $data) if ($this->dumper) { $this->doDump($data, $name, $file, $line); - } else { - $this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt'); - ++$this->dataCount; } + $this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt'); + ++$this->dataCount; + if ($this->stopwatch) { $this->stopwatch->stop('dump'); } @@ -136,7 +136,7 @@ public function dump(Data $data) public function collect(Request $request, Response $response, \Exception $exception = null) { // Sub-requests and programmatic calls stay in the collected profile. - if (($this->requestStack && $this->requestStack->getMasterRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) { + if ($this->dumper || ($this->requestStack && $this->requestStack->getMasterRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) { return; } @@ -154,13 +154,9 @@ public function collect(Request $request, Response $response, \Exception $except $this->dumper = new CliDumper('php://output', $this->charset); } - foreach ($this->data as $i => $dump) { - $this->data[$i] = null; + foreach ($this->data as $dump) { $this->doDump($dump['data'], $dump['name'], $dump['file'], $dump['line']); } - - $this->data = array(); - $this->dataCount = 0; } } diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php index 7d19cb01b1d8..5869c72500d5 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php @@ -72,6 +72,8 @@ public function testCollectDefault() $output = ob_get_clean(); $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output); + $this->assertSame(1, $collector->getDumpsCount()); + $collector->serialize(); } public function testCollectHtml() @@ -99,6 +101,8 @@ public function testCollectHtml() $output = preg_replace('/sf-dump-\d+/', 'sf-dump', $output); $this->assertSame($xOutput, $output); + $this->assertSame(1, $collector->getDumpsCount()); + $collector->serialize(); } public function testFlush() From 5368483d9a4a0655afdb1169cd6655f3b1d76172 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 14 May 2015 09:57:59 +0200 Subject: [PATCH 05/11] [DebugBundle] Use output mechanism of dumpers instead of echoing --- .../DataCollector/DumpDataCollector.php | 35 +++++++++++++------ .../DataCollector/DumpDataCollectorTest.php | 27 +++++++++++--- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index c4101e2d6291..74faed19ee46 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -246,20 +246,33 @@ public function __destruct() private function doDump($data, $name, $file, $line) { - if ($this->dumper instanceof HtmlDumper) { - $name = $this->htmlEncode($name); - $file = $this->htmlEncode($file); - if ('' !== $file) { - if ($this->fileLinkFormat) { - $link = strtr($this->fileLinkFormat, array('%f' => $file, '%l' => $line)); - $name = sprintf('%s', $link, $file, $name); + if (PHP_VERSION_ID >= 50400 && $this->dumper instanceof CliDumper) { + $contextDumper = function ($name, $file, $line, $fileLinkFormat) { + if ($this instanceof HtmlDumper) { + if ('' !== $file) { + $s = $this->style('meta', '%s'); + $name = strip_tags($this->style('', $name)); + $file = strip_tags($this->style('', $file)); + if ($fileLinkFormat) { + $link = strtr($fileLinkFormat, array('%f' => $file, '%l' => (int) $line)); + $name = sprintf(''.$s.'', $link, $file, $name); + } else { + $name = sprintf(''.$s.'', $file, $name); + } + } else { + $name = $this->style('meta', $name); + } + $this->line = $name.' on line '.$this->style('meta', $line).':'; } else { - $name = sprintf('%s', $file, $name); + $this->line = $this->style('meta', $name).' on line '.$this->style('meta', $line).':'; } - } - echo "\n{$name} on line {$line}:"; + $this->dumpLine(0); + }; + $contextDumper = $contextDumper->bindTo($this->dumper, $this->dumper); + $contextDumper($name, $file, $line, $this->fileLinkFormat); } else { - echo "{$name} on line {$line}:\n"; + $cloner = new VarCloner(); + $this->dumper->dump($cloner->cloneVar($name.' on line '.$line.':')); } $this->dumper->dump($data); } diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php index 5869c72500d5..e9b8433c46ef 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php @@ -71,7 +71,11 @@ public function testCollectDefault() $collector->collect(new Request(), new Response()); $output = ob_get_clean(); - $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output); + if (PHP_VERSION_ID >= 50400) { + $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output); + } else { + $this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n123\n", $output); + } $this->assertSame(1, $collector->getDumpsCount()); $collector->serialize(); } @@ -85,12 +89,23 @@ public function testCollectHtml() $collector->dump($data); $line = __LINE__ - 1; $file = __FILE__; - $xOutput = <<= 50400) { + $xOutput = <<DumpDataCollectorTest.php on line {$line}: +123 + -DumpDataCollectorTest.php on line {$line}:
123
+EOTXT;
+        } else {
+            $len = strlen("DumpDataCollectorTest.php on line {$line}:");
+            $xOutput = <<"DumpDataCollectorTest.php on line {$line}:"
+
+
123
 
EOTXT; + } ob_start(); $response = new Response(); @@ -114,6 +129,10 @@ public function testFlush() ob_start(); $collector = null; - $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean()); + if (PHP_VERSION_ID >= 50400) { + $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean()); + } else { + $this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", ob_get_clean()); + } } } From 5f255e505936824edacdcbe6d4268848b0e54bad Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 14 May 2015 15:58:04 +0200 Subject: [PATCH 06/11] [DebugBundle] Allow alternative destination for dumps --- src/Symfony/Bundle/DebugBundle/DebugBundle.php | 3 +-- .../DebugBundle/DependencyInjection/Configuration.php | 5 +++++ .../DebugBundle/DependencyInjection/DebugExtension.php | 10 ++++++++++ .../Bundle/DebugBundle/Resources/config/services.xml | 5 +++++ .../HttpKernel/DataCollector/DumpDataCollector.php | 9 +++++++-- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/DebugBundle/DebugBundle.php b/src/Symfony/Bundle/DebugBundle/DebugBundle.php index fdd7724dfc1d..3aa536dba786 100644 --- a/src/Symfony/Bundle/DebugBundle/DebugBundle.php +++ b/src/Symfony/Bundle/DebugBundle/DebugBundle.php @@ -14,7 +14,6 @@ use Symfony\Bundle\DebugBundle\DependencyInjection\Compiler\DumpDataCollectorPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; -use Symfony\Component\VarDumper\Dumper\CliDumper; use Symfony\Component\VarDumper\VarDumper; /** @@ -31,7 +30,7 @@ public function boot() // configuration for CLI mode is overridden in HTTP mode on // 'kernel.request' event VarDumper::setHandler(function ($var) use ($container) { - $dumper = new CliDumper(); + $dumper = $container->get('var_dumper.cli_dumper'); $cloner = $container->get('var_dumper.cloner'); $handler = function ($var) use ($dumper, $cloner) { $dumper->dump($cloner->cloneVar($var)); diff --git a/src/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php index 52cdfa94fe76..5761e62a72e1 100644 --- a/src/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/DebugBundle/DependencyInjection/Configuration.php @@ -41,6 +41,11 @@ public function getConfigTreeBuilder() ->min(-1) ->defaultValue(-1) ->end() + ->scalarNode('dump_destination') + ->info('A stream URL where dumps should be written to') + ->example('php://stderr') + ->defaultNull() + ->end() ->end() ; diff --git a/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php b/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php index d5c4fd93d1fa..4e5351c0e0cd 100644 --- a/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php +++ b/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php @@ -14,6 +14,7 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\DependencyInjection\Extension; /** @@ -37,6 +38,15 @@ public function load(array $configs, ContainerBuilder $container) $container->getDefinition('var_dumper.cloner') ->addMethodCall('setMaxItems', array($config['max_items'])) ->addMethodCall('setMaxString', array($config['max_string_length'])); + + if (null !== $config['dump_destination']) { + $container->getDefinition('var_dumper.cli_dumper') + ->replaceArgument(0, $config['dump_destination']) + ; + $container->getDefinition('data_collector.dump') + ->replaceArgument(4, new Reference('var_dumper.cli_dumper')) + ; + } } /** diff --git a/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml b/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml index 7de182861b43..16e27a22c584 100644 --- a/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml +++ b/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml @@ -16,6 +16,7 @@ null %kernel.charset% + null @@ -25,6 +26,10 @@ + + null + %kernel.charset% + diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 74faed19ee46..32b99e562c5a 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -35,13 +35,16 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface private $rootRefs; private $charset; private $dumper; + private $dumperIsInjected; - public function __construct(Stopwatch $stopwatch = null, $fileLinkFormat = null, $charset = null, RequestStack $requestStack = null) + public function __construct(Stopwatch $stopwatch = null, $fileLinkFormat = null, $charset = null, RequestStack $requestStack = null, DataDumperInterface $dumper = null) { $this->stopwatch = $stopwatch; $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); $this->charset = $charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8'; $this->requestStack = $requestStack; + $this->dumper = $dumper; + $this->dumperIsInjected = null !== $dumper; // All clones share these properties by reference: $this->rootRefs = array( @@ -170,7 +173,9 @@ public function serialize() $this->data = array(); $this->dataCount = 0; $this->isCollected = true; - $this->dumper = null; + if (!$this->dumperIsInjected) { + $this->dumper = null; + } return $ser; } From a3fc6b9fa9bb12234787e445ca6d2db0c5f29db7 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 15 May 2015 12:05:21 +0200 Subject: [PATCH 07/11] [Validator] Deprecated PHP7-incompatible constraints and related validators --- UPGRADE-2.7.md | 6 ++++++ src/Symfony/Component/Validator/CHANGELOG.md | 1 + src/Symfony/Component/Validator/Constraints/False.php | 4 +++- .../Component/Validator/Constraints/FalseValidator.php | 4 +++- src/Symfony/Component/Validator/Constraints/Null.php | 4 +++- .../Component/Validator/Constraints/NullValidator.php | 4 +++- src/Symfony/Component/Validator/Constraints/True.php | 4 +++- .../Component/Validator/Constraints/TrueValidator.php | 4 +++- 8 files changed, 25 insertions(+), 6 deletions(-) diff --git a/UPGRADE-2.7.md b/UPGRADE-2.7.md index f491c7d471ba..7d532cf3227a 100644 --- a/UPGRADE-2.7.md +++ b/UPGRADE-2.7.md @@ -528,3 +528,9 @@ Config * The `__toString()` method of the `\Symfony\Component\Config\ConfigCache` is marked as deprecated in favor of the new `getPath()` method. +Validator +--------- + + * The PHP7-incompatible constraints (Null, True, False) and related validators + (NullValidator, TrueValidator, FalseValidator) are marked as deprecated + in favor of their `Is`-prefixed equivalent. diff --git a/src/Symfony/Component/Validator/CHANGELOG.md b/src/Symfony/Component/Validator/CHANGELOG.md index db442250588d..4531286fdbcb 100644 --- a/src/Symfony/Component/Validator/CHANGELOG.md +++ b/src/Symfony/Component/Validator/CHANGELOG.md @@ -5,6 +5,7 @@ CHANGELOG ----- * deprecated `DefaultTranslator` in favor of `Symfony\Component\Translation\IdentityTranslator` + * deprecated PHP7-incompatible constraints (Null, True, False) and related validators (NullValidator, TrueValidator, FalseValidator) in favor of their `Is`-prefixed equivalent 2.6.0 ----- diff --git a/src/Symfony/Component/Validator/Constraints/False.php b/src/Symfony/Component/Validator/Constraints/False.php index 6ec76ee3d181..9e9f6ed3d2b6 100644 --- a/src/Symfony/Component/Validator/Constraints/False.php +++ b/src/Symfony/Component/Validator/Constraints/False.php @@ -11,12 +11,14 @@ namespace Symfony\Component\Validator\Constraints; +trigger_error('The '.__NAMESPACE__.'\False class is deprecated since version 2.7 and will be removed in 3.0. Use the IsFalse class in the same namespace instead.', E_USER_DEPRECATED); + /** * @Annotation * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) * * @author Bernhard Schussek * - * @api + * @deprecated since version 2.7, to be removed in 3.0. Use IsFalse instead. */ class False extends IsFalse {} diff --git a/src/Symfony/Component/Validator/Constraints/FalseValidator.php b/src/Symfony/Component/Validator/Constraints/FalseValidator.php index 72fd1d44d1bb..534400e9c6ac 100644 --- a/src/Symfony/Component/Validator/Constraints/FalseValidator.php +++ b/src/Symfony/Component/Validator/Constraints/FalseValidator.php @@ -11,9 +11,11 @@ namespace Symfony\Component\Validator\Constraints; +trigger_error('The '.__NAMESPACE__.'\FalseValidator class is deprecated since version 2.7 and will be removed in 3.0. Use the IsFalseValidator class in the same namespace instead.', E_USER_DEPRECATED); + /** * @author Bernhard Schussek * - * @api + * @deprecated since version 2.7, to be removed in 3.0. Use IsFalseValidator instead. */ class FalseValidator extends IsFalseValidator {} diff --git a/src/Symfony/Component/Validator/Constraints/Null.php b/src/Symfony/Component/Validator/Constraints/Null.php index 5ad789cef85d..1031b482cd8f 100644 --- a/src/Symfony/Component/Validator/Constraints/Null.php +++ b/src/Symfony/Component/Validator/Constraints/Null.php @@ -11,12 +11,14 @@ namespace Symfony\Component\Validator\Constraints; +trigger_error('The '.__NAMESPACE__.'\Null class is deprecated since version 2.7 and will be removed in 3.0. Use the IsNull class in the same namespace instead.', E_USER_DEPRECATED); + /** * @Annotation * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) * * @author Bernhard Schussek * - * @api + * @deprecated since version 2.7, to be removed in 3.0. Use IsNull instead. */ class Null extends IsNull {} diff --git a/src/Symfony/Component/Validator/Constraints/NullValidator.php b/src/Symfony/Component/Validator/Constraints/NullValidator.php index 876924f37542..721c95148fe2 100644 --- a/src/Symfony/Component/Validator/Constraints/NullValidator.php +++ b/src/Symfony/Component/Validator/Constraints/NullValidator.php @@ -11,9 +11,11 @@ namespace Symfony\Component\Validator\Constraints; +trigger_error('The '.__NAMESPACE__.'\NullValidator class is deprecated since version 2.7 and will be removed in 3.0. Use the IsNullValidator class in the same namespace instead.', E_USER_DEPRECATED); + /** * @author Bernhard Schussek * - * @api + * @deprecated since version 2.7, to be removed in 3.0. Use IsNullValidator instead. */ class NullValidator extends IsNullValidator {} diff --git a/src/Symfony/Component/Validator/Constraints/True.php b/src/Symfony/Component/Validator/Constraints/True.php index 832b84b92bd2..f09b084119af 100644 --- a/src/Symfony/Component/Validator/Constraints/True.php +++ b/src/Symfony/Component/Validator/Constraints/True.php @@ -11,12 +11,14 @@ namespace Symfony\Component\Validator\Constraints; +trigger_error('The '.__NAMESPACE__.'\True class is deprecated since version 2.7 and will be removed in 3.0. Use the IsTrue class in the same namespace instead.', E_USER_DEPRECATED); + /** * @Annotation * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) * * @author Bernhard Schussek * - * @api + * @deprecated since version 2.7, to be removed in 3.0. Use IsTrue instead. */ class True extends IsTrue {} diff --git a/src/Symfony/Component/Validator/Constraints/TrueValidator.php b/src/Symfony/Component/Validator/Constraints/TrueValidator.php index fb0b7d6cdd85..5d17bdba35d0 100644 --- a/src/Symfony/Component/Validator/Constraints/TrueValidator.php +++ b/src/Symfony/Component/Validator/Constraints/TrueValidator.php @@ -11,9 +11,11 @@ namespace Symfony\Component\Validator\Constraints; +trigger_error('The '.__NAMESPACE__.'\TrueValidator class is deprecated since version 2.7 and will be removed in 3.0. Use the IsTrueValidator class in the same namespace instead.', E_USER_DEPRECATED); + /** * @author Bernhard Schussek * - * @api + * @deprecated since version 2.7, to be removed in 3.0. Use IsTrueValidator instead. */ class TrueValidator extends IsTrueValidator {} From 700fcf187106009b0b9bd2e604b9761de3bfc0da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Fri, 15 May 2015 15:29:11 +0200 Subject: [PATCH 08/11] Fix WebProfilerBundle compatiblity with HttpKernel < 2.7 --- .../Resources/views/Collector/config.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig index eed04dfbd6fa..d25122b90bf2 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig @@ -8,7 +8,7 @@ {% if collector.applicationname %} {{ collector.applicationname }} {{ collector.applicationversion }} - {% else %} + {% elseif collector.symfonyState is defined %} {% if 'unknown' == collector.symfonyState -%} {%- elseif 'eol' == collector.symfonyState -%} From 34d83a70b371f98fb61d35492d599722dcc1809b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 15 May 2015 15:45:10 +0200 Subject: [PATCH 09/11] fixed CS --- src/Symfony/Component/Console/Application.php | 12 ++++++------ .../Component/Validator/Constraints/False.php | 4 +++- .../Validator/Constraints/FalseValidator.php | 4 +++- src/Symfony/Component/Validator/Constraints/Null.php | 4 +++- .../Validator/Constraints/NullValidator.php | 4 +++- src/Symfony/Component/Validator/Constraints/True.php | 4 +++- .../Validator/Constraints/TrueValidator.php | 4 +++- 7 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index b4c710901298..badcce6473c1 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -936,12 +936,12 @@ protected function getDefaultInputDefinition() return new InputDefinition(array( new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'), - new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'), - new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'), - new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'), - new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'), - new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'), + new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'), + new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'), + new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'), + new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'), + new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'), + new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'), new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'), )); } diff --git a/src/Symfony/Component/Validator/Constraints/False.php b/src/Symfony/Component/Validator/Constraints/False.php index 6ec76ee3d181..b377c3255ea7 100644 --- a/src/Symfony/Component/Validator/Constraints/False.php +++ b/src/Symfony/Component/Validator/Constraints/False.php @@ -19,4 +19,6 @@ * * @api */ -class False extends IsFalse {} +class False extends IsFalse +{ +} diff --git a/src/Symfony/Component/Validator/Constraints/FalseValidator.php b/src/Symfony/Component/Validator/Constraints/FalseValidator.php index 72fd1d44d1bb..140945f76e2d 100644 --- a/src/Symfony/Component/Validator/Constraints/FalseValidator.php +++ b/src/Symfony/Component/Validator/Constraints/FalseValidator.php @@ -16,4 +16,6 @@ * * @api */ -class FalseValidator extends IsFalseValidator {} +class FalseValidator extends IsFalseValidator +{ +} diff --git a/src/Symfony/Component/Validator/Constraints/Null.php b/src/Symfony/Component/Validator/Constraints/Null.php index 5ad789cef85d..2be06df0bb89 100644 --- a/src/Symfony/Component/Validator/Constraints/Null.php +++ b/src/Symfony/Component/Validator/Constraints/Null.php @@ -19,4 +19,6 @@ * * @api */ -class Null extends IsNull {} +class Null extends IsNull +{ +} diff --git a/src/Symfony/Component/Validator/Constraints/NullValidator.php b/src/Symfony/Component/Validator/Constraints/NullValidator.php index 876924f37542..9b165eaa80d3 100644 --- a/src/Symfony/Component/Validator/Constraints/NullValidator.php +++ b/src/Symfony/Component/Validator/Constraints/NullValidator.php @@ -16,4 +16,6 @@ * * @api */ -class NullValidator extends IsNullValidator {} +class NullValidator extends IsNullValidator +{ +} diff --git a/src/Symfony/Component/Validator/Constraints/True.php b/src/Symfony/Component/Validator/Constraints/True.php index 832b84b92bd2..626f6d857150 100644 --- a/src/Symfony/Component/Validator/Constraints/True.php +++ b/src/Symfony/Component/Validator/Constraints/True.php @@ -19,4 +19,6 @@ * * @api */ -class True extends IsTrue {} +class True extends IsTrue +{ +} diff --git a/src/Symfony/Component/Validator/Constraints/TrueValidator.php b/src/Symfony/Component/Validator/Constraints/TrueValidator.php index fb0b7d6cdd85..7ab44ca3c36f 100644 --- a/src/Symfony/Component/Validator/Constraints/TrueValidator.php +++ b/src/Symfony/Component/Validator/Constraints/TrueValidator.php @@ -16,4 +16,6 @@ * * @api */ -class TrueValidator extends IsTrueValidator {} +class TrueValidator extends IsTrueValidator +{ +} From 0678b3e6f87ddcdcf41ec580d4625fca5c9cbc22 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 15 May 2015 15:53:19 +0200 Subject: [PATCH 10/11] fixed CS --- .../DebugBundle/DependencyInjection/DebugExtension.php | 2 +- .../Bundle/FrameworkBundle/Command/RouterDebugCommand.php | 2 +- .../FrameworkBundle/Console/Helper/DescriptorHelper.php | 6 +++--- .../Provider/PreAuthenticatedAuthenticationProvider.php | 2 +- .../Constraints/LegacyUserPasswordValidatorTest.php | 2 +- .../Security/Http/Tests/Firewall/RememberMeListenerTest.php | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php b/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php index 4e5351c0e0cd..a6169889c4a7 100644 --- a/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php +++ b/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php @@ -36,7 +36,7 @@ public function load(array $configs, ContainerBuilder $container) $loader->load('services.xml'); $container->getDefinition('var_dumper.cloner') - ->addMethodCall('setMaxItems', array($config['max_items'])) + ->addMethodCall('setMaxItems', array($config['max_items'])) ->addMethodCall('setMaxString', array($config['max_string_length'])); if (null !== $config['dump_destination']) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php index 8901522e1c0b..ef8e8b6a901d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php @@ -55,7 +55,7 @@ protected function configure() )) ->setDefinition(array( new InputArgument('name', InputArgument::OPTIONAL, 'A route name'), - new InputOption('show-controllers', null, InputOption::VALUE_NONE, 'Show assigned controllers in overview'), + new InputOption('show-controllers', null, InputOption::VALUE_NONE, 'Show assigned controllers in overview'), new InputOption('format', null, InputOption::VALUE_REQUIRED, 'To output route(s) in other formats', 'txt'), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw route(s)'), )) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Helper/DescriptorHelper.php b/src/Symfony/Bundle/FrameworkBundle/Console/Helper/DescriptorHelper.php index 8d46ae16241b..2599f0090e5d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Helper/DescriptorHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Helper/DescriptorHelper.php @@ -30,10 +30,10 @@ class DescriptorHelper extends BaseDescriptorHelper public function __construct() { $this - ->register('txt', new TextDescriptor()) - ->register('xml', new XmlDescriptor()) + ->register('txt', new TextDescriptor()) + ->register('xml', new XmlDescriptor()) ->register('json', new JsonDescriptor()) - ->register('md', new MarkdownDescriptor()) + ->register('md', new MarkdownDescriptor()) ; } } diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php b/src/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php index c17a9545a0c9..4f732542ea94 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php +++ b/src/Symfony/Component/Security/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php @@ -60,7 +60,7 @@ public function authenticate(TokenInterface $token) throw new BadCredentialsException('No pre-authenticated principal found in request.'); } - $user = $this->userProvider->loadUserByUsername($user); + $user = $this->userProvider->loadUserByUsername($user); $this->userChecker->checkPostAuth($user); diff --git a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/LegacyUserPasswordValidatorTest.php b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/LegacyUserPasswordValidatorTest.php index 54258e34ca3e..72e08c0a73d8 100644 --- a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/LegacyUserPasswordValidatorTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/LegacyUserPasswordValidatorTest.php @@ -18,7 +18,7 @@ * @author Bernhard Schussek * @group legacy */ -class LegacyUserPasswordValidatorApiTest extends UserPasswordValidatorTest +class LegacyUserPasswordValidatorTest extends UserPasswordValidatorTest { protected function getApiVersion() { diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php index 12ced6bf1287..3f43fb233715 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php @@ -106,7 +106,7 @@ public function testOnCoreSecurityIgnoresAuthenticationExceptionThrownByAuthenti */ public function testOnCoreSecurityIgnoresAuthenticationOptionallyRethrowsExceptionThrownAuthenticationManagerImplementation() { - list($listener, $context, $service, $manager,) = $this->getListener(false, false); + list($listener, $context, $service, $manager) = $this->getListener(false, false); $context ->expects($this->once()) From d883ba098418bb974c86a12c3c2bf72981bfb02f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 15 May 2015 16:02:48 +0200 Subject: [PATCH 11/11] fixed CS --- .../Helper/{AssetsHelper.php => AssetsHelperTest.php} | 0 src/Symfony/Component/Finder/Tests/GlobTest.php | 1 - src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php | 2 +- src/Symfony/Component/Validator/Constraints/IpValidator.php | 1 - .../Component/Validator/Constraints/UuidValidator.php | 6 +++--- 5 files changed, 4 insertions(+), 6 deletions(-) rename src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/{AssetsHelper.php => AssetsHelperTest.php} (100%) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelper.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelper.php rename to src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php diff --git a/src/Symfony/Component/Finder/Tests/GlobTest.php b/src/Symfony/Component/Finder/Tests/GlobTest.php index 22ee37338980..24cad96e05e0 100755 --- a/src/Symfony/Component/Finder/Tests/GlobTest.php +++ b/src/Symfony/Component/Finder/Tests/GlobTest.php @@ -22,5 +22,4 @@ public function testGlobToRegexDelimiters() $this->assertEquals(Glob::toRegex('.*', true, true, ''), '^\.[^/]*$'); $this->assertEquals(Glob::toRegex('.*', true, true, '/'), '/^\.[^/]*$/'); } - } diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php index 15aed67f6dd9..97e68f66f979 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php @@ -66,7 +66,7 @@ public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithANonH // should set a response, but does not }); - $kernel = new HttpKernel($dispatcher, $this->getResolver(function () use($exception) { throw $exception; })); + $kernel = new HttpKernel($dispatcher, $this->getResolver(function () use ($exception) { throw $exception; })); try { $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true); diff --git a/src/Symfony/Component/Validator/Constraints/IpValidator.php b/src/Symfony/Component/Validator/Constraints/IpValidator.php index 15e5720de2e7..8ec8068e79d5 100644 --- a/src/Symfony/Component/Validator/Constraints/IpValidator.php +++ b/src/Symfony/Component/Validator/Constraints/IpValidator.php @@ -108,4 +108,3 @@ public function validate($value, Constraint $constraint) } } } - diff --git a/src/Symfony/Component/Validator/Constraints/UuidValidator.php b/src/Symfony/Component/Validator/Constraints/UuidValidator.php index d64e6a49a57b..08f9e27b736c 100644 --- a/src/Symfony/Component/Validator/Constraints/UuidValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UuidValidator.php @@ -238,15 +238,15 @@ private function validateStrict($value, Uuid $constraint) ) ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) ->addViolation(); - } else { - $this->buildViolation($constraint->message) + } else { + $this->buildViolation($constraint->message) ->setParameter( '{{ value }}', $this->formatValue($value) ) ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) ->addViolation(); - } + } return; }