Merge branch '2.3' into 2.7

* 2.3:
  [Process] Unset callback after stop to free memory
  Improve error message for undefined DIC aliases
  Fix typo
  CS: remove unneeded parentheses around control statements
This commit is contained in:
Christophe Coevoet 2015-12-05 12:06:38 +01:00
commit 0bbbb01fbe
9 changed files with 16 additions and 11 deletions

View File

@ -89,7 +89,7 @@ class ORMQueryBuilderLoader implements EntityLoaderInterface
*/ */
public function getEntitiesByIds($identifier, array $values) public function getEntitiesByIds($identifier, array $values)
{ {
$qb = clone ($this->queryBuilder); $qb = clone $this->queryBuilder;
$alias = current($qb->getRootAliases()); $alias = current($qb->getRootAliases());
$parameter = 'ORMQueryBuilderLoader_getEntitiesByIds_'.$identifier; $parameter = 'ORMQueryBuilderLoader_getEntitiesByIds_'.$identifier;
$where = $qb->expr()->in($alias.'.'.$identifier, ':'.$parameter); $where = $qb->expr()->in($alias.'.'.$identifier, ':'.$parameter);

View File

@ -45,7 +45,7 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface
try { try {
$definition = $container->getDefinition($aliasId); $definition = $container->getDefinition($aliasId);
} catch (InvalidArgumentException $e) { } 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()) { if ($definition->isPublic()) {

View File

@ -443,13 +443,13 @@ class Filesystem
*/ */
public function isAbsolutePath($file) public function isAbsolutePath($file)
{ {
return (strspn($file, '/\\', 0, 1) return strspn($file, '/\\', 0, 1)
|| (strlen($file) > 3 && ctype_alpha($file[0]) || (strlen($file) > 3 && ctype_alpha($file[0])
&& substr($file, 1, 1) === ':' && substr($file, 1, 1) === ':'
&& (strspn($file, '/\\', 2, 1)) && (strspn($file, '/\\', 2, 1))
) )
|| null !== parse_url($file, PHP_URL_SCHEME) || null !== parse_url($file, PHP_URL_SCHEME)
); ;
} }
/** /**

View File

@ -55,15 +55,15 @@ class SortableIterator implements \IteratorAggregate
}; };
} elseif (self::SORT_BY_ACCESSED_TIME === $sort) { } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
$this->sort = function ($a, $b) { $this->sort = function ($a, $b) {
return ($a->getATime() - $b->getATime()); return $a->getATime() - $b->getATime();
}; };
} elseif (self::SORT_BY_CHANGED_TIME === $sort) { } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
$this->sort = function ($a, $b) { $this->sort = function ($a, $b) {
return ($a->getCTime() - $b->getCTime()); return $a->getCTime() - $b->getCTime();
}; };
} elseif (self::SORT_BY_MODIFIED_TIME === $sort) { } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
$this->sort = function ($a, $b) { $this->sort = function ($a, $b) {
return ($a->getMTime() - $b->getMTime()); return $a->getMTime() - $b->getMTime();
}; };
} elseif (is_callable($sort)) { } elseif (is_callable($sort)) {
$this->sort = $sort; $this->sort = $sort;

View File

@ -972,7 +972,7 @@ class Response
* Sets the Vary header. * Sets the Vary header.
* *
* @param string|array $headers * @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 * @return Response
*/ */

View File

@ -52,7 +52,7 @@ abstract class AbstractProxy
*/ */
public function isSessionHandlerInterface() public function isSessionHandlerInterface()
{ {
return ($this instanceof \SessionHandlerInterface); return $this instanceof \SessionHandlerInterface;
} }
/** /**

View File

@ -214,7 +214,7 @@ class FullTransformer
*/ */
public function isQuoteMatch($quoteMatch) public function isQuoteMatch($quoteMatch)
{ {
return ("'" === $quoteMatch[0]); return "'" === $quoteMatch[0];
} }
/** /**

View File

@ -1409,6 +1409,11 @@ class Process
$this->exitcode = 128 + $this->processInformation['termsig']; $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; return $this->exitcode;
} }

View File

@ -707,6 +707,6 @@ class Parser
*/ */
private function isStringUnIndentedCollectionItem() private function isStringUnIndentedCollectionItem()
{ {
return (0 === strpos($this->currentLine, '- ')); return 0 === strpos($this->currentLine, '- ');
} }
} }