Skip to content

Commit

Permalink
Fix example to work around phpstan bug for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jul 11, 2024
1 parent 8383436 commit 92f975f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/PHPStanTests/nsrt/preg-match.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ function doMatch(string $s): void
}
assertType('array{}|array{0: string, 1?: string|null}', $matches);

if (Preg::isMatch('/Price: (?P<currency>£|€)\d+/', $s, $matches)) {
assertType('array{0: string, 1: string|null, currency: string|null}', $matches);
if (Preg::isMatch('/Price: (?<currency>£|€)\d+/', $s, $matches)) {
assertType('array{0: string, currency: string|null, 1: string|null}', $matches);
} else {
assertType('array{}', $matches);
}
assertType('array{}|array{0: string, 1?: string|null}', $matches);
assertType('array{}|array{0: string, currency: string|null, 1: string|null}', $matches);
}

// disabled until https://github.com/phpstan/phpstan-src/pull/3185 can be resolved
Expand Down

0 comments on commit 92f975f

Please sign in to comment.