Skip to content

Commit

Permalink
getimagesize, getimagesizefromstring zero is a possible value for hei…
Browse files Browse the repository at this point in the history
…ght and width
  • Loading branch information
Markus Fruehauf authored and ondrejmirtes committed Jul 2, 2024
1 parent e685c40 commit 123e2ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions resources/functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3331,8 +3331,8 @@
'gethostbyname' => ['string', 'hostname'=>'string'],
'gethostbynamel' => ['list<string>|false', 'hostname'=>'string'],
'gethostname' => ['string|false'],
'getimagesize' => ['array{0: positive-int, 1: positive-int, 2: int, 3: string, mime: string, channels?: int, bits?: int}|false', 'imagefile'=>'string', '&w_info='=>'array'],
'getimagesizefromstring' => ['array{0: positive-int, 1: positive-int, 2: int, 3: string, mime: string, channels?: int, bits?: int}|false', 'data'=>'string', '&w_info='=>'array'],
'getimagesize' => ['array{0: 0|positive-int, 1: 0|positive-int, 2: int, 3: string, mime: string, channels?: int, bits?: int}|false', 'imagefile'=>'string', '&w_info='=>'array'],
'getimagesizefromstring' => ['array{0: 0|positive-int, 1: 0|positive-int, 2: int, 3: string, mime: string, channels?: int, bits?: int}|false', 'data'=>'string', '&w_info='=>'array'],
'getlastmod' => ['int|false'],
'getmxrr' => ['bool', 'hostname'=>'string', '&w_mxhosts'=>'array', '&w_weight='=>'array'],
'getmygid' => ['int|false'],
Expand Down
8 changes: 4 additions & 4 deletions tests/PHPStan/Analyser/nsrt/image-size.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ function imageFoo(): void

list($width, $height, $type, $attr) = $imagesize;

assertType('int<1, max>', $width);
assertType('int<1, max>', $height);
assertType('int<0, max>', $width);
assertType('int<0, max>', $height);
assertType('int', $type);
assertType('string', $attr);
assertType('string', $imagesize['mime']);
Expand All @@ -31,8 +31,8 @@ function imagesizeFoo(string $s): void
}
list($width, $height, $type, $attr) = $imagesize;

assertType('int<1, max>', $width);
assertType('int<1, max>', $height);
assertType('int<0, max>', $width);
assertType('int<0, max>', $height);
assertType('int', $type);
assertType('string', $attr);
assertType('string', $imagesize['mime']);
Expand Down

0 comments on commit 123e2ac

Please sign in to comment.