Skip to content

Commit

Permalink
Merge branch '2.x' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jun 22, 2022
2 parents a08e8f4 + 8d1539b commit 2e36ee8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
17 changes: 0 additions & 17 deletions phpstan-baseline.neon

This file was deleted.

2 changes: 0 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ parameters:
- src
- tests

reportUnmatchedIgnoredErrors: false
treatPhpDocTypesAsCertain: false

bootstrapFiles:
- tests/phpstan-locate-phpunit-autoloader.php

includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
- phpstan-baseline.neon
4 changes: 2 additions & 2 deletions src/Preg.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function matchAll(string $pattern, string $subject, ?array &$match
}

$result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
if ($result === false || /* PHP < 8 may return null */ $result === null) {
if (!is_int($result)) { // PHP < 8 may return null, 8+ returns int|false
throw PcreException::fromFunction('preg_match_all', $pattern);
}

Expand All @@ -95,7 +95,7 @@ public static function matchAll(string $pattern, string $subject, ?array &$match
public static function matchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): int
{
$result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE, $offset);
if ($result === false || /* PHP < 8 may return null */ $result === null) {
if (!is_int($result)) { // PHP < 8 may return null, 8+ returns int|false
throw PcreException::fromFunction('preg_match_all', $pattern);
}

Expand Down

0 comments on commit 2e36ee8

Please sign in to comment.