Skip to content

Commit d1860cd

Browse files
authored
Support FILE_NO_DEFAULT_CONTEXT in file()
1 parent c26d114 commit d1860cd

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='=>'int-mask<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|FILE_NO_DEFAULT_CONTEXT>', '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 int<0, 7>, 8 given.',
1375+
'Parameter #2 $flags of function file expects 0|1|2|3|4|5|6|7|16|17|18|19|20|21|22|23, 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
@@ -16,6 +16,10 @@ public function error():void {
1616
$f = file(__FILE__, FILE_APPEND);
1717
}
1818

19+
public function noContext():void {
20+
$f = file(__FILE__, FILE_NO_DEFAULT_CONTEXT);
21+
}
22+
1923
public function doFoo():void {
2024
$fileLines = file(__FILE__, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
2125
}

0 commit comments

Comments
 (0)