Skip to content

Commit

Permalink
Use PHP_VERSION_ID instead of version_compare()
Browse files Browse the repository at this point in the history
As we do elsewhere
  • Loading branch information
weirdan committed Mar 3, 2024
1 parent 64a3272 commit 08fbb64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/Traits/InvalidCodeAnalysisTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testInvalidCode(
): void {
$test_name = $this->getTestName();
if (strpos($test_name, 'PHP80-') !== false) {
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
if (PHP_VERSION_ID < 8_00_00) {
$this->markTestSkipped('Test case requires PHP 8.0.');
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Traits/ValidCodeAnalysisTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ public function testValidCode(
): void {
$test_name = $this->getTestName();
if (strpos($test_name, 'PHP80-') !== false) {
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
if (PHP_VERSION_ID < 8_00_00) {
$this->markTestSkipped('Test case requires PHP 8.0.');
}

if ($php_version === null) {
$php_version = '8.0';
}
} elseif (strpos($test_name, 'PHP81-') !== false) {
if (version_compare(PHP_VERSION, '8.1.0', '<')) {
if (PHP_VERSION_ID < 8_01_00) {
$this->markTestSkipped('Test case requires PHP 8.1.');
}

Expand Down

0 comments on commit 08fbb64

Please sign in to comment.