N°8834 - Add compatibility with PHP 8.4 (#819)

* N°8834 - Add compatibility with PHP 8.4

* Rollback of scssphp/scssphp version upgrade due to compilation error
This commit is contained in:
Lenaick
2026-02-26 10:36:32 +01:00
committed by GitHub
parent d4821b7edc
commit fc967c06ce
961 changed files with 12298 additions and 7130 deletions

View File

@@ -219,7 +219,7 @@ abstract class AbstractCloner implements ClonerInterface
*
* @see addCasters
*/
public function __construct(array $casters = null)
public function __construct(?array $casters = null)
{
$this->addCasters($casters ?? static::$defaultCasters);
}

View File

@@ -115,7 +115,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate, \Stringable
public function getIterator(): \Traversable
{
if (!\is_array($value = $this->getValue())) {
throw new \LogicException(sprintf('"%s" object holds non-iterable type "%s".', self::class, get_debug_type($value)));
throw new \LogicException(\sprintf('"%s" object holds non-iterable type "%s".', self::class, get_debug_type($value)));
}
yield from $value;
@@ -168,7 +168,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate, \Stringable
return (string) $value;
}
return sprintf('%s (count=%d)', $this->getType(), \count($value));
return \sprintf('%s (count=%d)', $this->getType(), \count($value));
}
/**
@@ -298,7 +298,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate, \Stringable
if (!$item instanceof Stub) {
$cursor->attr = [];
$type = \gettype($item);
if ($item && 'array' === $type) {
if ('array' === $type && $item) {
$item = $this->getStub($item);
}
} elseif (Stub::TYPE_REF === $item->type) {
@@ -375,7 +375,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate, \Stringable
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

@@ -1,25 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\VarDumper\Cloner\Internal;
/**
* Flags a typed property that has no default value.
*
* This dummy object is used to distinguish a property with a default value of null
* from a property that is uninitialized by default.
*
* @internal
*/
enum NoDefault
{
case NoDefault;
}

View File

@@ -40,29 +40,37 @@ class Stub
public $position = 0;
public $attr = [];
private static array $defaultProperties = [];
/**
* @internal
*/
public function __sleep(): array
protected static array $propertyDefaults = [];
public function __serialize(): array
{
$properties = [];
static $noDefault = new \stdClass();
if (!isset(self::$defaultProperties[$c = static::class])) {
self::$defaultProperties[$c] = get_class_vars($c);
foreach ((new \ReflectionClass($c))->getStaticProperties() as $k => $v) {
unset(self::$defaultProperties[$c][$k]);
if (self::class === static::class) {
$data = [];
foreach ($this as $k => $v) {
$default = self::$propertyDefaults[$this::class][$k] ??= ($p = new \ReflectionProperty($this, $k))->hasDefaultValue() ? $p->getDefaultValue() : ($p->hasType() ? $noDefault : null);
if ($noDefault === $default || $default !== $v) {
$data[$k] = $v;
}
}
return $data;
}
foreach (self::$defaultProperties[$c] as $k => $v) {
if ($this->$k !== $v) {
$properties[] = $k;
return \Closure::bind(function () use ($noDefault) {
$data = [];
foreach ($this as $k => $v) {
$default = self::$propertyDefaults[$this::class][$k] ??= ($p = new \ReflectionProperty($this, $k))->hasDefaultValue() ? $p->getDefaultValue() : ($p->hasType() ? $noDefault : null);
if ($noDefault === $default || $default !== $v) {
$data[$k] = $v;
}
}
}
return $properties;
return $data;
}, $this, $this::class)();
}
}