Skip to content

Commit 43d3ac4

Browse files
thg2kondrejmirtes
authored andcommitted
Fix wrong fread() length parameter type and return type
1 parent b482a5b commit 43d3ac4

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

resources/functionMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3003,7 +3003,7 @@
30033003
'fprintf' => ['int', 'stream'=>'resource', 'format'=>'string', '...values='=>'__stringAndStringable|int|float|null|bool'],
30043004
'fputcsv' => ['0|positive-int|false', 'fp'=>'resource', 'fields'=>'array<int|string, __stringAndStringable|int|float|null|bool>', 'delimiter='=>'string', 'enclosure='=>'string', 'escape_char='=>'string'],
30053005
'fputs' => ['0|positive-int|false', 'fp'=>'resource', 'str'=>'string', 'length='=>'0|positive-int'],
3006-
'fread' => ['string|false', 'fp'=>'resource', 'length'=>'0|positive-int'],
3006+
'fread' => ['string', 'fp'=>'resource', 'length'=>'positive-int'],
30073007
'frenchtojd' => ['int', 'month'=>'int', 'day'=>'int', 'year'=>'int'],
30083008
'fribidi_log2vis' => ['string', 'str'=>'string', 'direction'=>'string', 'charset'=>'int'],
30093009
'fscanf' => ['list<mixed>|int|false', 'stream'=>'resource', 'format'=>'string', '&...w_vars='=>'string|int|float|null'],

resources/functionMap_php74delta.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
'FFI::string' => ['string', '&ptr'=>'FFI\CData', 'size='=>'int'],
3939
'FFI::typeof' => ['FFI\CType', '&ptr'=>'FFI\CData'],
4040
'FFI::type' => ['FFI\CType', 'type'=>'string'],
41+
'fread' => ['string|false', 'fp'=>'resource', 'length'=>'positive-int'],
4142
'get_mangled_object_vars' => ['array', 'obj'=>'object'],
4243
'mb_str_split' => ['list<string>|false', 'str'=>'string', 'split_length='=>'int', 'encoding='=>'string'],
4344
'password_algos' => ['list<string>'],

tests/PHPStan/Analyser/NodeScopeResolverTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,9 @@ public function dataFileAsserts(): iterable
707707
yield from $this->gatherAssertTypes(__DIR__ . '/data/array-unpacking-string-keys.php');
708708
}
709709

710-
yield from $this->gatherAssertTypes(__DIR__ . '/data/filesystem-functions.php');
710+
if (PHP_VERSION_ID >= 70400) {
711+
yield from $this->gatherAssertTypes(__DIR__ . '/data/filesystem-functions.php');
712+
}
711713

712714
yield from $this->gatherAssertTypes(__DIR__ . '/data/filter-input.php');
713715
if (PHP_VERSION_ID >= 80000) {

0 commit comments

Comments
 (0)