diff options
Diffstat (limited to 'vendor/ramsey/collection')
22 files changed, 112 insertions, 81 deletions
diff --git a/vendor/ramsey/collection/LICENSE b/vendor/ramsey/collection/LICENSE index 0efc999bf..ae15f590c 100644 --- a/vendor/ramsey/collection/LICENSE +++ b/vendor/ramsey/collection/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015-2020 Ben Ramsey <ben@benramsey.com> +Copyright (c) 2015-2021 Ben Ramsey <ben@benramsey.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/ramsey/collection/README.md b/vendor/ramsey/collection/README.md index ce7a554d2..9124dd77e 100644 --- a/vendor/ramsey/collection/README.md +++ b/vendor/ramsey/collection/README.md @@ -8,17 +8,15 @@ <a href="https://github.com/ramsey/collection"><img src="http://img.shields.io/badge/source-ramsey/collection-blue.svg?style=flat-square" alt="Source Code"></a> <a href="https://packagist.org/packages/ramsey/collection"><img src="https://img.shields.io/packagist/v/ramsey/collection.svg?style=flat-square&label=release" alt="Download Package"></a> <a href="https://php.net"><img src="https://img.shields.io/packagist/php-v/ramsey/collection.svg?style=flat-square&colorB=%238892BF" alt="PHP Programming Language"></a> + <a href="https://github.com/ramsey/collection/blob/master/LICENSE"><img src="https://img.shields.io/packagist/l/ramsey/collection.svg?style=flat-square&colorB=darkcyan" alt="Read License"></a> <a href="https://github.com/ramsey/collection/actions?query=workflow%3ACI"><img src="https://img.shields.io/github/workflow/status/ramsey/collection/CI?label=CI&logo=github&style=flat-square" alt="Build Status"></a> <a href="https://codecov.io/gh/ramsey/collection"><img src="https://img.shields.io/codecov/c/gh/ramsey/collection?label=codecov&logo=codecov&style=flat-square" alt="Codecov Code Coverage"></a> <a href="https://shepherd.dev/github/ramsey/collection"><img src="https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fshepherd.dev%2Fgithub%2Framsey%2Fcollection%2Fcoverage" alt="Psalm Type Coverage"></a> - <a href="https://github.com/ramsey/collection/blob/master/LICENSE"><img src="https://img.shields.io/packagist/l/ramsey/collection.svg?style=flat-square&colorB=darkcyan" alt="Read License"></a> - <a href="https://packagist.org/packages/ramsey/collection/stats"><img src="https://img.shields.io/packagist/dt/ramsey/collection.svg?style=flat-square&colorB=darkmagenta" alt="Package downloads on Packagist"></a> - <a href="https://phpc.chat/channel/ramsey"><img src="https://img.shields.io/badge/phpc.chat-%23ramsey-darkslateblue?style=flat-square" alt="Chat with the maintainers"></a> </p> ## About -ramsey/collection is a PHP 7.2+ library for representing and manipulating collections. +ramsey/collection is a PHP library for representing and manipulating collections. Much inspiration for this library came from the [Java Collections Framework][java]. @@ -44,7 +42,7 @@ Examples of how to use this framework can be found in the Contributions are welcome! Before contributing to this project, familiarize yourself with [CONTRIBUTING.md](CONTRIBUTING.md). -To develop this project, you will need [PHP](https://www.php.net) 7.2 or greater +To develop this project, you will need [PHP](https://www.php.net) 7.3 or greater and [Composer](https://getcomposer.org). After cloning this repository locally, execute the following commands: diff --git a/vendor/ramsey/collection/composer.json b/vendor/ramsey/collection/composer.json index 0c5d09578..98862ee46 100644 --- a/vendor/ramsey/collection/composer.json +++ b/vendor/ramsey/collection/composer.json @@ -1,7 +1,7 @@ { "name": "ramsey/collection", "type": "library", - "description": "A PHP 7.2+ library for representing and manipulating collections.", + "description": "A PHP library for representing and manipulating collections.", "keywords": [ "array", "collection", @@ -19,7 +19,8 @@ } ], "require": { - "php": "^7.2 || ^8" + "php": "^7.3 || ^8", + "symfony/polyfill-php81": "^1.23" }, "require-dev": { "captainhook/captainhook": "^5.3", @@ -29,6 +30,7 @@ "hamcrest/hamcrest-php": "^2", "jangregor/phpstan-prophecy": "^0.8", "mockery/mockery": "^1.3", + "phpspec/prophecy-phpunit": "^2.0", "phpstan/extension-installer": "^1", "phpstan/phpstan": "^0.12.32", "phpstan/phpstan-mockery": "^0.12.5", @@ -50,7 +52,8 @@ "autoload-dev": { "psr-4": { "Ramsey\\Console\\": "resources/console/", - "Ramsey\\Collection\\Test\\": "tests/" + "Ramsey\\Collection\\Test\\": "tests/", + "Ramsey\\Test\\Generics\\": "tests/generics/" }, "files": [ "vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php" @@ -58,48 +61,42 @@ }, "scripts": { "post-autoload-dump": "captainhook install --ansi -f -s", - "br:analyze": [ - "@br:analyze:phpstan", - "@br:analyze:psalm" + "dev:analyze": [ + "@dev:analyze:phpstan", + "@dev:analyze:psalm" ], - "br:analyze:phpstan": "phpstan --memory-limit=1G analyse", - "br:analyze:psalm": "psalm --diff --config=psalm.xml", - "br:build:clean": "git clean -fX build/.", - "br:build:clear-cache": "git clean -fX build/cache/.", - "br:lint": "phpcs --cache=build/cache/phpcs.cache", - "br:lint:fix": "./bin/lint-fix.sh", - "br:repl": [ + "dev:analyze:phpstan": "phpstan --memory-limit=1G analyse", + "dev:analyze:psalm": "psalm --diff --config=psalm.xml", + "dev:build:clean": "git clean -fX build/.", + "dev:build:clear-cache": "git clean -fX build/cache/.", + "dev:lint": "phpcs --cache=build/cache/phpcs.cache", + "dev:lint:fix": "./bin/lint-fix.sh", + "dev:repl": [ "echo ; echo 'Type ./bin/repl to start the REPL.'" ], - "br:test": "phpunit", - "br:test:all": [ - "@br:lint", - "@br:analyze", - "@br:test" + "dev:test": "phpunit", + "dev:test:all": [ + "@dev:lint", + "@dev:analyze", + "@dev:test" ], - "br:test:coverage:ci": "phpunit --coverage-clover build/logs/clover.xml", - "br:test:coverage:html": "phpunit --coverage-html build/coverage", - "pre-commit": [ - "@br:lint:fix", - "@br:lint", - "@br:analyze" - ], - "test": "@br:test:all" + "dev:test:coverage:ci": "phpunit --coverage-clover build/logs/clover.xml", + "dev:test:coverage:html": "phpunit --coverage-html build/coverage", + "test": "@dev:test:all" }, "scripts-descriptions": { - "br:analyze": "Performs static analysis on the code base.", - "br:analyze:phpstan": "Runs the PHPStan static analyzer.", - "br:analyze:psalm": "Runs the Psalm static analyzer.", - "br:build:clean": "Removes everything not under version control from the build directory.", - "br:build:clear-cache": "Removes everything not under version control from build/cache/.", - "br:lint": "Checks all source code for coding standards issues.", - "br:lint:fix": "Checks source code for coding standards issues and fixes them, if possible.", - "br:repl": "Note: Use ./bin/repl to run the REPL.", - "br:test": "Runs the full unit test suite.", - "br:test:all": "Runs linting, static analysis, and unit tests.", - "br:test:coverage:ci": "Runs the unit test suite and generates a Clover coverage report.", - "br:test:coverage:html": "Runs the unit tests suite and generates an HTML coverage report.", - "pre-commit": "These commands are run as part of a Git pre-commit hook installed using captainhook/captainhook. Each command should be prepared to accept a list of space-separated staged files.", + "dev:analyze": "Performs static analysis on the code base.", + "dev:analyze:phpstan": "Runs the PHPStan static analyzer.", + "dev:analyze:psalm": "Runs the Psalm static analyzer.", + "dev:build:clean": "Removes everything not under version control from the build directory.", + "dev:build:clear-cache": "Removes everything not under version control from build/cache/.", + "dev:lint": "Checks all source code for coding standards issues.", + "dev:lint:fix": "Checks source code for coding standards issues and fixes them, if possible.", + "dev:repl": "Note: Use ./bin/repl to run the REPL.", + "dev:test": "Runs the full unit test suite.", + "dev:test:all": "Runs linting, static analysis, and unit tests.", + "dev:test:coverage:ci": "Runs the unit test suite and generates a Clover coverage report.", + "dev:test:coverage:html": "Runs the unit tests suite and generates an HTML coverage report.", "test": "Shortcut to run the full test suite." } } diff --git a/vendor/ramsey/collection/src/AbstractArray.php b/vendor/ramsey/collection/src/AbstractArray.php index 2c6e0dedd..d72dbe697 100644 --- a/vendor/ramsey/collection/src/AbstractArray.php +++ b/vendor/ramsey/collection/src/AbstractArray.php @@ -25,7 +25,7 @@ use function unserialize; * the effort required to implement this interface. * * @template T - * @template-implements ArrayInterface<T> + * @implements ArrayInterface<T> */ abstract class AbstractArray implements ArrayInterface { @@ -54,6 +54,8 @@ abstract class AbstractArray implements ArrayInterface * Returns an iterator for this array. * * @link http://php.net/manual/en/iteratoraggregate.getiterator.php IteratorAggregate::getIterator() + * + * @return Traversable<array-key, T> */ public function getIterator(): Traversable { @@ -81,7 +83,10 @@ abstract class AbstractArray implements ArrayInterface * * @return T|null the value stored at the offset, or null if the offset * does not exist. + * + * @psalm-suppress InvalidAttribute */ + #[\ReturnTypeWillChange] // phpcs:ignore public function offsetGet($offset) { return $this->data[$offset] ?? null; @@ -121,6 +126,8 @@ abstract class AbstractArray implements ArrayInterface /** * 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. @@ -131,8 +138,23 @@ abstract class AbstractArray implements ArrayInterface } /** + * Returns data suitable for PHP serialization. + * + * @link https://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.serialize + * @link https://www.php.net/serialize + * + * @return array<array-key, T> + */ + public function __serialize(): array + { + 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. @@ -148,6 +170,16 @@ abstract class AbstractArray implements ArrayInterface } /** + * Adds unserialized data to the object. + * + * @param array<array-key, T> $data + */ + public function __unserialize(array $data): void + { + $this->data = $data; + } + + /** * Returns the number of items in this array. * * @link http://php.net/manual/en/countable.count.php Countable::count() diff --git a/vendor/ramsey/collection/src/AbstractCollection.php b/vendor/ramsey/collection/src/AbstractCollection.php index 2facf0e89..d2cd1151c 100644 --- a/vendor/ramsey/collection/src/AbstractCollection.php +++ b/vendor/ramsey/collection/src/AbstractCollection.php @@ -32,6 +32,7 @@ use function array_uintersect; use function current; use function end; use function in_array; +use function is_int; use function reset; use function sprintf; use function unserialize; @@ -42,8 +43,8 @@ use function usort; * minimize the effort required to implement this interface * * @template T - * @template-extends AbstractArray<T> - * @template-implements CollectionInterface<T> + * @extends AbstractArray<T> + * @implements CollectionInterface<T> */ abstract class AbstractCollection extends AbstractArray implements CollectionInterface { @@ -238,7 +239,7 @@ abstract class AbstractCollection extends AbstractArray implements CollectionInt public function merge(CollectionInterface ...$collections): CollectionInterface { - $temp = [$this->data]; + $mergedCollection = clone $this; foreach ($collections as $index => $collection) { if (!$collection instanceof static) { @@ -255,16 +256,16 @@ abstract class AbstractCollection extends AbstractArray implements CollectionInt ); } - $temp[] = $collection->toArray(); + foreach ($collection as $key => $value) { + if (is_int($key)) { + $mergedCollection[] = $value; + } else { + $mergedCollection[$key] = $value; + } + } } - /** @var array<array-key, T> $merge */ - $merge = array_merge(...$temp); - - $collection = clone $this; - $collection->data = $merge; - - return $collection; + return $mergedCollection; } /** diff --git a/vendor/ramsey/collection/src/AbstractSet.php b/vendor/ramsey/collection/src/AbstractSet.php index 3bd22965f..1126ccb0a 100644 --- a/vendor/ramsey/collection/src/AbstractSet.php +++ b/vendor/ramsey/collection/src/AbstractSet.php @@ -20,7 +20,7 @@ namespace Ramsey\Collection; * this specific type of collection. * * @template T - * @template-extends AbstractCollection<T> + * @extends AbstractCollection<T> */ abstract class AbstractSet extends AbstractCollection { diff --git a/vendor/ramsey/collection/src/ArrayInterface.php b/vendor/ramsey/collection/src/ArrayInterface.php index 19fbff336..27af6102b 100644 --- a/vendor/ramsey/collection/src/ArrayInterface.php +++ b/vendor/ramsey/collection/src/ArrayInterface.php @@ -23,6 +23,8 @@ use Serializable; * `ArrayInterface` provides traversable array functionality to data types. * * @template T + * @extends ArrayAccess<array-key, T> + * @extends IteratorAggregate<array-key, T> */ interface ArrayInterface extends ArrayAccess, diff --git a/vendor/ramsey/collection/src/Collection.php b/vendor/ramsey/collection/src/Collection.php index 2f8deddaa..1299c12c2 100644 --- a/vendor/ramsey/collection/src/Collection.php +++ b/vendor/ramsey/collection/src/Collection.php @@ -71,7 +71,7 @@ namespace Ramsey\Collection; * ``` * * @template T - * @template-extends AbstractCollection<T> + * @extends AbstractCollection<T> */ class Collection extends AbstractCollection { diff --git a/vendor/ramsey/collection/src/CollectionInterface.php b/vendor/ramsey/collection/src/CollectionInterface.php index dfef6ca86..aa86feb04 100644 --- a/vendor/ramsey/collection/src/CollectionInterface.php +++ b/vendor/ramsey/collection/src/CollectionInterface.php @@ -21,7 +21,7 @@ namespace Ramsey\Collection; * and others unordered. * * @template T - * @template-extends ArrayInterface<T> + * @extends ArrayInterface<T> */ interface CollectionInterface extends ArrayInterface { diff --git a/vendor/ramsey/collection/src/DoubleEndedQueue.php b/vendor/ramsey/collection/src/DoubleEndedQueue.php index 6ebdca5ad..c9c59502d 100644 --- a/vendor/ramsey/collection/src/DoubleEndedQueue.php +++ b/vendor/ramsey/collection/src/DoubleEndedQueue.php @@ -22,8 +22,8 @@ use Ramsey\Collection\Exception\NoSuchElementException; * minimize the effort required to implement this interface. * * @template T - * @template-extends Queue<T> - * @template-implements DoubleEndedQueueInterface<T> + * @extends Queue<T> + * @implements DoubleEndedQueueInterface<T> */ class DoubleEndedQueue extends Queue implements DoubleEndedQueueInterface { diff --git a/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php b/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php index 67aae5e2e..d7df53469 100644 --- a/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php +++ b/vendor/ramsey/collection/src/DoubleEndedQueueInterface.php @@ -160,7 +160,7 @@ use Ramsey\Collection\Exception\NoSuchElementException; * empty. * * @template T - * @template-extends QueueInterface<T> + * @extends QueueInterface<T> */ interface DoubleEndedQueueInterface extends QueueInterface { diff --git a/vendor/ramsey/collection/src/GenericArray.php b/vendor/ramsey/collection/src/GenericArray.php index 9b95df387..2b079aa5e 100644 --- a/vendor/ramsey/collection/src/GenericArray.php +++ b/vendor/ramsey/collection/src/GenericArray.php @@ -17,7 +17,7 @@ namespace Ramsey\Collection; /** * `GenericArray` represents a standard array object. * - * @template-extends AbstractArray<mixed> + * @extends AbstractArray<mixed> */ class GenericArray extends AbstractArray { diff --git a/vendor/ramsey/collection/src/Map/AbstractMap.php b/vendor/ramsey/collection/src/Map/AbstractMap.php index 70f71160c..ae9f2fe61 100644 --- a/vendor/ramsey/collection/src/Map/AbstractMap.php +++ b/vendor/ramsey/collection/src/Map/AbstractMap.php @@ -26,8 +26,8 @@ use function in_array; * effort required to implement this interface. * * @template T - * @template-extends AbstractArray<T> - * @template-implements MapInterface<T> + * @extends AbstractArray<T> + * @implements MapInterface<T> */ abstract class AbstractMap extends AbstractArray implements MapInterface { diff --git a/vendor/ramsey/collection/src/Map/AbstractTypedMap.php b/vendor/ramsey/collection/src/Map/AbstractTypedMap.php index ff9f69177..551d2e6c6 100644 --- a/vendor/ramsey/collection/src/Map/AbstractTypedMap.php +++ b/vendor/ramsey/collection/src/Map/AbstractTypedMap.php @@ -22,11 +22,10 @@ use Ramsey\Collection\Tool\ValueToStringTrait; * This class provides a basic implementation of `TypedMapInterface`, to * minimize the effort required to implement this interface. * - * @phpstan-ignore-next-line - * @template K as array-key + * @template K * @template T - * @template-extends AbstractMap<T> - * @template-implements TypedMapInterface<T> + * @extends AbstractMap<T> + * @implements TypedMapInterface<T> */ abstract class AbstractTypedMap extends AbstractMap implements TypedMapInterface { @@ -64,6 +63,7 @@ abstract class AbstractTypedMap extends AbstractMap implements TypedMapInterface ); } + /** @psalm-suppress MixedArgumentTypeCoercion */ parent::offsetSet($offset, $value); } } diff --git a/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php b/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php index 3274dc9de..79a314d96 100644 --- a/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php +++ b/vendor/ramsey/collection/src/Map/AssociativeArrayMap.php @@ -18,7 +18,7 @@ namespace Ramsey\Collection\Map; * `AssociativeArrayMap` represents a standard associative array object. * * @template T - * @template-extends AbstractMap<T> + * @extends AbstractMap<T> */ class AssociativeArrayMap extends AbstractMap { diff --git a/vendor/ramsey/collection/src/Map/MapInterface.php b/vendor/ramsey/collection/src/Map/MapInterface.php index 04e52a238..6ed0b2967 100644 --- a/vendor/ramsey/collection/src/Map/MapInterface.php +++ b/vendor/ramsey/collection/src/Map/MapInterface.php @@ -22,7 +22,7 @@ use Ramsey\Collection\ArrayInterface; * A map cannot contain duplicate keys; each key can map to at most one value. * * @template T - * @template-extends ArrayInterface<T> + * @extends ArrayInterface<T> */ interface MapInterface extends ArrayInterface { diff --git a/vendor/ramsey/collection/src/Map/NamedParameterMap.php b/vendor/ramsey/collection/src/Map/NamedParameterMap.php index ecc52f73a..9926ddd8c 100644 --- a/vendor/ramsey/collection/src/Map/NamedParameterMap.php +++ b/vendor/ramsey/collection/src/Map/NamedParameterMap.php @@ -26,7 +26,7 @@ use function is_int; * `NamedParameterMap` represents a mapping of values to a set of named keys * that may optionally be typed * - * @template-extends AbstractMap<mixed> + * @extends AbstractMap<mixed> */ class NamedParameterMap extends AbstractMap { diff --git a/vendor/ramsey/collection/src/Map/TypedMap.php b/vendor/ramsey/collection/src/Map/TypedMap.php index 752475fee..2e796377a 100644 --- a/vendor/ramsey/collection/src/Map/TypedMap.php +++ b/vendor/ramsey/collection/src/Map/TypedMap.php @@ -80,10 +80,9 @@ use Ramsey\Collection\Tool\TypeTrait; * } * ``` * - * @phpstan-ignore-next-line - * @template K as array-key + * @template K * @template T - * @template-extends AbstractTypedMap<K, T> + * @extends AbstractTypedMap<K, T> */ class TypedMap extends AbstractTypedMap { @@ -121,6 +120,8 @@ class TypedMap extends AbstractTypedMap { $this->keyType = $keyType; $this->valueType = $valueType; + + /** @psalm-suppress MixedArgumentTypeCoercion */ parent::__construct($data); } diff --git a/vendor/ramsey/collection/src/Map/TypedMapInterface.php b/vendor/ramsey/collection/src/Map/TypedMapInterface.php index 51b6a81a2..0308109cc 100644 --- a/vendor/ramsey/collection/src/Map/TypedMapInterface.php +++ b/vendor/ramsey/collection/src/Map/TypedMapInterface.php @@ -19,7 +19,7 @@ namespace Ramsey\Collection\Map; * typed. * * @template T - * @template-extends MapInterface<T> + * @extends MapInterface<T> */ interface TypedMapInterface extends MapInterface { diff --git a/vendor/ramsey/collection/src/Queue.php b/vendor/ramsey/collection/src/Queue.php index 4af2fdf76..93e032b43 100644 --- a/vendor/ramsey/collection/src/Queue.php +++ b/vendor/ramsey/collection/src/Queue.php @@ -24,8 +24,8 @@ use Ramsey\Collection\Tool\ValueToStringTrait; * the effort required to implement this interface. * * @template T - * @template-extends AbstractArray<T> - * @template-implements QueueInterface<T> + * @extends AbstractArray<T> + * @implements QueueInterface<T> */ class Queue extends AbstractArray implements QueueInterface { diff --git a/vendor/ramsey/collection/src/QueueInterface.php b/vendor/ramsey/collection/src/QueueInterface.php index 7ebbb5d06..8c7383df8 100644 --- a/vendor/ramsey/collection/src/QueueInterface.php +++ b/vendor/ramsey/collection/src/QueueInterface.php @@ -94,7 +94,7 @@ use Ramsey\Collection\Exception\NoSuchElementException; * `poll()` method to indicate that the queue contains no elements. * * @template T - * @template-extends ArrayInterface<T> + * @extends ArrayInterface<T> */ interface QueueInterface extends ArrayInterface { diff --git a/vendor/ramsey/collection/src/Set.php b/vendor/ramsey/collection/src/Set.php index ac1c5cbf0..6932f247a 100644 --- a/vendor/ramsey/collection/src/Set.php +++ b/vendor/ramsey/collection/src/Set.php @@ -36,7 +36,7 @@ namespace Ramsey\Collection; * ``` * * @template T - * @template-extends AbstractSet<T> + * @extends AbstractSet<T> */ class Set extends AbstractSet { |