diff --git a/.gitignore b/.gitignore index 579f1a00..1ebdfde2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ phpstan.neon phpunit.xml phpcs.xml -.phpunit.result.cache +/.phpunit.cache diff --git a/.laminas-ci.json b/.laminas-ci.json index 560d70c3..b61c7af3 100644 --- a/.laminas-ci.json +++ b/.laminas-ci.json @@ -1,6 +1,6 @@ { "extensions": [ - "bcmath" + "bcmath", "pcov" ], "ini": [ "memory_limit=-1" diff --git a/README.md b/README.md index a41b3b93..d2e6abf4 100644 --- a/README.md +++ b/README.md @@ -121,4 +121,20 @@ vendor/bin/roave-backward-compatibility-check --help ## Configuration -There are currently no configuration options available. +The file `.roave-backward-compatibility-check.xml` is read from the current working directory (when it exists) and sets configuration for the command. + +It's expected to be an XML file that follows our [schema](resources/schema.xsd): + +**Example:** + +```xml + + + + #\[BC\] CHANGED: The parameter \$a of of TestArtifact\\TheClass\#method\(\)# + #\[BC\] CHANGED: The parameter \$b of of TestArtifact\\TheClass\#method2\(\)# + + +``` diff --git a/box.json.dist b/box.json.dist index 987325ce..d1a9f091 100644 --- a/box.json.dist +++ b/box.json.dist @@ -7,6 +7,7 @@ "main": "bin/roave-backward-compatibility-check.php", "output": "dist/roave-backward-compatibility-check.phar", "files-bin": [ + "resources/schema.xsd", "LICENSE", "vendor/composer/composer/LICENSE" ], diff --git a/composer.json b/composer.json index aaae80ef..dbb09009 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,10 @@ "description": "Tool to compare two revisions of a public API to check for BC breaks", "require": { "php": "~8.1.0 || ~8.2.0", + "ext-dom": "*", "ext-json": "*", + "ext-libxml": "*", + "ext-simplexml": "*", "azjezz/psl": "^2.3.1", "composer/composer": "^2.5.1", "nikic/php-parser": "^4.15.3", @@ -26,9 +29,9 @@ "require-dev": { "doctrine/coding-standard": "^11.0.0", "php-standard-library/psalm-plugin": "^2.2.1", - "phpunit/phpunit": "^9.5.27", + "phpunit/phpunit": "^10.0.14", "psalm/plugin-phpunit": "^0.18.4", - "roave/infection-static-analysis-plugin": "^1.27.0", + "roave/infection-static-analysis-plugin": "^1.29.0", "roave/security-advisories": "dev-master", "squizlabs/php_codesniffer": "^3.7.1", "vimeo/psalm": "^5.4.0" diff --git a/composer.lock b/composer.lock index 79732ee0..1f34e49c 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": "3e7bc55a493461b07c54b86cef013320", + "content-hash": "fb864e7a716067b5d6b0fb8c50410194", "packages": [ { "name": "azjezz/psl", @@ -1613,16 +1613,16 @@ }, { "name": "symfony/console", - "version": "v6.2.3", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0f579613e771dba2dbb8211c382342a641f5da06" + "reference": "cbad09eb8925b6ad4fb721c7a179344dc4a19d45" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0f579613e771dba2dbb8211c382342a641f5da06", - "reference": "0f579613e771dba2dbb8211c382342a641f5da06", + "url": "https://api.github.com/repos/symfony/console/zipball/cbad09eb8925b6ad4fb721c7a179344dc4a19d45", + "reference": "cbad09eb8925b6ad4fb721c7a179344dc4a19d45", "shasum": "" }, "require": { @@ -1689,7 +1689,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.2.3" + "source": "https://github.com/symfony/console/tree/v6.2.7" }, "funding": [ { @@ -1705,20 +1705,20 @@ "type": "tidelift" } ], - "time": "2022-12-28T14:26:22+00:00" + "time": "2023-02-25T17:00:03+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.0", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3" + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/1ee04c65529dea5d8744774d474e7cbd2f1206d3", - "reference": "1ee04c65529dea5d8744774d474e7cbd2f1206d3", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", "shasum": "" }, "require": { @@ -1756,7 +1756,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" }, "funding": [ { @@ -1772,20 +1772,20 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-03-01T10:25:55+00:00" }, { "name": "symfony/filesystem", - "version": "v6.2.0", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "50b2523c874605cf3d4acf7a9e2b30b6a440a016" + "reference": "82b6c62b959f642d000456f08c6d219d749215b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/50b2523c874605cf3d4acf7a9e2b30b6a440a016", - "reference": "50b2523c874605cf3d4acf7a9e2b30b6a440a016", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/82b6c62b959f642d000456f08c6d219d749215b3", + "reference": "82b6c62b959f642d000456f08c6d219d749215b3", "shasum": "" }, "require": { @@ -1819,7 +1819,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.2.0" + "source": "https://github.com/symfony/filesystem/tree/v6.2.7" }, "funding": [ { @@ -1835,20 +1835,20 @@ "type": "tidelift" } ], - "time": "2022-11-20T13:01:27+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { "name": "symfony/finder", - "version": "v6.2.3", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "81eefbddfde282ee33b437ba5e13d7753211ae8e" + "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/81eefbddfde282ee33b437ba5e13d7753211ae8e", - "reference": "81eefbddfde282ee33b437ba5e13d7753211ae8e", + "url": "https://api.github.com/repos/symfony/finder/zipball/20808dc6631aecafbe67c186af5dcb370be3a0eb", + "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb", "shasum": "" }, "require": { @@ -1883,7 +1883,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.2.3" + "source": "https://github.com/symfony/finder/tree/v6.2.7" }, "funding": [ { @@ -1899,7 +1899,7 @@ "type": "tidelift" } ], - "time": "2022-12-22T17:55:15+00:00" + "time": "2023-02-16T09:57:23+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2474,16 +2474,16 @@ }, { "name": "symfony/process", - "version": "v6.2.0", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "ba6e55359f8f755fe996c58a81e00eaa67a35877" + "reference": "680e8a2ea6b3f87aecc07a6a65a203ae573d1902" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/ba6e55359f8f755fe996c58a81e00eaa67a35877", - "reference": "ba6e55359f8f755fe996c58a81e00eaa67a35877", + "url": "https://api.github.com/repos/symfony/process/zipball/680e8a2ea6b3f87aecc07a6a65a203ae573d1902", + "reference": "680e8a2ea6b3f87aecc07a6a65a203ae573d1902", "shasum": "" }, "require": { @@ -2515,7 +2515,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.2.0" + "source": "https://github.com/symfony/process/tree/v6.2.7" }, "funding": [ { @@ -2531,20 +2531,20 @@ "type": "tidelift" } ], - "time": "2022-11-02T09:08:04+00:00" + "time": "2023-02-24T10:42:00+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.2.0", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75" + "reference": "a8c9cedf55f314f3a186041d19537303766df09a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/aac98028c69df04ee77eb69b96b86ee51fbf4b75", - "reference": "aac98028c69df04ee77eb69b96b86ee51fbf4b75", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a8c9cedf55f314f3a186041d19537303766df09a", + "reference": "a8c9cedf55f314f3a186041d19537303766df09a", "shasum": "" }, "require": { @@ -2600,7 +2600,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.2.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.2.1" }, "funding": [ { @@ -2616,20 +2616,20 @@ "type": "tidelift" } ], - "time": "2022-11-25T10:21:52+00:00" + "time": "2023-03-01T10:32:47+00:00" }, { "name": "symfony/string", - "version": "v6.2.2", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "863219fd713fa41cbcd285a79723f94672faff4d" + "reference": "67b8c1eec78296b85dc1c7d9743830160218993d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/863219fd713fa41cbcd285a79723f94672faff4d", - "reference": "863219fd713fa41cbcd285a79723f94672faff4d", + "url": "https://api.github.com/repos/symfony/string/zipball/67b8c1eec78296b85dc1c7d9743830160218993d", + "reference": "67b8c1eec78296b85dc1c7d9743830160218993d", "shasum": "" }, "require": { @@ -2686,7 +2686,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.2.2" + "source": "https://github.com/symfony/string/tree/v6.2.7" }, "funding": [ { @@ -2702,7 +2702,7 @@ "type": "tidelift" } ], - "time": "2022-12-14T16:11:27+00:00" + "time": "2023-02-24T10:42:00+00:00" } ], "packages-dev": [ @@ -3131,76 +3131,6 @@ }, "time": "2022-12-11T22:31:43+00:00" }, - { - "name": "doctrine/instantiator", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" - }, - "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": "2022-03-03T08:28:38+00:00" - }, { "name": "felixfbecker/advanced-json-rpc", "version": "v3.2.1", @@ -3542,16 +3472,16 @@ }, { "name": "infection/infection", - "version": "0.26.16", + "version": "0.26.19", "source": { "type": "git", "url": "https://github.com/infection/infection.git", - "reference": "d646aafe530ba21b8479694cd151570c93c72312" + "reference": "bd7351c88f3a797ea8977e68fe6a3f4d4c5f457f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infection/infection/zipball/d646aafe530ba21b8479694cd151570c93c72312", - "reference": "d646aafe530ba21b8479694cd151570c93c72312", + "url": "https://api.github.com/repos/infection/infection/zipball/bd7351c88f3a797ea8977e68fe6a3f4d4c5f457f", + "reference": "bd7351c88f3a797ea8977e68fe6a3f4d4c5f457f", "shasum": "" }, "require": { @@ -3562,30 +3492,32 @@ "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", + "fidry/cpu-core-counter": "^0.4.0", "infection/abstract-testframework-adapter": "^0.5.0", "infection/extension-installer": "^0.1.0", "infection/include-interceptor": "^0.2.5", "justinrainbow/json-schema": "^5.2.10", - "nikic/php-parser": "^4.13.2", + "nikic/php-parser": "^4.15.1", "ondram/ci-detector": "^4.1.0", "php": "^8.0", "sanmai/later": "^0.1.1", "sanmai/pipeline": "^5.1 || ^6", - "sebastian/diff": "^3.0.2 || ^4.0", + "sebastian/diff": "^3.0.2 || ^4.0 || ^5.0", "symfony/console": "^5.4 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0", "symfony/finder": "^5.4 || ^6.0", "symfony/process": "^5.4 || ^6.0", "thecodingmachine/safe": "^2.1.2", - "webmozart/assert": "^1.3" + "webmozart/assert": "^1.11" }, "conflict": { "dg/bypass-finals": "<1.4.1", - "phpunit/php-code-coverage": ">9 <9.1.4" + "phpunit/php-code-coverage": ">9,<9.1.4 || >9.2.17,<9.2.21" }, "require-dev": { "brianium/paratest": "^6.3", "ext-simplexml": "*", + "fidry/makefile": "^0.2.0", "helmich/phpunit-json-assert": "^3.0", "phpspec/prophecy-phpunit": "^2.0", "phpstan/extension-installer": "^1.1.0", @@ -3652,7 +3584,7 @@ ], "support": { "issues": "https://github.com/infection/infection/issues", - "source": "https://github.com/infection/infection/tree/0.26.16" + "source": "https://github.com/infection/infection/tree/0.26.19" }, "funding": [ { @@ -3664,7 +3596,7 @@ "type": "open_collective" } ], - "time": "2022-10-22T10:07:33+00:00" + "time": "2023-02-05T21:47:26+00:00" }, { "name": "myclabs/deep-copy", @@ -4231,35 +4163,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.23", + "version": "10.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c" + "reference": "b9c21a93dd8c8eed79879374884ee733259475cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", - "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b9c21a93dd8c8eed79879374884ee733259475cc", + "reference": "b9c21a93dd8c8eed79879374884ee733259475cc", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", - "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", + "nikic/php-parser": "^4.15", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-text-template": "^3.0", + "sebastian/code-unit-reverse-lookup": "^3.0", + "sebastian/complexity": "^3.0", + "sebastian/environment": "^6.0", + "sebastian/lines-of-code": "^2.0", + "sebastian/version": "^4.0", "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-pcov": "*", @@ -4268,7 +4200,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "10.0-dev" } }, "autoload": { @@ -4296,7 +4228,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.23" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.0.1" }, "funding": [ { @@ -4304,32 +4236,32 @@ "type": "github" } ], - "time": "2022-12-28T12:41:10+00:00" + "time": "2023-02-25T05:35:03+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/fd9329ab3368f59fe1fe808a189c51086bd4b6bd", + "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -4356,7 +4288,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.0.1" }, "funding": [ { @@ -4364,28 +4296,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2023-02-10T16:53:14+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-pcntl": "*" @@ -4393,7 +4325,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -4419,7 +4351,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" }, "funding": [ { @@ -4427,32 +4359,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2023-02-03T06:56:09+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/9f3d3709577a527025f55bcf0f7ab8052c8bb37d", + "reference": "9f3d3709577a527025f55bcf0f7ab8052c8bb37d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -4478,7 +4410,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.0" }, "funding": [ { @@ -4486,32 +4418,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2023-02-03T06:56:46+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -4537,7 +4469,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" }, "funding": [ { @@ -4545,24 +4477,23 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2023-02-03T06:57:52+00:00" }, { "name": "phpunit/phpunit", - "version": "9.5.27", + "version": "10.0.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38" + "reference": "7065dbebcb0f66cf16a45fc9cfc28c2351e06169" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7065dbebcb0f66cf16a45fc9cfc28c2351e06169", + "reference": "7065dbebcb0f66cf16a45fc9cfc28c2351e06169", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -4572,27 +4503,26 @@ "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", - "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.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.0", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-invoker": "^4.0", + "phpunit/php-text-template": "^3.0", + "phpunit/php-timer": "^6.0", + "sebastian/cli-parser": "^2.0", + "sebastian/code-unit": "^2.0", + "sebastian/comparator": "^5.0", + "sebastian/diff": "^5.0", + "sebastian/environment": "^6.0", + "sebastian/exporter": "^5.0", + "sebastian/global-state": "^6.0", + "sebastian/object-enumerator": "^5.0", + "sebastian/recursion-context": "^5.0", + "sebastian/type": "^4.0", + "sebastian/version": "^4.0" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "*" }, "bin": [ "phpunit" @@ -4600,7 +4530,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-main": "10.0-dev" } }, "autoload": { @@ -4631,7 +4561,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.0.14" }, "funding": [ { @@ -4647,7 +4577,7 @@ "type": "tidelift" } ], - "time": "2022-12-09T07:31:23+00:00" + "time": "2023-03-01T05:37:49+00:00" }, { "name": "psalm/plugin-phpunit", @@ -4711,28 +4641,28 @@ }, { "name": "roave/infection-static-analysis-plugin", - "version": "1.27.0", + "version": "1.29.0", "source": { "type": "git", "url": "https://github.com/Roave/infection-static-analysis-plugin.git", - "reference": "29963545d0a9978835f4c4d18d7c880c617294aa" + "reference": "fe8f89dd60d3baa523dbc14cc202f1d37c4ed9c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/infection-static-analysis-plugin/zipball/29963545d0a9978835f4c4d18d7c880c617294aa", - "reference": "29963545d0a9978835f4c4d18d7c880c617294aa", + "url": "https://api.github.com/repos/Roave/infection-static-analysis-plugin/zipball/fe8f89dd60d3baa523dbc14cc202f1d37c4ed9c7", + "reference": "fe8f89dd60d3baa523dbc14cc202f1d37c4ed9c7", "shasum": "" }, "require": { - "infection/infection": "0.26.16", + "infection/infection": "0.26.19", "ocramius/package-versions": "^2.7.0", "php": "~8.1.0 || ~8.2.0", "sanmai/later": "^0.1.2", "vimeo/psalm": "^4.30.0 || ^5.0.0" }, "require-dev": { - "doctrine/coding-standard": "^11.0.0", - "phpunit/phpunit": "^9.5.27" + "doctrine/coding-standard": "^11.1.0", + "phpunit/phpunit": "^10.0.7" }, "bin": [ "bin/roave-infection-static-analysis-plugin" @@ -4756,9 +4686,9 @@ "description": "Static analysis on top of mutation testing - prevents escaped mutants from being invalid according to static analysis", "support": { "issues": "https://github.com/Roave/infection-static-analysis-plugin/issues", - "source": "https://github.com/Roave/infection-static-analysis-plugin/tree/1.27.0" + "source": "https://github.com/Roave/infection-static-analysis-plugin/tree/1.29.0" }, - "time": "2022-12-22T10:30:15+00:00" + "time": "2023-02-14T15:49:49+00:00" }, { "name": "roave/security-advisories", @@ -5452,28 +5382,28 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efdc130dbbbb8ef0b545a994fd811725c5282cae", + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -5496,7 +5426,7 @@ "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" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.0" }, "funding": [ { @@ -5504,32 +5434,32 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2023-02-03T06:58:15+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -5552,7 +5482,7 @@ "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" + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" }, "funding": [ { @@ -5560,32 +5490,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2023-02-03T06:58:43+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -5607,7 +5537,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" }, "funding": [ { @@ -5615,34 +5545,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2023-02-03T06:59:15+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/72f01e6586e0caf6af81297897bd112eb7e9627c", + "reference": "72f01e6586e0caf6af81297897bd112eb7e9627c", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -5681,7 +5613,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.0" }, "funding": [ { @@ -5689,33 +5621,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2023-02-03T07:07:16+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/e67d240970c9dc7ea7b2123a6d520e334dd61dc6", + "reference": "e67d240970c9dc7ea7b2123a6d520e334dd61dc6", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" + "nikic/php-parser": "^4.10", + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -5738,7 +5670,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.0" }, "funding": [ { @@ -5746,33 +5678,33 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-02-03T06:59:47+00:00" }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "70dd1b20bc198da394ad542e988381b44e64e39f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/70dd1b20bc198da394ad542e988381b44e64e39f", + "reference": "70dd1b20bc198da394ad542e988381b44e64e39f", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^10.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -5804,7 +5736,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/5.0.0" }, "funding": [ { @@ -5812,27 +5744,27 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-02-03T07:00:31+00:00" }, { "name": "sebastian/environment", - "version": "5.1.4", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "reference": "b6f3694c6386c7959915a0037652e0c40f6f69cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/b6f3694c6386c7959915a0037652e0c40f6f69cc", + "reference": "b6f3694c6386c7959915a0037652e0c40f6f69cc", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-posix": "*" @@ -5840,7 +5772,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -5859,7 +5791,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -5867,7 +5799,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "source": "https://github.com/sebastianbergmann/environment/tree/6.0.0" }, "funding": [ { @@ -5875,34 +5807,34 @@ "type": "github" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2023-02-03T07:03:04+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", + "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -5944,7 +5876,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/5.0.0" }, "funding": [ { @@ -5952,38 +5884,35 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2023-02-03T07:06:49+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "aab257c712de87b90194febd52e4d184551c2d44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/aab257c712de87b90194febd52e4d184551c2d44", + "reference": "aab257c712de87b90194febd52e4d184551c2d44", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -6008,7 +5937,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.0" }, "funding": [ { @@ -6016,33 +5945,33 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2023-02-03T07:07:38+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/17c4d940ecafb3d15d2cf916f4108f664e28b130", + "reference": "17c4d940ecafb3d15d2cf916f4108f664e28b130", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" + "nikic/php-parser": "^4.10", + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -6065,7 +5994,7 @@ "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" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.0" }, "funding": [ { @@ -6073,34 +6002,34 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-02-03T07:08:02+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -6122,7 +6051,7 @@ "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" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" }, "funding": [ { @@ -6130,32 +6059,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2023-02-03T07:08:32+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -6177,7 +6106,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" }, "funding": [ { @@ -6185,32 +6114,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2023-02-03T07:06:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -6237,65 +6166,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "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": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" }, "funding": [ { @@ -6303,32 +6177,32 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2023-02-03T07:05:40+00:00" }, { "name": "sebastian/type", - "version": "3.2.0", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -6351,7 +6225,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" }, "funding": [ { @@ -6359,29 +6233,29 @@ "type": "github" } ], - "time": "2022-09-12T14:47:03+00:00" + "time": "2023-02-03T07:10:45+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -6404,7 +6278,7 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" }, "funding": [ { @@ -6412,7 +6286,7 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2023-02-07T11:34:05+00:00" }, { "name": "slevomat/coding-standard", @@ -6481,26 +6355,25 @@ }, { "name": "spatie/array-to-xml", - "version": "2.17.1", + "version": "3.1.5", "source": { "type": "git", "url": "https://github.com/spatie/array-to-xml.git", - "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46" + "reference": "13f76acef5362d15c71ae1ac6350cc3df5e25e43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", - "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/13f76acef5362d15c71ae1ac6350cc3df5e25e43", + "reference": "13f76acef5362d15c71ae1ac6350cc3df5e25e43", "shasum": "" }, "require": { "ext-dom": "*", - "php": "^7.4|^8.0" + "php": "^8.0" }, "require-dev": { "mockery/mockery": "^1.2", "pestphp/pest": "^1.21", - "phpunit/phpunit": "^9.0", "spatie/pest-plugin-snapshots": "^1.1" }, "type": "library", @@ -6529,7 +6402,7 @@ "xml" ], "support": { - "source": "https://github.com/spatie/array-to-xml/tree/2.17.1" + "source": "https://github.com/spatie/array-to-xml/tree/3.1.5" }, "funding": [ { @@ -6541,7 +6414,7 @@ "type": "github" } ], - "time": "2022-12-26T08:22:07+00:00" + "time": "2022-12-24T13:43:51+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -6790,16 +6663,16 @@ }, { "name": "vimeo/psalm", - "version": "5.4.0", + "version": "5.7.7", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "62db5d4f6a7ae0a20f7cc5a4952d730272fc0863" + "reference": "e028ba46ba0d7f9a78bc3201c251e137383e145f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/62db5d4f6a7ae0a20f7cc5a4952d730272fc0863", - "reference": "62db5d4f6a7ae0a20f7cc5a4952d730272fc0863", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/e028ba46ba0d7f9a78bc3201c251e137383e145f", + "reference": "e028ba46ba0d7f9a78bc3201c251e137383e145f", "shasum": "" }, "require": { @@ -6818,28 +6691,27 @@ "ext-tokenizer": "*", "felixfbecker/advanced-json-rpc": "^3.1", "felixfbecker/language-server-protocol": "^1.5.2", - "fidry/cpu-core-counter": "^0.4.0", + "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "nikic/php-parser": "^4.13", "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", - "sebastian/diff": "^4.0", - "spatie/array-to-xml": "^2.17.0", + "sebastian/diff": "^4.0 || ^5.0", + "spatie/array-to-xml": "^2.17.0 || ^3.0", "symfony/console": "^4.1.6 || ^5.0 || ^6.0", - "symfony/filesystem": "^5.4 || ^6.0", - "symfony/polyfill-php80": "^1.25" + "symfony/filesystem": "^5.4 || ^6.0" }, "provide": { "psalm/psalm": "self.version" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.4", - "brianium/paratest": "^6.0", + "brianium/paratest": "^6.9", "ext-curl": "*", "mockery/mockery": "^1.5", "nunomaduro/mock-final-classes": "^1.1", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/phpdoc-parser": "^1.6", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^9.6", "psalm/plugin-mockery": "^1.1", "psalm/plugin-phpunit": "^0.18", "slevomat/coding-standard": "^8.4", @@ -6885,13 +6757,14 @@ "keywords": [ "code", "inspection", - "php" + "php", + "static analysis" ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.4.0" + "source": "https://github.com/vimeo/psalm/tree/5.7.7" }, - "time": "2022-12-19T21:31:12+00:00" + "time": "2023-02-25T01:05:07+00:00" }, { "name": "webmozart/assert", @@ -6961,7 +6834,10 @@ "prefer-lowest": false, "platform": { "php": "~8.1.0 || ~8.2.0", - "ext-json": "*" + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-simplexml": "*" }, "platform-dev": [], "platform-overrides": { diff --git a/infection.json.dist b/infection.json.dist index 2fea2d7a..51aa632b 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -17,5 +17,5 @@ "NotIdenticalNotEqual": false }, "minMsi": 90.1, - "minCoveredMsi": 100 + "minCoveredMsi": 95 } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 8dc40ff0..c14652bb 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,9 +2,10 @@ @@ -15,7 +16,7 @@ - + ./src diff --git a/resources/schema.xsd b/resources/schema.xsd new file mode 100644 index 00000000..14cc97f4 --- /dev/null +++ b/resources/schema.xsd @@ -0,0 +1,24 @@ + + + + + + + This schema file defines the structure for the XML configuration file of roave/backward-compatibility-check. + + + + + + + + + + + + + + + + + diff --git a/src/Baseline.php b/src/Baseline.php new file mode 100644 index 00000000..d0f846e6 --- /dev/null +++ b/src/Baseline.php @@ -0,0 +1,40 @@ + $ignoredChanges */ + private function __construct(private readonly array $ignoredChanges = []) + { + } + + public static function empty(): self + { + return new self(); + } + + public static function fromList(string ...$ignoredChanges): self + { + return new self(array_values($ignoredChanges)); + } + + public function ignores(Change $change): bool + { + $changeDescription = $change->__toString(); + + foreach ($this->ignoredChanges as $ignoredChangeRegex) { + if (preg_match($ignoredChangeRegex, $changeDescription) === 1) { + return true; + } + } + + return false; + } +} diff --git a/src/Changes.php b/src/Changes.php index 199652d7..d4770975 100644 --- a/src/Changes.php +++ b/src/Changes.php @@ -67,6 +67,23 @@ public function mergeWith(self $other): self return $instance; } + public function applyBaseline(Baseline $baseline): self + { + $instance = new self([]); + + $instance->unBufferedChanges = (function () use ($baseline): Generator { + foreach ($this as $change) { + if ($baseline->ignores($change)) { + continue; + } + + yield $change; + } + })(); + + return $instance; + } + /** * {@inheritDoc} * diff --git a/src/Command/AssertBackwardsCompatible.php b/src/Command/AssertBackwardsCompatible.php index af4ef615..ba6f69e6 100644 --- a/src/Command/AssertBackwardsCompatible.php +++ b/src/Command/AssertBackwardsCompatible.php @@ -113,7 +113,9 @@ public function execute(InputInterface $input, OutputInterface $output): int $stdErr = $output->getErrorOutput(); // @todo fix flaky assumption about the path of the source repo... - $sourceRepo = CheckedOutRepository::fromPath(Env\current_dir()); + $currentDirectory = Env\current_dir(); + + $sourceRepo = CheckedOutRepository::fromPath($currentDirectory); $fromRevision = $input->getOption('from') !== null ? $this->parseRevisionFromInput($input, $sourceRepo) @@ -125,6 +127,8 @@ public function execute(InputInterface $input, OutputInterface $output): int $toRevision = $this->parseRevision->fromStringForRepository($to, $sourceRepo); + $configuration = (new DetermineConfigurationFromFilesystem())($currentDirectory, $stdErr); + $stdErr->writeln(Str\format( 'Comparing from %s to %s...', Type\string()->coerce($fromRevision), @@ -148,7 +152,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $toPath->__toString(), ($this->locateDependencies)($toPath->__toString(), $includeDevelopmentDependencies), ), - ); + )->applyBaseline($configuration->baseline); $formatters = [ 'console' => new SymfonyConsoleTextFormatter($stdErr), diff --git a/src/Command/DetermineConfigurationFromFilesystem.php b/src/Command/DetermineConfigurationFromFilesystem.php new file mode 100644 index 00000000..2be952f4 --- /dev/null +++ b/src/Command/DetermineConfigurationFromFilesystem.php @@ -0,0 +1,37 @@ +parser->parse($currentDirectory); + + if ($configuration->filename !== null) { + $stdErr->writeln(Str\format( + 'Using "%s" as configuration file', + Type\string()->coerce($configuration->filename), + )); + } + + return $configuration; + } +} diff --git a/src/Configuration/Configuration.php b/src/Configuration/Configuration.php new file mode 100644 index 00000000..e5a7bbc5 --- /dev/null +++ b/src/Configuration/Configuration.php @@ -0,0 +1,27 @@ + $errors */ + public static function fromLibxmlErrors(array $errors): self + { + $message = 'The provided configuration is invalid, errors:' . PHP_EOL; + + foreach ($errors as $error) { + $message .= sprintf( + ' - [Line %d] %s' . PHP_EOL, + $error->line, + trim($error->message), + ); + } + + return new self($message); + } +} diff --git a/src/Configuration/ParseConfigurationFile.php b/src/Configuration/ParseConfigurationFile.php new file mode 100644 index 00000000..ffc3723d --- /dev/null +++ b/src/Configuration/ParseConfigurationFile.php @@ -0,0 +1,11 @@ +validateStructure($xmlContents); + } catch (File\Exception\InvalidArgumentException) { + return Configuration::default(); + } + + $configuration = new SimpleXMLElement($xmlContents); + + return Configuration::fromFile( + $this->parseBaseline($configuration), + $filename, + ); + } + + private function validateStructure(string $xmlContents): void + { + $previousConfiguration = libxml_use_internal_errors(true); + + $xmlDocument = new DOMDocument(); + $xmlDocument->loadXML($xmlContents); + + $configurationIsValid = $xmlDocument->schemaValidate(self::SCHEMA); + + $parsingErrors = array_values(libxml_get_errors()); + libxml_use_internal_errors($previousConfiguration); + + if ($configurationIsValid) { + return; + } + + throw InvalidConfigurationStructure::fromLibxmlErrors($parsingErrors); + } + + private function parseBaseline(SimpleXMLElement $element): Baseline + { + $ignoredItems = []; + + foreach ($element->xpath('baseline/ignored-regex') ?? [] as $node) { + $ignoredItems[] = (string) $node; + } + + return Baseline::fromList(...$ignoredItems); + } +} diff --git a/test/e2e/Command/AssertBackwardsCompatibleTest.php b/test/e2e/Command/AssertBackwardsCompatibleTest.php index 246f1210..becc433e 100644 --- a/test/e2e/Command/AssertBackwardsCompatibleTest.php +++ b/test/e2e/Command/AssertBackwardsCompatibleTest.php @@ -30,6 +30,15 @@ final class AssertBackwardsCompatibleTest extends TestCase JSON; + private const BASELINE_CONFIGURATION = <<<'XML' + + + + #\[BC\] CHANGED: The parameter \$a of TestArtifact\\TheClass\#method.*# + + +XML; + private const CLASS_VERSIONS = [ <<<'PHP' sourcesRepository); Shell\execute('git', ['config', 'user.email', 'me@example.com'], $this->sourcesRepository); Shell\execute('git', ['config', 'user.name', 'Just Me'], $this->sourcesRepository); + Shell\execute('git', ['config', 'commit.gpgSign', 'false'], $this->sourcesRepository); + Shell\execute('git', ['config', 'tag.forceSignAnnotated', 'false'], $this->sourcesRepository); File\write($this->sourcesRepository . '/composer.json', self::COMPOSER_MANIFEST); @@ -262,6 +273,21 @@ public function testWillPickLatestTaggedVersionOnNoGivenFrom(): void } } + public function testWillAllowSpecifyingBaselineConfiguration(): void + { + File\write($this->sourcesRepository . '/.roave-backward-compatibility-check.xml', self::BASELINE_CONFIGURATION); + + $output = Shell\execute(__DIR__ . '/../../../bin/roave-backward-compatibility-check', [ + '--from=' . $this->versions[0], + '--to=' . $this->versions[1], + ], $this->sourcesRepository, [], Shell\ErrorOutputBehavior::Append); + + self::assertStringContainsString( + '.roave-backward-compatibility-check.xml" as configuration file', + $output, + ); + } + private function tagOnVersion(string $tagName, int $version): void { Shell\execute('git', ['checkout', $this->versions[$version]], $this->sourcesRepository); diff --git a/test/unit/ChangesTest.php b/test/unit/ChangesTest.php index 8e2b5283..67662c58 100644 --- a/test/unit/ChangesTest.php +++ b/test/unit/ChangesTest.php @@ -7,6 +7,7 @@ use Generator; use PHPUnit\Framework\TestCase; use Psl\Type; +use Roave\BackwardCompatibility\Baseline; use Roave\BackwardCompatibility\Change; use Roave\BackwardCompatibility\Changes; @@ -118,4 +119,41 @@ public function testCount(): void Changes::fromList(...array_fill(0, $count, Change::added('foo', true))), ); } + + /** @psalm-suppress UnusedVariable by-ref assignments are in place to override the behavior of the spy/callback */ + public function testApplyBaselineWillApplyTheFilterWithoutLoadingChanges(): void + { + $stopProducingValues = static function (): void { + self::fail('No values should have been produced'); + }; + + $changesProvider = static function () use (&$stopProducingValues): Generator { + /** @psalm-var callable(): void $stopProducingValues */ + $stopProducingValues(); + + yield Change::changed('a', true); + + $stopProducingValues(); + + yield Change::changed('b', false); + }; + + $changes = Changes::fromIterator($changesProvider()); + $filtered = $changes->applyBaseline(Baseline::fromList('#a#')); + + self::assertNotSame($changes, $filtered, 'New instance should be created'); + + $stopProducingValues = static function (): void { + }; + + $expectedChanges = [Change::changed('b', false)]; + + self::assertEquals($expectedChanges, iterator_to_array($filtered)); + self::assertEquals( + $expectedChanges, + iterator_to_array($filtered), + 'Changes can be iterated upon more than once (they are buffered)', + ); + self::assertCount(1, $filtered); + } } diff --git a/test/unit/Command/AssertBackwardsCompatibleTest.php b/test/unit/Command/AssertBackwardsCompatibleTest.php index f8f29939..dc532dde 100644 --- a/test/unit/Command/AssertBackwardsCompatibleTest.php +++ b/test/unit/Command/AssertBackwardsCompatibleTest.php @@ -4,6 +4,7 @@ namespace RoaveTest\BackwardCompatibility\Command; +use LogicException; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psl\Env; @@ -20,7 +21,6 @@ use Roave\BackwardCompatibility\Git\CheckedOutRepository; use Roave\BackwardCompatibility\Git\GetVersionCollection; use Roave\BackwardCompatibility\Git\ParseRevision; -use Roave\BackwardCompatibility\Git\PerformCheckoutOfRevision; use Roave\BackwardCompatibility\Git\PickVersionFromVersionCollection; use Roave\BackwardCompatibility\Git\Revision; use Roave\BackwardCompatibility\LocateDependencies\LocateDependencies; @@ -46,8 +46,7 @@ final class AssertBackwardsCompatibleTest extends TestCase private ConsoleOutputInterface $output; /** @var OutputInterface&MockObject */ private OutputInterface $stdErr; - /** @var PerformCheckoutOfRevision&MockObject */ - private PerformCheckoutOfRevision $performCheckout; + private PerformCheckoutOfRevisionForTests $performCheckout; /** @var ParseRevision&MockObject */ private ParseRevision $parseRevision; /** @var GetVersionCollection&MockObject */ @@ -73,7 +72,7 @@ public function setUp(): void $this->input = $this->createMock(InputInterface::class); $this->output = $this->createMock(ConsoleOutputInterface::class); $this->stdErr = $this->createMock(OutputInterface::class); - $this->performCheckout = $this->createMock(PerformCheckoutOfRevision::class); + $this->performCheckout = new PerformCheckoutOfRevisionForTests(); $this->parseRevision = $this->createMock(ParseRevision::class); $this->getVersions = $this->createMock(GetVersionCollection::class); $this->pickVersion = $this->createMock(PickVersionFromVersionCollection::class); @@ -137,32 +136,9 @@ public function testExecuteWhenRevisionsAreProvidedAsOptions(): void ['sources-path', 'src'], ]); - $this->performCheckout->expects(self::exactly(2)) - ->method('checkout') - ->withConsecutive( - [$this->sourceRepository, $fromSha], - [$this->sourceRepository, $toSha], - )->willReturnOnConsecutiveCalls( - $this->sourceRepository, - $this->sourceRepository, - ); - - $this->performCheckout->expects(self::exactly(2)) - ->method('remove') - ->withConsecutive( - [$this->sourceRepository], - [$this->sourceRepository], - ); - $this->parseRevision->expects(self::exactly(2)) ->method('fromStringForRepository') - ->withConsecutive( - [$fromSha], - [$toSha], - )->willReturnOnConsecutiveCalls( - Revision::fromSha1($fromSha), - Revision::fromSha1($toSha), - ); + ->willReturnCallback(Revision::fromSha1(...)); $this ->locateDependencies @@ -173,6 +149,7 @@ public function testExecuteWhenRevisionsAreProvidedAsOptions(): void $this->compareApi->expects(self::once())->method('__invoke')->willReturn(Changes::empty()); self::assertSame(0, $this->compare->execute($this->input, $this->output)); + self::assertSame(0, $this->performCheckout->nonRemovedRepositoryCount()); } public function testExecuteWhenDevelopmentDependenciesAreRequested(): void @@ -189,32 +166,9 @@ public function testExecuteWhenDevelopmentDependenciesAreRequested(): void ['sources-path', 'src'], ]); - $this->performCheckout->expects(self::exactly(2)) - ->method('checkout') - ->withConsecutive( - [$this->sourceRepository, $fromSha], - [$this->sourceRepository, $toSha], - )->willReturnOnConsecutiveCalls( - $this->sourceRepository, - $this->sourceRepository, - ); - - $this->performCheckout->expects(self::exactly(2)) - ->method('remove') - ->withConsecutive( - [$this->sourceRepository], - [$this->sourceRepository], - ); - $this->parseRevision->expects(self::exactly(2)) ->method('fromStringForRepository') - ->withConsecutive( - [$fromSha], - [$toSha], - )->willReturnOnConsecutiveCalls( - Revision::fromSha1($fromSha), - Revision::fromSha1($toSha), - ); + ->willReturnCallback(Revision::fromSha1(...)); $this ->locateDependencies @@ -225,6 +179,7 @@ public function testExecuteWhenDevelopmentDependenciesAreRequested(): void $this->compareApi->expects(self::once())->method('__invoke')->willReturn(Changes::empty()); self::assertSame(0, $this->compare->execute($this->input, $this->output)); + self::assertSame(0, $this->performCheckout->nonRemovedRepositoryCount()); } public function testExecuteReturnsNonZeroExitCodeWhenChangesAreDetected(): void @@ -242,32 +197,9 @@ public function testExecuteReturnsNonZeroExitCodeWhenChangesAreDetected(): void ['sources-path', 'src'], ]); - $this->performCheckout->expects(self::exactly(2)) - ->method('checkout') - ->withConsecutive( - [$this->sourceRepository, $fromSha], - [$this->sourceRepository, $toSha], - )->willReturnOnConsecutiveCalls( - $this->sourceRepository, - $this->sourceRepository, - ); - - $this->performCheckout->expects(self::exactly(2)) - ->method('remove') - ->withConsecutive( - [$this->sourceRepository], - [$this->sourceRepository], - ); - $this->parseRevision->expects(self::exactly(2)) ->method('fromStringForRepository') - ->withConsecutive( - [$fromSha], - [$toSha], - )->willReturnOnConsecutiveCalls( - Revision::fromSha1($fromSha), - Revision::fromSha1($toSha), - ); + ->willReturnCallback(Revision::fromSha1(...)); $this ->locateDependencies @@ -290,6 +222,7 @@ public function testExecuteReturnsNonZeroExitCodeWhenChangesAreDetected(): void )); self::assertSame(3, $this->compare->execute($this->input, $this->output)); + self::assertSame(0, $this->performCheckout->nonRemovedRepositoryCount()); } public function testProvidingMarkdownOptionWritesMarkdownOutput(): void @@ -307,32 +240,9 @@ public function testProvidingMarkdownOptionWritesMarkdownOutput(): void ['sources-path', 'src'], ]); - $this->performCheckout->expects(self::exactly(2)) - ->method('checkout') - ->withConsecutive( - [$this->sourceRepository, $fromSha], - [$this->sourceRepository, $toSha], - )->willReturnOnConsecutiveCalls( - $this->sourceRepository, - $this->sourceRepository, - ); - - $this->performCheckout->expects(self::exactly(2)) - ->method('remove') - ->withConsecutive( - [$this->sourceRepository], - [$this->sourceRepository], - ); - $this->parseRevision->expects(self::exactly(2)) ->method('fromStringForRepository') - ->withConsecutive( - [$fromSha], - [$toSha], - )->willReturnOnConsecutiveCalls( - Revision::fromSha1($fromSha), - Revision::fromSha1($toSha), - ); + ->willReturnCallback(Revision::fromSha1(...)); $this ->locateDependencies @@ -353,6 +263,7 @@ public function testProvidingMarkdownOptionWritesMarkdownOutput(): void }); $this->compare->execute($this->input, $this->output); + self::assertSame(0, $this->performCheckout->nonRemovedRepositoryCount()); } public function testExecuteWithDefaultRevisionsNotProvidedAndNoDetectedTags(): void @@ -365,10 +276,6 @@ public function testExecuteWithDefaultRevisionsNotProvidedAndNoDetectedTags(): v ['sources-path', 'src'], ]); - $this - ->performCheckout - ->expects(self::never()) - ->method('checkout'); $this ->parseRevision ->expects(self::never()) @@ -391,6 +298,7 @@ public function testExecuteWithDefaultRevisionsNotProvidedAndNoDetectedTags(): v $this->expectException(InvariantViolationException::class); $this->compare->execute($this->input, $this->output); + self::assertSame(0, $this->performCheckout->nonRemovedRepositoryCount()); } /** @dataProvider validVersionCollections */ @@ -398,7 +306,7 @@ public function testExecuteWithDefaultRevisionsNotProvided(VersionCollection $ve { $fromSha = Hash\Context::forAlgorithm(Hash\Algorithm::SHA1)->update('fromRevision')->finalize(); $toSha = Hash\Context::forAlgorithm(Hash\Algorithm::SHA1)->update('toRevision')->finalize(); - $pickedVersion = $this->makeVersion('1.0.0'); + $pickedVersion = self::makeVersion('1.0.0'); $this->input->method('getOption')->willReturnMap([ ['from', null], @@ -409,32 +317,13 @@ public function testExecuteWithDefaultRevisionsNotProvided(VersionCollection $ve ['sources-path', 'src'], ]); - $this->performCheckout->expects(self::exactly(2)) - ->method('checkout') - ->withConsecutive( - [$this->sourceRepository, $fromSha], - [$this->sourceRepository, $toSha], - )->willReturnOnConsecutiveCalls( - $this->sourceRepository, - $this->sourceRepository, - ); - - $this->performCheckout->expects(self::exactly(2)) - ->method('remove') - ->withConsecutive( - [$this->sourceRepository], - [$this->sourceRepository], - ); - $this->parseRevision->expects(self::exactly(2)) ->method('fromStringForRepository') - ->withConsecutive( - [(string) $pickedVersion], - ['HEAD'], - )->willReturnOnConsecutiveCalls( - Revision::fromSha1($fromSha), - Revision::fromSha1($toSha), - ); + ->willReturnCallback(static fn (string $input): Revision => match ($input) { + (string) $pickedVersion => Revision::fromSha1($fromSha), + 'HEAD' => Revision::fromSha1($toSha), + default => throw new LogicException(), + }); $this->getVersions->expects(self::once()) ->method('fromRepository') @@ -462,31 +351,32 @@ public function testExecuteWithDefaultRevisionsNotProvided(VersionCollection $ve $this->compareApi->expects(self::once())->method('__invoke')->willReturn(Changes::empty()); self::assertSame(0, $this->compare->execute($this->input, $this->output)); + self::assertSame(0, $this->performCheckout->nonRemovedRepositoryCount()); } /** @return VersionCollection[][] */ - public function validVersionCollections(): array + public static function validVersionCollections(): array { return [ [ new VersionCollection( - $this->makeVersion('1.0.0'), - $this->makeVersion('1.0.1'), - $this->makeVersion('1.0.2'), + self::makeVersion('1.0.0'), + self::makeVersion('1.0.1'), + self::makeVersion('1.0.2'), ), ], [ new VersionCollection( - $this->makeVersion('1.0.0'), - $this->makeVersion('1.0.1'), + self::makeVersion('1.0.0'), + self::makeVersion('1.0.1'), ), ], - [new VersionCollection($this->makeVersion('1.0.0'))], + [new VersionCollection(self::makeVersion('1.0.0'))], ]; } /** @psalm-param non-empty-string $version */ - private function makeVersion(string $version): Version + private static function makeVersion(string $version): Version { return Type\instance_of(Version::class) ->coerce(Version::fromString($version)); diff --git a/test/unit/Command/PerformCheckoutOfRevisionForTests.php b/test/unit/Command/PerformCheckoutOfRevisionForTests.php new file mode 100644 index 00000000..25c74067 --- /dev/null +++ b/test/unit/Command/PerformCheckoutOfRevisionForTests.php @@ -0,0 +1,54 @@ + */ + private SplObjectStorage $checkedOutRepositories; + + public function __construct() + { + $this->checkedOutRepositories = new SplObjectStorage(); + } + + public function checkout(CheckedOutRepository $sourceRepository, Revision $revision): CheckedOutRepository + { + if (! isset($this->checkedOutRepositories[$sourceRepository])) { + $this->checkedOutRepositories[$sourceRepository] = 0; + } + + $this->checkedOutRepositories[$sourceRepository] += 1; + + return $sourceRepository; + } + + public function remove(CheckedOutRepository $checkedOutRepository): void + { + $this->checkedOutRepositories[$checkedOutRepository] -= 1; + + if ($this->checkedOutRepositories[$checkedOutRepository] !== 0) { + return; + } + + unset($this->checkedOutRepositories[$checkedOutRepository]); + } + + public function nonRemovedRepositoryCount(): int + { + $sum = 0; + + foreach ($this->checkedOutRepositories as $repository) { + $sum += $this->checkedOutRepositories[$repository]; + } + + return $sum; + } +} diff --git a/test/unit/Configuration/ConfigurationTest.php b/test/unit/Configuration/ConfigurationTest.php new file mode 100644 index 00000000..4510fb44 --- /dev/null +++ b/test/unit/Configuration/ConfigurationTest.php @@ -0,0 +1,21 @@ +baseline); + self::assertNull($config->filename); + } +} diff --git a/test/unit/Configuration/ParseXmlConfigurationFileTest.php b/test/unit/Configuration/ParseXmlConfigurationFileTest.php new file mode 100644 index 00000000..661fb51a --- /dev/null +++ b/test/unit/Configuration/ParseXmlConfigurationFileTest.php @@ -0,0 +1,193 @@ +temporaryDirectory = Filesystem\create_temporary_file( + Env\temp_dir(), + 'roave-backward-compatibility-xml-config-test', + ); + + self::assertNotEmpty($this->temporaryDirectory); + self::assertFileExists($this->temporaryDirectory); + + Filesystem\delete_file($this->temporaryDirectory); + Filesystem\create_directory($this->temporaryDirectory); + } + + /** @after */ + public function cleanUpFilesystem(): void + { + Shell\execute('rm', ['-rf', $this->temporaryDirectory]); + } + + /** @test */ + public function defaultConfigurationShouldBeUsedWhenFileDoesNotExist(): void + { + $config = (new ParseXmlConfigurationFile())->parse($this->temporaryDirectory); + + self::assertEquals(Configuration::default(), $config); + } + + /** + * @test + * @dataProvider invalidConfiguration + */ + public function exceptionShouldBeRaisedWhenStructureIsInvalid( + string $xmlContents, + string $expectedError, + ): void { + File\write($this->temporaryDirectory . '/.roave-backward-compatibility-check.xml', $xmlContents); + + $this->expectException(InvalidConfigurationStructure::class); + $this->expectExceptionMessage($expectedError); + + (new ParseXmlConfigurationFile())->parse($this->temporaryDirectory); + } + + /** @return iterable */ + public static function invalidConfiguration(): iterable + { + yield 'invalid root element' => [ + <<<'XML' + + +XML, + '[Line 2] Element \'anything\': No matching global declaration available for the validation root', + ]; + + yield 'invalid root child' => [ + <<<'XML' + + + + +XML, + '[Line 3] Element \'something\': This element is not expected. Expected is ( baseline )', + ]; + + yield 'multiple baseline tags' => [ + <<<'XML' + + + + + +XML, + '[Line 4] Element \'baseline\': This element is not expected', + ]; + + yield 'invalid baseline child' => [ + <<<'XML' + + + + + + +XML, + '[Line 4] Element \'nothing\': This element is not expected. Expected is ( ignored-regex )', + ]; + + yield 'invalid ignored item type' => [ + <<<'XML' + + + + + + + + +XML, + '[Line 4] Element \'ignored-regex\': Element content is not allowed, because the type definition is simple', + ]; + } + + /** + * @test + * @dataProvider validConfiguration + */ + public function baselineShouldBeParsed( + string $xmlContents, + Baseline $expectedBaseline, + ): void { + File\write($this->temporaryDirectory . '/.roave-backward-compatibility-check.xml', $xmlContents); + + self::assertEquals( + Configuration::fromFile( + $expectedBaseline, + $this->temporaryDirectory . '/.roave-backward-compatibility-check.xml', + ), + (new ParseXmlConfigurationFile())->parse($this->temporaryDirectory), + ); + } + + /** @return iterable */ + public static function validConfiguration(): iterable + { + yield 'no baseline' => [ + <<<'XML' + + +XML, + Baseline::empty(), + ]; + + yield 'empty baseline' => [ + <<<'XML' + + + + +XML, + Baseline::empty(), + ]; + + yield 'baseline with single element' => [ + <<<'XML' + + + + #\[BC\] CHANGED: The parameter \$a of TestArtifact\\TheClass\#method.*# + + +XML, + Baseline::fromList('#\[BC\] CHANGED: The parameter \$a of TestArtifact\\\\TheClass\#method.*#'), + ]; + + yield 'baseline with multiple elements' => [ + <<<'XML' + + + + #\[BC\] CHANGED: The parameter \$a of TestArtifact\\TheClass\#method.*# + #\[BC\] ADDED: Method .*\(\) was added to interface TestArtifact\\TheInterface.*# + + +XML, + Baseline::fromList( + '#\[BC\] CHANGED: The parameter \$a of TestArtifact\\\\TheClass\#method.*#', + '#\[BC\] ADDED: Method .*\(\) was added to interface TestArtifact\\\\TheInterface.*#', + ), + ]; + } +} diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/AncestorRemovedTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/AncestorRemovedTest.php index e9a8aefa..1a34930e 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/AncestorRemovedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/AncestorRemovedTest.php @@ -44,7 +44,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); $fromReflector = new DefaultReflector(new StringSourceLocator( diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameAbstractTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameAbstractTest.php index e411b72e..ca5c3ff9 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameAbstractTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameAbstractTest.php @@ -44,7 +44,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); $fromReflector = new DefaultReflector(new StringSourceLocator( diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameFinalTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameFinalTest.php index eef01122..8168320c 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameFinalTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameFinalTest.php @@ -41,7 +41,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); $fromReflector = new DefaultReflector(new StringSourceLocator( diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInterfaceTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInterfaceTest.php index eb06a61f..372320af 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInterfaceTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInterfaceTest.php @@ -43,7 +43,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); $fromReflector = new DefaultReflector(new StringSourceLocator( diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInternalTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInternalTest.php index eedbf069..4f90b61e 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInternalTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInternalTest.php @@ -42,7 +42,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); $fromReflector = new DefaultReflector(new StringSourceLocator( diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameTraitTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameTraitTest.php index e7b78032..a1d78a72 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameTraitTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameTraitTest.php @@ -44,7 +44,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); $fromReflector = new DefaultReflector(new StringSourceLocator( diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ConstantRemovedTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ConstantRemovedTest.php index 1ffaf8a2..96366047 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ConstantRemovedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ConstantRemovedTest.php @@ -41,7 +41,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/MethodRemovedTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/MethodRemovedTest.php index aca411c1..598a75e8 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/MethodRemovedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/MethodRemovedTest.php @@ -41,7 +41,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/PropertyRemovedTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/PropertyRemovedTest.php index 447047b8..00e3d60c 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/PropertyRemovedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/PropertyRemovedTest.php @@ -42,7 +42,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/ClassConstantBased/ClassConstantValueChangedTest.php b/test/unit/DetectChanges/BCBreak/ClassConstantBased/ClassConstantValueChangedTest.php index 82a993e0..2283f331 100644 --- a/test/unit/DetectChanges/BCBreak/ClassConstantBased/ClassConstantValueChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassConstantBased/ClassConstantValueChangedTest.php @@ -48,7 +48,7 @@ public function testDiffs( * 2: list * }> */ - public function constantsToBeTested(): array + public static function constantsToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/ClassConstantBased/ClassConstantVisibilityReducedTest.php b/test/unit/DetectChanges/BCBreak/ClassConstantBased/ClassConstantVisibilityReducedTest.php index 7899f4cb..5f4cc4a3 100644 --- a/test/unit/DetectChanges/BCBreak/ClassConstantBased/ClassConstantVisibilityReducedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassConstantBased/ClassConstantVisibilityReducedTest.php @@ -48,7 +48,7 @@ public function testDiffs( * 2: list * }> */ - public function constantsToBeTested(): array + public static function constantsToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternalTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternalTest.php index c203619c..a97b1610 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternalTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternalTest.php @@ -48,7 +48,7 @@ public function testDiffs( * 2: list * }> */ - public function functionsToBeTested(): array + public static function functionsToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterByReferenceChangedTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterByReferenceChangedTest.php index 1b227920..94574002 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterByReferenceChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterByReferenceChangedTest.php @@ -51,7 +51,7 @@ public function testDiffs( * 2: list * }> */ - public function functionsToBeTested(): array + public static function functionsToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterDefaultValueChangedTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterDefaultValueChangedTest.php index 3740fb2a..372042e8 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterDefaultValueChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterDefaultValueChangedTest.php @@ -53,7 +53,7 @@ public function testDiffs( * 2: list * }> */ - public function functionsToBeTested(): array + public static function functionsToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); $sourceStubber = (new BetterReflection())->sourceStubber(); diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterNameChangedTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterNameChangedTest.php index 0c012fd8..b25a8f35 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterNameChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterNameChangedTest.php @@ -50,7 +50,7 @@ public function testDiffs( * 2: list * }> */ - public function functionsToBeTested(): array + public static function functionsToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); @@ -154,7 +154,7 @@ public function theMethod(int $b) {} $toClassReflector = new DefaultReflector($toLocator); $fromMethod = $fromClassReflector->reflectClass('TheClass')->getMethod('theMethod'); $toMethod = $toClassReflector->reflectClass('TheClass')->getMethod('theMethod'); - + assert($fromMethod !== null); assert($toMethod !== null); diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterTypeChangedTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterTypeChangedTest.php index f12dfe33..3da38051 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterTypeChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterTypeChangedTest.php @@ -51,7 +51,7 @@ public function testDiffs( * 2: list * }> */ - public function functionsToBeTested(): array + public static function functionsToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterTypeContravarianceChangedTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterTypeContravarianceChangedTest.php index 01e902ff..3d92467d 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterTypeContravarianceChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterTypeContravarianceChangedTest.php @@ -52,7 +52,7 @@ public function testDiffs( * 2: list * }> */ - public function functionsToBeTested(): array + public static function functionsToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/RequiredParameterAmountIncreasedTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/RequiredParameterAmountIncreasedTest.php index 98535e45..95159a5e 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/RequiredParameterAmountIncreasedTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/RequiredParameterAmountIncreasedTest.php @@ -51,7 +51,7 @@ public function testDiffs( * 2: list * }> */ - public function functionsToBeTested(): array + public static function functionsToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/ReturnTypeByReferenceChangedTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/ReturnTypeByReferenceChangedTest.php index ee38b00d..ec14472a 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/ReturnTypeByReferenceChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/ReturnTypeByReferenceChangedTest.php @@ -51,7 +51,7 @@ public function testDiffs( * 2: list * }> */ - public function functionsToBeTested(): array + public static function functionsToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/ReturnTypeChangedTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/ReturnTypeChangedTest.php index c9ecdb76..921a3b61 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/ReturnTypeChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/ReturnTypeChangedTest.php @@ -51,7 +51,7 @@ public function testDiffs( * 2: list * }> */ - public function functionsToBeTested(): array + public static function functionsToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/ReturnTypeCovarianceChangedTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/ReturnTypeCovarianceChangedTest.php index 1caa556e..b1810d07 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/ReturnTypeCovarianceChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/ReturnTypeCovarianceChangedTest.php @@ -52,7 +52,7 @@ public function testDiffs( * 2: list * }> */ - public function functionsToBeTested(): array + public static function functionsToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/InterfaceBased/AncestorRemovedTest.php b/test/unit/DetectChanges/BCBreak/InterfaceBased/AncestorRemovedTest.php index 7e4326ca..0d6308d5 100644 --- a/test/unit/DetectChanges/BCBreak/InterfaceBased/AncestorRemovedTest.php +++ b/test/unit/DetectChanges/BCBreak/InterfaceBased/AncestorRemovedTest.php @@ -44,7 +44,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function interfacesToBeTested(): array + public static function interfacesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); $fromReflector = new DefaultReflector(new StringSourceLocator( diff --git a/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameClassTest.php b/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameClassTest.php index 9067174d..220aeacd 100644 --- a/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameClassTest.php +++ b/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameClassTest.php @@ -43,7 +43,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); $fromReflector = new DefaultReflector(new StringSourceLocator( diff --git a/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameTraitTest.php b/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameTraitTest.php index 2f7d1366..90e8f261 100644 --- a/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameTraitTest.php +++ b/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameTraitTest.php @@ -43,7 +43,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); $fromReflector = new DefaultReflector(new StringSourceLocator( diff --git a/test/unit/DetectChanges/BCBreak/InterfaceBased/MethodAddedTest.php b/test/unit/DetectChanges/BCBreak/InterfaceBased/MethodAddedTest.php index 92213a57..09b192d4 100644 --- a/test/unit/DetectChanges/BCBreak/InterfaceBased/MethodAddedTest.php +++ b/test/unit/DetectChanges/BCBreak/InterfaceBased/MethodAddedTest.php @@ -43,7 +43,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function interfacesToBeTested(): array + public static function interfacesToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/MethodBecameFinalTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/MethodBecameFinalTest.php index 1d126d05..acf6295b 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/MethodBecameFinalTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/MethodBecameFinalTest.php @@ -46,7 +46,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function propertiesToBeTested(): array + public static function propertiesToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/MethodConcretenessChangedTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/MethodConcretenessChangedTest.php index 4eba54c8..9f0a82bc 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/MethodConcretenessChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/MethodConcretenessChangedTest.php @@ -46,7 +46,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function propertiesToBeTested(): array + public static function propertiesToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/MethodScopeChangedTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/MethodScopeChangedTest.php index 73c6b427..206d346c 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/MethodScopeChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/MethodScopeChangedTest.php @@ -43,7 +43,7 @@ public function testDiffs( } /** @return array}> */ - public function propertiesToBeTested(): array + public static function propertiesToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/MethodVisibilityReducedTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/MethodVisibilityReducedTest.php index f4f91b5f..781a1b02 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/MethodVisibilityReducedTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/MethodVisibilityReducedTest.php @@ -46,7 +46,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function propertiesToBeTested(): array + public static function propertiesToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternalTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternalTest.php index b8fcf8e3..ad404a07 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternalTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternalTest.php @@ -45,7 +45,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function propertiesToBeTested(): array + public static function propertiesToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyDefaultValueChangedTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyDefaultValueChangedTest.php index dbf559b9..efaf4361 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyDefaultValueChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyDefaultValueChangedTest.php @@ -45,7 +45,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function propertiesToBeTested(): array + public static function propertiesToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyScopeChangedTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyScopeChangedTest.php index c2e302c1..02404543 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyScopeChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyScopeChangedTest.php @@ -45,7 +45,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function propertiesToBeTested(): array + public static function propertiesToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyTypeChangedTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyTypeChangedTest.php index 416a3b88..0fcf891a 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyTypeChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyTypeChangedTest.php @@ -50,7 +50,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function propertiesToBeTested(): array + public static function propertiesToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyVisibilityReducedTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyVisibilityReducedTest.php index 2ec9bb6a..061c40f6 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyVisibilityReducedTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyVisibilityReducedTest.php @@ -45,7 +45,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function propertiesToBeTested(): array + public static function propertiesToBeTested(): array { $astLocator = (new BetterReflection())->astLocator(); diff --git a/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameClassTest.php b/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameClassTest.php index 0d90207c..46f5aa98 100644 --- a/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameClassTest.php +++ b/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameClassTest.php @@ -44,7 +44,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); $fromReflector = new DefaultReflector(new StringSourceLocator( diff --git a/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameInterfaceTest.php b/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameInterfaceTest.php index 4036a4d9..161f8172 100644 --- a/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameInterfaceTest.php +++ b/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameInterfaceTest.php @@ -44,7 +44,7 @@ public function testDiffs( * @return array>> * @psalm-return array}> */ - public function classesToBeTested(): array + public static function classesToBeTested(): array { $locator = (new BetterReflection())->astLocator(); $fromReflector = new DefaultReflector(new StringSourceLocator( diff --git a/test/unit/DetectChanges/Variance/TypeIsContravariantTest.php b/test/unit/DetectChanges/Variance/TypeIsContravariantTest.php index 9c57d1f9..0b056af2 100644 --- a/test/unit/DetectChanges/Variance/TypeIsContravariantTest.php +++ b/test/unit/DetectChanges/Variance/TypeIsContravariantTest.php @@ -46,7 +46,7 @@ public function testContravariance( * 2: bool * }> */ - public function checkedTypes(): array + public static function checkedTypes(): array { $reflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -468,7 +468,7 @@ public function testContravarianceConsidersSameTypeAlwaysContravariant( } /** @return list */ - public function existingTypes(): array + public static function existingTypes(): array { $reflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -547,7 +547,7 @@ final class OwnerPropertyContainer { private $owner; } } /** @return string[][] */ - public function existingNullableTypeStrings(): array + public static function existingNullableTypeStrings(): array { return [ ['int'], diff --git a/test/unit/DetectChanges/Variance/TypeIsCovariantTest.php b/test/unit/DetectChanges/Variance/TypeIsCovariantTest.php index 22ea7bb6..5336775a 100644 --- a/test/unit/DetectChanges/Variance/TypeIsCovariantTest.php +++ b/test/unit/DetectChanges/Variance/TypeIsCovariantTest.php @@ -46,7 +46,7 @@ public function testCovariance( * 2: bool * }> */ - public function checkedTypes(): array + public static function checkedTypes(): array { $reflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -508,7 +508,7 @@ public function testCovarianceConsidersSameTypeAlwaysCovariant( } /** @return list */ - public function existingTypes(): array + public static function existingTypes(): array { $reflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -588,7 +588,7 @@ final class OwnerPropertyContainer { private $owner; } } /** @return string[][] */ - public function existingNullableTypeStrings(): array + public static function existingNullableTypeStrings(): array { return [ ['int'], diff --git a/test/unit/Formatter/FunctionNameTest.php b/test/unit/Formatter/FunctionNameTest.php index 548cac7c..2080d805 100644 --- a/test/unit/Formatter/FunctionNameTest.php +++ b/test/unit/Formatter/FunctionNameTest.php @@ -30,7 +30,7 @@ public function testName(ReflectionFunction|ReflectionMethod $function, string $ * 1: string * }> */ - public function functionsToBeTested(): array + public static function functionsToBeTested(): array { $locator = new StringSourceLocator( <<<'PHP' @@ -67,18 +67,18 @@ function e() {} 'N1\b()', ], 'N2\C::d' => [ - $this->getMethod($reflector->reflectClass('N2\C'), 'd'), + self::getMethod($reflector->reflectClass('N2\C'), 'd'), 'N2\C::d()', ], 'N2\C#e' => [ - $this->getMethod($reflector->reflectClass('N2\C'), 'e'), + self::getMethod($reflector->reflectClass('N2\C'), 'e'), 'N2\C#e()', ], ]; } /** @param non-empty-string $name */ - private function getMethod(ReflectionClass $class, string $name): ReflectionMethod + private static function getMethod(ReflectionClass $class, string $name): ReflectionMethod { $method = $class->getMethod($name); diff --git a/test/unit/Formatter/ReflectionPropertyNameTest.php b/test/unit/Formatter/ReflectionPropertyNameTest.php index 7f6fb606..ac72edea 100644 --- a/test/unit/Formatter/ReflectionPropertyNameTest.php +++ b/test/unit/Formatter/ReflectionPropertyNameTest.php @@ -28,7 +28,7 @@ public function testName(ReflectionProperty $property, string $expectedName): vo * @return array> * @psalm-return array */ - public function propertiesToBeTested(): array + public static function propertiesToBeTested(): array { $locator = new StringSourceLocator( <<<'PHP' diff --git a/test/unit/Formatter/SymfonyConsoleTextFormatterTest.php b/test/unit/Formatter/SymfonyConsoleTextFormatterTest.php index 2433ce3d..55f410a4 100644 --- a/test/unit/Formatter/SymfonyConsoleTextFormatterTest.php +++ b/test/unit/Formatter/SymfonyConsoleTextFormatterTest.php @@ -11,7 +11,9 @@ use Roave\BackwardCompatibility\Change; use Roave\BackwardCompatibility\Changes; use Roave\BackwardCompatibility\Formatter\SymfonyConsoleTextFormatter; -use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Output\BufferedOutput; + +use const PHP_EOL; /** @covers \Roave\BackwardCompatibility\Formatter\SymfonyConsoleTextFormatter */ final class SymfonyConsoleTextFormatterTest extends TestCase @@ -22,17 +24,17 @@ public function testWrite(): void $change1Text = SecureRandom\string(8); $change2Text = SecureRandom\string(8); - $output = $this->createMock(OutputInterface::class); - $output->expects(self::exactly(2)) - ->method('writeln') - ->withConsecutive( - [Str\format('[BC] REMOVED: %s', $change1Text)], - [Str\format(' ADDED: %s', $change2Text)], - ); + $output = new BufferedOutput(); (new SymfonyConsoleTextFormatter($output))->write(Changes::fromList( Change::removed($change1Text, true), Change::added($change2Text, false), )); + + self::assertSame( + Str\format('[BC] REMOVED: %s', $change1Text) . PHP_EOL . + Str\format(' ADDED: %s', $change2Text) . PHP_EOL, + $output->fetch(), + ); } } diff --git a/test/unit/Git/GetVersionCollectionFromGitRepositoryTest.php b/test/unit/Git/GetVersionCollectionFromGitRepositoryTest.php index 0fcc73d5..7ac04509 100644 --- a/test/unit/Git/GetVersionCollectionFromGitRepositoryTest.php +++ b/test/unit/Git/GetVersionCollectionFromGitRepositoryTest.php @@ -28,6 +28,8 @@ public function setUp(): void Shell\execute('git', ['init'], $tmpGitRepo); Shell\execute('git', ['config', 'user.email', 'me@example.com'], $tmpGitRepo); Shell\execute('git', ['config', 'user.name', 'Me Again'], $tmpGitRepo); + Shell\execute('git', ['config', 'commit.gpgSign', 'false'], $tmpGitRepo); + Shell\execute('git', ['config', 'tag.forceSignAnnotated', 'false'], $tmpGitRepo); File\write($tmpGitRepo . '/test', SecureRandom\string(8)); Shell\execute('git', ['add', '.'], $tmpGitRepo); Shell\execute('git', ['commit', '-m', '"whatever"'], $tmpGitRepo); diff --git a/test/unit/Git/GitCheckoutRevisionToTemporaryPathTest.php b/test/unit/Git/GitCheckoutRevisionToTemporaryPathTest.php index 3dc50269..7f431fc1 100644 --- a/test/unit/Git/GitCheckoutRevisionToTemporaryPathTest.php +++ b/test/unit/Git/GitCheckoutRevisionToTemporaryPathTest.php @@ -63,6 +63,8 @@ public function testCheckedOutRevisionIsAtExpectedRevisionState(): void Shell\execute('git', ['init'], $repoPath); Shell\execute('git', ['config', 'user.email', 'me@example.com'], $repoPath); Shell\execute('git', ['config', 'user.name', 'Mr Magoo'], $repoPath); + Shell\execute('git', ['config', 'commit.gpgSign', 'false'], $repoPath); + Shell\execute('git', ['config', 'tag.forceSignAnnotated', 'false'], $repoPath); Shell\execute('git', ['commit', '-m', 'initial commit', '--allow-empty'], $repoPath); $firstCommit = Revision::fromSha1( diff --git a/test/unit/Git/GitParseRevisionTest.php b/test/unit/Git/GitParseRevisionTest.php index 5e727205..e269683c 100644 --- a/test/unit/Git/GitParseRevisionTest.php +++ b/test/unit/Git/GitParseRevisionTest.php @@ -12,7 +12,7 @@ final class GitParseRevisionTest extends TestCase { /** @return string[][] */ - public function revisionProvider(): array + public static function revisionProvider(): array { return [ ['e72a47b', 'e72a47bb9d777c9e73c1322d58a83450d36d9454'], diff --git a/test/unit/Git/PickLastVersionFromCollectionTest.php b/test/unit/Git/PickLastVersionFromCollectionTest.php index 952b506c..82058600 100644 --- a/test/unit/Git/PickLastVersionFromCollectionTest.php +++ b/test/unit/Git/PickLastVersionFromCollectionTest.php @@ -20,7 +20,7 @@ final class PickLastVersionFromCollectionTest extends TestCase * @return array>> * @psalm-return array}> */ - public function lastStableVersionForCollectionProvider(): array + public static function lastStableVersionForCollectionProvider(): array { return [ ['2.2.0', ['1.1.0', '2.1.1', '2.2.0', '1.2.1']], diff --git a/test/unit/Git/RevisionTest.php b/test/unit/Git/RevisionTest.php index 68f2fe1a..decef019 100644 --- a/test/unit/Git/RevisionTest.php +++ b/test/unit/Git/RevisionTest.php @@ -33,7 +33,7 @@ public function testFromSha1WithNewlinesStillProvidesValidSha1(): void } /** @return string[][] */ - public function invalidRevisionProvider(): array + public static function invalidRevisionProvider(): array { return [ [''], diff --git a/test/unit/SourceLocator/LocatedSourceWithStrippedSourcesDirectoryTest.php b/test/unit/SourceLocator/LocatedSourceWithStrippedSourcesDirectoryTest.php index ed5c7ae0..e1a02615 100644 --- a/test/unit/SourceLocator/LocatedSourceWithStrippedSourcesDirectoryTest.php +++ b/test/unit/SourceLocator/LocatedSourceWithStrippedSourcesDirectoryTest.php @@ -35,9 +35,9 @@ public function testWillStripPrefixFilePathWhenLocatedSourceInConfiguredPath( ->getFileName(), ); } - + /** @return non-empty-list */ - public function verifiedPaths(): array + public static function verifiedPaths(): array { return [ ['/foo/bar.php', '/foo', '/bar.php'], @@ -46,7 +46,7 @@ public function verifiedPaths(): array ['/foo/bar.php', '', '/foo/bar.php'], ]; } - + public function testWillGetSourcesFromGivenLocatedSource(): void { self::assertSame( @@ -81,7 +81,7 @@ public function testWillReportInternalSourceFromGivenLocatedSource(): void $internalSource ->method('isInternal') ->willReturn(true); - + self::assertFalse( (new LocatedSourceWithStrippedSourcesDirectory( $nonInternalSource, @@ -99,11 +99,11 @@ public function testWillReportInternalSourceFromGivenLocatedSource(): void public function testWillGetExtensionNameFromGivenLocatedSource(): void { $extensionSource = $this->createMock(LocatedSource::class); - + $extensionSource ->method('getExtensionName') ->willReturn('the-extension'); - + self::assertSame( 'the-extension', (new LocatedSourceWithStrippedSourcesDirectory($extensionSource, '/some/source/directory')) @@ -168,16 +168,16 @@ public function testAllMethodsOfOriginalLocatedSourceAreOverridden(ReflectionMet 'Method is re-declared in the subclass', ); } - + /** @return array */ - public function methodsDeclaredByLocatedSource(): array + public static function methodsDeclaredByLocatedSource(): array { $methods = array_filter( (new ReflectionClass(LocatedSourceWithStrippedSourcesDirectory::class)) ->getMethods(), static fn (ReflectionMethod $method): bool => $method->isPublic() && ! $method->isStatic() ); - + return array_combine( array_map(static fn (ReflectionMethod $method): string => $method->getName(), $methods), array_map(static fn (ReflectionMethod $method): array => [$method], $methods), diff --git a/test/unit/SourceLocator/ReplaceSourcePathOfLocatedSourcesTest.php b/test/unit/SourceLocator/ReplaceSourcePathOfLocatedSourcesTest.php index 70abab98..532fbedb 100644 --- a/test/unit/SourceLocator/ReplaceSourcePathOfLocatedSourcesTest.php +++ b/test/unit/SourceLocator/ReplaceSourcePathOfLocatedSourcesTest.php @@ -30,7 +30,7 @@ public function testWillWrapFoundReflection(): void $reflector = $this->createMock(Reflector::class); $source = $this->createMock(LocatedSource::class); $identifier = new Identifier('find-me', new IdentifierType(IdentifierType::IDENTIFIER_CLASS)); - + $next->expects(self::once()) ->method('findReflection') ->with( @@ -39,7 +39,7 @@ public function testWillWrapFoundReflection(): void $identifier, ) ->willReturn($reflection); - + self::assertSame( $reflection, (new ReplaceSourcePathOfLocatedSources($next, '/foo')) @@ -88,7 +88,7 @@ public function testAllMethodsOfBaseClassAreOverridden(ReflectionMethod $method) } /** @return array */ - public function methodsDeclaredByReplaceSourcePathOfLocatedSources(): array + public static function methodsDeclaredByReplaceSourcePathOfLocatedSources(): array { $methods = array_filter( (new ReflectionClass(ReplaceSourcePathOfLocatedSources::class))