@@ -2362,7 +2362,7 @@ private function writeObjPicture(int $colL, int $dxL, int $rwT, int|float $dyT,
23622362 *
23632363 * @param GdImage $image The image to process
23642364 *
2365- * @return array Array with data and properties of the bitmap
2365+ * @return array{0: float, 1: float, 2: int, 3: string} Data and properties of the bitmap
23662366 */
23672367 public function processBitmapGd (GdImage $ image ): array
23682368 {
@@ -2372,9 +2372,9 @@ public function processBitmapGd(GdImage $image): array
23722372 $ data = pack ('Vvvvv ' , 0x000C , $ width , $ height , 0x01 , 0x18 );
23732373 for ($ j = $ height ; --$ j ;) {
23742374 for ($ i = 0 ; $ i < $ width ; ++$ i ) {
2375- /** @phpstan-ignore-next-line */
2376- $ color = imagecolorsforindex ( $ image , imagecolorat ( $ image , $ i , $ j ));
2377- if ( $ color !== false ) {
2375+ $ colorAt = imagecolorat ( $ image , $ i , $ j );
2376+ if ( $ colorAt !== false ) {
2377+ $ color = imagecolorsforindex ( $ image , $ colorAt );
23782378 foreach (['red ' , 'green ' , 'blue ' ] as $ key ) {
23792379 $ color [$ key ] = $ color [$ key ] + (int ) round ((255 - $ color [$ key ]) * $ color ['alpha ' ] / 127 );
23802380 }
@@ -2385,8 +2385,11 @@ public function processBitmapGd(GdImage $image): array
23852385 $ data .= str_repeat ("\x00" , 4 - 3 * $ width % 4 );
23862386 }
23872387 }
2388+ // Phpstan says this always throws an exception before getting here.
2389+ // I don't see why, but I think this is code is never exercised
2390+ // in unit tests, so I can't say for sure it's wrong.
23882391
2389- return [$ width , $ height , strlen ($ data ), $ data ];
2392+ return [$ width , $ height , strlen ($ data ), $ data ]; //* @phpstan-ignore-line
23902393 }
23912394
23922395 /**
0 commit comments