Skip to content

Commit

Permalink
Fix expectations as php8 polyfills are loaded by phpstan.phar
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jul 11, 2024
1 parent 0850175 commit 0613a55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"phpstan": "phpstan analyse"
"test": "@php vendor/bin/phpunit",
"phpstan": "@php phpstan analyse"
}
}
6 changes: 3 additions & 3 deletions tests/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function doExpectWarning(string $message): void

protected function expectPcreEngineException(string $pattern): void
{
$error = PHP_VERSION_ID >= 80000 ? 'Backtrack limit exhausted' : 'PREG_BACKTRACK_LIMIT_ERROR';
$error = function_exists('preg_last_error_msg') ? 'Backtrack limit exhausted' : 'PREG_BACKTRACK_LIMIT_ERROR';
$this->expectPcreException($pattern, $error);
}

Expand All @@ -49,9 +49,9 @@ protected function expectPcreException(string $pattern, ?string $error = null):

if (null === $error) {
// Only use a message if the error can be reliably determined
if (PHP_VERSION_ID >= 80000) {
if (function_exists('preg_last_error_msg')) {
$error = 'Internal error';
} elseif (PHP_VERSION_ID >= 70201) {
} else {
$error = 'PREG_INTERNAL_ERROR';
}
}
Expand Down

0 comments on commit 0613a55

Please sign in to comment.