diff --git a/resources/functionMap_bleedingEdge.php b/resources/functionMap_bleedingEdge.php index ed9768c9f6..f154d74d5f 100644 --- a/resources/functionMap_bleedingEdge.php +++ b/resources/functionMap_bleedingEdge.php @@ -107,6 +107,7 @@ 'ImagickKernel::scale' => ['void', 'scale'=>'float', 'normalizeFlag'=>'Imagick::NORMALIZE_KERNEL_*'], 'max' => ['', '...arg1'=>'non-empty-array'], 'min' => ['', '...arg1'=>'non-empty-array'], + 'file' => ['list|false', 'filename'=>'string', 'flags='=>'0|FILE_USE_INCLUDE_PATH|FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES', 'context='=>'resource'], ], 'old' => [ diff --git a/tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php b/tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php index 67a9726043..b5ecc1ae9e 100644 --- a/tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php +++ b/tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php @@ -1368,4 +1368,14 @@ public function testBenevolentSuperglobalKeys(): void $this->analyse([__DIR__ . '/data/benevolent-superglobal-keys.php'], []); } + public function testFileParams(): void + { + $this->analyse([__DIR__ . '/data/file.php'], [ + [ + 'Parameter #2 $flags of function file expects 0|1|2|4, 8 given.', + 16, + ], + ]); + } + } diff --git a/tests/PHPStan/Rules/Functions/data/file.php b/tests/PHPStan/Rules/Functions/data/file.php new file mode 100644 index 0000000000..77c32f64af --- /dev/null +++ b/tests/PHPStan/Rules/Functions/data/file.php @@ -0,0 +1,18 @@ +