⬆️ N°4770 Update to latest Symfony 3.4

This commit is contained in:
Pierre Goiffon
2022-02-10 15:18:50 +01:00
parent b494ff2ce6
commit f29a8792af
401 changed files with 4329 additions and 2378 deletions

View File

@@ -45,6 +45,7 @@ abstract class AbstractCloner implements ClonerInterface
'Doctrine\Common\Proxy\Proxy' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castCommonProxy'],
'Doctrine\ORM\Proxy\Proxy' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castOrmProxy'],
'Doctrine\ORM\PersistentCollection' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castPersistentCollection'],
'Doctrine\Persistence\ObjectManager' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'DOMException' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'],
'DOMStringList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
@@ -101,7 +102,6 @@ abstract class AbstractCloner implements ClonerInterface
'SplDoublyLinkedList' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castDoublyLinkedList'],
'SplFileInfo' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFileInfo'],
'SplFileObject' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFileObject'],
'SplFixedArray' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFixedArray'],
'SplHeap' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'],
'SplObjectStorage' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'],
'SplPriorityQueue' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'],
@@ -117,7 +117,9 @@ abstract class AbstractCloner implements ClonerInterface
'DateTimeZone' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castTimeZone'],
'DatePeriod' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castPeriod'],
'CurlHandle' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'],
':curl' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'],
':dba' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
':dba persistent' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
':gd' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'],
@@ -216,7 +218,7 @@ abstract class AbstractCloner implements ClonerInterface
public function cloneVar($var, $filter = 0)
{
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) {
if (\E_RECOVERABLE_ERROR === $type || \E_USER_ERROR === $type) {
// Cloner never dies
throw new \ErrorException($msg, 0, $type, $file, $line);
}
@@ -265,8 +267,8 @@ abstract class AbstractCloner implements ClonerInterface
$obj = $stub->value;
$class = $stub->class;
if (isset($class[15]) && "\0" === $class[15] && 0 === strpos($class, "class@anonymous\x00")) {
$stub->class = get_parent_class($class).'@anonymous';
if ((\PHP_VERSION_ID >= 80000 || (isset($class[15]) && "\0" === $class[15])) && false !== strpos($class, "@anonymous\0")) {
$stub->class = \PHP_VERSION_ID < 80000 ? (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous' : get_debug_type($obj);
}
if (isset($this->classInfo[$class])) {
list($i, $parents, $hasDebugInfo) = $this->classInfo[$class];
@@ -288,7 +290,7 @@ abstract class AbstractCloner implements ClonerInterface
$this->classInfo[$class] = [$i, $parents, $hasDebugInfo];
}
$a = Caster::castObject($obj, $class, $hasDebugInfo);
$a = Caster::castObject($obj, $class, $hasDebugInfo, $stub->class);
try {
while ($i--) {

View File

@@ -114,7 +114,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
public function getIterator()
{
if (!\is_array($value = $this->getValue())) {
throw new \LogicException(sprintf('%s object holds non-iterable type "%s".', self::class, \gettype($value)));
throw new \LogicException(sprintf('"%s" object holds non-iterable type "%s".', self::class, \gettype($value)));
}
foreach ($value as $k => $v) {
@@ -306,7 +306,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
}
} elseif (Stub::TYPE_REF === $item->type) {
if ($item->handle) {
if (!isset($refs[$r = $item->handle - (PHP_INT_MAX >> 1)])) {
if (!isset($refs[$r = $item->handle - (\PHP_INT_MAX >> 1)])) {
$cursor->refIndex = $refs[$r] = $cursor->refIndex ?: ++$refs[0];
} else {
$firstSeen = false;
@@ -374,7 +374,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
break;
default:
throw new \RuntimeException(sprintf('Unexpected Stub type: %s', $item->type));
throw new \RuntimeException(sprintf('Unexpected Stub type: "%s".', $item->type));
}
} elseif ('array' === $type) {
$dumper->enterHash($cursor, Cursor::HASH_INDEXED, 0, false);

View File

@@ -48,7 +48,7 @@ class Stub
{
$properties = [];
if (!isset(self::$defaultProperties[$c = \get_class($this)])) {
if (!isset(self::$defaultProperties[$c = static::class])) {
self::$defaultProperties[$c] = get_class_vars($c);
foreach ((new \ReflectionClass($c))->getStaticProperties() as $k => $v) {

View File

@@ -48,8 +48,8 @@ class VarCloner extends AbstractCloner
// or null if the original value is used directly
if (!self::$hashMask) {
self::$gid = uniqid(mt_rand(), true); // Unique string used to detect the special $GLOBALS variable
self::initHashMask();
self::$gid = md5(dechex(self::$hashMask)); // Unique string used to detect the special $GLOBALS variable
}
$gid = self::$gid;
$hashMask = self::$hashMask;
@@ -120,7 +120,6 @@ class VarCloner extends AbstractCloner
case \is_int($v):
case \is_float($v):
continue 2;
case \is_string($v):
if ('' === $v) {
continue 2;
@@ -248,7 +247,7 @@ class VarCloner extends AbstractCloner
$stub->position = $len++;
} elseif ($pos < $maxItems) {
if ($maxItems < $pos += \count($a)) {
$a = \array_slice($a, 0, $maxItems - $pos);
$a = \array_slice($a, 0, $maxItems - $pos, true);
if ($stub->cut >= 0) {
$stub->cut += $pos - $maxItems;
}
@@ -310,7 +309,7 @@ class VarCloner extends AbstractCloner
private static function initHashMask()
{
$obj = (object) [];
self::$hashOffset = 16 - PHP_INT_SIZE;
self::$hashOffset = 16 - \PHP_INT_SIZE;
self::$hashMask = -1;
if (\defined('HHVM_VERSION')) {
@@ -318,7 +317,7 @@ class VarCloner extends AbstractCloner
} else {
// check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below
$obFuncs = ['ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush'];
foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
foreach (debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && \in_array($frame['function'], $obFuncs)) {
$frame['line'] = 0;
break;
@@ -331,6 +330,6 @@ class VarCloner extends AbstractCloner
}
}
self::$hashMask ^= hexdec(substr(spl_object_hash($obj), self::$hashOffset, PHP_INT_SIZE));
self::$hashMask ^= hexdec(substr(spl_object_hash($obj), self::$hashOffset, \PHP_INT_SIZE));
}
}