Skip to content

Commit e4e9650

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Fix some imagecolor*() return types
2 parents 4744dc8 + 8bcaaa3 commit e4e9650

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

ext/gd/gd.stub.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ function imagelayereffect(GdImage $image, int $effect): bool {}
3737

3838
function imagecolorallocatealpha(GdImage $image, int $red, int $green, int $blue, int $alpha): int|false {}
3939

40-
function imagecolorresolvealpha(GdImage $image, int $red, int $green, int $blue, int $alpha): int|false {}
40+
function imagecolorresolvealpha(GdImage $image, int $red, int $green, int $blue, int $alpha): int {}
4141

42-
function imagecolorclosestalpha(GdImage $image, int $red, int $green, int $blue, int $alpha): int|false {}
42+
function imagecolorclosestalpha(GdImage $image, int $red, int $green, int $blue, int $alpha): int {}
4343

4444
function imagecolorexactalpha(GdImage $image, int $red, int $green, int $blue, int $alpha): int|false {}
4545

@@ -142,15 +142,15 @@ function imagepalettecopy(GdImage $dst, GdImage $src): void {}
142142

143143
function imagecolorat(GdImage $image, int $x, int $y): int|false {}
144144

145-
function imagecolorclosest(GdImage $image, int $red, int $green, int $blue): int|false {}
145+
function imagecolorclosest(GdImage $image, int $red, int $green, int $blue): int {}
146146

147-
function imagecolorclosesthwb(GdImage $image, int $red, int $green, int $blue): int|false {}
147+
function imagecolorclosesthwb(GdImage $image, int $red, int $green, int $blue): int {}
148148

149149
function imagecolordeallocate(GdImage $image, int $color): bool {}
150150

151-
function imagecolorresolve(GdImage $image, int $red, int $green, int $blue): int|false {}
151+
function imagecolorresolve(GdImage $image, int $red, int $green, int $blue): int {}
152152

153-
function imagecolorexact(GdImage $image, int $red, int $green, int $blue): int|false {}
153+
function imagecolorexact(GdImage $image, int $red, int $green, int $blue): int {}
154154

155155
function imagecolorset(GdImage $image, int $color, int $red, int $green, int $blue, int $alpha = 0): ?bool {}
156156

ext/gd/gd_arginfo.h

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 6d0c2e29e9626c161b33baa2b987e9f8f8441669 */
2+
* Stub hash: 4db5a04f57436fffff4d34f4e44db7b7fdc39874 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gd_info, 0, 0, IS_ARRAY, 0)
55
ZEND_END_ARG_INFO()
@@ -81,9 +81,15 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imagecolorallocatealpha, 0, 5, M
8181
ZEND_ARG_TYPE_INFO(0, alpha, IS_LONG, 0)
8282
ZEND_END_ARG_INFO()
8383

84-
#define arginfo_imagecolorresolvealpha arginfo_imagecolorallocatealpha
84+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolorresolvealpha, 0, 5, IS_LONG, 0)
85+
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)
86+
ZEND_ARG_TYPE_INFO(0, red, IS_LONG, 0)
87+
ZEND_ARG_TYPE_INFO(0, green, IS_LONG, 0)
88+
ZEND_ARG_TYPE_INFO(0, blue, IS_LONG, 0)
89+
ZEND_ARG_TYPE_INFO(0, alpha, IS_LONG, 0)
90+
ZEND_END_ARG_INFO()
8591

86-
#define arginfo_imagecolorclosestalpha arginfo_imagecolorallocatealpha
92+
#define arginfo_imagecolorclosestalpha arginfo_imagecolorresolvealpha
8793

8894
#define arginfo_imagecolorexactalpha arginfo_imagecolorallocatealpha
8995

@@ -276,18 +282,23 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imagecolorat, 0, 3, MAY_BE_LONG|
276282
ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
277283
ZEND_END_ARG_INFO()
278284

279-
#define arginfo_imagecolorclosest arginfo_imagecolorallocate
285+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolorclosest, 0, 4, IS_LONG, 0)
286+
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)
287+
ZEND_ARG_TYPE_INFO(0, red, IS_LONG, 0)
288+
ZEND_ARG_TYPE_INFO(0, green, IS_LONG, 0)
289+
ZEND_ARG_TYPE_INFO(0, blue, IS_LONG, 0)
290+
ZEND_END_ARG_INFO()
280291

281-
#define arginfo_imagecolorclosesthwb arginfo_imagecolorallocate
292+
#define arginfo_imagecolorclosesthwb arginfo_imagecolorclosest
282293

283294
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolordeallocate, 0, 2, _IS_BOOL, 0)
284295
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)
285296
ZEND_ARG_TYPE_INFO(0, color, IS_LONG, 0)
286297
ZEND_END_ARG_INFO()
287298

288-
#define arginfo_imagecolorresolve arginfo_imagecolorallocate
299+
#define arginfo_imagecolorresolve arginfo_imagecolorclosest
289300

290-
#define arginfo_imagecolorexact arginfo_imagecolorallocate
301+
#define arginfo_imagecolorexact arginfo_imagecolorclosest
291302

292303
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolorset, 0, 5, _IS_BOOL, 1)
293304
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)

0 commit comments

Comments
 (0)