From 140d629406d5b0445a3f692a2036f6272de60245 Mon Sep 17 00:00:00 2001 From: LolGleb Date: Tue, 29 Aug 2023 13:40:26 +0200 Subject: [PATCH 1/5] [phpstorm-stubs] Updated parameters for some functions in gd.php, odbc.php and xdebug.php. --- gd/gd.php | 20 +++++++-------- odbc/odbc.php | 62 ++++++++++++++++++++++++++++------------------- xdebug/xdebug.php | 2 +- 3 files changed, 48 insertions(+), 36 deletions(-) diff --git a/gd/gd.php b/gd/gd.php index a17deb3f5..81cfc892e 100644 --- a/gd/gd.php +++ b/gd/gd.php @@ -1038,7 +1038,7 @@ function imagepng(GdImage $image, $file = null, int $quality = -1, int $filters * @return bool true on success or false on failure. * @since 5.4 */ -function imagewebp($image, $to = null, $quality = 80): bool {} +function imagewebp($image, $to = null, $quality = -1): bool {} /** * Output image to browser or file @@ -1071,7 +1071,7 @@ function imagegif(GdImage $image, $file = null): bool {} *

* @return bool true on success or false on failure. */ -function imagejpeg($image, $file = null, $quality = null): bool {} +function imagejpeg($image, $file = null, $quality = -1): bool {} /** * Output image to browser or file @@ -1121,7 +1121,7 @@ function imagegd(GdImage $image, ?string $file = null): bool {} *

* @return bool true on success or false on failure. */ -function imagegd2(GdImage $image, ?string $file = null, int $chunk_size = 128, int $mode = IMG_GD2_RAW): bool {} +function imagegd2(GdImage $image, ?string $file = null, int $chunk_size = null, int $mode = null): bool {} /** * Destroy an image @@ -1618,7 +1618,7 @@ function imagedashedline(GdImage $image, int $x1, int $y1, int $x2, int $y2, int * corner seeing the text horizontally. */ #[Pure] -function imagettfbbox($size, $angle, $font_filename, $text) {} +function imagettfbbox($size, $angle, $font_filename, $text, array $options = []) {} /** * Write text to the image using TrueType fonts @@ -1729,10 +1729,10 @@ function imagettftext(GdImage $image, float $size, float $angle, int $x, int $y, * search for files that do not begin with a leading '/' by appending * '.ttf' to the filename and searching along a library-defined font path. *

- * @param string $text

+ * @param string $string

* The string to be measured. *

- * @param array $extrainfo [optional]

+ * @param array $options [optional]

* * Possible array indexes for extrainfo * @@ -1790,7 +1790,7 @@ function imagettftext(GdImage $image, float $size, float $angle, int $x, int $y, * Returns false on error. */ #[Pure] -function imageftbbox($size, $angle, $font_filename, $text, $extrainfo = null) {} +function imageftbbox($size, $angle, $font_filename, $string, $options = []) {} /** * Write text to the image using fonts using FreeType 2 @@ -1855,10 +1855,10 @@ function imageftbbox($size, $angle, $font_filename, $text, $extrainfo = null) {} * Note: * open_basedir does not apply to font_filename. *

- * @param string $text

+ * @param string $string

* Text to be inserted into image. *

- * @param array $extrainfo [optional]

+ * @param array $options [optional]

*

* Possible array indexes for extrainfo * @@ -1908,7 +1908,7 @@ function imageftbbox($size, $angle, $font_filename, $text, $extrainfo = null) {} * * Returns false on error. */ -function imagefttext($image, $size, $angle, $x, $y, $color, $font_filename, $text, $extrainfo = null) {} +function imagefttext($image, $size, $angle, $x, $y, $color, $font_filename, $string, $options = []) {} /** * Load a PostScript Type 1 font from file diff --git a/odbc/odbc.php b/odbc/odbc.php index 85af5b678..ad8e6ba61 100644 --- a/odbc/odbc.php +++ b/odbc/odbc.php @@ -124,7 +124,7 @@ function odbc_commit($connection_id) {} * @param string $password

* The password. *

- * @param int $cursor_type [optional]

+ * @param int $cursor_option [optional]

* This sets the type of cursor to be used * for this connection. This parameter is not normally needed, but * can be useful for working around problems with some ODBC drivers. @@ -135,7 +135,7 @@ function odbc_commit($connection_id) {} *

* @return resource|false an ODBC connection or (FALSE) on error. */ -function odbc_connect($dsn, $user, $password, $cursor_type = null) {} +function odbc_connect($dsn, $user, $password, $cursor_option = SQL_CUR_USE_DRIVER) {} /** * Get cursorname @@ -166,10 +166,10 @@ function odbc_data_source($connection_id, $fetch_type) {} /** * Execute a prepared statement * @link https://php.net/manual/en/function.odbc-execute.php - * @param resource $result_id

+ * @param resource $statement

* The result id resource, from odbc_prepare. *

- * @param array $parameters_array [optional]

+ * @param array $params [optional]

* Parameters in parameter_array will be * substituted for placeholders in the prepared statement in order. * Elements of this array will be converted to strings by calling this @@ -189,7 +189,7 @@ function odbc_data_source($connection_id, $fetch_type) {} * executing the query directly with odbc_exec). * @return bool TRUE on success or FALSE on failure. */ -function odbc_execute($result_id, array $parameters_array = null) {} +function odbc_execute($statement, array $params = []) {} /** * Get the last error code @@ -240,30 +240,30 @@ function odbc_exec($connection_id, $query_string, #[PhpStormStubsElementAvailabl /** * Fetch a result row as an associative array * @link https://php.net/manual/en/function.odbc-fetch-array.php - * @param resource $result

+ * @param resource $statement

* The result resource from odbc_exec. *

- * @param int $rownumber [optional]

+ * @param int $row [optional]

* Optionally choose which row number to retrieve. *

* @return array|false an array that corresponds to the fetched row, or FALSE if there * are no more rows. */ -function odbc_fetch_array($result, $rownumber = null) {} +function odbc_fetch_array($statement, $row = -1) {} /** * Fetch a result row as an object * @link https://php.net/manual/en/function.odbc-fetch-object.php - * @param resource $result

+ * @param resource $statement

* The result resource from odbc_exec. *

- * @param int $rownumber [optional]

+ * @param int $row [optional]

* Optionally choose which row number to retrieve. *

* @return object|false an object that corresponds to the fetched row, or FALSE if there * are no more rows. */ -function odbc_fetch_object($result, $rownumber = null) {} +function odbc_fetch_object($statement, $row = -1) {} /** * Fetch a row @@ -293,22 +293,22 @@ function odbc_fetch_row($result_id, $row_number = null) {} /** * Fetch one result row into array * @link https://php.net/manual/en/function.odbc-fetch-into.php - * @param resource $result_id

+ * @param resource $statement

* The result resource. *

- * @param array &$result_array

+ * @param array &$array

* The result array * that can be of any type since it will be converted to type * array. The array will contain the column values starting at array * index 0. *

- * @param int $rownumber [optional]

+ * @param int $row [optional]

* The row number. *

* @return int the number of columns in the result; * FALSE on error. */ -function odbc_fetch_into($result_id, array &$result_array, $rownumber = null) {} +function odbc_fetch_into($statement, array &$array, $row = 0) {} /** * Get the length (precision) of a field @@ -389,7 +389,7 @@ function odbc_free_result($result_id) {} /** * Retrieves information about data types supported by the data source * @link https://php.net/manual/en/function.odbc-gettypeinfo.php - * @param resource $connection_id

The ODBC connection identifier, + * @param resource $odbc

The ODBC connection identifier, * see odbc_connect for details.

* @param int $data_type [optional]

* The data type, which can be used to restrict the information to a @@ -419,7 +419,7 @@ function odbc_free_result($result_id) {} * The result set is ordered by DATA_TYPE and TYPE_NAME. *

*/ -function odbc_gettypeinfo($connection_id, $data_type = null) {} +function odbc_gettypeinfo($odbc, $data_type = 0) {} /** * Handling of LONG columns @@ -473,11 +473,11 @@ function odbc_num_rows($result_id) {} * @param string $dsn * @param string $user * @param string $password - * @param int $cursor_type [optional] + * @param int $cursor_option [optional] * @return resource|false an ODBC connection id or 0 (FALSE) on * error. */ -function odbc_pconnect($dsn, $user, $password, $cursor_type = null) {} +function odbc_pconnect($dsn, $user, $password, $cursor_option = SQL_CUR_USE_DRIVER) {} /** * Prepares a statement for execution @@ -511,7 +511,7 @@ function odbc_result($result_id, $field) {} /** * Print result as HTML table * @link https://php.net/manual/en/function.odbc-result-all.php - * @param resource $result_id

+ * @param resource $statement

* The result identifier. *

* @param string $format [optional]

@@ -520,7 +520,7 @@ function odbc_result($result_id, $field) {} * @return int|false the number of rows in the result or FALSE on error. * @deprecated 8.1 */ -function odbc_result_all($result_id, $format = null) {} +function odbc_result_all($statement, $format = '') {} /** * Rollback a transaction @@ -827,8 +827,13 @@ function odbc_foreignkeys($connection_id, $pk_qualifier, $pk_owner, $pk_table, $ /** * Get the list of procedures stored in a specific data source * @link https://php.net/manual/en/function.odbc-procedures.php - * @param resource $connection_id

The ODBC connection identifier, + * @param resource $odbc

The ODBC connection identifier, * see odbc_connect for details.

+ * @param string|null $catalog

The catalog ('qualifier' in ODBC 2 parlance).

+ * @param string|null $schema

The schema ('owner' in ODBC 2 parlance). This parameter accepts the + * following search patterns: % to match zero or more characters, and _ to match a single character.

+ * @param string|null $procedure

The proc. This parameter accepts the following search patterns: + * % to match zero or more characters, and _ to match a single character.

* @return resource|false

an ODBC * result identifier containing the information or FALSE on failure. *

@@ -844,13 +849,20 @@ function odbc_foreignkeys($connection_id, $pk_qualifier, $pk_owner, $pk_table, $ * PROCEDURE_TYPE *

*/ -function odbc_procedures($connection_id) {} +function odbc_procedures($odbc, $catalog = null, $schema = null, $procedure = null) {} /** * Retrieve information about parameters to procedures * @link https://php.net/manual/en/function.odbc-procedurecolumns.php - * @param resource $connection_id

The ODBC connection identifier, + * @param resource $odbc

The ODBC connection identifier, * see odbc_connect for details.

+ * @param string|null $catalog

The catalog ('qualifier' in ODBC 2 parlance).

+ * @param string|null $schema

The schema ('owner' in ODBC 2 parlance). This parameter accepts the + * following search patterns: % to match zero or more characters, and _ to match a single character.

+ * @param string|null $procedure

The proc. This parameter accepts the following search patterns: + * % to match zero or more characters, and _ to match a single character.

+ * @param string|null $column

The column. This parameter accepts the following search patterns: + * % to match zero or more characters, and _ to match a single character.

* @return resource|false

the list of input and output parameters, as well as the * columns that make up the result set for the specified procedures. * Returns an ODBC result identifier or FALSE on failure. @@ -872,7 +884,7 @@ function odbc_procedures($connection_id) {} * REMARKS *

*/ -function odbc_procedurecolumns($connection_id) {} +function odbc_procedurecolumns($odbc, $catalog = null, $schema = null, $procedure = null, $column = null) {} /** * Alias of odbc_exec diff --git a/xdebug/xdebug.php b/xdebug/xdebug.php index e4e68a8ad..c4e4b55db 100644 --- a/xdebug/xdebug.php +++ b/xdebug/xdebug.php @@ -3,7 +3,7 @@ /** * Show diagnostic information */ -function xdebug_info(string $category = '') {} +function xdebug_info(string $category = 'null') {} /** * Returns an array of ALL valid ini options with values and is not the same as ini_get_all() which returns only From a2b4a257e0dc297ad40374214849b764417f4e07 Mon Sep 17 00:00:00 2001 From: LolGleb Date: Wed, 30 Aug 2023 13:27:04 +0200 Subject: [PATCH 2/5] [phpstorm-stubs] Updated dockerfiles to make gd extension work. --- tests/DockerImages/5.6/Dockerfile | 4 +++- tests/DockerImages/7.0/Dockerfile | 4 +++- tests/DockerImages/7.1/Dockerfile | 4 +++- tests/DockerImages/7.2/Dockerfile | 4 +++- tests/DockerImages/7.3/Dockerfile | 4 +++- tests/DockerImages/7.4/Dockerfile | 4 +++- tests/DockerImages/8.0/Dockerfile | 4 +++- tests/DockerImages/8.1/Dockerfile | 4 +++- tests/DockerImages/8.2/Dockerfile | 4 +++- tests/DockerImages/8.3/Dockerfile | 4 +++- 10 files changed, 30 insertions(+), 10 deletions(-) diff --git a/tests/DockerImages/5.6/Dockerfile b/tests/DockerImages/5.6/Dockerfile index 5592f32d0..13508fded 100644 --- a/tests/DockerImages/5.6/Dockerfile +++ b/tests/DockerImages/5.6/Dockerfile @@ -4,7 +4,9 @@ RUN set -eux; \ bash gcc g++ make autoconf pkgconfig git \ libmcrypt-dev imap-dev php7-imap php7-enchant bzip2-dev gettext-dev libxml2-dev php7-dev php7-gd icu-dev \ php7-zip php7-tidy php7-intl libffi-dev openssl-dev php7-pear rabbitmq-c librrd libzip-dev rrdtool-dev \ - gmp-dev yaml yaml-dev fann fann-dev + gmp-dev yaml yaml-dev fann fann-dev libjpeg-turbo-dev libpng-dev libwebp-dev freetype-dev + +RUN docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-webp-dir=/usr --with-jpeg-dir=/usr RUN docker-php-ext-install imap gmp sockets intl bz2 mysqli bcmath calendar dba exif gettext opcache pcntl \ pdo_mysql shmop sysvmsg sysvsem sysvshm xml soap diff --git a/tests/DockerImages/7.0/Dockerfile b/tests/DockerImages/7.0/Dockerfile index a87b4db5b..c64e62f07 100644 --- a/tests/DockerImages/7.0/Dockerfile +++ b/tests/DockerImages/7.0/Dockerfile @@ -5,7 +5,9 @@ RUN set -eux; \ bash gcc g++ make autoconf pkgconfig git \ libmcrypt-dev imap-dev php7-imap php7-enchant bzip2-dev gettext-dev libxml2-dev php7-dev php7-gd icu-dev \ php7-zip php7-tidy php7-intl libffi-dev openssl-dev php7-pear rabbitmq-c librrd libzip-dev rrdtool-dev \ - gmp-dev yaml yaml-dev fann fann-dev aspell-dev + gmp-dev yaml yaml-dev fann fann-dev aspell-dev libjpeg-turbo-dev libpng-dev libwebp-dev freetype-dev + +RUN docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-webp-dir=/usr --with-jpeg-dir=/usr RUN docker-php-ext-install imap gmp sockets intl bz2 mysqli bcmath calendar dba exif gettext opcache pcntl \ pdo_mysql shmop sysvmsg sysvsem sysvshm xml soap pspell diff --git a/tests/DockerImages/7.1/Dockerfile b/tests/DockerImages/7.1/Dockerfile index da6e1de44..c83a52753 100644 --- a/tests/DockerImages/7.1/Dockerfile +++ b/tests/DockerImages/7.1/Dockerfile @@ -6,7 +6,9 @@ RUN set -eux; \ libmcrypt-dev imap-dev php7-imap php7-enchant bzip2-dev gettext-dev libxml2-dev php7-dev php7-gd icu-dev \ php7-zip php7-tidy php7-intl libffi-dev openssl-dev php7-pear rabbitmq-c rabbitmq-c-dev librrd \ libzip-dev rrdtool-dev gmp-dev yaml yaml-dev fann fann-dev openldap-dev librdkafka librdkafka-dev libcurl curl-dev \ - libpng-dev gpgme gpgme-dev aspell-dev + libpng-dev gpgme gpgme-dev aspell-dev libjpeg-turbo-dev libpng-dev libwebp-dev freetype-dev + +RUN docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-webp-dir=/usr --with-jpeg-dir=/usr RUN docker-php-ext-install imap gmp sockets intl gd ldap bz2 mysqli bcmath calendar dba exif gettext opcache pcntl \ pdo_mysql shmop sysvmsg sysvsem sysvshm xml soap pspell diff --git a/tests/DockerImages/7.2/Dockerfile b/tests/DockerImages/7.2/Dockerfile index 1d4611948..59925d362 100644 --- a/tests/DockerImages/7.2/Dockerfile +++ b/tests/DockerImages/7.2/Dockerfile @@ -6,7 +6,9 @@ RUN set -eux; \ libmcrypt-dev imap-dev php7-imap php7-enchant bzip2-dev gettext-dev libxml2-dev php7-dev php7-gd icu-dev \ php7-zip php7-tidy php7-intl libffi-dev openssl-dev php7-pear rabbitmq-c rabbitmq-c-dev librrd \ libzip-dev rrdtool-dev gmp-dev yaml yaml-dev fann fann-dev openldap-dev librdkafka librdkafka-dev libcurl curl-dev \ - libpng-dev gpgme gpgme-dev aspell-dev + libpng-dev gpgme gpgme-dev aspell-dev libjpeg-turbo-dev libpng-dev libwebp-dev freetype-dev + +RUN docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-webp-dir=/usr --with-jpeg-dir=/usr RUN docker-php-ext-install imap gmp sockets intl gd ldap bz2 mysqli bcmath calendar dba exif gettext opcache pcntl \ pdo_mysql shmop sysvmsg sysvsem sysvshm xml soap pspell diff --git a/tests/DockerImages/7.3/Dockerfile b/tests/DockerImages/7.3/Dockerfile index 307861dcf..0bdc1fa1d 100644 --- a/tests/DockerImages/7.3/Dockerfile +++ b/tests/DockerImages/7.3/Dockerfile @@ -6,7 +6,9 @@ RUN set -eux; \ libmcrypt-dev imap-dev php7-imap enchant2 php8-enchant bzip2-dev gettext-dev libxml2-dev php7-dev php7-gd icu-dev \ php7-zip php7-tidy php7-intl libffi-dev openssl-dev php7-pear rabbitmq-c rabbitmq-c-dev librrd \ libzip-dev rrdtool-dev gmp-dev yaml yaml-dev fann fann-dev openldap-dev librdkafka librdkafka-dev libcurl curl-dev \ - libpng-dev gpgme gpgme-dev libpq-dev aspell-dev + libpng-dev gpgme gpgme-dev libpq-dev aspell-dev libjpeg-turbo-dev libpng-dev libwebp-dev freetype-dev + +RUN docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-webp-dir=/usr --with-jpeg-dir=/usr RUN docker-php-ext-install imap gmp sockets intl gd ldap bz2 mysqli bcmath calendar dba exif gettext opcache pcntl \ pdo_mysql shmop sysvmsg sysvsem sysvshm xml soap pgsql pspell diff --git a/tests/DockerImages/7.4/Dockerfile b/tests/DockerImages/7.4/Dockerfile index d99adbfd3..22f747e60 100644 --- a/tests/DockerImages/7.4/Dockerfile +++ b/tests/DockerImages/7.4/Dockerfile @@ -6,7 +6,9 @@ RUN set -eux; \ libmcrypt-dev imap-dev enchant2 php8-enchant bzip2-dev gettext-dev libxml2-dev icu-dev \ libffi-dev openssl-dev rabbitmq-c rabbitmq-c-dev librrd \ libzip-dev rrdtool-dev gmp-dev yaml yaml-dev fann fann-dev openldap-dev librdkafka librdkafka-dev libcurl curl-dev \ - libpng-dev gpgme gpgme-dev libpq-dev aspell-dev + libpng-dev gpgme gpgme-dev libpq-dev aspell-dev libjpeg-turbo-dev libpng-dev libwebp-dev freetype-dev + +RUN docker-php-ext-configure gd --with-jpeg --with-webp --with-freetype RUN docker-php-ext-install imap gmp sockets intl gd ldap bz2 mysqli bcmath calendar dba exif gettext opcache pcntl \ pdo_mysql shmop sysvmsg sysvsem sysvshm xml soap pgsql pspell diff --git a/tests/DockerImages/8.0/Dockerfile b/tests/DockerImages/8.0/Dockerfile index 709315711..30d3f3f02 100644 --- a/tests/DockerImages/8.0/Dockerfile +++ b/tests/DockerImages/8.0/Dockerfile @@ -6,7 +6,9 @@ RUN set -eux; \ libmcrypt-dev imap-dev php8-imap enchant2 php8-enchant bzip2-dev gettext-dev libxml2-dev php8-dev php8-gd icu-dev \ php8-zip php8-tidy php8-intl libffi-dev openssl-dev php8-pear rabbitmq-c rabbitmq-c-dev librrd \ libzip-dev rrdtool-dev gmp-dev yaml yaml-dev fann fann-dev openldap-dev librdkafka librdkafka-dev libcurl curl-dev \ - libpng-dev gpgme gpgme-dev libpq-dev aspell-dev + libpng-dev gpgme gpgme-dev libpq-dev aspell-dev libjpeg-turbo-dev libpng-dev libwebp-dev freetype-dev + +RUN docker-php-ext-configure gd --with-jpeg --with-webp --with-freetype RUN docker-php-ext-install imap gmp sockets intl gd ldap bz2 mysqli bcmath calendar dba exif gettext opcache pcntl \ pdo_mysql shmop sysvmsg sysvsem sysvshm xml soap pgsql pspell diff --git a/tests/DockerImages/8.1/Dockerfile b/tests/DockerImages/8.1/Dockerfile index d6b728277..c4223ee08 100644 --- a/tests/DockerImages/8.1/Dockerfile +++ b/tests/DockerImages/8.1/Dockerfile @@ -6,7 +6,9 @@ RUN set -eux; \ libmcrypt-dev imap-dev php-imap enchant2 php-enchant bzip2-dev gettext-dev libxml2-dev php81-dev php-gd icu-dev \ php-zip php-tidy php-intl libffi-dev openssl-dev php81-pear rabbitmq-c rabbitmq-c-dev librrd \ libzip-dev rrdtool-dev gmp-dev yaml yaml-dev fann fann-dev openldap-dev librdkafka librdkafka-dev libcurl curl-dev \ - libpng-dev gpgme gpgme-dev libpq-dev aspell-dev + libpng-dev gpgme gpgme-dev libpq-dev aspell-dev libjpeg-turbo-dev libpng-dev libwebp-dev freetype-dev + +RUN docker-php-ext-configure gd --with-jpeg --with-webp --with-freetype RUN docker-php-ext-install imap gmp sockets intl gd ldap bz2 mysqli bcmath calendar dba exif gettext opcache pcntl \ pdo_mysql shmop sysvmsg sysvsem sysvshm xml soap pgsql pspell diff --git a/tests/DockerImages/8.2/Dockerfile b/tests/DockerImages/8.2/Dockerfile index 9d60d7554..010d6c073 100644 --- a/tests/DockerImages/8.2/Dockerfile +++ b/tests/DockerImages/8.2/Dockerfile @@ -6,7 +6,9 @@ RUN set -eux; \ libmcrypt-dev imap-dev php-imap enchant2 php-enchant bzip2-dev gettext-dev libxml2-dev php82-dev php-gd icu-dev \ php-zip php-tidy php-intl libffi-dev openssl-dev php82-pear rabbitmq-c rabbitmq-c-dev librrd \ libzip-dev rrdtool-dev gmp-dev yaml yaml-dev fann fann-dev openldap-dev librdkafka librdkafka-dev libcurl curl-dev \ - libpng-dev gpgme gpgme-dev libpq-dev aspell-dev + libpng-dev gpgme gpgme-dev libpq-dev aspell-dev libjpeg-turbo-dev libpng-dev libwebp-dev freetype-dev + +RUN docker-php-ext-configure gd --with-jpeg --with-webp --with-freetype RUN docker-php-ext-install imap gmp sockets intl gd ldap bz2 mysqli bcmath calendar dba exif gettext opcache pcntl \ pdo_mysql shmop sysvmsg sysvsem sysvshm xml soap pgsql pspell diff --git a/tests/DockerImages/8.3/Dockerfile b/tests/DockerImages/8.3/Dockerfile index 766eb15a0..4759154c1 100644 --- a/tests/DockerImages/8.3/Dockerfile +++ b/tests/DockerImages/8.3/Dockerfile @@ -6,7 +6,9 @@ RUN set -eux; \ libmcrypt-dev imap-dev php-imap enchant2 php-enchant bzip2-dev gettext-dev libxml2-dev php82-dev php-gd icu-dev \ php-zip php-tidy php-intl libffi-dev openssl-dev php82-pear rabbitmq-c rabbitmq-c-dev librrd \ libzip-dev rrdtool-dev gmp-dev yaml yaml-dev fann fann-dev openldap-dev librdkafka librdkafka-dev libcurl curl-dev \ - libpng-dev gpgme gpgme-dev libpq-dev aspell-dev + libpng-dev gpgme gpgme-dev libpq-dev aspell-dev libjpeg-turbo-dev libpng-dev libwebp-dev freetype-dev + +RUN docker-php-ext-configure gd --with-jpeg --with-webp --with-freetype RUN docker-php-ext-install imap gmp sockets intl gd ldap bz2 mysqli bcmath calendar dba exif gettext opcache pcntl \ pdo_mysql shmop sysvmsg sysvsem sysvshm xml soap pgsql pspell From 622a0f947eab847e4e10e82f61a8b6c74753d112 Mon Sep 17 00:00:00 2001 From: LolGleb Date: Wed, 30 Aug 2023 15:14:32 +0200 Subject: [PATCH 3/5] [phpstorm-stubs] Attempt to fix methods signature according to tests failures. --- gd/gd.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/gd/gd.php b/gd/gd.php index 81cfc892e..b2761404b 100644 --- a/gd/gd.php +++ b/gd/gd.php @@ -1028,9 +1028,9 @@ function imagepng(GdImage $image, $file = null, int $quality = -1, int $filters * Output a WebP image to browser or file * @link https://php.net/manual/en/function.imagewebp.php * @param resource|GdImage $image - * @param string $to [optional]

- * The path to save the file to. If not set or null, the raw image stream - * will be outputted directly. + * @param resource|string|null $file [optional]

+ * The path or an open stream resource (which is automatically closed after this function returns) + * to save the file to. If not set or null, the raw image stream will be output directly. *

* @param int $quality [optional]

* quality ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file). @@ -1038,7 +1038,7 @@ function imagepng(GdImage $image, $file = null, int $quality = -1, int $filters * @return bool true on success or false on failure. * @since 5.4 */ -function imagewebp($image, $to = null, $quality = -1): bool {} +function imagewebp(GdImage $image, $file = null, int $quality = -1): bool {} /** * Output image to browser or file @@ -1071,7 +1071,7 @@ function imagegif(GdImage $image, $file = null): bool {} *

* @return bool true on success or false on failure. */ -function imagejpeg($image, $file = null, $quality = -1): bool {} +function imagejpeg(GdImage $image, $file = null, int $quality = -1): bool {} /** * Output image to browser or file @@ -1569,9 +1569,10 @@ function imagedashedline(GdImage $image, int $x1, int $y1, int $x2, int $y2, int * search for files that do not begin with a leading '/' by appending * '.ttf' to the filename and searching along a library-defined font path. *

- * @param string $text

+ * @param string $string

* The string to be measured. *

+ * @param array $options [optional] * @return array|false imagettfbbox returns an array with 8 * elements representing four points making the bounding box of the * text on success and false on error. @@ -1618,7 +1619,7 @@ function imagedashedline(GdImage $image, int $x1, int $y1, int $x2, int $y2, int * corner seeing the text horizontally. */ #[Pure] -function imagettfbbox($size, $angle, $font_filename, $text, array $options = []) {} +function imagettfbbox(float $size, float $angle, string $font_filename, string $string, #[PhpStormStubsElementAvailable(from: '8.0')] $options = []): array|false {} /** * Write text to the image using TrueType fonts @@ -1703,6 +1704,7 @@ function imagettfbbox($size, $angle, $font_filename, $text, array $options = []) * If a character is used in the string which is not supported by the * font, a hollow rectangle will replace the character. *

+ * @param array $options [optional] * @return array|false an array with 8 elements representing four points making the * bounding box of the text. The order of the points is lower left, lower * right, upper right, upper left. The points are relative to the text @@ -1710,7 +1712,7 @@ function imagettfbbox($size, $angle, $font_filename, $text, array $options = []) * corner when you see the text horizontally. * Returns false on error. */ -function imagettftext(GdImage $image, float $size, float $angle, int $x, int $y, int $color, string $font_filename, string $text, array $options = []): array|false {} +function imagettftext(GdImage $image, float $size, float $angle, int $x, int $y, int $color, string $font_filename, string $text, #[PhpStormStubsElementAvailable(from: '8.0')] array $options = []): array|false {} /** * Give the bounding box of a text using fonts via freetype2 @@ -1790,7 +1792,7 @@ function imagettftext(GdImage $image, float $size, float $angle, int $x, int $y, * Returns false on error. */ #[Pure] -function imageftbbox($size, $angle, $font_filename, $string, $options = []) {} +function imageftbbox(float $size, float $angle, string $font_filename, string $string, array $options = []): array|false {} /** * Write text to the image using fonts using FreeType 2 @@ -1855,7 +1857,7 @@ function imageftbbox($size, $angle, $font_filename, $string, $options = []) {} * Note: * open_basedir does not apply to font_filename. *

- * @param string $string

+ * @param string $text

* Text to be inserted into image. *

* @param array $options [optional]

@@ -1908,7 +1910,7 @@ function imageftbbox($size, $angle, $font_filename, $string, $options = []) {} * * Returns false on error. */ -function imagefttext($image, $size, $angle, $x, $y, $color, $font_filename, $string, $options = []) {} +function imagefttext(GdImage $image, float $size, float $angle, int $x, int $y, int $color, string $font_filename, string $text, array $options = []): array|false {} /** * Load a PostScript Type 1 font from file From a1e00562958d96906191fb5a629872a8b3c8f086 Mon Sep 17 00:00:00 2001 From: LolGleb Date: Wed, 30 Aug 2023 16:46:42 +0200 Subject: [PATCH 4/5] [phpstorm-stubs] Last fix for typehint for imagettfbbox(). --- gd/gd.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gd/gd.php b/gd/gd.php index b2761404b..f3edfff20 100644 --- a/gd/gd.php +++ b/gd/gd.php @@ -1619,7 +1619,7 @@ function imagedashedline(GdImage $image, int $x1, int $y1, int $x2, int $y2, int * corner seeing the text horizontally. */ #[Pure] -function imagettfbbox(float $size, float $angle, string $font_filename, string $string, #[PhpStormStubsElementAvailable(from: '8.0')] $options = []): array|false {} +function imagettfbbox(float $size, float $angle, string $font_filename, string $string, #[PhpStormStubsElementAvailable(from: '8.0')] array $options = []): array|false {} /** * Write text to the image using TrueType fonts From cbe3eb24961eceee7879c326d8c375943cecbf32 Mon Sep 17 00:00:00 2001 From: LolGleb Date: Wed, 30 Aug 2023 17:08:16 +0200 Subject: [PATCH 5/5] [phpstorm-stubs] Added default values for parameters in imagegd2(). --- gd/gd.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gd/gd.php b/gd/gd.php index f3edfff20..43068286e 100644 --- a/gd/gd.php +++ b/gd/gd.php @@ -1121,7 +1121,7 @@ function imagegd(GdImage $image, ?string $file = null): bool {} *

* @return bool true on success or false on failure. */ -function imagegd2(GdImage $image, ?string $file = null, int $chunk_size = null, int $mode = null): bool {} +function imagegd2(GdImage $image, ?string $file = null, int $chunk_size = 128, int $mode = IMG_GD2_RAW): bool {} /** * Destroy an image