diff --git a/src/Rules/CarbonCopyRule.php b/src/Rules/CarbonCopyRule.php index 90fd211..6b90d35 100644 --- a/src/Rules/CarbonCopyRule.php +++ b/src/Rules/CarbonCopyRule.php @@ -47,7 +47,9 @@ public function processNode(Node $node, Scope $scope): array $scope, $node->var, '', - static fn (Type $type): bool => $type->canCallMethods()->yes() && $type->hasMethod($name)->yes() + static function (Type $type) use ($name): bool { + return $type->canCallMethods()->yes() && $type->hasMethod($name)->yes(); + } ); $type = $typeResult->getType(); diff --git a/tests/RulesTest.php b/tests/RulesTest.php index 5d6b07d..dc63b9e 100644 --- a/tests/RulesTest.php +++ b/tests/RulesTest.php @@ -37,6 +37,8 @@ protected function findErrorsByLine(string $filename): array { $errors = $this->findErrors(realpath($filename)); - return collect($errors['messages'] ?? [])->mapWithKeys(fn ($message) => [$message['line'] => $message['message']])->toArray(); + return collect($errors['messages'] ?? [])->mapWithKeys(function ($message) { + return [$message['line'] => $message['message']]; + })->toArray(); } }