[Web] Update composer libs

- Removing symfony/deprecation-contracts (v2.4.0)
  - Upgrading ddeboer/imap (1.12.1 => 1.13.1)
  - Upgrading directorytree/ldaprecord (v2.6.3 => v2.10.1)
  - Upgrading illuminate/contracts (v8.53.1 => v9.3.0)
  - Upgrading nesbot/carbon (2.51.1 => 2.57.0)
  - Upgrading phpmailer/phpmailer (v6.5.0 => v6.6.0)
  - Upgrading psr/container (1.1.1 => 2.0.2)
  - Upgrading psr/log (1.1.4 => 3.0.0)
  - Upgrading psr/simple-cache (1.0.1 => 2.0.0)
  - Upgrading robthree/twofactorauth (1.8.0 => 1.8.1)
  - Upgrading symfony/polyfill-ctype (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-mbstring (v1.23.1 => v1.24.0)
  - Upgrading symfony/polyfill-php80 (v1.23.1 => v1.24.0)
  - Upgrading symfony/translation (v5.3.4 => v6.0.5)
  - Upgrading symfony/translation-contracts (v2.4.0 => v3.0.0)
  - Upgrading symfony/var-dumper (v5.3.6 => v6.0.5)
  - Upgrading tightenco/collect (v8.34.0 => v8.83.2)
  - Upgrading twig/twig (v3.3.2 => v3.3.8)
This commit is contained in:
andryyy
2022-03-02 20:08:24 +01:00
parent 24275ffdbf
commit 98bc947d00
940 changed files with 7649 additions and 14226 deletions

View File

@@ -29,6 +29,8 @@ abstract class AbstractCloner implements ClonerInterface
'Symfony\Component\VarDumper\Caster\ConstStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'],
'Symfony\Component\VarDumper\Caster\EnumStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'],
'Fiber' => ['Symfony\Component\VarDumper\Caster\FiberCaster', 'castFiber'],
'Closure' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClosure'],
'Generator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castGenerator'],
'ReflectionType' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castType'],
@@ -81,11 +83,15 @@ abstract class AbstractCloner implements ClonerInterface
'Symfony\Bridge\Monolog\Logger' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Symfony\Component\DependencyInjection\ContainerInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Symfony\Component\EventDispatcher\EventDispatcherInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Symfony\Component\HttpClient\AmpHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
'Symfony\Component\HttpClient\CurlHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
'Symfony\Component\HttpClient\NativeHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
'Symfony\Component\HttpClient\Response\AmpResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
'Symfony\Component\HttpClient\Response\CurlResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
'Symfony\Component\HttpClient\Response\NativeResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
'Symfony\Component\HttpFoundation\Request' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'],
'Symfony\Component\Uid\Ulid' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castUlid'],
'Symfony\Component\Uid\Uuid' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castUuid'],
'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'],
'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'],
'Symfony\Component\VarDumper\Caster\FrameStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'],
@@ -147,8 +153,9 @@ abstract class AbstractCloner implements ClonerInterface
'Ds\Pair' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPair'],
'Symfony\Component\VarDumper\Caster\DsPairStub' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPairStub'],
'mysqli_driver' => ['Symfony\Component\VarDumper\Caster\MysqliCaster', 'castMysqliDriver'],
'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'],
@@ -190,10 +197,18 @@ abstract class AbstractCloner implements ClonerInterface
protected $maxString = -1;
protected $minDepth = 1;
private $casters = [];
/**
* @var array<string, list<callable>>
*/
private array $casters = [];
/**
* @var callable|null
*/
private $prevErrorHandler;
private $classInfo = [];
private $filter = 0;
private array $classInfo = [];
private int $filter = 0;
/**
* @param callable[]|null $casters A map of casters
@@ -253,12 +268,9 @@ abstract class AbstractCloner implements ClonerInterface
/**
* Clones a PHP variable.
*
* @param mixed $var Any PHP variable
* @param int $filter A bit field of Caster::EXCLUDE_* constants
*
* @return Data The cloned variable represented by a Data object
* @param int $filter A bit field of Caster::EXCLUDE_* constants
*/
public function cloneVar($var, int $filter = 0)
public function cloneVar(mixed $var, int $filter = 0): Data
{
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
if (\E_RECOVERABLE_ERROR === $type || \E_USER_ERROR === $type) {
@@ -290,26 +302,20 @@ abstract class AbstractCloner implements ClonerInterface
/**
* Effectively clones the PHP variable.
*
* @param mixed $var Any PHP variable
*
* @return array The cloned variable represented in an array
*/
abstract protected function doClone($var);
abstract protected function doClone(mixed $var): array;
/**
* Casts an object to an array representation.
*
* @param bool $isNested True if the object is nested in the dumped structure
*
* @return array The object casted as array
*/
protected function castObject(Stub $stub, bool $isNested)
protected function castObject(Stub $stub, bool $isNested): array
{
$obj = $stub->value;
$class = $stub->class;
if (\PHP_VERSION_ID < 80000 ? "\0" === ($class[15] ?? null) : str_contains($class, "@anonymous\0")) {
if (str_contains($class, "@anonymous\0")) {
$stub->class = get_debug_type($obj);
}
if (isset($this->classInfo[$class])) {
@@ -360,10 +366,8 @@ abstract class AbstractCloner implements ClonerInterface
* Casts a resource to an array representation.
*
* @param bool $isNested True if the object is nested in the dumped structure
*
* @return array The resource casted as array
*/
protected function castResource(Stub $stub, bool $isNested)
protected function castResource(Stub $stub, bool $isNested): array
{
$a = [];
$res = $stub->value;

View File

@@ -18,10 +18,6 @@ interface ClonerInterface
{
/**
* Clones a PHP variable.
*
* @param mixed $var Any PHP variable
*
* @return Data The cloned variable represented by a Data object
*/
public function cloneVar($var);
public function cloneVar(mixed $var): Data;
}

View File

@@ -19,13 +19,13 @@ use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
*/
class Data implements \ArrayAccess, \Countable, \IteratorAggregate
{
private $data;
private $position = 0;
private $key = 0;
private $maxDepth = 20;
private $maxItemsPerDepth = -1;
private $useRefHandles = -1;
private $context = [];
private array $data;
private int $position = 0;
private int|string $key = 0;
private int $maxDepth = 20;
private int $maxItemsPerDepth = -1;
private int $useRefHandles = -1;
private array $context = [];
/**
* @param array $data An array as returned by ClonerInterface::cloneVar()
@@ -35,10 +35,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
$this->data = $data;
}
/**
* @return string|null The type of the value
*/
public function getType()
public function getType(): ?string
{
$item = $this->data[$this->position][$this->key];
@@ -65,11 +62,13 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
}
/**
* Returns a native representation of the original value.
*
* @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
* @return string|int|float|bool|array|Data[]|null
*/
public function getValue($recursive = false)
public function getValue(array|bool $recursive = false): string|int|float|bool|array|null
{
$item = $this->data[$this->position][$this->key];
@@ -108,18 +107,12 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
return $children;
}
/**
* @return int
*/
public function count()
public function count(): int
{
return \count($this->getValue());
}
/**
* @return \Traversable
*/
public function getIterator()
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)));
@@ -139,50 +132,32 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
return null;
}
/**
* @return bool
*/
public function __isset(string $key)
public function __isset(string $key): bool
{
return null !== $this->seek($key);
}
/**
* @return bool
*/
public function offsetExists($key)
public function offsetExists(mixed $key): bool
{
return $this->__isset($key);
}
/**
* @return mixed
*/
public function offsetGet($key)
public function offsetGet(mixed $key): mixed
{
return $this->__get($key);
}
/**
* @return void
*/
public function offsetSet($key, $value)
public function offsetSet(mixed $key, mixed $value): void
{
throw new \BadMethodCallException(self::class.' objects are immutable.');
}
/**
* @return void
*/
public function offsetUnset($key)
public function offsetUnset(mixed $key): void
{
throw new \BadMethodCallException(self::class.' objects are immutable.');
}
/**
* @return string
*/
public function __toString()
public function __toString(): string
{
$value = $this->getValue();
@@ -195,26 +170,22 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
/**
* Returns a depth limited clone of $this.
*
* @return static
*/
public function withMaxDepth(int $maxDepth)
public function withMaxDepth(int $maxDepth): static
{
$data = clone $this;
$data->maxDepth = (int) $maxDepth;
$data->maxDepth = $maxDepth;
return $data;
}
/**
* Limits the number of elements per depth level.
*
* @return static
*/
public function withMaxItemsPerDepth(int $maxItemsPerDepth)
public function withMaxItemsPerDepth(int $maxItemsPerDepth): static
{
$data = clone $this;
$data->maxItemsPerDepth = (int) $maxItemsPerDepth;
$data->maxItemsPerDepth = $maxItemsPerDepth;
return $data;
}
@@ -223,10 +194,8 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
* Enables/disables objects' identifiers tracking.
*
* @param bool $useRefHandles False to hide global ref. handles
*
* @return static
*/
public function withRefHandles(bool $useRefHandles)
public function withRefHandles(bool $useRefHandles): static
{
$data = clone $this;
$data->useRefHandles = $useRefHandles ? -1 : 0;
@@ -234,10 +203,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
return $data;
}
/**
* @return static
*/
public function withContext(array $context)
public function withContext(array $context): static
{
$data = clone $this;
$data->context = $context;
@@ -247,12 +213,8 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
/**
* Seeks to a specific key in nested data structures.
*
* @param string|int $key The key to seek to
*
* @return static|null Null if the key is not set
*/
public function seek($key)
public function seek(string|int $key): ?static
{
$item = $this->data[$this->position][$this->key];
@@ -318,7 +280,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
*
* @param mixed $item A Stub object or the original value being dumped
*/
private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, $item)
private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item)
{
$cursor->refIndex = 0;
$cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0;
@@ -440,7 +402,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
return $hashCut;
}
private function getStub($item)
private function getStub(mixed $item)
{
if (!$item || !\is_array($item)) {
return $item;

View File

@@ -20,11 +20,8 @@ interface DumperInterface
{
/**
* Dumps a scalar value.
*
* @param string $type The PHP type of the value being dumped
* @param string|int|float|bool $value The scalar value being dumped
*/
public function dumpScalar(Cursor $cursor, string $type, $value);
public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value);
/**
* Dumps a string.
@@ -38,19 +35,19 @@ interface DumperInterface
/**
* Dumps while entering an hash.
*
* @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 $type A Cursor::HASH_* const for the type of hash
* @param string|int|null $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, int $type, $class, bool $hasChild);
public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild);
/**
* Dumps while leaving an hash.
*
* @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
* @param int $type A Cursor::HASH_* const for the type of hash
* @param string|int|null $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, int $type, $class, bool $hasChild, int $cut);
public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut);
}

View File

@@ -39,7 +39,7 @@ class Stub
public $position = 0;
public $attr = [];
private static $defaultProperties = [];
private static array $defaultProperties = [];
/**
* @internal

View File

@@ -16,23 +16,23 @@ namespace Symfony\Component\VarDumper\Cloner;
*/
class VarCloner extends AbstractCloner
{
private static $gid;
private static $arrayCache = [];
private static string $gid;
private static array $arrayCache = [];
/**
* {@inheritdoc}
*/
protected function doClone($var)
protected function doClone(mixed $var): array
{
$len = 1; // Length of $queue
$pos = 0; // Number of cloned items past the minimum depth
$refsCounter = 0; // Hard references counter
$queue = [[$var]]; // This breadth-first queue is the return value
$hardRefs = []; // Map of original zval ids to stub objects
$objRefs = []; // Map of original object handles to their stub object counterpart
$objects = []; // Keep a ref to objects to ensure their handle cannot be reused while cloning
$resRefs = []; // Map of original resource handles to their stub object counterpart
$values = []; // Map of stub objects' ids to original values
$queue = [[$var]]; // This breadth-first queue is the return value
$hardRefs = []; // Map of original zval ids to stub objects
$objRefs = []; // Map of original object handles to their stub object counterpart
$objects = []; // Keep a ref to objects to ensure their handle cannot be reused while cloning
$resRefs = []; // Map of original resource handles to their stub object counterpart
$values = []; // Map of stub objects' ids to original values
$maxItems = $this->maxItems;
$maxString = $this->maxString;
$minDepth = $this->minDepth;
@@ -44,9 +44,7 @@ class VarCloner extends AbstractCloner
$stub = null; // Stub capturing the main properties of an original item value
// or null if the original value is used directly
if (!$gid = self::$gid) {
$gid = self::$gid = md5(random_bytes(6)); // Unique string used to detect the special $GLOBALS variable
}
$gid = self::$gid ??= md5(random_bytes(6)); // Unique string used to detect the special $GLOBALS variable
$arrayStub = new Stub();
$arrayStub->type = Stub::TYPE_ARRAY;
$fromObjCast = false;
@@ -65,32 +63,25 @@ class VarCloner extends AbstractCloner
foreach ($vals as $k => $v) {
// $v is the original value or a stub object in case of hard references
if (\PHP_VERSION_ID >= 70400) {
$zvalIsRef = null !== \ReflectionReference::fromArrayElement($vals, $k);
} else {
$refs[$k] = $cookie;
$zvalIsRef = $vals[$k] === $cookie;
}
$zvalRef = ($r = \ReflectionReference::fromArrayElement($vals, $k)) ? $r->getId() : null;
if ($zvalIsRef) {
if ($zvalRef) {
$vals[$k] = &$stub; // Break hard references to make $queue completely
unset($stub); // independent from the original structure
if ($v instanceof Stub && isset($hardRefs[spl_object_id($v)])) {
$vals[$k] = $refs[$k] = $v;
if (null !== $vals[$k] = $hardRefs[$zvalRef] ?? null) {
$v = $vals[$k];
if ($v->value instanceof Stub && (Stub::TYPE_OBJECT === $v->value->type || Stub::TYPE_RESOURCE === $v->value->type)) {
++$v->value->refCount;
}
++$v->refCount;
continue;
}
$refs[$k] = $vals[$k] = new Stub();
$refs[$k]->value = $v;
$h = spl_object_id($refs[$k]);
$hardRefs[$h] = &$refs[$k];
$values[$h] = $v;
$vals[$k] = new Stub();
$vals[$k]->value = $v;
$vals[$k]->handle = ++$refsCounter;
$hardRefs[$zvalRef] = $vals[$k];
}
// Create $stub when the original value $v can not be used directly
// Create $stub when the original value $v cannot be used directly
// If $v is a nested structure, put that structure in array $a
switch (true) {
case null === $v:
@@ -129,39 +120,46 @@ class VarCloner extends AbstractCloner
continue 2;
}
$stub = $arrayStub;
if (\PHP_VERSION_ID >= 80100) {
$stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC;
$a = $v;
break;
}
$stub->class = Stub::ARRAY_INDEXED;
$j = -1;
foreach ($v as $gk => $gv) {
if ($gk !== ++$j) {
$stub->class = Stub::ARRAY_ASSOC;
$a = $v;
$a[$gid] = true;
break;
}
}
$a = $v;
if (Stub::ARRAY_ASSOC === $stub->class) {
// Copies of $GLOBALS have very strange behavior,
// let's detect them with some black magic
if (\PHP_VERSION_ID < 80100 && ($a[$gid] = true) && isset($v[$gid])) {
unset($v[$gid]);
$a = [];
foreach ($v as $gk => &$gv) {
if ($v === $gv) {
unset($v);
$v = new Stub();
$v->value = [$v->cut = \count($gv), Stub::TYPE_ARRAY => 0];
$v->handle = -1;
$gv = &$hardRefs[spl_object_id($v)];
$gv = $v;
}
$a[$gk] = &$gv;
// Copies of $GLOBALS have very strange behavior,
// let's detect them with some black magic
if (isset($v[$gid])) {
unset($v[$gid]);
$a = [];
foreach ($v as $gk => &$gv) {
if ($v === $gv && !isset($hardRefs[\ReflectionReference::fromArrayElement($v, $gk)->getId()])) {
unset($v);
$v = new Stub();
$v->value = [$v->cut = \count($gv), Stub::TYPE_ARRAY => 0];
$v->handle = -1;
$gv = &$a[$gk];
$hardRefs[\ReflectionReference::fromArrayElement($a, $gk)->getId()] = &$gv;
$gv = $v;
}
unset($gv);
} else {
$a = $v;
$a[$gk] = &$gv;
}
unset($gv);
} else {
$a = $v;
}
break;
@@ -251,10 +249,10 @@ class VarCloner extends AbstractCloner
}
}
if ($zvalIsRef) {
$refs[$k]->value = $stub;
} else {
if (!$zvalRef) {
$vals[$k] = $stub;
} else {
$hardRefs[$zvalRef]->value = $stub;
}
}