Skip to content

Commit

Permalink
Fix PHPStan 2 findings
Browse files Browse the repository at this point in the history
  • Loading branch information
SchmidtClaudia authored and Seldaek committed Nov 12, 2024
1 parent 312f023 commit e06408b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/PcreException.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ private static function pcreLastErrorMessage($code)
return preg_last_error_msg();
}

// older php versions did not set the code properly in all cases
if (PHP_VERSION_ID < 70201 && $code === 0) {
return 'UNDEFINED_ERROR';
}

/** @var array<string, array<string, int>> $constants */
$constants = get_defined_constants(true);
if (!isset($constants['pcre']) || !is_array($constants['pcre'])) {
return 'UNDEFINED_ERROR';
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStanTests/InvalidRegexPatternRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function getRule(): \PHPStan\Rules\Rule

public function testRule(): void
{
$missing = PHP_VERSION_ID < 70300 ? ')' : 'closing parenthesis';
$missing = 'closing parenthesis';

$this->analyse([__DIR__ . '/fixtures/invalid-patterns.php'], [
[
Expand Down

0 comments on commit e06408b

Please sign in to comment.