Skip to content

Commit

Permalink
Add test cases for non-strict array_search()
Browse files Browse the repository at this point in the history
  • Loading branch information
takaram committed Nov 6, 2022
1 parent e28d665 commit cdab81a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/PHPStan/Analyser/data/bug-3789.php
Expand Up @@ -11,7 +11,13 @@ function doFoo(string $needle, array $haystack): void {
assertType('0|1|2|false', array_search($needle, $haystack, true));
assertType('0|1|2|false', array_search('foo', $haystack, true));

assertType('0|1|2|false', array_search($needle, $haystack));
assertType('0|1|2|false', array_search('foo', $haystack));

$haystack[1] = 'foo';
assertType('0|1|2|false', array_search($needle, $haystack, true));
assertType('0|1|2', array_search('foo', $haystack, true));

assertType('0|1|2|false', array_search($needle, $haystack));
assertType('0|1|2|false', array_search('foo', $haystack));
}

0 comments on commit cdab81a

Please sign in to comment.