diff --git a/tools/.phpstan/composer.json b/tools/.phpstan/composer.json index bbb40c0cb..1ba7425c9 100644 --- a/tools/.phpstan/composer.json +++ b/tools/.phpstan/composer.json @@ -1,8 +1,8 @@ { "require-dev": { - "phpstan/phpstan": "^2.2.2", + "phpstan/phpstan": "^2.2.3", "phpstan/extension-installer": "^1.4.3", - "phpstan/phpstan-phpunit": "^2.0.16", + "phpstan/phpstan-phpunit": "^2.0.17", "phpstan/phpstan-strict-rules": "^2.0.11", "tomasvotruba/type-coverage": "^2.2.2", "ergebnis/phpstan-rules": "^2.13.1" diff --git a/tools/.phpstan/composer.lock b/tools/.phpstan/composer.lock index 51b5978d5..efa84798d 100644 --- a/tools/.phpstan/composer.lock +++ b/tools/.phpstan/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": "55202efead208ece4ee94dc6d340cfd6", + "content-hash": "3a631a402b78d0528255c91177fb0f1e", "packages": [], "packages-dev": [ { @@ -80,6 +80,57 @@ }, "time": "2026-01-27T17:13:06+00:00" }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, { "name": "phpstan/extension-installer", "version": "1.4.3", @@ -130,11 +181,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.2.2", + "version": "2.2.3", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5cc34d491a90e79c216d824f60fe21fd4d93bd6", - "reference": "e5cc34d491a90e79c216d824f60fe21fd4d93bd6", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4048833dd47b377287818841877fb3087289509c", + "reference": "4048833dd47b377287818841877fb3087289509c", "shasum": "" }, "require": { @@ -190,25 +241,26 @@ "type": "github" } ], - "time": "2026-06-05T09:00:01+00:00" + "time": "2026-06-30T21:15:26+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "2.0.16", + "version": "2.0.17", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "6ab598e1bc106e6827fd346ae4a12b4a5d634c32" + "reference": "c2f977551f0736d60467b3d754b2e0cf4e337b3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/6ab598e1bc106e6827fd346ae4a12b4a5d634c32", - "reference": "6ab598e1bc106e6827fd346ae4a12b4a5d634c32", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/c2f977551f0736d60467b3d754b2e0cf4e337b3f", + "reference": "c2f977551f0736d60467b3d754b2e0cf4e337b3f", "shasum": "" }, "require": { + "phar-io/version": "^3.2", "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.1.32" + "phpstan/phpstan": "^2.2.3" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -218,7 +270,8 @@ "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/phpstan-deprecation-rules": "^2.0", "phpstan/phpstan-strict-rules": "^2.0", - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^9.6", + "shipmonk/name-collision-detector": "^2.1" }, "type": "phpstan-extension", "extra": { @@ -244,9 +297,9 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.16" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.17" }, - "time": "2026-02-14T09:05:21+00:00" + "time": "2026-06-29T05:32:23+00:00" }, { "name": "phpstan/phpstan-strict-rules", diff --git a/tools/.phpstan/vendor/composer/installed.json b/tools/.phpstan/vendor/composer/installed.json index 2f262baf3..7d784989d 100644 --- a/tools/.phpstan/vendor/composer/installed.json +++ b/tools/.phpstan/vendor/composer/installed.json @@ -76,6 +76,60 @@ }, "install-path": "../ergebnis/phpstan-rules" }, + { + "name": "phar-io/version", + "version": "3.2.1", + "version_normalized": "3.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "time": "2022-02-21T01:04:05+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "install-path": "../phar-io/version" + }, { "name": "phpstan/extension-installer", "version": "1.4.3", @@ -129,12 +183,12 @@ }, { "name": "phpstan/phpstan", - "version": "2.2.2", - "version_normalized": "2.2.2.0", + "version": "2.2.3", + "version_normalized": "2.2.3.0", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5cc34d491a90e79c216d824f60fe21fd4d93bd6", - "reference": "e5cc34d491a90e79c216d824f60fe21fd4d93bd6", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4048833dd47b377287818841877fb3087289509c", + "reference": "4048833dd47b377287818841877fb3087289509c", "shasum": "" }, "require": { @@ -143,7 +197,7 @@ "conflict": { "phpstan/phpstan-shim": "*" }, - "time": "2026-06-05T09:00:01+00:00", + "time": "2026-06-30T21:15:26+00:00", "bin": [ "phpstan", "phpstan.phar" @@ -196,22 +250,23 @@ }, { "name": "phpstan/phpstan-phpunit", - "version": "2.0.16", - "version_normalized": "2.0.16.0", + "version": "2.0.17", + "version_normalized": "2.0.17.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "6ab598e1bc106e6827fd346ae4a12b4a5d634c32" + "reference": "c2f977551f0736d60467b3d754b2e0cf4e337b3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/6ab598e1bc106e6827fd346ae4a12b4a5d634c32", - "reference": "6ab598e1bc106e6827fd346ae4a12b4a5d634c32", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/c2f977551f0736d60467b3d754b2e0cf4e337b3f", + "reference": "c2f977551f0736d60467b3d754b2e0cf4e337b3f", "shasum": "" }, "require": { + "phar-io/version": "^3.2", "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.1.32" + "phpstan/phpstan": "^2.2.3" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -221,9 +276,10 @@ "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/phpstan-deprecation-rules": "^2.0", "phpstan/phpstan-strict-rules": "^2.0", - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^9.6", + "shipmonk/name-collision-detector": "^2.1" }, - "time": "2026-02-14T09:05:21+00:00", + "time": "2026-06-29T05:32:23+00:00", "type": "phpstan-extension", "extra": { "phpstan": { @@ -249,7 +305,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.16" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.17" }, "install-path": "../phpstan/phpstan-phpunit" }, @@ -380,6 +436,7 @@ "dev": true, "dev-package-names": [ "ergebnis/phpstan-rules", + "phar-io/version", "phpstan/extension-installer", "phpstan/phpstan", "phpstan/phpstan-phpunit", diff --git a/tools/.phpstan/vendor/composer/installed.php b/tools/.phpstan/vendor/composer/installed.php index 8152f7231..7d9bd3768 100644 --- a/tools/.phpstan/vendor/composer/installed.php +++ b/tools/.phpstan/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'ed4f43a9a69d6be9f92d50397044ccb862bd8133', + 'reference' => 'ef2221e08f8198f1d6413191574ee7ec77be32e8', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'ed4f43a9a69d6be9f92d50397044ccb862bd8133', + 'reference' => 'ef2221e08f8198f1d6413191574ee7ec77be32e8', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -28,6 +28,15 @@ 'aliases' => array(), 'dev_requirement' => true, ), + 'phar-io/version' => array( + 'pretty_version' => '3.2.1', + 'version' => '3.2.1.0', + 'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phar-io/version', + 'aliases' => array(), + 'dev_requirement' => true, + ), 'phpstan/extension-installer' => array( 'pretty_version' => '1.4.3', 'version' => '1.4.3.0', @@ -38,18 +47,18 @@ 'dev_requirement' => true, ), 'phpstan/phpstan' => array( - 'pretty_version' => '2.2.2', - 'version' => '2.2.2.0', - 'reference' => 'e5cc34d491a90e79c216d824f60fe21fd4d93bd6', + 'pretty_version' => '2.2.3', + 'version' => '2.2.3.0', + 'reference' => '4048833dd47b377287818841877fb3087289509c', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpstan', 'aliases' => array(), 'dev_requirement' => true, ), 'phpstan/phpstan-phpunit' => array( - 'pretty_version' => '2.0.16', - 'version' => '2.0.16.0', - 'reference' => '6ab598e1bc106e6827fd346ae4a12b4a5d634c32', + 'pretty_version' => '2.0.17', + 'version' => '2.0.17.0', + 'reference' => 'c2f977551f0736d60467b3d754b2e0cf4e337b3f', 'type' => 'phpstan-extension', 'install_path' => __DIR__ . '/../phpstan/phpstan-phpunit', 'aliases' => array(), diff --git a/tools/.phpstan/vendor/phar-io/version/CHANGELOG.md b/tools/.phpstan/vendor/phar-io/version/CHANGELOG.md new file mode 100644 index 000000000..4c0edfa70 --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/CHANGELOG.md @@ -0,0 +1,142 @@ +# Changelog + +All notable changes to phar-io/version are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [3.2.1] - 2022-02-21 + +### Fixed + +- Have ExactVersionConstraint honor build metadata (added in 3.2.0) + + +## [3.2.0] - 2022-02-21 + +### Added + +- Build metadata is now supported and considered for equality checks only + + +## [3.1.1] - 2022-02-07 + +### Fixed + +- [#28](https://github.com/phar-io/version/issues/28): `VersionConstraintParser` does not support logical OR represented by single pipe (|) (Thanks @llaville) + + +## [3.1.0] - 2021-02-23 + +### Changed + +- Internal Refactoring +- More scalar types + +### Added + +- [#24](https://github.com/phar-io/version/issues/24): `Version::getOriginalString()` added (Thanks @addshore) +- Version constraints using the caret operator (`^`) now honor pre-1.0 releases, e.g. `^0.3` translates to `0.3.*`) +- Various integration tests for version constraint processing + +### Fixed + +- [#23](https://github.com/phar-io/version/pull/23): Tilde operator without patch level + + + +## [3.0.4] - 14.12.2020 + +### Fixed + +- [#22](https://github.com/phar-io/version/pull/22): make dev suffix rank works for uppercase too + +## [3.0.3] - 30.11.2020 + +### Added + +- Comparator method `Version::equals()` added + + +## [3.0.2] - 27.06.2020 + +This release now supports PHP 7.2+ and PHP ^8.0. No other changes included. + + +## [3.0.1] - 09.05.2020 + +__Potential BC Break Notice:__ +`Version::getVersionString()` no longer returns `v` prefixes in case the "input" +string contained one. These are not part of the semver specs +(see https://semver.org/#is-v123-a-semantic-version) and get stripped out. +As of Version 3.1.0 `Version::getOriginalString()` can be used to still +retrieve it as given. + +### Changed + +- Internal Refactoring +- More scalar types + +### Fixed + +- Fixed Constraint processing Regression for ^1.2 and ~1.2 + + +## [3.0.0] - 05.05.2020 + +### Changed + +- Require PHP 7.2+ +- All code now uses strict mode +- Scalar types have been added as needed + +### Added + +- The technically invalid format using 'v' prefix ("v1.2.3") is now properly supported + + +## [2.0.1] - 08.07.2018 + +### Fixed + +- Versions without a pre-release suffix are now always considered greater +than versions with a pre-release suffix. Example: `3.0.0 > 3.0.0-alpha.1` + + +## [2.0.0] - 23.06.2018 + +Changes to public API: + +- `PreReleaseSuffix::construct()`: optional parameter `$number` removed +- `PreReleaseSuffix::isGreaterThan()`: introduced +- `Version::hasPreReleaseSuffix()`: introduced + +### Added + +- [#11](https://github.com/phar-io/version/issues/11): Added support for pre-release version suffixes. Supported values are: + - `dev` + - `beta` (also abbreviated form `b`) + - `rc` + - `alpha` (also abbreviated form `a`) + - `patch` (also abbreviated form `p`) + + All values can be followed by a number, e.g. `beta3`. + + When comparing versions, the pre-release suffix is taken into account. Example: +`1.5.0 > 1.5.0-beta1 > 1.5.0-alpha3 > 1.5.0-alpha2 > 1.5.0-dev11` + +### Changed + +- reorganized the source directories + +### Fixed + +- [#10](https://github.com/phar-io/version/issues/10): Version numbers containing +a numeric suffix as seen in Debian packages are now supported. + + +[3.1.0]: https://github.com/phar-io/version/compare/3.0.4...3.1.0 +[3.0.4]: https://github.com/phar-io/version/compare/3.0.3...3.0.4 +[3.0.3]: https://github.com/phar-io/version/compare/3.0.2...3.0.3 +[3.0.2]: https://github.com/phar-io/version/compare/3.0.1...3.0.2 +[3.0.1]: https://github.com/phar-io/version/compare/3.0.0...3.0.1 +[3.0.0]: https://github.com/phar-io/version/compare/2.0.1...3.0.0 +[2.0.1]: https://github.com/phar-io/version/compare/2.0.0...2.0.1 +[2.0.0]: https://github.com/phar-io/version/compare/1.0.1...2.0.0 diff --git a/tools/.phpstan/vendor/phar-io/version/LICENSE b/tools/.phpstan/vendor/phar-io/version/LICENSE new file mode 100644 index 000000000..ce32758a8 --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2016-2017 Arne Blankerts , Sebastian Heuer and contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + diff --git a/tools/.phpstan/vendor/phar-io/version/README.md b/tools/.phpstan/vendor/phar-io/version/README.md new file mode 100644 index 000000000..76e6e9857 --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/README.md @@ -0,0 +1,61 @@ +# Version + +Library for handling version information and constraints + +[![Build Status](https://travis-ci.org/phar-io/version.svg?branch=master)](https://travis-ci.org/phar-io/version) + +## Installation + +You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): + + composer require phar-io/version + +If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency: + + composer require --dev phar-io/version + +## Version constraints + +A Version constraint describes a range of versions or a discrete version number. The format of version numbers follows the schema of [semantic versioning](http://semver.org): `..`. A constraint might contain an operator that describes the range. + +Beside the typical mathematical operators like `<=`, `>=`, there are two special operators: + +*Caret operator*: `^1.0` +can be written as `>=1.0.0 <2.0.0` and read as »every Version within major version `1`«. + +*Tilde operator*: `~1.0.0` +can be written as `>=1.0.0 <1.1.0` and read as »every version within minor version `1.1`. The behavior of tilde operator depends on whether a patch level version is provided or not. If no patch level is provided, tilde operator behaves like the caret operator: `~1.0` is identical to `^1.0`. + +## Usage examples + +Parsing version constraints and check discrete versions for compliance: + +```php + +use PharIo\Version\Version; +use PharIo\Version\VersionConstraintParser; + +$parser = new VersionConstraintParser(); +$caret_constraint = $parser->parse( '^7.0' ); + +$caret_constraint->complies( new Version( '7.0.17' ) ); // true +$caret_constraint->complies( new Version( '7.1.0' ) ); // true +$caret_constraint->complies( new Version( '6.4.34' ) ); // false + +$tilde_constraint = $parser->parse( '~1.1.0' ); + +$tilde_constraint->complies( new Version( '1.1.4' ) ); // true +$tilde_constraint->complies( new Version( '1.2.0' ) ); // false +``` + +As of version 2.0.0, pre-release labels are supported and taken into account when comparing versions: + +```php + +$leftVersion = new PharIo\Version\Version('3.0.0-alpha.1'); +$rightVersion = new PharIo\Version\Version('3.0.0-alpha.2'); + +$leftVersion->isGreaterThan($rightVersion); // false +$rightVersion->isGreaterThan($leftVersion); // true + +``` diff --git a/tools/.phpstan/vendor/phar-io/version/composer.json b/tools/.phpstan/vendor/phar-io/version/composer.json new file mode 100644 index 000000000..22687dcd3 --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/composer.json @@ -0,0 +1,34 @@ +{ + "name": "phar-io/version", + "description": "Library for handling version information and constraints", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "support": { + "issues": "https://github.com/phar-io/version/issues" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "autoload": { + "classmap": [ + "src/" + ] + } +} + diff --git a/tools/.phpstan/vendor/phar-io/version/src/BuildMetaData.php b/tools/.phpstan/vendor/phar-io/version/src/BuildMetaData.php new file mode 100644 index 000000000..d42f0363f --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/BuildMetaData.php @@ -0,0 +1,28 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class BuildMetaData { + + /** @var string */ + private $value; + + public function __construct(string $value) { + $this->value = $value; + } + + public function asString(): string { + return $this->value; + } + + public function equals(BuildMetaData $other): bool { + return $this->asString() === $other->asString(); + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/PreReleaseSuffix.php b/tools/.phpstan/vendor/phar-io/version/src/PreReleaseSuffix.php new file mode 100644 index 000000000..00563008e --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/PreReleaseSuffix.php @@ -0,0 +1,82 @@ + 0, + 'a' => 1, + 'alpha' => 1, + 'b' => 2, + 'beta' => 2, + 'rc' => 3, + 'p' => 4, + 'pl' => 4, + 'patch' => 4, + ]; + + /** @var string */ + private $value; + + /** @var int */ + private $valueScore; + + /** @var int */ + private $number = 0; + + /** @var string */ + private $full; + + /** + * @throws InvalidPreReleaseSuffixException + */ + public function __construct(string $value) { + $this->parseValue($value); + } + + public function asString(): string { + return $this->full; + } + + public function getValue(): string { + return $this->value; + } + + public function getNumber(): ?int { + return $this->number; + } + + public function isGreaterThan(PreReleaseSuffix $suffix): bool { + if ($this->valueScore > $suffix->valueScore) { + return true; + } + + if ($this->valueScore < $suffix->valueScore) { + return false; + } + + return $this->getNumber() > $suffix->getNumber(); + } + + private function mapValueToScore(string $value): int { + $value = \strtolower($value); + + return self::valueScoreMap[$value]; + } + + private function parseValue(string $value): void { + $regex = '/-?((dev|beta|b|rc|alpha|a|patch|p|pl)\.?(\d*)).*$/i'; + + if (\preg_match($regex, $value, $matches) !== 1) { + throw new InvalidPreReleaseSuffixException(\sprintf('Invalid label %s', $value)); + } + + $this->full = $matches[1]; + $this->value = $matches[2]; + + if ($matches[3] !== '') { + $this->number = (int)$matches[3]; + } + + $this->valueScore = $this->mapValueToScore($matches[2]); + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/Version.php b/tools/.phpstan/vendor/phar-io/version/src/Version.php new file mode 100644 index 000000000..644af5ca8 --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/Version.php @@ -0,0 +1,208 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class Version { + /** @var string */ + private $originalVersionString; + + /** @var VersionNumber */ + private $major; + + /** @var VersionNumber */ + private $minor; + + /** @var VersionNumber */ + private $patch; + + /** @var null|PreReleaseSuffix */ + private $preReleaseSuffix; + + /** @var null|BuildMetaData */ + private $buildMetadata; + + public function __construct(string $versionString) { + $this->ensureVersionStringIsValid($versionString); + $this->originalVersionString = $versionString; + } + + /** + * @throws NoPreReleaseSuffixException + */ + public function getPreReleaseSuffix(): PreReleaseSuffix { + if ($this->preReleaseSuffix === null) { + throw new NoPreReleaseSuffixException('No pre-release suffix set'); + } + + return $this->preReleaseSuffix; + } + + public function getOriginalString(): string { + return $this->originalVersionString; + } + + public function getVersionString(): string { + $str = \sprintf( + '%d.%d.%d', + $this->getMajor()->getValue() ?? 0, + $this->getMinor()->getValue() ?? 0, + $this->getPatch()->getValue() ?? 0 + ); + + if (!$this->hasPreReleaseSuffix()) { + return $str; + } + + return $str . '-' . $this->getPreReleaseSuffix()->asString(); + } + + public function hasPreReleaseSuffix(): bool { + return $this->preReleaseSuffix !== null; + } + + public function equals(Version $other): bool { + if ($this->getVersionString() !== $other->getVersionString()) { + return false; + } + + if ($this->hasBuildMetaData() !== $other->hasBuildMetaData()) { + return false; + } + + if ($this->hasBuildMetaData() && $other->hasBuildMetaData() && + !$this->getBuildMetaData()->equals($other->getBuildMetaData())) { + return false; + } + + return true; + } + + public function isGreaterThan(Version $version): bool { + if ($version->getMajor()->getValue() > $this->getMajor()->getValue()) { + return false; + } + + if ($version->getMajor()->getValue() < $this->getMajor()->getValue()) { + return true; + } + + if ($version->getMinor()->getValue() > $this->getMinor()->getValue()) { + return false; + } + + if ($version->getMinor()->getValue() < $this->getMinor()->getValue()) { + return true; + } + + if ($version->getPatch()->getValue() > $this->getPatch()->getValue()) { + return false; + } + + if ($version->getPatch()->getValue() < $this->getPatch()->getValue()) { + return true; + } + + if (!$version->hasPreReleaseSuffix() && !$this->hasPreReleaseSuffix()) { + return false; + } + + if ($version->hasPreReleaseSuffix() && !$this->hasPreReleaseSuffix()) { + return true; + } + + if (!$version->hasPreReleaseSuffix() && $this->hasPreReleaseSuffix()) { + return false; + } + + return $this->getPreReleaseSuffix()->isGreaterThan($version->getPreReleaseSuffix()); + } + + public function getMajor(): VersionNumber { + return $this->major; + } + + public function getMinor(): VersionNumber { + return $this->minor; + } + + public function getPatch(): VersionNumber { + return $this->patch; + } + + /** + * @psalm-assert-if-true BuildMetaData $this->buildMetadata + * @psalm-assert-if-true BuildMetaData $this->getBuildMetaData() + */ + public function hasBuildMetaData(): bool { + return $this->buildMetadata !== null; + } + + /** + * @throws NoBuildMetaDataException + */ + public function getBuildMetaData(): BuildMetaData { + if (!$this->hasBuildMetaData()) { + throw new NoBuildMetaDataException('No build metadata set'); + } + + return $this->buildMetadata; + } + + /** + * @param string[] $matches + * + * @throws InvalidPreReleaseSuffixException + */ + private function parseVersion(array $matches): void { + $this->major = new VersionNumber((int)$matches['Major']); + $this->minor = new VersionNumber((int)$matches['Minor']); + $this->patch = isset($matches['Patch']) ? new VersionNumber((int)$matches['Patch']) : new VersionNumber(0); + + if (isset($matches['PreReleaseSuffix']) && $matches['PreReleaseSuffix'] !== '') { + $this->preReleaseSuffix = new PreReleaseSuffix($matches['PreReleaseSuffix']); + } + + if (isset($matches['BuildMetadata'])) { + $this->buildMetadata = new BuildMetaData($matches['BuildMetadata']); + } + } + + /** + * @param string $version + * + * @throws InvalidVersionException + */ + private function ensureVersionStringIsValid($version): void { + $regex = '/^v? + (?P0|[1-9]\d*) + \\. + (?P0|[1-9]\d*) + (\\. + (?P0|[1-9]\d*) + )? + (?: + - + (?(?:(dev|beta|b|rc|alpha|a|patch|p|pl)\.?\d*)) + )? + (?: + \\+ + (?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-@]+)*) + )? + $/xi'; + + if (\preg_match($regex, $version, $matches) !== 1) { + throw new InvalidVersionException( + \sprintf("Version string '%s' does not follow SemVer semantics", $version) + ); + } + + $this->parseVersion($matches); + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/VersionConstraintParser.php b/tools/.phpstan/vendor/phar-io/version/src/VersionConstraintParser.php new file mode 100644 index 000000000..03d6a0959 --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/VersionConstraintParser.php @@ -0,0 +1,115 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class VersionConstraintParser { + /** + * @throws UnsupportedVersionConstraintException + */ + public function parse(string $value): VersionConstraint { + if (\strpos($value, '|') !== false) { + return $this->handleOrGroup($value); + } + + if (!\preg_match('/^[\^~*]?v?[\d.*]+(?:-.*)?$/i', $value)) { + throw new UnsupportedVersionConstraintException( + \sprintf('Version constraint %s is not supported.', $value) + ); + } + + switch ($value[0]) { + case '~': + return $this->handleTildeOperator($value); + case '^': + return $this->handleCaretOperator($value); + } + + $constraint = new VersionConstraintValue($value); + + if ($constraint->getMajor()->isAny()) { + return new AnyVersionConstraint(); + } + + if ($constraint->getMinor()->isAny()) { + return new SpecificMajorVersionConstraint( + $constraint->getVersionString(), + $constraint->getMajor()->getValue() ?? 0 + ); + } + + if ($constraint->getPatch()->isAny()) { + return new SpecificMajorAndMinorVersionConstraint( + $constraint->getVersionString(), + $constraint->getMajor()->getValue() ?? 0, + $constraint->getMinor()->getValue() ?? 0 + ); + } + + return new ExactVersionConstraint($constraint->getVersionString()); + } + + private function handleOrGroup(string $value): OrVersionConstraintGroup { + $constraints = []; + + foreach (\preg_split('{\s*\|\|?\s*}', \trim($value)) as $groupSegment) { + $constraints[] = $this->parse(\trim($groupSegment)); + } + + return new OrVersionConstraintGroup($value, $constraints); + } + + private function handleTildeOperator(string $value): AndVersionConstraintGroup { + $constraintValue = new VersionConstraintValue(\substr($value, 1)); + + if ($constraintValue->getPatch()->isAny()) { + return $this->handleCaretOperator($value); + } + + $constraints = [ + new GreaterThanOrEqualToVersionConstraint( + $value, + new Version(\substr($value, 1)) + ), + new SpecificMajorAndMinorVersionConstraint( + $value, + $constraintValue->getMajor()->getValue() ?? 0, + $constraintValue->getMinor()->getValue() ?? 0 + ) + ]; + + return new AndVersionConstraintGroup($value, $constraints); + } + + private function handleCaretOperator(string $value): AndVersionConstraintGroup { + $constraintValue = new VersionConstraintValue(\substr($value, 1)); + + $constraints = [ + new GreaterThanOrEqualToVersionConstraint($value, new Version(\substr($value, 1))) + ]; + + if ($constraintValue->getMajor()->getValue() === 0) { + $constraints[] = new SpecificMajorAndMinorVersionConstraint( + $value, + $constraintValue->getMajor()->getValue() ?? 0, + $constraintValue->getMinor()->getValue() ?? 0 + ); + } else { + $constraints[] = new SpecificMajorVersionConstraint( + $value, + $constraintValue->getMajor()->getValue() ?? 0 + ); + } + + return new AndVersionConstraintGroup( + $value, + $constraints + ); + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/VersionConstraintValue.php b/tools/.phpstan/vendor/phar-io/version/src/VersionConstraintValue.php new file mode 100644 index 000000000..0762e7c0e --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/VersionConstraintValue.php @@ -0,0 +1,88 @@ +versionString = $versionString; + + $this->parseVersion($versionString); + } + + public function getLabel(): string { + return $this->label; + } + + public function getBuildMetaData(): string { + return $this->buildMetaData; + } + + public function getVersionString(): string { + return $this->versionString; + } + + public function getMajor(): VersionNumber { + return $this->major; + } + + public function getMinor(): VersionNumber { + return $this->minor; + } + + public function getPatch(): VersionNumber { + return $this->patch; + } + + private function parseVersion(string $versionString): void { + $this->extractBuildMetaData($versionString); + $this->extractLabel($versionString); + $this->stripPotentialVPrefix($versionString); + + $versionSegments = \explode('.', $versionString); + $this->major = new VersionNumber(\is_numeric($versionSegments[0]) ? (int)$versionSegments[0] : null); + + $minorValue = isset($versionSegments[1]) && \is_numeric($versionSegments[1]) ? (int)$versionSegments[1] : null; + $patchValue = isset($versionSegments[2]) && \is_numeric($versionSegments[2]) ? (int)$versionSegments[2] : null; + + $this->minor = new VersionNumber($minorValue); + $this->patch = new VersionNumber($patchValue); + } + + private function extractBuildMetaData(string &$versionString): void { + if (\preg_match('/\+(.*)/', $versionString, $matches) === 1) { + $this->buildMetaData = $matches[1]; + $versionString = \str_replace($matches[0], '', $versionString); + } + } + + private function extractLabel(string &$versionString): void { + if (\preg_match('/-(.*)/', $versionString, $matches) === 1) { + $this->label = $matches[1]; + $versionString = \str_replace($matches[0], '', $versionString); + } + } + + private function stripPotentialVPrefix(string &$versionString): void { + if ($versionString[0] !== 'v') { + return; + } + $versionString = \substr($versionString, 1); + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/VersionNumber.php b/tools/.phpstan/vendor/phar-io/version/src/VersionNumber.php new file mode 100644 index 000000000..4833a9b0f --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/VersionNumber.php @@ -0,0 +1,28 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class VersionNumber { + + /** @var ?int */ + private $value; + + public function __construct(?int $value) { + $this->value = $value; + } + + public function isAny(): bool { + return $this->value === null; + } + + public function getValue(): ?int { + return $this->value; + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php b/tools/.phpstan/vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php new file mode 100644 index 000000000..66201a140 --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/constraints/AbstractVersionConstraint.php @@ -0,0 +1,23 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +abstract class AbstractVersionConstraint implements VersionConstraint { + /** @var string */ + private $originalValue; + + public function __construct(string $originalValue) { + $this->originalValue = $originalValue; + } + + public function asString(): string { + return $this->originalValue; + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php b/tools/.phpstan/vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php new file mode 100644 index 000000000..5096f2fbb --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/constraints/AndVersionConstraintGroup.php @@ -0,0 +1,34 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class AndVersionConstraintGroup extends AbstractVersionConstraint { + /** @var VersionConstraint[] */ + private $constraints = []; + + /** + * @param VersionConstraint[] $constraints + */ + public function __construct(string $originalValue, array $constraints) { + parent::__construct($originalValue); + + $this->constraints = $constraints; + } + + public function complies(Version $version): bool { + foreach ($this->constraints as $constraint) { + if (!$constraint->complies($version)) { + return false; + } + } + + return true; + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/constraints/AnyVersionConstraint.php b/tools/.phpstan/vendor/phar-io/version/src/constraints/AnyVersionConstraint.php new file mode 100644 index 000000000..1499f071f --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/constraints/AnyVersionConstraint.php @@ -0,0 +1,20 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class AnyVersionConstraint implements VersionConstraint { + public function complies(Version $version): bool { + return true; + } + + public function asString(): string { + return '*'; + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/constraints/ExactVersionConstraint.php b/tools/.phpstan/vendor/phar-io/version/src/constraints/ExactVersionConstraint.php new file mode 100644 index 000000000..1d675c9c9 --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/constraints/ExactVersionConstraint.php @@ -0,0 +1,22 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class ExactVersionConstraint extends AbstractVersionConstraint { + public function complies(Version $version): bool { + $other = $version->getVersionString(); + + if ($version->hasBuildMetaData()) { + $other .= '+' . $version->getBuildMetaData()->asString(); + } + + return $this->asString() === $other; + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php b/tools/.phpstan/vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php new file mode 100644 index 000000000..ec3717231 --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/constraints/GreaterThanOrEqualToVersionConstraint.php @@ -0,0 +1,26 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class GreaterThanOrEqualToVersionConstraint extends AbstractVersionConstraint { + /** @var Version */ + private $minimalVersion; + + public function __construct(string $originalValue, Version $minimalVersion) { + parent::__construct($originalValue); + + $this->minimalVersion = $minimalVersion; + } + + public function complies(Version $version): bool { + return $version->getVersionString() === $this->minimalVersion->getVersionString() + || $version->isGreaterThan($this->minimalVersion); + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php b/tools/.phpstan/vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php new file mode 100644 index 000000000..59fd382f8 --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/constraints/OrVersionConstraintGroup.php @@ -0,0 +1,35 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class OrVersionConstraintGroup extends AbstractVersionConstraint { + /** @var VersionConstraint[] */ + private $constraints = []; + + /** + * @param string $originalValue + * @param VersionConstraint[] $constraints + */ + public function __construct($originalValue, array $constraints) { + parent::__construct($originalValue); + + $this->constraints = $constraints; + } + + public function complies(Version $version): bool { + foreach ($this->constraints as $constraint) { + if ($constraint->complies($version)) { + return true; + } + } + + return false; + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php b/tools/.phpstan/vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php new file mode 100644 index 000000000..302aa311c --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/constraints/SpecificMajorAndMinorVersionConstraint.php @@ -0,0 +1,33 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class SpecificMajorAndMinorVersionConstraint extends AbstractVersionConstraint { + /** @var int */ + private $major; + + /** @var int */ + private $minor; + + public function __construct(string $originalValue, int $major, int $minor) { + parent::__construct($originalValue); + + $this->major = $major; + $this->minor = $minor; + } + + public function complies(Version $version): bool { + if ($version->getMajor()->getValue() !== $this->major) { + return false; + } + + return $version->getMinor()->getValue() === $this->minor; + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php b/tools/.phpstan/vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php new file mode 100644 index 000000000..968b809c1 --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/constraints/SpecificMajorVersionConstraint.php @@ -0,0 +1,25 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +class SpecificMajorVersionConstraint extends AbstractVersionConstraint { + /** @var int */ + private $major; + + public function __construct(string $originalValue, int $major) { + parent::__construct($originalValue); + + $this->major = $major; + } + + public function complies(Version $version): bool { + return $version->getMajor()->getValue() === $this->major; + } +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/constraints/VersionConstraint.php b/tools/.phpstan/vendor/phar-io/version/src/constraints/VersionConstraint.php new file mode 100644 index 000000000..e94f9e00e --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/constraints/VersionConstraint.php @@ -0,0 +1,16 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +interface VersionConstraint { + public function complies(Version $version): bool; + + public function asString(): string; +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/exceptions/Exception.php b/tools/.phpstan/vendor/phar-io/version/src/exceptions/Exception.php new file mode 100644 index 000000000..3ea458f3d --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/exceptions/Exception.php @@ -0,0 +1,15 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +use Throwable; + +interface Exception extends Throwable { +} diff --git a/tools/.phpstan/vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php b/tools/.phpstan/vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php new file mode 100644 index 000000000..bc0b0c3e4 --- /dev/null +++ b/tools/.phpstan/vendor/phar-io/version/src/exceptions/InvalidPreReleaseSuffixException.php @@ -0,0 +1,5 @@ +, Sebastian Heuer , Sebastian Bergmann + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PharIo\Version; + +final class UnsupportedVersionConstraintException extends \RuntimeException implements Exception { +} diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/composer.json b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/composer.json index 08cd088a3..f65321fd0 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/composer.json +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/composer.json @@ -8,7 +8,8 @@ "keywords": ["static analysis"], "require": { "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.1.32" + "phar-io/version": "^3.2", + "phpstan/phpstan": "^2.2.3" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -18,7 +19,8 @@ "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/phpstan-deprecation-rules": "^2.0", "phpstan/phpstan-strict-rules": "^2.0", - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^9.6", + "shipmonk/name-collision-detector": "^2.1" }, "config": { "sort-packages": true diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/extension.neon b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/extension.neon index 665d85c33..ffa036556 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/extension.neon +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/extension.neon @@ -80,6 +80,12 @@ services: - class: PHPStan\Type\PHPUnit\DynamicCallToAssertionIgnoreExtension + - + class: PHPStan\Rules\PHPUnit\AttributeVersionRequirementHelper + arguments: + deprecationRulesInstalled: %deprecationRulesInstalled% + bleedingEdge: %featureToggles.bleedingEdge% + conditionalTags: PHPStan\PhpDoc\PHPUnit\MockObjectTypeNodeResolverExtension: phpstan.phpDoc.typeNodeResolverExtension: %phpunit.convertUnionToIntersectionType% diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/rules.neon b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/rules.neon index 7bff01616..9d2d94778 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/rules.neon +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/rules.neon @@ -16,6 +16,9 @@ conditionalTags: PHPStan\Rules\PHPUnit\DataProviderDataRule: phpstan.rules.rule: %featureToggles.bleedingEdge% + PHPStan\Rules\PHPUnit\ClassAttributeRequiresPhpVersionRule: + phpstan.rules.rule: %featureToggles.bleedingEdge% + services: - class: PHPStan\Rules\PHPUnit\DataProviderDeclarationRule @@ -27,11 +30,12 @@ services: - class: PHPStan\Rules\PHPUnit\AttributeRequiresPhpVersionRule - arguments: - deprecationRulesInstalled: %deprecationRulesInstalled% tags: - phpstan.rules.rule + - + class: PHPStan\Rules\PHPUnit\ClassAttributeRequiresPhpVersionRule + - class: PHPStan\Rules\PHPUnit\AssertEqualsIsDiscouragedRule diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AnnotationHelper.php b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AnnotationHelper.php index 21623caba..dc89bdb70 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AnnotationHelper.php +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AnnotationHelper.php @@ -5,7 +5,6 @@ use PhpParser\Comment\Doc; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\RuleErrorBuilder; -use function array_key_exists; use function in_array; use function preg_match; use function preg_split; @@ -43,14 +42,10 @@ public function processDocComment(Doc $docComment): array foreach ($docCommentLines as $docCommentLine) { // These annotations can't be retrieved using the getResolvedPhpDoc method on the FileTypeMapper as they are not present when they are invalid $annotation = preg_match('/(?@(?[a-zA-Z]+)(?\s*)(?.*))/', $docCommentLine, $matches); - if ($annotation === false) { + if ($annotation === false || $matches === []) { continue; // Line without annotation } - if (array_key_exists('property', $matches) === false || array_key_exists('whitespace', $matches) === false || array_key_exists('annotation', $matches) === false) { - continue; - } - if (!in_array($matches['property'], self::ANNOTATIONS_WITH_PARAMS, true) || $matches['whitespace'] !== '') { continue; } diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AttributeRequiresPhpVersionRule.php b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AttributeRequiresPhpVersionRule.php index 899ff1cb5..b5521f74a 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AttributeRequiresPhpVersionRule.php +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AttributeRequiresPhpVersionRule.php @@ -6,11 +6,8 @@ use PHPStan\Analyser\Scope; use PHPStan\Node\InClassMethodNode; use PHPStan\Rules\Rule; -use PHPStan\Rules\RuleErrorBuilder; use PHPUnit\Framework\TestCase; -use function count; -use function is_numeric; -use function sprintf; +use function array_merge; /** * @implements Rule @@ -18,24 +15,17 @@ class AttributeRequiresPhpVersionRule implements Rule { - private PHPUnitVersion $PHPUnitVersion; - private TestMethodsHelper $testMethodsHelper; - /** - * When phpstan-deprecation-rules is installed, it reports deprecated usages. - */ - private bool $deprecationRulesInstalled; + private AttributeVersionRequirementHelper $attributeVersionRequirementHelper; public function __construct( - PHPUnitVersion $PHPUnitVersion, TestMethodsHelper $testMethodsHelper, - bool $deprecationRulesInstalled + AttributeVersionRequirementHelper $attributeVersionRequirementHelper ) { - $this->PHPUnitVersion = $PHPUnitVersion; $this->testMethodsHelper = $testMethodsHelper; - $this->deprecationRulesInstalled = $deprecationRulesInstalled; + $this->attributeVersionRequirementHelper = $attributeVersionRequirementHelper; } public function getNodeType(): string @@ -55,39 +45,13 @@ public function processNode(Node $node, Scope $scope): array return []; } - $errors = []; - foreach ($reflectionMethod->getAttributesByName('PHPUnit\Framework\Attributes\RequiresPhp') as $attr) { - $args = $attr->getArguments(); - if (count($args) !== 1) { - continue; - } - - if ( - !is_numeric($args[0]) - ) { - continue; - } - - if ($this->PHPUnitVersion->requiresPhpversionAttributeWithOperator()->yes()) { - $errors[] = RuleErrorBuilder::message( - sprintf('Version requirement is missing operator.'), - ) - ->identifier('phpunit.attributeRequiresPhpVersion') - ->build(); - } elseif ( - $this->deprecationRulesInstalled - && $this->PHPUnitVersion->deprecatesPhpversionAttributeWithoutOperator()->yes() - ) { - $errors[] = RuleErrorBuilder::message( - sprintf('Version requirement without operator is deprecated.'), - ) - ->identifier('phpunit.attributeRequiresPhpVersion') - ->build(); - } - - } - - return $errors; + return $this->attributeVersionRequirementHelper->checkVersionRequirement( + array_merge( + $reflectionMethod->getAttributesByName('PHPUnit\Framework\Attributes\RequiresPhp'), + $reflectionMethod->getAttributesByName('PHPUnit\Framework\Attributes\RequiresPhpunit'), + ), + $scope, + ); } } diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AttributeVersionRequirementHelper.php b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AttributeVersionRequirementHelper.php new file mode 100644 index 000000000..966c2bf52 --- /dev/null +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AttributeVersionRequirementHelper.php @@ -0,0 +1,206 @@ +!=|<|<=|<>|=|==|>|>=)?\s*(?P[\d\.-]+(dev|(RC|alpha|beta)[\d\.])?)[ \t]*\r?$/m"; + + private PHPUnitVersion $PHPUnitVersion; + + private PhpVersion $fallbackPhpVersion; + + /** + * When phpstan-deprecation-rules is installed, rule reports deprecated usages. + */ + private bool $deprecationRulesInstalled; + + /** + * Whether warnings about incomplete versions are allowed to be emitted + */ + private bool $warnAboutIncompleteVersion; + + private bool $bleedingEdge; + + public function __construct( + PHPUnitVersion $PHPUnitVersion, + bool $deprecationRulesInstalled, + PhpVersion $phpVersion, + bool $bleedingEdge, + bool $warnAboutIncompleteVersion = true + ) + { + $this->PHPUnitVersion = $PHPUnitVersion; + $this->deprecationRulesInstalled = $deprecationRulesInstalled; + $this->fallbackPhpVersion = $phpVersion; + $this->warnAboutIncompleteVersion = $warnAboutIncompleteVersion; + $this->bleedingEdge = $bleedingEdge; + } + + /** + * @param array $attributes + * + * @return list + */ + public function checkVersionRequirement(array $attributes, Scope $scope): array + { + $phpstanPharIoVersions = $this->getAnalyzedPhpVersions($scope); + if ($phpstanPharIoVersions === []) { + return []; + } + + $errors = []; + $parser = new VersionConstraintParser(); + foreach ($attributes as $attr) { + $args = $attr->getArguments(); + if (count($args) !== 1) { + continue; + } + + // the following block is mimicing PHPUnit version parsing + // see https://github.com/sebastianbergmann/phpunit/blob/43c2cd7b96ee1e800b35e4df23b419a88b53111d/src/Metadata/Version/Requirement.php + + $versionRequirement = $args[0]; + + if ($this->warnAboutIncompleteVersion($versionRequirement)) { + $errors[] = RuleErrorBuilder::message( + sprintf('Version requirement is incomplete.'), + ) + ->identifier('phpunit.attributeRequiresPhpVersion') + ->build(); + } + + if ( + !is_numeric($versionRequirement) + ) { + if (!$this->bleedingEdge) { + continue; + } + + try { + // check composer like version constraints, e.g. ^1 or ~2 + $testPhpVersionConstraint = $parser->parse($versionRequirement); + + foreach ($phpstanPharIoVersions as $pharIoVersion) { + if ($testPhpVersionConstraint->complies($pharIoVersion)) { + // one of the versions within range matched, check next attribute + continue 2; + } + } + } catch (UnsupportedVersionConstraintException $e) { + // test php-src builtin operators as in version_compare() + if (preg_match(self::VERSION_COMPARISON, $versionRequirement, $matches) <= 0) { + $errors[] = RuleErrorBuilder::message( + sprintf($e->getMessage()), + ) + ->identifier('phpunit.attributeRequiresPhpVersion') + ->build(); + + continue; + } + + $operator = $matches['operator'] !== '' ? $matches['operator'] : '>='; + + foreach ($phpstanPharIoVersions as $pharIoVersion) { + if (version_compare($pharIoVersion->getVersionString(), $matches['version'], $operator)) { + // one of the versions within range matched, check next attribute + continue 2; + } + } + } + + $errors[] = RuleErrorBuilder::message( + sprintf('Version requirement will always evaluate to false.'), + ) + ->identifier('phpunit.attributeRequiresPhpVersion') + ->build(); + + continue; + } + + if ($this->PHPUnitVersion->requiresPhpversionAttributeWithOperator()->yes()) { + $errors[] = RuleErrorBuilder::message( + sprintf('Version requirement is missing operator.'), + ) + ->identifier('phpunit.attributeRequiresPhpVersion') + ->build(); + } elseif ( + $this->deprecationRulesInstalled + && $this->PHPUnitVersion->deprecatesPhpversionAttributeWithoutOperator()->yes() + ) { + $errors[] = RuleErrorBuilder::message( + sprintf('Version requirement without operator is deprecated.'), + ) + ->identifier('phpunit.attributeRequiresPhpVersion') + ->build(); + } + } + return $errors; + } + + /** + * @return Version[] + */ + private function getAnalyzedPhpVersions(Scope $scope): array + { + $scopePhpVersion = $scope->getPhpVersion()->getType(); + if ($scopePhpVersion instanceof ConstantIntegerType) { + $v = new PhpVersion($scopePhpVersion->getValue()); + return [new Version($v->getVersionString())]; + } elseif ($scopePhpVersion instanceof IntegerRangeType) { + if ($scopePhpVersion->getMin() === null || $scopePhpVersion->getMax() === null) { + return []; + } + + $versions = []; + $minorVersionIterator = new PhpMinorVersionIterator( + new PhpVersion($scopePhpVersion->getMin()), + new PhpVersion($scopePhpVersion->getMax()), + ); + foreach ($minorVersionIterator as $phpstanVersion) { + $versions[] = new Version($phpstanVersion->getVersionString()); + } + return $versions; + } + + return [new Version($this->fallbackPhpVersion->getVersionString())]; + } + + // see https://github.com/sebastianbergmann/phpunit/issues/6451 + private function warnAboutIncompleteVersion(string $versionRequirement): bool + { + if (!$this->bleedingEdge) { + return false; + } + + if (!$this->warnAboutIncompleteVersion) { + return false; + } + + if (!$this->PHPUnitVersion->warnsAboutIncompleteVersion()->yes()) { + return false; + } + + return substr_count($versionRequirement, '.') !== 2; + } + +} diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/ClassAttributeRequiresPhpVersionRule.php b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/ClassAttributeRequiresPhpVersionRule.php new file mode 100644 index 000000000..a9e68ff36 --- /dev/null +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/ClassAttributeRequiresPhpVersionRule.php @@ -0,0 +1,48 @@ + + */ +class ClassAttributeRequiresPhpVersionRule implements Rule +{ + + private AttributeVersionRequirementHelper $attributeVersionRequirementHelper; + + public function __construct( + AttributeVersionRequirementHelper $attributeVersionRequirementHelper + ) + { + $this->attributeVersionRequirementHelper = $attributeVersionRequirementHelper; + } + + public function getNodeType(): string + { + return InClassNode::class; + } + + public function processNode(Node $node, Scope $scope): array + { + $classReflection = $scope->getClassReflection(); + if ($classReflection === null || $classReflection->is(TestCase::class) === false) { + return []; + } + + return $this->attributeVersionRequirementHelper->checkVersionRequirement( + array_merge( + $classReflection->getNativeReflection()->getBetterReflection()->getAttributesByName('PHPUnit\Framework\Attributes\RequiresPhp'), + $classReflection->getNativeReflection()->getBetterReflection()->getAttributesByName('PHPUnit\Framework\Attributes\RequiresPhpunit'), + ), + $scope, + ); + } + +} diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/PHPUnitVersion.php b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/PHPUnitVersion.php index 56eb75584..f614585be 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/PHPUnitVersion.php +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/PHPUnitVersion.php @@ -62,6 +62,11 @@ public function deprecatesPhpversionAttributeWithoutOperator(): TrinaryLogic return $this->minVersion(12, 4); } + public function warnsAboutIncompleteVersion(): TrinaryLogic + { + return $this->minVersion(12, 5); + } + private function minVersion(int $major, int $minor): TrinaryLogic { if ($this->majorVersion === null || $this->minorVersion === null) { diff --git a/tools/.phpstan/vendor/phpstan/phpstan/README.md b/tools/.phpstan/vendor/phpstan/phpstan/README.md index 443d1d13d..1db09e43d 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan/README.md +++ b/tools/.phpstan/vendor/phpstan/phpstan/README.md @@ -71,15 +71,13 @@ Want your logo here? [Learn more »](https://phpstan.org/sponsor)
Route4Me: Route Optimizer and Route Planner Software     -Craft CMS +Crisp.nl
TicketSwap     campoint AG
-Crisp.nl -
-Netrouting +TestMu AI [**You can sponsor my open-source work on PHPStan through GitHub Sponsors and also directly.**](https://phpstan.org/sponsor) diff --git a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar index 9eb85e618..44e01c0e8 100755 Binary files a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar and b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar differ diff --git a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar.asc b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar.asc index e711243da..d2ecefe89 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar.asc +++ b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar.asc @@ -1,16 +1,16 @@ -----BEGIN PGP SIGNATURE----- -iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmoij9cACgkQUcZzBf/C -5cAuDhAAmcmz0qZXr2R6v5mNAA8i4W5Kltw2qK4hhf5bC/Dt81VpZ27vIihB0NJF -4Al38dVs0FIJ9iA5gXpSCf3br3wGbhUagcwdGnh8nY6+9lvym4NSSybTBg/mOzEe -hOItK/9DgU9gKW+KCoLYXFomRV7htmTIjeXtsmLcXyEODxJ22fEsIJYwO+YBiJtR -0vnJvbZDnvDE/fLzF8gKs8V45Ru2dvl2UM8P+55DCijmBe/Tt1vDpK0JDWOiVFoG -CUgjV5hzSXbcYy+m0/QJyS75SqQgCYxRjOr4K+IM5vNKJvrB8WiX+ezLNeTPiYlL -hmSXm5kZovK5j4vdprC61EwmxfrmhA4KSDEokl3iBAAHO8ToT5ABClQhS/9c6v+c -WEHrzzbnTYtSzsbHjidlgYcif4BIAWaOSaPjl/vlp1b1etf6LHX712PzgYhhaEG+ -7zUWR2sIOaJXuw1DMQSbjEzf7biFWo3FBWVmCRR2zKEhQ7HUgOuS0V7kftvGg8zw -nP5Nq9reEjHLYCGhr58KMOPtAyPIrUmVVeunGPVn1hSBpJHoSAv1LMdTyI+nu+by -F7H1IL0M6PM+lxEgMMl35t8hEB+zHkHK0bHZPb2c5LSSk5ZA04QEVp+W+mDBj+HC -FDxy/oIVxNkYV9dEcIU+jMCKANPXKszNzI2wbXv2vHDL9P3O0Sc= -=c6Og +iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmpEMbUACgkQUcZzBf/C +5cAivw//XOvI0f0iIE2/D50nhinupN1bbLw9DiUkyALtkz/1RXbXTTxgPnL7kd9G +2cQzaeoTM9i0Erk1HCrjXOdVjTY0dLzmTbYDbdu43224Ey4nb9GTeWOJelRCI69X +9YzATmhiCIcs+V9I+rEFqZPD3M/YF5q4kkctAPbgNXbKY3jhYP9VKnbPg+LqEPJC +MU3n0GRs2Iu0KWNIQq3KhzqIj9wia0J7uYyY22YebC6DVqjfmoQBi0Yzn4Am7gdP +pTnzb6NbpY0jccuOJi2m7ZR8pKuitNTlZYxHy1IA5z/uDtDIFk4V5A2VOCn3HUBK +WbzLdjWcMhL7UJBkOBtXQ+9rhAUkCVIH8cF1FwUeUaAep+83XVK1IYeewtgpygXp +XJ0mzGR90akaHJ7hvalgtvbPXrR0Mvrmfvmo7iCOE1qiEYD8ksdRsAipQ7vl9zBo +Km1EtscILSc1WA8eol9U4g9wbtXxKZ40g+9DqC2HhI/FaxNXSQ0vCCfAtVL6QMJH +7ElOD6rBEMkPDXa9j/9MQWuN+jm5SIDD3DwV1RB8vpqCmOb+Q9NJFMe9wgeJIwfB +2QQnsvHyoR3OjEeTwGJszMdr3nVBqgD9ooHEsvCR1PKmOEct0epAmM0JwtOxpibB +tV8ZaNbQTqqcy9gQMUbynpsBv/G+D13vJ3L1wJLD4oYy+4vxhwY= +=58nz -----END PGP SIGNATURE-----