From ba7bd350a5577e6ec2b5e479d2ddf5e5c8aa8a47 Mon Sep 17 00:00:00 2001 From: Dusan Kasan Date: Sun, 8 Mar 2020 22:25:46 +0100 Subject: [PATCH 1/3] allow better use of collection trait --- composer.lock | 612 ++++++++++++------ src/Collection.php | 16 +- src/CollectionInterface.php | 98 +-- src/CollectionTrait.php | 110 ++-- src/collection_functions.php | 104 +-- .../CustomPassthroughFunctionTest.php | 3 +- tests/scenarios/GroupingFlightsTest.php | 3 +- tests/spec/CollectionSpec.php | 9 +- 8 files changed, 607 insertions(+), 348 deletions(-) diff --git a/composer.lock b/composer.lock index 1447838..e6c9bce 100644 --- a/composer.lock +++ b/composer.lock @@ -55,34 +55,80 @@ ], "time": "2016-08-12T14:21:22+00:00" }, + { + "name": "composer/xdebug-handler", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/1ab9842d69e64fb3a01be6b656501032d1b78cb7", + "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0", + "psr/log": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "time": "2020-03-01T12:26:26+00:00" + }, { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^6.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -102,12 +148,12 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2015-06-14T21:17:01+00:00" + "time": "2019-10-21T16:45:58+00:00" }, { "name": "henrikbjorn/phpspec-code-coverage", @@ -154,25 +200,28 @@ }, { "name": "myclabs/deep-copy", - "version": "1.7.0", + "version": "1.9.5", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" + "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { @@ -195,36 +244,43 @@ "object", "object graph" ], - "time": "2017-10-19T19:58:43+00:00" + "time": "2020-01-17T21:11:47+00:00" }, { "name": "pdepend/pdepend", - "version": "2.2.4", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/pdepend/pdepend.git", - "reference": "b086687f3a01dc6bb92d633aef071d2c5dd0db06" + "reference": "daba1cf0a6edaf172fa02a17807ae29f4c1c7471" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/b086687f3a01dc6bb92d633aef071d2c5dd0db06", - "reference": "b086687f3a01dc6bb92d633aef071d2c5dd0db06", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/daba1cf0a6edaf172fa02a17807ae29f4c1c7471", + "reference": "daba1cf0a6edaf172fa02a17807ae29f4c1c7471", "shasum": "" }, "require": { "php": ">=5.3.7", - "symfony/config": "^2.3.0|^3", - "symfony/dependency-injection": "^2.3.0|^3", - "symfony/filesystem": "^2.3.0|^3" + "symfony/config": "^2.3.0|^3|^4|^5", + "symfony/dependency-injection": "^2.3.0|^3|^4|^5", + "symfony/filesystem": "^2.3.0|^3|^4|^5" }, "require-dev": { - "phpunit/phpunit": "^4.4.0,<4.8", + "easy-doc/easy-doc": "0.0.0 || ^1.2.3", + "gregwar/rst": "^1.0", + "phpunit/phpunit": "^4.8.35|^5.7", "squizlabs/php_codesniffer": "^2.0.0" }, "bin": [ "src/bin/pdepend" ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, "autoload": { "psr-4": { "PDepend\\": "src/main/php/PDepend" @@ -235,39 +291,37 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", - "time": "2016-03-10T15:15:04+00:00" + "time": "2020-02-08T12:06:13+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "~6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -289,38 +343,42 @@ "reflection", "static analysis" ], - "time": "2017-09-11T18:02:19+00:00" + "time": "2018-08-07T13:53:10+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.3.2", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2" + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bf329f6c1aadea3299f08ee804682b7c45b326a2", - "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" + "ext-filter": "^7.1", + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.0", + "webmozart/assert": "^1" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" + "doctrine/instantiator": "^1", + "mockery/mockery": "^1" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -331,44 +389,46 @@ { "name": "Mike van Riel", "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-10T14:09:06+00:00" + "time": "2020-02-22T12:28:44+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95", + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "ext-tokenizer": "^7.2", + "mockery/mockery": "~1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -381,34 +441,40 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2020-02-18T18:59:58+00:00" }, { "name": "phpmd/phpmd", - "version": "2.4.3", + "version": "2.8.2", "source": { "type": "git", "url": "https://github.com/phpmd/phpmd.git", - "reference": "2b9c2417a18696dfb578b38c116cd0ddc19b256e" + "reference": "714629ed782537f638fe23c4346637659b779a77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpmd/phpmd/zipball/2b9c2417a18696dfb578b38c116cd0ddc19b256e", - "reference": "2b9c2417a18696dfb578b38c116cd0ddc19b256e", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/714629ed782537f638fe23c4346637659b779a77", + "reference": "714629ed782537f638fe23c4346637659b779a77", "shasum": "" }, "require": { - "pdepend/pdepend": "^2.0.4", - "php": ">=5.3.0" + "composer/xdebug-handler": "^1.0", + "ext-xml": "*", + "pdepend/pdepend": "^2.7.1", + "php": ">=5.3.9" }, "require-dev": { - "phpunit/phpunit": "^4.0", + "easy-doc/easy-doc": "0.0.0 || ^1.3.2", + "gregwar/rst": "^1.0", + "mikey179/vfsstream": "^1.6.4", + "phpunit/phpunit": "^4.8.36 || ^5.7.27", "squizlabs/php_codesniffer": "^2.0" }, "bin": [ "src/bin/phpmd" ], - "type": "project", + "type": "library", "autoload": { "psr-0": { "PHPMD\\": "src/main/php" @@ -425,20 +491,20 @@ "homepage": "https://github.com/manuelpichler", "role": "Project Founder" }, - { - "name": "Other contributors", - "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", - "role": "Contributors" - }, { "name": "Marc Würth", "email": "ravage@bluewin.ch", "homepage": "https://github.com/ravage84", "role": "Project Maintainer" + }, + { + "name": "Other contributors", + "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", + "role": "Contributors" } ], "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", - "homepage": "http://phpmd.org/", + "homepage": "https://phpmd.org/", "keywords": [ "mess detection", "mess detector", @@ -446,7 +512,7 @@ "phpmd", "pmd" ], - "time": "2016-04-04T11:52:04+00:00" + "time": "2020-02-16T20:15:50+00:00" }, { "name": "phpspec/php-diff", @@ -570,38 +636,38 @@ }, { "name": "phpspec/prophecy", - "version": "1.8.0", + "version": "v1.10.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b4400efc9d206e83138e2bb97ed7f5b14b831cd9", + "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", + "phpspec/phpspec": "^2.5 || ^3.2", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -629,7 +695,7 @@ "spy", "stub" ], - "time": "2018-08-05T17:53:17+00:00" + "time": "2020-01-20T15:57:02+00:00" }, { "name": "phpunit/php-code-coverage", @@ -833,29 +899,29 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.12", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" + "reference": "791198a2c6254db10131eecfe8c06670700904db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^6.2.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -878,7 +944,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-12-04T08:55:13+00:00" + "time": "2017-11-27T05:48:46+00:00" }, { "name": "phpunit/phpunit", @@ -1021,6 +1087,102 @@ ], "time": "2017-06-30T09:13:00+00:00" }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/log", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2019-11-01T11:05:21+00:00" + }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.1", @@ -1536,16 +1698,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.4.0", + "version": "3.5.4", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "379deb987e26c7cd103a7b387aea178baec96e48" + "reference": "dceec07328401de6211037abbb18bda423677e26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/379deb987e26c7cd103a7b387aea178baec96e48", - "reference": "379deb987e26c7cd103a7b387aea178baec96e48", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26", + "reference": "dceec07328401de6211037abbb18bda423677e26", "shasum": "" }, "require": { @@ -1578,30 +1740,41 @@ } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", "standards" ], - "time": "2018-12-19T23:57:18+00:00" + "time": "2020-01-30T22:20:29+00:00" }, { "name": "symfony/config", - "version": "v3.1.0", + "version": "v4.4.5", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "048dc47e07f92333203c3b7045868bbc864fc40e" + "reference": "cbfef5ae91ccd3b06621c18d58cd355c68c87ae9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/048dc47e07f92333203c3b7045868bbc864fc40e", - "reference": "048dc47e07f92333203c3b7045868bbc864fc40e", + "url": "https://api.github.com/repos/symfony/config/zipball/cbfef5ae91ccd3b06621c18d58cd355c68c87ae9", + "reference": "cbfef5ae91ccd3b06621c18d58cd355c68c87ae9", "shasum": "" }, "require": { - "php": ">=5.5.9", - "symfony/filesystem": "~2.8|~3.0" + "php": "^7.1.3", + "symfony/filesystem": "^3.4|^4.0|^5.0", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/finder": "<3.4" + }, + "require-dev": { + "symfony/event-dispatcher": "^3.4|^4.0|^5.0", + "symfony/finder": "^3.4|^4.0|^5.0", + "symfony/messenger": "^4.1|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/yaml": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -1609,7 +1782,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -1636,24 +1809,25 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2016-05-20T11:48:17+00:00" + "time": "2020-02-04T09:32:40+00:00" }, { "name": "symfony/console", - "version": "v2.8.6", + "version": "v2.8.52", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "48221d3de4dc22d2cd57c97e8b9361821da86609" + "reference": "cbcf4b5e233af15cd2bbd50dee1ccc9b7927dc12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/48221d3de4dc22d2cd57c97e8b9361821da86609", - "reference": "48221d3de4dc22d2cd57c97e8b9361821da86609", + "url": "https://api.github.com/repos/symfony/console/zipball/cbcf4b5e233af15cd2bbd50dee1ccc9b7927dc12", + "reference": "cbcf4b5e233af15cd2bbd50dee1ccc9b7927dc12", "shasum": "" }, "require": { "php": ">=5.3.9", + "symfony/debug": "^2.7.2|~3.0.0", "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { @@ -1662,7 +1836,7 @@ "symfony/process": "~2.1|~3.0.0" }, "suggest": { - "psr/log": "For using the console logger", + "psr/log-implementation": "For using the console logger", "symfony/event-dispatcher": "", "symfony/process": "" }, @@ -1696,40 +1870,107 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-04-26T12:00:47+00:00" + "time": "2018-11-20T15:55:20+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a", + "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2016-07-30T07:22:48+00:00" }, { "name": "symfony/dependency-injection", - "version": "v3.1.0", + "version": "v3.3.18", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "383110341e8f47ae972da3a29503b099831549e1" + "reference": "54243abc4e1a1a15e274e391bd6f7090b44711f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/383110341e8f47ae972da3a29503b099831549e1", - "reference": "383110341e8f47ae972da3a29503b099831549e1", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/54243abc4e1a1a15e274e391bd6f7090b44711f1", + "reference": "54243abc4e1a1a15e274e391bd6f7090b44711f1", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8", + "psr/container": "^1.0" + }, + "conflict": { + "symfony/config": "<3.3.7", + "symfony/finder": "<3.3", + "symfony/yaml": "<3.3" + }, + "provide": { + "psr/container-implementation": "1.0" }, "require-dev": { - "symfony/config": "~2.8|~3.0", + "symfony/config": "~3.3", "symfony/expression-language": "~2.8|~3.0", - "symfony/yaml": "~2.8|~3.0" + "symfony/yaml": "~3.3" }, "suggest": { "symfony/config": "", "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -1756,31 +1997,34 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2016-05-24T10:06:56+00:00" + "time": "2018-01-29T09:02:23+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.2.14", + "version": "v3.4.38", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "b8de6ee252af19330dd72ad5fc0dd4658a1d6325" + "reference": "2f67a869aef3eecf42e7f8be4a8b86c92308686c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b8de6ee252af19330dd72ad5fc0dd4658a1d6325", - "reference": "b8de6ee252af19330dd72ad5fc0dd4658a1d6325", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2f67a869aef3eecf42e7f8be4a8b86c92308686c", + "reference": "2f67a869aef3eecf42e7f8be4a8b86c92308686c", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/dependency-injection": "", @@ -1789,7 +2033,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1816,29 +2060,30 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-06-02T08:26:05+00:00" + "time": "2020-02-04T08:04:52+00:00" }, { "name": "symfony/filesystem", - "version": "v3.1.0", + "version": "v5.0.5", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "5751e80d6f94b7c018f338a4a7be0b700d6f3058" + "reference": "3afadc0f57cd74f86379d073e694b0f2cda2a88c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/5751e80d6f94b7c018f338a4a7be0b700d6f3058", - "reference": "5751e80d6f94b7c018f338a4a7be0b700d6f3058", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3afadc0f57cd74f86379d073e694b0f2cda2a88c", + "reference": "3afadc0f57cd74f86379d073e694b0f2cda2a88c", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^7.2.5", + "symfony/polyfill-ctype": "~1.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1865,20 +2110,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-04-12T18:27:47+00:00" + "time": "2020-01-21T08:40:24+00:00" }, { "name": "symfony/finder", - "version": "v3.4.21", + "version": "v3.4.38", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "3f2a2ab6315dd7682d4c16dcae1e7b95c8b8555e" + "reference": "5ec813ccafa8164ef21757e8c725d3a57da59200" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/3f2a2ab6315dd7682d4c16dcae1e7b95c8b8555e", - "reference": "3f2a2ab6315dd7682d4c16dcae1e7b95c8b8555e", + "url": "https://api.github.com/repos/symfony/finder/zipball/5ec813ccafa8164ef21757e8c725d3a57da59200", + "reference": "5ec813ccafa8164ef21757e8c725d3a57da59200", "shasum": "" }, "require": { @@ -1914,20 +2159,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-01-01T13:45:19+00:00" + "time": "2020-02-14T07:34:21+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.10.0", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", "shasum": "" }, "require": { @@ -1939,7 +2184,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1955,13 +2200,13 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, { "name": "Gert de Pagter", "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony polyfill for ctype functions", @@ -1972,20 +2217,20 @@ "polyfill", "portable" ], - "time": "2018-08-06T14:22:27+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.2.0", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "dff51f72b0706335131b00a7f49606168c582594" + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", - "reference": "dff51f72b0706335131b00a7f49606168c582594", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", "shasum": "" }, "require": { @@ -1997,7 +2242,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -2031,20 +2276,20 @@ "portable", "shim" ], - "time": "2016-05-18T14:26:46+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/process", - "version": "v3.4.21", + "version": "v3.4.38", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "0d41dd7d95ed179aed6a13393b0f4f97bfa2d25c" + "reference": "b03b02dcea26ba4c65c16a73bab4f00c186b13da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/0d41dd7d95ed179aed6a13393b0f4f97bfa2d25c", - "reference": "0d41dd7d95ed179aed6a13393b0f4f97bfa2d25c", + "url": "https://api.github.com/repos/symfony/process/zipball/b03b02dcea26ba4c65c16a73bab4f00c186b13da", + "reference": "b03b02dcea26ba4c65c16a73bab4f00c186b13da", "shasum": "" }, "require": { @@ -2080,7 +2325,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-01-02T21:24:08+00:00" + "time": "2020-02-04T08:04:52+00:00" }, { "name": "symfony/yaml", @@ -2139,32 +2384,29 @@ }, { "name": "webmozart/assert", - "version": "1.4.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" + "reference": "aed98a490f9a8f78468232db345ab9cf606cf598" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", + "url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598", + "reference": "aed98a490f9a8f78468232db345ab9cf606cf598", "shasum": "" }, "require": { "php": "^5.3.3 || ^7.0", "symfony/polyfill-ctype": "^1.8" }, + "conflict": { + "vimeo/psalm": "<3.6.0" + }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -2186,7 +2428,7 @@ "check", "validate" ], - "time": "2018-12-25T11:19:39+00:00" + "time": "2020-02-14T12:15:55+00:00" } ], "aliases": [], diff --git a/src/Collection.php b/src/Collection.php index f8037a0..1c99d3c 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -45,7 +45,7 @@ public function __construct($input) * Static alias of normal constructor. * * @param callable|array|Traversable $input - * @return Collection + * @return CollectionInterface */ public static function from($input) { @@ -59,7 +59,7 @@ public static function from($input) * * @param mixed $input * @param callable $function - * @return Collection + * @return CollectionInterface */ public static function iterate($input, callable $function) { @@ -71,7 +71,7 @@ public static function iterate($input, callable $function) * * @param mixed $value * @param int $times - * @return Collection + * @return CollectionInterface */ public static function repeat($value, $times = -1) { @@ -84,7 +84,7 @@ public static function repeat($value, $times = -1) * @param int $start * @param int|null $end * @param int $step - * @return Collection + * @return CollectionInterface */ public static function range($start = 0, $end = null, $step = 1) { @@ -138,4 +138,12 @@ public function unserialize($serialized) { $this->input = dereferenceKeyValue(unserialize($serialized)); } + + /** + * @inheritDoc + */ + protected function buildFromCollection(Collection $collection) + { + return $collection; + } } diff --git a/src/CollectionInterface.php b/src/CollectionInterface.php index 98d3d33..fdb9882 100644 --- a/src/CollectionInterface.php +++ b/src/CollectionInterface.php @@ -17,14 +17,14 @@ public function toArray(); * Returns a lazy collection of items for which $function returned true. * * @param callable|null $function ($value, $key) - * @return Collection + * @return CollectionInterface */ public function filter(callable $function = null); /** * Returns a lazy collection of distinct items. The comparison is the same as in in_array. * - * @return Collection + * @return CollectionInterface */ public function distinct(); @@ -32,7 +32,7 @@ public function distinct(); * Returns a lazy collection with items from all $collections passed as argument appended together * * @param array|\Traversable ...$collections - * @return Collection + * @return CollectionInterface */ public function concat(...$collections); @@ -40,7 +40,7 @@ public function concat(...$collections); * Returns collection where each item is changed to the output of executing $function on each key/item. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function map(callable $function); @@ -63,7 +63,7 @@ public function reduce(callable $function, $startValue, $convertToCollection = f * is passed. * * @param int $depth How many levels should be flatten, default (-1) is infinite. - * @return Collection + * @return CollectionInterface */ public function flatten($depth = -1); @@ -72,7 +72,7 @@ public function flatten($depth = -1); * return true if first item is larger than the second and false otherwise. * * @param callable $function ($value1, $value2, $key1, $key2) - * @return Collection + * @return CollectionInterface */ public function sort(callable $function); @@ -82,7 +82,7 @@ public function sort(callable $function); * * @param int $from * @param int $to If omitted, will slice until end - * @return Collection + * @return CollectionInterface */ public function slice($from, $to = -1); @@ -90,7 +90,7 @@ public function slice($from, $to = -1); * Returns collection which items are separated into groups indexed by the return value of $function. * * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ public function groupBy(callable $function); @@ -98,7 +98,7 @@ public function groupBy(callable $function); * Returns collection where items are separated into groups indexed by the value at given key. * * @param mixed $key - * @return Collection + * @return CollectionInterface */ public function groupByKey($key); @@ -106,7 +106,7 @@ public function groupByKey($key); * Returns a lazy collection in which $function is executed for each item. * * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ public function each(callable $function); @@ -158,7 +158,7 @@ public function find(callable $function, $default = null, $convertToCollection = * items in this collection for which the $function returned this value. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function countBy(callable $function); @@ -167,7 +167,7 @@ public function countBy(callable $function); * that item. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function indexBy(callable $function); @@ -198,7 +198,7 @@ public function contains($value); /** * Returns collection of items in this collection in reverse order. * - * @return Collection + * @return CollectionInterface */ public function reverse(); @@ -217,7 +217,7 @@ public function reduceRight(callable $function, $startValue, $convertToCollectio * A form of slice that returns first $numberOfItems items. * * @param int $numberOfItems - * @return Collection + * @return CollectionInterface */ public function take($numberOfItems); @@ -225,14 +225,14 @@ public function take($numberOfItems); * A form of slice that returns all but first $numberOfItems items. * * @param int $numberOfItems - * @return Collection + * @return CollectionInterface */ public function drop($numberOfItems); /** * Returns collection of values from this collection but with keys being numerical from 0 upwards. * - * @return Collection + * @return CollectionInterface */ public function values(); @@ -240,14 +240,14 @@ public function values(); * Returns a lazy collection without elements matched by $function. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function reject(callable $function); /** * Returns a lazy collection of the keys of this collection. * - * @return Collection + * @return CollectionInterface */ public function keys(); @@ -255,7 +255,7 @@ public function keys(); * Returns a lazy collection of items of this collection separated by $separator * * @param mixed $separator - * @return Collection + * @return CollectionInterface */ public function interpose($separator); @@ -263,7 +263,7 @@ public function interpose($separator); * Returns a lazy collection with last $numberOfItems items skipped. These are still iterated over, just skipped. * * @param int $numberOfItems - * @return Collection + * @return CollectionInterface */ public function dropLast($numberOfItems = 1); @@ -272,14 +272,14 @@ public function dropLast($numberOfItems = 1); * so on. Accepts any number of collections. * * @param array|\Traversable ...$collections - * @return Collection + * @return CollectionInterface */ public function interleave(...$collections); /** * Returns an infinite lazy collection of items in this collection repeated infinitely. * - * @return Collection + * @return CollectionInterface */ public function cycle(); @@ -289,7 +289,7 @@ public function cycle(); * * @param mixed $value * @param mixed|null $key - * @return Collection + * @return CollectionInterface */ public function prepend($value, $key = null); @@ -299,7 +299,7 @@ public function prepend($value, $key = null); * * @param mixed $value * @param mixed $key - * @return Collection + * @return CollectionInterface */ public function append($value, $key = null); @@ -308,7 +308,7 @@ public function append($value, $key = null); * false. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function dropWhile(callable $function); @@ -316,7 +316,7 @@ public function dropWhile(callable $function); * Returns a lazy collection which is a result of calling map($function) and then flatten(1) * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function mapcat(callable $function); @@ -325,7 +325,7 @@ public function mapcat(callable $function); * returns false. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function takeWhile(callable $function); @@ -333,7 +333,7 @@ public function takeWhile(callable $function); * Returns a collection of [take($position), drop($position)] * * @param int $position - * @return Collection + * @return CollectionInterface */ public function splitAt($position); @@ -341,7 +341,7 @@ public function splitAt($position); * Returns a collection of [takeWhile($predicament), dropWhile($predicament] * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function splitWith(callable $function); @@ -350,7 +350,7 @@ public function splitWith(callable $function); * are replaced by their values. * * @param array|\Traversable $replacementMap - * @return Collection + * @return CollectionInterface */ public function replace($replacementMap); @@ -359,7 +359,7 @@ public function replace($replacementMap); * * @param callable $function * @param mixed $startValue - * @return Collection + * @return CollectionInterface */ public function reductions(callable $function, $startValue); @@ -367,14 +367,14 @@ public function reductions(callable $function, $startValue); * Returns a lazy collection of every nth item in this collection * * @param int $step - * @return Collection + * @return CollectionInterface */ public function takeNth($step); /** * Returns a non-collection of shuffled items from this collection * - * @return Collection + * @return CollectionInterface */ public function shuffle(); @@ -388,7 +388,7 @@ public function shuffle(); * @param int $numberOfItems * @param int $step * @param array|\Traversable $padding - * @return Collection + * @return CollectionInterface */ public function partition($numberOfItems, $step = 0, $padding = []); @@ -397,7 +397,7 @@ public function partition($numberOfItems, $step = 0, $padding = []); * return different result. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function partitionBy(callable $function); @@ -419,7 +419,7 @@ public function isNotEmpty(); * Returns a collection where keys are distinct items from this collection and their values are number of * occurrences of each value. * - * @return Collection + * @return CollectionInterface */ public function frequencies(); @@ -446,7 +446,7 @@ public function last($convertToCollection = false); /** * Realizes collection - turns lazy collection into non-lazy one by iterating over it and storing the key/values. * - * @return Collection + * @return CollectionInterface */ public function realize(); @@ -466,7 +466,7 @@ public function second($convertToCollection = false); * has length equal to the size of smaller collection. * * @param array|\Traversable $collection - * @return Collection + * @return CollectionInterface * @throws \DusanKasan\Knapsack\Exceptions\ItemNotFound */ public function combine($collection); @@ -475,7 +475,7 @@ public function combine($collection); * Returns a lazy collection without the items associated to any of the keys from $keys. * * @param array|\Traversable $keys - * @return Collection + * @return CollectionInterface */ public function except($keys); @@ -483,7 +483,7 @@ public function except($keys); * Returns a lazy collection of items associated to any of the keys from $keys. * * @param array|\Traversable $keys - * @return Collection + * @return CollectionInterface */ public function only($keys); @@ -492,14 +492,14 @@ public function only($keys); * keys from the first collection. Note that the ...$collections are iterated non-lazily. * * @param array|\Traversable ...$collections - * @return Collection + * @return CollectionInterface */ public function diff(...$collections); /** * Returns a lazy collection where keys and values are flipped. * - * @return Collection + * @return CollectionInterface */ public function flip(); @@ -516,7 +516,7 @@ public function has($key); * passed collection. Stops when any of the collections don't have an item at the nth position. * * @param array|\Traversable ...$collections - * @return Collection + * @return CollectionInterface */ public function zip(...$collections); @@ -524,7 +524,7 @@ public function zip(...$collections); * Uses a $transformer callable that takes a Collection and returns Collection on itself. * * @param callable $transformer Collection => Collection - * @return Collection + * @return CollectionInterface * @throws InvalidReturnValue */ public function transform(callable $transformer); @@ -533,7 +533,7 @@ public function transform(callable $transformer); * Transpose each item in a collection, interchanging the row and column indexes. * Can only transpose collections of collections. Otherwise an InvalidArgument is raised. * - * @return Collection + * @return CollectionInterface */ public function transpose(); @@ -542,7 +542,7 @@ public function transpose(); * it must be escaped using \ character. * * @param mixed $keyPath - * @return Collection + * @return CollectionInterface */ public function extract($keyPath); @@ -551,7 +551,7 @@ public function extract($keyPath); * the first collection. Note that the ...$collections are iterated non-lazily. * * @param array|\Traversable ...$collections - * @return Collection + * @return CollectionInterface */ public function intersect(...$collections); @@ -629,7 +629,7 @@ public function toString(); * $replacementMap are replaced by their values. * * @param array|\Traversable $replacementMap - * @return Collection + * @return CollectionInterface */ public function replaceByKeys($replacementMap); @@ -664,7 +664,7 @@ public function dump($maxItemsPerCollection = null, $maxDepth = null); * * @param int|null $maxItemsPerCollection * @param int|null $maxDepth - * @return Collection + * @return CollectionInterface */ public function printDump($maxItemsPerCollection = null, $maxDepth = null); } \ No newline at end of file diff --git a/src/CollectionTrait.php b/src/CollectionTrait.php index 7ce1f11..b805358 100644 --- a/src/CollectionTrait.php +++ b/src/CollectionTrait.php @@ -20,17 +20,17 @@ public function toArray() * Returns a lazy collection of items for which $function returned true. * * @param callable|null $function ($value, $key) - * @return Collection + * @return CollectionInterface */ public function filter(callable $function = null) { - return filter($this->getItems(), $function); + return $this->buildFromCollection(filter($this->getItems(), $function)); } /** * Returns a lazy collection of distinct items. The comparison is the same as in in_array. * - * @return Collection + * @return CollectionInterface */ public function distinct() { @@ -41,7 +41,7 @@ public function distinct() * Returns a lazy collection with items from all $collections passed as argument appended together * * @param array|\Traversable ...$collections - * @return Collection + * @return CollectionInterface */ public function concat(...$collections) { @@ -52,7 +52,7 @@ public function concat(...$collections) * Returns collection where each item is changed to the output of executing $function on each key/item. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function map(callable $function) { @@ -83,7 +83,7 @@ public function reduce(callable $function, $startValue, $convertToCollection = f * is passed. * * @param int $depth How many levels should be flatten, default (-1) is infinite. - * @return Collection + * @return CollectionInterface */ public function flatten($depth = -1) { @@ -95,7 +95,7 @@ public function flatten($depth = -1) * return true if first item is larger than the second and false otherwise. * * @param callable $function ($value1, $value2, $key1, $key2) - * @return Collection + * @return CollectionInterface */ public function sort(callable $function) { @@ -108,7 +108,7 @@ public function sort(callable $function) * * @param int $from * @param int $to If omitted, will slice until end - * @return Collection + * @return CollectionInterface */ public function slice($from, $to = -1) { @@ -119,7 +119,7 @@ public function slice($from, $to = -1) * Returns collection which items are separated into groups indexed by the return value of $function. * * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ public function groupBy(callable $function) { @@ -130,7 +130,7 @@ public function groupBy(callable $function) * Returns collection where items are separated into groups indexed by the value at given key. * * @param mixed $key - * @return Collection + * @return CollectionInterface */ public function groupByKey($key) { @@ -141,7 +141,7 @@ public function groupByKey($key) * Returns a lazy collection in which $function is executed for each item. * * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ public function each(callable $function) { @@ -214,7 +214,7 @@ public function find(callable $function, $default = null, $convertToCollection = * items in this collection for which the $function returned this value. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function countBy(callable $function) { @@ -226,7 +226,7 @@ public function countBy(callable $function) * that item. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function indexBy(callable $function) { @@ -269,7 +269,7 @@ public function contains($value) /** * Returns collection of items in this collection in reverse order. * - * @return Collection + * @return CollectionInterface */ public function reverse() { @@ -296,7 +296,7 @@ public function reduceRight(callable $function, $startValue, $convertToCollectio * A form of slice that returns first $numberOfItems items. * * @param int $numberOfItems - * @return Collection + * @return CollectionInterface */ public function take($numberOfItems) { @@ -307,7 +307,7 @@ public function take($numberOfItems) * A form of slice that returns all but first $numberOfItems items. * * @param int $numberOfItems - * @return Collection + * @return CollectionInterface */ public function drop($numberOfItems) { @@ -317,7 +317,7 @@ public function drop($numberOfItems) /** * Returns collection of values from this collection but with keys being numerical from 0 upwards. * - * @return Collection + * @return CollectionInterface */ public function values() { @@ -328,7 +328,7 @@ public function values() * Returns a lazy collection without elements matched by $function. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function reject(callable $function) { @@ -338,7 +338,7 @@ public function reject(callable $function) /** * Returns a lazy collection of the keys of this collection. * - * @return Collection + * @return CollectionInterface */ public function keys() { @@ -349,7 +349,7 @@ public function keys() * Returns a lazy collection of items of this collection separated by $separator * * @param mixed $separator - * @return Collection + * @return CollectionInterface */ public function interpose($separator) { @@ -360,7 +360,7 @@ public function interpose($separator) * Returns a lazy collection with last $numberOfItems items skipped. These are still iterated over, just skipped. * * @param int $numberOfItems - * @return Collection + * @return CollectionInterface */ public function dropLast($numberOfItems = 1) { @@ -372,7 +372,7 @@ public function dropLast($numberOfItems = 1) * so on. Accepts any number of collections. * * @param array|\Traversable ...$collections - * @return Collection + * @return CollectionInterface */ public function interleave(...$collections) { @@ -382,7 +382,7 @@ public function interleave(...$collections) /** * Returns an infinite lazy collection of items in this collection repeated infinitely. * - * @return Collection + * @return CollectionInterface */ public function cycle() { @@ -395,7 +395,7 @@ public function cycle() * * @param mixed $value * @param mixed|null $key - * @return Collection + * @return CollectionInterface */ public function prepend($value, $key = null) { @@ -408,7 +408,7 @@ public function prepend($value, $key = null) * * @param mixed $value * @param mixed $key - * @return Collection + * @return CollectionInterface */ public function append($value, $key = null) { @@ -420,7 +420,7 @@ public function append($value, $key = null) * false. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function dropWhile(callable $function) { @@ -431,7 +431,7 @@ public function dropWhile(callable $function) * Returns a lazy collection which is a result of calling map($function) and then flatten(1) * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function mapcat(callable $function) { @@ -443,7 +443,7 @@ public function mapcat(callable $function) * returns false. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function takeWhile(callable $function) { @@ -454,7 +454,7 @@ public function takeWhile(callable $function) * Returns a collection of [take($position), drop($position)] * * @param int $position - * @return Collection + * @return CollectionInterface */ public function splitAt($position) { @@ -465,7 +465,7 @@ public function splitAt($position) * Returns a collection of [takeWhile($predicament), dropWhile($predicament] * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function splitWith(callable $function) { @@ -477,7 +477,7 @@ public function splitWith(callable $function) * are replaced by their values. * * @param array|\Traversable $replacementMap - * @return Collection + * @return CollectionInterface */ public function replace($replacementMap) { @@ -489,7 +489,7 @@ public function replace($replacementMap) * * @param callable $function * @param mixed $startValue - * @return Collection + * @return CollectionInterface */ public function reductions(callable $function, $startValue) { @@ -500,7 +500,7 @@ public function reductions(callable $function, $startValue) * Returns a lazy collection of every nth item in this collection * * @param int $step - * @return Collection + * @return CollectionInterface */ public function takeNth($step) { @@ -510,7 +510,7 @@ public function takeNth($step) /** * Returns a non-collection of shuffled items from this collection * - * @return Collection + * @return CollectionInterface */ public function shuffle() { @@ -527,7 +527,7 @@ public function shuffle() * @param int $numberOfItems * @param int $step * @param array|\Traversable $padding - * @return Collection + * @return CollectionInterface */ public function partition($numberOfItems, $step = 0, $padding = []) { @@ -539,7 +539,7 @@ public function partition($numberOfItems, $step = 0, $padding = []) * return different result. * * @param callable $function - * @return Collection + * @return CollectionInterface */ public function partitionBy(callable $function) { @@ -570,7 +570,7 @@ public function isNotEmpty() * Returns a collection where keys are distinct items from this collection and their values are number of * occurrences of each value. * - * @return Collection + * @return CollectionInterface */ public function frequencies() { @@ -610,7 +610,7 @@ public function last($convertToCollection = false) /** * Realizes collection - turns lazy collection into non-lazy one by iterating over it and storing the key/values. * - * @return Collection + * @return CollectionInterface */ public function realize() { @@ -638,7 +638,7 @@ public function second($convertToCollection = false) * has length equal to the size of smaller collection. * * @param array|\Traversable $collection - * @return Collection + * @return CollectionInterface * @throws \DusanKasan\Knapsack\Exceptions\ItemNotFound */ public function combine($collection) @@ -650,7 +650,7 @@ public function combine($collection) * Returns a lazy collection without the items associated to any of the keys from $keys. * * @param array|\Traversable $keys - * @return Collection + * @return CollectionInterface */ public function except($keys) { @@ -661,7 +661,7 @@ public function except($keys) * Returns a lazy collection of items associated to any of the keys from $keys. * * @param array|\Traversable $keys - * @return Collection + * @return CollectionInterface */ public function only($keys) { @@ -673,7 +673,7 @@ public function only($keys) * keys from the first collection. Note that the ...$collections are iterated non-lazily. * * @param array|\Traversable ...$collections - * @return Collection + * @return CollectionInterface */ public function diff(...$collections) { @@ -683,7 +683,7 @@ public function diff(...$collections) /** * Returns a lazy collection where keys and values are flipped. * - * @return Collection + * @return CollectionInterface */ public function flip() { @@ -706,7 +706,7 @@ public function has($key) * passed collection. Stops when any of the collections don't have an item at the nth position. * * @param array|\Traversable ...$collections - * @return Collection + * @return CollectionInterface */ public function zip(...$collections) { @@ -719,16 +719,16 @@ public function zip(...$collections) * Uses a $transformer callable that takes a Collection and returns Collection on itself. * * @param callable $transformer Collection => Collection - * @return Collection + * @return CollectionInterface * @throws InvalidReturnValue */ public function transform(callable $transformer) { $items = $this->getItems(); - $transformed = $transformer($items instanceof Collection ? $items : new Collection($items)); + $transformed = $transformer($items instanceof CollectionInterface ? $items : new Collection($items)); - if (!($transformed instanceof Collection)) { + if (!($transformed instanceof CollectionInterface)) { throw new InvalidReturnValue; } @@ -739,7 +739,7 @@ public function transform(callable $transformer) * Transpose each item in a collection, interchanging the row and column indexes. * Can only transpose collections of collections. Otherwise an InvalidArgument is raised. * - * @return Collection + * @return CollectionInterface */ public function transpose() { @@ -751,7 +751,7 @@ public function transpose() * it must be escaped using \ character. * * @param mixed $keyPath - * @return Collection + * @return CollectionInterface */ public function extract($keyPath) { @@ -763,7 +763,7 @@ public function extract($keyPath) * the first collection. Note that the ...$collections are iterated non-lazily. * * @param array|\Traversable ...$collections - * @return Collection + * @return CollectionInterface */ public function intersect(...$collections) { @@ -871,7 +871,7 @@ public function toString() * $replacementMap are replaced by their values. * * @param array|\Traversable $replacementMap - * @return Collection + * @return CollectionInterface */ public function replaceByKeys($replacementMap) { @@ -912,7 +912,7 @@ public function dump($maxItemsPerCollection = null, $maxDepth = null) * * @param int|null $maxItemsPerCollection * @param int|null $maxDepth - * @return Collection + * @return CollectionInterface */ public function printDump($maxItemsPerCollection = null, $maxDepth = null) { @@ -926,4 +926,10 @@ protected function getItems() { return $this; } + + /** + * @param Collection $collection + * @return CollectionInterface + */ + protected abstract function buildFromCollection(CollectionInterface $collection); } diff --git a/src/collection_functions.php b/src/collection_functions.php index cdd797e..29f1a2c 100644 --- a/src/collection_functions.php +++ b/src/collection_functions.php @@ -24,7 +24,7 @@ function toArray($collection) * Returns a lazy collection of distinct items in $collection. * * @param array|Traversable $collection - * @return Collection + * @return CollectionInterface */ function distinct($collection) { @@ -62,7 +62,7 @@ function size($collection) * Returns a non-lazy collection with items from $collection in reversed order. * * @param array|Traversable $collection - * @return Collection + * @return CollectionInterface */ function reverse($collection) { @@ -92,7 +92,7 @@ function ($item) { * Returns a lazy collection of values from $collection (i.e. the keys are reset). * * @param array|Traversable $collection - * @return Collection + * @return CollectionInterface */ function values($collection) { @@ -109,7 +109,7 @@ function values($collection) * Returns a lazy collection of keys from $collection. * * @param array|Traversable $collection - * @return Collection + * @return CollectionInterface */ function keys($collection) { @@ -126,7 +126,7 @@ function keys($collection) * Returns a lazy collection of items from $collection repeated infinitely. * * @param array|Traversable $collection - * @return Collection + * @return CollectionInterface */ function cycle($collection) { @@ -145,7 +145,7 @@ function cycle($collection) * Returns a non-lazy collection of shuffled items from $collection. * * @param array|Traversable $collection - * @return Collection + * @return CollectionInterface */ function shuffle($collection) { @@ -190,7 +190,7 @@ function isNotEmpty($collection) * value. * * @param array|Traversable $collection - * @return Collection + * @return CollectionInterface */ function frequencies($collection) { @@ -225,7 +225,7 @@ function last($collection) * * @param array|Traversable $collection * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ function map($collection, callable $function) { @@ -243,7 +243,7 @@ function map($collection, callable $function) * * @param array|Traversable $collection * @param callable|null $function ($value, $key) - * @return Collection + * @return CollectionInterface */ function filter($collection, callable $function = null) { @@ -268,7 +268,7 @@ function filter($collection, callable $function = null) * Returns a lazy collection with items from all $collections passed as argument appended together * * @param array|Traversable ...$collections - * @return Collection + * @return CollectionInterface */ function concat(...$collections) { @@ -310,7 +310,7 @@ function reduce($collection, callable $function, $startValue) * * @param array|Traversable $collection * @param int $levelsToFlatten -1 to flatten everything - * @return Collection + * @return CollectionInterface */ function flatten($collection, $levelsToFlatten = -1) { @@ -338,7 +338,7 @@ function flatten($collection, $levelsToFlatten = -1) * * @param array|Traversable $collection * @param callable $function ($value1, $value2, $key1, $key2) - * @return Collection + * @return CollectionInterface */ function sort($collection, callable $function) { @@ -371,7 +371,7 @@ function ($a, $b) use ($function) { * @param array|Traversable $collection * @param int $from * @param int $to -1 to slice until end - * @return Collection + * @return CollectionInterface */ function slice($collection, $from, $to = -1) { @@ -396,7 +396,7 @@ function slice($collection, $from, $to = -1) * * @param array|Traversable $collection * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ function groupBy($collection, callable $function) { @@ -420,7 +420,7 @@ function groupBy($collection, callable $function) * * @param array|Traversable $collection * @param mixed $key - * @return Collection + * @return CollectionInterface */ function groupByKey($collection, $key) { @@ -446,7 +446,7 @@ function ($value) use ($key) { * * @param array|Traversable $collection * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ function each($collection, callable $function) { @@ -522,7 +522,7 @@ function find($collection, callable $function, $default = null) * * @param array|Traversable $collection * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ function indexBy($collection, callable $function) { @@ -541,7 +541,7 @@ function indexBy($collection, callable $function) * * @param array|Traversable $collection * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ function countBy($collection, callable $function) { @@ -623,7 +623,7 @@ function reduceRight($collection, callable $function, $startValue) * * @param array|Traversable $collection * @param int $numberOfItems - * @return Collection + * @return CollectionInterface */ function take($collection, $numberOfItems) { @@ -635,7 +635,7 @@ function take($collection, $numberOfItems) * * @param array|Traversable $collection * @param int $numberOfItems - * @return Collection + * @return CollectionInterface */ function drop($collection, $numberOfItems) { @@ -649,7 +649,7 @@ function drop($collection, $numberOfItems) * * @param mixed $value * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ function iterate($value, callable $function) { @@ -677,7 +677,7 @@ function iterate($value, callable $function) * * @param array|Traversable $collection * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ function reject($collection, callable $function) { @@ -694,7 +694,7 @@ function ($value, $key) use ($function) { * * @param array|Traversable $collection * @param int $numberOfItems - * @return Collection + * @return CollectionInterface */ function dropLast($collection, $numberOfItems = 1) { @@ -719,7 +719,7 @@ function dropLast($collection, $numberOfItems = 1) * * @param array|Traversable $collection * @param mixed $separator - * @return Collection + * @return CollectionInterface */ function interpose($collection, $separator) { @@ -742,7 +742,7 @@ function interpose($collection, $separator) * so on. Accepts any number of collections. * * @param array|Traversable ...$collections - * @return Collection + * @return CollectionInterface */ function interleave(...$collections) { @@ -779,7 +779,7 @@ function ($collection) { * @param array|Traversable $collection * @param mixed $value * @param mixed|null $key - * @return Collection + * @return CollectionInterface */ function prepend($collection, $value, $key = null) { @@ -805,7 +805,7 @@ function prepend($collection, $value, $key = null) * @param array|Traversable $collection * @param mixed $value * @param mixed|null $key - * @return Collection + * @return CollectionInterface */ function append($collection, $value, $key = null) { @@ -829,7 +829,7 @@ function append($collection, $value, $key = null) * * @param array|Traversable $collection * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ function dropWhile($collection, callable $function) { @@ -854,7 +854,7 @@ function dropWhile($collection, callable $function) * * @param array|Traversable $collection * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ function takeWhile($collection, callable $function) { @@ -879,7 +879,7 @@ function takeWhile($collection, callable $function) * * @param array|Traversable $collection * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ function mapcat($collection, callable $function) { @@ -891,7 +891,7 @@ function mapcat($collection, callable $function) * * @param array|Traversable $collection * @param int $position - * @return Collection + * @return CollectionInterface */ function splitAt($collection, $position) { @@ -908,7 +908,7 @@ function splitAt($collection, $position) * * @param array|Traversable $collection * @param callable $function ($value, $key) - * @return Collection + * @return CollectionInterface */ function splitWith($collection, callable $function) { @@ -926,7 +926,7 @@ function splitWith($collection, callable $function) * * @param array|Traversable $collection * @param array|Traversable $replacementMap - * @return Collection + * @return CollectionInterface */ function replace($collection, $replacementMap) { @@ -946,7 +946,7 @@ function replace($collection, $replacementMap) * @param array|Traversable $collection * @param callable $function * @param mixed $startValue - * @return Collection + * @return CollectionInterface */ function reductions($collection, callable $function, $startValue) { @@ -968,7 +968,7 @@ function reductions($collection, callable $function, $startValue) * * @param array|Traversable $collection * @param int $step - * @return Collection + * @return CollectionInterface */ function takeNth($collection, $step) { @@ -997,7 +997,7 @@ function takeNth($collection, $step) * @param int $numberOfItems * @param int $step * @param array|Traversable $padding - * @return Collection + * @return CollectionInterface */ function partition($collection, $numberOfItems, $step = -1, $padding = []) { @@ -1035,7 +1035,7 @@ function partition($collection, $numberOfItems, $step = -1, $padding = []) * * @param array|Traversable $collection * @param callable $function - * @return Collection + * @return CollectionInterface */ function partitionBy($collection, callable $function) { @@ -1068,7 +1068,7 @@ function partitionBy($collection, callable $function) * * @param mixed $value * @param int $times - * @return Collection + * @return CollectionInterface */ function repeat($value, $times = -1) { @@ -1091,7 +1091,7 @@ function repeat($value, $times = -1) * @param int $start * @param int|null $end * @param int $step - * @return Collection + * @return CollectionInterface */ function range($start = 0, $end = null, $step = 1) { @@ -1153,7 +1153,7 @@ function ($i) { * Transforms [[$key, $value], [$key2, $value2]] into [$key => $value, $key2 => $value2]. Used as a helper * * @param array|Traversable $collection - * @return Collection + * @return CollectionInterface */ function dereferenceKeyValue($collection) { @@ -1170,7 +1170,7 @@ function dereferenceKeyValue($collection) * Realizes collection - turns lazy collection into non-lazy one by iterating over it and storing the key/values. * * @param array|Traversable $collection - * @return Collection + * @return CollectionInterface */ function realize($collection) { @@ -1203,7 +1203,7 @@ function second($collection) * * @param array|Traversable $keys * @param array|Traversable $values - * @return Collection + * @return CollectionInterface */ function combine($keys, $values) { @@ -1230,7 +1230,7 @@ function combine($keys, $values) * * @param array|Traversable $collection * @param array|Traversable $keys - * @return Collection + * @return CollectionInterface */ function except($collection, $keys) { @@ -1249,7 +1249,7 @@ function ($value, $key) use ($keys) { * * @param array|Traversable $collection * @param array|Traversable $keys - * @return Collection + * @return CollectionInterface */ function only($collection, $keys) { @@ -1269,7 +1269,7 @@ function ($value, $key) use ($keys) { * * @param array|Traversable $collection * @param array|Traversable ...$collections - * @return Collection + * @return CollectionInterface */ function diff($collection, ...$collections) { @@ -1291,7 +1291,7 @@ function diff($collection, ...$collections) * * @param array|Traversable $collection * @param array|Traversable ...$collections - * @return Collection + * @return CollectionInterface */ function intersect($collection, ...$collections) { @@ -1311,7 +1311,7 @@ function intersect($collection, ...$collections) * Returns a lazy collection where keys and values are flipped. * * @param array|Traversable $collection - * @return Collection + * @return CollectionInterface */ function flip($collection) { @@ -1346,7 +1346,7 @@ function has($collection, $key) * any of the collections don't have an item at the nth position. * * @param array|Traversable ...$collections - * @return Collection + * @return CollectionInterface */ function zip(...$collections) { @@ -1391,12 +1391,12 @@ function ($collection) { * Can only transpose collections of collections. Otherwise an InvalidArgument is raised. * * @param Collection[] $collection - * @return Collection + * @return CollectionInterface */ function transpose($collection) { if (some($collection, function ($value) { - return !($value instanceof Collection); + return !($value instanceof CollectionInterface); })) { throw new InvalidArgument('Can only transpose collections of collections.'); } @@ -1422,7 +1422,7 @@ function (...$items) { * * @param array|Traversable $collection * @param mixed $keyPath - * @return Collection + * @return CollectionInterface */ function extract($collection, $keyPath) { @@ -1648,7 +1648,7 @@ function toString($collection) * * @param array|Traversable $collection * @param array|Traversable $replacementMap - * @return Collection + * @return CollectionInterface */ function replaceByKeys($collection, $replacementMap) { diff --git a/tests/scenarios/CustomPassthroughFunctionTest.php b/tests/scenarios/CustomPassthroughFunctionTest.php index 177e860..b837c9f 100644 --- a/tests/scenarios/CustomPassthroughFunctionTest.php +++ b/tests/scenarios/CustomPassthroughFunctionTest.php @@ -3,6 +3,7 @@ namespace DusanKasan\Knapsack\Tests\Scenarios; use DusanKasan\Knapsack\Collection; +use DusanKasan\Knapsack\CollectionInterface; use PHPUnit_Framework_TestCase; class CustomPassthroughFunctionTest extends PHPUnit_Framework_TestCase @@ -33,7 +34,7 @@ public function testIt() ]; //Must take and return a Collection - $transpose = function (Collection $collections) { + $transpose = function (CollectionInterface $collections) { $transposed = array_map( function (...$items) { return $items; diff --git a/tests/scenarios/GroupingFlightsTest.php b/tests/scenarios/GroupingFlightsTest.php index 5deb7d3..02d4e08 100644 --- a/tests/scenarios/GroupingFlightsTest.php +++ b/tests/scenarios/GroupingFlightsTest.php @@ -3,6 +3,7 @@ namespace DusanKasan\Knapsack\Tests\Scenarios; use DusanKasan\Knapsack\Collection; +use DusanKasan\Knapsack\CollectionInterface; use PHPUnit_Framework_TestCase; /** @@ -54,7 +55,7 @@ public function testIt() $this->assertEquals($expected, $result); } - public function summarize(Collection $flights) + public function summarize(CollectionInterface $flights) { $numCancellations = $flights ->filter(function ($f) { diff --git a/tests/spec/CollectionSpec.php b/tests/spec/CollectionSpec.php index 89b4888..ba3967d 100644 --- a/tests/spec/CollectionSpec.php +++ b/tests/spec/CollectionSpec.php @@ -5,6 +5,7 @@ use ArrayIterator; use DOMXPath; use DusanKasan\Knapsack\Collection; +use DusanKasan\Knapsack\CollectionInterface; use DusanKasan\Knapsack\Exceptions\InvalidArgument; use DusanKasan\Knapsack\Exceptions\InvalidReturnValue; use DusanKasan\Knapsack\Exceptions\ItemNotFound; @@ -242,7 +243,7 @@ function ($temp, $item, $key) { $this ->reduce( - function (Collection $temp, $item) { + function (CollectionInterface $temp, $item) { return $temp->append($item); }, new Collection([]) @@ -556,7 +557,7 @@ function ($temp, $key, $item) { $this ->reduceRight( - function (Collection $temp, $item) { + function (CollectionInterface $temp, $item) { return $temp->append($item); }, new Collection([]) @@ -1080,7 +1081,7 @@ function it_can_use_callable_as_transformer() { $this->beConstructedWith([1, 2, 3]); $this - ->transform(function (Collection $collection) { + ->transform(function (CollectionInterface $collection) { return $collection->map('\DusanKasan\Knapsack\increment'); }) ->toArray() @@ -1091,7 +1092,7 @@ function it_can_use_callable_as_transformer() ->during( 'transform', [ - function (Collection $collection) { + function (CollectionInterface $collection) { return $collection->first(); }, ] From 90ba3ec059f5cd6f9b1df26b12bae0cee4d44fec Mon Sep 17 00:00:00 2001 From: Dusan Kasan Date: Fri, 17 Apr 2020 23:52:50 +0200 Subject: [PATCH 2/3] psalm type annotations, implemented, support for 7.1 and older dropped --- composer.json | 16 +- composer.lock | 1853 ++++++++++++++++++++++++++------- phpspec.yml | 3 - psalm.xml | 16 + src/Collection.php | 59 +- src/CollectionInterface.php | 186 ++-- src/CollectionTrait.php | 438 ++++---- src/RewindableIterable.php | 42 + src/collection_functions.php | 1056 +++++++++++-------- src/utility_functions.php | 23 + tests/spec/CollectionSpec.php | 12 +- 11 files changed, 2546 insertions(+), 1158 deletions(-) create mode 100644 psalm.xml create mode 100644 src/RewindableIterable.php diff --git a/composer.json b/composer.json index 951fc70..e04c69d 100644 --- a/composer.json +++ b/composer.json @@ -14,16 +14,16 @@ } ], "require-dev": { - "phpspec/phpspec": "^3.4", - "henrikbjorn/phpspec-code-coverage": "^3.0", - "squizlabs/php_codesniffer": "^3.4", - "phpmd/phpmd" : "^2.0", - "ciaranmcnulty/phpspec-typehintedmethods": "^2.0", - "phpunit/phpunit": "^5.7", - "symfony/console": "^2.7" + "phpspec/phpspec": "^6.1", + "friends-of-phpspec/phpspec-code-coverage": "^4.3", + "squizlabs/php_codesniffer": "^3.5", + "phpmd/phpmd" : "^2.8", + "phpunit/phpunit": "^8.5", + "symfony/console": "^5.0", + "vimeo/psalm": "^3.11" }, "require": { - "php": ">=5.6.0" + "php": ">=7.2" }, "autoload": { "files": [ diff --git a/composer.lock b/composer.lock index e6c9bce..e517c0b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,35 +4,125 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a344b2e43e6ad7d5efbd6d9e76622eee", + "content-hash": "13717daf9a9bb7617e5e29715e7c2d4e", "packages": [], "packages-dev": [ { - "name": "ciaranmcnulty/phpspec-typehintedmethods", - "version": "2.0.0", + "name": "amphp/amp", + "version": "v2.4.2", "source": { "type": "git", - "url": "https://github.com/ciaranmcnulty/phpspec-typehintedmethods.git", - "reference": "3b0ae89c7717d7809516af4bb6c1faaf61f667e3" + "url": "https://github.com/amphp/amp.git", + "reference": "feca077369a47263b22156b3c6389e55f3809f24" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ciaranmcnulty/phpspec-typehintedmethods/zipball/3b0ae89c7717d7809516af4bb6c1faaf61f667e3", - "reference": "3b0ae89c7717d7809516af4bb6c1faaf61f667e3", + "url": "https://api.github.com/repos/amphp/amp/zipball/feca077369a47263b22156b3c6389e55f3809f24", + "reference": "feca077369a47263b22156b3c6389e55f3809f24", "shasum": "" }, "require": { - "phpspec/phpspec": "~3.0" + "php": ">=7" }, "require-dev": { - "behat/behat": "~3.0", - "symfony/filesystem": "~3.0" + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "ext-json": "*", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6.0.9 | ^7", + "react/promise": "^2", + "vimeo/psalm": "^3.9@dev" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, "autoload": { "psr-4": { - "Cjm\\PhpSpec\\": "src/" + "Amp\\": "lib" + }, + "files": [ + "lib/functions.php", + "lib/Internal/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" } + ], + "description": "A non-blocking concurrency framework for PHP applications.", + "homepage": "http://amphp.org/amp", + "keywords": [ + "async", + "asynchronous", + "awaitable", + "concurrency", + "event", + "event-loop", + "future", + "non-blocking", + "promise" + ], + "time": "2020-04-04T15:05:26+00:00" + }, + { + "name": "amphp/byte-stream", + "version": "v1.7.3", + "source": { + "type": "git", + "url": "https://github.com/amphp/byte-stream.git", + "reference": "b867505edb79dda8f253ca3c3a2bbadae4b16592" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/b867505edb79dda8f253ca3c3a2bbadae4b16592", + "reference": "b867505edb79dda8f253ca3c3a2bbadae4b16592", + "shasum": "" + }, + "require": { + "amphp/amp": "^2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "friendsofphp/php-cs-fixer": "^2.3", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6 || ^7 || ^8", + "vimeo/psalm": "^3.9@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Amp\\ByteStream\\": "lib" + }, + "files": [ + "lib/functions.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -40,20 +130,86 @@ ], "authors": [ { - "name": "Ciaran McNulty", - "email": "mail@ciaranmcnulty.com", - "homepage": "http://ciaranmcnulty.com", - "role": "Developer" + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" } ], - "description": "Extension for phpspec to enhance generated methods", - "homepage": "http://github.com/ciaranmcnulty/phpspec-typehintedmethods", + "description": "A stream abstraction to make working with non-blocking I/O simple.", + "homepage": "http://amphp.org/byte-stream", "keywords": [ - "BDD", - "TDD", - "phpspec" + "amp", + "amphp", + "async", + "io", + "non-blocking", + "stream" + ], + "time": "2020-04-04T16:56:54+00:00" + }, + { + "name": "composer/semver", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", + "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" ], - "time": "2016-08-12T14:21:22+00:00" + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2020-01-13T12:06:48+00:00" }, { "name": "composer/xdebug-handler", @@ -156,47 +312,174 @@ "time": "2019-10-21T16:45:58+00:00" }, { - "name": "henrikbjorn/phpspec-code-coverage", - "version": "3.0.1", + "name": "felixfbecker/advanced-json-rpc", + "version": "v3.1.1", "source": { "type": "git", - "url": "https://github.com/henrikbjorn/PhpSpecCodeCoverageExtension.git", - "reference": "4e878b81c0d28494882ecb7e9403ac5cbaa6cc1b" + "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", + "reference": "0ed363f8de17d284d479ec813c9ad3f6834b5c40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/henrikbjorn/PhpSpecCodeCoverageExtension/zipball/4e878b81c0d28494882ecb7e9403ac5cbaa6cc1b", - "reference": "4e878b81c0d28494882ecb7e9403ac5cbaa6cc1b", + "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/0ed363f8de17d284d479ec813c9ad3f6834b5c40", + "reference": "0ed363f8de17d284d479ec813c9ad3f6834b5c40", "shasum": "" }, "require": { - "php": "^5.5|^5.6|^7.0", - "phpspec/phpspec": "^3.0", - "phpunit/php-code-coverage": "^4.0" + "netresearch/jsonmapper": "^1.0 || ^2.0", + "php": ">=7.0", + "phpdocumentor/reflection-docblock": "^4.0.0 || ^5.0.0" }, "require-dev": { - "bossa/phpspec2-expect": "dev-master" + "phpunit/phpunit": "^6.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "AdvancedJsonRpc\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "A more advanced JSONRPC implementation", + "time": "2020-03-11T15:21:41+00:00" + }, + { + "name": "felixfbecker/language-server-protocol", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/felixfbecker/php-language-server-protocol.git", + "reference": "378801f6139bb74ac215d81cca1272af61df9a9f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/378801f6139bb74ac215d81cca1272af61df9a9f", + "reference": "378801f6139bb74ac215d81cca1272af61df9a9f", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpstan/phpstan": "*", + "phpunit/phpunit": "^6.3", + "squizlabs/php_codesniffer": "^3.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "LanguageServerProtocol\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "PHP classes for the Language Server Protocol", + "keywords": [ + "language", + "microsoft", + "php", + "server" + ], + "time": "2019-06-23T21:03:50+00:00" + }, + { + "name": "friends-of-phpspec/phpspec-code-coverage", + "version": "v4.3.2", + "source": { + "type": "git", + "url": "https://github.com/friends-of-phpspec/phpspec-code-coverage.git", + "reference": "9a54302573094cc1b3bdca3cc78c58582130b254" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/friends-of-phpspec/phpspec-code-coverage/zipball/9a54302573094cc1b3bdca3cc78c58582130b254", + "reference": "9a54302573094cc1b3bdca3cc78c58582130b254", + "shasum": "" + }, + "require": { + "php": "^7.1", + "phpspec/phpspec": "^4.2 || ^5.0 || ^6.0", + "phpunit/php-code-coverage": "^5.0 || ^6.0 || ^7.0" + }, + "require-dev": { + "drupol/php-conventions": "^1", + "scrutinizer/ocular": "^1" }, "suggest": { - "ext-xdebug": "To allow coverage generation when not using a recent version of phpdbg" + "ext-pcov": "Install PCov extension to generate code coverage.", + "ext-xdebug": "Install Xdebug to generate phpspec code coverage." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.x-dev" } }, "autoload": { "psr-4": { - "PhpSpecCodeCoverage\\": "src/" - } + "FriendsOfPhpSpec\\PhpSpec\\CodeCoverage\\": "src/" + }, + "files": [ + "src/bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Integrates CodeCoverage with PhpSpec", - "time": "2016-08-02T06:07:43+00:00" + "authors": [ + { + "name": "ek9", + "email": "dev@ek9.co", + "homepage": "https://ek9.co" + }, + { + "name": "Henrik Bjornskov" + }, + { + "name": "Stéphane Hulard", + "email": "s.hulard@chstudio.fr", + "homepage": "https://chstudio.fr" + }, + { + "name": "Pol Dellaiera", + "email": "pol.dellaiera@protonmail.com", + "homepage": "https://not-a-number.io/" + }, + { + "name": "Jay Linski", + "homepage": "https://twitter.com/jay_linski" + } + ], + "description": "Generate Code Coverage reports for PhpSpec tests", + "homepage": "https://github.com/friends-of-phpspec/phpspec-code-coverage", + "keywords": [ + "code-coverage", + "coverage", + "phpspec", + "report", + "spec", + "test", + "tests" + ], + "time": "2019-11-12T10:27:45+00:00" }, { "name": "myclabs/deep-copy", @@ -246,6 +529,204 @@ ], "time": "2020-01-17T21:11:47+00:00" }, + { + "name": "netresearch/jsonmapper", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/cweiske/jsonmapper.git", + "reference": "e245890383c3ed38b6d202ee373c23ccfebc0f54" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/e245890383c3ed38b6d202ee373c23ccfebc0f54", + "reference": "e245890383c3ed38b6d202ee373c23ccfebc0f54", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4 || ~7.0", + "squizlabs/php_codesniffer": "~3.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "JsonMapper": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "OSL-3.0" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@cweiske.de", + "homepage": "http://github.com/cweiske/jsonmapper/", + "role": "Developer" + } + ], + "description": "Map nested JSON structures onto PHP classes", + "time": "2020-03-04T17:23:33+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.4.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "bd43ec7152eaaab3bd8c6d0aa95ceeb1df8ee120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bd43ec7152eaaab3bd8c6d0aa95ceeb1df8ee120", + "reference": "bd43ec7152eaaab3bd8c6d0aa95ceeb1df8ee120", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "0.0.5", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2020-04-10T16:34:50+00:00" + }, + { + "name": "ocramius/package-versions", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/PackageVersions.git", + "reference": "421679846270a5772534828013a93be709fb13df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/421679846270a5772534828013a93be709fb13df", + "reference": "421679846270a5772534828013a93be709fb13df", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1.0 || ^2.0", + "php": "^7.4.0" + }, + "require-dev": { + "composer/composer": "^1.9.3 || ^2.0@dev", + "doctrine/coding-standard": "^7.0.2", + "ext-zip": "^1.15.0", + "infection/infection": "^0.15.3", + "phpunit/phpunit": "^9.0.1", + "vimeo/psalm": "^3.9.3" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "1.99.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "time": "2020-04-06T17:43:35+00:00" + }, + { + "name": "openlss/lib-array2xml", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/nullivex/lib-array2xml.git", + "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nullivex/lib-array2xml/zipball/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "LSS": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Bryan Tong", + "email": "bryan@nullivex.com", + "homepage": "https://www.nullivex.com" + }, + { + "name": "Tony Butler", + "email": "spudz76@gmail.com", + "homepage": "https://www.nullivex.com" + } + ], + "description": "Array2XML conversion library credit to lalit.org", + "homepage": "https://www.nullivex.com", + "keywords": [ + "array", + "array conversion", + "xml", + "xml conversion" + ], + "time": "2019-03-29T20:06:56+00:00" + }, { "name": "pdepend/pdepend", "version": "2.7.1", @@ -285,13 +766,115 @@ "psr-4": { "PDepend\\": "src/main/php/PDepend" } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Official version of pdepend to be handled with Composer", + "time": "2020-02-08T12:06:13+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } ], - "description": "Official version of pdepend to be handled with Composer", - "time": "2020-02-08T12:06:13+00:00" + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -554,36 +1137,38 @@ }, { "name": "phpspec/phpspec", - "version": "3.4.3", + "version": "6.1.1", "source": { "type": "git", "url": "https://github.com/phpspec/phpspec.git", - "reference": "8e72ed3576f6e26baebb2c214a8dba344508e3bd" + "reference": "486aaa736e9e24f3e22a6545f6affb88f98e2602" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/phpspec/zipball/8e72ed3576f6e26baebb2c214a8dba344508e3bd", - "reference": "8e72ed3576f6e26baebb2c214a8dba344508e3bd", + "url": "https://api.github.com/repos/phpspec/phpspec/zipball/486aaa736e9e24f3e22a6545f6affb88f98e2602", + "reference": "486aaa736e9e24f3e22a6545f6affb88f98e2602", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.1", + "doctrine/instantiator": "^1.0.5", "ext-tokenizer": "*", - "php": "^5.6 || ^7.0", + "php": "^7.2, <7.5", "phpspec/php-diff": "^1.0.0", - "phpspec/prophecy": "^1.5", + "phpspec/prophecy": "^1.9", "sebastian/exporter": "^1.0 || ^2.0 || ^3.0", - "symfony/console": "^2.7 || ^3.0", - "symfony/event-dispatcher": "^2.7 || ^3.0", - "symfony/finder": "^2.7 || ^3.0", - "symfony/process": "^2.7 || ^3.0", - "symfony/yaml": "^2.7 || ^3.0" + "symfony/console": "^3.4 || ^4.0 || ^5.0", + "symfony/event-dispatcher": "^3.4 || ^4.0 || ^5.0", + "symfony/finder": "^3.4 || ^4.0 || ^5.0", + "symfony/process": "^3.4 || ^4.0 || ^5.0", + "symfony/yaml": "^3.4 || ^4.0 || ^5.0" + }, + "conflict": { + "sebastian/comparator": "<1.2.4" }, "require-dev": { "behat/behat": "^3.3", - "ciaranmcnulty/versionbasedtestskipper": "^0.2.1", - "phpunit/phpunit": "^5.5|^6.0", - "symfony/filesystem": "^3.0" + "phpunit/phpunit": "^7.0", + "symfony/filesystem": "^3.4 || ^4.0 || ^5.0" }, "suggest": { "phpspec/nyan-formatters": "Adds Nyan formatters" @@ -594,7 +1179,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "6.1.x-dev" } }, "autoload": { @@ -621,7 +1206,7 @@ "homepage": "https://ciaranmcnulty.com/" } ], - "description": "Specification-oriented BDD framework for PHP 5.6+", + "description": "Specification-oriented BDD framework for PHP 7.1+", "homepage": "http://phpspec.net/", "keywords": [ "BDD", @@ -632,20 +1217,20 @@ "testing", "tests" ], - "time": "2017-12-06T09:12:11+00:00" + "time": "2019-12-17T10:23:12+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.10.2", + "version": "v1.10.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9" + "reference": "451c3cd1418cf640de218914901e51b064abb093" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b4400efc9d206e83138e2bb97ed7f5b14b831cd9", - "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", "shasum": "" }, "require": { @@ -695,44 +1280,44 @@ "spy", "stub" ], - "time": "2020-01-20T15:57:02+00:00" + "time": "2020-03-05T15:02:03+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.8", + "version": "7.0.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" + "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f1884187926fbb755a9aaf0b3836ad3165b478bf", + "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" + "php": "^7.2", + "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.1.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^4.2.2", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-xdebug": "^2.5.1" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -747,7 +1332,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -758,29 +1343,32 @@ "testing", "xunit" ], - "time": "2017-04-02T07:44:40+00:00" + "time": "2019-11-20T13:55:58+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -795,7 +1383,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -805,7 +1393,7 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", @@ -850,28 +1438,28 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.9", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -886,7 +1474,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -895,33 +1483,33 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" + "time": "2019-06-07T04:22:29+00:00" }, { "name": "phpunit/php-token-stream", - "version": "2.0.2", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.2.4" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -944,55 +1532,56 @@ "keywords": [ "tokenizer" ], - "time": "2017-11-27T05:48:46+00:00" + "time": "2019-09-17T06:23:10+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.27", + "version": "8.5.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c" + "reference": "67750516bc02f300e2742fed2f50177f8f37bedf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/67750516bc02f300e2742fed2f50177f8f37bedf", + "reference": "67750516bc02f300e2742fed2f50177f8f37bedf", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.2.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "^1.4.3", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "^1.0.6|^2.0.1", - "symfony/yaml": "~2.1|~3.0|~4.0" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.9.1", + "phar-io/manifest": "^1.0.3", + "phar-io/version": "^2.0.1", + "php": "^7.2", + "phpspec/prophecy": "^1.8.1", + "phpunit/php-code-coverage": "^7.0.7", + "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.2", + "sebastian/exporter": "^3.1.1", + "sebastian/global-state": "^3.0.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", + "sebastian/version": "^2.0.1" }, "require-dev": { "ext-pdo": "*" }, "suggest": { + "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" + "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" @@ -1000,7 +1589,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "8.5-dev" } }, "autoload": { @@ -1026,83 +1615,73 @@ "testing", "xunit" ], - "time": "2018-02-01T05:50:59+00:00" + "time": "2020-03-31T08:52:04+00:00" }, { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.4", + "name": "psr/container", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" + "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Psr\\Container\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", "keywords": [ - "mock", - "xunit" + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" ], - "time": "2017-06-30T09:13:00+00:00" + "time": "2017-02-14T16:28:37+00:00" }, { - "name": "psr/container", + "name": "psr/event-dispatcher", "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.2.0" }, "type": "library", "extra": { @@ -1112,7 +1691,7 @@ }, "autoload": { "psr-4": { - "Psr\\Container\\": "src/" + "Psr\\EventDispatcher\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1125,29 +1704,26 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Standard interfaces for event handling.", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "events", + "psr", + "psr-14" ], - "time": "2017-02-14T16:28:37+00:00" + "time": "2019-01-08T18:20:26+00:00" }, { "name": "psr/log", - "version": "1.1.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", "shasum": "" }, "require": { @@ -1181,7 +1757,7 @@ "psr", "psr-3" ], - "time": "2019-11-01T11:05:21+00:00" + "time": "2020-03-23T09:12:05+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1230,30 +1806,30 @@ }, { "name": "sebastian/comparator", - "version": "1.2.4", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1284,38 +1860,39 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-01-29T09:50:25+00:00" + "time": "2018-07-12T15:12:46+00:00" }, { "name": "sebastian/diff", - "version": "1.4.3", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1340,34 +1917,40 @@ "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2017-05-22T07:24:03+00:00" + "time": "2019-02-04T06:01:07+00:00" }, { "name": "sebastian/environment", - "version": "2.0.0", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -1392,34 +1975,34 @@ "environment", "hhvm" ], - "time": "2016-11-26T07:53:53+00:00" + "time": "2019-11-20T08:46:58+00:00" }, { "name": "sebastian/exporter", - "version": "2.0.0", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -1432,6 +2015,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1440,17 +2027,13 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -1459,27 +2042,30 @@ "export", "exporter" ], - "time": "2016-11-19T08:54:04+00:00" + "time": "2019-09-14T09:02:43+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -1487,7 +2073,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1510,33 +2096,34 @@ "keywords": [ "global state" ], - "time": "2015-10-12T03:26:01+00:00" + "time": "2019-02-01T05:30:01+00:00" }, { "name": "sebastian/object-enumerator", - "version": "2.0.1", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1556,32 +2143,77 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" }, { "name": "sebastian/recursion-context", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1609,29 +2241,29 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" + "time": "2017-03-03T06:23:57+00:00" }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1651,7 +2283,53 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "time": "2018-10-04T04:07:39+00:00" + }, + { + "name": "sebastian/type", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3", + "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3", + "shasum": "" + }, + "require": { + "php": "^7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "time": "2019-07-02T08:10:15+00:00" }, { "name": "sebastian/version", @@ -1749,32 +2427,32 @@ }, { "name": "symfony/config", - "version": "v4.4.5", + "version": "v5.0.7", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "cbfef5ae91ccd3b06621c18d58cd355c68c87ae9" + "reference": "3e633c31a34738f7f4ed7a225c43fc45ca74c986" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/cbfef5ae91ccd3b06621c18d58cd355c68c87ae9", - "reference": "cbfef5ae91ccd3b06621c18d58cd355c68c87ae9", + "url": "https://api.github.com/repos/symfony/config/zipball/3e633c31a34738f7f4ed7a225c43fc45ca74c986", + "reference": "3e633c31a34738f7f4ed7a225c43fc45ca74c986", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/filesystem": "^3.4|^4.0|^5.0", + "php": "^7.2.5", + "symfony/filesystem": "^4.4|^5.0", "symfony/polyfill-ctype": "~1.8" }, "conflict": { - "symfony/finder": "<3.4" + "symfony/finder": "<4.4" }, "require-dev": { - "symfony/event-dispatcher": "^3.4|^4.0|^5.0", - "symfony/finder": "^3.4|^4.0|^5.0", - "symfony/messenger": "^4.1|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/finder": "^4.4|^5.0", + "symfony/messenger": "^4.4|^5.0", "symfony/service-contracts": "^1.1|^2", - "symfony/yaml": "^3.4|^4.0|^5.0" + "symfony/yaml": "^4.4|^5.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -1782,7 +2460,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1809,41 +2487,56 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2020-02-04T09:32:40+00:00" + "time": "2020-03-27T16:56:45+00:00" }, { "name": "symfony/console", - "version": "v2.8.52", + "version": "v5.0.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "cbcf4b5e233af15cd2bbd50dee1ccc9b7927dc12" + "reference": "5fa1caadc8cdaa17bcfb25219f3b53fe294a9935" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/cbcf4b5e233af15cd2bbd50dee1ccc9b7927dc12", - "reference": "cbcf4b5e233af15cd2bbd50dee1ccc9b7927dc12", + "url": "https://api.github.com/repos/symfony/console/zipball/5fa1caadc8cdaa17bcfb25219f3b53fe294a9935", + "reference": "5fa1caadc8cdaa17bcfb25219f3b53fe294a9935", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/debug": "^2.7.2|~3.0.0", - "symfony/polyfill-mbstring": "~1.0" + "php": "^7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/service-contracts": "^1.1|^2" + }, + "conflict": { + "symfony/dependency-injection": "<4.4", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/process": "~2.1|~3.0.0" + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" }, "suggest": { - "psr/log-implementation": "For using the console logger", + "psr/log": "For using the console logger", "symfony/event-dispatcher": "", + "symfony/lock": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1870,42 +2563,58 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-11-20T15:55:20+00:00" + "time": "2020-03-30T11:42:42+00:00" }, { - "name": "symfony/debug", - "version": "v3.0.9", + "name": "symfony/dependency-injection", + "version": "v5.0.7", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a" + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "4e48dc44680d8efa357410c78093a04753196981" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/697c527acd9ea1b2d3efac34d9806bf255278b0a", - "reference": "697c527acd9ea1b2d3efac34d9806bf255278b0a", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/4e48dc44680d8efa357410c78093a04753196981", + "reference": "4e48dc44680d8efa357410c78093a04753196981", "shasum": "" }, "require": { - "php": ">=5.5.9", - "psr/log": "~1.0" + "php": "^7.2.5", + "psr/container": "^1.0", + "symfony/service-contracts": "^1.1.6|^2" }, "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "symfony/config": "<5.0", + "symfony/finder": "<4.4", + "symfony/proxy-manager-bridge": "<4.4", + "symfony/yaml": "<4.4" + }, + "provide": { + "psr/container-implementation": "1.0", + "symfony/service-implementation": "1.0" }, "require-dev": { - "symfony/class-loader": "~2.8|~3.0", - "symfony/http-kernel": "~2.8|~3.0" + "symfony/config": "^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/yaml": "^4.4|^5.0" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Debug\\": "" + "Symfony\\Component\\DependencyInjection\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1925,57 +2634,57 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Debug Component", + "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2016-07-30T07:22:48+00:00" + "time": "2020-03-30T11:42:42+00:00" }, { - "name": "symfony/dependency-injection", - "version": "v3.3.18", + "name": "symfony/event-dispatcher", + "version": "v5.0.7", "source": { "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "54243abc4e1a1a15e274e391bd6f7090b44711f1" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "24f40d95385774ed5c71dbf014edd047e2f2f3dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/54243abc4e1a1a15e274e391bd6f7090b44711f1", - "reference": "54243abc4e1a1a15e274e391bd6f7090b44711f1", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/24f40d95385774ed5c71dbf014edd047e2f2f3dc", + "reference": "24f40d95385774ed5c71dbf014edd047e2f2f3dc", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/container": "^1.0" + "php": "^7.2.5", + "symfony/event-dispatcher-contracts": "^2" }, "conflict": { - "symfony/config": "<3.3.7", - "symfony/finder": "<3.3", - "symfony/yaml": "<3.3" + "symfony/dependency-injection": "<4.4" }, "provide": { - "psr/container-implementation": "1.0" + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { - "symfony/config": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/yaml": "~3.3" + "psr/log": "~1.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/stopwatch": "^4.4|^5.0" }, "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" + "symfony/dependency-injection": "", + "symfony/http-kernel": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" + "Symfony\\Component\\EventDispatcher\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1995,54 +2704,41 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony DependencyInjection Component", + "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-01-29T09:02:23+00:00" + "time": "2020-03-27T16:56:45+00:00" }, { - "name": "symfony/event-dispatcher", - "version": "v3.4.38", + "name": "symfony/event-dispatcher-contracts", + "version": "v2.0.1", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "2f67a869aef3eecf42e7f8be4a8b86c92308686c" + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "af23c2584d4577d54661c434446fb8fbed6025dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2f67a869aef3eecf42e7f8be4a8b86c92308686c", - "reference": "2f67a869aef3eecf42e7f8be4a8b86c92308686c", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/af23c2584d4577d54661c434446fb8fbed6025dd", + "reference": "af23c2584d4577d54661c434446fb8fbed6025dd", "shasum": "" }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0" - }, + "require": { + "php": "^7.2.5", + "psr/event-dispatcher": "^1" + }, "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "symfony/event-dispatcher-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "2.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Symfony\\Contracts\\EventDispatcher\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2050,30 +2746,38 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "description": "Generic abstractions related to dispatching event", "homepage": "https://symfony.com", - "time": "2020-02-04T08:04:52+00:00" + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/filesystem", - "version": "v5.0.5", + "version": "v5.0.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "3afadc0f57cd74f86379d073e694b0f2cda2a88c" + "reference": "ca3b87dd09fff9b771731637f5379965fbfab420" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/3afadc0f57cd74f86379d073e694b0f2cda2a88c", - "reference": "3afadc0f57cd74f86379d073e694b0f2cda2a88c", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/ca3b87dd09fff9b771731637f5379965fbfab420", + "reference": "ca3b87dd09fff9b771731637f5379965fbfab420", "shasum": "" }, "require": { @@ -2110,29 +2814,29 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2020-01-21T08:40:24+00:00" + "time": "2020-03-27T16:56:45+00:00" }, { "name": "symfony/finder", - "version": "v3.4.38", + "version": "v5.0.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "5ec813ccafa8164ef21757e8c725d3a57da59200" + "reference": "600a52c29afc0d1caa74acbec8d3095ca7e9910d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/5ec813ccafa8164ef21757e8c725d3a57da59200", - "reference": "5ec813ccafa8164ef21757e8c725d3a57da59200", + "url": "https://api.github.com/repos/symfony/finder/zipball/600a52c29afc0d1caa74acbec8d3095ca7e9910d", + "reference": "600a52c29afc0d1caa74acbec8d3095ca7e9910d", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.2.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2159,20 +2863,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2020-02-14T07:34:21+00:00" + "time": "2020-03-27T16:56:45+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.14.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", "shasum": "" }, "require": { @@ -2184,7 +2888,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.14-dev" + "dev-master": "1.15-dev" } }, "autoload": { @@ -2217,20 +2921,20 @@ "polyfill", "portable" ], - "time": "2020-01-13T11:15:53+00:00" + "time": "2020-02-27T09:26:54+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.14.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", - "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", "shasum": "" }, "require": { @@ -2242,7 +2946,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.14-dev" + "dev-master": "1.15-dev" } }, "autoload": { @@ -2276,29 +2980,87 @@ "portable", "shim" ], - "time": "2020-01-13T11:15:53+00:00" + "time": "2020-03-09T19:04:49+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", + "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.15-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2020-02-27T09:26:54+00:00" }, { "name": "symfony/process", - "version": "v3.4.38", + "version": "v5.0.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "b03b02dcea26ba4c65c16a73bab4f00c186b13da" + "reference": "c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b03b02dcea26ba4c65c16a73bab4f00c186b13da", - "reference": "b03b02dcea26ba4c65c16a73bab4f00c186b13da", + "url": "https://api.github.com/repos/symfony/process/zipball/c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e", + "reference": "c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.2.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2325,27 +3087,89 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2020-02-04T08:04:52+00:00" + "time": "2020-03-27T16:56:45+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "144c5e51266b281231e947b51223ba14acf1a749" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", + "reference": "144c5e51266b281231e947b51223ba14acf1a749", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/yaml", - "version": "v3.3.18", + "version": "v5.0.7", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "af615970e265543a26ee712c958404eb9b7ac93d" + "reference": "ad5e9c83ade5bbb3a96a3f30588a0622708caefd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/af615970e265543a26ee712c958404eb9b7ac93d", - "reference": "af615970e265543a26ee712c958404eb9b7ac93d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/ad5e9c83ade5bbb3a96a3f30588a0622708caefd", + "reference": "ad5e9c83ade5bbb3a96a3f30588a0622708caefd", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.2.5", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<4.4" }, "require-dev": { - "symfony/console": "~2.8|~3.0" + "symfony/console": "^4.4|^5.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -2353,7 +3177,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2380,7 +3204,145 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-01-20T15:04:53+00:00" + "time": "2020-03-30T11:42:42+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2019-06-13T22:48:21+00:00" + }, + { + "name": "vimeo/psalm", + "version": "3.11.1", + "source": { + "type": "git", + "url": "https://github.com/vimeo/psalm.git", + "reference": "8533b866ab1a46e5a69a4692ff57f10529dbfbeb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/8533b866ab1a46e5a69a4692ff57f10529dbfbeb", + "reference": "8533b866ab1a46e5a69a4692ff57f10529dbfbeb", + "shasum": "" + }, + "require": { + "amphp/amp": "^2.1", + "amphp/byte-stream": "^1.5", + "composer/semver": "^1.4", + "composer/xdebug-handler": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-simplexml": "*", + "ext-tokenizer": "*", + "felixfbecker/advanced-json-rpc": "^3.0.3", + "felixfbecker/language-server-protocol": "^1.4", + "netresearch/jsonmapper": "^1.0 || ^2.0", + "nikic/php-parser": "^4.3", + "ocramius/package-versions": "^1.2", + "openlss/lib-array2xml": "^1.0", + "php": "^7.1.3|^8", + "sebastian/diff": "^3.0 || ^4.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "webmozart/glob": "^4.1", + "webmozart/path-util": "^2.3" + }, + "provide": { + "psalm/psalm": "self.version" + }, + "require-dev": { + "amphp/amp": "^2.4.2", + "bamarni/composer-bin-plugin": "^1.2", + "brianium/paratest": "^4.0.0", + "ext-curl": "*", + "php-coveralls/php-coveralls": "^2.2", + "phpmyadmin/sql-parser": "5.1.0", + "phpspec/prophecy": ">=1.9.0", + "phpunit/phpunit": "^7.5.16 || ^8.5 || ^9.0", + "psalm/plugin-phpunit": "^0.10", + "slevomat/coding-standard": "^5.0", + "squizlabs/php_codesniffer": "^3.5", + "symfony/process": "^4.3" + }, + "suggest": { + "ext-igbinary": "^2.0.5" + }, + "bin": [ + "psalm", + "psalm-language-server", + "psalm-plugin", + "psalm-refactor", + "psalter" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev", + "dev-2.x": "2.x-dev", + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psalm\\Plugin\\": "src/Psalm/Plugin", + "Psalm\\": "src/Psalm" + }, + "files": [ + "src/functions.php", + "src/spl_object_id.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matthew Brown" + } + ], + "description": "A static analysis tool for finding errors in PHP applications", + "keywords": [ + "code", + "inspection", + "php" + ], + "time": "2020-04-13T02:19:49+00:00" }, { "name": "webmozart/assert", @@ -2429,6 +3391,99 @@ "validate" ], "time": "2020-02-14T12:15:55+00:00" + }, + { + "name": "webmozart/glob", + "version": "4.1.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/glob.git", + "reference": "3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/glob/zipball/3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe", + "reference": "3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe", + "shasum": "" + }, + "require": { + "php": "^5.3.3|^7.0", + "webmozart/path-util": "^2.2" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1", + "symfony/filesystem": "^2.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Glob\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "A PHP implementation of Ant's glob.", + "time": "2015-12-29T11:14:33+00:00" + }, + { + "name": "webmozart/path-util", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/path-util.git", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "webmozart/assert": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\PathUtil\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "time": "2015-12-17T08:42:14+00:00" } ], "aliases": [], @@ -2437,7 +3492,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.6.0" + "php": ">=7.2" }, "platform-dev": [] } diff --git a/phpspec.yml b/phpspec.yml index 3e14869..af2c4c1 100644 --- a/phpspec.yml +++ b/phpspec.yml @@ -1,6 +1,3 @@ -extensions: - Cjm\PhpSpec\Extension\TypeHintedMethodsExtension: ~ - suites: default: spec_path: tests diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 0000000..d6c2a02 --- /dev/null +++ b/psalm.xml @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/src/Collection.php b/src/Collection.php index 1c99d3c..25260ef 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -8,22 +8,31 @@ use IteratorAggregate; use Traversable; +/** + * @template TKey + * @template TVal + * @implements CollectionInterface + * @implements IteratorAggregate + */ class Collection implements IteratorAggregate, \Serializable, CollectionInterface { + /** + * @use CollectionTrait + */ use CollectionTrait; /** - * @var Traversable + * @var Traversable */ protected $input; /** - * @var callable + * @var callable():iterable|null */ - private $inputFactory; + private $inputFactory = null; /** - * @param callable|array|Traversable $input If callable is passed, it must return an array|Traversable. + * @param callable(): iterable|iterable $input */ public function __construct($input) { @@ -44,12 +53,14 @@ public function __construct($input) /** * Static alias of normal constructor. * - * @param callable|array|Traversable $input - * @return CollectionInterface + * @template CKey + * @template CVal + * @param callable():iterable|iterable $input + * @return static */ public static function from($input) { - return new self($input); + return new static($input); } /** @@ -58,24 +69,25 @@ public static function from($input) * end the collection by throwing a NoMoreItems exception. * * @param mixed $input - * @param callable $function - * @return CollectionInterface + * @param callable(mixed):mixed $function + * @return static */ public static function iterate($input, callable $function) { - return iterate($input, $function); + return static::from(iterate($input, $function)); } /** * Returns a lazy collection of $value repeated $times times. If $times is not provided the collection is infinite. * - * @param mixed $value + * @template TItem + * @param TItem $value * @param int $times - * @return CollectionInterface + * @return static */ - public static function repeat($value, $times = -1) + public static function repeat($value, int $times = -1) { - return repeat($value, $times); + return static::from(repeat($value, $times)); } /** @@ -84,16 +96,17 @@ public static function repeat($value, $times = -1) * @param int $start * @param int|null $end * @param int $step - * @return CollectionInterface + * @return static */ public static function range($start = 0, $end = null, $step = 1) { - return \DusanKasan\Knapsack\range($start, $end, $step); + return static::from(\DusanKasan\Knapsack\range($start, $end, $step)); } /** * {@inheritdoc} * @throws InvalidReturnValue + * @return Traversable */ public function getIterator() { @@ -123,7 +136,12 @@ public function serialize() toArray( map( $this->input, - function ($value, $key) { + /** + * @param mixed $value + * @param mixed $key + * @return array + */ + function ($value, $key): array { return [$key, $value]; } ) @@ -139,11 +157,12 @@ public function unserialize($serialized) $this->input = dereferenceKeyValue(unserialize($serialized)); } + /** - * @inheritDoc + * @return iterable */ - protected function buildFromCollection(Collection $collection) + protected function getItems(): iterable { - return $collection; + return $this; } } diff --git a/src/CollectionInterface.php b/src/CollectionInterface.php index fdb9882..636a01a 100644 --- a/src/CollectionInterface.php +++ b/src/CollectionInterface.php @@ -3,8 +3,13 @@ namespace DusanKasan\Knapsack; use DusanKasan\Knapsack\Exceptions\InvalidReturnValue; +use Traversable; -interface CollectionInterface +/** + * @template TKey + * @template TVal + */ +interface CollectionInterface extends Traversable { /** * Converts $collection to array. If there are multiple items with the same key, only the last will be preserved. @@ -16,31 +21,32 @@ public function toArray(); /** * Returns a lazy collection of items for which $function returned true. * - * @param callable|null $function ($value, $key) - * @return CollectionInterface + * @param callable(TVal, TKey): bool|null $function + * @return static */ public function filter(callable $function = null); /** * Returns a lazy collection of distinct items. The comparison is the same as in in_array. * - * @return CollectionInterface + * @return static */ public function distinct(); /** * Returns a lazy collection with items from all $collections passed as argument appended together * - * @param array|\Traversable ...$collections - * @return CollectionInterface + * @param iterable ...$collections + * @return static */ public function concat(...$collections); /** * Returns collection where each item is changed to the output of executing $function on each key/item. * - * @param callable $function - * @return CollectionInterface + * @template TRes + * @param callable(TVal, TKey):TRes $function + * @return static */ public function map(callable $function); @@ -48,7 +54,7 @@ public function map(callable $function); * Reduces the collection to single value by iterating over the collection and calling $function while * passing $startValue and current key/item as parameters. The output of $function is used as $startValue in * next iteration. The output of $function on last element is the return value of this function. If - * $convertToCollection is true and the return value is a collection (array|Traversable) an instance of Collection + * $convertToCollection is true and the return value is a collection (iterable) an instance of Collection * is returned. * * @param callable $function ($tmpValue, $value, $key) @@ -71,8 +77,8 @@ public function flatten($depth = -1); * Returns a non-lazy collection sorted using $function($item1, $item2, $key1, $key2 ). $function should * return true if first item is larger than the second and false otherwise. * - * @param callable $function ($value1, $value2, $key1, $key2) - * @return CollectionInterface + * @param callable(TVal, TVal, TKey, TKey): bool $function + * @return static */ public function sort(callable $function); @@ -81,32 +87,33 @@ public function sort(callable $function); * number $to. The items before $from are also iterated over, just not returned. * * @param int $from - * @param int $to If omitted, will slice until end - * @return CollectionInterface + * @param int $to -1 to slice until end + * @return static */ - public function slice($from, $to = -1); + public function slice(int $from, int $to = -1); /** * Returns collection which items are separated into groups indexed by the return value of $function. * - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TRes + * @param callable(TVal, TKey): TRes $function + * @return CollectionInterface> */ - public function groupBy(callable $function); + public function groupBy(callable $function): CollectionInterface; /** * Returns collection where items are separated into groups indexed by the value at given key. * * @param mixed $key - * @return CollectionInterface + * @return CollectionInterface */ - public function groupByKey($key); + public function groupByKey($key): CollectionInterface; /** * Returns a lazy collection in which $function is executed for each item. * - * @param callable $function ($value, $key) - * @return CollectionInterface + * @param callable(TVal, TKey): void $function + * @return static */ public function each(callable $function); @@ -119,7 +126,7 @@ public function size(); /** * Returns value at the key $key. If multiple values have this key, return first. If no value has this key, throw - * ItemNotFound. If $convertToCollection is true and the return value is a collection (array|Traversable) an + * ItemNotFound. If $convertToCollection is true and the return value is a collection (iterable) an * instance of Collection will be returned. * * @param mixed $key @@ -132,7 +139,7 @@ public function get($key, $convertToCollection = false); /** * Returns item at the key $key. If multiple items have this key, return first. If no item has this key, return * $ifNotFound. If no value has this key, throw ItemNotFound. If $convertToCollection is true and the return value - * is a collection (array|Traversable) an instance of Collection will be returned. + * is a collection (iterable) an instance of Collection will be returned. * * @param mixed $key * @param mixed $default @@ -144,12 +151,12 @@ public function getOrDefault($key, $default = null, $convertToCollection = false /** * Returns first value matched by $function. If no value matches, return $default. If $convertToCollection is true - * and the return value is a collection (array|Traversable) an instance of Collection will be returned. + * and the return value is a collection (iterable) an instance of Collection will be returned. * - * @param callable $function - * @param mixed|null $default + * @param callable(TVal, TKey): bool $function + * @param TVal|null $default * @param bool $convertToCollection - * @return mixed|Collection + * @return TVal|CollectionInterface */ public function find(callable $function, $default = null, $convertToCollection = false); @@ -157,24 +164,26 @@ public function find(callable $function, $default = null, $convertToCollection = * Returns a non-lazy collection of items whose keys are the return values of $function and values are the number of * items in this collection for which the $function returned this value. * - * @param callable $function - * @return CollectionInterface + * @template TRes + * @param callable(TVal, TKey): TRes $function + * @return CollectionInterface */ - public function countBy(callable $function); + public function countBy(callable $function): CollectionInterface; /** * Returns a lazy collection by changing keys of this collection for each item to the result of $function for * that item. * - * @param callable $function - * @return CollectionInterface + * @template TNewKey + * @param callable(TVal, TKey): TNewKey $function + * @return static */ public function indexBy(callable $function); /** * Returns true if $function returns true for every item in this collection, false otherwise. * - * @param callable $function + * @param callable(TVal, TKey): bool $function * @return bool */ public function every(callable $function); @@ -182,7 +191,7 @@ public function every(callable $function); /** * Returns true if $function returns true for at least one item in this collection, false otherwise. * - * @param callable $function + * @param callable(TVal, TKey): bool $function * @return bool */ public function some(callable $function); @@ -190,7 +199,7 @@ public function some(callable $function); /** * Returns true if $value is present in the collection. * - * @param mixed $value + * @param TVal $value * @return bool */ public function contains($value); @@ -198,18 +207,19 @@ public function contains($value); /** * Returns collection of items in this collection in reverse order. * - * @return CollectionInterface + * @return static */ public function reverse(); /** * Reduce the collection to single value. Walks from right to left. If $convertToCollection is true and the return - * value is a collection (array|Traversable) an instance of Collection is returned. + * value is a collection (iterable) an instance of Collection is returned. * - * @param callable $function Must take 2 arguments, intermediate value and item from the iterator. - * @param mixed $startValue + * @template TRes + * @param callable $function + * @param TRes $startValue * @param bool $convertToCollection - * @return mixed|Collection + * @return TRes|CollectionInterface */ public function reduceRight(callable $function, $startValue, $convertToCollection = false); @@ -217,45 +227,45 @@ public function reduceRight(callable $function, $startValue, $convertToCollectio * A form of slice that returns first $numberOfItems items. * * @param int $numberOfItems - * @return CollectionInterface + * @return static */ - public function take($numberOfItems); + public function take(int $numberOfItems); /** * A form of slice that returns all but first $numberOfItems items. * * @param int $numberOfItems - * @return CollectionInterface + * @return static */ - public function drop($numberOfItems); + public function drop(int $numberOfItems); /** * Returns collection of values from this collection but with keys being numerical from 0 upwards. * - * @return CollectionInterface + * @return static */ public function values(); /** * Returns a lazy collection without elements matched by $function. * - * @param callable $function - * @return CollectionInterface + * @param callable(TVal, TKey): bool $function + * @return static */ public function reject(callable $function); /** * Returns a lazy collection of the keys of this collection. * - * @return CollectionInterface + * @return CollectionInterface */ public function keys(); /** * Returns a lazy collection of items of this collection separated by $separator * - * @param mixed $separator - * @return CollectionInterface + * @param TVal $separator + * @return static */ public function interpose($separator); @@ -263,23 +273,23 @@ public function interpose($separator); * Returns a lazy collection with last $numberOfItems items skipped. These are still iterated over, just skipped. * * @param int $numberOfItems - * @return CollectionInterface + * @return static */ - public function dropLast($numberOfItems = 1); + public function dropLast(int $numberOfItems = 1); /** * Returns a lazy collection of first item from first collection, first item from second, second from first and * so on. Accepts any number of collections. * - * @param array|\Traversable ...$collections - * @return CollectionInterface + * @param iterable ...$collections + * @return static */ public function interleave(...$collections); /** * Returns an infinite lazy collection of items in this collection repeated infinitely. * - * @return CollectionInterface + * @return static */ public function cycle(); @@ -287,9 +297,9 @@ public function cycle(); * Returns a lazy collection of items of this collection with $value added as first element. If $key is not provided * it will be next integer index. * - * @param mixed $value - * @param mixed|null $key - * @return CollectionInterface + * @param TVal $value + * @param TKey|null $key + * @return static */ public function prepend($value, $key = null); @@ -297,9 +307,9 @@ public function prepend($value, $key = null); * Returns a lazy collection of items of this collection with $value added as last element. If $key is not provided * it will be next integer index. * - * @param mixed $value - * @param mixed $key - * @return CollectionInterface + * @param TVal $value + * @param TKey|null $key + * @return static */ public function append($value, $key = null); @@ -307,8 +317,8 @@ public function append($value, $key = null); * Returns a lazy collection by removing items from this collection until first item for which $function returns * false. * - * @param callable $function - * @return CollectionInterface + * @param callable(TVal, TKey): bool $function + * @return static */ public function dropWhile(callable $function); @@ -349,7 +359,7 @@ public function splitWith(callable $function); * Returns a lazy collection with items from this collection but values that are found in keys of $replacementMap * are replaced by their values. * - * @param array|\Traversable $replacementMap + * @param iterable $replacementMap * @return CollectionInterface */ public function replace($replacementMap); @@ -387,7 +397,7 @@ public function shuffle(); * * @param int $numberOfItems * @param int $step - * @param array|\Traversable $padding + * @param iterable $padding * @return CollectionInterface */ public function partition($numberOfItems, $step = 0, $padding = []); @@ -425,7 +435,7 @@ public function frequencies(); /** * Returns first item of this collection. If the collection is empty, throws ItemNotFound. If $convertToCollection - * is true and the return value is a collection (array|Traversable) an instance of Collection is returned. + * is true and the return value is a collection (iterable) an instance of Collection is returned. * * @param bool $convertToCollection * @return mixed|Collection @@ -435,7 +445,7 @@ public function first($convertToCollection = false); /** * Returns last item of this collection. If the collection is empty, throws ItemNotFound. If $convertToCollection - * is true and the return value is a collection (array|Traversable) it is converted to Collection. + * is true and the return value is a collection (iterable) it is converted to Collection. * * @param bool $convertToCollection * @return mixed|Collection @@ -452,7 +462,7 @@ public function realize(); /** * Returns the second item in this collection or throws ItemNotFound if the collection is empty or has 1 item. If - * $convertToCollection is true and the return value is a collection (array|Traversable) it is converted to + * $convertToCollection is true and the return value is a collection (iterable) it is converted to * Collection. * * @param bool $convertToCollection @@ -465,33 +475,33 @@ public function second($convertToCollection = false); * Combines the values of this collection as keys, with values of $collection as values. The resulting collection * has length equal to the size of smaller collection. * - * @param array|\Traversable $collection + * @param iterable $collection * @return CollectionInterface * @throws \DusanKasan\Knapsack\Exceptions\ItemNotFound */ - public function combine($collection); + public function combine(iterable $collection); /** * Returns a lazy collection without the items associated to any of the keys from $keys. * - * @param array|\Traversable $keys + * @param iterable $keys * @return CollectionInterface */ - public function except($keys); + public function except(iterable $keys); /** * Returns a lazy collection of items associated to any of the keys from $keys. * - * @param array|\Traversable $keys + * @param iterable $keys * @return CollectionInterface */ - public function only($keys); + public function only(iterable $keys); /** * Returns a lazy collection of items that are in $this but are not in any of the other arguments, indexed by the * keys from the first collection. Note that the ...$collections are iterated non-lazily. * - * @param array|\Traversable ...$collections + * @param iterable ...$collections * @return CollectionInterface */ public function diff(...$collections); @@ -515,10 +525,10 @@ public function has($key); * Returns a lazy collection of non-lazy collections of items from nth position from this collection and each * passed collection. Stops when any of the collections don't have an item at the nth position. * - * @param array|\Traversable ...$collections + * @param iterable ...$collections * @return CollectionInterface */ - public function zip(...$collections); + public function zip(iterable ...$collections); /** * Uses a $transformer callable that takes a Collection and returns Collection on itself. @@ -550,10 +560,10 @@ public function extract($keyPath); * Returns a lazy collection of items that are in $this and all the other arguments, indexed by the keys from * the first collection. Note that the ...$collections are iterated non-lazily. * - * @param array|\Traversable ...$collections + * @param iterable ...$collections * @return CollectionInterface */ - public function intersect(...$collections); + public function intersect(iterable ...$collections); /** * Checks whether this collection has exactly $size items. @@ -561,7 +571,7 @@ public function intersect(...$collections); * @param int $size * @return bool */ - public function sizeIs($size); + public function sizeIs(int $size): bool; /** * Checks whether this collection has less than $size items. @@ -569,7 +579,7 @@ public function sizeIs($size); * @param int $size * @return bool */ - public function sizeIsLessThan($size); + public function sizeIsLessThan(int $size): bool; /** * Checks whether this collection has more than $size items. @@ -577,7 +587,7 @@ public function sizeIsLessThan($size); * @param int $size * @return bool */ - public function sizeIsGreaterThan($size); + public function sizeIsGreaterThan(int $size): bool; /** * Checks whether this collection has between $fromSize to $toSize items. $toSize can be @@ -587,7 +597,7 @@ public function sizeIsGreaterThan($size); * @param int $toSize * @return bool */ - public function sizeIsBetween($fromSize, $toSize); + public function sizeIsBetween(int $fromSize, int $toSize): bool; /** * Returns a sum of all values in this collection. @@ -628,10 +638,10 @@ public function toString(); * Returns a lazy collection with items from $collection, but items with keys that are found in keys of * $replacementMap are replaced by their values. * - * @param array|\Traversable $replacementMap - * @return CollectionInterface + * @param iterable $replacementMap + * @return CollectionInterface */ - public function replaceByKeys($replacementMap); + public function replaceByKeys(iterable $replacementMap); /** * /** @@ -657,7 +667,7 @@ public function replaceByKeys($replacementMap); * @param int|null $maxDepth * @return array */ - public function dump($maxItemsPerCollection = null, $maxDepth = null); + public function dump(int $maxItemsPerCollection = null, int $maxDepth = null): array; /** * Calls dump on this collection and then prints it using the var_export. @@ -666,5 +676,5 @@ public function dump($maxItemsPerCollection = null, $maxDepth = null); * @param int|null $maxDepth * @return CollectionInterface */ - public function printDump($maxItemsPerCollection = null, $maxDepth = null); + public function printDump(int $maxItemsPerCollection = null, int $maxDepth = null); } \ No newline at end of file diff --git a/src/CollectionTrait.php b/src/CollectionTrait.php index b805358..b84c213 100644 --- a/src/CollectionTrait.php +++ b/src/CollectionTrait.php @@ -3,7 +3,13 @@ namespace DusanKasan\Knapsack; use DusanKasan\Knapsack\Exceptions\InvalidReturnValue; +use DusanKasan\Knapsack\Exceptions\ItemNotFound; +use Generator; +/** + * @template TKey + * @template TVal + */ trait CollectionTrait { /** @@ -19,87 +25,89 @@ public function toArray() /** * Returns a lazy collection of items for which $function returned true. * - * @param callable|null $function ($value, $key) - * @return CollectionInterface + * @param callable(TVal, TKey): bool|null $function + * @return static */ public function filter(callable $function = null) { - return $this->buildFromCollection(filter($this->getItems(), $function)); + return static::from(filter($this->getItems(), $function)); } /** * Returns a lazy collection of distinct items. The comparison is the same as in in_array. * - * @return CollectionInterface + * @return static */ public function distinct() { - return distinct($this->getItems()); + return static::from(distinct($this->getItems())); } /** * Returns a lazy collection with items from all $collections passed as argument appended together * - * @param array|\Traversable ...$collections - * @return CollectionInterface + * @param iterable ...$collections + * @return static */ public function concat(...$collections) { - return concat($this, ...$collections); + return static::from(concat($this, ...$collections)); } /** * Returns collection where each item is changed to the output of executing $function on each key/item. * - * @param callable $function - * @return CollectionInterface + * @template TRes + * @param callable(TVal, TKey):TRes $function + * @return static */ public function map(callable $function) { - return map($this->getItems(), $function); + return static::from(map($this->getItems(), $function)); } /** * Reduces the collection to single value by iterating over the collection and calling $function while * passing $startValue and current key/item as parameters. The output of $function is used as $startValue in * next iteration. The output of $function on last element is the return value of this function. If - * $convertToCollection is true and the return value is a collection (array|Traversable) an instance of Collection + * $convertToCollection is true and the return value is a collection (iterable) an instance of Collection * is returned. * - * @param callable $function ($tmpValue, $value, $key) - * @param mixed $startValue + * @template TRes + * @param callable $function + * @param TRes $startValue * @param bool $convertToCollection - * @return mixed|Collection + * @return TRes|CollectionInterface */ public function reduce(callable $function, $startValue, $convertToCollection = false) { $result = reduce($this->getItems(), $function, $startValue); - return ($convertToCollection && isCollection($result)) ? new Collection($result) : $result; + return ($convertToCollection && is_iterable($result)) ? new Collection($result) : $result; } /** * Returns a lazy collection with one or multiple levels of nesting flattened. Removes all nesting when no value * is passed. * - * @param int $depth How many levels should be flatten, default (-1) is infinite. - * @return CollectionInterface + * @param int $levelsToFlatten -1 to flatten everything + * @return CollectionInterface */ - public function flatten($depth = -1) + public function flatten($levelsToFlatten = -1) { - return flatten($this->getItems(), $depth); + return new Collection(flatten($this->getItems(), $levelsToFlatten)); } /** * Returns a non-lazy collection sorted using $function($item1, $item2, $key1, $key2 ). $function should * return true if first item is larger than the second and false otherwise. * - * @param callable $function ($value1, $value2, $key1, $key2) - * @return CollectionInterface + * @param callable(TVal, TVal, TKey, TKey): bool $function + * @return static */ public function sort(callable $function) { - return \DusanKasan\Knapsack\sort($this->getItems(), $function); + return static::from(\DusanKasan\Knapsack\sort($this->getItems(), $function)); } /** @@ -107,45 +115,54 @@ public function sort(callable $function) * number $to. The items before $from are also iterated over, just not returned. * * @param int $from - * @param int $to If omitted, will slice until end - * @return CollectionInterface + * @param int $to -1 to slice until end + * @return static */ - public function slice($from, $to = -1) + public function slice(int $from, int $to = -1) { - return slice($this->getItems(), $from, $to); + return static::from(slice($this->getItems(), $from, $to)); } /** * Returns collection which items are separated into groups indexed by the return value of $function. * - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TRes + * @param callable(TVal, TKey): TRes $function + * @return CollectionInterface> */ - public function groupBy(callable $function) + public function groupBy(callable $function): CollectionInterface { - return groupBy($this->getItems(), $function); + return new Collection(function () use ($function): iterable { + foreach (groupBy($this->getItems(), $function) as $k => $v) { + yield $k => static::from($v); + } + }); } /** * Returns collection where items are separated into groups indexed by the value at given key. * * @param mixed $key - * @return CollectionInterface + * @return CollectionInterface */ - public function groupByKey($key) + public function groupByKey($key): CollectionInterface { - return groupByKey($this->getItems(), $key); + return new Collection(function () use ($key): iterable { + foreach (groupByKey($this->getItems(), $key) as $k => $v) { + yield $k => static::from($v); + } + }); } /** * Returns a lazy collection in which $function is executed for each item. * - * @param callable $function ($value, $key) - * @return CollectionInterface + * @param callable(TVal, TKey): void $function + * @return static */ public function each(callable $function) { - return \DusanKasan\Knapsack\each($this->getItems(), $function); + return static::from(each($this->getItems(), $function)); } /** @@ -153,93 +170,94 @@ public function each(callable $function) * * @return int */ - public function size() + public function size(): int { return size($this->getItems()); } /** * Returns value at the key $key. If multiple values have this key, return first. If no value has this key, throw - * ItemNotFound. If $convertToCollection is true and the return value is a collection (array|Traversable) an + * ItemNotFound. If $convertToCollection is true and the return value is a collection (iterable) an * instance of Collection will be returned. * - * @param mixed $key + * @param TKey $key * @param bool $convertToCollection - * @return mixed|Collection - * @throws \DusanKasan\Knapsack\Exceptions\ItemNotFound + * @return TVal|CollectionInterface + * @throws ItemNotFound */ public function get($key, $convertToCollection = false) { $result = get($this->getItems(), $key); - return ($convertToCollection && isCollection($result)) ? new Collection($result) : $result; + return ($convertToCollection && is_iterable($result)) ? new Collection($result) : $result; } /** * Returns item at the key $key. If multiple items have this key, return first. If no item has this key, return * $ifNotFound. If no value has this key, throw ItemNotFound. If $convertToCollection is true and the return value - * is a collection (array|Traversable) an instance of Collection will be returned. + * is a collection (iterable) an instance of Collection will be returned. * - * @param mixed $key - * @param mixed $default + * @param TKey $key + * @param TVal $default * @param bool $convertToCollection - * @return mixed|Collection - * @throws \DusanKasan\Knapsack\Exceptions\ItemNotFound + * @return TVal|CollectionInterface */ public function getOrDefault($key, $default = null, $convertToCollection = false) { $result = getOrDefault($this->getItems(), $key, $default); - return ($convertToCollection && isCollection($result)) ? new Collection($result) : $result; + return ($convertToCollection && is_iterable($result)) ? new Collection($result) : $result; } /** * Returns first value matched by $function. If no value matches, return $default. If $convertToCollection is true - * and the return value is a collection (array|Traversable) an instance of Collection will be returned. + * and the return value is a collection (iterable) an instance of Collection will be returned. * - * @param callable $function - * @param mixed|null $default + * @param callable(TVal, TKey): bool $function + * @param TVal|null $default * @param bool $convertToCollection - * @return mixed|Collection + * @return TVal|CollectionInterface */ public function find(callable $function, $default = null, $convertToCollection = false) { $result = find($this->getItems(), $function, $default); - return ($convertToCollection && isCollection($result)) ? new Collection($result) : $result; + return ($convertToCollection && is_iterable($result)) ? new Collection($result) : $result; } /** * Returns a non-lazy collection of items whose keys are the return values of $function and values are the number of * items in this collection for which the $function returned this value. * - * @param callable $function - * @return CollectionInterface + * @template TRes + * @param callable(TVal, TKey): TRes $function + * @return CollectionInterface */ - public function countBy(callable $function) + public function countBy(callable $function): CollectionInterface { - return countBy($this->getItems(), $function); + return new Collection(countBy($this->getItems(), $function)); } /** * Returns a lazy collection by changing keys of this collection for each item to the result of $function for * that item. * - * @param callable $function - * @return CollectionInterface + * @template TNewKey + * @param callable(TVal, TKey): TNewKey $function + * @return static */ public function indexBy(callable $function) { - return indexBy($this->getItems(), $function); + return static::from(indexBy($this->getItems(), $function)); } /** * Returns true if $function returns true for every item in this collection, false otherwise. * - * @param callable $function + * @param callable(TVal, TKey): bool $function * @return bool */ - public function every(callable $function) + public function every(callable $function): bool { return every($this->getItems(), $function); } @@ -247,10 +265,10 @@ public function every(callable $function) /** * Returns true if $function returns true for at least one item in this collection, false otherwise. * - * @param callable $function + * @param callable(TVal, TKey): bool $function * @return bool */ - public function some(callable $function) + public function some(callable $function): bool { return some($this->getItems(), $function); } @@ -258,7 +276,7 @@ public function some(callable $function) /** * Returns true if $value is present in the collection. * - * @param mixed $value + * @param TVal $value * @return bool */ public function contains($value) @@ -269,173 +287,174 @@ public function contains($value) /** * Returns collection of items in this collection in reverse order. * - * @return CollectionInterface + * @return static */ public function reverse() { - return reverse($this->getItems()); + return static::from(reverse($this->getItems())); } /** * Reduce the collection to single value. Walks from right to left. If $convertToCollection is true and the return - * value is a collection (array|Traversable) an instance of Collection is returned. + * value is a collection (iterable) an instance of Collection is returned. * - * @param callable $function Must take 2 arguments, intermediate value and item from the iterator. - * @param mixed $startValue + * @template TRes + * @param callable $function + * @param TRes $startValue * @param bool $convertToCollection - * @return mixed|Collection + * @return TRes|CollectionInterface */ public function reduceRight(callable $function, $startValue, $convertToCollection = false) { $result = reduceRight($this->getItems(), $function, $startValue); - return ($convertToCollection && isCollection($result)) ? new Collection($result) : $result; + return ($convertToCollection && is_iterable($result)) ? new Collection($result) : $result; } /** * A form of slice that returns first $numberOfItems items. * * @param int $numberOfItems - * @return CollectionInterface + * @return static */ - public function take($numberOfItems) + public function take(int $numberOfItems) { - return take($this->getItems(), $numberOfItems); + return static::from(take($this->getItems(), $numberOfItems)); } /** * A form of slice that returns all but first $numberOfItems items. * * @param int $numberOfItems - * @return CollectionInterface + * @return static */ - public function drop($numberOfItems) + public function drop(int $numberOfItems) { - return drop($this->getItems(), $numberOfItems); + return static::from(drop($this->getItems(), $numberOfItems)); } /** * Returns collection of values from this collection but with keys being numerical from 0 upwards. * - * @return CollectionInterface + * @return static */ public function values() { - return values($this->getItems()); + return static::from(values($this->getItems())); } /** * Returns a lazy collection without elements matched by $function. * - * @param callable $function - * @return CollectionInterface + * @param callable(TVal, TKey): bool $function + * @return static */ public function reject(callable $function) { - return reject($this->getItems(), $function); + return static::from(reject($this->getItems(), $function)); } /** * Returns a lazy collection of the keys of this collection. * - * @return CollectionInterface + * @return CollectionInterface */ public function keys() { - return keys($this->getItems()); + return new Collection(keys($this->getItems())); } /** * Returns a lazy collection of items of this collection separated by $separator * - * @param mixed $separator - * @return CollectionInterface + * @param TVal $separator + * @return static */ public function interpose($separator) { - return interpose($this->getItems(), $separator); + return static::from(interpose($this->getItems(), $separator)); } /** * Returns a lazy collection with last $numberOfItems items skipped. These are still iterated over, just skipped. * * @param int $numberOfItems - * @return CollectionInterface + * @return static */ - public function dropLast($numberOfItems = 1) + public function dropLast(int $numberOfItems = 1) { - return dropLast($this->getItems(), $numberOfItems); + return static::from(dropLast($this->getItems(), $numberOfItems)); } /** * Returns a lazy collection of first item from first collection, first item from second, second from first and * so on. Accepts any number of collections. * - * @param array|\Traversable ...$collections - * @return CollectionInterface + * @param iterable ...$collections + * @return static */ public function interleave(...$collections) { - return interleave($this->getItems(), ...$collections); + return static::from(interleave($this->getItems(), ...$collections)); } /** * Returns an infinite lazy collection of items in this collection repeated infinitely. * - * @return CollectionInterface + * @return static */ public function cycle() { - return cycle($this->getItems()); + return static::from(cycle($this->getItems())); } /** * Returns a lazy collection of items of this collection with $value added as first element. If $key is not provided * it will be next integer index. * - * @param mixed $value - * @param mixed|null $key - * @return CollectionInterface + * @param TVal $value + * @param TKey|null $key + * @return static */ public function prepend($value, $key = null) { - return prepend($this->getItems(), $value, $key); + return static::from(prepend($this->getItems(), $value, $key)); } /** * Returns a lazy collection of items of this collection with $value added as last element. If $key is not provided * it will be next integer index. * - * @param mixed $value - * @param mixed $key - * @return CollectionInterface + * @param TVal $value + * @param TKey|null $key + * @return static */ public function append($value, $key = null) { - return append($this->getItems(), $value, $key); + return static::from(append($this->getItems(), $value, $key)); } /** * Returns a lazy collection by removing items from this collection until first item for which $function returns * false. * - * @param callable $function - * @return CollectionInterface + * @param callable(TVal, TKey): bool $function + * @return static */ public function dropWhile(callable $function) { - return dropWhile($this->getItems(), $function); + return static::from(dropWhile($this->getItems(), $function)); } /** * Returns a lazy collection which is a result of calling map($function) and then flatten(1) * * @param callable $function - * @return CollectionInterface + * @return static */ public function mapcat(callable $function) { - return mapcat($this->getItems(), $function); + return static::from(mapcat($this->getItems(), $function)); } /** @@ -443,45 +462,53 @@ public function mapcat(callable $function) * returns false. * * @param callable $function - * @return CollectionInterface + * @return static */ public function takeWhile(callable $function) { - return takeWhile($this->getItems(), $function); + return static::from(takeWhile($this->getItems(), $function)); } /** * Returns a collection of [take($position), drop($position)] * * @param int $position - * @return CollectionInterface + * @return static */ public function splitAt($position) { - return splitAt($this->getItems(), $position); + return static::from(function () use ($position): Generator { + foreach (splitAt($this->getItems(), $position) as $k => $v) { + yield $k => static::from($v); + } + }); } /** * Returns a collection of [takeWhile($predicament), dropWhile($predicament] * * @param callable $function - * @return CollectionInterface + * @return static */ public function splitWith(callable $function) { - return splitWith($this->getItems(), $function); + return static::from(function () use ($function): Generator { + foreach (splitWith($this->getItems(), $function) as $k => $v) { + yield $k => static::from($v); + } + }); } /** * Returns a lazy collection with items from this collection but values that are found in keys of $replacementMap * are replaced by their values. * - * @param array|\Traversable $replacementMap - * @return CollectionInterface + * @param iterable $replacementMap + * @return static */ public function replace($replacementMap) { - return replace($this->getItems(), $replacementMap); + return static::from(replace($this->getItems(), $replacementMap)); } /** @@ -489,22 +516,22 @@ public function replace($replacementMap) * * @param callable $function * @param mixed $startValue - * @return CollectionInterface + * @return static */ public function reductions(callable $function, $startValue) { - return reductions($this->getItems(), $function, $startValue); + return static::from(reductions($this->getItems(), $function, $startValue)); } /** * Returns a lazy collection of every nth item in this collection * * @param int $step - * @return CollectionInterface + * @return static */ public function takeNth($step) { - return takeNth($this->getItems(), $step); + return static::from(takeNth($this->getItems(), $step)); } /** @@ -514,7 +541,7 @@ public function takeNth($step) */ public function shuffle() { - return \DusanKasan\Knapsack\shuffle($this->getItems()); + return static::from(\DusanKasan\Knapsack\shuffle($this->getItems())); } /** @@ -526,12 +553,17 @@ public function shuffle() * * @param int $numberOfItems * @param int $step - * @param array|\Traversable $padding - * @return CollectionInterface + * @param iterable $padding + * @return static */ public function partition($numberOfItems, $step = 0, $padding = []) { - return partition($this->getItems(), $numberOfItems, $step, $padding); + return static::from(function() use ($numberOfItems, $step, $padding) { + $c = partition($this->getItems(), $numberOfItems, $step, $padding); + foreach($c as $k => $v) { + yield $k => static::from($v); + } + }); } /** @@ -539,11 +571,16 @@ public function partition($numberOfItems, $step = 0, $padding = []) * return different result. * * @param callable $function - * @return CollectionInterface + * @return static */ public function partitionBy(callable $function) { - return partitionBy($this->getItems(), $function); + return static::from(function() use ($function) { + $c = partitionBy($this->getItems(), $function); + foreach($c as $k => $v) { + yield $k => static::from($v); + } + }); } /** @@ -570,124 +607,125 @@ public function isNotEmpty() * Returns a collection where keys are distinct items from this collection and their values are number of * occurrences of each value. * - * @return CollectionInterface + * @return static */ public function frequencies() { - return frequencies($this->getItems()); + return static::from(frequencies($this->getItems())); } /** * Returns first item of this collection. If the collection is empty, throws ItemNotFound. If $convertToCollection - * is true and the return value is a collection (array|Traversable) an instance of Collection is returned. + * is true and the return value is a collection (iterable) an instance of Collection is returned. * * @param bool $convertToCollection * @return mixed|Collection - * @throws \DusanKasan\Knapsack\Exceptions\ItemNotFound + * @throws ItemNotFound */ public function first($convertToCollection = false) { $result = first($this->getItems()); - return ($convertToCollection && isCollection($result)) ? new Collection($result) : $result; + return ($convertToCollection && is_iterable($result)) ? new Collection($result) : $result; } /** * Returns last item of this collection. If the collection is empty, throws ItemNotFound. If $convertToCollection - * is true and the return value is a collection (array|Traversable) it is converted to Collection. + * is true and the return value is a collection (iterable) it is converted to Collection. * * @param bool $convertToCollection * @return mixed|Collection - * @throws \DusanKasan\Knapsack\Exceptions\ItemNotFound + * @throws ItemNotFound */ public function last($convertToCollection = false) { $result = last($this->getItems()); - return ($convertToCollection && isCollection($result)) ? new Collection($result) : $result; + return ($convertToCollection && is_iterable($result)) ? new Collection($result) : $result; } /** * Realizes collection - turns lazy collection into non-lazy one by iterating over it and storing the key/values. * - * @return CollectionInterface + * @return static */ public function realize() { - return realize($this->getItems()); + return static::from(realize($this->getItems())); } /** * Returns the second item in this collection or throws ItemNotFound if the collection is empty or has 1 item. If - * $convertToCollection is true and the return value is a collection (array|Traversable) it is converted to + * $convertToCollection is true and the return value is a collection (iterable) it is converted to * Collection. * * @param bool $convertToCollection * @return mixed|Collection - * @throws \DusanKasan\Knapsack\Exceptions\ItemNotFound + * @throws ItemNotFound */ public function second($convertToCollection = false) { $result = second($this->getItems()); - return ($convertToCollection && isCollection($result)) ? new Collection($result) : $result; + return ($convertToCollection && is_iterable($result)) ? new Collection($result) : $result; } /** * Combines the values of this collection as keys, with values of $collection as values. The resulting collection * has length equal to the size of smaller collection. * - * @param array|\Traversable $collection - * @return CollectionInterface - * @throws \DusanKasan\Knapsack\Exceptions\ItemNotFound + * @template TNewVal + * @param iterable $collection + * @return static + * @throws ItemNotFound */ - public function combine($collection) + public function combine(iterable $collection) { - return combine($this->getItems(), $collection); + return static::from(combine($this->getItems(), $collection)); } /** * Returns a lazy collection without the items associated to any of the keys from $keys. * - * @param array|\Traversable $keys - * @return CollectionInterface + * @param iterable $keys + * @return static */ - public function except($keys) + public function except(iterable $keys) { - return except($this->getItems(), $keys); + return static::from(except($this->getItems(), $keys)); } /** * Returns a lazy collection of items associated to any of the keys from $keys. * - * @param array|\Traversable $keys - * @return CollectionInterface + * @param iterable $keys + * @return static */ - public function only($keys) + public function only(iterable $keys) { - return only($this->getItems(), $keys); + return static::from(only($this->getItems(), $keys)); } /** * Returns a lazy collection of items that are in $this but are not in any of the other arguments, indexed by the * keys from the first collection. Note that the ...$collections are iterated non-lazily. * - * @param array|\Traversable ...$collections - * @return CollectionInterface + * @param iterable ...$collections + * @return static */ public function diff(...$collections) { - return diff($this->getItems(), ...$collections); + return static::from(diff($this->getItems(), ...$collections)); } /** * Returns a lazy collection where keys and values are flipped. * - * @return CollectionInterface + * @return static */ public function flip() { - return flip($this->getItems()); + return static::from(flip($this->getItems())); } /** @@ -705,14 +743,13 @@ public function has($key) * Returns a lazy collection of non-lazy collections of items from nth position from this collection and each * passed collection. Stops when any of the collections don't have an item at the nth position. * - * @param array|\Traversable ...$collections - * @return CollectionInterface + * @param iterable ...$collections + * @return static> */ - public function zip(...$collections) + public function zip(iterable ...$collections) { array_unshift($collections, $this->getItems()); - - return zip(...$collections); + return static::from(zip(...$collections)); } /** @@ -739,11 +776,16 @@ public function transform(callable $transformer) * Transpose each item in a collection, interchanging the row and column indexes. * Can only transpose collections of collections. Otherwise an InvalidArgument is raised. * - * @return CollectionInterface + * @TODO: TVal must be iterable + * @return static */ public function transpose() { - return transpose($this->getItems()); + return static::from(function (): Generator { + foreach (transpose($this->getItems()) as $k => $v) { + yield $k => static::from($v); + } + }); } /** @@ -751,23 +793,23 @@ public function transpose() * it must be escaped using \ character. * * @param mixed $keyPath - * @return CollectionInterface + * @return CollectionInterface */ public function extract($keyPath) { - return \DusanKasan\Knapsack\extract($this->getItems(), $keyPath); + return Collection::from(extract($this->getItems(), $keyPath)); } /** * Returns a lazy collection of items that are in $this and all the other arguments, indexed by the keys from * the first collection. Note that the ...$collections are iterated non-lazily. * - * @param array|\Traversable ...$collections - * @return CollectionInterface + * @param iterable ...$collections + * @return static */ - public function intersect(...$collections) + public function intersect(iterable ...$collections) { - return intersect($this->getItems(), ...$collections); + return static::from(intersect($this->getItems(), ...$collections)); } /** @@ -776,7 +818,7 @@ public function intersect(...$collections) * @param int $size * @return bool */ - public function sizeIs($size) + public function sizeIs(int $size): bool { return sizeIs($this->getItems(), $size); } @@ -787,7 +829,7 @@ public function sizeIs($size) * @param int $size * @return bool */ - public function sizeIsLessThan($size) + public function sizeIsLessThan(int $size): bool { return sizeIsLessThan($this->getItems(), $size); } @@ -798,7 +840,7 @@ public function sizeIsLessThan($size) * @param int $size * @return bool */ - public function sizeIsGreaterThan($size) + public function sizeIsGreaterThan(int $size): bool { return sizeIsGreaterThan($this->getItems(), $size); } @@ -811,7 +853,7 @@ public function sizeIsGreaterThan($size) * @param int $toSize * @return bool */ - public function sizeIsBetween($fromSize, $toSize) + public function sizeIsBetween(int $fromSize, int $toSize): bool { return sizeIsBetween($this->getItems(), $fromSize, $toSize); } @@ -839,21 +881,21 @@ public function average() /** * Returns maximal value from this collection. * - * @return mixed + * @return TVal */ public function max() { - return \DusanKasan\Knapsack\max($this->getItems()); + return max($this->getItems()); } /** * Returns minimal value from this collection. * - * @return mixed + * @return TVal */ public function min() { - return \DusanKasan\Knapsack\min($this->getItems()); + return min($this->getItems()); } /** @@ -861,7 +903,7 @@ public function min() * * @return string */ - public function toString() + public function toString(): string { return toString($this->getItems()); } @@ -870,12 +912,12 @@ public function toString() * Returns a lazy collection with items from $collection, but items with keys that are found in keys of * $replacementMap are replaced by their values. * - * @param array|\Traversable $replacementMap - * @return CollectionInterface + * @param iterable $replacementMap + * @return static */ - public function replaceByKeys($replacementMap) + public function replaceByKeys(iterable $replacementMap) { - return replaceByKeys($this->getItems(), $replacementMap); + return static::from(replaceByKeys($this->getItems(), $replacementMap)); } /** @@ -902,7 +944,7 @@ public function replaceByKeys($replacementMap) * @param int|null $maxDepth * @return array */ - public function dump($maxItemsPerCollection = null, $maxDepth = null) + public function dump(int $maxItemsPerCollection = null, int $maxDepth = null): array { return dump($this->getItems(), $maxItemsPerCollection, $maxDepth); } @@ -912,24 +954,24 @@ public function dump($maxItemsPerCollection = null, $maxDepth = null) * * @param int|null $maxItemsPerCollection * @param int|null $maxDepth - * @return CollectionInterface + * @return static */ - public function printDump($maxItemsPerCollection = null, $maxDepth = null) + public function printDump(int $maxItemsPerCollection = null, int $maxDepth = null) { - return printDump($this->getItems(), $maxItemsPerCollection, $maxDepth); + printDump($this->getItems(), $maxItemsPerCollection, $maxDepth); + return $this; } /** - * @return array|\Traversable + * @return iterable */ - protected function getItems() - { - return $this; - } + protected abstract function getItems(): iterable; /** - * @param Collection $collection - * @return CollectionInterface + * @template CKey + * @template CVal + * @param callable():iterable|iterable $i + * @return static */ - protected abstract function buildFromCollection(CollectionInterface $collection); + protected abstract static function from($i); } diff --git a/src/RewindableIterable.php b/src/RewindableIterable.php new file mode 100644 index 0000000..967f49c --- /dev/null +++ b/src/RewindableIterable.php @@ -0,0 +1,42 @@ + + */ + private $factory; + + /** + * @param callable(): iterable $factory + */ + public function __construct(callable $factory) + { + $this->factory = function() use ($factory): Traversable { + $iterable = $factory(); + if (is_array($iterable)) { + $iterable = new ArrayIterator($iterable); + } + return $iterable; + }; + } + + /** + * @return Traversable + */ + public function getIterator(): Traversable + { + $fn = $this->factory; + return $fn(); + } +} \ No newline at end of file diff --git a/src/collection_functions.php b/src/collection_functions.php index 29f1a2c..6761a77 100644 --- a/src/collection_functions.php +++ b/src/collection_functions.php @@ -5,17 +5,20 @@ use DusanKasan\Knapsack\Exceptions\InvalidArgument; use DusanKasan\Knapsack\Exceptions\ItemNotFound; use DusanKasan\Knapsack\Exceptions\NoMoreItems; +use Generator; use Iterator; -use IteratorIterator; +use ReflectionObject; use Traversable; /** * Converts $collection to array. If there are multiple items with the same key, only the last will be preserved. * - * @param array|Traversable $collection - * @return array + * @template TKey + * @template TVal + * @param iterable $collection + * @return array */ -function toArray($collection) +function toArray(iterable $collection) { return is_array($collection) ? $collection : iterator_to_array($collection); } @@ -23,14 +26,15 @@ function toArray($collection) /** * Returns a lazy collection of distinct items in $collection. * - * @param array|Traversable $collection - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @return iterable */ -function distinct($collection) +function distinct(iterable $collection): iterable { - $generatorFactory = function () use ($collection) { + $factory = function () use ($collection): Generator { $distinctValues = []; - foreach ($collection as $key => $value) { if (!in_array($value, $distinctValues)) { $distinctValues[] = $value; @@ -39,19 +43,19 @@ function distinct($collection) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns number of items in $collection. * - * @param array|Traversable $collection + * @param iterable $collection * @return int */ -function size($collection) +function size($collection): int { $result = 0; - foreach ($collection as $value) { + foreach ($collection as $_) { $result++; } @@ -61,76 +65,74 @@ function size($collection) /** * Returns a non-lazy collection with items from $collection in reversed order. * - * @param array|Traversable $collection - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @return iterable */ -function reverse($collection) +function reverse(iterable $collection): iterable { - $generatorFactory = function () use ($collection) { + $factory = function () use ($collection): Generator { $array = []; foreach ($collection as $key => $value) { $array[] = [$key, $value]; } - return map( - indexBy( - array_reverse($array), - function ($item) { - return $item[0]; - } - ), - function ($item) { - return $item[1]; - } - ); + foreach (array_reverse($array) as $item) { + yield $item[0] => $item[1]; + } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection of values from $collection (i.e. the keys are reset). * - * @param array|Traversable $collection - * @return CollectionInterface + * @template TVal + * @param iterable $collection + * @return iterable */ -function values($collection) +function values(iterable $collection): iterable { - $generatorFactory = function () use ($collection) { + $factory = function () use ($collection): iterable { foreach ($collection as $value) { yield $value; } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection of keys from $collection. * - * @param array|Traversable $collection - * @return CollectionInterface + * @template TKey + * @param iterable $collection + * @return iterable */ -function keys($collection) +function keys(iterable $collection): iterable { - $generatorFactory = function () use ($collection) { + $factory = function () use ($collection): Generator { foreach ($collection as $key => $value) { yield $key; } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection of items from $collection repeated infinitely. * - * @param array|Traversable $collection - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @return iterable */ -function cycle($collection) +function cycle(iterable $collection): iterable { - $generatorFactory = function () use ($collection) { + $factory = function () use ($collection): Generator { while (true) { foreach ($collection as $key => $value) { yield $key => $value; @@ -138,36 +140,42 @@ function cycle($collection) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a non-lazy collection of shuffled items from $collection. * - * @param array|Traversable $collection - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @return iterable */ -function shuffle($collection) +function shuffle(iterable $collection): iterable { - $buffer = []; - foreach ($collection as $key => $value) { - $buffer[] = [$key, $value]; - } + $factory = function () use ($collection): Traversable { + $buffer = []; + foreach ($collection as $key => $value) { + $buffer[] = [$key, $value]; + } - \shuffle($buffer); + \shuffle($buffer); - return dereferenceKeyValue($buffer); + return dereferenceKeyValue($buffer); + }; + + return new RewindableIterable($factory); } /** * Returns true if $collection does not contain any items. * - * @param array|Traversable $collection + * @param iterable $collection * @return bool */ -function isEmpty($collection) +function isEmpty(iterable $collection): bool { - foreach ($collection as $value) { + foreach ($collection as $_) { return false; } @@ -177,10 +185,10 @@ function isEmpty($collection) /** * Returns true if $collection does contain any items. * - * @param array|Traversable $collection + * @param iterable $collection * @return bool */ -function isNotEmpty($collection) +function isNotEmpty(iterable $collection) { return !isEmpty($collection); } @@ -189,21 +197,32 @@ function isNotEmpty($collection) * Returns a collection where keys are distinct values from $collection and values are number of occurrences of each * value. * - * @param array|Traversable $collection - * @return CollectionInterface + * @template TVal + * @param iterable $collection + * @return iterable */ -function frequencies($collection) +function frequencies(iterable $collection): iterable { - return countBy($collection, '\DusanKasan\Knapsack\identity'); + return countBy( + $collection, + /** + * @param mixed $item + * @return mixed + */ + function ($item) { + return $item; + } + ); } /** * Returns the first item of $collection or throws ItemNotFound if #collection is empty. * - * @param array|Traversable $collection - * @return mixed + * @template TVal + * @param iterable $collection + * @return TVal */ -function first($collection) +function first(iterable $collection) { return get(values($collection), 0); } @@ -211,8 +230,9 @@ function first($collection) /** * Returns the last item of $collection or throws ItemNotFound if #collection is empty. * - * @param array|Traversable $collection - * @return mixed + * @template TVal + * @param iterable $collection + * @return TVal */ function last($collection) { @@ -223,37 +243,48 @@ function last($collection) * Returns a lazy collection of items of $collection where value of each item is set to the return value of calling * $function on its value and key. * - * @param array|Traversable $collection - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TKey + * @template TVal + * @template TRes + * @param iterable $collection + * @param callable(TVal, TKey):TRes $function + * @return iterable */ -function map($collection, callable $function) +function map(iterable $collection, callable $function): iterable { - $generatorFactory = function () use ($collection, $function) { + $factory = function () use ($collection, $function): iterable { foreach ($collection as $key => $value) { yield $key => $function($value, $key); } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection of items from $collection for which $function returns true. * - * @param array|Traversable $collection - * @param callable|null $function ($value, $key) - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param callable(TVal, TKey): bool|null $function + * @return iterable */ function filter($collection, callable $function = null) { if (null === $function) { - $function = function ($value) { - return (bool) $value; - }; + $function = + /** + * @param mixed $value + * @param mixed $_ + * @return bool + */ + function ($value, $_): bool { + return (bool)$value; + }; } - $generatorFactory = function () use ($collection, $function) { + $factory = function () use ($collection, $function): iterable { foreach ($collection as $key => $value) { if ($function($value, $key)) { yield $key => $value; @@ -261,18 +292,20 @@ function filter($collection, callable $function = null) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection with items from all $collections passed as argument appended together * - * @param array|Traversable ...$collections - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable ...$collections + * @return iterable */ -function concat(...$collections) +function concat(iterable ...$collections): iterable { - $generatorFactory = function () use ($collections) { + $factory = function () use ($collections): iterable { foreach ($collections as $collection) { foreach ($collection as $key => $value) { yield $key => $value; @@ -280,7 +313,7 @@ function concat(...$collections) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** @@ -288,12 +321,15 @@ function concat(...$collections) * passing $startValue and current key/item as parameters. The output of $function is used as $startValue in * next iteration. The output of $function on last element is the return value of this function. * - * @param array|Traversable $collection - * @param callable $function ($value, $key) - * @param mixed $startValue - * @return mixed + * @template TKey + * @template TVal + * @template TRes + * @param iterable $collection + * @param callable(TRes, TVal, TKey): TRes $function + * @param TRes $startValue + * @return TRes */ -function reduce($collection, callable $function, $startValue) +function reduce(iterable $collection, callable $function, $startValue) { $tmp = duplicate($startValue); @@ -308,13 +344,13 @@ function reduce($collection, callable $function, $startValue) * Flattens multiple levels of nesting in collection. If $levelsToFlatten is not specified, flattens all levels of * nesting. * - * @param array|Traversable $collection + * @param iterable $collection * @param int $levelsToFlatten -1 to flatten everything - * @return CollectionInterface + * @return iterable */ -function flatten($collection, $levelsToFlatten = -1) +function flatten(iterable $collection, int $levelsToFlatten = -1): iterable { - $generatorFactory = function () use ($collection, $levelsToFlatten) { + $factory = function () use ($collection, $levelsToFlatten): Generator { $flattenNextLevel = $levelsToFlatten < 0 || $levelsToFlatten > 0; $childLevelsToFlatten = $levelsToFlatten > 0 ? $levelsToFlatten - 1 : $levelsToFlatten; @@ -329,38 +365,54 @@ function flatten($collection, $levelsToFlatten = -1) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** - * Returns a non-lazy collection sorted using $collection($item1, $item2, $key1, $key2 ). $collection should + * Returns a non-lazy collection sorted using $function($item1, $item2, $key1, $key2). $function should * return true if first item is larger than the second and false otherwise. * - * @param array|Traversable $collection - * @param callable $function ($value1, $value2, $key1, $key2) - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param callable(TVal, TVal, TKey, TKey): bool $function + * @return iterable */ -function sort($collection, callable $function) +function sort(iterable $collection, callable $function): iterable { - $array = iterator_to_array( - values( - map( - $collection, - function ($value, $key) { - return [$key, $value]; - } + $factory = function () use ($collection, $function): Traversable { + $array = toArray( + values( + map( + $collection, + /** + * @param mixed $value + * @param mixed $key + * @return array + */ + function ($value, $key): array { + return [$key, $value]; + } + ) ) - ) - ); + ); - uasort( - $array, - function ($a, $b) use ($function) { - return $function($a[1], $b[1], $a[0], $b[0]); - } - ); + uasort( + $array, + /** + * @param mixed $a + * @param mixed $b + * @return int + */ + function ($a, $b) use ($function): int { + return (int)$function($a[1], $b[1], $a[0], $b[0]); + } + ); + + return dereferenceKeyValue($array); + }; - return dereferenceKeyValue($array); + return new RewindableIterable($factory); } /** @@ -368,14 +420,16 @@ function ($a, $b) use ($function) { * If $to is not provided, the returned collection is contains all items from $from until end of $collection. All items * before $from are iterated over, but not included in result. * - * @param array|Traversable $collection + * @template TKey + * @template TVal + * @param iterable $collection * @param int $from * @param int $to -1 to slice until end - * @return CollectionInterface + * @return iterable */ -function slice($collection, $from, $to = -1) +function slice(iterable $collection, int $from, int $to = -1): iterable { - $generatorFactory = function () use ($collection, $from, $to) { + $factory = function () use ($collection, $from, $to): iterable { $index = 0; foreach ($collection as $key => $value) { if ($index >= $from && ($index < $to || $to == -1)) { @@ -388,69 +442,84 @@ function slice($collection, $from, $to = -1) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a non-lazy collection of items grouped by the result of $function. * - * @param array|Traversable $collection - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TKey + * @template TVal + * @template TRes + * @param iterable $collection + * @param callable(TVal, TKey): TRes $function + * @return iterable> */ -function groupBy($collection, callable $function) +function groupBy(iterable $collection, callable $function): iterable { - $result = []; + $factory = function () use ($collection, $function): array { + $result = []; - foreach ($collection as $key => $value) { - $newKey = $function($value, $key); + foreach ($collection as $key => $value) { + $newKey = $function($value, $key); + $result[$newKey][] = $value; + } - $result[$newKey][] = $value; - } + return $result; + }; - return Collection::from($result) - ->map(function ($entry) { - return new Collection($entry); - }); + return new RewindableIterable($factory); } /** * Returns a non-lazy collection of items grouped by the value at given key. Ignores non-collection items and items * without the given keys * - * @param array|Traversable $collection - * @param mixed $key - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable> $collection + * @param TKey $key + * @return iterable> */ -function groupByKey($collection, $key) +function groupByKey(iterable $collection, $key): iterable { - $generatorFactory = function () use ($collection, $key) { - + $generatorFactory = function () use ($collection, $key): iterable { return groupBy( filter( $collection, - function ($item) use ($key) { - return isCollection($item) && has($item, $key); + /** + * @param mixed $item + * @return bool + */ + function ($item) use ($key): bool { + return is_iterable($item) && has($item, $key); } ), + /** + * @param mixed $value + * @return mixed + */ function ($value) use ($key) { return get($value, $key); } ); }; - return new Collection($generatorFactory); + return new RewindableIterable($generatorFactory); } + /** * Executes $function for each item in $collection * - * @param array|Traversable $collection - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param callable(TVal, TKey): void $function + * @return iterable */ -function each($collection, callable $function) +function each(iterable $collection, callable $function): iterable { - $generatorFactory = function () use ($collection, $function) { + $factory = function () use ($collection, $function): iterable { foreach ($collection as $key => $value) { $function($value, $key); @@ -458,17 +527,19 @@ function each($collection, callable $function) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns an item with $key key from $collection. If that key is not present, throws ItemNotFound. * - * @param array|Traversable $collection - * @param mixed $key - * @return mixed + * @template TKey + * @template TVal + * @param iterable $collection + * @param TKey $key + * @return TVal */ -function get($collection, $key) +function get(iterable $collection, $key) { foreach ($collection as $valueKey => $value) { if ($key === $valueKey) { @@ -482,12 +553,14 @@ function get($collection, $key) /** * Returns an item with $key key from $collection. If that key is not present, returns $default. * - * @param array|Traversable $collection - * @param mixed $key - * @param mixed $default value returned if key is not found - * @return mixed + * @template TKey + * @template TVal + * @param iterable $collection + * @param TKey $key + * @param TVal $default value returned if key is not found + * @return TVal */ -function getOrDefault($collection, $key, $default) +function getOrDefault(iterable $collection, $key, $default) { try { return get($collection, $key); @@ -500,12 +573,14 @@ function getOrDefault($collection, $key, $default) * Returns the first item from $collection for which $function returns true. If item like that is not present, returns * $default. * - * @param array|Traversable $collection - * @param callable $function ($value, $key) - * @param mixed $default - * @return mixed + * @template TKey + * @template TVal + * @param iterable $collection + * @param callable(TVal, TKey): bool $function + * @param TVal|null $default + * @return TVal|null */ -function find($collection, callable $function, $default = null) +function find(iterable $collection, callable $function, $default = null) { foreach ($collection as $key => $value) { if ($function($value, $key)) { @@ -520,42 +595,56 @@ function find($collection, callable $function, $default = null) * Returns a lazy collection by changing keys of $collection for each item to the result of $function for * that item. * - * @param array|Traversable $collection - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TKey + * @template TVal + * @template TNewKey + * @param iterable $collection + * @param callable(TVal, TKey): TNewKey $function + * @return iterable */ function indexBy($collection, callable $function) { - $generatorFactory = function () use ($collection, $function) { + $factory = function () use ($collection, $function): iterable { foreach ($collection as $key => $value) { yield $function($value, $key) => $value; } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a non-lazy collection of items whose keys are the return values of $function and values are the number of * items in this collection for which the $function returned this value. * - * @param array|Traversable $collection - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TKey + * @template TVal + * @template TRes + * @param iterable $collection + * @param callable(TVal, TKey): TRes $function + * @return iterable */ function countBy($collection, callable $function) { return map( groupBy($collection, $function), - '\DusanKasan\Knapsack\size' + /** + * @param mixed $c + * @return int + */ + function ($c): int { + return size($c); + } ); } /** * Returns true if $function returns true for every item in $collection * - * @param array|Traversable $collection - * @param callable $function ($value, $key) + * @template TKey + * @template TVal + * @param iterable $collection + * @param callable(TVal, TKey): bool $function * @return bool */ function every($collection, callable $function) @@ -572,8 +661,10 @@ function every($collection, callable $function) /** * Returns true if $function returns true for at least one item in $collection. * - * @param array|Traversable $collection - * @param callable $function ($value, $key) + * @template TKey + * @template TVal + * @param iterable $collection + * @param callable(TVal, TKey): bool $function * @return bool */ function some($collection, callable $function) @@ -590,7 +681,7 @@ function some($collection, callable $function) /** * Returns true if $needle is found in $collection values. * - * @param array|Traversable $collection + * @param iterable $collection * @param mixed $needle * @return bool */ @@ -608,12 +699,15 @@ function contains($collection, $needle) /** * Reduce that walks from right to the left. * - * @param array|Traversable $collection - * @param callable $function - * @param mixed $startValue - * @return mixed + * @template TKey + * @template TVal + * @template TRes + * @param iterable $collection + * @param callable(TRes, TVal, TKey): TRes $function + * @param TRes $startValue + * @return TRes */ -function reduceRight($collection, callable $function, $startValue) +function reduceRight(iterable $collection, callable $function, $startValue) { return reduce(reverse($collection), $function, $startValue); } @@ -621,11 +715,13 @@ function reduceRight($collection, callable $function, $startValue) /** * Returns a lazy collection of first $numberOfItems items of $collection. * - * @param array|Traversable $collection + * @template TKey + * @template TVal + * @param iterable $collection * @param int $numberOfItems - * @return CollectionInterface + * @return iterable */ -function take($collection, $numberOfItems) +function take(iterable $collection, int $numberOfItems): iterable { return slice($collection, 0, $numberOfItems); } @@ -633,11 +729,13 @@ function take($collection, $numberOfItems) /** * Returns a lazy collection of all but first $numberOfItems items of $collection. * - * @param array|Traversable $collection + * @template TKey + * @template TVal + * @param iterable $collection * @param int $numberOfItems - * @return CollectionInterface + * @return iterable */ -function drop($collection, $numberOfItems) +function drop(iterable $collection, int $numberOfItems): iterable { return slice($collection, $numberOfItems); } @@ -647,14 +745,15 @@ function drop($collection, $numberOfItems) * $function to the last value in the collection. By default this produces an infinite collection. However you can * end the collection by throwing a NoMoreItems exception. * - * @param mixed $value - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TVal + * @param TVal $value + * @param callable(TVal): TVal $function + * @return iterable */ function iterate($value, callable $function) { $duplicated = duplicate($value); - $generatorFactory = function () use ($duplicated, $function) { + $factory = function () use ($duplicated, $function): iterable { $value = $duplicated; yield $value; @@ -669,21 +768,28 @@ function iterate($value, callable $function) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection of items from $collection for which $function returned true. * - * @param array|Traversable $collection - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param callable(TVal, TKey): bool $function + * @return iterable */ -function reject($collection, callable $function) +function reject(iterable $collection, callable $function): iterable { return filter( $collection, - function ($value, $key) use ($function) { + /** + * @param mixed $value + * @param mixed $key + * @return bool + */ + function ($value, $key) use ($function): bool { return !$function($value, $key); } ); @@ -692,13 +798,15 @@ function ($value, $key) use ($function) { /** * Returns a lazy collection of items in $collection without the last $numberOfItems items. * - * @param array|Traversable $collection + * @template TKey + * @template TVal + * @param iterable $collection * @param int $numberOfItems - * @return CollectionInterface + * @return iterable */ -function dropLast($collection, $numberOfItems = 1) +function dropLast(iterable $collection, $numberOfItems = 1): iterable { - $generatorFactory = function () use ($collection, $numberOfItems) { + $factory = function () use ($collection, $numberOfItems): iterable { $buffer = []; foreach ($collection as $key => $value) { @@ -711,19 +819,21 @@ function dropLast($collection, $numberOfItems = 1) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection of items from $collection separated by $separator. * - * @param array|Traversable $collection - * @param mixed $separator - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param TVal $separator + * @return iterable */ -function interpose($collection, $separator) +function interpose(iterable $collection, $separator): iterable { - $generatorFactory = function () use ($collection, $separator) { + $factory = function () use ($collection, $separator): iterable { foreach (take($collection, 1) as $key => $value) { yield $key => $value; } @@ -734,23 +844,25 @@ function interpose($collection, $separator) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection of first item from first collection, first item from second, second from first and * so on. Accepts any number of collections. * - * @param array|Traversable ...$collections - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable ...$collections + * @return iterable */ -function interleave(...$collections) +function interleave(iterable ...$collections): iterable { - $generatorFactory = function () use ($collections) { + $generatorFactory = function () use ($collections): iterable { /* @var Iterator[] $iterators */ $iterators = array_map( function ($collection) { - $it = new IteratorIterator(new Collection($collection)); + $it = iterableToIterator($collection); $it->rewind(); return $it; }, @@ -769,21 +881,23 @@ function ($collection) { } while ($valid); }; - return new Collection($generatorFactory); + return new RewindableIterable($generatorFactory); } /** * Returns a lazy collection of items in $collection with $value added as first element. If $key is not provided * it will be next integer index. * - * @param array|Traversable $collection - * @param mixed $value - * @param mixed|null $key - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param TVal $value + * @param TKey|null $key + * @return iterable */ -function prepend($collection, $value, $key = null) +function prepend(iterable $collection, $value, $key = null): iterable { - $generatorFactory = function () use ($collection, $value, $key) { + $generatorFactory = function () use ($collection, $value, $key): iterable { if ($key === null) { yield $value; } else { @@ -795,21 +909,23 @@ function prepend($collection, $value, $key = null) } }; - return new Collection($generatorFactory); + return new RewindableIterable($generatorFactory); } /** * Returns a lazy collection of items in $collection with $value added as last element. If $key is not provided * it will be next integer index. * - * @param array|Traversable $collection - * @param mixed $value - * @param mixed|null $key - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param TVal $value + * @param TKey|null $key + * @return iterable */ -function append($collection, $value, $key = null) +function append(iterable $collection, $value, $key = null): iterable { - $generatorFactory = function () use ($collection, $value, $key) { + $generatorFactory = function () use ($collection, $value, $key): iterable { foreach ($collection as $k => $v) { yield $k => $v; } @@ -821,19 +937,21 @@ function append($collection, $value, $key = null) } }; - return new Collection($generatorFactory); + return new RewindableIterable($generatorFactory); } /** * Returns a lazy collection by removing items from $collection until first item for which $function returns false. * - * @param array|Traversable $collection - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param callable(TVal, TKey): bool $function + * @return iterable */ -function dropWhile($collection, callable $function) +function dropWhile(iterable $collection, callable $function): iterable { - $generatorFactory = function () use ($collection, $function) { + $factory = function () use ($collection, $function): iterable { $shouldDrop = true; foreach ($collection as $key => $value) { if ($shouldDrop) { @@ -846,19 +964,21 @@ function dropWhile($collection, callable $function) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection of items from $collection until first item for which $function returns false. * - * @param array|Traversable $collection - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param callable(TVal, TKey): bool $function + * @return iterable */ function takeWhile($collection, callable $function) { - $generatorFactory = function () use ($collection, $function) { + $factory = function () use ($collection, $function): iterable { $shouldTake = true; foreach ($collection as $key => $value) { if ($shouldTake) { @@ -871,17 +991,20 @@ function takeWhile($collection, callable $function) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection. A result of calling map and flatten(1) * - * @param array|Traversable $collection - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TKey + * @template TVal + * @template TRes + * @param iterable $collection + * @param callable(TVal, TKey): iterable $function + * @return iterable */ -function mapcat($collection, callable $function) +function mapcat(iterable $collection, callable $function): iterable { return flatten(map($collection, $function), 1); } @@ -889,68 +1012,76 @@ function mapcat($collection, callable $function) /** * Returns a lazy collection [take($collection, $position), drop($collection, $position)] * - * @param array|Traversable $collection + * @template TKey + * @template TVal + * @param iterable $collection * @param int $position - * @return CollectionInterface + * @return iterable> */ -function splitAt($collection, $position) +function splitAt(iterable $collection, int $position): iterable { - $generatorFactory = function () use ($collection, $position) { + $factory = function () use ($collection, $position): Generator { yield take($collection, $position); yield drop($collection, $position); }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection [takeWhile($collection, $function), dropWhile($collection, $function)] * - * @param array|Traversable $collection - * @param callable $function ($value, $key) - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param callable(TVal, TKey): bool $function + * @return iterable> */ -function splitWith($collection, callable $function) +function splitWith($collection, callable $function): iterable { - $generatorFactory = function () use ($collection, $function) { + $factory = function () use ($collection, $function): iterable { yield takeWhile($collection, $function); yield dropWhile($collection, $function); }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection with items from $collection but values that are found in keys of $replacementMap * are replaced by their values. * - * @param array|Traversable $collection - * @param array|Traversable $replacementMap - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param iterable $replacementMap + * @return iterable */ -function replace($collection, $replacementMap) +function replace(iterable $collection, iterable $replacementMap): iterable { - $generatorFactory = function () use ($collection, $replacementMap) { + $factory = function () use ($collection, $replacementMap): iterable { foreach ($collection as $key => $value) { - $newValue = getOrDefault($replacementMap, $value, $value); - yield $key => $newValue; + yield $key => getOrDefault($replacementMap, $value, $value); } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection of reduction steps. * - * @param array|Traversable $collection - * @param callable $function - * @param mixed $startValue - * @return CollectionInterface + * @template TKey + * @template TVal + * @template TRes + * @param iterable $collection + * @param callable(TRes, TVal, TKey): TRes $function + * @param TRes $startValue + * @return iterable */ -function reductions($collection, callable $function, $startValue) +function reductions(iterable $collection, callable $function, $startValue): iterable { - $generatorFactory = function () use ($collection, $function, $startValue) { + $factory = function () use ($collection, $function, $startValue): iterable { $tmp = duplicate($startValue); yield $tmp; @@ -960,19 +1091,21 @@ function reductions($collection, callable $function, $startValue) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection of every nth ($step) item in $collection. * - * @param array|Traversable $collection + * @template TKey + * @template TVal + * @param iterable $collection * @param int $step - * @return CollectionInterface + * @return iterable */ -function takeNth($collection, $step) +function takeNth(iterable $collection, int $step) { - $generatorFactory = function () use ($collection, $step) { + $factory = function () use ($collection, $step): iterable { $index = 0; foreach ($collection as $key => $value) { if ($index % $step == 0) { @@ -983,7 +1116,7 @@ function takeNth($collection, $step) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** @@ -993,15 +1126,17 @@ function takeNth($collection, $step) * necessary to complete last partition up to $numberOfItems items. In case there are * not enough padding elements, return a partition with less than $numberOfItems items. * - * @param array|Traversable $collection + * @template TKey + * @template TVal + * @param iterable $collection * @param int $numberOfItems * @param int $step - * @param array|Traversable $padding - * @return CollectionInterface + * @param iterable $padding + * @return iterable> */ -function partition($collection, $numberOfItems, $step = -1, $padding = []) +function partition(iterable $collection, int $numberOfItems, int $step = -1, iterable $padding = []): iterable { - $generatorFactory = function () use ($collection, $numberOfItems, $step, $padding) { + $generator = function () use ($collection, $numberOfItems, $step, $padding): Generator { $buffer = []; $itemsToSkip = 0; $tmpStep = $step ?: $numberOfItems; @@ -1021,25 +1156,24 @@ function partition($collection, $numberOfItems, $step = -1, $padding = []) } } - yield take( - concat(dereferenceKeyValue($buffer), $padding), - $numberOfItems - ); + yield take(concat(dereferenceKeyValue($buffer), $padding), $numberOfItems); }; - return new Collection($generatorFactory); + return new RewindableIterable($generator); } /** * Returns a lazy collection created by partitioning $collection each time $function returned a different value. * - * @param array|Traversable $collection - * @param callable $function - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param callable(TVal, TKey=): mixed $function + * @return iterable> */ -function partitionBy($collection, callable $function) +function partitionBy(iterable $collection, callable $function): iterable { - $generatorFactory = function () use ($collection, $function) { + $factory = function () use ($collection, $function): iterable { $result = null; $buffer = []; @@ -1060,19 +1194,20 @@ function partitionBy($collection, callable $function) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection of $value repeated $times times. If $times is not provided the collection is infinite. * - * @param mixed $value + * @template TVal + * @param TVal $value * @param int $times - * @return CollectionInterface + * @return iterable */ -function repeat($value, $times = -1) +function repeat($value, int $times = -1): iterable { - $generatorFactory = function () use ($value, $times) { + $factory = function () use ($value, $times): iterable { $tmpTimes = $times; while ($tmpTimes != 0) { @@ -1082,7 +1217,7 @@ function repeat($value, $times = -1) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** @@ -1091,14 +1226,14 @@ function repeat($value, $times = -1) * @param int $start * @param int|null $end * @param int $step - * @return CollectionInterface + * @return iterable */ -function range($start = 0, $end = null, $step = 1) +function range(int $start = 0, int $end = null, int $step = 1): iterable { - $generatorFactory = function () use ($start, $end, $step) { + $factory = function () use ($start, $end, $step): iterable { return iterate( $start, - function ($value) use ($step, $end) { + function (int $value) use ($step, $end): int { $result = $value + $step; if ($end !== null && $result > $end) { @@ -1110,26 +1245,16 @@ function ($value) use ($step, $end) { ); }; - return new Collection($generatorFactory); -} - -/** - * Returns true if $input is array or Traversable object. - * - * @param mixed $input - * @return bool - */ -function isCollection($input) -{ - return is_array($input) || $input instanceof Traversable; + return new RewindableIterable($factory); } /** * Returns duplicated/cloned $input that has no relation to the original one. Used for making sure there are no side * effect in functions. * - * @param mixed $input - * @return mixed + * @template TVal + * @param TVal $input + * @return TVal */ function duplicate($input) { @@ -1137,6 +1262,10 @@ function duplicate($input) return toArray( map( $input, + /** + * @param mixed $i + * @return mixed + */ function ($i) { return duplicate($i); } @@ -1152,33 +1281,37 @@ function ($i) { /** * Transforms [[$key, $value], [$key2, $value2]] into [$key => $value, $key2 => $value2]. Used as a helper * - * @param array|Traversable $collection - * @return CollectionInterface + * @TODO: types + * @param iterable $collection + * @return Traversable */ -function dereferenceKeyValue($collection) +function dereferenceKeyValue(iterable $collection): Traversable { - $generatorFactory = function () use ($collection) { - foreach ($collection as $value) { - yield $value[0] => $value[1]; - } - }; - - return new Collection($generatorFactory); + foreach ($collection as $value) { + yield $value[0] => $value[1]; + } } /** * Realizes collection - turns lazy collection into non-lazy one by iterating over it and storing the key/values. * - * @param array|Traversable $collection - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @return iterable */ -function realize($collection) +function realize(iterable $collection): iterable { return dereferenceKeyValue( toArray( map( $collection, - function ($value, $key) { + /** + * @param mixed $value + * @param mixed $key + * @return array + */ + function ($value, $key): array { return [$key, $value]; } ) @@ -1189,8 +1322,11 @@ function ($value, $key) { /** * Returns the second item of $collection or throws ItemNotFound if $collection is empty or has 1 item. * - * @param array|Traversable $collection - * @return mixed + * @template TKey + * @template TVal + * @param iterable $collection + * @return TVal + * @throws ItemNotFound */ function second($collection) { @@ -1201,44 +1337,50 @@ function second($collection) * Combines $keys and $values into a lazy collection. The resulting collection has length equal to the size of smaller * argument. * - * @param array|Traversable $keys - * @param array|Traversable $values - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $keys + * @param iterable $values + * @return iterable */ -function combine($keys, $values) +function combine(iterable $keys, iterable $values): iterable { - $generatorFactory = function () use ($keys, $values) { - $keyCollection = new Collection($keys); - $valueIt = new IteratorIterator(new Collection($values)); - $valueIt->rewind(); - - foreach ($keyCollection as $key) { - if (!$valueIt->valid()) { + $values = iterableToIterator($values); + $factory = function () use ($keys, $values): iterable { + foreach ($keys as $key) { + if (!$values->valid()) { break; } - yield $key => $valueIt->current(); - $valueIt->next(); + yield $key => $values->current(); + $values->next(); } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection without the items associated to any of the keys from $keys. * - * @param array|Traversable $collection - * @param array|Traversable $keys - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param iterable $keys + * @return iterable */ -function except($collection, $keys) +function except(iterable $collection, iterable $keys): iterable { $keys = toArray(values($keys)); return reject( $collection, - function ($value, $key) use ($keys) { + /** + * @param mixed $value + * @param mixed $key + * @return bool + */ + function ($value, $key) use ($keys): bool { return in_array($key, $keys); } ); @@ -1247,9 +1389,11 @@ function ($value, $key) use ($keys) { /** * Returns a lazy collection of items associated to any of the keys from $keys. * - * @param array|Traversable $collection - * @param array|Traversable $keys - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param iterable $keys + * @return iterable */ function only($collection, $keys) { @@ -1257,7 +1401,12 @@ function only($collection, $keys) return filter( $collection, - function ($value, $key) use ($keys) { + /** + * @param mixed $_ + * @param mixed $key + * @return bool + */ + function ($_, $key) use ($keys): bool { return in_array($key, $keys, true); } ); @@ -1267,14 +1416,16 @@ function ($value, $key) use ($keys) { * Returns a lazy collection of items that are in $collection but are not in any of the other arguments, indexed by the * keys from the first collection. Note that the ...$collections are iterated non-lazily. * - * @param array|Traversable $collection - * @param array|Traversable ...$collections - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param iterable ...$collections + * @return iterable */ -function diff($collection, ...$collections) +function diff(iterable $collection, ...$collections) { $valuesToCompare = toArray(values(concat(...$collections))); - $generatorFactory = function () use ($collection, $valuesToCompare) { + $factory = function () use ($collection, $valuesToCompare): iterable { foreach ($collection as $key => $value) { if (!in_array($value, $valuesToCompare)) { yield $key => $value; @@ -1282,21 +1433,23 @@ function diff($collection, ...$collections) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection of items that are in $collection and all the other arguments, indexed by the keys from the * first collection. Note that the ...$collections are iterated non-lazily. * - * @param array|Traversable $collection - * @param array|Traversable ...$collections - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param iterable ...$collections + * @return iterable */ -function intersect($collection, ...$collections) +function intersect(iterable $collection, iterable ...$collections): iterable { $valuesToCompare = toArray(values(concat(...$collections))); - $generatorFactory = function () use ($collection, $valuesToCompare) { + $factory = function () use ($collection, $valuesToCompare): iterable { foreach ($collection as $key => $value) { if (in_array($value, $valuesToCompare)) { yield $key => $value; @@ -1304,34 +1457,37 @@ function intersect($collection, ...$collections) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Returns a lazy collection where keys and values are flipped. * - * @param array|Traversable $collection - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @return iterable */ function flip($collection) { - $generatorFactory = function () use ($collection) { + $factory = function () use ($collection): iterable { foreach ($collection as $key => $value) { yield $value => $key; } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Checks for the existence of an item with key $key in $collection. * - * @param array|Traversable $collection - * @param mixed $key + * @template TKey + * @param iterable $collection + * @param TKey $key * @return bool */ -function has($collection, $key) +function has(iterable $collection, $key): bool { try { get($collection, $key); @@ -1345,25 +1501,27 @@ function has($collection, $key) * Returns a lazy collection of non-lazy collections of items from nth position from each passed collection. Stops when * any of the collections don't have an item at the nth position. * - * @param array|Traversable ...$collections - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable ...$collections + * @return iterable> */ -function zip(...$collections) +function zip(iterable ...$collections): iterable { /* @var Iterator[] $iterators */ $iterators = array_map( function ($collection) { - $it = new IteratorIterator(new Collection($collection)); + $it = iterableToIterator($collection); $it->rewind(); return $it; }, $collections ); - $generatorFactory = function () use ($iterators) { + $factory = function () use ($iterators): iterable { while (true) { $isMissingItems = false; - $zippedItem = new Collection([]); + $zippedItem = []; foreach ($iterators as $it) { if (!$it->valid()) { @@ -1383,34 +1541,42 @@ function ($collection) { } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Transpose each item in a collection, interchanging the row and column indexes. * Can only transpose collections of collections. Otherwise an InvalidArgument is raised. * - * @param Collection[] $collection - * @return CollectionInterface + * @template TVal + * @param iterable> $collection + * @return iterable> */ -function transpose($collection) +function transpose(iterable $collection): iterable { - if (some($collection, function ($value) { - return !($value instanceof CollectionInterface); - })) { + if (some( + $collection, + /** + * @param mixed $value + * @return bool + */ + function ($value): bool { + return !is_iterable($value); + } + )) { throw new InvalidArgument('Can only transpose collections of collections.'); } - return Collection::from( - array_map( - function (...$items) { - return new Collection($items); - }, - ...toArray( - map( - $collection, - 'DusanKasan\Knapsack\toArray' - ) + return array_map( + function (...$items) { + return $items; + }, + ...toArray( + map( + $collection, + function (iterable $c): array { + return toArray($c); + } ) ) ); @@ -1420,18 +1586,30 @@ function (...$items) { * Returns a lazy collection of data extracted from $collection items by dot separated key path. Supports the * * wildcard. If a key contains \ or * it must be escaped using \ character. * - * @param array|Traversable $collection - * @param mixed $keyPath - * @return CollectionInterface + * @param iterable $collection + * @param string $keyPath + * @return iterable */ -function extract($collection, $keyPath) +function extract(iterable $collection, string $keyPath): iterable { preg_match_all('/(.*[^\\\])(?:\.|$)/U', $keyPath, $matches); $pathParts = $matches[1]; - $extractor = function ($coll) use ($pathParts) { + $extractor = function (iterable $coll) use ($pathParts): iterable { foreach ($pathParts as $pathPart) { - $coll = flatten(filter($coll, '\DusanKasan\Knapsack\isCollection'), 1); + $coll = flatten( + filter( + $coll, + /** + * @param mixed $item + * @return bool + */ + function ($item) { + return is_iterable($item); + } + ), + 1 + ); if ($pathPart != '*') { $pathPart = str_replace(['\.', '\*'], ['.', '*'], $pathPart); @@ -1442,7 +1620,7 @@ function extract($collection, $keyPath) return $coll; }; - $generatorFactory = function () use ($collection, $extractor) { + $factory = function () use ($collection, $extractor): iterable { foreach ($collection as $item) { foreach ($extractor([$item]) as $extracted) { yield $extracted; @@ -1450,17 +1628,17 @@ function extract($collection, $keyPath) } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** * Checks whether $collection has exactly $size items. * - * @param array|Traversable $collection + * @param iterable $collection * @param int $size * @return bool */ -function sizeIs($collection, $size) +function sizeIs(iterable $collection, int $size): bool { $itemsTempCount = 0; @@ -1478,11 +1656,11 @@ function sizeIs($collection, $size) /** * Checks whether $collection has less than $size items. * - * @param array|Traversable $collection + * @param iterable $collection * @param int $size * @return bool */ -function sizeIsLessThan($collection, $size) +function sizeIsLessThan(iterable $collection, int $size): bool { $itemsTempCount = 0; @@ -1500,11 +1678,11 @@ function sizeIsLessThan($collection, $size) /** * Checks whether $collection has more than $size items. * - * @param array|Traversable $collection + * @param iterable $collection * @param int $size * @return bool */ -function sizeIsGreaterThan($collection, $size) +function sizeIsGreaterThan(iterable $collection, int $size): bool { $itemsTempCount = 0; @@ -1523,12 +1701,12 @@ function sizeIsGreaterThan($collection, $size) * Checks whether $collection has between $fromSize to $toSize items. $toSize can be * smaller than $fromSize. * - * @param array|Traversable $collection + * @param iterable $collection * @param int $fromSize * @param int $toSize * @return bool */ -function sizeIsBetween($collection, $fromSize, $toSize) +function sizeIsBetween(iterable $collection, int $fromSize, int $toSize): bool { if ($fromSize > $toSize) { $tmp = $toSize; @@ -1551,10 +1729,11 @@ function sizeIsBetween($collection, $fromSize, $toSize) /** * Returns a sum of all values in the $collection. * - * @param array|Traversable $collection - * @return int|float + * @template TVal of numeric + * @param iterable $collection + * @return TVal */ -function sum($collection) +function sum(iterable $collection) { $result = 0; @@ -1568,8 +1747,8 @@ function sum($collection) /** * Returns average of values from $collection. * - * @param array|Traversable $collection - * @return int|float + * @param iterable $collection + * @return float */ function average($collection) { @@ -1581,14 +1760,15 @@ function average($collection) $count++; } - return $count ? $sum/$count : 0; + return (float)($count ? $sum / $count : 0); } /** * Returns maximal value from $collection. * - * @param array|Traversable $collection - * @return mixed + * @template TVal of numeric + * @param iterable $collection + * @return TVal */ function max($collection) { @@ -1604,8 +1784,9 @@ function max($collection) /** * Returns minimal value from $collection. * - * @param array|Traversable $collection - * @return mixed + * @template TVal of numeric + * @param iterable $collection + * @return TVal */ function min($collection) { @@ -1627,7 +1808,7 @@ function min($collection) /** * Returns a string by concatenating the $collection values into a string. * - * @param array|Traversable $collection + * @param iterable $collection * @return string */ function toString($collection) @@ -1635,7 +1816,7 @@ function toString($collection) $result = ''; foreach ($collection as $value) { - $result .= (string) $value; + $result .= (string)$value; } return $result; @@ -1643,23 +1824,25 @@ function toString($collection) /** - * Returns a lazy collection with items from $collection, but items with keys that are found in keys of $replacementMap + * Returns a lazy collection with items from $collection, but items with keys that are found in keys of $replacementMap * are replaced by their values. * - * @param array|Traversable $collection - * @param array|Traversable $replacementMap - * @return CollectionInterface + * @template TKey + * @template TVal + * @param iterable $collection + * @param iterable $replacementMap + * @return iterable */ function replaceByKeys($collection, $replacementMap) { - $generatorFactory = function () use ($collection, $replacementMap) { + $factory = function () use ($collection, $replacementMap): iterable { foreach ($collection as $key => $value) { $newValue = getOrDefault($replacementMap, $key, $value); yield $key => $newValue; } }; - return new Collection($generatorFactory); + return new RewindableIterable($factory); } /** @@ -1686,7 +1869,7 @@ function replaceByKeys($collection, $replacementMap) * @param int|null $maxDepth * @return array|mixed */ -function dump($input, $maxItemsPerCollection = null, $maxDepth = null) +function dump($input, int $maxItemsPerCollection = null, int $maxDepth = null) { if (is_scalar($input)) { return $input; @@ -1710,7 +1893,7 @@ function dump($input, $maxItemsPerCollection = null, $maxDepth = null) $normalizedProperties[$betterKey] = dump( $value, $maxItemsPerCollection, - $maxDepth>0 ? $maxDepth-1 : null + $maxDepth > 0 ? $maxDepth - 1 : null ); break; @@ -1726,13 +1909,13 @@ function dump($input, $maxItemsPerCollection = null, $maxDepth = null) return '^^^'; } - $reflection = new \ReflectionObject($input); + $reflection = new ReflectionObject($input); $normalizedProperties = []; foreach ($reflection->getProperties() as $property) { $property->setAccessible(true); $normalizedProperties[$property->getName()] = $property->getValue($input); } - return [get_class($input) => dump($normalizedProperties, null, $maxDepth>0 ? $maxDepth-1 : null)]; + return [get_class($input) => dump($normalizedProperties, null, $maxDepth > 0 ? $maxDepth - 1 : null)]; } return gettype($input); @@ -1741,12 +1924,13 @@ function dump($input, $maxItemsPerCollection = null, $maxDepth = null) /** * Calls dump on $input and then prints it using the var_export. Returns $input. * - * @param mixed $input + * + * @param iterable $input * @param int|null $maxItemsPerCollection * @param int|null $maxDepth * @return mixed */ -function printDump($input, $maxItemsPerCollection = null, $maxDepth = null) +function printDump(iterable $input, int $maxItemsPerCollection = null, int $maxDepth = null) { var_export(dump($input, $maxItemsPerCollection, $maxDepth)); return $input; diff --git a/src/utility_functions.php b/src/utility_functions.php index b71228b..f78389d 100644 --- a/src/utility_functions.php +++ b/src/utility_functions.php @@ -2,6 +2,10 @@ namespace DusanKasan\Knapsack; +use ArrayIterator; +use Iterator; +use IteratorAggregate; + /** * Returns its argument. * @@ -51,3 +55,22 @@ function decrement($value) { return $value - 1; } + +/** + * Converts any iterable to an Iterator. + * + * @param iterable $iterable + * @return Iterator + */ +function iterableToIterator(iterable $iterable): Iterator { + if ($iterable instanceof IteratorAggregate) { + $iterable = $iterable->getIterator(); + } + + if ($iterable instanceof Iterator) { + return $iterable; + } + + /** @var array $iterable */ + return new ArrayIterator($iterable); +} \ No newline at end of file diff --git a/tests/spec/CollectionSpec.php b/tests/spec/CollectionSpec.php index ba3967d..579146e 100644 --- a/tests/spec/CollectionSpec.php +++ b/tests/spec/CollectionSpec.php @@ -404,8 +404,8 @@ function ($v) { ) ->shouldReturn('not found'); - $this->find('\DusanKasan\Knapsack\isCollection', null, true)->first()->shouldReturn(5); - $this->find('\DusanKasan\Knapsack\isCollection')->shouldReturn([5]); + $this->find(function($item) {return is_iterable($item);}, null, true)->first()->shouldReturn(5); + $this->find(function($item) {return is_iterable($item);})->shouldReturn([5]); } function it_can_count_by() @@ -1188,14 +1188,14 @@ function it_can_sum_the_collection() function it_can_get_average_of_the_collection() { $this->beConstructedWith([1, 2, 2, 3]); - $this->average()->shouldReturn(2); + $this->average()->shouldReturn(2.0); $this->append(3)->average()->shouldReturn(2.2); } function it_will_return_zero_when_average_is_called_on_empty_collection() { $this->beConstructedWith([]); - $this->average()->shouldReturn(0); + $this->average()->shouldReturn(0.0); } function it_can_get_maximal_value_in_the_colleciton() @@ -1267,12 +1267,12 @@ function it_can_transpose_arrays_of_different_lengths() function it_should_throw_an_invalid_argument_if_collection_items_are_not_collection() { $this->beConstructedWith([ - [1, 2, 3], + 1, [4, 5, 6], [7, 8, 9], ]); - $this->shouldThrow(InvalidArgument::class)->during('transpose'); + $this->transpose()->getIterator()->shouldThrow(InvalidArgument::class)->during('rewind'); } function it_can_use_the_utility_methods() From f0bc7f91a99b6f160813b8b2e470fe210205469d Mon Sep 17 00:00:00 2001 From: "dusan.kasan" Date: Sun, 30 Jan 2022 14:30:01 +0100 Subject: [PATCH 3/3] PHP 8.0 related changes, dependencies update --- composer.json | 8 +- composer.lock | 2946 ++++++++++++----- phpunit.xml.dist | 2 +- src/CollectionTrait.php | 17 +- src/RewindableIterable.php | 3 +- src/collection_functions.php | 4 +- tests/scenarios/CallableFuctionNamesTest.php | 3 +- .../CustomPassthroughFunctionTest.php | 3 +- tests/scenarios/FibonaccisSequenceTest.php | 3 +- tests/scenarios/GroupingFlightsTest.php | 3 +- tests/scenarios/MultipleOperationsTest.php | 3 +- tests/spec/CollectionSpec.php | 2 +- 12 files changed, 2228 insertions(+), 769 deletions(-) diff --git a/composer.json b/composer.json index e04c69d..ac1cbc4 100644 --- a/composer.json +++ b/composer.json @@ -14,13 +14,13 @@ } ], "require-dev": { - "phpspec/phpspec": "^6.1", - "friends-of-phpspec/phpspec-code-coverage": "^4.3", + "phpspec/phpspec": "^7.0", + "friends-of-phpspec/phpspec-code-coverage": "^6.1", "squizlabs/php_codesniffer": "^3.5", "phpmd/phpmd" : "^2.8", - "phpunit/phpunit": "^8.5", + "phpunit/phpunit": "^9.5", "symfony/console": "^5.0", - "vimeo/psalm": "^3.11" + "vimeo/psalm": "^4.0" }, "require": { "php": ">=7.2" diff --git a/composer.lock b/composer.lock index e517c0b..8296005 100644 --- a/composer.lock +++ b/composer.lock @@ -4,34 +4,34 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "13717daf9a9bb7617e5e29715e7c2d4e", + "content-hash": "6efec4c115ab366e1f86ea7bbff3837c", "packages": [], "packages-dev": [ { "name": "amphp/amp", - "version": "v2.4.2", + "version": "v2.6.1", "source": { "type": "git", "url": "https://github.com/amphp/amp.git", - "reference": "feca077369a47263b22156b3c6389e55f3809f24" + "reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/feca077369a47263b22156b3c6389e55f3809f24", - "reference": "feca077369a47263b22156b3c6389e55f3809f24", + "url": "https://api.github.com/repos/amphp/amp/zipball/c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae", + "reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae", "shasum": "" }, "require": { - "php": ">=7" + "php": ">=7.1" }, "require-dev": { "amphp/php-cs-fixer-config": "dev-master", "amphp/phpunit-util": "^1", "ext-json": "*", "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^6.0.9 | ^7", - "react/promise": "^2", - "vimeo/psalm": "^3.9@dev" + "phpunit/phpunit": "^7 | ^8 | ^9", + "psalm/phar": "^3.11@dev", + "react/promise": "^2" }, "type": "library", "extra": { @@ -83,32 +83,44 @@ "non-blocking", "promise" ], - "time": "2020-04-04T15:05:26+00:00" + "support": { + "irc": "irc://irc.freenode.org/amphp", + "issues": "https://github.com/amphp/amp/issues", + "source": "https://github.com/amphp/amp/tree/v2.6.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2021-09-23T18:43:08+00:00" }, { "name": "amphp/byte-stream", - "version": "v1.7.3", + "version": "v1.8.1", "source": { "type": "git", "url": "https://github.com/amphp/byte-stream.git", - "reference": "b867505edb79dda8f253ca3c3a2bbadae4b16592" + "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/byte-stream/zipball/b867505edb79dda8f253ca3c3a2bbadae4b16592", - "reference": "b867505edb79dda8f253ca3c3a2bbadae4b16592", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/acbd8002b3536485c997c4e019206b3f10ca15bd", + "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd", "shasum": "" }, "require": { - "amphp/amp": "^2" + "amphp/amp": "^2", + "php": ">=7.1" }, "require-dev": { "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1", + "amphp/phpunit-util": "^1.4", "friendsofphp/php-cs-fixer": "^2.3", "jetbrains/phpstorm-stubs": "^2019.3", "phpunit/phpunit": "^6 || ^7 || ^8", - "vimeo/psalm": "^3.9@dev" + "psalm/phar": "^3.11.4" }, "type": "library", "extra": { @@ -148,32 +160,188 @@ "non-blocking", "stream" ], - "time": "2020-04-04T16:56:54+00:00" + "support": { + "irc": "irc://irc.freenode.org/amphp", + "issues": "https://github.com/amphp/byte-stream/issues", + "source": "https://github.com/amphp/byte-stream/tree/v1.8.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2021-03-30T17:13:30+00:00" + }, + { + "name": "composer/package-versions-deprecated", + "version": "1.11.99.5", + "source": { + "type": "git", + "url": "https://github.com/composer/package-versions-deprecated.git", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1.0 || ^2.0", + "php": "^7 || ^8" + }, + "replace": { + "ocramius/package-versions": "1.11.99" + }, + "require-dev": { + "composer/composer": "^1.9.3 || ^2.0@dev", + "ext-zip": "^1.13", + "phpunit/phpunit": "^6.5 || ^7" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "support": { + "issues": "https://github.com/composer/package-versions-deprecated/issues", + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-01-17T14:14:24+00:00" + }, + { + "name": "composer/pcre", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/1.0.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-01-21T20:24:37+00:00" }, { "name": "composer/semver", - "version": "1.5.1", + "version": "3.2.7", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" + "reference": "deac27056b57e46faf136fae7b449eeaa71661ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", - "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", + "url": "https://api.github.com/repos/composer/semver/zipball/deac27056b57e46faf136fae7b449eeaa71661ee", + "reference": "deac27056b57e46faf136fae7b449eeaa71661ee", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0" + "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5" + "phpstan/phpstan": "^0.12.54", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { @@ -209,28 +377,50 @@ "validation", "versioning" ], - "time": "2020-01-13T12:06:48+00:00" + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.2.7" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-01-04T09:57:54+00:00" }, { "name": "composer/xdebug-handler", - "version": "1.4.1", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7" + "reference": "0c1a3925ec58a4ec98e992b9c7d171e9e184be0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/1ab9842d69e64fb3a01be6b656501032d1b78cb7", - "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/0c1a3925ec58a4ec98e992b9c7d171e9e184be0a", + "reference": "0c1a3925ec58a4ec98e992b9c7d171e9e184be0a", "shasum": "" }, "require": { + "composer/pcre": "^1", "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" + "psr/log": "^1 || ^2 || ^3" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" }, "type": "library", "autoload": { @@ -253,40 +443,91 @@ "Xdebug", "performance" ], - "time": "2020-03-01T12:26:26+00:00" + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/2.0.4" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-01-04T17:06:45+00:00" + }, + { + "name": "dnoegel/php-xdg-base-dir", + "version": "v0.1.1", + "source": { + "type": "git", + "url": "https://github.com/dnoegel/php-xdg-base-dir.git", + "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", + "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~7.0|~6.0|~5.0|~4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "XdgBaseDir\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "implementation of xdg base directory specification for php", + "support": { + "issues": "https://github.com/dnoegel/php-xdg-base-dir/issues", + "source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1" + }, + "time": "2019-12-04T15:06:13+00:00" }, { "name": "doctrine/instantiator", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", + "doctrine/coding-standard": "^8.0", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" + "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -300,7 +541,7 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", @@ -309,29 +550,47 @@ "constructor", "instantiate" ], - "time": "2019-10-21T16:45:58+00:00" + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2020-11-10T18:47:58+00:00" }, { "name": "felixfbecker/advanced-json-rpc", - "version": "v3.1.1", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", - "reference": "0ed363f8de17d284d479ec813c9ad3f6834b5c40" + "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/0ed363f8de17d284d479ec813c9ad3f6834b5c40", - "reference": "0ed363f8de17d284d479ec813c9ad3f6834b5c40", + "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447", + "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447", "shasum": "" }, "require": { - "netresearch/jsonmapper": "^1.0 || ^2.0", - "php": ">=7.0", - "phpdocumentor/reflection-docblock": "^4.0.0 || ^5.0.0" + "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", + "php": "^7.1 || ^8.0", + "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" }, "require-dev": { - "phpunit/phpunit": "^6.0.0" + "phpunit/phpunit": "^7.0 || ^8.0" }, "type": "library", "autoload": { @@ -350,31 +609,40 @@ } ], "description": "A more advanced JSONRPC implementation", - "time": "2020-03-11T15:21:41+00:00" + "support": { + "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", + "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1" + }, + "time": "2021-06-11T22:34:44+00:00" }, { "name": "felixfbecker/language-server-protocol", - "version": "v1.4.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/felixfbecker/php-language-server-protocol.git", - "reference": "378801f6139bb74ac215d81cca1272af61df9a9f" + "reference": "9d846d1f5cf101deee7a61c8ba7caa0a975cd730" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/378801f6139bb74ac215d81cca1272af61df9a9f", - "reference": "378801f6139bb74ac215d81cca1272af61df9a9f", + "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/9d846d1f5cf101deee7a61c8ba7caa0a975cd730", + "reference": "9d846d1f5cf101deee7a61c8ba7caa0a975cd730", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.1" }, "require-dev": { "phpstan/phpstan": "*", - "phpunit/phpunit": "^6.3", - "squizlabs/php_codesniffer": "^3.1" + "squizlabs/php_codesniffer": "^3.1", + "vimeo/psalm": "^4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, "autoload": { "psr-4": { "LanguageServerProtocol\\": "src/" @@ -397,30 +665,37 @@ "php", "server" ], - "time": "2019-06-23T21:03:50+00:00" + "support": { + "issues": "https://github.com/felixfbecker/php-language-server-protocol/issues", + "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/1.5.1" + }, + "time": "2021-02-22T14:02:09+00:00" }, { "name": "friends-of-phpspec/phpspec-code-coverage", - "version": "v4.3.2", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/friends-of-phpspec/phpspec-code-coverage.git", - "reference": "9a54302573094cc1b3bdca3cc78c58582130b254" + "reference": "cb6177eb8ce45cdde990ff3e6db3b44fbbb17364" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/friends-of-phpspec/phpspec-code-coverage/zipball/9a54302573094cc1b3bdca3cc78c58582130b254", - "reference": "9a54302573094cc1b3bdca3cc78c58582130b254", + "url": "https://api.github.com/repos/friends-of-phpspec/phpspec-code-coverage/zipball/cb6177eb8ce45cdde990ff3e6db3b44fbbb17364", + "reference": "cb6177eb8ce45cdde990ff3e6db3b44fbbb17364", "shasum": "" }, "require": { - "php": "^7.1", - "phpspec/phpspec": "^4.2 || ^5.0 || ^6.0", - "phpunit/php-code-coverage": "^5.0 || ^6.0 || ^7.0" + "php": ">= 7.3", + "phpspec/phpspec": "^6.0 || ^7.0", + "phpunit/php-code-coverage": "^9.0" + }, + "conflict": { + "sebastian/comparator": "< 2.0" }, "require-dev": { - "drupol/php-conventions": "^1", - "scrutinizer/ocular": "^1" + "drupol/php-conventions": "^3.0", + "vimeo/psalm": "^4.7" }, "suggest": { "ext-pcov": "Install PCov extension to generate code coverage.", @@ -429,7 +704,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "6.x-dev" } }, "autoload": { @@ -465,7 +740,7 @@ }, { "name": "Jay Linski", - "homepage": "https://twitter.com/jay_linski" + "homepage": "https://github.com/jaylinski" } ], "description": "Generate Code Coverage reports for PhpSpec tests", @@ -479,27 +754,29 @@ "test", "tests" ], - "time": "2019-11-12T10:27:45+00:00" + "support": { + "docs": "https://github.com/friends-of-phpspec/phpspec-code-coverage#phpspec-code-coverage", + "issues": "https://github.com/friends-of-phpspec/phpspec-code-coverage/issues", + "source": "https://github.com/friends-of-phpspec/phpspec-code-coverage" + }, + "time": "2021-03-30T20:51:42+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.9.5", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", - "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", "shasum": "" }, "require": { - "php": "^7.1" - }, - "replace": { - "myclabs/deep-copy": "self.version" + "php": "^7.1 || ^8.0" }, "require-dev": { "doctrine/collections": "^1.0", @@ -527,20 +804,30 @@ "object", "object graph" ], - "time": "2020-01-17T21:11:47+00:00" + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-11-13T09:40:50+00:00" }, { "name": "netresearch/jsonmapper", - "version": "v2.0.0", + "version": "v4.0.0", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "e245890383c3ed38b6d202ee373c23ccfebc0f54" + "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/e245890383c3ed38b6d202ee373c23ccfebc0f54", - "reference": "e245890383c3ed38b6d202ee373c23ccfebc0f54", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", + "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", "shasum": "" }, "require": { @@ -548,10 +835,10 @@ "ext-pcre": "*", "ext-reflection": "*", "ext-spl": "*", - "php": ">=5.6" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4 || ~7.0", + "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0", "squizlabs/php_codesniffer": "~3.5" }, "type": "library", @@ -573,20 +860,25 @@ } ], "description": "Map nested JSON structures onto PHP classes", - "time": "2020-03-04T17:23:33+00:00" + "support": { + "email": "cweiske@cweiske.de", + "issues": "https://github.com/cweiske/jsonmapper/issues", + "source": "https://github.com/cweiske/jsonmapper/tree/v4.0.0" + }, + "time": "2020-12-01T19:48:11+00:00" }, { "name": "nikic/php-parser", - "version": "v4.4.0", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "bd43ec7152eaaab3bd8c6d0aa95ceeb1df8ee120" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bd43ec7152eaaab3bd8c6d0aa95ceeb1df8ee120", - "reference": "bd43ec7152eaaab3bd8c6d0aa95ceeb1df8ee120", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -594,8 +886,8 @@ "php": ">=7.0" }, "require-dev": { - "ircmaxell/php-yacc": "0.0.5", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -603,7 +895,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.9-dev" } }, "autoload": { @@ -625,58 +917,11 @@ "parser", "php" ], - "time": "2020-04-10T16:34:50+00:00" - }, - { - "name": "ocramius/package-versions", - "version": "1.8.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "421679846270a5772534828013a93be709fb13df" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/421679846270a5772534828013a93be709fb13df", - "reference": "421679846270a5772534828013a93be709fb13df", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7.4.0" - }, - "require-dev": { - "composer/composer": "^1.9.3 || ^2.0@dev", - "doctrine/coding-standard": "^7.0.2", - "ext-zip": "^1.15.0", - "infection/infection": "^0.15.3", - "phpunit/phpunit": "^9.0.1", - "vimeo/psalm": "^3.9.3" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.99.x-dev" - } + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "time": "2020-04-06T17:43:35+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "openlss/lib-array2xml", @@ -725,20 +970,24 @@ "xml", "xml conversion" ], + "support": { + "issues": "https://github.com/nullivex/lib-array2xml/issues", + "source": "https://github.com/nullivex/lib-array2xml/tree/master" + }, "time": "2019-03-29T20:06:56+00:00" }, { "name": "pdepend/pdepend", - "version": "2.7.1", + "version": "2.10.2", "source": { "type": "git", "url": "https://github.com/pdepend/pdepend.git", - "reference": "daba1cf0a6edaf172fa02a17807ae29f4c1c7471" + "reference": "c8c1d2af43fb8c2b5387d50e9c42a9c56de13686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/daba1cf0a6edaf172fa02a17807ae29f4c1c7471", - "reference": "daba1cf0a6edaf172fa02a17807ae29f4c1c7471", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/c8c1d2af43fb8c2b5387d50e9c42a9c56de13686", + "reference": "c8c1d2af43fb8c2b5387d50e9c42a9c56de13686", "shasum": "" }, "require": { @@ -748,9 +997,9 @@ "symfony/filesystem": "^2.3.0|^3|^4|^5" }, "require-dev": { - "easy-doc/easy-doc": "0.0.0 || ^1.2.3", + "easy-doc/easy-doc": "0.0.0|^1.2.3", "gregwar/rst": "^1.0", - "phpunit/phpunit": "^4.8.35|^5.7", + "phpunit/phpunit": "^4.8.36|^5.7.27", "squizlabs/php_codesniffer": "^2.0.0" }, "bin": [ @@ -772,32 +1021,43 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", - "time": "2020-02-08T12:06:13+00:00" + "support": { + "issues": "https://github.com/pdepend/pdepend/issues", + "source": "https://github.com/pdepend/pdepend/tree/2.10.2" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/pdepend/pdepend", + "type": "tidelift" + } + ], + "time": "2021-11-16T20:05:32+00:00" }, { "name": "phar-io/manifest", - "version": "1.0.3", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { "ext-dom": "*", "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -827,24 +1087,28 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", - "version": "2.0.1", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + "reference": "bae7c545bef187884426f042434e561ab1ddb182" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", + "reference": "bae7c545bef187884426f042434e561ab1ddb182", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -874,32 +1138,33 @@ } ], "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.1.0" + }, + "time": "2021-02-23T14:00:09+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "2.0.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", "shasum": "" }, "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "~6" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-2.x": "2.x-dev" } }, "autoload": { @@ -926,32 +1191,36 @@ "reflection", "static analysis" ], - "time": "2018-08-07T13:53:10+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.1.0", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { - "ext-filter": "^7.1", - "php": "^7.2", - "phpdocumentor/reflection-common": "^2.0", - "phpdocumentor/type-resolver": "^1.0", - "webmozart/assert": "^1" + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "doctrine/instantiator": "^1", - "mockery/mockery": "^1" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -979,34 +1248,38 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-02-22T12:28:44+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + }, + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.1.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95", - "reference": "7462d5f123dfc080dfdf26897032a6513644fc95", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", "shasum": "" }, "require": { - "php": "^7.2", + "php": "^7.2 || ^8.0", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "^7.2", - "mockery/mockery": "~1" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-1.x": "1.x-dev" } }, "autoload": { @@ -1025,32 +1298,38 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-02-18T18:59:58+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" + }, + "time": "2022-01-04T19:58:01+00:00" }, { "name": "phpmd/phpmd", - "version": "2.8.2", + "version": "2.11.1", "source": { "type": "git", "url": "https://github.com/phpmd/phpmd.git", - "reference": "714629ed782537f638fe23c4346637659b779a77" + "reference": "08b60a2eb7e14c23f46ff8865b510ae08b75d0fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpmd/phpmd/zipball/714629ed782537f638fe23c4346637659b779a77", - "reference": "714629ed782537f638fe23c4346637659b779a77", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/08b60a2eb7e14c23f46ff8865b510ae08b75d0fd", + "reference": "08b60a2eb7e14c23f46ff8865b510ae08b75d0fd", "shasum": "" }, "require": { - "composer/xdebug-handler": "^1.0", + "composer/xdebug-handler": "^1.0 || ^2.0", "ext-xml": "*", - "pdepend/pdepend": "^2.7.1", + "pdepend/pdepend": "^2.10.2", "php": ">=5.3.9" }, "require-dev": { "easy-doc/easy-doc": "0.0.0 || ^1.3.2", + "ext-json": "*", + "ext-simplexml": "*", "gregwar/rst": "^1.0", - "mikey179/vfsstream": "^1.6.4", + "mikey179/vfsstream": "^1.6.8", "phpunit/phpunit": "^4.8.36 || ^5.7.27", "squizlabs/php_codesniffer": "^2.0" }, @@ -1095,20 +1374,31 @@ "phpmd", "pmd" ], - "time": "2020-02-16T20:15:50+00:00" + "support": { + "irc": "irc://irc.freenode.org/phpmd", + "issues": "https://github.com/phpmd/phpmd/issues", + "source": "https://github.com/phpmd/phpmd/tree/2.11.1" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/phpmd/phpmd", + "type": "tidelift" + } + ], + "time": "2021-12-17T11:25:43+00:00" }, { "name": "phpspec/php-diff", - "version": "v1.1.0", + "version": "v1.1.3", "source": { "type": "git", "url": "https://github.com/phpspec/php-diff.git", - "reference": "0464787bfa7cd13576c5a1e318709768798bec6a" + "reference": "fc1156187f9f6c8395886fe85ed88a0a245d72e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/php-diff/zipball/0464787bfa7cd13576c5a1e318709768798bec6a", - "reference": "0464787bfa7cd13576c5a1e318709768798bec6a", + "url": "https://api.github.com/repos/phpspec/php-diff/zipball/fc1156187f9f6c8395886fe85ed88a0a245d72e9", + "reference": "fc1156187f9f6c8395886fe85ed88a0a245d72e9", "shasum": "" }, "type": "library", @@ -1133,42 +1423,46 @@ } ], "description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).", - "time": "2016-04-07T12:29:16+00:00" + "support": { + "source": "https://github.com/phpspec/php-diff/tree/v1.1.3" + }, + "time": "2020-09-18T13:47:07+00:00" }, { "name": "phpspec/phpspec", - "version": "6.1.1", + "version": "7.1.0", "source": { "type": "git", "url": "https://github.com/phpspec/phpspec.git", - "reference": "486aaa736e9e24f3e22a6545f6affb88f98e2602" + "reference": "30dc06a0f20642d9589bb644fbcfcb1692828699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/phpspec/zipball/486aaa736e9e24f3e22a6545f6affb88f98e2602", - "reference": "486aaa736e9e24f3e22a6545f6affb88f98e2602", + "url": "https://api.github.com/repos/phpspec/phpspec/zipball/30dc06a0f20642d9589bb644fbcfcb1692828699", + "reference": "30dc06a0f20642d9589bb644fbcfcb1692828699", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.5", "ext-tokenizer": "*", - "php": "^7.2, <7.5", + "php": "^7.3 || 8.0.*", "phpspec/php-diff": "^1.0.0", "phpspec/prophecy": "^1.9", - "sebastian/exporter": "^1.0 || ^2.0 || ^3.0", - "symfony/console": "^3.4 || ^4.0 || ^5.0", - "symfony/event-dispatcher": "^3.4 || ^4.0 || ^5.0", - "symfony/finder": "^3.4 || ^4.0 || ^5.0", - "symfony/process": "^3.4 || ^4.0 || ^5.0", - "symfony/yaml": "^3.4 || ^4.0 || ^5.0" + "sebastian/exporter": "^3.0 || ^4.0", + "symfony/console": "^3.4 || ^4.4 || ^5.0", + "symfony/event-dispatcher": "^3.4 || ^4.4 || ^5.0", + "symfony/finder": "^3.4 || ^4.4 || ^5.0", + "symfony/process": "^3.4 || ^4.4 || ^5.0", + "symfony/yaml": "^3.4 || ^4.4 || ^5.0" }, "conflict": { "sebastian/comparator": "<1.2.4" }, "require-dev": { "behat/behat": "^3.3", - "phpunit/phpunit": "^7.0", - "symfony/filesystem": "^3.4 || ^4.0 || ^5.0" + "phpunit/phpunit": "^8.0 || ^9.0", + "symfony/filesystem": "^3.4 || ^4.0 || ^5.0", + "vimeo/psalm": "^4.3" }, "suggest": { "phpspec/nyan-formatters": "Adds Nyan formatters" @@ -1179,7 +1473,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1.x-dev" + "dev-main": "7.1.x-dev" } }, "autoload": { @@ -1217,37 +1511,41 @@ "testing", "tests" ], - "time": "2019-12-17T10:23:12+00:00" + "support": { + "issues": "https://github.com/phpspec/phpspec/issues", + "source": "https://github.com/phpspec/phpspec/tree/7.1.0" + }, + "time": "2021-06-19T16:10:14+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.10.3", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "451c3cd1418cf640de218914901e51b064abb093" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", - "reference": "451c3cd1418cf640de218914901e51b064abb093", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.2", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.5 || ^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + "phpspec/phpspec": "^6.0 || ^7.0", + "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.10.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -1280,44 +1578,52 @@ "spy", "stub" ], - "time": "2020-03-05T15:02:03+00:00" + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" + }, + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "7.0.10", + "version": "9.2.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf" + "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f1884187926fbb755a9aaf0b3836ad3165b478bf", - "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687", + "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-xmlwriter": "*", - "php": "^7.2", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.1.1", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^4.2.2", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1.3" + "nikic/php-parser": "^4.13.0", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^8.2.2" + "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-xdebug": "^2.7.2" + "ext-pcov": "*", + "ext-xdebug": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "9.2-dev" } }, "autoload": { @@ -1343,32 +1649,42 @@ "testing", "xunit" ], - "time": "2019-11-20T13:55:58+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-05T09:12:13+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.2", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1393,26 +1709,48 @@ "filesystem", "iterator" ], - "time": "2018-09-13T20:33:42+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1429,37 +1767,47 @@ "role": "lead" } ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", "keywords": [ - "template" + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2015-06-21T13:50:34+00:00" + "time": "2020-09-28T05:58:55+00:00" }, { - "name": "phpunit/php-timer", - "version": "2.1.2", + "name": "phpunit/php-text-template", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1478,38 +1826,47 @@ "role": "lead" } ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", "keywords": [ - "timer" + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2019-06-07T04:22:29+00:00" + "time": "2020-10-26T05:33:50+00:00" }, { - "name": "phpunit/php-token-stream", - "version": "3.1.1", + "name": "phpunit/php-timer", + "version": "5.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, "require": { - "ext-tokenizer": "*", - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1524,64 +1881,78 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ - "tokenizer" + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2019-09-17T06:23:10+00:00" + "time": "2020-10-26T13:16:10+00:00" }, { "name": "phpunit/phpunit", - "version": "8.5.3", + "version": "9.5.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "67750516bc02f300e2742fed2f50177f8f37bedf" + "reference": "597cb647654ede35e43b137926dfdfef0fb11743" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/67750516bc02f300e2742fed2f50177f8f37bedf", - "reference": "67750516bc02f300e2742fed2f50177f8f37bedf", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/597cb647654ede35e43b137926dfdfef0fb11743", + "reference": "597cb647654ede35e43b137926dfdfef0fb11743", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.2.0", + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.9.1", - "phar-io/manifest": "^1.0.3", - "phar-io/version": "^2.0.1", - "php": "^7.2", - "phpspec/prophecy": "^1.8.1", - "phpunit/php-code-coverage": "^7.0.7", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1.2", - "sebastian/comparator": "^3.0.2", - "sebastian/diff": "^3.0.2", - "sebastian/environment": "^4.2.2", - "sebastian/exporter": "^3.1.1", - "sebastian/global-state": "^3.0.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0.1", - "sebastian/type": "^1.1.3", - "sebastian/version": "^2.0.1" + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpspec/prophecy": "^1.12.1", + "phpunit/php-code-coverage": "^9.2.7", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.5", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.3", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^2.3.4", + "sebastian/version": "^3.0.2" }, "require-dev": { - "ext-pdo": "*" + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0.1" }, "suggest": { "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0.0" + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -1589,12 +1960,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "8.5-dev" + "dev-master": "9.5-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1615,31 +1989,40 @@ "testing", "xunit" ], - "time": "2020-03-31T08:52:04+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.13" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-01-24T07:33:35+00:00" }, { "name": "psr/container", - "version": "1.0.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.4.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -1652,7 +2035,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common Container Interface (PHP FIG PSR-11)", @@ -1664,7 +2047,11 @@ "container-interop", "psr" ], - "time": "2017-02-14T16:28:37+00:00" + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" }, { "name": "psr/event-dispatcher", @@ -1710,34 +2097,38 @@ "psr", "psr-14" ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, "time": "2019-01-08T18:20:26+00:00" }, { "name": "psr/log", - "version": "1.1.3", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1747,7 +2138,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -1757,32 +2148,147 @@ "psr", "psr-3" ], - "time": "2020-03-23T09:12:05+00:00" + "support": { + "source": "https://github.com/php-fig/log/tree/2.0.0" + }, + "time": "2021-07-14T16:41:46+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", + "name": "sebastian/cli-parser", "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1802,34 +2308,44 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.2", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + "reference": "55f4261989e546dc112258c7a75935a81a7ce382" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382", "shasum": "" }, "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1842,6 +2358,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1853,10 +2373,6 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -1866,33 +2382,100 @@ "compare", "equality" ], - "time": "2018-07-12T15:12:46+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:49:45+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" }, { "name": "sebastian/diff", - "version": "3.0.2", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1905,13 +2488,13 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", @@ -1922,27 +2505,37 @@ "unidiff", "unified diff" ], - "time": "2019-02-04T06:01:07+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" }, { "name": "sebastian/environment", - "version": "4.2.3", + "version": "5.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + "reference": "388b6ced16caa751030f6a69e588299fa09200ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-posix": "*" @@ -1950,7 +2543,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -1975,34 +2568,44 @@ "environment", "hhvm" ], - "time": "2019-11-20T08:46:58+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:52:38+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.2", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2037,35 +2640,45 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], - "time": "2019-09-14T09:02:43+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", - "version": "3.0.0", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", "shasum": "" }, "require": { - "php": "^7.2", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-uopz": "*" @@ -2073,7 +2686,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2096,34 +2709,43 @@ "keywords": [ "global state" ], - "time": "2019-02-01T05:30:01+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-06-11T13:31:12+00:00" }, { - "name": "sebastian/object-enumerator", - "version": "3.0.3", + "name": "sebastian/lines-of-code", + "version": "1.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "nikic/php-parser": "^4.6", + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -2138,37 +2760,105 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" - }, + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2188,32 +2878,42 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.0", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2226,14 +2926,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -2241,29 +2941,42 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:17:30+00:00" }, { "name": "sebastian/resource-operations", - "version": "2.0.1", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2283,32 +2996,42 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" }, { "name": "sebastian/type", - "version": "1.1.3", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3" + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3", - "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", "shasum": "" }, "require": { - "php": "^7.2" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^8.2" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.3-dev" } }, "autoload": { @@ -2329,29 +3052,39 @@ ], "description": "Collection of value objects that represent the types of the PHP type system", "homepage": "https://github.com/sebastianbergmann/type", - "time": "2019-07-02T08:10:15+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-06-15T12:49:02+00:00" }, { "name": "sebastian/version", - "version": "2.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2372,20 +3105,30 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.4", + "version": "3.6.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "dceec07328401de6211037abbb18bda423677e26" + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26", - "reference": "dceec07328401de6211037abbb18bda423677e26", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", "shasum": "" }, "require": { @@ -2423,46 +3166,49 @@ "phpcs", "standards" ], - "time": "2020-01-30T22:20:29+00:00" + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2021-12-12T21:44:58+00:00" }, { "name": "symfony/config", - "version": "v5.0.7", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "3e633c31a34738f7f4ed7a225c43fc45ca74c986" + "reference": "d65e1bd990c740e31feb07d2b0927b8d4df9956f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/3e633c31a34738f7f4ed7a225c43fc45ca74c986", - "reference": "3e633c31a34738f7f4ed7a225c43fc45ca74c986", + "url": "https://api.github.com/repos/symfony/config/zipball/d65e1bd990c740e31feb07d2b0927b8d4df9956f", + "reference": "d65e1bd990c740e31feb07d2b0927b8d4df9956f", "shasum": "" }, "require": { - "php": "^7.2.5", - "symfony/filesystem": "^4.4|^5.0", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/filesystem": "^4.4|^5.0|^6.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-php80": "^1.16", + "symfony/polyfill-php81": "^1.22" }, "conflict": { "symfony/finder": "<4.4" }, "require-dev": { - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/yaml": "^4.4|^5.0" + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/messenger": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/yaml": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Config\\": "" @@ -2485,47 +3231,69 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Config Component", + "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", - "time": "2020-03-27T16:56:45+00:00" + "support": { + "source": "https://github.com/symfony/config/tree/v5.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-03T09:50:52+00:00" }, { "name": "symfony/console", - "version": "v5.0.7", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5fa1caadc8cdaa17bcfb25219f3b53fe294a9935" + "reference": "a2a86ec353d825c75856c6fd14fac416a7bdb6b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5fa1caadc8cdaa17bcfb25219f3b53fe294a9935", - "reference": "5fa1caadc8cdaa17bcfb25219f3b53fe294a9935", + "url": "https://api.github.com/repos/symfony/console/zipball/a2a86ec353d825c75856c6fd14fac416a7bdb6b8", + "reference": "a2a86ec353d825c75856c6fd14fac416a7bdb6b8", "shasum": "" }, "require": { - "php": "^7.2.5", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/service-contracts": "^1.1|^2" + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { + "psr/log": ">=3", "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", "symfony/event-dispatcher": "<4.4", "symfony/lock": "<4.4", "symfony/process": "<4.4" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -2534,11 +3302,6 @@ "symfony/process": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" @@ -2561,43 +3324,70 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Console Component", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", - "time": "2020-03-30T11:42:42+00:00" + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-26T16:28:35+00:00" }, { "name": "symfony/dependency-injection", - "version": "v5.0.7", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "4e48dc44680d8efa357410c78093a04753196981" + "reference": "974580fd67f14d65b045c11b09eb149cd4b13df5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/4e48dc44680d8efa357410c78093a04753196981", - "reference": "4e48dc44680d8efa357410c78093a04753196981", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/974580fd67f14d65b045c11b09eb149cd4b13df5", + "reference": "974580fd67f14d65b045c11b09eb149cd4b13df5", "shasum": "" }, "require": { - "php": "^7.2.5", - "psr/container": "^1.0", + "php": ">=7.2.5", + "psr/container": "^1.1.1", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16", + "symfony/polyfill-php81": "^1.22", "symfony/service-contracts": "^1.1.6|^2" }, "conflict": { - "symfony/config": "<5.0", + "ext-psr": "<1.1|>=2", + "symfony/config": "<5.3", "symfony/finder": "<4.4", "symfony/proxy-manager-bridge": "<4.4", "symfony/yaml": "<4.4" }, "provide": { "psr/container-implementation": "1.0", - "symfony/service-implementation": "1.0" + "symfony/service-implementation": "1.0|2.0" }, "require-dev": { - "symfony/config": "^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/yaml": "^4.4|^5.0" + "symfony/config": "^5.3|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/config": "", @@ -2607,11 +3397,6 @@ "symfony/yaml": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\DependencyInjection\\": "" @@ -2634,27 +3419,113 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony DependencyInjection Component", + "description": "Allows you to standardize and centralize the way objects are constructed in your application", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/dependency-injection/tree/v5.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-26T16:28:35+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", + "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", + "shasum": "" + }, + "require": { + "php": ">=8.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", - "time": "2020-03-30T11:42:42+00:00" + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-01T23:48:49+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.0.7", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "24f40d95385774ed5c71dbf014edd047e2f2f3dc" + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/24f40d95385774ed5c71dbf014edd047e2f2f3dc", - "reference": "24f40d95385774ed5c71dbf014edd047e2f2f3dc", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/dec8a9f58d20df252b9cd89f1c6c1530f747685d", + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d", "shasum": "" }, "require": { - "php": "^7.2.5", - "symfony/event-dispatcher-contracts": "^2" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", + "symfony/polyfill-php80": "^1.16" }, "conflict": { "symfony/dependency-injection": "<4.4" @@ -2664,24 +3535,20 @@ "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^4.4|^5.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/dependency-injection": "", "symfony/http-kernel": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" @@ -2704,26 +3571,43 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", - "time": "2020-03-27T16:56:45+00:00" + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.0.1", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "af23c2584d4577d54661c434446fb8fbed6025dd" + "reference": "aa5422287b75594b90ee9cd807caf8f0df491385" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/af23c2584d4577d54661c434446fb8fbed6025dd", - "reference": "af23c2584d4577d54661c434446fb8fbed6025dd", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/aa5422287b75594b90ee9cd807caf8f0df491385", + "reference": "aa5422287b75594b90ee9cd807caf8f0df491385", "shasum": "" }, "require": { - "php": "^7.2.5", + "php": ">=8.0.2", "psr/event-dispatcher": "^1" }, "suggest": { @@ -2732,7 +3616,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -2764,32 +3652,46 @@ "interoperability", "standards" ], - "time": "2019-11-18T17:27:11+00:00" + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-07-15T12:33:35+00:00" }, { "name": "symfony/filesystem", - "version": "v5.0.7", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "ca3b87dd09fff9b771731637f5379965fbfab420" + "reference": "0f0c4bf1840420f4aef3f32044a9dbb24682731b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/ca3b87dd09fff9b771731637f5379965fbfab420", - "reference": "ca3b87dd09fff9b771731637f5379965fbfab420", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/0f0c4bf1840420f4aef3f32044a9dbb24682731b", + "reference": "0f0c4bf1840420f4aef3f32044a9dbb24682731b", "shasum": "" }, "require": { - "php": "^7.2.5", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" @@ -2812,33 +3714,47 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", - "time": "2020-03-27T16:56:45+00:00" + "support": { + "source": "https://github.com/symfony/filesystem/tree/v5.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/finder", - "version": "v5.0.7", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "600a52c29afc0d1caa74acbec8d3095ca7e9910d" + "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/600a52c29afc0d1caa74acbec8d3095ca7e9910d", - "reference": "600a52c29afc0d1caa74acbec8d3095ca7e9910d", + "url": "https://api.github.com/repos/symfony/finder/zipball/231313534dded84c7ecaa79d14bc5da4ccb69b7d", + "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d", "shasum": "" }, "require": { - "php": "^7.2.5" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Finder\\": "" @@ -2861,26 +3777,46 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", - "time": "2020-03-27T16:56:45+00:00" + "support": { + "source": "https://github.com/symfony/finder/tree/v5.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-26T16:34:36+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.15.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", - "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" }, "suggest": { "ext-ctype": "For best performance" @@ -2888,7 +3824,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -2921,37 +3861,58 @@ "polyfill", "portable" ], - "time": "2020-02-27T09:26:54+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-10-20T20:35:02+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.15.0", + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.24.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { - "ext-mbstring": "For best performance" + "ext-intl": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" }, "files": [ "bootstrap.php" @@ -2971,38 +3932,227 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony polyfill for intl's grapheme_* functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "mbstring", + "grapheme", + "intl", "polyfill", "portable", "shim" ], - "time": "2020-03-09T19:04:49+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.24.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-23T21:10:46+00:00" }, { - "name": "symfony/polyfill-php73", - "version": "v1.15.0", + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.24.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", - "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.24.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-30T18:21:41+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -3038,31 +4188,206 @@ "portable", "shim" ], - "time": "2020-02-27T09:26:54+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.24.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-06-05T21:20:04+00:00" }, { - "name": "symfony/process", - "version": "v5.0.7", + "name": "symfony/polyfill-php80", + "version": "v1.24.0", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e", - "reference": "c5ca4a0fc16a0c888067d43fbcfe1f8a53d8e70e", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", "shasum": "" }, "require": { - "php": "^7.2.5" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-09-13T13:58:33+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.24.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-09-13T13:58:11+00:00" + }, + { + "name": "symfony/process", + "version": "v5.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "553f50487389a977eb31cf6b37faae56da00f753" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/553f50487389a977eb31cf6b37faae56da00f753", + "reference": "553f50487389a977eb31cf6b37faae56da00f753", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\Process\\": "" @@ -3085,27 +4410,47 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Process Component", + "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", - "time": "2020-03-27T16:56:45+00:00" + "support": { + "source": "https://github.com/symfony/process/tree/v5.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-26T16:28:35+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.0.1", + "version": "v2.4.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "144c5e51266b281231e947b51223ba14acf1a749" + "reference": "d664541b99d6fb0247ec5ff32e87238582236204" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", - "reference": "144c5e51266b281231e947b51223ba14acf1a749", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d664541b99d6fb0247ec5ff32e87238582236204", + "reference": "d664541b99d6fb0247ec5ff32e87238582236204", "shasum": "" }, "require": { - "php": "^7.2.5", - "psr/container": "^1.0" + "php": ">=7.2.5", + "psr/container": "^1.1" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -3113,7 +4458,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "2.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3145,41 +4494,142 @@ "interoperability", "standards" ], - "time": "2019-11-18T17:27:11+00:00" + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.4.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-04T16:37:19+00:00" + }, + { + "name": "symfony/string", + "version": "v6.0.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "522144f0c4c004c80d56fa47e40e17028e2eefc2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/522144f0c4c004c80d56fa47e40e17028e2eefc2", + "reference": "522144f0c4c004c80d56fa47e40e17028e2eefc2", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.0" + }, + "require-dev": { + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "files": [ + "Resources/functions.php" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v6.0.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/yaml", - "version": "v5.0.7", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "ad5e9c83ade5bbb3a96a3f30588a0622708caefd" + "reference": "e80f87d2c9495966768310fc531b487ce64237a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/ad5e9c83ade5bbb3a96a3f30588a0622708caefd", - "reference": "ad5e9c83ade5bbb3a96a3f30588a0622708caefd", + "url": "https://api.github.com/repos/symfony/yaml/zipball/e80f87d2c9495966768310fc531b487ce64237a2", + "reference": "e80f87d2c9495966768310fc531b487ce64237a2", "shasum": "" }, "require": { - "php": "^7.2.5", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<4.4" + "symfony/console": "<5.3" }, "require-dev": { - "symfony/console": "^4.4|^5.0" + "symfony/console": "^5.3|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" }, + "bin": [ + "Resources/bin/yaml-lint" + ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" @@ -3202,29 +4652,46 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", - "time": "2020-03-30T11:42:42+00:00" + "support": { + "source": "https://github.com/symfony/yaml/tree/v5.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-26T16:32:32+00:00" }, { "name": "theseer/tokenizer", - "version": "1.1.3", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { "ext-dom": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": "^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -3244,63 +4711,77 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2019-06-13T22:48:21+00:00" + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2021-07-28T10:34:58+00:00" }, { "name": "vimeo/psalm", - "version": "3.11.1", + "version": "4.19.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "8533b866ab1a46e5a69a4692ff57f10529dbfbeb" + "reference": "a2ad69ae4f5ab1f7d225a8dc4e2ec2d9415ed599" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/8533b866ab1a46e5a69a4692ff57f10529dbfbeb", - "reference": "8533b866ab1a46e5a69a4692ff57f10529dbfbeb", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/a2ad69ae4f5ab1f7d225a8dc4e2ec2d9415ed599", + "reference": "a2ad69ae4f5ab1f7d225a8dc4e2ec2d9415ed599", "shasum": "" }, "require": { - "amphp/amp": "^2.1", + "amphp/amp": "^2.4.2", "amphp/byte-stream": "^1.5", - "composer/semver": "^1.4", - "composer/xdebug-handler": "^1.1", + "composer/package-versions-deprecated": "^1.8.0", + "composer/semver": "^1.4 || ^2.0 || ^3.0", + "composer/xdebug-handler": "^1.1 || ^2.0 || ^3.0", + "dnoegel/php-xdg-base-dir": "^0.1.1", + "ext-ctype": "*", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", + "ext-mbstring": "*", "ext-simplexml": "*", "ext-tokenizer": "*", "felixfbecker/advanced-json-rpc": "^3.0.3", - "felixfbecker/language-server-protocol": "^1.4", - "netresearch/jsonmapper": "^1.0 || ^2.0", - "nikic/php-parser": "^4.3", - "ocramius/package-versions": "^1.2", + "felixfbecker/language-server-protocol": "^1.5", + "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", + "nikic/php-parser": "^4.13", "openlss/lib-array2xml": "^1.0", - "php": "^7.1.3|^8", + "php": "^7.1|^8", "sebastian/diff": "^3.0 || ^4.0", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", - "webmozart/glob": "^4.1", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0", "webmozart/path-util": "^2.3" }, "provide": { "psalm/psalm": "self.version" }, "require-dev": { - "amphp/amp": "^2.4.2", "bamarni/composer-bin-plugin": "^1.2", - "brianium/paratest": "^4.0.0", + "brianium/paratest": "^4.0||^6.0", "ext-curl": "*", - "php-coveralls/php-coveralls": "^2.2", - "phpmyadmin/sql-parser": "5.1.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpdocumentor/reflection-docblock": "^5", + "phpmyadmin/sql-parser": "5.1.0||dev-master", "phpspec/prophecy": ">=1.9.0", - "phpunit/phpunit": "^7.5.16 || ^8.5 || ^9.0", - "psalm/plugin-phpunit": "^0.10", - "slevomat/coding-standard": "^5.0", + "phpunit/phpunit": "^9.0", + "psalm/plugin-phpunit": "^0.16", + "slevomat/coding-standard": "^7.0", "squizlabs/php_codesniffer": "^3.5", - "symfony/process": "^4.3" + "symfony/process": "^4.3 || ^5.0 || ^6.0", + "weirdan/prophecy-shim": "^1.0 || ^2.0" }, "suggest": { - "ext-igbinary": "^2.0.5" + "ext-curl": "In order to send data to shepherd", + "ext-igbinary": "^2.0.5 is required, used to serialize caching data" }, "bin": [ "psalm", @@ -3312,15 +4793,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.x-dev", + "dev-master": "4.x-dev", + "dev-3.x": "3.x-dev", "dev-2.x": "2.x-dev", "dev-1.x": "1.x-dev" } }, "autoload": { "psr-4": { - "Psalm\\Plugin\\": "src/Psalm/Plugin", - "Psalm\\": "src/Psalm" + "Psalm\\": "src/Psalm/" }, "files": [ "src/functions.php", @@ -3342,33 +4823,43 @@ "inspection", "php" ], - "time": "2020-04-13T02:19:49+00:00" + "support": { + "issues": "https://github.com/vimeo/psalm/issues", + "source": "https://github.com/vimeo/psalm/tree/4.19.0" + }, + "time": "2022-01-27T19:00:37+00:00" }, { "name": "webmozart/assert", - "version": "1.7.0", + "version": "1.10.0", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "aed98a490f9a8f78468232db345ab9cf606cf598" + "url": "https://github.com/webmozarts/assert.git", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598", - "reference": "aed98a490f9a8f78468232db345ab9cf606cf598", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "vimeo/psalm": "<3.6.0" + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -3390,54 +4881,11 @@ "check", "validate" ], - "time": "2020-02-14T12:15:55+00:00" - }, - { - "name": "webmozart/glob", - "version": "4.1.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/glob.git", - "reference": "3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/glob/zipball/3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe", - "reference": "3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe", - "shasum": "" - }, - "require": { - "php": "^5.3.3|^7.0", - "webmozart/path-util": "^2.2" + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.10.0" }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1", - "symfony/filesystem": "^2.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Glob\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "A PHP implementation of Ant's glob.", - "time": "2015-12-29T11:14:33+00:00" + "time": "2021-03-09T10:59:23+00:00" }, { "name": "webmozart/path-util", @@ -3483,6 +4931,11 @@ } ], "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "support": { + "issues": "https://github.com/webmozart/path-util/issues", + "source": "https://github.com/webmozart/path-util/tree/2.3.0" + }, + "abandoned": "symfony/filesystem", "time": "2015-12-17T08:42:14+00:00" } ], @@ -3494,5 +4947,6 @@ "platform": { "php": ">=7.2" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.2.0" } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 592ae2e..4196bd7 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,7 +2,7 @@ - + tests/scenarios diff --git a/src/CollectionTrait.php b/src/CollectionTrait.php index b84c213..71a3e53 100644 --- a/src/CollectionTrait.php +++ b/src/CollectionTrait.php @@ -90,19 +90,20 @@ public function reduce(callable $function, $startValue, $convertToCollection = f * Returns a lazy collection with one or multiple levels of nesting flattened. Removes all nesting when no value * is passed. * - * @param int $levelsToFlatten -1 to flatten everything + * @param int $depth -1 to flatten everything * @return CollectionInterface */ - public function flatten($levelsToFlatten = -1) + public function flatten($depth = -1) { - return new Collection(flatten($this->getItems(), $levelsToFlatten)); + return new Collection(flatten($this->getItems(), $depth)); } /** - * Returns a non-lazy collection sorted using $function($item1, $item2, $key1, $key2 ). $function should - * return true if first item is larger than the second and false otherwise. + * Returns a non-lazy collection sorted using $function($item1, $item2, $key1, $key2). $function should + * return true if first item is larger than the second and false otherwise. In PHP8 and forward, $function + * must return int as described by https://www.php.net/manual/en/function.usort.php. * - * @param callable(TVal, TVal, TKey, TKey): bool $function + * @param callable(TVal, TVal, TKey, TKey): bool|int $function * @return static */ public function sort(callable $function) @@ -970,8 +971,8 @@ protected abstract function getItems(): iterable; /** * @template CKey * @template CVal - * @param callable():iterable|iterable $i + * @param callable():iterable|iterable $input * @return static */ - protected abstract static function from($i); + protected abstract static function from($input); } diff --git a/src/RewindableIterable.php b/src/RewindableIterable.php index 967f49c..535f6f2 100644 --- a/src/RewindableIterable.php +++ b/src/RewindableIterable.php @@ -36,7 +36,6 @@ public function __construct(callable $factory) */ public function getIterator(): Traversable { - $fn = $this->factory; - return $fn(); + return ($this->factory)(); } } \ No newline at end of file diff --git a/src/collection_functions.php b/src/collection_functions.php index 6761a77..8b36e92 100644 --- a/src/collection_functions.php +++ b/src/collection_functions.php @@ -375,7 +375,7 @@ function flatten(iterable $collection, int $levelsToFlatten = -1): iterable * @template TKey * @template TVal * @param iterable $collection - * @param callable(TVal, TVal, TKey, TKey): bool $function + * @param callable(TVal, TVal, TKey, TKey): bool|int $function * @return iterable */ function sort(iterable $collection, callable $function): iterable @@ -397,7 +397,7 @@ function ($value, $key): array { ) ); - uasort( + usort( $array, /** * @param mixed $a diff --git a/tests/scenarios/CallableFuctionNamesTest.php b/tests/scenarios/CallableFuctionNamesTest.php index 6c000cf..5ba731e 100644 --- a/tests/scenarios/CallableFuctionNamesTest.php +++ b/tests/scenarios/CallableFuctionNamesTest.php @@ -3,9 +3,10 @@ namespace DusanKasan\Knapsack\Tests\Scenarios; use DusanKasan\Knapsack\Collection; +use PHPUnit\Framework\TestCase; use PHPUnit_Framework_TestCase; -class CallableFunctionNamesTest extends PHPUnit_Framework_TestCase +class CallableFunctionNamesTest extends TestCase { /** * Example that it's possible to use callable function names as arguments. diff --git a/tests/scenarios/CustomPassthroughFunctionTest.php b/tests/scenarios/CustomPassthroughFunctionTest.php index b837c9f..c757b78 100644 --- a/tests/scenarios/CustomPassthroughFunctionTest.php +++ b/tests/scenarios/CustomPassthroughFunctionTest.php @@ -4,9 +4,10 @@ use DusanKasan\Knapsack\Collection; use DusanKasan\Knapsack\CollectionInterface; +use PHPUnit\Framework\TestCase; use PHPUnit_Framework_TestCase; -class CustomPassthroughFunctionTest extends PHPUnit_Framework_TestCase +class CustomPassthroughFunctionTest extends TestCase { /** * Example of implementing a transpose function and how to apply it over a collection. diff --git a/tests/scenarios/FibonaccisSequenceTest.php b/tests/scenarios/FibonaccisSequenceTest.php index 0180275..bc23cac 100644 --- a/tests/scenarios/FibonaccisSequenceTest.php +++ b/tests/scenarios/FibonaccisSequenceTest.php @@ -3,9 +3,10 @@ namespace DusanKasan\Knapsack\Tests\Scenarios; use DusanKasan\Knapsack\Collection; +use PHPUnit\Framework\TestCase; use PHPUnit_Framework_TestCase; -class FibonaccisSequenceTest extends PHPUnit_Framework_TestCase +class FibonaccisSequenceTest extends TestCase { /** * Example generating first 5 values in fibonacci's sequence. diff --git a/tests/scenarios/GroupingFlightsTest.php b/tests/scenarios/GroupingFlightsTest.php index 02d4e08..d72ff3d 100644 --- a/tests/scenarios/GroupingFlightsTest.php +++ b/tests/scenarios/GroupingFlightsTest.php @@ -4,13 +4,14 @@ use DusanKasan\Knapsack\Collection; use DusanKasan\Knapsack\CollectionInterface; +use PHPUnit\Framework\TestCase; use PHPUnit_Framework_TestCase; /** * More advanced usage of collection pipeline, see * http://martinfowler.com/articles/refactoring-pipelines.html#GroupingFlightRecords for reference. */ -class GroupingFlightsTest extends PHPUnit_Framework_TestCase +class GroupingFlightsTest extends TestCase { private $inputData = [ [ diff --git a/tests/scenarios/MultipleOperationsTest.php b/tests/scenarios/MultipleOperationsTest.php index 32203ad..7e2a9c2 100644 --- a/tests/scenarios/MultipleOperationsTest.php +++ b/tests/scenarios/MultipleOperationsTest.php @@ -3,9 +3,10 @@ namespace DusanKasan\Knapsack\Tests\Scenarios; use DusanKasan\Knapsack\Collection; +use PHPUnit\Framework\TestCase; use PHPUnit_Framework_TestCase; -class MultipleOperationsTest extends PHPUnit_Framework_TestCase +class MultipleOperationsTest extends TestCase { /** * Example of a longer pipeline. If this was real code, you should probably split it into smaller chunks. diff --git a/tests/spec/CollectionSpec.php b/tests/spec/CollectionSpec.php index 579146e..5bd94a4 100644 --- a/tests/spec/CollectionSpec.php +++ b/tests/spec/CollectionSpec.php @@ -272,7 +272,7 @@ function it_can_sort() $this ->sort(function ($v1, $v2, $k1, $k2) { - return $k1 < $k2 || $v1 == $v2; + return -1 * ($k1 <=> $k2); }) ->toArray() ->shouldReturn([2 => 2, 1 => 1, 0 => 3]);