From 8500e3ac253caa417078870fe63a2f1be3c3759a Mon Sep 17 00:00:00 2001 From: Nathanael Esayeas Date: Fri, 4 Aug 2023 21:08:58 -0500 Subject: [PATCH 1/3] Update composer.json Signed-off-by: Nathanael Esayeas --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index abdf5a580..68c1a4477 100644 --- a/composer.json +++ b/composer.json @@ -73,6 +73,7 @@ "test\\": "tests/" }, "files": [ + "fixtures/autoload.php", "vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php" ] }, From 92a68b905438833621e999f5d616adb61898fb4b Mon Sep 17 00:00:00 2001 From: Nathanael Esayeas Date: Fri, 4 Aug 2023 21:09:23 -0500 Subject: [PATCH 2/3] Create autoload.php Signed-off-by: Nathanael Esayeas --- fixtures/autoload.php | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 fixtures/autoload.php diff --git a/fixtures/autoload.php b/fixtures/autoload.php new file mode 100644 index 000000000..07e0afafb --- /dev/null +++ b/fixtures/autoload.php @@ -0,0 +1,63 @@ + 80300, + 'PHP82' => 80200, + 'PHP81' => 80100, + 'PHP80' => 80000, + 'PHP74' => 70400, + 'PHP73' => 70300, + 'PHP72' => 70200, +]; + +$allVersions = implode('|', array_keys($phpVersions)); + +$currentSupportedVersion = implode('|', array_keys(array_filter($phpVersions, static function (int $version): bool { + return PHP_VERSION_ID >= $version; +}))); + +$allTestsAndFixtures = globRecursively(dirname(__DIR__) . '/fixtures/*.php'); + +$currentSupportedVersionTestsAndFixtures = array_filter( + $allTestsAndFixtures, + static function (string $filePath) use ($currentSupportedVersion): bool { + return preg_match('#' . $currentSupportedVersion . '#', $filePath) === 1; + } +); + +$allPhpVersionTestsAndFixtures = array_filter( + $allTestsAndFixtures, + static function (string $filePath) use ($allVersions): bool { + return preg_match('#' . $allVersions . '#', $filePath) === 1; + } +); + +$excludedPhpVersions = array_diff($allPhpVersionTestsAndFixtures, $currentSupportedVersionTestsAndFixtures); + +$autoloadTestsAndFixtures = array_diff($allTestsAndFixtures, $excludedPhpVersions); + +array_map( + static function (string $file): void { + if (!file_exists($file)) { + return; + } + + require_once $file; + }, + $autoloadTestsAndFixtures +); From 39796ec9ffc5817c2490396b7c3b9177ec3dfdd5 Mon Sep 17 00:00:00 2001 From: Nathanael Esayeas Date: Fri, 4 Aug 2023 21:57:49 -0500 Subject: [PATCH 3/3] Update psalm-baseline.xml Signed-off-by: Nathanael Esayeas --- psalm-baseline.xml | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index dbd0732b2..310ea97cf 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -981,6 +981,9 @@ isInternal isInternal + + $attribute->getName() + $this->name $this->rfc->getNamespaceName() @@ -990,9 +993,6 @@ $this->rfc->isAbstract() $this->rfc->isFinal() - - ReflectionAttribute - @@ -1603,9 +1603,6 @@ $lastBrace - - enum_exists($prefix) - @@ -1893,16 +1890,17 @@ load - + $definition->getClassName() $definition->getCode() $path + $this->path $this->path - require $tmpfname + require $fileName RequireLoader @@ -2069,27 +2067,35 @@ - + + + $innterType + $type->getTypes() + $type->getTypes() + $typeHint + + + $innterType $type $type + $typeHint - + list<array{typeHint: string, isPrimitive: bool}> - string - + $declaringClass getSimplestReturnType - - \ReflectionIntersectionType - \ReflectionUnionType - - - $declaringClass - + + !$type instanceof ReflectionType && method_exists($method, 'getTentativeReturnType') + !$type instanceof ReflectionType && method_exists($method, 'getTentativeReturnType') + + + getName +