Merge branch '3.4' into 4.3

* 3.4:
  [ProxyManager] fix closure binding
  [VarDumper] fix annotations
  [Console] fixed a PHP notice when there is no function
This commit is contained in:
Nicolas Grekas 2019-08-15 10:49:41 +02:00
commit 8aff3ad611
6 changed files with 23 additions and 20 deletions

View File

@ -95,7 +95,7 @@ EOF;
}
if (version_compare(self::getProxyManagerVersion(), '2.5', '<')) {
$code = str_replace(' \Closure::bind(function ', ' \Closure::bind(static function ', $code);
$code = preg_replace('/ \\\\Closure::bind\(function ((?:& )?\(\$instance(?:, \$value)?\))/', ' \Closure::bind(static function \1', $code);
}
return $code;

View File

@ -123,6 +123,9 @@ class Translator extends BaseTranslator implements WarmableInterface
parent::initializeCatalogue($locale);
}
/**
* @internal
*/
protected function doLoadCatalogue($locale): void
{
parent::doLoadCatalogue($locale);

View File

@ -831,11 +831,11 @@ class Application
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'];
$function = isset($trace[$i]['function']) ? $trace[$i]['function'] : '';
$file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
$line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
$output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
$output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
}
$output->writeln('', OutputInterface::VERBOSITY_QUIET);

View File

@ -61,7 +61,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
}
/**
* @param bool $recursive Whether values should be resolved recursively or not
* @param array|bool $recursive Whether values should be resolved recursively or not
*
* @return string|int|float|bool|array|Data[]|null A native representation of the original value
*/
@ -168,7 +168,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
*
* @param int $maxDepth The max dumped depth level
*
* @return self A clone of $this
* @return static
*/
public function withMaxDepth($maxDepth)
{
@ -183,7 +183,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
*
* @param int $maxItemsPerDepth The max number of items dumped per depth level
*
* @return self A clone of $this
* @return static
*/
public function withMaxItemsPerDepth($maxItemsPerDepth)
{
@ -198,7 +198,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
*
* @param bool $useRefHandles False to hide global ref. handles
*
* @return self A clone of $this
* @return static
*/
public function withRefHandles($useRefHandles)
{
@ -213,7 +213,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
*
* @param string|int $key The key to seek to
*
* @return self|null A clone of $this or null if the key is not set
* @return static|null Null if the key is not set
*/
public function seek($key)
{

View File

@ -40,21 +40,21 @@ interface DumperInterface
/**
* Dumps while entering an hash.
*
* @param Cursor $cursor The Cursor position in the dump
* @param int $type A Cursor::HASH_* const for the type of hash
* @param string $class The object class, resource type or array count
* @param bool $hasChild When the dump of the hash has child item
* @param Cursor $cursor The Cursor position in the dump
* @param int $type A Cursor::HASH_* const for the type of hash
* @param string|int $class The object class, resource type or array count
* @param bool $hasChild When the dump of the hash has child item
*/
public function enterHash(Cursor $cursor, $type, $class, $hasChild);
/**
* Dumps while leaving an hash.
*
* @param Cursor $cursor The Cursor position in the dump
* @param int $type A Cursor::HASH_* const for the type of hash
* @param string $class The object class, resource type or array count
* @param bool $hasChild When the dump of the hash has child item
* @param int $cut The number of items the hash has been cut by
* @param Cursor $cursor The Cursor position in the dump
* @param int $type A Cursor::HASH_* const for the type of hash
* @param string|int $class The object class, resource type or array count
* @param bool $hasChild When the dump of the hash has child item
* @param int $cut The number of items the hash has been cut by
*/
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut);
}

View File

@ -185,13 +185,13 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Converts a non-UTF-8 string to UTF-8.
*
* @param string $s The non-UTF-8 string to convert
* @param string|null $s The non-UTF-8 string to convert
*
* @return string The string converted to UTF-8
* @return string|null The string converted to UTF-8
*/
protected function utf8Encode($s)
{
if (preg_match('//u', $s)) {
if (null === $s || preg_match('//u', $s)) {
return $s;
}