Skip to content

Commit c26d114

Browse files
authored
Fix int-mask in file()
1 parent a5768e3 commit c26d114

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

resources/functionMap_bleedingEdge.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
'ImagickKernel::scale' => ['void', 'scale'=>'float', 'normalizeFlag'=>'Imagick::NORMALIZE_KERNEL_*'],
108108
'max' => ['', '...arg1'=>'non-empty-array'],
109109
'min' => ['', '...arg1'=>'non-empty-array'],
110-
'file' => ['list<string>|false', 'filename'=>'string', 'flags='=>'0|FILE_USE_INCLUDE_PATH|FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES', 'context='=>'resource'],
110+
'file' => ['list<string>|false', 'filename'=>'string', 'flags='=>'int-mask<FILE_USE_INCLUDE_PATH|FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES>', 'context='=>'resource'],
111111
'flock' => ['bool', 'fp'=>'resource', 'operation'=>'int-mask<LOCK_SH, LOCK_EX, LOCK_UN, LOCK_NB>', '&w_wouldblock='=>'int'],
112112
],
113113
'old' => [

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ public function testFileParams(): void
13721372
{
13731373
$this->analyse([__DIR__ . '/data/file.php'], [
13741374
[
1375-
'Parameter #2 $flags of function file expects 0|1|2|4, 8 given.',
1375+
'Parameter #2 $flags of function file expects int<0, 7>, 8 given.',
13761376
16,
13771377
],
13781378
]);

tests/PHPStan/Rules/Functions/data/file.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ public function ok():void {
1515
public function error():void {
1616
$f = file(__FILE__, FILE_APPEND);
1717
}
18+
19+
public function doFoo():void {
20+
$fileLines = file(__FILE__, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
21+
}
1822
}

0 commit comments

Comments
 (0)