Skip to content

Commit

Permalink
php 7.2/7.3 expectation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Jun 21, 2024
1 parent 28103f8 commit 891a631
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 7 additions & 1 deletion tests/PHPStan/Analyser/data/param-out-php7.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ function fooMatch(string $input): void {
assertType('list<array<string>>', $matches);

preg_match('/@[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}(?!\w)/', $input, $matches, PREG_UNMATCHED_AS_NULL);
assertType("array{0?: string}", $matches);
assertType("array<string|null>", $matches);
}

function testMatch() {
preg_match('#.*#', 'foo', $matches);
assertType('array<string>', $matches);
}


5 changes: 5 additions & 0 deletions tests/PHPStan/Analyser/data/param-out-php8.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ function fooMatch(string $input): void {
assertType("array{0?: string}", $matches);
}

function testMatch() {
preg_match('#.*#', 'foo', $matches);
assertType('array{0?: string}', $matches);
}

5 changes: 0 additions & 5 deletions tests/PHPStan/Analyser/data/param-out.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,6 @@ function fooDateTime(\SplFileObject $splFileObject, ?string $wouldBlock) {
assertType('string', $wouldBlock);
}

function testMatch() {
preg_match('#.*#', 'foo', $matches);
assertType('array{0?: string}', $matches);
}

function testParseStr() {
$str="first=value&arr[]=foo+bar&arr[]=baz";
parse_str($str, $output);
Expand Down

0 comments on commit 891a631

Please sign in to comment.