Skip to content

Incorrect \Imagick::identifyImage() return type #10888

@SVillette

Description

@SVillette

Bug report

Hello,
Analysis of \Imagick::identifyImage() is incorrect. As you can see in the first example in the PHP documentation https://www.php.net/manual/en/imagick.identifyimage.php, the method return an array with more than width and height. And about these two keys, the mapping is also incorrect as width and height are in a nested array with geometry key.

Example:

array:11 [
  "imageName" => "foo.pdf"
  "mimetype" => "application/pdf"
  "format" => "PDF (Portable Document Format)"
  "units" => "Undefined"
  "colorSpace" => "sRGB"
  "type" => "Bilevel"
  "compression" => "Undefined"
  "fileSize" => "5945B"
  "geometry" => array:2 [
    "width" => 842
    "height" => 595
  ]
  "resolution" => array:2 [
    "x" => 72.0
    "y" => 72.0
  ]
  "signature" => "foo"
]

Code snippet that reproduces the problem

https://phpstan.org/r/a33b5101-d293-4da3-b4ef-cc71736ee6f4

Expected output

I think PHPStan return type of \Imagick::identifyImage() should be updated

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions