1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Added support for preg_grep (#2523)

This commit is contained in:
Bruce Weirdan 2019-12-29 18:05:08 +02:00 committed by Matthew Brown
parent b375ebf06f
commit 7d3dd47efa
2 changed files with 23 additions and 0 deletions

View File

@ -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)
{
}

View File

@ -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]);