From 55097c47c5534d4453f7494f8a1542f7beb4d588 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 14 Mar 2024 10:13:22 +0000 Subject: Revert "composer update and use the fixed streams php-jcs library until the floats issue will be fixed upstream. see here for reference https://codeberg.org/streams/streams/issues/151" This reverts commit 6bf61dfa6b585db01b607a79bd64ec9c583a9c10. --- vendor/ramsey/collection/src/AbstractArray.php | 60 +++++++++++++++++++++----- 1 file changed, 49 insertions(+), 11 deletions(-) (limited to 'vendor/ramsey/collection/src/AbstractArray.php') diff --git a/vendor/ramsey/collection/src/AbstractArray.php b/vendor/ramsey/collection/src/AbstractArray.php index 5ce622aa7..d72dbe697 100644 --- a/vendor/ramsey/collection/src/AbstractArray.php +++ b/vendor/ramsey/collection/src/AbstractArray.php @@ -17,7 +17,8 @@ namespace Ramsey\Collection; use ArrayIterator; use Traversable; -use function count; +use function serialize; +use function unserialize; /** * This class provides a basic implementation of `ArrayInterface`, to minimize @@ -33,7 +34,7 @@ abstract class AbstractArray implements ArrayInterface * * @var array */ - protected array $data = []; + protected $data = []; /** * Constructs a new array object. @@ -68,7 +69,7 @@ abstract class AbstractArray implements ArrayInterface * * @param array-key $offset The offset to check. */ - public function offsetExists(mixed $offset): bool + public function offsetExists($offset): bool { return isset($this->data[$offset]); } @@ -80,12 +81,15 @@ abstract class AbstractArray implements ArrayInterface * * @param array-key $offset The offset for which a value should be returned. * - * @return T the value stored at the offset, or null if the offset + * @return T|null the value stored at the offset, or null if the offset * does not exist. + * + * @psalm-suppress InvalidAttribute */ - public function offsetGet(mixed $offset): mixed + #[\ReturnTypeWillChange] // phpcs:ignore + public function offsetGet($offset) { - return $this->data[$offset]; + return $this->data[$offset] ?? null; } /** @@ -93,11 +97,12 @@ abstract class AbstractArray implements ArrayInterface * * @link http://php.net/manual/en/arrayaccess.offsetset.php ArrayAccess::offsetSet() * - * @param array-key | null $offset The offset to set. If `null`, the value - * may be set at a numerically-indexed offset. + * @param array-key|null $offset The offset to set. If `null`, the value may be + * set at a numerically-indexed offset. * @param T $value The value to set at the given offset. */ - public function offsetSet(mixed $offset, mixed $value): void + // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + public function offsetSet($offset, $value): void { if ($offset === null) { $this->data[] = $value; @@ -113,11 +118,25 @@ abstract class AbstractArray implements ArrayInterface * * @param array-key $offset The offset to remove from the array. */ - public function offsetUnset(mixed $offset): void + public function offsetUnset($offset): void { unset($this->data[$offset]); } + /** + * Returns a serialized string representation of this array object. + * + * @deprecated The Serializable interface will go away in PHP 9. + * + * @link http://php.net/manual/en/serializable.serialize.php Serializable::serialize() + * + * @return string a PHP serialized string. + */ + public function serialize(): string + { + return serialize($this->data); + } + /** * Returns data suitable for PHP serialization. * @@ -131,6 +150,25 @@ abstract class AbstractArray implements ArrayInterface return $this->data; } + /** + * Converts a serialized string representation into an instance object. + * + * @deprecated The Serializable interface will go away in PHP 9. + * + * @link http://php.net/manual/en/serializable.unserialize.php Serializable::unserialize() + * + * @param string $serialized A PHP serialized string to unserialize. + * + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + */ + public function unserialize($serialized): void + { + /** @var array $data */ + $data = unserialize($serialized, ['allowed_classes' => false]); + + $this->data = $data; + } + /** * Adds unserialized data to the object. * @@ -166,6 +204,6 @@ abstract class AbstractArray implements ArrayInterface public function isEmpty(): bool { - return $this->data === []; + return count($this->data) === 0; } } -- cgit v1.2.3