mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-26 03:58:45 +02:00
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:
@@ -34,7 +34,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
|
||||
* @param string $resource The fully-qualified class name
|
||||
* @param bool|null $exists Boolean when the existence check has already been done
|
||||
*/
|
||||
public function __construct(string $resource, bool $exists = null)
|
||||
public function __construct(string $resource, ?bool $exists = null)
|
||||
{
|
||||
$this->resource = $resource;
|
||||
if (null !== $exists) {
|
||||
@@ -101,23 +101,23 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
|
||||
return $this->exists[0] xor !$exists[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __sleep(): array
|
||||
public function __serialize(): array
|
||||
{
|
||||
if (null === $this->exists) {
|
||||
$this->isFresh(0);
|
||||
}
|
||||
|
||||
return ['resource', 'exists'];
|
||||
return [
|
||||
'resource' => $this->resource,
|
||||
'exists' => $this->exists,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __wakeup(): void
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
$this->resource = array_shift($data);
|
||||
$this->exists = array_shift($data);
|
||||
|
||||
if (\is_bool($this->exists)) {
|
||||
$this->exists = [$this->exists, null];
|
||||
}
|
||||
@@ -139,7 +139,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function throwOnRequiredClass(string $class, \Exception $previous = null): void
|
||||
public static function throwOnRequiredClass(string $class, ?\Exception $previous = null): void
|
||||
{
|
||||
// If the passed class is the resource being checked, we shouldn't throw.
|
||||
if (null === $previous && self::$autoloadedClass === $class) {
|
||||
@@ -158,10 +158,10 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
|
||||
throw $previous;
|
||||
}
|
||||
|
||||
$message = sprintf('Class "%s" not found.', $class);
|
||||
$message = \sprintf('Class "%s" not found.', $class);
|
||||
|
||||
if ($class !== (self::$autoloadedClass ?? $class)) {
|
||||
$message = substr_replace($message, sprintf(' while loading "%s"', self::$autoloadedClass), -1, 0);
|
||||
$message = substr_replace($message, \sprintf(' while loading "%s"', self::$autoloadedClass), -1, 0);
|
||||
}
|
||||
|
||||
if (null !== $previous) {
|
||||
|
||||
Reference in New Issue
Block a user