Skip to content

Commit fb6e84d

Browse files
committed
Fix return types being incorrectly marked as resources, fixes #546
1 parent 58ebfd6 commit fb6e84d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+521
-498
lines changed

generated/8.1/fileinfo.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ function finfo_close(finfo $finfo): void
3838
*
3939
* Passing NULL or an empty string will be equivalent to the default
4040
* value.
41-
* @return resource (Procedural style only)
41+
* @return finfo (Procedural style only)
4242
* Returns an finfo instance on success.
4343
* @throws FileinfoException
4444
*
4545
*/
46-
function finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null)
46+
function finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null): finfo
4747
{
4848
error_clear_last();
4949
if ($magic_database !== null) {

generated/8.1/ftp.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ function ftp_close(\FTP\Connection $ftp): void
132132
* If omitted, the default value is 90 seconds. The timeout can be changed and
133133
* queried at any time with ftp_set_option and
134134
* ftp_get_option.
135-
* @return resource Returns an FTP\Connection instance on success.
135+
* @return \FTP\Connection Returns an FTP\Connection instance on success.
136136
* @throws FtpException
137137
*
138138
*/
139-
function ftp_connect(string $hostname, int $port = 21, int $timeout = 90)
139+
function ftp_connect(string $hostname, int $port = 21, int $timeout = 90): \FTP\Connection
140140
{
141141
error_clear_last();
142142
$safeResult = \ftp_connect($hostname, $port, $timeout);
@@ -491,11 +491,11 @@ function ftp_site(\FTP\Connection $ftp, string $command): void
491491
* If omitted, the default value is 90 seconds. The timeout can be changed and
492492
* queried at any time with ftp_set_option and
493493
* ftp_get_option.
494-
* @return resource Returns an FTP\Connection instance on success.
494+
* @return \FTP\Connection Returns an FTP\Connection instance on success.
495495
* @throws FtpException
496496
*
497497
*/
498-
function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90)
498+
function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90): \FTP\Connection
499499
{
500500
error_clear_last();
501501
$safeResult = \ftp_ssl_connect($hostname, $port, $timeout);

generated/8.1/image.php

+40-40
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ function image_type_to_extension(int $image_type, bool $include_dot = true): str
105105
* such as imagecreatetruecolor.
106106
* @param array $affine Array with keys 0 to 5.
107107
* @param array $clip Array with keys "x", "y", "width" and "height"; or NULL.
108-
* @return resource Return affined image object on success.
108+
* @return \GdImage Return affined image object on success.
109109
* @throws ImageException
110110
*
111111
*/
112-
function imageaffine(\GdImage $image, array $affine, ?array $clip = null)
112+
function imageaffine(\GdImage $image, array $affine, ?array $clip = null): \GdImage
113113
{
114114
error_clear_last();
115115
if ($clip !== null) {
@@ -727,11 +727,11 @@ function imagecopyresized(\GdImage $dst_image, \GdImage $src_image, int $dst_x,
727727
*
728728
* @param int $width The image width.
729729
* @param int $height The image height.
730-
* @return resource Returns an image object on success.
730+
* @return \GdImage Returns an image object on success.
731731
* @throws ImageException
732732
*
733733
*/
734-
function imagecreate(int $width, int $height)
734+
function imagecreate(int $width, int $height): \GdImage
735735
{
736736
error_clear_last();
737737
$safeResult = \imagecreate($width, $height);
@@ -767,11 +767,11 @@ function imagecreatefromavif(string $filename): \GdImage
767767
* representing the image obtained from the given filename.
768768
*
769769
* @param string $filename Path to the BMP image.
770-
* @return resource Returns an image object on success.
770+
* @return \GdImage Returns an image object on success.
771771
* @throws ImageException
772772
*
773773
*/
774-
function imagecreatefrombmp(string $filename)
774+
function imagecreatefrombmp(string $filename): \GdImage
775775
{
776776
error_clear_last();
777777
$safeResult = \imagecreatefrombmp($filename);
@@ -786,11 +786,11 @@ function imagecreatefrombmp(string $filename)
786786
* Create a new image from GD file or URL.
787787
*
788788
* @param string $filename Path to the GD file.
789-
* @return resource Returns an image object on success.
789+
* @return \GdImage Returns an image object on success.
790790
* @throws ImageException
791791
*
792792
*/
793-
function imagecreatefromgd(string $filename)
793+
function imagecreatefromgd(string $filename): \GdImage
794794
{
795795
error_clear_last();
796796
$safeResult = \imagecreatefromgd($filename);
@@ -805,11 +805,11 @@ function imagecreatefromgd(string $filename)
805805
* Create a new image from GD2 file or URL.
806806
*
807807
* @param string $filename Path to the GD2 image.
808-
* @return resource Returns an image object on success.
808+
* @return \GdImage Returns an image object on success.
809809
* @throws ImageException
810810
*
811811
*/
812-
function imagecreatefromgd2(string $filename)
812+
function imagecreatefromgd2(string $filename): \GdImage
813813
{
814814
error_clear_last();
815815
$safeResult = \imagecreatefromgd2($filename);
@@ -828,11 +828,11 @@ function imagecreatefromgd2(string $filename)
828828
* @param int $y y-coordinate of source point.
829829
* @param int $width Source width.
830830
* @param int $height Source height.
831-
* @return resource Returns an image object on success.
831+
* @return \GdImage Returns an image object on success.
832832
* @throws ImageException
833833
*
834834
*/
835-
function imagecreatefromgd2part(string $filename, int $x, int $y, int $width, int $height)
835+
function imagecreatefromgd2part(string $filename, int $x, int $y, int $width, int $height): \GdImage
836836
{
837837
error_clear_last();
838838
$safeResult = \imagecreatefromgd2part($filename, $x, $y, $width, $height);
@@ -848,11 +848,11 @@ function imagecreatefromgd2part(string $filename, int $x, int $y, int $width, in
848848
* representing the image obtained from the given filename.
849849
*
850850
* @param string $filename Path to the GIF image.
851-
* @return resource Returns an image object on success.
851+
* @return \GdImage Returns an image object on success.
852852
* @throws ImageException
853853
*
854854
*/
855-
function imagecreatefromgif(string $filename)
855+
function imagecreatefromgif(string $filename): \GdImage
856856
{
857857
error_clear_last();
858858
$safeResult = \imagecreatefromgif($filename);
@@ -868,11 +868,11 @@ function imagecreatefromgif(string $filename)
868868
* representing the image obtained from the given filename.
869869
*
870870
* @param string $filename Path to the JPEG image.
871-
* @return resource Returns an image object on success.
871+
* @return \GdImage Returns an image object on success.
872872
* @throws ImageException
873873
*
874874
*/
875-
function imagecreatefromjpeg(string $filename)
875+
function imagecreatefromjpeg(string $filename): \GdImage
876876
{
877877
error_clear_last();
878878
$safeResult = \imagecreatefromjpeg($filename);
@@ -888,11 +888,11 @@ function imagecreatefromjpeg(string $filename)
888888
* representing the image obtained from the given filename.
889889
*
890890
* @param string $filename Path to the PNG image.
891-
* @return resource Returns an image object on success.
891+
* @return \GdImage Returns an image object on success.
892892
* @throws ImageException
893893
*
894894
*/
895-
function imagecreatefrompng(string $filename)
895+
function imagecreatefrompng(string $filename): \GdImage
896896
{
897897
error_clear_last();
898898
$safeResult = \imagecreatefrompng($filename);
@@ -910,13 +910,13 @@ function imagecreatefrompng(string $filename)
910910
* them: JPEG, PNG, GIF, BMP, WBMP, GD2, and WEBP.
911911
*
912912
* @param string $data A string containing the image data.
913-
* @return resource An image object will be returned on success. FALSE is returned if
913+
* @return \GdImage An image object will be returned on success. FALSE is returned if
914914
* the image type is unsupported, the data is not in a recognised format,
915915
* or the image is corrupt and cannot be loaded.
916916
* @throws ImageException
917917
*
918918
*/
919-
function imagecreatefromstring(string $data)
919+
function imagecreatefromstring(string $data): \GdImage
920920
{
921921
error_clear_last();
922922
$safeResult = \imagecreatefromstring($data);
@@ -952,11 +952,11 @@ function imagecreatefromtga(string $filename): \GdImage
952952
* representing the image obtained from the given filename.
953953
*
954954
* @param string $filename Path to the WBMP image.
955-
* @return resource Returns an image object on success.
955+
* @return \GdImage Returns an image object on success.
956956
* @throws ImageException
957957
*
958958
*/
959-
function imagecreatefromwbmp(string $filename)
959+
function imagecreatefromwbmp(string $filename): \GdImage
960960
{
961961
error_clear_last();
962962
$safeResult = \imagecreatefromwbmp($filename);
@@ -972,11 +972,11 @@ function imagecreatefromwbmp(string $filename)
972972
* representing the image obtained from the given filename.
973973
*
974974
* @param string $filename Path to the WebP image.
975-
* @return resource Returns an image object on success.
975+
* @return \GdImage Returns an image object on success.
976976
* @throws ImageException
977977
*
978978
*/
979-
function imagecreatefromwebp(string $filename)
979+
function imagecreatefromwebp(string $filename): \GdImage
980980
{
981981
error_clear_last();
982982
$safeResult = \imagecreatefromwebp($filename);
@@ -992,11 +992,11 @@ function imagecreatefromwebp(string $filename)
992992
* representing the image obtained from the given filename.
993993
*
994994
* @param string $filename Path to the XBM image.
995-
* @return resource Returns an image object on success.
995+
* @return \GdImage Returns an image object on success.
996996
* @throws ImageException
997997
*
998998
*/
999-
function imagecreatefromxbm(string $filename)
999+
function imagecreatefromxbm(string $filename): \GdImage
10001000
{
10011001
error_clear_last();
10021002
$safeResult = \imagecreatefromxbm($filename);
@@ -1012,11 +1012,11 @@ function imagecreatefromxbm(string $filename)
10121012
* representing the image obtained from the given filename.
10131013
*
10141014
* @param string $filename Path to the XPM image.
1015-
* @return resource Returns an image object on success.
1015+
* @return \GdImage Returns an image object on success.
10161016
* @throws ImageException
10171017
*
10181018
*/
1019-
function imagecreatefromxpm(string $filename)
1019+
function imagecreatefromxpm(string $filename): \GdImage
10201020
{
10211021
error_clear_last();
10221022
$safeResult = \imagecreatefromxpm($filename);
@@ -1033,11 +1033,11 @@ function imagecreatefromxpm(string $filename)
10331033
*
10341034
* @param int $width Image width.
10351035
* @param int $height Image height.
1036-
* @return resource Returns an image object on success.
1036+
* @return \GdImage Returns an image object on success.
10371037
* @throws ImageException
10381038
*
10391039
*/
1040-
function imagecreatetruecolor(int $width, int $height)
1040+
function imagecreatetruecolor(int $width, int $height): \GdImage
10411041
{
10421042
error_clear_last();
10431043
$safeResult = \imagecreatetruecolor($width, $height);
@@ -1057,11 +1057,11 @@ function imagecreatetruecolor(int $width, int $height)
10571057
* @param array $rectangle The cropping rectangle as array with keys
10581058
* x, y, width and
10591059
* height.
1060-
* @return resource Return cropped image object on success.
1060+
* @return \GdImage Return cropped image object on success.
10611061
* @throws ImageException
10621062
*
10631063
*/
1064-
function imagecrop(\GdImage $image, array $rectangle)
1064+
function imagecrop(\GdImage $image, array $rectangle): \GdImage
10651065
{
10661066
error_clear_last();
10671067
$safeResult = \imagecrop($image, $rectangle);
@@ -1081,12 +1081,12 @@ function imagecrop(\GdImage $image, array $rectangle)
10811081
* @param int $mode One of the following constants:
10821082
* @param float $threshold
10831083
* @param int $color
1084-
* @return resource Returns a cropped image object on success.
1084+
* @return \GdImage Returns a cropped image object on success.
10851085
* If the complete image was cropped, imagecrop returns FALSE.
10861086
* @throws ImageException
10871087
*
10881088
*/
1089-
function imagecropauto(\GdImage $image, int $mode = IMG_CROP_DEFAULT, float $threshold = 0.5, int $color = -1)
1089+
function imagecropauto(\GdImage $image, int $mode = IMG_CROP_DEFAULT, float $threshold = 0.5, int $color = -1): \GdImage
10901090
{
10911091
error_clear_last();
10921092
$safeResult = \imagecropauto($image, $mode, $threshold, $color);
@@ -1824,11 +1824,11 @@ function imagegif(\GdImage $image, $file = null): void
18241824
/**
18251825
* Grabs a screenshot of the whole screen.
18261826
*
1827-
* @return resource Returns an image object on success.
1827+
* @return \GdImage Returns an image object on success.
18281828
* @throws ImageException
18291829
*
18301830
*/
1831-
function imagegrabscreen()
1831+
function imagegrabscreen(): \GdImage
18321832
{
18331833
error_clear_last();
18341834
$safeResult = \imagegrabscreen();
@@ -2163,11 +2163,11 @@ function imageresolution(\GdImage $image, ?int $resolution_x = null, ?int $resol
21632163
* number of degrees to rotate the image anticlockwise.
21642164
* @param int $background_color Specifies the color of the uncovered zone after the rotation
21652165
* @param bool $ignore_transparent This parameter is unused.
2166-
* @return resource Returns an image object for the rotated image.
2166+
* @return \GdImage Returns an image object for the rotated image.
21672167
* @throws ImageException
21682168
*
21692169
*/
2170-
function imagerotate(\GdImage $image, float $angle, int $background_color, bool $ignore_transparent = false)
2170+
function imagerotate(\GdImage $image, float $angle, int $background_color, bool $ignore_transparent = false): \GdImage
21712171
{
21722172
error_clear_last();
21732173
$safeResult = \imagerotate($image, $angle, $background_color, $ignore_transparent);
@@ -2221,11 +2221,11 @@ function imagesavealpha(\GdImage $image, bool $enable): void
22212221
* IMG_WEIGHTED4 is not yet supported.
22222222
*
22232223
*
2224-
* @return resource Return the scaled image object on success.
2224+
* @return \GdImage Return the scaled image object on success.
22252225
* @throws ImageException
22262226
*
22272227
*/
2228-
function imagescale(\GdImage $image, int $width, int $height = -1, int $mode = IMG_BILINEAR_FIXED)
2228+
function imagescale(\GdImage $image, int $width, int $height = -1, int $mode = IMG_BILINEAR_FIXED): \GdImage
22292229
{
22302230
error_clear_last();
22312231
$safeResult = \imagescale($image, $width, $height, $mode);

generated/8.1/imap.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1796,11 +1796,11 @@ function imap_num_msg(\IMAP\Connection $imap): int
17961796
*
17971797
*
17981798
*
1799-
* @return resource Returns an IMAP\Connection instance on success.
1799+
* @return \IMAP\Connection Returns an IMAP\Connection instance on success.
18001800
* @throws ImapException
18011801
*
18021802
*/
1803-
function imap_open(string $mailbox, string $user, string $password, int $flags = 0, int $retries = 0, array $options = [])
1803+
function imap_open(string $mailbox, string $user, string $password, int $flags = 0, int $retries = 0, array $options = []): \IMAP\Connection
18041804
{
18051805
error_clear_last();
18061806
$safeResult = \imap_open($mailbox, $user, $password, $flags, $retries, $options);

generated/8.1/ldap.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ function ldap_first_attribute(\LDAP\Connection $ldap, \LDAP\ResultEntry $entry):
341341
*
342342
* @param \LDAP\Connection $ldap An LDAP\Connection instance, returned by ldap_connect.
343343
* @param \LDAP\Result $result An LDAP\Result instance, returned by ldap_list or ldap_search.
344-
* @return resource Returns an LDAP\ResultEntry instance.
344+
* @return \LDAP\ResultEntry Returns an LDAP\ResultEntry instance.
345345
* @throws LdapException
346346
*
347347
*/
348-
function ldap_first_entry(\LDAP\Connection $ldap, \LDAP\Result $result)
348+
function ldap_first_entry(\LDAP\Connection $ldap, \LDAP\Result $result): \LDAP\ResultEntry
349349
{
350350
error_clear_last();
351351
$safeResult = \ldap_first_entry($ldap, $result);

0 commit comments

Comments
 (0)