From 5717a1fea88f554323c08fa148016285b3eee544 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Mon, 2 Dec 2024 18:35:20 +0200 Subject: [PATCH] Provide backwards compatibility with PHPStan 1.x. Fixes #951. --- src/PHPStan/RemainingRayCallRule.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/PHPStan/RemainingRayCallRule.php b/src/PHPStan/RemainingRayCallRule.php index ad33cc2..39d8289 100644 --- a/src/PHPStan/RemainingRayCallRule.php +++ b/src/PHPStan/RemainingRayCallRule.php @@ -20,8 +20,15 @@ public function processNode(Node $node, Scope $scope): array return []; } - if ($node->name->getParts()[0] !== 'ray') { + // Backwards compatibility with PHPStan 1.x. + if (!method_exists($node->name, 'getParts')) { + if ($node->name->parts[0] !== 'ray') { return []; + } + } else { + if ($node->name->getParts()[0] !== 'ray') { + return []; + } } return [