From b4aced9713de31990e41c1a42f922a1f92b46c39 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Sat, 25 Jun 2022 22:50:37 -0500 Subject: [PATCH] Allow the return type checks to run with php 8.0 --- psalm.xml.dist | 7 +++++++ tests/Internal/Codebase/InternalCallMapHandlerTest.php | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/psalm.xml.dist b/psalm.xml.dist index 135cadc6691..d16459e5ad6 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -166,5 +166,12 @@ + + + + + + + diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index 0f8c26fc46d..df101426fd8 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -555,7 +555,7 @@ public function testGetcallmapReturnsAValidCallmap(): void /** * - * @return iterable}> + * @return iterable}> */ public function callMapEntryProvider(): iterable { @@ -765,7 +765,12 @@ private function assertParameter(array $normalizedEntry, ReflectionParameter $pa */ public function assertEntryReturnType(ReflectionFunction $function, string $entryReturnType): void { - $expectedType = $function->hasTentativeReturnType() ? $function->getTentativeReturnType() : $function->getReturnType(); + if (version_compare(PHP_VERSION, '8.1.0', '>=')) { + /** @var \ReflectionType|null $expectedType */ + $expectedType = $function->hasTentativeReturnType() ? $function->getTentativeReturnType() : $function->getReturnType(); + } else { + $expectedType = $function->getReturnType(); + } if ($expectedType === null) { $this->assertSame('', $entryReturnType, 'CallMap entry has incorrect return type'); return;