Skip to content

Commit

Permalink
Allow running on PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Oct 30, 2021
1 parent 4e5ed5d commit 9d0e070
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion conf/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion src/Php/PhpVersionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 8 additions & 2 deletions tests/PHPStan/Php/PhpVersionFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9d0e070

Please sign in to comment.