php-svg-lib icon indicating copy to clipboard operation
php-svg-lib copied to clipboard

Address issues reported by phpstan

Open bsweeney opened this issue 6 months ago • 4 comments

phpstan reports the same warnings with both 8 and 9. They should probably be fixed regardless. The signatures are the same, so I imagine they are compatible.

I'm hesitant to fix these, though, because you're still supporting PHP 7.1, and maintaining compatibility with that is awkward. If yo ever release a new version, I'd recommend rector and updating to only supported versions of php.

Very low priority, I just noticed the new version of that library.

phpstan analyze src 29/29 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%


Line Svg/Style.php


89 Method Svg\Style::fromAttributes() should return Svg\Style but return statement is missing.
🪪 return.missing
91 Method Svg\Style::fromAttributes() should return Svg\Style but return statement is missing.
🪪 return.missing



Line Svg/Surface/CPdf.php


1109 Undefined variable: $object
🪪 variable.undefined
1111 Undefined variable: $object
🪪 variable.undefined
3624 Call to vsprintf contains 3 placeholders, 4 values given.
🪪 argument.vsprintf
3663 Call to vsprintf contains 3 placeholders, 4 values given.
🪪 argument.vsprintf



Line Svg/Surface/SurfaceCpdf.php


220 Call to an undefined method Svg\Surface\SurfaceCpdf::_convert_gif_bmp_to_png().
🪪 method.notFound


Originally posted by @tacman in https://github.com/dompdf/php-svg-lib/issues/132#issuecomment-3210877715

bsweeney avatar Aug 21 '25 15:08 bsweeney

Curiously _convert_gif_bmp_to_png does not exist for us, but some users seems to have it: https://github.com/search?q=%22_convert_gif_bmp_to_png%22&type=code

williamdes avatar Sep 18 '25 10:09 williamdes

Aha, it was renamed from _convert_gif_bmp_to_png to _convert_to_png in https://github.com/dompdf/dompdf/commit/beb89841a14d680b86db8eb1688959334f4a841c

williamdes avatar Sep 18 '25 10:09 williamdes

Svg/Surface/CPdf.php Line 1109 Undefined variable: $object Line 1111 Undefined variable: $object

@bsweeney you should look into this as it seems you changed the nearby code in the recent years

williamdes avatar Sep 18 '25 10:09 williamdes

I'll review differences between the Dompdf and SvgLib versions for the next release. Thanks for your efforts.

bsweeney avatar Sep 23 '25 12:09 bsweeney