From 9d0e070ed9cacf9093397f16280dab99caf3a37c Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Sat, 30 Oct 2021 09:11:57 +0200 Subject: [PATCH] Allow running on PHP 8.1 --- conf/config.neon | 2 +- src/Php/PhpVersionFactory.php | 2 +- tests/PHPStan/Php/PhpVersionFactoryTest.php | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/conf/config.neon b/conf/config.neon index 06ac0d6019..c1c476fdb9 100644 --- a/conf/config.neon +++ b/conf/config.neon @@ -219,7 +219,7 @@ parametersSchema: minimumNumberOfJobsPerProcess: int(), buffer: int() ]) - phpVersion: schema(anyOf(schema(int(), min(70100), max(80099))), nullable()) + phpVersion: schema(anyOf(schema(int(), min(70100), max(80199))), nullable()) polluteScopeWithLoopInitialAssignments: bool() polluteScopeWithAlwaysIterableForeach: bool() propertyAlwaysWrittenTags: listOf(string()) diff --git a/src/Php/PhpVersionFactory.php b/src/Php/PhpVersionFactory.php index 8d726313fd..6923cf467d 100644 --- a/src/Php/PhpVersionFactory.php +++ b/src/Php/PhpVersionFactory.php @@ -27,7 +27,7 @@ public function create(): PhpVersion $parts = explode('.', $this->composerPhpVersion); $tmp = (int) $parts[0] * 10000 + (int) ($parts[1] ?? 0) * 100 + (int) ($parts[2] ?? 0); $tmp = max($tmp, 70100); - $versionId = min($tmp, 80099); + $versionId = min($tmp, 80199); } if ($versionId === null) { diff --git a/tests/PHPStan/Php/PhpVersionFactoryTest.php b/tests/PHPStan/Php/PhpVersionFactoryTest.php index ad255411b9..2dab16aed5 100644 --- a/tests/PHPStan/Php/PhpVersionFactoryTest.php +++ b/tests/PHPStan/Php/PhpVersionFactoryTest.php @@ -55,8 +55,14 @@ public function dataCreate(): array [ null, '8.1', - 80099, - '8.0.99', + 80100, + '8.1', + ], + [ + null, + '8.2', + 80199, + '8.1.99', ], [ null,