Skip to content

Commit

Permalink
moved php 8.2 only test
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed May 16, 2024
1 parent aedcb4e commit 059ebae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 0 additions & 7 deletions tests/PHPStan/Analyser/data/preg_match_shapes.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ function doUnknownFlags(string $s, int $flags): void {
assertType('array<array{string|null, int<-1, max>}|string|null>', $matches);
}

function doNonAutoCapturingFlag(string $s): void {
if (preg_match('/(\d+)/n', $s, $matches)) {
assertType('array{string}', $matches);
}
assertType('array<string>', $matches);
}

function doNonAutoCapturingModifier(string $s): void {
if (preg_match('/(?n)(\d+)/', $s, $matches)) {
assertType('array{string}', $matches);
Expand Down
10 changes: 10 additions & 0 deletions tests/PHPStan/Analyser/data/preg_match_shapes_php82.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ function doOnlyNamedSubpattern(string $s): void {
}
assertType('array<string>', $matches);
}

// n modifier captures only named groups
// https://php.watch/versions/8.2/preg-n-no-capture-modifier
function doNonAutoCapturingFlag(string $s): void {
if (preg_match('/(\d+)/n', $s, $matches)) {
assertType('array{string}', $matches);
}
assertType('array<string>', $matches);
}

0 comments on commit 059ebae

Please sign in to comment.