Skip to content

Commit

Permalink
fix tests per php version
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed May 16, 2024
1 parent 2269138 commit e05d70e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions tests/PHPStan/Analyser/NodeScopeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1479,15 +1479,17 @@ public function dataFileAsserts(): iterable
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-10952.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-10952b.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/case-insensitive-parent.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-10893.php');


if (PHP_VERSION_ID < 70400) {
yield from $this->gatherAssertTypes(__DIR__ . '/data/preg_match_shapes_php73.php');
} else {
yield from $this->gatherAssertTypes(__DIR__ . '/data/preg_match_shapes.php');
}
if (PHP_VERSION_ID >= 80200) {
yield from $this->gatherAssertTypes(__DIR__ . '/data/preg_match_shapes_php82.php');
}
yield from $this->gatherAssertTypes(__DIR__ . '/data/preg_match_shapes.php');

yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-10893.php');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/data/preg_match_shapes.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function doOffsetCaptureWithUnmatchedNull(string $s): void {
}

function doUnknownFlags(string $s, int $flags): void {
if (preg_match('/(foo)(bar)(baz)/', 'foobarbaz', $matches, $flags)) {
if (preg_match('/(foo)(bar)(baz)/', $s, $matches, $flags)) {
assertType('array<array{string|null, int<-1, max>}|string|null>', $matches);
}
assertType('array<array{string|null, int<-1, max>}|string|null>', $matches);
Expand Down

0 comments on commit e05d70e

Please sign in to comment.