Skip to content
Permalink
Browse files

Added support for preg_grep (#2523)

  • Loading branch information
weirdan authored and muglug committed Dec 29, 2019
1 parent b375ebf commit 7d3dd47efa82c420c2ef43f89643e625e6e658dc
Showing with 23 additions and 0 deletions.
  1. +12 −0 src/Psalm/Internal/Stubs/CoreGenericFunctions.php
  2. +11 −0 tests/FunctionCallTest.php
@@ -231,3 +231,15 @@ function array_merge_recursive(array $arr, array ...$arr2)
function array_fill_keys(array $keys, $value): array
{
}

/**
* @template TKey
*
* @param string $pattern
* @param array<TKey,string> $input
* @param 0|1 $flags 1=PREG_GREP_INVERT
* @return array<TKey,string>
*/
function preg_grep($pattern, array $input, $flags = 0)
{
}
@@ -14,6 +14,17 @@ class FunctionCallTest extends TestCase
public function providerValidCodeParse()
{
return [
'preg_grep' => [
'<?php
/**
* @param array<int,string> $strings
* @return array<int,string>
*/
function filter(array $strings): array {
return preg_grep("/search/", $strings, PREG_GREP_INVERT);
}
'
],
'arrayFilter' => [
'<?php
$d = array_filter(["a" => 5, "b" => 12, "c" => null]);

0 comments on commit 7d3dd47

Please sign in to comment.
You can’t perform that action at this time.