From f3731a2e59014ed1637686fa64952fef4ed16f21 Mon Sep 17 00:00:00 2001 From: George Steel Date: Sun, 16 Oct 2022 09:13:07 +0100 Subject: [PATCH 1/2] Add support for PHP 8.2, remove support for PHP 7.4 Signed-off-by: George Steel --- composer.json | 12 +- composer.lock | 384 +++++++++++++++++--------------------------------- 2 files changed, 132 insertions(+), 264 deletions(-) diff --git a/composer.json b/composer.json index 42921b3..38940e9 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "dealerdirect/phpcodesniffer-composer-installer": true }, "platform": { - "php": "7.4.99" + "php": "8.0.99" } }, "extra": { @@ -34,7 +34,7 @@ } }, "require": { - "php": "^7.4 || ~8.0.0 || ~8.1.0", + "php": "~8.0.0 || ~8.1.0 || ~8.2.0", "laminas/laminas-permissions-acl": "^2.9", "mezzio/mezzio-authorization": "^1.2", "mezzio/mezzio-router": "^3.8", @@ -43,12 +43,12 @@ }, "require-dev": { "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-servicemanager": "^3.10", + "laminas/laminas-servicemanager": "^3.15", "phpspec/prophecy": "^1.15", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5.11", + "phpspec/prophecy-phpunit": "^2.0.1", + "phpunit/phpunit": "^9.5.25", "psalm/plugin-phpunit": "^0.17.0", - "vimeo/psalm": "^4.24" + "vimeo/psalm": "^4.29" }, "conflict": { "container-interop/container-interop": "<1.2.0", diff --git a/composer.lock b/composer.lock index 3b84ccb..8e54fbf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e1485889306c29dc1baa8613679987ce", + "content-hash": "932c91ffc297a15ec6e53916fd7b186c", "packages": [ { "name": "fig/http-message-util", @@ -127,20 +127,20 @@ }, { "name": "mezzio/mezzio-authentication", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/mezzio/mezzio-authentication.git", - "reference": "9c5608bc6a1ce653bc6d2bb93abc5014777304aa" + "reference": "001b081a514f495b711fe44ae4e2be30a1c75181" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mezzio/mezzio-authentication/zipball/9c5608bc6a1ce653bc6d2bb93abc5014777304aa", - "reference": "9c5608bc6a1ce653bc6d2bb93abc5014777304aa", + "url": "https://api.github.com/repos/mezzio/mezzio-authentication/zipball/001b081a514f495b711fe44ae4e2be30a1c75181", + "reference": "001b081a514f495b711fe44ae4e2be30a1c75181", "shasum": "" }, "require": { - "php": "^7.4 || ~8.0.0 || ~8.1.0", + "php": "~8.0.0 || ~8.1.0 || ~8.2.0", "psr/container": "^1.0 || ^2.0", "psr/http-message": "^1.0.1", "psr/http-server-middleware": "^1.0", @@ -153,11 +153,9 @@ "require-dev": { "ext-sqlite3": "*", "laminas/laminas-coding-standard": "~2.4.0", - "phpspec/prophecy": "^1.14", - "phpspec/prophecy-phpunit": "^v2.0.1", - "phpunit/phpunit": "^9.5.24", + "phpunit/phpunit": "^9.5.25", "psalm/plugin-phpunit": "^0.17.0", - "vimeo/psalm": "^4.27.0" + "vimeo/psalm": "^4.29" }, "suggest": { "ext-pdo": "*: for use with the PDO-backed UserRepositoryInterface implementation", @@ -205,25 +203,25 @@ "type": "community_bridge" } ], - "time": "2022-09-18T15:02:36+00:00" + "time": "2022-10-14T15:54:13+00:00" }, { "name": "mezzio/mezzio-authorization", - "version": "1.5.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/mezzio/mezzio-authorization.git", - "reference": "fdd7059375f59706392c0b3d3618acfa791ce74c" + "reference": "bd0d3fca84e6a1f4d0bc65996eb988adcfd913d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mezzio/mezzio-authorization/zipball/fdd7059375f59706392c0b3d3618acfa791ce74c", - "reference": "fdd7059375f59706392c0b3d3618acfa791ce74c", + "url": "https://api.github.com/repos/mezzio/mezzio-authorization/zipball/bd0d3fca84e6a1f4d0bc65996eb988adcfd913d6", + "reference": "bd0d3fca84e6a1f4d0bc65996eb988adcfd913d6", "shasum": "" }, "require": { "mezzio/mezzio-authentication": "^1.3", - "php": "^7.4 || ~8.0.0 || ~8.1.0", + "php": "~8.0.0 || ~8.1.0 || ~8.2.0", "psr/container": "^1.0 || ^2.0", "psr/http-message": "^1.0.1", "psr/http-server-middleware": "^1.0" @@ -234,11 +232,9 @@ }, "require-dev": { "laminas/laminas-coding-standard": "~2.4.0", - "phpspec/prophecy": "^v1.15.0", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5.11", + "phpunit/phpunit": "^9.5.25", "psalm/plugin-phpunit": "^0.17.0", - "vimeo/psalm": "^4.24" + "vimeo/psalm": "^4.29" }, "suggest": { "mezzio/mezzio-authorization-acl": "^1.0; provides a laminas-permissions-acl-backed adapter", @@ -283,25 +279,25 @@ "type": "community_bridge" } ], - "time": "2022-09-17T16:12:57+00:00" + "time": "2022-10-15T11:14:20+00:00" }, { "name": "mezzio/mezzio-router", - "version": "3.8.0", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/mezzio/mezzio-router.git", - "reference": "27075d3e9b407791abf7ba5e62954a59be4b18df" + "reference": "5b03ab8ef9ae8323a9093d5b9d79a69a3733968f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mezzio/mezzio-router/zipball/27075d3e9b407791abf7ba5e62954a59be4b18df", - "reference": "27075d3e9b407791abf7ba5e62954a59be4b18df", + "url": "https://api.github.com/repos/mezzio/mezzio-router/zipball/5b03ab8ef9ae8323a9093d5b9d79a69a3733968f", + "reference": "5b03ab8ef9ae8323a9093d5b9d79a69a3733968f", "shasum": "" }, "require": { "fig/http-message-util": "^1.1.2", - "php": "^7.4 || ~8.0.0 || ~8.1.0", + "php": "~8.0.0 || ~8.1.0 || ~8.2.0", "psr/container": "^1.0 || ^2.0", "psr/http-factory": "^1.0", "psr/http-message": "^1.0.1", @@ -313,14 +309,12 @@ "zendframework/zend-expressive-router": "*" }, "require-dev": { - "laminas/laminas-coding-standard": "~2.3.0", - "laminas/laminas-diactoros": "^2.6", - "laminas/laminas-stratigility": "^3.4", - "phpspec/prophecy": "^1.9", - "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5.11", - "psalm/plugin-phpunit": "^0.15.0", - "vimeo/psalm": "^4.17" + "laminas/laminas-coding-standard": "~2.4.0", + "laminas/laminas-diactoros": "^2.18", + "laminas/laminas-stratigility": "^3.8", + "phpunit/phpunit": "^9.5.25", + "psalm/plugin-phpunit": "^0.17.0", + "vimeo/psalm": "^4.28" }, "suggest": { "mezzio/mezzio-aurarouter": "^3.0 to use the Aura.Router routing adapter", @@ -366,7 +360,7 @@ "type": "community_bridge" } ], - "time": "2022-01-06T16:27:49+00:00" + "time": "2022-10-10T19:40:00+00:00" }, { "name": "psr/container", @@ -1591,31 +1585,30 @@ }, { "name": "laminas/laminas-stdlib", - "version": "3.13.0", + "version": "3.15.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-stdlib.git", - "reference": "66a6d03c381f6c9f1dd988bf8244f9afb9380d76" + "reference": "63b66bd4b696f024f42616b9d95cdb10e5109c27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/66a6d03c381f6c9f1dd988bf8244f9afb9380d76", - "reference": "66a6d03c381f6c9f1dd988bf8244f9afb9380d76", + "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/63b66bd4b696f024f42616b9d95cdb10e5109c27", + "reference": "63b66bd4b696f024f42616b9d95cdb10e5109c27", "shasum": "" }, "require": { - "php": "^7.4 || ~8.0.0 || ~8.1.0" + "php": "~8.0.0 || ~8.1.0 || ~8.2.0" }, "conflict": { "zendframework/zend-stdlib": "*" }, "require-dev": { - "laminas/laminas-coding-standard": "~2.3.0", + "laminas/laminas-coding-standard": "^2.4.0", "phpbench/phpbench": "^1.2.6", - "phpstan/phpdoc-parser": "^0.5.4", - "phpunit/phpunit": "^9.5.23", + "phpunit/phpunit": "^9.5.25", "psalm/plugin-phpunit": "^0.17.0", - "vimeo/psalm": "^4.26" + "vimeo/psalm": "^4.28" }, "type": "library", "autoload": { @@ -1647,7 +1640,7 @@ "type": "community_bridge" } ], - "time": "2022-08-24T13:56:50+00:00" + "time": "2022-10-10T19:10:24+00:00" }, { "name": "myclabs/deep-copy", @@ -2091,25 +2084,30 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.1", + "version": "1.6.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" + "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { "ext-tokenizer": "*", - "psalm/phar": "^4.8" + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" }, "type": "library", "extra": { @@ -2135,9 +2133,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2" }, - "time": "2022-03-15T21:29:03+00:00" + "time": "2022-10-14T12:47:21+00:00" }, { "name": "phpspec/prophecy", @@ -2784,30 +2782,30 @@ }, { "name": "psr/log", - "version": "1.1.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -2828,9 +2826,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/3.0.0" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2021-07-14T16:46:02+00:00" }, { "name": "sebastian/cli-parser", @@ -3915,46 +3913,42 @@ }, { "name": "symfony/console", - "version": "v5.4.14", + "version": "v6.0.14", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "984ea2c0f45f42dfed01d2f3987b187467c4b16d" + "reference": "1f89cab8d52c84424f798495b3f10342a7b1a070" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/984ea2c0f45f42dfed01d2f3987b187467c4b16d", - "reference": "984ea2c0f45f42dfed01d2f3987b187467c4b16d", + "url": "https://api.github.com/repos/symfony/console/zipball/1f89cab8d52c84424f798495b3f10342a7b1a070", + "reference": "1f89cab8d52c84424f798495b3f10342a7b1a070", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.0.2", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", "symfony/service-contracts": "^1.1|^2|^3", - "symfony/string": "^5.1|^6.0" + "symfony/string": "^5.4|^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" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "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" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -3994,74 +3988,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.14" - }, - "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-10-07T08:01:20+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v2.5.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.5-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", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/console/tree/v6.0.14" }, "funding": [ { @@ -4077,7 +4004,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-10-07T08:02:12+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4409,85 +4336,6 @@ ], "time": "2022-05-24T11:49:31+00:00" }, - { - "name": "symfony/polyfill-php73", - "version": "v1.26.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.26-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "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" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.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": "2022-05-24T11:49:31+00:00" - }, { "name": "symfony/polyfill-php80", "version": "v1.26.0", @@ -4573,29 +4421,36 @@ }, { "name": "symfony/service-contracts", - "version": "v1.1.2", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "191afdcb5804db960d26d8566b7e9a2843cab3a0" + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/191afdcb5804db960d26d8566b7e9a2843cab3a0", - "reference": "191afdcb5804db960d26d8566b7e9a2843cab3a0", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d78d39c1599bd1188b8e26bb341da52c3c6d8a66", + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": ">=8.0.2", + "psr/container": "^2.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { - "psr/container": "", "symfony/service-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-main": "3.0-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -4628,40 +4483,53 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v1.1.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.0.2" }, - "time": "2019-05-28T07:50:59+00:00" + "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-05-30T19:17:58+00:00" }, { "name": "symfony/string", - "version": "v5.4.14", + "version": "v6.0.14", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "089e7237497fae7a9c404d0c3aeb8db3254733e4" + "reference": "3db7da820a6e4a584b714b3933c34c6a7db4d86c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/089e7237497fae7a9c404d0c3aeb8db3254733e4", - "reference": "089e7237497fae7a9c404d0c3aeb8db3254733e4", + "url": "https://api.github.com/repos/symfony/string/zipball/3db7da820a6e4a584b714b3933c34c6a7db4d86c", + "reference": "3db7da820a6e4a584b714b3933c34c6a7db4d86c", "shasum": "" }, "require": { - "php": ">=7.2.5", + "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", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": ">=3.0" + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "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": { @@ -4700,7 +4568,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.14" + "source": "https://github.com/symfony/string/tree/v6.0.14" }, "funding": [ { @@ -4716,7 +4584,7 @@ "type": "tidelift" } ], - "time": "2022-10-05T15:16:54+00:00" + "time": "2022-10-10T09:34:08+00:00" }, { "name": "theseer/tokenizer", @@ -4989,11 +4857,11 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.4 || ~8.0.0 || ~8.1.0" + "php": "~8.0.0 || ~8.1.0 || ~8.2.0" }, "platform-dev": [], "platform-overrides": { - "php": "7.4.99" + "php": "8.0.99" }, "plugin-api-version": "2.3.0" } From 88fd72ae3ffe34e35326bb75b992d56cefbdf57f Mon Sep 17 00:00:00 2001 From: George Steel Date: Sun, 16 Oct 2022 09:24:37 +0100 Subject: [PATCH 2/2] Remove prophecy in favour of native PHPUnit mocks Signed-off-by: George Steel --- .coveralls.yml | 2 - composer.json | 2 - composer.lock | 121 +----------------------------- psalm-baseline.xml | 73 +----------------- test/ConfigProviderTest.php | 20 ++--- test/LaminasAclFactoryTest.php | 132 +++++++++++++++++++-------------- test/LaminasAclTest.php | 89 +++++++++++++--------- 7 files changed, 142 insertions(+), 297 deletions(-) delete mode 100644 .coveralls.yml diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index bc71b62..0000000 --- a/.coveralls.yml +++ /dev/null @@ -1,2 +0,0 @@ -coverage_clover: clover.xml -json_path: coveralls-upload.json diff --git a/composer.json b/composer.json index 38940e9..23896df 100644 --- a/composer.json +++ b/composer.json @@ -44,8 +44,6 @@ "require-dev": { "laminas/laminas-coding-standard": "~2.4.0", "laminas/laminas-servicemanager": "^3.15", - "phpspec/prophecy": "^1.15", - "phpspec/prophecy-phpunit": "^2.0.1", "phpunit/phpunit": "^9.5.25", "psalm/plugin-phpunit": "^0.17.0", "vimeo/psalm": "^4.29" diff --git a/composer.lock b/composer.lock index 8e54fbf..d78fa88 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "932c91ffc297a15ec6e53916fd7b186c", + "content-hash": "c161a4663f16b8919406b2c5547304f8", "packages": [ { "name": "fig/http-message-util", @@ -2137,125 +2137,6 @@ }, "time": "2022-10-14T12:47:21+00:00" }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "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": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "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": "phpspec/prophecy-phpunit", - "version": "v2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy-phpunit.git", - "reference": "2d7a9df55f257d2cba9b1d0c0963a54960657177" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/2d7a9df55f257d2cba9b1d0c0963a54960657177", - "reference": "2d7a9df55f257d2cba9b1d0c0963a54960657177", - "shasum": "" - }, - "require": { - "php": "^7.3 || ^8", - "phpspec/prophecy": "^1.3", - "phpunit/phpunit": "^9.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\PhpUnit\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christophe Coevoet", - "email": "stof@notk.org" - } - ], - "description": "Integrating the Prophecy mocking library in PHPUnit test cases", - "homepage": "http://phpspec.net", - "keywords": [ - "phpunit", - "prophecy" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy-phpunit/issues", - "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.0.1" - }, - "time": "2020-07-09T08:33:42+00:00" - }, { "name": "phpstan/phpdoc-parser", "version": "1.5.1", diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 49e303c..8e5e753 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + @@ -58,11 +58,7 @@ $configProvider() - - testReturnedArrayContainsDependencies - testServicesDefinedInConfigProvider - - + $configProvider() $config['dependencies'] $factory @@ -94,69 +90,4 @@ assertIsArray - - - testFactoryWithEmptyRolesResources - testFactoryWithInvalidRole - testFactoryWithUnknownRole - testFactoryWithoutAllowOrDeny - testFactoryWithoutConfig - testFactoryWithoutLaminasAclConfig - testFactoryWithoutResources - - - $this->container->reveal() - $this->container->reveal() - $this->container->reveal() - $this->container->reveal() - $this->container->reveal() - $this->container->reveal() - $this->container->reveal() - - - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - - - reveal - reveal - reveal - reveal - reveal - reveal - reveal - - - - - testConstructor - testIsGranted - testIsGrantedWithFailedRouting - testIsGrantedWithoutRouteResult - testIsNotGranted - - - $this->acl->reveal() - $this->acl->reveal() - $this->acl->reveal() - $this->acl->reveal() - $this->acl->reveal() - - - willReturn - willReturn - - - reveal - reveal - reveal - reveal - reveal - - diff --git a/test/ConfigProviderTest.php b/test/ConfigProviderTest.php index d56746b..216e29c 100644 --- a/test/ConfigProviderTest.php +++ b/test/ConfigProviderTest.php @@ -26,25 +26,25 @@ protected function setUp(): void public function testInvocationReturnsArray(): array { $config = ($this->provider)(); - $this->assertIsArray($config); + self::assertIsArray($config); return $config; } /** * @depends testInvocationReturnsArray */ - public function testReturnedArrayContainsDependencies(array $config) + public function testReturnedArrayContainsDependencies(array $config): void { - $this->assertArrayHasKey('dependencies', $config); - $this->assertIsArray($config['dependencies']); - $this->assertArrayHasKey('factories', $config['dependencies']); + self::assertArrayHasKey('dependencies', $config); + self::assertIsArray($config['dependencies']); + self::assertArrayHasKey('factories', $config['dependencies']); $factories = $config['dependencies']['factories']; - $this->assertIsArray($factories); - $this->assertArrayHasKey(LaminasAcl::class, $factories); + self::assertIsArray($factories); + self::assertArrayHasKey(LaminasAcl::class, $factories); } - public function testServicesDefinedInConfigProvider() + public function testServicesDefinedInConfigProvider(): void { $config = ($this->provider)(); @@ -66,8 +66,8 @@ public function testServicesDefinedInConfigProvider() $dependencies = $this->provider->getDependencies(); foreach ($dependencies['factories'] as $name => $factory) { - $this->assertTrue($container->has($name), sprintf('Container does not contain service %s', $name)); - $this->assertIsObject( + self::assertTrue($container->has($name), sprintf('Container does not contain service %s', $name)); + self::assertIsObject( $container->get($name), sprintf('Cannot get service %s from container using factory %s', $name, $factory) ); diff --git a/test/LaminasAclFactoryTest.php b/test/LaminasAclFactoryTest.php index 5d49a22..22d2aab 100644 --- a/test/LaminasAclFactoryTest.php +++ b/test/LaminasAclFactoryTest.php @@ -7,72 +7,81 @@ use Mezzio\Authorization\Acl\LaminasAcl; use Mezzio\Authorization\Acl\LaminasAclFactory; use Mezzio\Authorization\Exception; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use Prophecy\PhpUnit\ProphecyTrait; -use Prophecy\Prophecy\ObjectProphecy; use Psr\Container\ContainerInterface; class LaminasAclFactoryTest extends TestCase { - use ProphecyTrait; - - /** @var ContainerInterface|ObjectProphecy */ - private $container; + /** @var ContainerInterface&MockObject */ + private ContainerInterface $container; protected function setUp(): void { - $this->container = $this->prophesize(ContainerInterface::class); + $this->container = $this->createMock(ContainerInterface::class); } - public function testFactoryWithoutConfig() + public function testFactoryWithoutConfig(): void { - $this->container->get('config')->willReturn([]); + $this->container->expects(self::once()) + ->method('get') + ->willReturn('config') + ->willReturn([]); $factory = new LaminasAclFactory(); $this->expectException(Exception\InvalidConfigException::class); - $factory($this->container->reveal()); + $factory($this->container); } - public function testFactoryWithoutLaminasAclConfig() + public function testFactoryWithoutLaminasAclConfig(): void { - $this->container->get('config')->willReturn(['mezzio-authorization-acl' => []]); + $this->container->expects(self::once()) + ->method('get') + ->willReturn('config') + ->willReturn(['mezzio-authorization-acl' => []]); $factory = new LaminasAclFactory(); $this->expectException(Exception\InvalidConfigException::class); - $factory($this->container->reveal()); + $factory($this->container); } - public function testFactoryWithoutResources() + public function testFactoryWithoutResources(): void { - $this->container->get('config')->willReturn([ - 'mezzio-authorization-acl' => [ - 'roles' => [], - ], - ]); + $this->container->expects(self::once()) + ->method('get') + ->willReturn('config') + ->willReturn([ + 'mezzio-authorization-acl' => [ + 'roles' => [], + ], + ]); $factory = new LaminasAclFactory(); $this->expectException(Exception\InvalidConfigException::class); - $factory($this->container->reveal()); + $factory($this->container); } - public function testFactoryWithEmptyRolesResources() + public function testFactoryWithEmptyRolesResources(): void { - $this->container->get('config')->willReturn([ - 'mezzio-authorization-acl' => [ - 'roles' => [], - 'resources' => [], - ], - ]); + $this->container->expects(self::once()) + ->method('get') + ->willReturn('config') + ->willReturn([ + 'mezzio-authorization-acl' => [ + 'roles' => [], + 'resources' => [], + ], + ]); $factory = new LaminasAclFactory(); - $laminasAcl = $factory($this->container->reveal()); - $this->assertInstanceOf(LaminasAcl::class, $laminasAcl); + $laminasAcl = $factory($this->container); + self::assertInstanceOf(LaminasAcl::class, $laminasAcl); } - public function testFactoryWithoutAllowOrDeny() + public function testFactoryWithoutAllowOrDeny(): void { $config = [ 'mezzio-authorization-acl' => [ @@ -89,50 +98,59 @@ public function testFactoryWithoutAllowOrDeny() ], ], ]; - $this->container->get('config')->willReturn($config); + $this->container->expects(self::once()) + ->method('get') + ->willReturn('config') + ->willReturn($config); $factory = new LaminasAclFactory(); - $laminasAcl = $factory($this->container->reveal()); - $this->assertInstanceOf(LaminasAcl::class, $laminasAcl); + $laminasAcl = $factory($this->container); + self::assertInstanceOf(LaminasAcl::class, $laminasAcl); } - public function testFactoryWithInvalidRole() + public function testFactoryWithInvalidRole(): void { - $this->container->get('config')->willReturn([ - 'mezzio-authorization-acl' => [ - 'roles' => [ - 1 => [], + $this->container->expects(self::once()) + ->method('get') + ->willReturn('config') + ->willReturn([ + 'mezzio-authorization-acl' => [ + 'roles' => [ + 1 => [], + ], + 'permissions' => [], ], - 'permissions' => [], - ], - ]); + ]); $factory = new LaminasAclFactory(); $this->expectException(Exception\InvalidConfigException::class); - $factory($this->container->reveal()); + $factory($this->container); } - public function testFactoryWithUnknownRole() + public function testFactoryWithUnknownRole(): void { - $this->container->get('config')->willReturn([ - 'mezzio-authorization-acl' => [ - 'roles' => [ - 'administrator' => [], - ], - 'resources' => [ - 'admin.dashboard', - 'admin.posts', + $this->container->expects(self::once()) + ->method('get') + ->willReturn('config') + ->willReturn([ + 'mezzio-authorization-acl' => [ + 'roles' => [ + 'administrator' => [], + ], + 'resources' => [ + 'admin.dashboard', + 'admin.posts', + ], + 'allow' => [ + 'editor' => ['admin.dashboard'], + ], ], - 'allow' => [ - 'editor' => ['admin.dashboard'], - ], - ], - ]); + ]); $factory = new LaminasAclFactory(); $this->expectException(Exception\InvalidConfigException::class); - $factory($this->container->reveal()); + $factory($this->container); } } diff --git a/test/LaminasAclTest.php b/test/LaminasAclTest.php index 5b70534..b67ec41 100644 --- a/test/LaminasAclTest.php +++ b/test/LaminasAclTest.php @@ -9,85 +9,104 @@ use Mezzio\Authorization\Exception; use Mezzio\Router\Route; use Mezzio\Router\RouteResult; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use Prophecy\PhpUnit\ProphecyTrait; -use Prophecy\Prophecy\ObjectProphecy; use Psr\Http\Message\ServerRequestInterface; class LaminasAclTest extends TestCase { - use ProphecyTrait; - - /** @var Acl|ObjectProphecy */ + /** @var Acl&MockObject */ private $acl; protected function setUp(): void { - $this->acl = $this->prophesize(Acl::class); + $this->acl = $this->createMock(Acl::class); } - public function testConstructor() + public function testConstructor(): void { - $laminasAcl = new LaminasAcl($this->acl->reveal()); - $this->assertInstanceOf(LaminasAcl::class, $laminasAcl); + $laminasAcl = new LaminasAcl($this->acl); + self::assertInstanceOf(LaminasAcl::class, $laminasAcl); } - public function testIsGrantedWithoutRouteResult() + public function testIsGrantedWithoutRouteResult(): void { - $request = $this->prophesize(ServerRequestInterface::class); - $request->getAttribute(RouteResult::class, false)->willReturn(false); + $request = $this->createMock(ServerRequestInterface::class); + $request->expects(self::once()) + ->method('getAttribute') + ->with(RouteResult::class, false) + ->willReturn(false); - $laminasAcl = new LaminasAcl($this->acl->reveal()); + $laminasAcl = new LaminasAcl($this->acl); $this->expectException(Exception\RuntimeException::class); - $laminasAcl->isGranted('foo', $request->reveal()); + $laminasAcl->isGranted('foo', $request); } - public function testIsGranted() + public function testIsGranted(): void { $routeResult = $this->getSuccessRouteResult('home'); - $request = $this->prophesize(ServerRequestInterface::class); - $request->getAttribute(RouteResult::class, false)->willReturn($routeResult); + $request = $this->createMock(ServerRequestInterface::class); + $request->expects(self::once()) + ->method('getAttribute') + ->with(RouteResult::class, false) + ->willReturn($routeResult); + + $this->acl->expects(self::once()) + ->method('isAllowed') + ->with('foo', 'home') + ->willReturn(true); - $this->acl->isAllowed('foo', 'home')->willReturn(true); - $laminasAcl = new LaminasAcl($this->acl->reveal()); + $laminasAcl = new LaminasAcl($this->acl); - $this->assertTrue($laminasAcl->isGranted('foo', $request->reveal())); + self::assertTrue($laminasAcl->isGranted('foo', $request)); } - public function testIsNotGranted() + public function testIsNotGranted(): void { $routeResult = $this->getSuccessRouteResult('home'); - $request = $this->prophesize(ServerRequestInterface::class); - $request->getAttribute(RouteResult::class, false)->willReturn($routeResult); + $request = $this->createMock(ServerRequestInterface::class); + $request->expects(self::once()) + ->method('getAttribute') + ->with(RouteResult::class, false) + ->willReturn($routeResult); + + $this->acl->expects(self::once()) + ->method('isAllowed') + ->with('foo', 'home') + ->willReturn(false); - $this->acl->isAllowed('foo', 'home')->willReturn(false); - $laminasAcl = new LaminasAcl($this->acl->reveal()); + $laminasAcl = new LaminasAcl($this->acl); - $this->assertFalse($laminasAcl->isGranted('foo', $request->reveal())); + self::assertFalse($laminasAcl->isGranted('foo', $request)); } - public function testIsGrantedWithFailedRouting() + public function testIsGrantedWithFailedRouting(): void { $routeResult = $this->getFailureRouteResult(Route::HTTP_METHOD_ANY); - $request = $this->prophesize(ServerRequestInterface::class); - $request->getAttribute(RouteResult::class, false)->willReturn($routeResult); + $request = $this->createMock(ServerRequestInterface::class); + $request->expects(self::once()) + ->method('getAttribute') + ->with(RouteResult::class, false) + ->willReturn($routeResult); - $laminasAcl = new LaminasAcl($this->acl->reveal()); + $laminasAcl = new LaminasAcl($this->acl); - $result = $laminasAcl->isGranted('foo', $request->reveal()); - $this->assertTrue($result); + $result = $laminasAcl->isGranted('foo', $request); + self::assertTrue($result); } private function getSuccessRouteResult(string $routeName): RouteResult { - $route = $this->prophesize(Route::class); - $route->getName()->willReturn($routeName); + $route = $this->createMock(Route::class); + $route->expects(self::atLeast(1)) + ->method('getName') + ->willReturn($routeName); - return RouteResult::fromRoute($route->reveal()); + return RouteResult::fromRoute($route); } private function getFailureRouteResult(?array $methods): RouteResult