From 5c2b5cfb1b3e9a4c5fcb0004b1801abbfdd90b3e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 31 May 2024 17:02:44 +0000 Subject: [PATCH] Bump symplify/phpstan-rules from 12.6.4 to 12.7.0 (#717) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Markus Staab --- composer.json | 2 +- composer.lock | 14 +- vendor/composer/autoload_classmap.php | 3 - vendor/composer/autoload_static.php | 3 - vendor/composer/installed.json | 42 ++--- vendor/composer/installed.php | 22 +-- .../src/Symfony/XmlServiceMapFactory.php | 9 +- ...eGetArgumentDynamicReturnTypeExtension.php | 11 ++ vendor/staabm/phpstan-todo-by/README.md | 13 +- .../ticket/GitHubTicketStatusFetcher.php | 14 +- .../phpstan-rules/config/naming-rules.neon | 1 - .../phpstan-rules/config/static-rules.neon | 3 - .../ForbiddenSameNamedNewInstanceRule.php | 135 ---------------- .../src/Rules/NoEmptyClassRule.php | 144 ----------------- .../src/Rules/NoVoidGetterMethodRule.php | 147 ------------------ 15 files changed, 77 insertions(+), 486 deletions(-) delete mode 100644 vendor/symplify/phpstan-rules/src/Rules/Complexity/ForbiddenSameNamedNewInstanceRule.php delete mode 100644 vendor/symplify/phpstan-rules/src/Rules/NoEmptyClassRule.php delete mode 100644 vendor/symplify/phpstan-rules/src/Rules/NoVoidGetterMethodRule.php diff --git a/composer.json b/composer.json index 552d8cf1f..27680215c 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "staabm/phpstan-baseline-analysis": "0.12.5", "staabm/phpstan-dba": "0.2.80", "staabm/phpstan-todo-by": "0.1.27", - "symplify/phpstan-rules": "12.6.4", + "symplify/phpstan-rules": "12.7.0", "thecodingmachine/phpstan-safe-rule": "1.2", "thecodingmachine/safe": "1.3.3", "tomasvotruba/cognitive-complexity": "0.2.3", diff --git a/composer.lock b/composer.lock index 0eb969150..b3c6c8517 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": "a8bd37409fc07a4453cd8c628f1cc3b2", + "content-hash": "94f6956fd83dc4ae34f53f11e1ad9a43", "packages": [ { "name": "beberlei/assert", @@ -1329,16 +1329,16 @@ }, { "name": "symplify/phpstan-rules", - "version": "12.6.4", + "version": "12.7.0", "source": { "type": "git", "url": "https://github.com/symplify/phpstan-rules.git", - "reference": "8485673fb551c27fdb443d0d34e95ba4d0b3afbe" + "reference": "14f506143ae7d6548da88326331cc536686e224f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symplify/phpstan-rules/zipball/8485673fb551c27fdb443d0d34e95ba4d0b3afbe", - "reference": "8485673fb551c27fdb443d0d34e95ba4d0b3afbe", + "url": "https://api.github.com/repos/symplify/phpstan-rules/zipball/14f506143ae7d6548da88326331cc536686e224f", + "reference": "14f506143ae7d6548da88326331cc536686e224f", "shasum": "" }, "require": { @@ -1367,7 +1367,7 @@ "description": "Set of Symplify rules for PHPStan", "support": { "issues": "https://github.com/symplify/phpstan-rules/issues", - "source": "https://github.com/symplify/phpstan-rules/tree/12.6.4" + "source": "https://github.com/symplify/phpstan-rules/tree/12.7.0" }, "funding": [ { @@ -1379,7 +1379,7 @@ "type": "github" } ], - "time": "2024-05-21T09:44:11+00:00" + "time": "2024-05-25T15:32:40+00:00" }, { "name": "thecodingmachine/phpstan-safe-rule", diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index a229f0d30..819d76bae 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -1601,7 +1601,6 @@ 'Symplify\\PHPStanRules\\Rules\\CheckTypehintCallerTypeRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/CheckTypehintCallerTypeRule.php', 'Symplify\\PHPStanRules\\Rules\\ClassNameRespectsParentSuffixRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/ClassNameRespectsParentSuffixRule.php', 'Symplify\\PHPStanRules\\Rules\\Complexity\\ForbiddenArrayMethodCallRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/Complexity/ForbiddenArrayMethodCallRule.php', - 'Symplify\\PHPStanRules\\Rules\\Complexity\\ForbiddenSameNamedNewInstanceRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/Complexity/ForbiddenSameNamedNewInstanceRule.php', 'Symplify\\PHPStanRules\\Rules\\Domain\\RequireAttributeNamespaceRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/Domain/RequireAttributeNamespaceRule.php', 'Symplify\\PHPStanRules\\Rules\\Domain\\RequireExceptionNamespaceRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/Domain/RequireExceptionNamespaceRule.php', 'Symplify\\PHPStanRules\\Rules\\Enum\\RequireUniqueEnumConstantRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/Enum/RequireUniqueEnumConstantRule.php', @@ -1619,7 +1618,6 @@ 'Symplify\\PHPStanRules\\Rules\\NoArrayAccessOnObjectRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/NoArrayAccessOnObjectRule.php', 'Symplify\\PHPStanRules\\Rules\\NoDuplicatedShortClassNameRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/NoDuplicatedShortClassNameRule.php', 'Symplify\\PHPStanRules\\Rules\\NoDynamicNameRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/NoDynamicNameRule.php', - 'Symplify\\PHPStanRules\\Rules\\NoEmptyClassRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/NoEmptyClassRule.php', 'Symplify\\PHPStanRules\\Rules\\NoInlineStringRegexRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/NoInlineStringRegexRule.php', 'Symplify\\PHPStanRules\\Rules\\NoIssetOnObjectRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/NoIssetOnObjectRule.php', 'Symplify\\PHPStanRules\\Rules\\NoMissingDirPathRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/NoMissingDirPathRule.php', @@ -1627,7 +1625,6 @@ 'Symplify\\PHPStanRules\\Rules\\NoReferenceRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/NoReferenceRule.php', 'Symplify\\PHPStanRules\\Rules\\NoReturnArrayVariableListRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/NoReturnArrayVariableListRule.php', 'Symplify\\PHPStanRules\\Rules\\NoReturnSetterMethodRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/NoReturnSetterMethodRule.php', - 'Symplify\\PHPStanRules\\Rules\\NoVoidGetterMethodRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/NoVoidGetterMethodRule.php', 'Symplify\\PHPStanRules\\Rules\\PHPUnit\\NoTestMocksRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/PHPUnit/NoTestMocksRule.php', 'Symplify\\PHPStanRules\\Rules\\PreferredClassRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/PreferredClassRule.php', 'Symplify\\PHPStanRules\\Rules\\PreventParentMethodVisibilityOverrideRule' => $vendorDir . '/symplify/phpstan-rules/src/Rules/PreventParentMethodVisibilityOverrideRule.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index d76f59005..faa72607d 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -1815,7 +1815,6 @@ class ComposerStaticInit9cf8af24a7a084f114b4553be2a1ff9f 'Symplify\\PHPStanRules\\Rules\\CheckTypehintCallerTypeRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/CheckTypehintCallerTypeRule.php', 'Symplify\\PHPStanRules\\Rules\\ClassNameRespectsParentSuffixRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/ClassNameRespectsParentSuffixRule.php', 'Symplify\\PHPStanRules\\Rules\\Complexity\\ForbiddenArrayMethodCallRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/Complexity/ForbiddenArrayMethodCallRule.php', - 'Symplify\\PHPStanRules\\Rules\\Complexity\\ForbiddenSameNamedNewInstanceRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/Complexity/ForbiddenSameNamedNewInstanceRule.php', 'Symplify\\PHPStanRules\\Rules\\Domain\\RequireAttributeNamespaceRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/Domain/RequireAttributeNamespaceRule.php', 'Symplify\\PHPStanRules\\Rules\\Domain\\RequireExceptionNamespaceRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/Domain/RequireExceptionNamespaceRule.php', 'Symplify\\PHPStanRules\\Rules\\Enum\\RequireUniqueEnumConstantRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/Enum/RequireUniqueEnumConstantRule.php', @@ -1833,7 +1832,6 @@ class ComposerStaticInit9cf8af24a7a084f114b4553be2a1ff9f 'Symplify\\PHPStanRules\\Rules\\NoArrayAccessOnObjectRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/NoArrayAccessOnObjectRule.php', 'Symplify\\PHPStanRules\\Rules\\NoDuplicatedShortClassNameRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/NoDuplicatedShortClassNameRule.php', 'Symplify\\PHPStanRules\\Rules\\NoDynamicNameRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/NoDynamicNameRule.php', - 'Symplify\\PHPStanRules\\Rules\\NoEmptyClassRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/NoEmptyClassRule.php', 'Symplify\\PHPStanRules\\Rules\\NoInlineStringRegexRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/NoInlineStringRegexRule.php', 'Symplify\\PHPStanRules\\Rules\\NoIssetOnObjectRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/NoIssetOnObjectRule.php', 'Symplify\\PHPStanRules\\Rules\\NoMissingDirPathRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/NoMissingDirPathRule.php', @@ -1841,7 +1839,6 @@ class ComposerStaticInit9cf8af24a7a084f114b4553be2a1ff9f 'Symplify\\PHPStanRules\\Rules\\NoReferenceRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/NoReferenceRule.php', 'Symplify\\PHPStanRules\\Rules\\NoReturnArrayVariableListRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/NoReturnArrayVariableListRule.php', 'Symplify\\PHPStanRules\\Rules\\NoReturnSetterMethodRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/NoReturnSetterMethodRule.php', - 'Symplify\\PHPStanRules\\Rules\\NoVoidGetterMethodRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/NoVoidGetterMethodRule.php', 'Symplify\\PHPStanRules\\Rules\\PHPUnit\\NoTestMocksRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/PHPUnit/NoTestMocksRule.php', 'Symplify\\PHPStanRules\\Rules\\PreferredClassRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/PreferredClassRule.php', 'Symplify\\PHPStanRules\\Rules\\PreventParentMethodVisibilityOverrideRule' => __DIR__ . '/..' . '/symplify/phpstan-rules/src/Rules/PreventParentMethodVisibilityOverrideRule.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 6ab0d7c23..22857942a 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -887,17 +887,17 @@ }, { "name": "phpstan/phpstan-symfony", - "version": "1.4.1", - "version_normalized": "1.4.1.0", + "version": "1.4.3", + "version_normalized": "1.4.3.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-symfony.git", - "reference": "d530cfebba55763732bc2421f79d2576d9d7942f" + "reference": "af6ae0f4b91bc080265e80776af26da3e5befb28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/d530cfebba55763732bc2421f79d2576d9d7942f", - "reference": "d530cfebba55763732bc2421f79d2576d9d7942f", + "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/af6ae0f4b91bc080265e80776af26da3e5befb28", + "reference": "af6ae0f4b91bc080265e80776af26da3e5befb28", "shasum": "" }, "require": { @@ -926,7 +926,7 @@ "symfony/serializer": "^5.4", "symfony/service-contracts": "^2.2.0" }, - "time": "2024-05-24T14:00:29+00:00", + "time": "2024-05-30T15:01:27+00:00", "type": "phpstan-extension", "extra": { "phpstan": { @@ -956,7 +956,7 @@ "description": "Symfony Framework extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-symfony/issues", - "source": "https://github.com/phpstan/phpstan-symfony/tree/1.4.1" + "source": "https://github.com/phpstan/phpstan-symfony/tree/1.4.3" }, "install-path": "../phpstan/phpstan-symfony" }, @@ -1231,17 +1231,17 @@ }, { "name": "staabm/phpstan-todo-by", - "version": "0.1.26", - "version_normalized": "0.1.26.0", + "version": "0.1.27", + "version_normalized": "0.1.27.0", "source": { "type": "git", "url": "https://github.com/staabm/phpstan-todo-by.git", - "reference": "0a9f996582fbec5816bc4f0f3e11c4aa94a5fd6c" + "reference": "aef25bd71ce63de28acb1c82289cb5bff172fcff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/staabm/phpstan-todo-by/zipball/0a9f996582fbec5816bc4f0f3e11c4aa94a5fd6c", - "reference": "0a9f996582fbec5816bc4f0f3e11c4aa94a5fd6c", + "url": "https://api.github.com/repos/staabm/phpstan-todo-by/zipball/aef25bd71ce63de28acb1c82289cb5bff172fcff", + "reference": "aef25bd71ce63de28acb1c82289cb5bff172fcff", "shasum": "" }, "require": { @@ -1259,7 +1259,7 @@ "phpunit/phpunit": "^9 || ^10.5", "redaxo/php-cs-fixer-config": "^1.0" }, - "time": "2024-05-24T15:09:38+00:00", + "time": "2024-05-24T17:49:10+00:00", "type": "phpstan-extension", "extra": { "phpstan": { @@ -1288,7 +1288,7 @@ ], "support": { "issues": "https://github.com/staabm/phpstan-todo-by/issues", - "source": "https://github.com/staabm/phpstan-todo-by/tree/0.1.26" + "source": "https://github.com/staabm/phpstan-todo-by/tree/0.1.27" }, "funding": [ { @@ -1383,17 +1383,17 @@ }, { "name": "symplify/phpstan-rules", - "version": "12.6.4", - "version_normalized": "12.6.4.0", + "version": "12.7.0", + "version_normalized": "12.7.0.0", "source": { "type": "git", "url": "https://github.com/symplify/phpstan-rules.git", - "reference": "8485673fb551c27fdb443d0d34e95ba4d0b3afbe" + "reference": "14f506143ae7d6548da88326331cc536686e224f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symplify/phpstan-rules/zipball/8485673fb551c27fdb443d0d34e95ba4d0b3afbe", - "reference": "8485673fb551c27fdb443d0d34e95ba4d0b3afbe", + "url": "https://api.github.com/repos/symplify/phpstan-rules/zipball/14f506143ae7d6548da88326331cc536686e224f", + "reference": "14f506143ae7d6548da88326331cc536686e224f", "shasum": "" }, "require": { @@ -1402,7 +1402,7 @@ "phpstan/phpstan": "^1.10.30", "webmozart/assert": "^1.11" }, - "time": "2024-05-21T09:44:11+00:00", + "time": "2024-05-25T15:32:40+00:00", "type": "phpstan-extension", "extra": { "phpstan": { @@ -1424,7 +1424,7 @@ "description": "Set of Symplify rules for PHPStan", "support": { "issues": "https://github.com/symplify/phpstan-rules/issues", - "source": "https://github.com/symplify/phpstan-rules/tree/12.6.4" + "source": "https://github.com/symplify/phpstan-rules/tree/12.7.0" }, "funding": [ { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 07682ae79..c3c9f3a06 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'd23723d8def1ad4473333a37569bbf4a3f0443d1', + 'reference' => '0ec3c35bb548592a2fbb99172a6d5d42a0aa80e5', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'd23723d8def1ad4473333a37569bbf4a3f0443d1', + 'reference' => '0ec3c35bb548592a2fbb99172a6d5d42a0aa80e5', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -149,9 +149,9 @@ 'dev_requirement' => false, ), 'phpstan/phpstan-symfony' => array( - 'pretty_version' => '1.4.1', - 'version' => '1.4.1.0', - 'reference' => 'd530cfebba55763732bc2421f79d2576d9d7942f', + 'pretty_version' => '1.4.3', + 'version' => '1.4.3.0', + 'reference' => 'af6ae0f4b91bc080265e80776af26da3e5befb28', 'type' => 'phpstan-extension', 'install_path' => __DIR__ . '/../phpstan/phpstan-symfony', 'aliases' => array(), @@ -194,9 +194,9 @@ 'dev_requirement' => false, ), 'staabm/phpstan-todo-by' => array( - 'pretty_version' => '0.1.26', - 'version' => '0.1.26.0', - 'reference' => '0a9f996582fbec5816bc4f0f3e11c4aa94a5fd6c', + 'pretty_version' => '0.1.27', + 'version' => '0.1.27.0', + 'reference' => 'aef25bd71ce63de28acb1c82289cb5bff172fcff', 'type' => 'phpstan-extension', 'install_path' => __DIR__ . '/../staabm/phpstan-todo-by', 'aliases' => array(), @@ -212,9 +212,9 @@ 'dev_requirement' => false, ), 'symplify/phpstan-rules' => array( - 'pretty_version' => '12.6.4', - 'version' => '12.6.4.0', - 'reference' => '8485673fb551c27fdb443d0d34e95ba4d0b3afbe', + 'pretty_version' => '12.7.0', + 'version' => '12.7.0.0', + 'reference' => '14f506143ae7d6548da88326331cc536686e224f', 'type' => 'phpstan-extension', 'install_path' => __DIR__ . '/../symplify/phpstan-rules', 'aliases' => array(), diff --git a/vendor/phpstan/phpstan-symfony/src/Symfony/XmlServiceMapFactory.php b/vendor/phpstan/phpstan-symfony/src/Symfony/XmlServiceMapFactory.php index ad52c373d..1cae5d97e 100644 --- a/vendor/phpstan/phpstan-symfony/src/Symfony/XmlServiceMapFactory.php +++ b/vendor/phpstan/phpstan-symfony/src/Symfony/XmlServiceMapFactory.php @@ -48,11 +48,11 @@ public function create(): ServiceMap } $service = new Service( - strpos((string) $attrs->id, '.') === 0 ? substr((string) $attrs->id, 1) : (string) $attrs->id, + $this->cleanServiceId((string) $attrs->id), isset($attrs->class) ? (string) $attrs->class : null, isset($attrs->public) && (string) $attrs->public === 'true', isset($attrs->synthetic) && (string) $attrs->synthetic === 'true', - isset($attrs->alias) ? (string) $attrs->alias : null + isset($attrs->alias) ? $this->cleanServiceId((string) $attrs->alias) : null ); if ($service->getAlias() !== null) { @@ -79,4 +79,9 @@ public function create(): ServiceMap return new DefaultServiceMap($services); } + private function cleanServiceId(string $id): string + { + return strpos($id, '.') === 0 ? substr($id, 1) : $id; + } + } diff --git a/vendor/phpstan/phpstan-symfony/src/Type/Symfony/InputInterfaceGetArgumentDynamicReturnTypeExtension.php b/vendor/phpstan/phpstan-symfony/src/Type/Symfony/InputInterfaceGetArgumentDynamicReturnTypeExtension.php index 0af7c88d1..a8d3eb37e 100644 --- a/vendor/phpstan/phpstan-symfony/src/Type/Symfony/InputInterfaceGetArgumentDynamicReturnTypeExtension.php +++ b/vendor/phpstan/phpstan-symfony/src/Type/Symfony/InputInterfaceGetArgumentDynamicReturnTypeExtension.php @@ -10,11 +10,13 @@ use PHPStan\Type\ArrayType; use PHPStan\Type\DynamicMethodReturnTypeExtension; use PHPStan\Type\IntegerType; +use PHPStan\Type\NullType; use PHPStan\Type\StringType; use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; use PHPStan\Type\TypeUtils; use function count; +use function in_array; final class InputInterfaceGetArgumentDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension { @@ -76,6 +78,15 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method } } + $method = $scope->getFunction(); + if ( + $method instanceof MethodReflection + && $method->getName() === 'interact' + && in_array('Symfony\Component\Console\Command\Command', $method->getDeclaringClass()->getParentClassesNames(), true) + ) { + $argTypes[] = new NullType(); + } + return count($argTypes) > 0 ? TypeCombinator::union(...$argTypes) : null; } diff --git a/vendor/staabm/phpstan-todo-by/README.md b/vendor/staabm/phpstan-todo-by/README.md index b010dd3b7..d13d6f3d2 100644 --- a/vendor/staabm/phpstan-todo-by/README.md +++ b/vendor/staabm/phpstan-todo-by/README.md @@ -1,6 +1,6 @@ # phpstan-todo-by: comments with expiration -PHPStan extension to check for TODO/FIXME/XXX comments with expiration. +PHPStan extension to check for `TODO/FIXME/XXX` comments with expiration. Inspired by [parker-codes/todo-by](https://github.com/parker-codes/todo_by). @@ -14,6 +14,9 @@ The main idea is, that comments within the source code will be turned into PHPSt // TODO: 2023-12-14 This comment turns into a PHPStan error as of 14th december 2023 function doFoo() { /* ... */ } +// TODO https://github.com/staabm/phpstan-todo-by/issues/91 fix me when this GitHub issue is closed +class FooClass {} + // TODO: <1.0.0 This has to be in the first major release of this repo function doBar() { /* ... */ } @@ -44,9 +47,9 @@ When a text is given after the date, this text will be picked up for the PHPStan - by a full github issue url There are more builtin constraints, but these **require additional configuration**: -- by a semantic version constraint matched against the projects [reference-version](https://github.com/staabm/phpstan-todo-by#reference-version) -- by a semantic version constraint matched against a Composer dependency (via `composer.lock` or [`virtualPackages`](https://github.com/staabm/phpstan-todo-by#virtual-packages) config) -- by ticket reference, matched against the status of a ticket (e.g. in github.com or JIRA) +- by a semantic version constraint matched against the projects [reference-version config](https://github.com/staabm/phpstan-todo-by#reference-version) +- by a semantic version constraint matched against a Composer dependency (via `composer.lock` or [`virtualPackages config`](https://github.com/staabm/phpstan-todo-by#virtual-packages)) +- by ticket reference, matched against the status of a ticket (e.g. in [github.com or JIRA via config](https://github.com/staabm/phpstan-todo-by#issue-tracker-key-support)) see examples of different comment variants which are supported: @@ -77,6 +80,7 @@ see examples of different comment variants which are supported: // TODO: APP-123 fix it when this Jira ticket is closed // TODO: #123 fix it when this GitHub issue is closed +// TODO: GH-123 fix it when this GitHub issue is closed // TODO: some-organization/some-repo#123 change me if this GitHub pull request is closed ``` @@ -311,6 +315,7 @@ There are multiple ways to reference GitHub issue/PR: ##### Only number ```php // TODO: #123 - fix me +// TODO: GH-123 - fix me ``` If the `defaultOwner` is set to `acme` and `defaultRepo` is set to `hello-world`, the referenced issue is resolved to `acme/hello-world#123`. diff --git a/vendor/staabm/phpstan-todo-by/src/utils/ticket/GitHubTicketStatusFetcher.php b/vendor/staabm/phpstan-todo-by/src/utils/ticket/GitHubTicketStatusFetcher.php index f5fd0cc15..a8110bc2a 100644 --- a/vendor/staabm/phpstan-todo-by/src/utils/ticket/GitHubTicketStatusFetcher.php +++ b/vendor/staabm/phpstan-todo-by/src/utils/ticket/GitHubTicketStatusFetcher.php @@ -19,7 +19,7 @@ final class GitHubTicketStatusFetcher implements TicketStatusFetcher private const KEY_REGEX = ' ((?P[\w\-\.]+)\/)? # optional owner with slash separator (?P[\w\-\.]+)? # optional repo - \#(?P\d+) # ticket number + (\#|GH-)(?P\d+) # ticket number '; private string $defaultOwner; @@ -78,7 +78,12 @@ public function fetchTicketStatusByUrls(array $ticketUrls): array $responses = $this->httpClient->getMulti($ticketUrls, $headers); $results = []; - $urlsToKeys = array_flip($ticketUrls); + + $urlsToKeys = []; + foreach ($ticketUrls as $key => $url) { + $urlsToKeys[$url][] = $key; + } + foreach ($responses as $url => [$responseCode, $response]) { if (404 === $responseCode) { $results[$url] = null; @@ -94,8 +99,9 @@ public function fetchTicketStatusByUrls(array $ticketUrls): array throw new RuntimeException("GitHub returned invalid response body with $url"); } - $ticketKey = $urlsToKeys[$url]; - $results[$ticketKey] = $data['state']; + foreach ($urlsToKeys[$url] as $ticketKey) { + $results[$ticketKey] = $data['state']; + } } return $results; diff --git a/vendor/symplify/phpstan-rules/config/naming-rules.neon b/vendor/symplify/phpstan-rules/config/naming-rules.neon index 8e359fb7b..e0bad68d5 100644 --- a/vendor/symplify/phpstan-rules/config/naming-rules.neon +++ b/vendor/symplify/phpstan-rules/config/naming-rules.neon @@ -1,7 +1,6 @@ rules: - Symplify\PHPStanRules\Rules\Explicit\ExplicitClassPrefixSuffixRule - Symplify\PHPStanRules\Rules\NoReturnSetterMethodRule - - Symplify\PHPStanRules\Rules\NoVoidGetterMethodRule - Symplify\PHPStanRules\Rules\UppercaseConstantRule - Symplify\PHPStanRules\Rules\ClassNameRespectsParentSuffixRule - Symplify\PHPStanRules\Rules\CheckTypehintCallerTypeRule diff --git a/vendor/symplify/phpstan-rules/config/static-rules.neon b/vendor/symplify/phpstan-rules/config/static-rules.neon index d3ac6ccda..ed643beaf 100644 --- a/vendor/symplify/phpstan-rules/config/static-rules.neon +++ b/vendor/symplify/phpstan-rules/config/static-rules.neon @@ -1,6 +1,5 @@ rules: - Symplify\PHPStanRules\Rules\ForbiddenExtendOfNonAbstractClassRule - - Symplify\PHPStanRules\Rules\Complexity\ForbiddenSameNamedNewInstanceRule # domain - Symplify\PHPStanRules\Rules\Domain\RequireExceptionNamespaceRule @@ -23,12 +22,10 @@ rules: - Symplify\PHPStanRules\Rules\ForbiddenMultipleClassLikeInOneFileRule # comlexity - - Symplify\PHPStanRules\Rules\Complexity\ForbiddenSameNamedNewInstanceRule - Symplify\PHPStanRules\Rules\NarrowType\NoReturnFalseInNonBoolClassMethodRule - Symplify\PHPStanRules\Rules\Complexity\ForbiddenArrayMethodCallRule - Symplify\PHPStanRules\Rules\CheckRequiredInterfaceInContractNamespaceRule - - Symplify\PHPStanRules\Rules\NoEmptyClassRule # naming - Symplify\PHPStanRules\Rules\RequireAttributeNameRule diff --git a/vendor/symplify/phpstan-rules/src/Rules/Complexity/ForbiddenSameNamedNewInstanceRule.php b/vendor/symplify/phpstan-rules/src/Rules/Complexity/ForbiddenSameNamedNewInstanceRule.php deleted file mode 100644 index 0da899675..000000000 --- a/vendor/symplify/phpstan-rules/src/Rules/Complexity/ForbiddenSameNamedNewInstanceRule.php +++ /dev/null @@ -1,135 +0,0 @@ - - */ -final class ForbiddenSameNamedNewInstanceRule implements Rule -{ - /** - * @var string - */ - public const ERROR_MESSAGE = 'New objects with "%s" name are overridden. This can lead to unwanted bugs, please pick a different name to avoid it.'; - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition(self::ERROR_MESSAGE, [ - new CodeSample( - <<<'CODE_SAMPLE' -$product = new Product(); -$product = new Product(); - -$this->productRepository->save($product); -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -$firstProduct = new Product(); -$secondProduct = new Product(); - -$this->productRepository->save($firstProduct); -CODE_SAMPLE - ), - ]); - } - - /** - * @return class-string - */ - public function getNodeType(): string - { - return Expression::class; - } - - /** - * @param Expression $node - * @return string[] - */ - public function processNode(Node $node, Scope $scope): array - { - if (! $node->expr instanceof Assign) { - return []; - } - - if ($this->shouldSkip($scope, $node)) { - return []; - } - - $assign = $node->expr; - - if (! $assign->var instanceof Variable) { - return []; - } - - if (! $assign->expr instanceof New_) { - return []; - } - - if (! is_string($assign->var->name)) { - return []; - } - - // is type already defined? - $variableName = $assign->var->name; - if (! $scope->hasVariableType($variableName)->yes()) { - return []; - } - - $variableType = $scope->getVariableType($variableName); - if ($variableType instanceof NullType) { - return []; - } - - $exprType = $scope->getType($node->expr); - if (! $exprType instanceof ObjectType) { - return []; - } - - $errorMessage = sprintf(self::ERROR_MESSAGE, '$' . $variableName); - return [$errorMessage]; - } - - private function shouldSkip(Scope $scope, Expression $expression): bool - { - if ($this->isNestedInForeach($expression)) { - return true; - } - - $classReflection = $scope->getClassReflection(); - - // skip tests, are easier to re-use variable there - return $classReflection instanceof ClassReflection && $classReflection->isSubclassOf(TestCase::class); - } - - private function isNestedInForeach(Expression $expression): bool - { - // only available on stmt - $parentStmtTypes = $expression->getAttribute(AttributeKey::PARENT_STMT_TYPES); - if (! is_array($parentStmtTypes)) { - return false; - } - - // skip in foreach, as nesting might be on purpose - return in_array(Foreach_::class, $parentStmtTypes, true); - } -} diff --git a/vendor/symplify/phpstan-rules/src/Rules/NoEmptyClassRule.php b/vendor/symplify/phpstan-rules/src/Rules/NoEmptyClassRule.php deleted file mode 100644 index 11ee52789..000000000 --- a/vendor/symplify/phpstan-rules/src/Rules/NoEmptyClassRule.php +++ /dev/null @@ -1,144 +0,0 @@ -reflectionProvider = $reflectionProvider; - } - - /** - * @return class-string - */ - public function getNodeType(): string - { - return InClassNode::class; - } - - /** - * @param InClassNode $node - * @return string[] - */ - public function processNode(Node $node, Scope $scope): array - { - $classLike = $node->getOriginalNode(); - if ($classLike->stmts !== []) { - return []; - } - - // skip attribute - if ($this->isAttributeClass($node)) { - return []; - } - - if ($this->shouldSkipClassLike($classLike, $node)) { - return []; - } - - return [self::ERROR_MESSAGE]; - } - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition(self::ERROR_MESSAGE, [ - new CodeSample( - <<<'CODE_SAMPLE' -class SomeClass -{ -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -class SomeClass -{ - public function getSome() - { - } -} -CODE_SAMPLE - ), - ]); - } - - private function shouldSkipClassLike(ClassLike $classLike, InClassNode $inClassNode): bool - { - if (! $classLike instanceof Class_ && ! $classLike instanceof Trait_) { - return true; - } - - $classReflection = $inClassNode->getClassReflection(); - if ($classReflection->isSubclassOf(Throwable::class)) { - return true; - } - - if ($classLike->getComments() !== []) { - return true; - } - - return $this->isFinalClassWithAbstractOrInterfaceParent($classLike); - } - - /** - * @param \PhpParser\Node\Stmt\Class_|\PhpParser\Node\Stmt\Trait_ $classLike - */ - private function isFinalClassWithAbstractOrInterfaceParent($classLike): bool - { - if (! $classLike instanceof Class_) { - return false; - } - - if ($classLike->implements !== []) { - return true; - } - - if (! $classLike->isFinal()) { - return false; - } - - if (! $classLike->extends instanceof Name) { - return false; - } - - $parentClass = $classLike->extends->toString(); - $parentClassReflection = $this->reflectionProvider->getClass($parentClass); - - return $parentClassReflection->isAbstract(); - } - - private function isAttributeClass(InClassNode $inClassNode): bool - { - $classReflection = $inClassNode->getClassReflection(); - return $classReflection->isAttributeClass(); - } -} diff --git a/vendor/symplify/phpstan-rules/src/Rules/NoVoidGetterMethodRule.php b/vendor/symplify/phpstan-rules/src/Rules/NoVoidGetterMethodRule.php deleted file mode 100644 index 9ed117f7b..000000000 --- a/vendor/symplify/phpstan-rules/src/Rules/NoVoidGetterMethodRule.php +++ /dev/null @@ -1,147 +0,0 @@ -> - */ - private const STOPPING_TYPES = [ - Return_::class, - Yield_::class, - YieldFrom::class, - // possibly unneeded contract override - Throw_::class, - Node\Stmt\Throw_::class, - ]; - - public function __construct(TypeAwareNodeFinder $typeAwareNodeFinder) - { - $this->typeAwareNodeFinder = $typeAwareNodeFinder; - } - - /** - * @return class-string - */ - public function getNodeType(): string - { - return ClassMethod::class; - } - - /** - * @param ClassMethod $node - * @return string[] - */ - public function processNode(Node $node, Scope $scope): array - { - $classReflection = $scope->getClassReflection(); - if (! $classReflection instanceof ClassReflection) { - return []; - } - - if (! $classReflection->isClass()) { - return []; - } - - if ($node->isAbstract()) { - return []; - } - - if (strncmp($node->name->toString(), 'get', strlen('get')) !== 0) { - return []; - } - - if (! $this->isVoidReturnClassMethod($node)) { - return []; - } - - return [self::ERROR_MESSAGE]; - } - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition(self::ERROR_MESSAGE, [ - new CodeSample( - <<<'CODE_SAMPLE' -final class SomeClass -{ - public function getData(): void - { - // ... - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -final class SomeClass -{ - public function getData(): array - { - // ... - } -} -CODE_SAMPLE - ), - ]); - } - - private function isVoidReturnClassMethod(ClassMethod $classMethod): bool - { - if ($this->hasClassMethodVoidReturnType($classMethod)) { - return true; - } - - foreach (self::STOPPING_TYPES as $stoppingType) { - $foundNode = $this->typeAwareNodeFinder->findFirstInstanceOf($classMethod, $stoppingType); - if ($foundNode instanceof Node) { - return false; - } - } - - return true; - } - - private function hasClassMethodVoidReturnType(ClassMethod $classMethod): bool - { - if ($classMethod->returnType === null) { - return false; - } - - if (! $classMethod->returnType instanceof Identifier) { - return false; - } - - return $classMethod->returnType->toString() === 'void'; - } -}