diff --git a/tools/.phpstan/composer.json b/tools/.phpstan/composer.json index febbff80a..a533798cf 100644 --- a/tools/.phpstan/composer.json +++ b/tools/.phpstan/composer.json @@ -1,8 +1,8 @@ { "require-dev": { - "phpstan/phpstan": "^2.2.15", + "phpstan/phpstan": "^2.2.16", "phpstan/extension-installer": "^1.4.3", - "phpstan/phpstan-phpunit": "^2.0.18", + "phpstan/phpstan-phpunit": "^2.0.19", "phpstan/phpstan-strict-rules": "^2.0.12", "ergebnis/phpstan-rules": "^2.14.0" }, diff --git a/tools/.phpstan/composer.lock b/tools/.phpstan/composer.lock index c52ba1e98..6f2891368 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": "cf3655cdbe27af1ab4f297792c4fbe16", + "content-hash": "cece32ec44a0a372ec2d559e9ee059e6", "packages": [], "packages-dev": [ { @@ -186,11 +186,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.2.15", + "version": "2.2.16", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b158556ffd26825cf615a1c1f72fb5157a2301b7", - "reference": "b158556ffd26825cf615a1c1f72fb5157a2301b7", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46a6d9060e5a7763adfcc21ebcb8b504ebdbcb92", + "reference": "46a6d9060e5a7763adfcc21ebcb8b504ebdbcb92", "shasum": "" }, "require": { @@ -246,26 +246,26 @@ "type": "github" } ], - "time": "2026-09-23T12:23:07+00:00" + "time": "2026-09-25T09:31:51+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "2.0.18", + "version": "2.0.19", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "f5dc20ff8082d02339b60cab68ec3eb0d859fb30" + "reference": "33a190a5e8e69fd18308443a80d4f43f42d43604" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/f5dc20ff8082d02339b60cab68ec3eb0d859fb30", - "reference": "f5dc20ff8082d02339b60cab68ec3eb0d859fb30", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/33a190a5e8e69fd18308443a80d4f43f42d43604", + "reference": "33a190a5e8e69fd18308443a80d4f43f42d43604", "shasum": "" }, "require": { "phar-io/version": "^3.2", "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.2.3" + "phpstan/phpstan": "^2.2.6" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -302,9 +302,9 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.18" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.19" }, - "time": "2026-07-04T12:16:09+00:00" + "time": "2026-09-26T17:07:06+00:00" }, { "name": "phpstan/phpstan-strict-rules", diff --git a/tools/.phpstan/vendor/composer/installed.json b/tools/.phpstan/vendor/composer/installed.json index 81118ebf4..5d8dc8bd4 100644 --- a/tools/.phpstan/vendor/composer/installed.json +++ b/tools/.phpstan/vendor/composer/installed.json @@ -188,12 +188,12 @@ }, { "name": "phpstan/phpstan", - "version": "2.2.15", - "version_normalized": "2.2.15.0", + "version": "2.2.16", + "version_normalized": "2.2.16.0", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b158556ffd26825cf615a1c1f72fb5157a2301b7", - "reference": "b158556ffd26825cf615a1c1f72fb5157a2301b7", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46a6d9060e5a7763adfcc21ebcb8b504ebdbcb92", + "reference": "46a6d9060e5a7763adfcc21ebcb8b504ebdbcb92", "shasum": "" }, "require": { @@ -202,7 +202,7 @@ "conflict": { "phpstan/phpstan-shim": "*" }, - "time": "2026-09-23T12:23:07+00:00", + "time": "2026-09-25T09:31:51+00:00", "bin": [ "phpstan", "phpstan.phar" @@ -255,23 +255,23 @@ }, { "name": "phpstan/phpstan-phpunit", - "version": "2.0.18", - "version_normalized": "2.0.18.0", + "version": "2.0.19", + "version_normalized": "2.0.19.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "f5dc20ff8082d02339b60cab68ec3eb0d859fb30" + "reference": "33a190a5e8e69fd18308443a80d4f43f42d43604" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/f5dc20ff8082d02339b60cab68ec3eb0d859fb30", - "reference": "f5dc20ff8082d02339b60cab68ec3eb0d859fb30", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/33a190a5e8e69fd18308443a80d4f43f42d43604", + "reference": "33a190a5e8e69fd18308443a80d4f43f42d43604", "shasum": "" }, "require": { "phar-io/version": "^3.2", "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.2.3" + "phpstan/phpstan": "^2.2.6" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -284,7 +284,7 @@ "phpunit/phpunit": "^9.6", "shipmonk/name-collision-detector": "^2.1" }, - "time": "2026-07-04T12:16:09+00:00", + "time": "2026-09-26T17:07:06+00:00", "type": "phpstan-extension", "extra": { "phpstan": { @@ -310,7 +310,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.18" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.19" }, "install-path": "../phpstan/phpstan-phpunit" }, diff --git a/tools/.phpstan/vendor/composer/installed.php b/tools/.phpstan/vendor/composer/installed.php index 5764fdf59..ea35898df 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' => '28f0b49879941c81f68ff69cc747fd37b54e07f3', + 'reference' => '9b94a0328227df891482a39d7588e15a18e660cd', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '28f0b49879941c81f68ff69cc747fd37b54e07f3', + 'reference' => '9b94a0328227df891482a39d7588e15a18e660cd', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -47,18 +47,18 @@ 'dev_requirement' => true, ), 'phpstan/phpstan' => array( - 'pretty_version' => '2.2.15', - 'version' => '2.2.15.0', - 'reference' => 'b158556ffd26825cf615a1c1f72fb5157a2301b7', + 'pretty_version' => '2.2.16', + 'version' => '2.2.16.0', + 'reference' => '46a6d9060e5a7763adfcc21ebcb8b504ebdbcb92', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpstan', 'aliases' => array(), 'dev_requirement' => true, ), 'phpstan/phpstan-phpunit' => array( - 'pretty_version' => '2.0.18', - 'version' => '2.0.18.0', - 'reference' => 'f5dc20ff8082d02339b60cab68ec3eb0d859fb30', + 'pretty_version' => '2.0.19', + 'version' => '2.0.19.0', + 'reference' => '33a190a5e8e69fd18308443a80d4f43f42d43604', 'type' => 'phpstan-extension', 'install_path' => __DIR__ . '/../phpstan/phpstan-phpunit', 'aliases' => array(), diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/composer.json b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/composer.json index f65321fd0..53028f0b5 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/composer.json +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/composer.json @@ -9,7 +9,7 @@ "require": { "php": "^7.4 || ^8.0", "phar-io/version": "^3.2", - "phpstan/phpstan": "^2.2.3" + "phpstan/phpstan": "^2.2.6" }, "conflict": { "phpunit/phpunit": "<7.0" diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/e2e/composer-version/.gitignore b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/e2e/composer-version/.gitignore new file mode 100644 index 000000000..8b7ef3503 --- /dev/null +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/e2e/composer-version/.gitignore @@ -0,0 +1,2 @@ +/vendor +composer.lock diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/e2e/composer-version/composer.json b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/e2e/composer-version/composer.json new file mode 100644 index 000000000..dcf27099e --- /dev/null +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/e2e/composer-version/composer.json @@ -0,0 +1,20 @@ +{ + "require": { + "php": "^8.1", + "phpstan/phpstan": "@dev", + "phpstan/phpstan-phpunit": "@dev", + "phpunit/phpunit": "^12.5", + "phpstan/extension-installer": "^1.4" + }, + "repositories": [ + { + "type": "path", + "url": "../../" + } + ], + "config": { + "allow-plugins": { + "phpstan/extension-installer": true + } + } +} diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/e2e/composer-version/phpstan.neon b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/e2e/composer-version/phpstan.neon new file mode 100644 index 000000000..16fee384f --- /dev/null +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/e2e/composer-version/phpstan.neon @@ -0,0 +1,5 @@ +includes: + - phar://phpstan.phar/conf/bleedingEdge.neon + +parameters: + level: 5 diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/e2e/composer-version/test.php b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/e2e/composer-version/test.php new file mode 100644 index 000000000..2ae0d3b6e --- /dev/null +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/e2e/composer-version/test.php @@ -0,0 +1,34 @@ + true, ]; + // TypeNodeResolver resolves the union again when this returns null, so resolving every + // member here would resolve each nested union twice per level. Look at the direct + // identifier members first: they cannot nest, and a mock class in a union is written as one. + $hasMockClass = false; + foreach ($typeNode->types as $innerTypeNode) { + if (!$innerTypeNode instanceof IdentifierTypeNode) { + continue; + } + + $classNames = $this->typeNodeResolver->resolve($innerTypeNode, $nameScope)->getObjectClassNames(); + if (count($classNames) === 1 && array_key_exists($classNames[0], $mockClassNames)) { + $hasMockClass = true; + break; + } + } + + if (!$hasMockClass) { + return null; + } + $types = $this->typeNodeResolver->resolveMultiple($typeNode->types, $nameScope); foreach ($types as $type) { $classNames = $type->getObjectClassNames(); diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AssertSameBooleanExpectedRule.php b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AssertSameBooleanExpectedRule.php index f185bdf7d..890787930 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AssertSameBooleanExpectedRule.php +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AssertSameBooleanExpectedRule.php @@ -5,6 +5,7 @@ use PhpParser\Node; use PhpParser\Node\Expr\CallLike; use PhpParser\Node\Expr\ConstFetch; +use PhpParser\NodeAbstract; use PHPStan\Analyser\Scope; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; @@ -77,8 +78,9 @@ public function processNode(Node $node, Scope $scope): array } /** - * @param array $args - * @return list + * @template T of NodeAbstract + * @param array $args + * @return list */ private static function rewriteArgs(array $args): array { diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AssertSameNullExpectedRule.php b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AssertSameNullExpectedRule.php index f6032efb8..2d5fda418 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AssertSameNullExpectedRule.php +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AssertSameNullExpectedRule.php @@ -5,6 +5,7 @@ use PhpParser\Node; use PhpParser\Node\Expr\CallLike; use PhpParser\Node\Expr\ConstFetch; +use PhpParser\NodeAbstract; use PHPStan\Analyser\Scope; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; @@ -63,8 +64,9 @@ public function processNode(Node $node, Scope $scope): array } /** - * @param array $args - * @return list + * @template T of NodeAbstract + * @param array $args + * @return list */ private static function rewriteArgs(array $args): array { 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 index 382493fb9..fc29d481a 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AttributeVersionRequirementHelper.php +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AttributeVersionRequirementHelper.php @@ -7,12 +7,11 @@ use PharIo\Version\VersionConstraintParser; use PHPStan\Analyser\Scope; use PHPStan\BetterReflection\Reflection\ReflectionAttribute; +use PHPStan\Php\ConfiguredPhpVersionRangeHelper; use PHPStan\Php\PhpMinorVersionIterator; -use PHPStan\Php\PhpVersion; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\RuleErrorBuilder; -use PHPStan\Type\Constant\ConstantIntegerType; -use PHPStan\Type\IntegerRangeType; +use PHPStan\ShouldNotHappenException; use function count; use function is_numeric; use function preg_match; @@ -28,8 +27,6 @@ final class AttributeVersionRequirementHelper private PHPUnitVersion $PHPUnitVersion; - private PhpVersion $fallbackPhpVersion; - /** * When phpstan-deprecation-rules is installed, rule reports deprecated usages. */ @@ -42,9 +39,11 @@ final class AttributeVersionRequirementHelper private bool $bleedingEdge; + private ConfiguredPhpVersionRangeHelper $phpVersionRangeHelper; + public function __construct( PHPUnitVersion $PHPUnitVersion, - PhpVersion $phpVersion, + ConfiguredPhpVersionRangeHelper $phpVersionRangeHelper, bool $deprecationRulesInstalled = false, bool $bleedingEdge = false, bool $warnAboutIncompleteVersion = true @@ -52,9 +51,9 @@ public function __construct( { $this->PHPUnitVersion = $PHPUnitVersion; $this->deprecationRulesInstalled = $deprecationRulesInstalled; - $this->fallbackPhpVersion = $phpVersion; $this->warnAboutIncompleteVersion = $warnAboutIncompleteVersion; $this->bleedingEdge = $bleedingEdge; + $this->phpVersionRangeHelper = $phpVersionRangeHelper; } /** @@ -64,11 +63,6 @@ public function __construct( */ public function checkVersionRequirement(array $attributes, Scope $scope): array { - $phpstanPharIoVersions = $this->getAnalyzedPhpVersions($scope); - if ($phpstanPharIoVersions === []) { - return []; - } - $errors = []; $parser = new VersionConstraintParser(); foreach ($attributes as $attr) { @@ -84,7 +78,7 @@ public function checkVersionRequirement(array $attributes, Scope $scope): array if ($this->warnAboutIncompleteVersion($versionRequirement)) { $errors[] = RuleErrorBuilder::message( - sprintf('Version requirement is incomplete.'), + sprintf('Version requirement %s is incomplete. Expect a version composed of major, minor and patch.', $versionRequirement), ) ->identifier('phpunit.attributeRequiresPhpVersion') ->build(); @@ -99,7 +93,7 @@ public function checkVersionRequirement(array $attributes, Scope $scope): array $pharIoVersions = strpos($attr->getName(), 'RequiresPhpunit') !== false ? $this->PHPUnitVersion->getPharIoVersions() - : $phpstanPharIoVersions; + : $this->getAnalyzedPhpVersions(); if ($pharIoVersions === []) { continue; } @@ -136,9 +130,25 @@ public function checkVersionRequirement(array $attributes, Scope $scope): array } } + if (count($pharIoVersions) < 2) { + throw new ShouldNotHappenException(); + } + + if (strpos($attr->getName(), 'RequiresPhpunit') !== false) { + $tip = 'PHPUnit version inferred from composer.json requirements.'; + } else { + $tip = 'PHP version for analysis inferred from NEON config phpVersion or composer.json requirements. Invoke PHPStan with -vvv to get more details.'; + } + $errors[] = RuleErrorBuilder::message( - sprintf('Version requirement will always evaluate to false.'), + sprintf( + 'Version requirement %s does not match %s...%s.', + $versionRequirement, + $pharIoVersions[0]->getVersionString(), + $pharIoVersions[count($pharIoVersions) - 1]->getVersionString(), + ), ) + ->tip($tip) ->identifier('phpunit.attributeRequiresPhpVersion') ->build(); @@ -147,7 +157,7 @@ public function checkVersionRequirement(array $attributes, Scope $scope): array if ($this->PHPUnitVersion->requiresPhpversionAttributeWithOperator()->yes()) { $errors[] = RuleErrorBuilder::message( - sprintf('Version requirement is missing operator.'), + sprintf('Version requirement %s is missing operator.', $versionRequirement), ) ->identifier('phpunit.attributeRequiresPhpVersion') ->build(); @@ -156,7 +166,7 @@ public function checkVersionRequirement(array $attributes, Scope $scope): array && $this->PHPUnitVersion->deprecatesPhpversionAttributeWithoutOperator()->yes() ) { $errors[] = RuleErrorBuilder::message( - sprintf('Version requirement without operator is deprecated.'), + sprintf('Version requirement %s without operator is deprecated.', $versionRequirement), ) ->identifier('phpunit.attributeRequiresPhpVersion') ->build(); @@ -166,23 +176,17 @@ public function checkVersionRequirement(array $attributes, Scope $scope): array } /** - * @return Version[] + * @return list */ - private function getAnalyzedPhpVersions(Scope $scope): array + private function getAnalyzedPhpVersions(): 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 []; - } - + // @phpstan-ignore phpstanApi.method + [$minVersion, $maxVersion] = $this->phpVersionRangeHelper->getVersionRange(); + if ($minVersion !== null && $maxVersion !== null) { $versions = []; $minorVersionIterator = new PhpMinorVersionIterator( - new PhpVersion($scopePhpVersion->getMin()), - new PhpVersion($scopePhpVersion->getMax()), + $minVersion, + $maxVersion, ); foreach ($minorVersionIterator as $phpstanVersion) { $versions[] = new Version($phpstanVersion->getVersionString()); @@ -190,7 +194,7 @@ private function getAnalyzedPhpVersions(Scope $scope): array return $versions; } - return [new Version($this->fallbackPhpVersion->getVersionString())]; + return []; } // see https://github.com/sebastianbergmann/phpunit/issues/6451 diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderDataRule.php b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderDataRule.php index ac800f57d..8df5d8b94 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderDataRule.php +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/DataProviderDataRule.php @@ -4,6 +4,7 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; +use PHPStan\BetterReflection\Reflection\ReflectionMethod; use PHPStan\Node\Expr\TypeExpr; use PHPStan\Rules\Rule; use PHPStan\Type\ObjectType; @@ -63,19 +64,19 @@ public function processNode(Node $node, Scope $scope): array return []; } - $testsWithProvider = []; + $testWithProviderMethods = []; $method = $scope->getFunction(); $testMethods = $this->testMethodsHelper->getTestMethods($classReflection, $scope); foreach ($testMethods as $testMethod) { foreach ($this->dataProviderHelper->getDataProviderMethods($scope, $testMethod, $classReflection) as [, $providerMethodName]) { if ($providerMethodName === $method->getName()) { - $testsWithProvider[] = $testMethod; + $testWithProviderMethods[] = $testMethod; continue 2; } } } - if (count($testsWithProvider) === 0) { + if (count($testWithProviderMethods) === 0) { return []; } @@ -84,25 +85,10 @@ public function processNode(Node $node, Scope $scope): array return []; } - $maxNumberOfParameters = null; - foreach ($testsWithProvider as $testMethod) { - $num = $testMethod->getNumberOfParameters(); - if ($testMethod->isVariadic()) { - $num = PHP_INT_MAX; - } - if ($maxNumberOfParameters === null) { - $maxNumberOfParameters = $num; - continue; - } + $maxNumberOfParameters = $this->getMaxNumberOfParameters($testWithProviderMethods); - $maxNumberOfParameters = max($maxNumberOfParameters, $num); - if ($num === PHP_INT_MAX) { - break; - } - } - - foreach ($testsWithProvider as $testMethod) { - $numberOfParameters = $testMethod->getNumberOfParameters(); + foreach ($testWithProviderMethods as $testWithProviderMethod) { + $numberOfParameters = $testWithProviderMethod->getNumberOfParameters(); foreach ($arraysTypes as [$startLine, $arraysType]) { $args = $this->arrayItemsToArgs($arraysType, $numberOfParameters); @@ -111,7 +97,7 @@ public function processNode(Node $node, Scope $scope): array } if ( - !$testMethod->isVariadic() + !$testWithProviderMethod->isVariadic() && $numberOfParameters !== $maxNumberOfParameters ) { $args = array_slice($args, 0, $numberOfParameters); @@ -119,7 +105,7 @@ public function processNode(Node $node, Scope $scope): array $scope->invokeNodeCallback(new Node\Expr\MethodCall( new TypeExpr(new ObjectType($classReflection->getName())), - $testMethod->getName(), + $testWithProviderMethod->getName(), $args, ['startLine' => $startLine], )); @@ -129,6 +115,28 @@ public function processNode(Node $node, Scope $scope): array return []; } + /** + * @param non-empty-array $testMethods + */ + private function getMaxNumberOfParameters(array $testMethods): int + { + $maxNumberOfParameters = null; + foreach ($testMethods as $testMethod) { + $num = $testMethod->getNumberOfParameters(); + if ($testMethod->isVariadic()) { + return PHP_INT_MAX; + } + if ($maxNumberOfParameters === null) { + $maxNumberOfParameters = $num; + continue; + } + + $maxNumberOfParameters = max($maxNumberOfParameters, $num); + } + + return $maxNumberOfParameters; + } + /** * @return array */ diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/TestMethodsHelper.php b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/TestMethodsHelper.php index f1efc97f1..e07abb5d2 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/TestMethodsHelper.php +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/TestMethodsHelper.php @@ -10,7 +10,7 @@ use PHPStan\Type\FileTypeMapper; use PHPUnit\Framework\TestCase; use function array_key_exists; -use function str_starts_with; +use function strpos; use function strtolower; final class TestMethodsHelper @@ -62,7 +62,7 @@ public function getTestMethods(ClassReflection $classReflection, Scope $scope): continue; } - if (str_starts_with(strtolower($reflectionMethod->getName()), 'test')) { + if (strpos(strtolower($reflectionMethod->getName()), 'test') === 0) { $testMethods[] = $reflectionMethod; continue; } diff --git a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Type/PHPUnit/DynamicCallToAssertionIgnoreExtension.php b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Type/PHPUnit/DynamicCallToAssertionIgnoreExtension.php index ccf5b0f47..35a0e9839 100644 --- a/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Type/PHPUnit/DynamicCallToAssertionIgnoreExtension.php +++ b/tools/.phpstan/vendor/phpstan/phpstan-phpunit/src/Type/PHPUnit/DynamicCallToAssertionIgnoreExtension.php @@ -8,7 +8,7 @@ use PHPStan\Analyser\Scope; use PHPUnit\Framework\TestCase; use function is_string; -use function str_starts_with; +use function strpos; final class DynamicCallToAssertionIgnoreExtension implements IgnoreErrorExtension { @@ -33,7 +33,7 @@ public function shouldIgnore(Error $error, Node $node, Scope $scope): bool if ( !$node->name instanceof Node\Identifier - || !str_starts_with($node->name->name, 'assert') + || strpos($node->name->name, 'assert') !== 0 ) { return false; } diff --git a/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar b/tools/.phpstan/vendor/phpstan/phpstan/phpstan.phar index f8be8aa78..73e26a771 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 00c4f661c..c5981564a 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/C5cAFAmqzxDgACgkQUcZzBf/C -5cAYehAAjW4JS0HQffBOUcahcVShdLNkvGmkJBOWyBku3VZNRahC6cakfkXPR5G4 -rO7/BrwA7G5urXc711LQ22Vv/92xS/tHmfNhNE0qZfVPIS+GU6yNAc+ZtDlTSy4v -T+c7O9BcRZwuix/GohsKwJmCkknqZt01qnTCkJBdaClT1oDo0YxTLXZpfXynKz4H -faa6FE2Ol9EW4hAUBaxiR50qpl5SMBwlthKpWvu6oMpg5Er3GDNYrBq7U8Jd89Go -oisojGWjfuXD6I/Hz5czGVr71CK9q9zrQ/LDoKpfX4uugubA9CHFqUSkFdzaHWzj -Id+W2jXdsYVy1HkrwoIW1cTGpXjd7rhq1FxjPzYWdMdOn8VX40Ly1VYzpqnoqcCH -cGx5nEzEN7Mt6TWorqY1zQRxNFLnIa+H0RaycsS2EeeKJBJoGx16IjMP+L19/0lL -0D2/KJ7awUA77UbuWPyJAx0hJj2p4GBOvkuGtpSSr1DiqCKPCBqIRASBm0a99OpV -cI+TTLoIz0LBYlskZjv0fgc3H65eudZFuOPBOTyRZcqm5vG8705BzNi+mOCXc7vg -K0cAzSF4g41NH2rj4BrYoeSZplDdO4NYZdz8XzPkNNd0uNtiwBI1ErptpXXgMejh -CjmmKjK42c87laBIU+CzpExNRP+nMD6OlXAe940izoJzln9CS6I= -=TGRc +iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmq2PxAACgkQUcZzBf/C +5cAOpBAAi9s4F2YeS+IEpjiZU9KwUYfJGf34NV6fyDLiJXQiYCVc7K+GSvKRkBF8 +gNr7WGJZLGNmdntdSWID71om2cvQnNMgvuzzNQaVO6rw6j/5n5iLfx+ardzpzo1r +jSlCcw/ZfnwGbTIzYFbA2X1y7zL8q9ZUOkYm0FchlLQmoXAmTkQnBCvdC/HOYuLp +A/yK99dgBCUtczTLX0qjHf8BY1oNIrBvF7ifRR6TDiuqAoMIPZcYCYnA9zpLafmj +6yZkG5cNyHLHljIbyLnr/Qpyn+MNX5m4dRw39vfsEc8QSpUb5xvpHzNDmiBV/sqi +Z6h7ovKkAuZvspPcwW9galACz/K2y+jq+5GvyKDY+7ANClJcL8V0ZF5UrVDsVZ54 +HpXEH6RKoLs13VLU6jtymtqbWhf059YaTZ07yCP7Obbj2KQFUmfh5G/xeKaBw49K +boaBEHXSNSgjSAmnvfMOqI3hgFCeeltdfnangMwpIhEFlWIGMHk29y9/spao1CQ2 +jSwT66pbcL2oxyH9vgvWjLLEtwyk3beWNU/5Pox1aFaqSRYAuA97jZQJomYMOXeL +B26erR2WOQXkTsfKxIrDljEtYnvNOMkmAAyPQ0IEdk2WlUIo6f8R2sr/zeduz2KH +UPbYYdAHx6Gsy92A3TNQWD8dv3BLJkdcJpTeCCGY4LsBZy5aAms= +=e4My -----END PGP SIGNATURE-----