mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
N°8755 - Remove unused Symfony features for iTop 3.3
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\VarDumper\Cloner;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Internal\NoDefault;
|
||||
|
||||
/**
|
||||
* Represents the main properties of a PHP variable.
|
||||
*
|
||||
@@ -42,34 +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])) {
|
||||
$reflection = new \ReflectionClass($c);
|
||||
self::$defaultProperties[$c] = [];
|
||||
|
||||
foreach ($reflection->getProperties() as $p) {
|
||||
if ($p->isStatic()) {
|
||||
continue;
|
||||
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;
|
||||
}
|
||||
|
||||
self::$defaultProperties[$c][$p->name] = $p->hasDefaultValue() ? $p->getDefaultValue() : ($p->hasType() ? NoDefault::NoDefault : null);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
foreach (self::$defaultProperties[$c] as $k => $v) {
|
||||
if (NoDefault::NoDefault === $v || $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)();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user