From 45d250d25f76615066c49449a134c91d30a3e92f Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Tue, 1 Dec 2015 12:58:24 +0100 Subject: [PATCH 1/4] CS: remove unneeded parentheses around control statements --- .../Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php | 2 +- src/Symfony/Component/Filesystem/Filesystem.php | 4 ++-- src/Symfony/Component/Finder/Iterator/SortableIterator.php | 6 +++--- .../HttpFoundation/Session/Storage/Proxy/AbstractProxy.php | 2 +- .../Intl/DateFormatter/DateFormat/FullTransformer.php | 2 +- .../Serializer/Normalizer/GetSetMethodNormalizer.php | 4 ++-- src/Symfony/Component/Yaml/Parser.php | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php index 30263ea7e3..6f688a904e 100644 --- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php +++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php @@ -76,7 +76,7 @@ class ORMQueryBuilderLoader implements EntityLoaderInterface */ public function getEntitiesByIds($identifier, array $values) { - $qb = clone ($this->queryBuilder); + $qb = clone $this->queryBuilder; $alias = current($qb->getRootAliases()); $parameter = 'ORMQueryBuilderLoader_getEntitiesByIds_'.$identifier; $where = $qb->expr()->in($alias.'.'.$identifier, ':'.$parameter); diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 6fc9b8b5f7..1b6eaa68cd 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -428,13 +428,13 @@ class Filesystem */ public function isAbsolutePath($file) { - return (strspn($file, '/\\', 0, 1) + return strspn($file, '/\\', 0, 1) || (strlen($file) > 3 && ctype_alpha($file[0]) && substr($file, 1, 1) === ':' && (strspn($file, '/\\', 2, 1)) ) || null !== parse_url($file, PHP_URL_SCHEME) - ); + ; } /** diff --git a/src/Symfony/Component/Finder/Iterator/SortableIterator.php b/src/Symfony/Component/Finder/Iterator/SortableIterator.php index b32ac8d6df..fa3458077a 100644 --- a/src/Symfony/Component/Finder/Iterator/SortableIterator.php +++ b/src/Symfony/Component/Finder/Iterator/SortableIterator.php @@ -55,15 +55,15 @@ class SortableIterator implements \IteratorAggregate }; } elseif (self::SORT_BY_ACCESSED_TIME === $sort) { $this->sort = function ($a, $b) { - return ($a->getATime() - $b->getATime()); + return $a->getATime() - $b->getATime(); }; } elseif (self::SORT_BY_CHANGED_TIME === $sort) { $this->sort = function ($a, $b) { - return ($a->getCTime() - $b->getCTime()); + return $a->getCTime() - $b->getCTime(); }; } elseif (self::SORT_BY_MODIFIED_TIME === $sort) { $this->sort = function ($a, $b) { - return ($a->getMTime() - $b->getMTime()); + return $a->getMTime() - $b->getMTime(); }; } elseif (is_callable($sort)) { $this->sort = $sort; diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index 1036818277..463677b55a 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -52,7 +52,7 @@ abstract class AbstractProxy */ public function isSessionHandlerInterface() { - return ($this instanceof \SessionHandlerInterface); + return $this instanceof \SessionHandlerInterface; } /** diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php index 3c3410e879..84d5179e57 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/FullTransformer.php @@ -214,7 +214,7 @@ class FullTransformer */ public function isQuoteMatch($quoteMatch) { - return ("'" === $quoteMatch[0]); + return "'" === $quoteMatch[0]; } /** diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php index 4adca3fe59..f4a8fb7279 100644 --- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php @@ -242,10 +242,10 @@ class GetSetMethodNormalizer extends SerializerAwareNormalizer implements Normal */ private function isGetMethod(\ReflectionMethod $method) { - return ( + return 0 === strpos($method->name, 'get') && 3 < strlen($method->name) && 0 === $method->getNumberOfRequiredParameters() - ); + ; } } diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 94a1628afa..614bfedce5 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -670,6 +670,6 @@ class Parser */ private function isStringUnIndentedCollectionItem() { - return (0 === strpos($this->currentLine, '- ')); + return 0 === strpos($this->currentLine, '- '); } } From 230acb28417373b405b1aa534b88516b14a8f213 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 3 Dec 2015 06:49:53 +0100 Subject: [PATCH 2/4] Fix typo --- src/Symfony/Component/HttpFoundation/Response.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 914e54fbb3..a21e6b921c 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -929,7 +929,7 @@ class Response * Sets the Vary header. * * @param string|array $headers - * @param bool $replace Whether to replace the actual value of not (true by default) + * @param bool $replace Whether to replace the actual value or not (true by default) * * @return Response */ From 9195cd3e44489a088094e6acbf04acae6f68cdc8 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Wed, 2 Dec 2015 10:46:45 +0100 Subject: [PATCH 3/4] Improve error message for undefined DIC aliases --- .../Compiler/ReplaceAliasByActualDefinitionPass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php index 972d708c59..8308937d4a 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php @@ -45,7 +45,7 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface try { $definition = $container->getDefinition($aliasId); } catch (InvalidArgumentException $e) { - throw new InvalidArgumentException(sprintf('Unable to replace alias "%s" with "%s".', $alias, $id), null, $e); + throw new InvalidArgumentException(sprintf('Unable to replace alias "%s" with actual definition "%s".', $id, $alias), null, $e); } if ($definition->isPublic()) { From ec93b9a7f722b57f86912fd317aab3c2c9027d9e Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Wed, 2 Dec 2015 10:09:02 +0100 Subject: [PATCH 4/4] [Process] Unset callback after stop to free memory --- src/Symfony/Component/Process/Process.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 676cddc67e..a743e21e34 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -1136,6 +1136,11 @@ class Process $this->exitcode = 128 + $this->processInformation['termsig']; } + // Free memory from self-reference callback created by buildCallback + // Doing so in other contexts like __destruct or by garbage collector is ineffective + // Now pipes are closed, so the callback is no longer necessary + $this->callback = null; + return $this->exitcode; }