Skip to content

Commit

Permalink
Fix preg_match_all behaviour with no flags
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Mar 29, 2024
1 parent 491a724 commit a856ec7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stubs/core.stub
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function sscanf(string $string, string $format, &$war, &...$vars) {}
* ? list<array<?string>>
* : (TFlags is 770
* ? list<array<array{?string, int}>>
* : array<mixed>
* : (TFlags is 0 ? array<list<string>> : array<mixed>)
* )
* )
* )
Expand Down
6 changes: 6 additions & 0 deletions tests/PHPStan/Analyser/data/param-out-default.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,10 @@ public function doBar(): void
assertType('array<int>', $c);
}

public function sayHello(string $row): void
{
preg_match_all('#// error:(.+)#', $row, $matches);
assertType('array<list<string>>', $matches);
}

}

0 comments on commit a856ec7

Please sign in to comment.