From 4f2b861e40671c43aa925f6169d789a523ccc949 Mon Sep 17 00:00:00 2001 From: geni_jaho Date: Tue, 12 Nov 2024 20:02:34 +0100 Subject: [PATCH 1/5] Resolve refactor() method return type issues --- phpstan.neon | 1 + .../Assign/CallOnAppArrayAccessToStandaloneAssignRector.php | 3 ++- src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php | 2 +- src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php | 3 ++- .../MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php | 3 ++- src/Rector/New_/AddGuardToLoginEventRector.php | 3 ++- src/Rector/PropertyFetch/OptionalToNullsafeOperatorRector.php | 3 +++ 7 files changed, 13 insertions(+), 5 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index f84cf6d3..bca12f85 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,6 @@ includes: - vendor/symplify/phpstan-rules/config/rector-rules.neon + - phar://phpstan.phar/conf/bleedingEdge.neon parameters: level: max diff --git a/src/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector.php b/src/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector.php index 90698aa1..bc02fce2 100644 --- a/src/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector.php +++ b/src/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector.php @@ -53,8 +53,9 @@ public function getNodeTypes(): array /** * @param Expression $node + * @return array|null */ - public function refactor(Node $node): Node|array|int|null + public function refactor(Node $node): array|null { if (! $node->expr instanceof Assign) { return null; diff --git a/src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php b/src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php index dee11b1a..1864fa1e 100644 --- a/src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php +++ b/src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php @@ -47,7 +47,7 @@ public function getNodeTypes(): array /** * @param Class_ $node */ - public function refactor(Node $node): Node|array|int|null + public function refactor(Node $node): Node|null { if (! $this->isObjectType($node, new ObjectType('Illuminate\Database\Eloquent\Model'))) { return null; diff --git a/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php b/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php index e375b830..c3ab2af1 100644 --- a/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php +++ b/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php @@ -78,8 +78,9 @@ public function getNodeTypes(): array /** * @param Expression $node + * @return NodeTraverser::REMOVE_NODE|null */ - public function refactor(Node $node): int|Node|array|null + public function refactor(Node $node): int|null { if (! $node->expr instanceof FuncCall) { return null; diff --git a/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php b/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php index c7986632..b9d0a7df 100644 --- a/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php +++ b/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php @@ -78,8 +78,9 @@ public function getNodeTypes(): array /** * @param Expression $node + * @return array|null */ - public function refactor(Node $node): Node|array|int|null + public function refactor(Node $node): array|null { if (! $node->expr instanceof MethodCall) { return null; diff --git a/src/Rector/New_/AddGuardToLoginEventRector.php b/src/Rector/New_/AddGuardToLoginEventRector.php index b6f5cc8b..dcd73946 100644 --- a/src/Rector/New_/AddGuardToLoginEventRector.php +++ b/src/Rector/New_/AddGuardToLoginEventRector.php @@ -68,8 +68,9 @@ public function getNodeTypes(): array /** * @param Expression $node + * @return array|null */ - public function refactor(Node $node): Node|array|int|null + public function refactor(Node $node): array|null { $newNode = $this->getNewNode($node); diff --git a/src/Rector/PropertyFetch/OptionalToNullsafeOperatorRector.php b/src/Rector/PropertyFetch/OptionalToNullsafeOperatorRector.php index 520e8ea6..d193fdc2 100644 --- a/src/Rector/PropertyFetch/OptionalToNullsafeOperatorRector.php +++ b/src/Rector/PropertyFetch/OptionalToNullsafeOperatorRector.php @@ -132,6 +132,9 @@ public function refactor(Node $node): ?Node return new NullsafeMethodCall($firstArg->value, $node->name, $node->args); } + /** + * @return PhpVersion::PHP_80 + */ public function provideMinPhpVersion(): int { return PhpVersion::PHP_80; From 9bcd3b7b0569cbca8e18575df4ea6653e8c203b1 Mon Sep 17 00:00:00 2001 From: geni_jaho Date: Tue, 12 Nov 2024 22:00:17 +0100 Subject: [PATCH 2/5] Require phpstan-deprecation-rules --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a0688221..9d5137fc 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,8 @@ "symplify/phpstan-extensions": "^11.4", "symplify/phpstan-rules": "^12.4", "symplify/rule-doc-generator": "^12.1", - "tightenco/duster": "^2.7" + "tightenco/duster": "^2.7", + "phpstan/phpstan-deprecation-rules": "^1.2" }, "autoload": { "psr-4": { From 47d381f4f9eff6cef06fae1e4722e4c62baf5171 Mon Sep 17 00:00:00 2001 From: geni_jaho Date: Tue, 12 Nov 2024 22:00:54 +0100 Subject: [PATCH 3/5] Resolve issues in AddGenericReturnTypeToRelationsRector --- .../AddGenericReturnTypeToRelationsRector.php | 24 ++++------- .../with-constant-string-type.php.inc | 40 +++++++++++++++++++ 2 files changed, 48 insertions(+), 16 deletions(-) create mode 100644 tests/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector/Fixture/NewGenerics/with-constant-string-type.php.inc diff --git a/src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php b/src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php index 92a5c43f..ab11ac04 100644 --- a/src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php +++ b/src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php @@ -239,21 +239,17 @@ private function getRelatedModelClassFromMethodCall(MethodCall $methodCall): ?st { $argType = $this->getType($methodCall->getArgs()[0]->value); - if ($argType instanceof ConstantStringType && $argType->isClassStringType()->yes()) { - return $argType->getValue(); - } - - if (! $argType instanceof GenericClassStringType) { + if (! $argType->isClassStringType()->yes()) { return null; } - $modelType = $argType->getGenericType(); + $objectClassNames = $argType->getClassStringObjectType()->getObjectClassNames(); - if (! $modelType instanceof ObjectType) { + if ($objectClassNames === []) { return null; } - return $modelType->getClassName(); + return $objectClassNames[0]; } private function getRelationMethodCall(ClassMethod $classMethod): ?MethodCall @@ -326,21 +322,17 @@ private function getClassForIntermediateGeneric(MethodCall $methodCall): ?string $argType = $this->getType($args[1]->value); - if ($argType instanceof ConstantStringType && $argType->isClassStringType()->yes()) { - return $argType->getValue(); - } - - if (! $argType instanceof GenericClassStringType) { + if (! $argType->isClassStringType()->yes()) { return null; } - $modelType = $argType->getGenericType(); + $objectClassNames = $argType->getClassStringObjectType()->getObjectClassNames(); - if (! $modelType instanceof ObjectType) { + if ($objectClassNames === []) { return null; } - return $modelType->getClassName(); + return $objectClassNames[0]; } private function areNativeTypeAndPhpDocReturnTypeEqual( diff --git a/tests/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector/Fixture/NewGenerics/with-constant-string-type.php.inc b/tests/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector/Fixture/NewGenerics/with-constant-string-type.php.inc new file mode 100644 index 00000000..fdb8edef --- /dev/null +++ b/tests/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector/Fixture/NewGenerics/with-constant-string-type.php.inc @@ -0,0 +1,40 @@ +hasMany('RectorLaravel\Tests\Rector\ClassMethod\AddGenericReturnTypeToRelationsRector\Fixture\NewGenerics\Account'); + } +} + +?> +----- + + */ + public function accounts(): HasMany + { + return $this->hasMany('RectorLaravel\Tests\Rector\ClassMethod\AddGenericReturnTypeToRelationsRector\Fixture\NewGenerics\Account'); + } +} + +?> From 391b0bcc69148939d88488a66fd2a09b807e6262 Mon Sep 17 00:00:00 2001 From: geni_jaho Date: Wed, 13 Nov 2024 23:22:57 +0100 Subject: [PATCH 4/5] Resolve PHPStan issues --- ...OnAppArrayAccessToStandaloneAssignRector.php | 2 +- .../AddGenericReturnTypeToRelationsRector.php | 2 -- .../MigrateToSimplifiedAttributeRector.php | 2 +- .../ApplyDefaultInsteadOfNullCoalesceRector.php | 12 +++++++++--- ...spatchNonShouldQueueToDispatchSyncRector.php | 13 +++++++++---- .../FuncCall/RemoveDumpDataDeadCodeRector.php | 2 +- ...hangeQueryWhereDateValueWithCarbonRector.php | 2 +- .../EloquentOrderByToLatestOrOldestRector.php | 11 ++++++++--- src/Rector/New_/AddGuardToLoginEventRector.php | 2 +- .../DispatchToHelperFunctionsRector.php | 13 ++++++++----- .../StaticCall/RouteActionCallableRector.php | 17 +++++++++++++---- src/Set/LaravelLevelSetList.php | 4 +--- src/Set/LaravelSetList.php | 4 +--- .../Packages/Cashier/CashierLevelSetList.php | 4 +--- src/Set/Packages/Cashier/CashierSetList.php | 4 +--- .../Packages/Livewire/LivewireLevelSetList.php | 4 +--- 16 files changed, 57 insertions(+), 41 deletions(-) diff --git a/src/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector.php b/src/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector.php index bc02fce2..478c0887 100644 --- a/src/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector.php +++ b/src/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector.php @@ -55,7 +55,7 @@ public function getNodeTypes(): array * @param Expression $node * @return array|null */ - public function refactor(Node $node): array|null + public function refactor(Node $node): ?array { if (! $node->expr instanceof Assign) { return null; diff --git a/src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php b/src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php index ab11ac04..b210d377 100644 --- a/src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php +++ b/src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php @@ -14,8 +14,6 @@ use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; use PHPStan\Reflection\ClassReflection; -use PHPStan\Type\Constant\ConstantStringType; -use PHPStan\Type\Generic\GenericClassStringType; use PHPStan\Type\Generic\GenericObjectType; use PHPStan\Type\ObjectType; use PHPStan\Type\ThisType; diff --git a/src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php b/src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php index 1864fa1e..15773b97 100644 --- a/src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php +++ b/src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php @@ -47,7 +47,7 @@ public function getNodeTypes(): array /** * @param Class_ $node */ - public function refactor(Node $node): Node|null + public function refactor(Node $node): ?Node { if (! $this->isObjectType($node, new ObjectType('Illuminate\Database\Eloquent\Model'))) { return null; diff --git a/src/Rector/Coalesce/ApplyDefaultInsteadOfNullCoalesceRector.php b/src/Rector/Coalesce/ApplyDefaultInsteadOfNullCoalesceRector.php index 6167dc31..63b42d6c 100644 --- a/src/Rector/Coalesce/ApplyDefaultInsteadOfNullCoalesceRector.php +++ b/src/Rector/Coalesce/ApplyDefaultInsteadOfNullCoalesceRector.php @@ -90,13 +90,19 @@ public function refactor(Node $node): MethodCall|StaticCall|FuncCall|null $call = $node->left; + if ($call instanceof MethodCall) { + $objectType = $call->var; + } elseif ($call instanceof StaticCall) { + $objectType = $call->class; + } else { + $objectType = null; + } + foreach ($this->applyDefaultWith as $applyDefaultWith) { $valid = false; - $objectType = $call->var ?? $call->class ?? null; - if ( - $applyDefaultWith->getObjectType() instanceof ObjectType && + $applyDefaultWith->getObjectType() !== null && $objectType !== null && $this->isObjectType( $objectType, diff --git a/src/Rector/FuncCall/DispatchNonShouldQueueToDispatchSyncRector.php b/src/Rector/FuncCall/DispatchNonShouldQueueToDispatchSyncRector.php index 29f6eddb..053f1dfa 100644 --- a/src/Rector/FuncCall/DispatchNonShouldQueueToDispatchSyncRector.php +++ b/src/Rector/FuncCall/DispatchNonShouldQueueToDispatchSyncRector.php @@ -136,15 +136,20 @@ private function processCall(FuncCall|MethodCall|StaticCall $call): FuncCall|Met private function isDispatchablesCall(MethodCall $methodCall): bool { $type = $this->getType($methodCall->var); - if (! $type instanceof ObjectType) { + + if (! $type->isObject()->yes()) { + return false; + } + + $objectClassNames = $type->getObjectClassNames(); + + if (count($objectClassNames) !== 1) { return false; } try { // Will trigger ClassNotFoundException if the class definition is not found - $reflection = $this->reflectionProvider->getClass( - $type->getClassName() - ); + $reflection = $this->reflectionProvider->getClass($objectClassNames[0]); if ($reflection->hasTraitUse(self::DISPATCHABLE_TRAIT)) { return true; diff --git a/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php b/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php index c3ab2af1..c9e662c6 100644 --- a/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php +++ b/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php @@ -80,7 +80,7 @@ public function getNodeTypes(): array * @param Expression $node * @return NodeTraverser::REMOVE_NODE|null */ - public function refactor(Node $node): int|null + public function refactor(Node $node): ?int { if (! $node->expr instanceof FuncCall) { return null; diff --git a/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php b/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php index b9d0a7df..2aaa7362 100644 --- a/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php +++ b/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php @@ -80,7 +80,7 @@ public function getNodeTypes(): array * @param Expression $node * @return array|null */ - public function refactor(Node $node): array|null + public function refactor(Node $node): ?array { if (! $node->expr instanceof MethodCall) { return null; diff --git a/src/Rector/MethodCall/EloquentOrderByToLatestOrOldestRector.php b/src/Rector/MethodCall/EloquentOrderByToLatestOrOldestRector.php index af240382..487d8f09 100644 --- a/src/Rector/MethodCall/EloquentOrderByToLatestOrOldestRector.php +++ b/src/Rector/MethodCall/EloquentOrderByToLatestOrOldestRector.php @@ -114,7 +114,7 @@ private function isOrderByMethodCall(MethodCall $methodCall): bool private function isAllowedPattern(MethodCall $methodCall): bool { - $columnArg = $methodCall->args[0]->value ?? null; + $columnArg = $methodCall->args[0] instanceof Arg ? $methodCall->args[0]->value : null; // If no patterns are specified, consider all column names as matching if ($this->allowedPatterns === []) { @@ -150,12 +150,17 @@ private function convertOrderByToLatest(MethodCall $methodCall): MethodCall return $methodCall; } - $columnVar = $methodCall->args[0]->value ?? null; + $columnVar = $methodCall->args[0] instanceof Arg ? $methodCall->args[0]->value : null; if ($columnVar === null) { return $methodCall; } - $direction = $methodCall->args[1]->value->value ?? 'asc'; + if (isset($methodCall->args[1]) && $methodCall->args[1] instanceof Arg && $methodCall->args[1]->value instanceof String_) { + $direction = $methodCall->args[1]->value->value; + } else { + $direction = 'asc'; + } + if ($this->isName($methodCall->name, 'orderByDesc')) { $newMethod = 'latest'; } else { diff --git a/src/Rector/New_/AddGuardToLoginEventRector.php b/src/Rector/New_/AddGuardToLoginEventRector.php index dcd73946..8ded43e0 100644 --- a/src/Rector/New_/AddGuardToLoginEventRector.php +++ b/src/Rector/New_/AddGuardToLoginEventRector.php @@ -70,7 +70,7 @@ public function getNodeTypes(): array * @param Expression $node * @return array|null */ - public function refactor(Node $node): array|null + public function refactor(Node $node): ?array { $newNode = $this->getNewNode($node); diff --git a/src/Rector/StaticCall/DispatchToHelperFunctionsRector.php b/src/Rector/StaticCall/DispatchToHelperFunctionsRector.php index 06580362..eb12475c 100644 --- a/src/Rector/StaticCall/DispatchToHelperFunctionsRector.php +++ b/src/Rector/StaticCall/DispatchToHelperFunctionsRector.php @@ -12,7 +12,6 @@ use PHPStan\Broker\ClassNotFoundException; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ReflectionProvider; -use PHPStan\Type\ObjectType; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\Exception\PoorDocumentationException; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -91,14 +90,18 @@ public function refactor(Node $node): ?Node private function getClassReflection(StaticCall $staticCall): ?ClassReflection { $type = $this->getType($staticCall->class); - if (! $type instanceof ObjectType) { + if (! $type->isObject()->yes()) { + return null; + } + + $objectClassNames = $type->getObjectClassNames(); + + if (count($objectClassNames) !== 1) { return null; } try { - return $this->reflectionProvider->getClass( - $type->getClassName() - ); + return $this->reflectionProvider->getClass($objectClassNames[0]); } catch (ClassNotFoundException) { } diff --git a/src/Rector/StaticCall/RouteActionCallableRector.php b/src/Rector/StaticCall/RouteActionCallableRector.php index a433157f..669ca9c5 100644 --- a/src/Rector/StaticCall/RouteActionCallableRector.php +++ b/src/Rector/StaticCall/RouteActionCallableRector.php @@ -14,7 +14,7 @@ use PhpParser\Node\Identifier; use PhpParser\Node\Scalar\String_; use PHPStan\Analyser\Scope; -use PHPStan\Reflection\Php\PhpMethodReflection; +use PHPStan\Reflection\MethodReflection; use Rector\Contract\Rector\ConfigurableRectorInterface; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PhpParser\Node\Value\ValueResolver; @@ -123,7 +123,7 @@ public function refactor(Node $node): ?Node $phpMethodReflection = $this->reflectionResolver->resolveMethodReflection($segments[0], $segments[1], $scope); - if (! $phpMethodReflection instanceof PhpMethodReflection) { + if (! $phpMethodReflection instanceof MethodReflection) { return null; } @@ -132,7 +132,7 @@ public function refactor(Node $node): ?Node $segments[1], ]); - if (is_array($argValue) && isset($argValue['as'])) { + if (is_array($argValue) && isset($argValue['as']) && is_string($argValue['as'])) { $node = new MethodCall($node, 'name', [new Arg(new String_($argValue['as']))]); } @@ -144,9 +144,17 @@ public function refactor(Node $node): ?Node if (is_string($argValue['middleware'])) { $argument = new String_($argValue['middleware']); } else { + // if any of the elements in the middleware array is not a string, return node as is + if (array_filter($argValue['middleware'], static fn ($value) => ! is_string($value)) !== []) { + return $node; + } + + /** @var list $middleware */ + $middleware = $argValue['middleware']; + $argument = new Array_(array_map( static fn ($value) => new ArrayItem(new String_($value)), - $argValue['middleware'] + $middleware )); } $node = new MethodCall($node, 'middleware', [new Arg($argument)]); @@ -164,6 +172,7 @@ public function configure(array $configuration): void Assert::isArray($routes); Assert::allString(array_keys($routes)); Assert::allString($routes); + /** @var array $routes */ $this->routes = $routes; $namespace = $configuration[self::NAMESPACE] ?? self::DEFAULT_NAMESPACE; diff --git a/src/Set/LaravelLevelSetList.php b/src/Set/LaravelLevelSetList.php index 852d3cd5..5dd9db62 100644 --- a/src/Set/LaravelLevelSetList.php +++ b/src/Set/LaravelLevelSetList.php @@ -4,9 +4,7 @@ namespace RectorLaravel\Set; -use Rector\Set\Contract\SetListInterface; - -final class LaravelLevelSetList implements SetListInterface +final class LaravelLevelSetList { /** * @var string diff --git a/src/Set/LaravelSetList.php b/src/Set/LaravelSetList.php index ad49796a..8a62c577 100644 --- a/src/Set/LaravelSetList.php +++ b/src/Set/LaravelSetList.php @@ -4,9 +4,7 @@ namespace RectorLaravel\Set; -use Rector\Set\Contract\SetListInterface; - -final class LaravelSetList implements SetListInterface +final class LaravelSetList { /** * @var string diff --git a/src/Set/Packages/Cashier/CashierLevelSetList.php b/src/Set/Packages/Cashier/CashierLevelSetList.php index b2fa4ee1..b9522ea7 100644 --- a/src/Set/Packages/Cashier/CashierLevelSetList.php +++ b/src/Set/Packages/Cashier/CashierLevelSetList.php @@ -4,9 +4,7 @@ namespace RectorLaravel\Set\Packages\Cashier; -use Rector\Set\Contract\SetListInterface; - -final class CashierLevelSetList implements SetListInterface +final class CashierLevelSetList { /** * @var string diff --git a/src/Set/Packages/Cashier/CashierSetList.php b/src/Set/Packages/Cashier/CashierSetList.php index ca727341..23f1f9fd 100644 --- a/src/Set/Packages/Cashier/CashierSetList.php +++ b/src/Set/Packages/Cashier/CashierSetList.php @@ -4,9 +4,7 @@ namespace RectorLaravel\Set\Packages\Cashier; -use Rector\Set\Contract\SetListInterface; - -final class CashierSetList implements SetListInterface +final class CashierSetList { /** * @var string diff --git a/src/Set/Packages/Livewire/LivewireLevelSetList.php b/src/Set/Packages/Livewire/LivewireLevelSetList.php index 36c3852a..1451cf63 100644 --- a/src/Set/Packages/Livewire/LivewireLevelSetList.php +++ b/src/Set/Packages/Livewire/LivewireLevelSetList.php @@ -4,9 +4,7 @@ namespace RectorLaravel\Set\Packages\Livewire; -use Rector\Set\Contract\SetListInterface; - -final class LivewireLevelSetList implements SetListInterface +final class LivewireLevelSetList { /** * @var string From 95dab0d6739b37da965b70baabf1b42934deae1a Mon Sep 17 00:00:00 2001 From: geni_jaho Date: Wed, 20 Nov 2024 00:10:19 +0100 Subject: [PATCH 5/5] Ignore PHPStan issue with instanceof GenericObjectType --- phpstan.neon | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpstan.neon b/phpstan.neon index bca12f85..a5b7505b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -33,3 +33,6 @@ parameters: # Laravel Container not being recognized properly in some of the tests - '#Call to method needs\(\) on an unknown class Illuminate\\Contracts\\Container\\ContextualBindingBuilder#' + + # No easy replacement for this check, it's also ignored in core Rector + - '#Doing instanceof PHPStan\\Type\\Generic\\GenericObjectType is error\-prone and deprecated#'