diff --git a/Core/Core.php b/Core/Core.php index c2e8267fb..ce599bdd5 100755 --- a/Core/Core.php +++ b/Core/Core.php @@ -11,7 +11,7 @@ * @return string the Zend Engine version number, as a string. */ #[Pure] -function zend_version () {} +function zend_version (): string {} /** * Returns the number of arguments passed to the function @@ -20,7 +20,7 @@ function zend_version () {} * function. */ #[Pure] -function func_num_args () {} +function func_num_args (): int {} /** * Return an item from the argument list @@ -32,7 +32,7 @@ function func_num_args () {} * @return mixed|false the specified argument, or false on error. */ #[Pure] -function func_get_arg (int $position) {} +function func_get_arg (int $position): mixed {} /** * Returns an array comprising a function's argument list @@ -41,7 +41,7 @@ function func_get_arg (int $position) {} * member of the current user-defined function's argument list. */ #[Pure] -function func_get_args () {} +function func_get_args (): array {} /** * Get string length @@ -53,7 +53,7 @@ function func_get_args () {} * and 0 if the string is empty. */ #[Pure] -function strlen (string $string) {} +function strlen (string $string): int {} /** * Binary safe string comparison @@ -64,13 +64,14 @@ function strlen (string $string) {} * @param string $string2

* The second string. *

- * @return int < 0 if str1 is less than + * @return int less 0 if str1 is less than * str2; > 0 if str1 * is greater than str2, and 0 if they are * equal. */ #[Pure] -function strcmp (string $string1, string $string2) {} +function strcmp (string $string1, string $string2): int +{} /** * Binary safe string comparison of the first n characters @@ -84,13 +85,14 @@ function strcmp (string $string1, string $string2) {} * @param int $length

* Number of characters to use in the comparison. *

- * @return int < 0 if str1 is less than + * @return int less 0 if str1 is less than * str2; > 0 if str1 * is greater than str2, and 0 if they are * equal. */ #[Pure] -function strncmp (string $string1, string $string2, int $length) {} +function strncmp (string $string1, string $string2, int $length): int +{} /** * Binary safe case-insensitive string comparison @@ -101,13 +103,14 @@ function strncmp (string $string1, string $string2, int $length) {} * @param string $string2

* The second string *

- * @return int < 0 if str1 is less than + * @return int less than 0 if str1 is less than * str2; > 0 if str1 * is greater than str2, and 0 if they are * equal. */ #[Pure] -function strcasecmp (string $string1, string $string2) {} +function strcasecmp (string $string1, string $string2): int +{} /** * Binary safe case-insensitive string comparison of the first n characters @@ -121,12 +124,13 @@ function strcasecmp (string $string1, string $string2) {} * @param int $length

* The length of strings to be used in the comparison. *

- * @return int < 0 if str1 is less than + * @return int less than 0 if str1 is less than * str2; > 0 if str1 is * greater than str2, and 0 if they are equal. */ #[Pure] -function strncasecmp (string $string1, string $string2, int $length) {} +function strncasecmp (string $string1, string $string2, int $length): int +{} /** * The function returns {@see true} if the passed $haystack starts from the @@ -185,7 +189,8 @@ function str_contains(string $haystack, string $needle) : bool {} * @removed 8.0 */ #[Deprecated(reason: "Use a foreach loop instead", since: "7.2")] -function each (array &$array) {} +function each (array &$array): array +{} /** * Sets which PHP errors are reported @@ -309,7 +314,8 @@ function each (array &$array) {} * level or the current level if no level parameter is * given. */ -function error_reporting (int $error_level) {} +function error_reporting (int $error_level): int +{} /** * Defines a named constant @@ -336,7 +342,8 @@ function error_reporting (int $error_level) {} *

* @return bool true on success or false on failure. */ -function define (string $constant_name, $value, #[Deprecated] bool $case_insensitive = false) {} +function define (string $constant_name, $value, #[Deprecated] bool $case_insensitive = false): bool +{} /** * Checks whether a given named constant exists @@ -348,7 +355,8 @@ function define (string $constant_name, $value, #[Deprecated] bool $case_insensi * has been defined, false otherwise. */ #[Pure] -function defined (string $constant_name) {} +function defined (string $constant_name): bool +{} /** * Returns the name of the class of an object @@ -356,24 +364,23 @@ function defined (string $constant_name) {} * @param object $object [optional]

* The tested object. This parameter may be omitted when inside a class. *

- * @return string|false

The name of the class of which object is an - * instance. Returns false if object is not an - * object. - *

- *

+ * @return string

The name of the class of which object is an + * instance. * If object is omitted when inside a class, the * name of that class is returned. */ #[Pure] -function get_class (object $object) {} +function get_class (object $object): string +{} /** * the "Late Static Binding" class name * @link https://php.net/manual/en/function.get-called-class.php - * @return string|false The class name. Returns false if called from outside a class. + * @return string */ #[Pure] -function get_called_class () {} +function get_called_class (): string +{} /** * Retrieves the parent class name for object or class @@ -391,7 +398,8 @@ function get_called_class () {} * If called without parameter outside object, this function returns false. */ #[Pure] -function get_parent_class (object|string $object_or_class) {} +function get_parent_class (object|string $object_or_class): string|false +{} /** * Checks if the class method exists @@ -407,7 +415,8 @@ function get_parent_class (object|string $object_or_class) {} * otherwise. */ #[Pure] -function method_exists (mixed $object_or_class, string $method) {} +function method_exists (mixed $object_or_class, string $method): bool +{} /** * Checks if the object or class has a property @@ -422,7 +431,8 @@ function method_exists (mixed $object_or_class, string $method) {} * null in case of an error. */ #[Pure] -function property_exists (mixed $object_or_class, string $property) {} +function property_exists (mixed $object_or_class, string $property): bool +{} /** * Checks if the trait exists @@ -432,7 +442,8 @@ function property_exists (mixed $object_or_class, string $property) {} * @link https://secure.php.net/manual/en/function.trait-exists.php * @since 5.4 */ -function trait_exists(string $trait, bool $autoload) {} +function trait_exists(string $trait, bool $autoload): bool +{} /** * Checks if the class has been defined @@ -446,7 +457,8 @@ function trait_exists(string $trait, bool $autoload) {} * @return bool true if class_name is a defined class, * false otherwise. */ -function class_exists (string $class, bool $autoload = true) {} +function class_exists (string $class, bool $autoload = true): bool +{} /** * Checks if the interface has been defined @@ -461,7 +473,8 @@ function class_exists (string $class, bool $autoload = true) {} * interface_name has been defined, false otherwise. * @since 5.0.2 */ -function interface_exists (string $interface, bool $autoload = true) {} +function interface_exists (string $interface, bool $autoload = true): bool +{} /** * Return true if the given function has been defined @@ -477,7 +490,8 @@ function interface_exists (string $interface, bool $autoload = true) {} * include_once and echo. */ #[Pure] -function function_exists (string $function) {} +function function_exists (string $function): bool +{} /** * Creates an alias for a class @@ -487,7 +501,8 @@ function function_exists (string $function) {} * @param bool $autoload [optional] Whether to autoload if the original class is not found. * @return bool true on success or false on failure. */ -function class_alias (string $class, string $alias, bool $autoload = true) {} +function class_alias (string $class, string $alias, bool $autoload = true): bool +{} /** * Returns an array with the names of included or required files @@ -504,7 +519,8 @@ function class_alias (string $class, string $alias, bool $autoload = true) {} * the returned array. */ #[Pure] -function get_included_files () {} +function get_included_files (): array +{} /** * Alias of get_included_files @@ -512,7 +528,8 @@ function get_included_files () {} * @return string[] */ #[Pure] -function get_required_files () {} +function get_required_files (): array +{} /** * checks if the object has this class as one of its parents or implements it @@ -532,7 +549,8 @@ function get_required_files () {} * class_name, false otherwise. */ #[Pure] -function is_subclass_of (mixed $object_or_class, string $class, bool $allow_string = true) {} +function is_subclass_of (mixed $object_or_class, string $class, bool $allow_string = true): bool +{} /** * Checks if the object is of this class or has this class as one of its parents @@ -551,7 +569,8 @@ function is_subclass_of (mixed $object_or_class, string $class, bool $allow_stri * its parents, FALSE otherwise. */ #[Pure] -function is_a (mixed $object_or_class, string $class, bool $allow_string = false) {} +function is_a (mixed $object_or_class, string $class, bool $allow_string = false): bool +{} /** * Get the default properties of the class @@ -565,7 +584,8 @@ function is_a (mixed $object_or_class, string $class, bool $allow_string = false * varname => value. */ #[Pure] -function get_class_vars (string $class) {} +function get_class_vars (string $class): array +{} /** * Gets the properties of the given object @@ -578,7 +598,8 @@ function get_class_vars (string $class) {} * not been assigned a value, it will be returned with a null value. */ #[Pure] -function get_object_vars (object $object) {} +function get_object_vars (object $object): array +{} /** * Gets the class methods' names @@ -590,7 +611,8 @@ function get_object_vars (object $object) {} * class_name. In case of an error, it returns null. */ #[Pure] -function get_class_methods (object|string $object_or_class) {} +function get_class_methods (object|string $object_or_class): array +{} /** * Generates a user-level error/warning/notice message @@ -607,7 +629,8 @@ function get_class_methods (object|string $object_or_class) {} * @return bool This function returns false if wrong error_type is * specified, true otherwise. */ -function trigger_error (string $message, int $error_level = E_USER_NOTICE) {} +function trigger_error (string $message, int $error_level = E_USER_NOTICE): bool +{} /** * Alias of trigger_error @@ -617,7 +640,8 @@ function trigger_error (string $message, int $error_level = E_USER_NOTICE) {} * @return bool This function returns false if wrong error_type is * specified, true otherwise. */ -function user_error (string $message, int $error_level = E_USER_NOTICE) {} +function user_error (string $message, int $error_level = E_USER_NOTICE): bool +{} /** * Sets a user-defined error handler function @@ -661,7 +685,8 @@ function set_error_handler (callable $callback, int $error_levels = E_ALL | E_ST * @link https://php.net/manual/en/function.restore-error-handler.php * @return bool This function always returns true. */ -function restore_error_handler () {} +function restore_error_handler (): bool +{} /** * Sets a user-defined exception handler function @@ -677,14 +702,16 @@ function restore_error_handler () {} * @return callable|null the name of the previously defined exception handler, or null on error. If * no previous handler was defined, null is also returned. */ -function set_exception_handler (callable $callback) {} +function set_exception_handler (callable $callback) +{} /** * Restores the previously defined exception handler function * @link https://php.net/manual/en/function.restore-exception-handler.php * @return bool This function always returns true. */ -function restore_exception_handler () {} +function restore_exception_handler (): bool +{} /** * Returns an array with the name of the defined classes @@ -699,7 +726,8 @@ function restore_exception_handler () {} *

*/ #[Pure] -function get_declared_classes () {} +function get_declared_classes (): array +{} /** * Returns an array of all declared interfaces @@ -708,7 +736,8 @@ function get_declared_classes () {} * script. */ #[Pure] -function get_declared_interfaces () {} +function get_declared_interfaces (): array +{} /** * Returns an array of all declared traits @@ -718,7 +747,8 @@ function get_declared_interfaces () {} * @since 5.4 */ #[Pure] -function get_declared_traits() {} +function get_declared_traits(): array +{} /** * Returns an array of all defined functions @@ -731,7 +761,8 @@ function get_declared_traits() {} * below). */ #[Pure] -function get_defined_functions (bool $exclude_disabled = false) {} +function get_defined_functions (bool $exclude_disabled = false): array +{} /** * Returns an array of all defined variables @@ -739,7 +770,8 @@ function get_defined_functions (bool $exclude_disabled = false) {} * @return array A multidimensional array with all the variables. */ #[Pure] -function get_defined_vars () {} +function get_defined_vars (): array +{} /** * Create an anonymous (lambda-style) function @@ -754,7 +786,8 @@ function get_defined_vars () {} * @removed 8.0 */ #[Deprecated(reason: "Use anonymous functions instead", since: "7.2")] -function create_function (string $args, string $code) {} +function create_function (string $args, string $code): bool|string +{} /** * Returns the resource type @@ -767,7 +800,8 @@ function create_function (string $args, string $code) {} * by this function, the return value will be the string * Unknown. */ -function get_resource_type ($resource) {} +function get_resource_type ($resource): string +{} /** * Returns an array with the names of all modules compiled and loaded @@ -779,7 +813,8 @@ function get_resource_type ($resource) {} * @return string[] an indexed array of all the modules names. */ #[Pure] -function get_loaded_extensions (bool $zend_extensions = false) {} +function get_loaded_extensions (bool $zend_extensions = false): array +{} /** * Find out whether an extension is loaded @@ -814,7 +849,8 @@ function get_loaded_extensions (bool $zend_extensions = false) {} * is loaded, false otherwise. */ #[Pure] -function extension_loaded (string $extension) {} +function extension_loaded (string $extension): bool +{} /** * Returns an array with the names of the functions of a module @@ -829,7 +865,8 @@ function extension_loaded (string $extension) {} * module_name is not a valid extension. */ #[Pure] -function get_extension_funcs (string $extension) {} +function get_extension_funcs (string $extension): array|false +{} /** * Returns an associative array with the names of all the constants and their values @@ -886,7 +923,8 @@ function get_extension_funcs (string $extension) {} * @return array */ #[Pure] -function get_defined_constants (bool $categorize = false) {} +function get_defined_constants (bool $categorize = false): array +{} /** * Generates a backtrace @@ -984,7 +1022,8 @@ function get_defined_constants (bool $categorize = false) {} * * */ -function debug_backtrace (int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT, int $limit = 0) {} +function debug_backtrace (int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT, int $limit = 0): array +{} /** * Prints a backtrace @@ -1008,14 +1047,15 @@ function debug_backtrace (int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT, int $li *

* @return void */ -function debug_print_backtrace (int $options = 0, int $limit = 0) {} +function debug_print_backtrace (int $options = 0, int $limit = 0): void {} /** * Forces collection of any existing garbage cycles * @link https://php.net/manual/en/function.gc-collect-cycles.php * @return int number of collected cycles. */ -function gc_collect_cycles () {} +function gc_collect_cycles (): int +{} /** * Returns status of the circular reference collector @@ -1023,21 +1063,22 @@ function gc_collect_cycles () {} * @return bool true if the garbage collector is enabled, false otherwise. */ #[Pure] -function gc_enabled () {} +function gc_enabled (): bool +{} /** * Activates the circular reference collector * @link https://php.net/manual/en/function.gc-enable.php * @return void */ -function gc_enable () {} +function gc_enable (): void {} /** * Deactivates the circular reference collector * @link https://php.net/manual/en/function.gc-disable.php * @return void */ -function gc_disable () {} +function gc_disable (): void {} /** * Gets information about the garbage collector @@ -1053,7 +1094,8 @@ function gc_disable () {} */ #[ArrayShape(["runs" => "int", "collected" => "int", "threshold" => "int", "roots" => "int"])] #[Pure] -function gc_status () {} +function gc_status (): array +{} /** * Reclaims memory used by the Zend Engine memory manager @@ -1061,7 +1103,8 @@ function gc_status () {} * @return int Returns the number of bytes freed. * @since 7.0 */ -function gc_mem_caches () {} +function gc_mem_caches (): int +{} /** * Returns active resources @@ -1078,4 +1121,5 @@ function gc_mem_caches () {} * @since 7.0 */ #[Pure] -function get_resources (string $type) {} +function get_resources (string $type): array +{} diff --git a/PDO/PDO.php b/PDO/PDO.php index a18c16ec9..5bdd5ef04 100644 --- a/PDO/PDO.php +++ b/PDO/PDO.php @@ -1649,7 +1649,8 @@ final class PDORow { * no drivers are available, it returns an empty array. */ #[Pure] -function pdo_drivers () {} +function pdo_drivers (): array +{} // End of PDO v.1.0.4dev ?> diff --git a/SPL/SPL_f.php b/SPL/SPL_f.php index 72ed5aa6d..26fe6c557 100644 --- a/SPL/SPL_f.php +++ b/SPL/SPL_f.php @@ -10,7 +10,8 @@ * @return array */ #[Pure] -function spl_classes () {} +function spl_classes (): array +{} /** * Default implementation for __autoload() @@ -25,7 +26,7 @@ function spl_classes () {} * @return void * @since 5.1.2 */ -function spl_autoload (string $class, string $file_extensions) +function spl_autoload (string $class, string $file_extensions): void {} /** @@ -42,7 +43,8 @@ function spl_autoload (string $class, string $file_extensions) * spl_autoload. * @since 5.1.2 */ -function spl_autoload_extensions (string $file_extensions) {} +function spl_autoload_extensions (string $file_extensions): string +{} /** * Register given function as __autoload() implementation @@ -60,7 +62,8 @@ function spl_autoload_extensions (string $file_extensions) {} * @throws TypeError Since 8.0. * @since 5.1.2 */ -function spl_autoload_register (callable $callback, bool $throw = true, bool $prepend = false) {} +function spl_autoload_register (callable $callback, bool $throw = true, bool $prepend = false): bool +{} /** * Unregister given function as __autoload() implementation @@ -71,7 +74,8 @@ function spl_autoload_register (callable $callback, bool $throw = true, bool $pr * @return bool true on success or false on failure. * @since 5.1.2 */ -function spl_autoload_unregister (callable $callback) {} +function spl_autoload_unregister (callable $callback): bool +{} /** * Return all registered __autoload() functions @@ -81,7 +85,8 @@ function spl_autoload_unregister (callable $callback) {} * If no function is registered the return value will be an empty array. * @since 5.1.2 */ -function spl_autoload_functions () {} +function spl_autoload_functions (): array +{} /** * Try all registered __autoload() functions to load the requested class @@ -92,7 +97,7 @@ function spl_autoload_functions () {} * @return void * @since 5.1.2 */ -function spl_autoload_call (string $class) {} +function spl_autoload_call (string $class): void {} /** * Return the parent classes of the given class @@ -108,7 +113,7 @@ function spl_autoload_call (string $class) {} * @return string[]|false An array on success, or false on error. */ #[Pure] -function class_parents ($object_or_class, bool $autoload) +function class_parents ($object_or_class, bool $autoload): array|false {} /** @@ -125,7 +130,7 @@ function class_parents ($object_or_class, bool $autoload) * @return string[]|false An array on success, or false on error. */ #[Pure] -function class_implements ($object_or_class, bool $autoload) +function class_implements ($object_or_class, bool $autoload): array|false {} /** @@ -136,7 +141,8 @@ function class_implements ($object_or_class, bool $autoload) * the same object. */ #[Pure] -function spl_object_hash (object $object) {} +function spl_object_hash (object $object): string +{} /** * Copy the iterator into an array @@ -150,7 +156,8 @@ function spl_object_hash (object $object) {} * @return array An array containing the elements of the iterator. */ #[Pure] -function iterator_to_array (Traversable $iterator, bool $preserve_keys = true) {} +function iterator_to_array (Traversable $iterator, bool $preserve_keys = true): array +{} /** * Count the elements in an iterator @@ -161,7 +168,8 @@ function iterator_to_array (Traversable $iterator, bool $preserve_keys = true) { * @return int The number of elements in iterator. */ #[Pure] -function iterator_count (Traversable $iterator) {} +function iterator_count (Traversable $iterator): int +{} /** * Call a function for every element in an iterator @@ -179,7 +187,7 @@ function iterator_count (Traversable $iterator) {} *

* @return int the iteration count. */ -function iterator_apply (Traversable $iterator, callable $callback, array $args) +function iterator_apply (Traversable $iterator, callable $callback, array $args): int {} // End of SPL v.0.2 @@ -194,7 +202,8 @@ function iterator_apply (Traversable $iterator, callable $callback, array $args) * @see get_declared_traits() * @since 5.4 */ -function class_uses($object_or_class, bool $autoload = true) {} +function class_uses($object_or_class, bool $autoload = true): array|false +{} /** * return the integer object handle for given object @@ -202,6 +211,7 @@ function class_uses($object_or_class, bool $autoload = true) {} * @return int * @since 7.2 */ -function spl_object_id(object $object) {} +function spl_object_id(object $object): int +{} ?> diff --git a/SimpleXML/SimpleXML.php b/SimpleXML/SimpleXML.php index 6f7bec96f..595cf0a75 100644 --- a/SimpleXML/SimpleXML.php +++ b/SimpleXML/SimpleXML.php @@ -415,10 +415,10 @@ public function count () {} * TRUE if ns is a prefix, FALSE if it's a URI; * defaults to FALSE. *

- * @return SimpleXMLElement an object of class SimpleXMLElement with + * @return SimpleXMLElement|false an object of class SimpleXMLElement with * properties containing the data held within the XML document, or FALSE on failure. */ -function simplexml_load_file (string $filename, string $class_name = "SimpleXMLElement", int $options = 0, string $namespace_or_prefix = "", bool $is_prefix = false) {} +function simplexml_load_file (string $filename, string $class_name = "SimpleXMLElement", int $options = 0, string $namespace_or_prefix = "", bool $is_prefix = false): SimpleXMLElement|false {} /** * Interprets a string of XML into an object @@ -443,10 +443,10 @@ function simplexml_load_file (string $filename, string $class_name = "SimpleXMLE * TRUE if ns is a prefix, FALSE if it's a URI; * defaults to FALSE. *

- * @return SimpleXMLElement an object of class SimpleXMLElement with + * @return SimpleXMLElement|false an object of class SimpleXMLElement with * properties containing the data held within the xml document, or FALSE on failure. */ -function simplexml_load_string (string $data, string $class_name = "SimpleXMLElement", int $options = 0, string $namespace_or_prefix = "", bool $is_prefix = false) {} +function simplexml_load_string (string $data, string $class_name = "SimpleXMLElement", int $options = 0, string $namespace_or_prefix = "", bool $is_prefix = false): SimpleXMLElement|false {} /** * Get a SimpleXMLElement object from a DOM node. @@ -462,6 +462,6 @@ function simplexml_load_string (string $data, string $class_name = "SimpleXMLEle *

* @return SimpleXMLElement a SimpleXMLElement or FALSE on failure. */ -function simplexml_import_dom (DOMNode $node, string $class_name = "SimpleXMLElement") {} +function simplexml_import_dom (DOMNode $node, string $class_name = "SimpleXMLElement"): SimpleXMLElement {} // End of SimpleXML v.0.1 diff --git a/Zend OPcache/OPcache.php b/Zend OPcache/OPcache.php index 71dcba144..cb647b6b5 100644 --- a/Zend OPcache/OPcache.php +++ b/Zend OPcache/OPcache.php @@ -11,7 +11,8 @@ * cache is disabled. * @since 5.5 */ -function opcache_compile_file(string $filename) { } +function opcache_compile_file(string $filename): bool +{ } /** * (PHP 5 >= 5.5.0, PECL ZendOpcache >= 7.0.0 )
@@ -25,7 +26,8 @@ function opcache_compile_file(string $filename) { } * cache is disabled. * @since 5.5 */ -function opcache_invalidate(string $filename, bool $force = false) { } +function opcache_invalidate(string $filename, bool $force = false): bool +{ } /** * (PHP 5 >= 5.5.0, PECL ZendOpcache >= 7.0.0 )
@@ -34,26 +36,29 @@ function opcache_invalidate(string $filename, bool $force = false) { } * @return bool Returns TRUE if the opcode cache was reset, or FALSE if the opcode cache is disabled. * @since 5.5 */ -function opcache_reset() { } +function opcache_reset(): bool +{ } /** * (PHP 5 >= 5.5.5, PECL ZendOpcache >= 7.0.2 )
* Get status information about the cache * @link https://php.net/manual/en/function.opcache-get-status.php * @param bool $include_scripts

Include script specific state information

- * @return array

Returns an array of information, optionally containing script specific state information

+ * @return array|false

Returns an array of information, optionally containing script specific state information

* @since 5.5 */ -function opcache_get_status (bool $include_scripts = true) {} +function opcache_get_status (bool $include_scripts = true): array|false +{} /** * (PHP 5 >= 5.5.5, PECL ZendOpcache >= 7.0.2 )
* Get configuration information about the cache * @link https://php.net/manual/en/function.opcache-get-configuration.php - * @return array

Returns an array of information, including ini, blacklist and version

+ * @return array|false

Returns an array of information, including ini, blacklist and version

* @since 5.5 */ -function opcache_get_configuration() {} +function opcache_get_configuration(): array|false +{} /** * (PHP 5 >= 5.6, PECL ZendOpcache >= 7.0.4 )
@@ -64,4 +69,5 @@ function opcache_get_configuration() {} * @return bool Returns TRUE if file is cached in OPCache, FALSE otherwise. * @since 5.6 */ -function opcache_is_script_cached(string $filename) {} +function opcache_is_script_cached(string $filename): bool +{} diff --git a/bcmath/bcmath.php b/bcmath/bcmath.php index 9f3089518..0c47ac6cb 100644 --- a/bcmath/bcmath.php +++ b/bcmath/bcmath.php @@ -20,7 +20,8 @@ * @return string The sum of the two operands, as a string. */ #[Pure] -function bcadd (string $num1, string $num2, int $scale = 0) {} +function bcadd (string $num1, string $num2, int $scale = 0): string +{} /** * Subtract one arbitrary precision number from another @@ -40,7 +41,8 @@ function bcadd (string $num1, string $num2, int $scale = 0) {} * @return string The result of the subtraction, as a string. */ #[Pure] -function bcsub (string $num1, string $num2, int $scale = 0) {} +function bcsub (string $num1, string $num2, int $scale = 0): string +{} /** * Multiply two arbitrary precision numbers @@ -60,7 +62,8 @@ function bcsub (string $num1, string $num2, int $scale = 0) {} * @return string the result as a string. */ #[Pure] -function bcmul (string $num1, string $num2, int $scale = 0) {} +function bcmul (string $num1, string $num2, int $scale = 0): string +{} /** * Divide two arbitrary precision numbers @@ -81,7 +84,8 @@ function bcmul (string $num1, string $num2, int $scale = 0) {} * divisor is 0. */ #[Pure] -function bcdiv (string $num1, string $num2, int $scale = 0) {} +function bcdiv (string $num1, string $num2, int $scale = 0): ?string +{} /** * Get modulus of an arbitrary precision number @@ -102,7 +106,8 @@ function bcdiv (string $num1, string $num2, int $scale = 0) {} * divisor is 0. */ #[Pure] -function bcmod (string $num1, string $num2, int $scale = 0) {} +function bcmod (string $num1, string $num2, int $scale = 0): ?string +{} /** * Raise an arbitrary precision number to another @@ -124,7 +129,8 @@ function bcmod (string $num1, string $num2, int $scale = 0) {} * @return string the result as a string. */ #[Pure] -function bcpow (string $num, string $exponent, int $scale = 0) {} +function bcpow (string $num, string $exponent, int $scale = 0): string +{} /** * Get the square root of an arbitrary precision number @@ -137,7 +143,8 @@ function bcpow (string $num, string $exponent, int $scale = 0) {} * operand is negative. */ #[Pure] -function bcsqrt (string $num, int $scale) {} +function bcsqrt (string $num, int $scale): ?string +{} /** * Set default scale parameter for all bc math functions @@ -147,7 +154,8 @@ function bcsqrt (string $num, int $scale) {} *

* @return int|true INT since 7.3.0 and TRUE before. */ -function bcscale (int $scale) {} +function bcscale (int $scale): int +{} /** * Compare two arbitrary precision numbers @@ -168,7 +176,8 @@ function bcscale (int $scale) {} * right_operand, -1 otherwise. */ #[Pure] -function bccomp (string $num1, string $num2, int $scale = 0) {} +function bccomp (string $num1, string $num2, int $scale = 0): int +{} /** * Raise an arbitrary precision number to another, reduced by a specified modulus @@ -193,4 +202,5 @@ function bccomp (string $num1, string $num2, int $scale = 0) {} * is 0 or exponent is negative. */ #[Pure] -function bcpowmod (string $num, string $exponent, string $modulus, int $scale = 0) {} +function bcpowmod (string $num, string $exponent, string $modulus, int $scale = 0): ?string +{} diff --git a/bz2/bz2.php b/bz2/bz2.php index fe2d74d8b..42188a26c 100644 --- a/bz2/bz2.php +++ b/bz2/bz2.php @@ -33,7 +33,7 @@ function bzopen ($file, string $mode) {} *

* @return string the uncompressed data, or FALSE on error. */ -function bzread ($bz, int $length = 1024) {} +function bzread ($bz, int $length = 1024): string|false {} /** * Binary safe bzip2 file write @@ -52,7 +52,7 @@ function bzread ($bz, int $length = 1024) {} *

* @return int the number of bytes written, or FALSE on error. */ -function bzwrite ($bz, string $data, int $length) +function bzwrite ($bz, string $data, int $length): int|false {} /** @@ -64,7 +64,7 @@ function bzwrite ($bz, string $data, int $length) *

* @return bool TRUE on success or FALSE on failure. */ -function bzflush ($bz) {} +function bzflush ($bz): bool {} /** * Close a bzip2 file @@ -75,7 +75,8 @@ function bzflush ($bz) {} *

* @return bool TRUE on success or FALSE on failure. */ -function bzclose ($bz) {} +function bzclose ($bz): bool +{} /** * Returns a bzip2 error number @@ -87,7 +88,8 @@ function bzclose ($bz) {} * @return int the error number as an integer. */ #[Pure] -function bzerrno ($bz) {} +function bzerrno ($bz): int +{} /** * Returns a bzip2 error string @@ -99,7 +101,8 @@ function bzerrno ($bz) {} * @return string a string containing the error message. */ #[Pure] -function bzerrstr ($bz) {} +function bzerrstr ($bz): string +{} /** * Returns the bzip2 error number and error string in an array @@ -113,7 +116,8 @@ function bzerrstr ($bz) {} * errstr entry. */ #[Pure] -function bzerror ($bz) {} +function bzerror ($bz): array +{} /** * Compress a string into bzip2 encoded data @@ -135,10 +139,10 @@ function bzerror ($bz) {} * Regardless of the workfactor, the generated * output is the same. *

- * @return mixed The compressed string, or an error number if an error occurred. + * @return string|int The compressed string, or an error number if an error occurred. */ #[Pure] -function bzcompress (string $data, int $block_size = 4, int $work_factor = 0) {} +function bzcompress (string $data, int $block_size = 4, int $work_factor = 0): string|int {} /** * Decompresses bzip2 encoded data @@ -155,7 +159,7 @@ function bzcompress (string $data, int $block_size = 4, int $work_factor = 0) {} * See the bzip2 documentation for more * information about this feature. *

- * @return mixed The decompressed string, or an error number if an error occurred. + * @return string|int|false The decompressed string, or an error number if an error occurred. */ #[Pure] -function bzdecompress (string $data, bool $use_less_memory) {} +function bzdecompress (string $data, bool $use_less_memory): string|int|false {} diff --git a/calendar/calendar.php b/calendar/calendar.php index 86cef8edf..48f31b7a7 100644 --- a/calendar/calendar.php +++ b/calendar/calendar.php @@ -10,7 +10,8 @@ *

* @return string The gregorian date as a string in the form "month/day/year" */ -function jdtogregorian (int $julian_day) {} +function jdtogregorian (int $julian_day): string +{} /** * Converts a Gregorian date to Julian Day Count @@ -26,7 +27,8 @@ function jdtogregorian (int $julian_day) {} *

* @return int The julian day for the given gregorian date as an integer. */ -function gregoriantojd (int $month, int $day, int $year) {} +function gregoriantojd (int $month, int $day, int $year): int +{} /** * Converts a Julian Day Count to a Julian Calendar Date @@ -36,7 +38,8 @@ function gregoriantojd (int $month, int $day, int $year) {} *

* @return string The julian date as a string in the form "month/day/year" */ -function jdtojulian (int $julian_day) {} +function jdtojulian (int $julian_day): string +{} /** * Converts a Julian Calendar date to Julian Day Count @@ -52,7 +55,8 @@ function jdtojulian (int $julian_day) {} *

* @return int The julian day for the given julian date as an integer. */ -function juliantojd (int $month, int $day, int $year) {} +function juliantojd (int $month, int $day, int $year): int +{} /** * Converts a Julian day count to a Jewish calendar date @@ -71,7 +75,8 @@ function juliantojd (int $month, int $day, int $year) {} *

* @return string The jewish date as a string in the form "month/day/year" */ -function jdtojewish (int $julian_day, bool $hebrew = false, int $flags = 0) {} +function jdtojewish (int $julian_day, bool $hebrew = false, int $flags = 0): string +{} /** * Converts a date in the Jewish Calendar to Julian Day Count @@ -87,7 +92,8 @@ function jdtojewish (int $julian_day, bool $hebrew = false, int $flags = 0) {} *

* @return int The julian day for the given jewish date as an integer. */ -function jewishtojd (int $month, int $day, int $year) {} +function jewishtojd (int $month, int $day, int $year): int +{} /** * Converts a Julian Day Count to the French Republican Calendar @@ -95,7 +101,8 @@ function jewishtojd (int $month, int $day, int $year) {} * @param int $julian_day * @return string The french revolution date as a string in the form "month/day/year" */ -function jdtofrench (int $julian_day) {} +function jdtofrench (int $julian_day): string +{} /** * Converts a date from the French Republican Calendar to a Julian Day Count @@ -111,7 +118,8 @@ function jdtofrench (int $julian_day) {} *

* @return int The julian day for the given french revolution date as an integer. */ -function frenchtojd (int $month, int $day, int $year) {} +function frenchtojd (int $month, int $day, int $year): int +{} /** * Returns the day of the week @@ -146,9 +154,10 @@ function frenchtojd (int $month, int $day, int $year) {} * * * - * @return mixed The gregorian weekday as either an integer or string. + * @return string|int The gregorian weekday as either an integer or string. */ -function jddayofweek (int $julian_day, int $mode = CAL_DOW_DAYNO) {} +function jddayofweek (int $julian_day, int $mode = CAL_DOW_DAYNO): string|int +{} /** * Returns a month name @@ -157,7 +166,8 @@ function jddayofweek (int $julian_day, int $mode = CAL_DOW_DAYNO) {} * @param int $mode * @return string The month name for the given Julian Day and calendar. */ -function jdmonthname (int $julian_day, int $mode) {} +function jdmonthname (int $julian_day, int $mode): string +{} /** * Get Unix timestamp for midnight on Easter of a given year @@ -168,7 +178,8 @@ function jdmonthname (int $julian_day, int $mode) {} * @param int $mode [optional] Allows Easter dates to be calculated based on the Julian calendar when set to CAL_EASTER_ALWAYS_JULIAN * @return int The easter date as a unix timestamp. */ -function easter_date (int $year, int $mode = CAL_EASTER_DEFAULT) {} +function easter_date (int $year, int $mode = CAL_EASTER_DEFAULT): int +{} /** * Get number of days after March 21 on which Easter falls for a given year @@ -185,7 +196,8 @@ function easter_date (int $year, int $mode = CAL_EASTER_DEFAULT) {} * @return int The number of days after March 21st that the Easter Sunday * is in the given year. */ -function easter_days (int $year, int $mode = CAL_EASTER_DEFAULT) {} +function easter_days (int $year, int $mode = CAL_EASTER_DEFAULT): int +{} /** * Convert Unix timestamp to Julian Day @@ -193,9 +205,10 @@ function easter_days (int $year, int $mode = CAL_EASTER_DEFAULT) {} * @param int $timestamp [optional] defaults to time()

* A unix timestamp to convert. *

- * @return int A julian day number as integer. + * @return int|false A julian day number as integer. */ -function unixtojd (int $timestamp = 0) {} +function unixtojd (int $timestamp = 0): int|false +{} /** * Convert Julian Day to Unix timestamp @@ -205,7 +218,8 @@ function unixtojd (int $timestamp = 0) {} *

* @return int The unix timestamp for the start of the given julian day. */ -function jdtounix (int $julian_day) {} +function jdtounix (int $julian_day): int +{} /** * Converts from a supported calendar to Julian Day Count @@ -231,7 +245,8 @@ function jdtounix (int $julian_day) {} *

* @return int A Julian Day number. */ -function cal_to_jd (int $calendar, int $month, int $day, int $year) {} +function cal_to_jd (int $calendar, int $month, int $day, int $year): int +{} /** * Converts from Julian Day Count to a supported calendar @@ -246,7 +261,8 @@ function cal_to_jd (int $calendar, int $month, int $day, int $year) {} * day of week, abbreviated and full names of weekday and month and the * date in string form "month/day/year". */ -function cal_from_jd (int $julian_day, int $calendar) {} +function cal_from_jd (int $julian_day, int $calendar): array +{} /** * Return the number of days in a month for a given year and calendar @@ -262,7 +278,8 @@ function cal_from_jd (int $julian_day, int $calendar) {} *

* @return int The length in days of the selected month in the given calendar */ -function cal_days_in_month (int $calendar, int $month, int $year) {} +function cal_days_in_month (int $calendar, int $month, int $year): int +{} /** * Returns information about a particular calendar @@ -273,7 +290,8 @@ function cal_days_in_month (int $calendar, int $month, int $year) {} *

* @return array */ -function cal_info (int $calendar = -1) {} +function cal_info (int $calendar = -1): array +{} define ('CAL_GREGORIAN', 0); define ('CAL_JULIAN', 1); diff --git a/ctype/ctype.php b/ctype/ctype.php index f10f7498a..2a88d5b2a 100644 --- a/ctype/ctype.php +++ b/ctype/ctype.php @@ -12,7 +12,8 @@ * a letter or a digit, FALSE otherwise. */ #[Pure] -function ctype_alnum (mixed $text) {} +function ctype_alnum (mixed $text): bool +{} /** * Check for alphabetic character(s) @@ -24,7 +25,8 @@ function ctype_alnum (mixed $text) {} * a letter from the current locale, FALSE otherwise. */ #[Pure] -function ctype_alpha (mixed $text) {} +function ctype_alpha (mixed $text): bool +{} /** * Check for control character(s) @@ -36,7 +38,8 @@ function ctype_alpha (mixed $text) {} * a control character from the current locale, FALSE otherwise. */ #[Pure] -function ctype_cntrl (mixed $text) {} +function ctype_cntrl (mixed $text): bool +{} /** * Check for numeric character(s) @@ -48,7 +51,8 @@ function ctype_cntrl (mixed $text) {} * text is a decimal digit, FALSE otherwise. */ #[Pure] -function ctype_digit (mixed $text) {} +function ctype_digit (mixed $text): bool +{} /** * Check for lowercase character(s) @@ -60,7 +64,8 @@ function ctype_digit (mixed $text) {} * a lowercase letter in the current locale. */ #[Pure] -function ctype_lower (mixed $text) {} +function ctype_lower (mixed $text): bool +{} /** * Check for any printable character(s) except space @@ -73,7 +78,8 @@ function ctype_lower (mixed $text) {} * otherwise. */ #[Pure] -function ctype_graph (mixed $text) {} +function ctype_graph (mixed $text): bool +{} /** * Check for printable character(s) @@ -87,7 +93,8 @@ function ctype_graph (mixed $text) {} * that do not have any output or control function at all. */ #[Pure] -function ctype_print (mixed $text) {} +function ctype_print (mixed $text): bool +{} /** * Check for any printable character which is not whitespace or an @@ -100,7 +107,8 @@ function ctype_print (mixed $text) {} * is printable, but neither letter, digit or blank, FALSE otherwise. */ #[Pure] -function ctype_punct (mixed $text) {} +function ctype_punct (mixed $text): bool +{} /** * Check for whitespace character(s) @@ -114,7 +122,8 @@ function ctype_punct (mixed $text) {} * carriage return and form feed characters. */ #[Pure] -function ctype_space (mixed $text) {} +function ctype_space (mixed $text): bool +{} /** * Check for uppercase character(s) @@ -126,7 +135,8 @@ function ctype_space (mixed $text) {} * an uppercase letter in the current locale. */ #[Pure] -function ctype_upper (mixed $text) {} +function ctype_upper (mixed $text): bool +{} /** * Check for character(s) representing a hexadecimal digit @@ -139,4 +149,5 @@ function ctype_upper (mixed $text) {} * [A-Fa-f] , FALSE otherwise. */ #[Pure] -function ctype_xdigit (mixed $text) {} +function ctype_xdigit (mixed $text): bool +{} diff --git a/curl/curl.php b/curl/curl.php index 783905de7..de42c716f 100644 --- a/curl/curl.php +++ b/curl/curl.php @@ -85,22 +85,24 @@ public function __wakeup() { *

* @return resource|false|CurlHandle a cURL handle on success, false on errors. */ +#[LanguageLevelTypeAware(["8.0" => "CurlHandle|false"], default: "resource|false")] function curl_init (string $url) {} /** * Copy a cURL handle along with all of its preferences * @link https://php.net/manual/en/function.curl-copy-handle.php * @param CurlHandle|resource $handle - * @return resource a new cURL handle. + * @return CurlHandle|resource|false a new cURL handle. */ #[Pure] +#[LanguageLevelTypeAware(["8.0" => "CurlHandle|false"], default: "resource|false")] function curl_copy_handle (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle) {} /** * Gets cURL version information * @link https://php.net/manual/en/function.curl-version.php * @param int $age [optional] Removed since version PHP 8.0. - * @return array an associative array with the following elements: + * @return array|false an associative array with the following elements: * * Indice * Value description @@ -154,7 +156,8 @@ function curl_copy_handle (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], def "protocols" => "array", ])] #[Pure] -function curl_version ($age = null) {} +function curl_version ($age = null): array|false +{} /** * Set an option for a cURL transfer @@ -2122,7 +2125,8 @@ function curl_version ($age = null) {} * * @return bool true on success or false on failure. */ -function curl_setopt (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle, int $option, mixed $value) {} +function curl_setopt (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle, int $option, mixed $value): bool +{} /** * Set multiple options for a cURL transfer @@ -2138,7 +2142,8 @@ function curl_setopt (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: * future options in the options array. * @since 5.1.3 */ -function curl_setopt_array (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle, array $options) {} +function curl_setopt_array (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle, array $options): bool +{} /** * (PHP 5 >=5.5.0)
@@ -2150,7 +2155,7 @@ function curl_setopt_array (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], de * @return void * @since 5.5 */ -function curl_share_close (#[LanguageLevelTypeAware(["8.0" => "CurlShareHandle"], default: "resource")] $share_handle) {} +function curl_share_close (#[LanguageLevelTypeAware(["8.0" => "CurlShareHandle"], default: "resource")] $share_handle): void {} /** * (PHP 5 >=5.5.0)
@@ -2159,7 +2164,8 @@ function curl_share_close (#[LanguageLevelTypeAware(["8.0" => "CurlShareHandle"] * @return resource|CurlShareHandle Returns resource of type "cURL Share Handle". * @since 5.5 */ -function curl_share_init () {} +function curl_share_init (): CurlShareHandle +{} /** * (PHP 5 >=5.5.0)
@@ -2240,7 +2246,8 @@ function curl_share_init () {} * Returns TRUE on success or FALSE on failure. * @since 5.5 */ -function curl_share_setopt (#[LanguageLevelTypeAware(["8.0" => "CurlShareHandle"], default: "resource")] $share_handle, int $option, mixed $value ) {} +function curl_share_setopt (#[LanguageLevelTypeAware(["8.0" => "CurlShareHandle"], default: "resource")] $share_handle, int $option, mixed $value ): bool +{} /** * (PHP 5 >=5.5.0)
@@ -2253,7 +2260,8 @@ function curl_share_setopt (#[LanguageLevelTypeAware(["8.0" => "CurlShareHandle" * @since 5.5 */ #[Pure] -function curl_strerror (int $error_code) {} +function curl_strerror (int $error_code): ?string +{} /** * (PHP 5 >=5.5.0)
@@ -2268,7 +2276,8 @@ function curl_strerror (int $error_code) {} * @since 5.5 */ #[Pure] -function curl_unescape (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle, string $string) {} +function curl_unescape (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle, string $string): string|false +{} /** * Perform a cURL session * @link https://php.net/manual/en/function.curl-exec.php @@ -2276,7 +2285,8 @@ function curl_unescape (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], defau * @return string|bool true on success or false on failure. However, if the CURLOPT_RETURNTRANSFER * option is set, it will return the result on success, false on failure. */ -function curl_exec (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle) {} +function curl_exec (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle): string|bool +{} /** * Get information regarding a specific transfer @@ -2310,7 +2320,8 @@ function curl_exec (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: " * "redirect_time" */ #[Pure] -function curl_getinfo (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle, int $option) {} +function curl_getinfo (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle, int $option): mixed +{} /** * Return a string containing the last error for the current session @@ -2320,7 +2331,8 @@ function curl_getinfo (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default * error occurred. */ #[Pure] -function curl_error (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle) {} +function curl_error (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle): string +{} /** * Return the last error number @@ -2330,7 +2342,8 @@ function curl_error (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: * occurred. */ #[Pure] -function curl_errno (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle) {} +function curl_errno (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle): int +{} /** * URL encodes the given string @@ -2344,7 +2357,8 @@ function curl_errno (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: * @since 5.5 */ #[Pure] -function curl_escape(#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle, string $string) {} +function curl_escape(#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle, string $string): string|false +{} /** * (PHP 5 >= 5.5.0)
@@ -2358,7 +2372,8 @@ function curl_escape(#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: * @since 5.5 */ #[Pure] -function curl_file_create(string $filename, string $mime_type = '', string $posted_filename = '') {} +function curl_file_create(string $filename, string $mime_type = '', string $posted_filename = ''): CURLFile +{} /** * Close a cURL session @@ -2366,14 +2381,16 @@ function curl_file_create(string $filename, string $mime_type = '', string $post * @param CurlHandle|resource $handle * @return void */ -function curl_close (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle) {} +function curl_close (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle): void {} /** * Returns a new cURL multi handle * @link https://php.net/manual/en/function.curl-multi-init.php - * @return resource|false|CurlMultiHandle a cURL multi handle resource on success, false on failure. + * @return resource|CurlMultiHandle a cURL multi handle resource on success, false on failure. */ -function curl_multi_init () {} +#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] +function curl_multi_init (): CurlMultiHandle|bool +{} /** * Add a normal cURL handle to a cURL multi handle @@ -2383,7 +2400,8 @@ function curl_multi_init () {} * @return int 0 on success, or one of the CURLM_XXX errors * code. */ -function curl_multi_add_handle (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle, #[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle) {} +function curl_multi_add_handle (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle, #[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle): int +{} /** * Remove a multi handle from a set of cURL handles @@ -2392,7 +2410,9 @@ function curl_multi_add_handle (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHan * @param CurlHandle|resource $handle * @return int|false On success, returns one of the CURLM_XXX error codes, false on failure. */ -function curl_multi_remove_handle (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle, #[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle) {} +#[LanguageLevelTypeAware(["8.0" => "int"], default: "int|false")] +function curl_multi_remove_handle (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle, #[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle) +{} /** * Wait for activity on any curl_multi connection @@ -2404,7 +2424,8 @@ function curl_multi_remove_handle (#[LanguageLevelTypeAware(["8.0" => "CurlMulti * @return int On success, returns the number of descriptors contained in, * the descriptor sets. On failure, this function will return -1 on a select failure or timeout (from the underlying select system call). */ -function curl_multi_select (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle, float $timeout = 1.0) {} +function curl_multi_select (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle, float $timeout = 1.0): int +{} /** * (PHP 5 >=5.5.0)
@@ -2457,7 +2478,8 @@ function curl_multi_select (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle" * @return bool Returns TRUE on success or FALSE on failure. * @since 5.5 */ -function curl_multi_setopt (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle, int $option, mixed $value) {} +function curl_multi_setopt (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle, int $option, mixed $value): bool +{} /** * (PHP 5 >=5.5.0)
@@ -2469,7 +2491,8 @@ function curl_multi_setopt (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle" * @return string|null Returns error string for valid error code, NULL otherwise. * @since 5.5 */ -function curl_multi_strerror (int $error_code) {} +function curl_multi_strerror (int $error_code): ?string +{} /** * (PHP 5 >=5.5.0)
@@ -2481,7 +2504,8 @@ function curl_multi_strerror (int $error_code) {} * @return int Returns an error code (CURLE_OK for no error). * @since 5.5 */ -function curl_pause (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle, int $flags) {} +function curl_pause (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle, int $flags): int +{} /** * (PHP 5 >=5.5.0)
@@ -2492,7 +2516,7 @@ function curl_pause (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: * @return void * @since 5.5 */ -function curl_reset (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle) {} +function curl_reset (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $handle): void {} /** * Run the sub-connections of the current cURL handle @@ -2508,7 +2532,8 @@ function curl_reset (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: * occurred problems on individual transfers even when this function returns * CURLM_OK. */ -function curl_multi_exec (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle, &$still_running) {} +function curl_multi_exec (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle, &$still_running): int +{} /** * Return the content of a cURL handle if CURLOPT_RETURNTRANSFER is set @@ -2517,7 +2542,8 @@ function curl_multi_exec (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], * @return string Return the content of a cURL handle if CURLOPT_RETURNTRANSFER is set. */ #[Pure] -function curl_multi_getcontent (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $multi_handle) {} +function curl_multi_getcontent (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"], default: "resource")] $multi_handle): string +{} /** * Get information about the current transfers @@ -2529,7 +2555,8 @@ function curl_multi_getcontent (#[LanguageLevelTypeAware(["8.0" => "CurlHandle"] * @return array|false On success, returns an associative array for the message, false on failure. */ #[Pure] -function curl_multi_info_read (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle, &$queued_messages) {} +function curl_multi_info_read (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle, &$queued_messages): array|false +{} /** * Close a set of cURL handles @@ -2537,7 +2564,7 @@ function curl_multi_info_read (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHand * @param CurlMultiHandle|resource $multi_handle * @return void */ -function curl_multi_close (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle) {} +function curl_multi_close (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle): void {} /** * Return the last multi curl error number @@ -2546,7 +2573,8 @@ function curl_multi_close (#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"] * @since 7.1 */ #[Pure] -function curl_multi_errno(#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle) {} +function curl_multi_errno(#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], default: "resource")] $multi_handle): int +{} /** * Return the last share curl error number @@ -2555,7 +2583,8 @@ function curl_multi_errno(#[LanguageLevelTypeAware(["8.0" => "CurlMultiHandle"], * @since 7.1 */ #[Pure] -function curl_share_errno(#[LanguageLevelTypeAware(["8.0" => "CurlShareHandle"], default: "resource")] $share_handle) {} +function curl_share_errno(#[LanguageLevelTypeAware(["8.0" => "CurlShareHandle"], default: "resource")] $share_handle): int +{} /** * Return string describing the given error code @@ -2564,7 +2593,8 @@ function curl_share_errno(#[LanguageLevelTypeAware(["8.0" => "CurlShareHandle"], * @since 7.1 */ #[Pure] -function curl_share_strerror(int $error_code){} +function curl_share_strerror(int $error_code): string +{} /** * @since 8.0 diff --git a/date/date.php b/date/date.php index 0a196a35f..0a22b9850 100644 --- a/date/date.php +++ b/date/date.php @@ -20,7 +20,8 @@ * this function would return -1 on failure. */ #[Pure] -function strtotime (string $datetime, int $baseTimestamp) {} +function strtotime (string $datetime, int $baseTimestamp): int|false +{} /** * Format a local time/date @@ -289,7 +290,9 @@ function strtotime (string $datetime, int $baseTimestamp) {} * E_WARNING level error is emitted. */ #[Pure] -function date (string $format, int $timestamp) {} +#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false")] +function date (string $format, int $timestamp) +{} /** * Format a local time/date as integer @@ -377,7 +380,7 @@ function date (string $format, int $timestamp) {} * *

* @param int $timestamp [optional] - * @return int an integer. + * @return int|false an integer. *

*

* As idate always returns an integer and @@ -385,7 +388,8 @@ function date (string $format, int $timestamp) {} * fewer digits than you would expect. See the example below. */ #[Pure] -function idate (string $format, int $timestamp) {} +function idate (string $format, int $timestamp): int|false +{} /** * Format a GMT/UTC date/time @@ -400,7 +404,9 @@ function idate (string $format, int $timestamp) {} * E_WARNING level error is emitted. */ #[Pure] -function gmdate (string $format, int $timestamp) {} +#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false")] +function gmdate (string $format, int $timestamp) +{} /** * Get Unix timestamp for a date @@ -453,7 +459,8 @@ function gmdate (string $format, int $timestamp) {} * it returned -1). */ #[Pure] -function mktime ($hour = null, $minute = null, $second = null, $month = null, $day = null, $year = null, #[Deprecated('Use the new timezone handling functions instead', since: '5.3')] $is_dst = -1) {} +function mktime ($hour = null, $minute = null, $second = null, $month = null, $day = null, $year = null, #[Deprecated('Use the new timezone handling functions instead', since: '5.3')] $is_dst = -1): int|false +{} /** * Get Unix timestamp for a GMT date @@ -480,10 +487,11 @@ function mktime ($hour = null, $minute = null, $second = null, $month = null, $d * Parameters always represent a GMT date so is_dst * doesn't influence the result. *

- * @return int a integer Unix timestamp. + * @return int|false a integer Unix timestamp. */ #[Pure] -function gmmktime ($hour = null, $minute = null, $second = null, $month = null, $day = null, $year = null, $is_dst = null) {} +function gmmktime ($hour = null, $minute = null, $second = null, $month = null, $day = null, $year = null, $is_dst = null): int|false +{} /** * Validate a Gregorian date @@ -502,7 +510,8 @@ function gmmktime ($hour = null, $minute = null, $second = null, $month = null, * @return bool true if the date given is valid; otherwise returns false. */ #[Pure] -function checkdate (int $month, int $day, int $year) {} +function checkdate (int $month, int $day, int $year): bool +{} /** * Format a local time/date according to locale settings @@ -756,13 +765,13 @@ function checkdate (int $month, int $day, int $year) {} * @param string $format

* @param int $timestamp [optional] defaults to the value of time() * Unix timestamp that defaults to the current local time if a timestamp is not given.. - * @return string a string formatted according format + * @return string|false a string formatted according format * using the given timestamp or the current * local time if no timestamp is given. Month and weekday names and * other language-dependent strings respect the current locale set * with setlocale. */ -function strftime (string $format, int $timestamp) +function strftime (string $format, int $timestamp): string|false {} /** @@ -772,20 +781,22 @@ function strftime (string $format, int $timestamp) * See description in strftime. *

* @param int $timestamp [optional] - * @return string a string formatted according to the given format string + * @return string|false a string formatted according to the given format string * using the given timestamp or the current * local time if no timestamp is given. Month and weekday names and * other language dependent strings respect the current locale set * with setlocale. */ -function gmstrftime (string $format, int $timestamp) {} +function gmstrftime (string $format, int $timestamp): string|false +{} /** * Return current Unix timestamp * @link https://php.net/manual/en/function.time.php * @return int

Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

*/ -function time () {} +function time (): int +{} /** * Get the local time @@ -804,7 +815,8 @@ function time () {} * @return array */ #[Pure] -function localtime (int $timestamp, bool $associative) {} +function localtime (int $timestamp, bool $associative): array +{} /** * Get date/time information @@ -886,7 +898,8 @@ function localtime (int $timestamp, bool $associative) {} * */ #[Pure] -function getdate (int $timestamp) {} +function getdate (int $timestamp): array +{} /** * Returns new DateTime object @@ -900,7 +913,8 @@ function getdate (int $timestamp) {} * @return DateTime|false DateTime object on success or false on failure. */ #[Pure] -function date_create (string $datetime, DateTimeZone $timezone ) {} +function date_create (string $datetime, DateTimeZone $timezone ): DateTime|false +{} /** * (PHP 5.5)
@@ -917,7 +931,8 @@ function date_create (string $datetime, DateTimeZone $timezone ) {} * @return DateTimeImmutable|false DateTime object on success or false on failure. */ #[Pure] -function date_create_immutable (string $datetime, DateTimeZone $timezone) {} +function date_create_immutable (string $datetime, DateTimeZone $timezone): DateTimeImmutable|false +{} /** * Returns new DateTimeImmutable object formatted according to the specified format @@ -925,10 +940,11 @@ function date_create_immutable (string $datetime, DateTimeZone $timezone) {} * @param string $format * @param string $datetime * @param DateTimeZone $timezone [optional] - * @return DateTimeImmutable + * @return DateTimeImmutable|false */ #[Pure] -function date_create_immutable_from_format (string $format, string $datetime, DateTimeZone $timezone) {} +function date_create_immutable_from_format (string $format, string $datetime, DateTimeZone $timezone): DateTimeImmutable|false +{} /** * Alias: @@ -944,7 +960,8 @@ function date_create_immutable_from_format (string $format, string $datetime, Da * {@see DateTime} instance or FALSE on failure.

*/ #[Pure] -function date_create_from_format (string $format, string $datetime, DateTimeZone $timezone) {} +function date_create_from_format (string $format, string $datetime, DateTimeZone $timezone): DateTime|false +{} /** * Returns associative array with detailed info about given date @@ -956,7 +973,9 @@ function date_create_from_format (string $format, string $datetime, DateTimeZone * on success or false on failure. */ #[Pure] -function date_parse (string $datetime) {} +#[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] +function date_parse (string $datetime): bool|array +{} /** * Get info about given date formatted according to the specified format @@ -970,17 +989,19 @@ function date_parse (string $datetime) {} * @return array associative array with detailed info about given date. */ #[Pure] -function date_parse_from_format (string $format, string $datetime) {} +function date_parse_from_format (string $format, string $datetime): array +{} /** * Returns the warnings and errors * Alias: * {@see DateTime::getLastErrors} * @link https://php.net/manual/en/function.date-get-last-errors.php - * @return array

Returns array containing info about warnings and errors.

+ * @return array|false

Returns array containing info about warnings and errors.

*/ #[Pure] -function date_get_last_errors () {} +function date_get_last_errors (): array|false +{} /** * Alias: @@ -991,7 +1012,9 @@ function date_get_last_errors () {} * @return string|false formatted date string on success or FALSE on failure. */ #[Pure] -function date_format (DateTimeInterface $object, string $format) {} +#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false")] +function date_format (DateTimeInterface $object, string $format) +{} /** * Alter the timestamp of a DateTime object by incrementing or decrementing @@ -1004,7 +1027,8 @@ function date_format (DateTimeInterface $object, string $format) {} * @return DateTime|false Returns the DateTime object for method chaining or FALSE on failure. */ #[Pure] -function date_modify (DateTime $object, string $modifier) {} +function date_modify (DateTime $object, string $modifier): DateTime|false +{} /** * &Alias; DateTime::add @@ -1018,7 +1042,9 @@ function date_modify (DateTime $object, string $modifier) {} * {@see DateTime} object for method chaining or FALSE on failure.

*/ #[Pure] -function date_add (DateTime $object, DateInterval $interval) {} +#[LanguageLevelTypeAware(["8.0" => "DateTime"], default: "DateTime|false")] +function date_add (DateTime $object, DateInterval $interval) +{} /** * Subtracts an amount of days, months, years, hours, minutes and seconds from a datetime object @@ -1034,7 +1060,9 @@ function date_add (DateTime $object, DateInterval $interval) {} * {@see DateTime} object for method chaining or FALSE on failure.

*/ #[Pure] -function date_sub (DateTime $object, DateInterval $interval) {} +#[LanguageLevelTypeAware(["8.0" => "DateTime"], default: "DateTime|false")] +function date_sub (DateTime $object, DateInterval $interval) +{} /** * Alias: @@ -1052,7 +1080,8 @@ function date_sub (DateTime $object, DateInterval $interval) {} *

*/ #[Pure] -function date_timezone_get (DateTimeInterface $object) {} +function date_timezone_get (DateTimeInterface $object): DateTimeZone|false +{} /** * Sets the time zone for the datetime object @@ -1068,7 +1097,9 @@ function date_timezone_get (DateTimeInterface $object) {} * {@see DateTime} object for method chaining or FALSE on failure.

*/ #[Pure] -function date_timezone_set (DateTimeInterface $object, DateTimeZone $timezone) {} +#[LanguageLevelTypeAware(["8.0" => "DateTime"], default: "DateTime|false")] +function date_timezone_set (DateTimeInterface $object, DateTimeZone $timezone) +{} /** * Alias: @@ -1079,7 +1110,10 @@ function date_timezone_set (DateTimeInterface $object, DateTimeZone $timezone) { * @return int|false

Returns the timezone offset in seconds from UTC on success or FALSE on failure.

*/ #[Pure] -function date_offset_get (DateTimeInterface $object) {} +#[LanguageLevelTypeAware(["8.0" => "int"], default: "int|false")] +function date_offset_get (DateTimeInterface $object) +{} + /** * Returns the difference between two datetime objects @@ -1092,8 +1126,9 @@ function date_offset_get (DateTimeInterface $object) {} * @return DateInterval|false The DateInterval object representing the difference between the two dates or FALSE on failure. */ #[Pure] -function date_diff (DateTimeInterface $baseObject, DateTimeInterface $targetObject, bool $absolute = false) {} - +#[LanguageLevelTypeAware(["8.0" => "DateInterval"], default: "DateInterval|false")] +function date_diff (DateTimeInterface $baseObject, DateTimeInterface $targetObject, bool $absolute = false) +{} /** * &Alias; DateTime::setTime * @link https://php.net/manual/en/function.date-time-set.php @@ -1102,11 +1137,11 @@ function date_diff (DateTimeInterface $baseObject, DateTimeInterface $targetObje * @param int $minute * @param int $second [optional] * @param int $microsecond [optional] - * @return void

Returns the + * @return DateTime

Returns the * {@see DateTime} object for method chaining or FALSE on failure.

*/ #[Pure] -function date_time_set (DateTime $object, int $hour, int $minute, int $second = 0, int $microsecond = 0) {} +function date_time_set (DateTime $object, int $hour, int $minute, int $second = 0, int $microsecond = 0): DateTime {} /** * &Alias; DateTime::setDate @@ -1123,7 +1158,9 @@ function date_time_set (DateTime $object, int $hour, int $minute, int $second = * {@see DateTime} object for method chaining or FALSE on failure. *

*/ -function date_date_set (DateTime $object, int $year, int $month, int $day) {} +#[LanguageLevelTypeAware(["8.0" => "DateTime"], default: "DateTime|false")] +function date_date_set (DateTime $object, int $year, int $month, int $day): DateTime|bool +{} /** * Alias: @@ -1137,7 +1174,9 @@ function date_date_set (DateTime $object, int $year, int $month, int $day) {} * Returns the {@see DateTime} object for method chaining or FALSE on failure. *

*/ -function date_isodate_set (DateTime $object, int $year, int $week, int $dayOfWeek = 1) {} +#[LanguageLevelTypeAware(["8.0" => "DateTime"], default: "DateTime|false")] +function date_isodate_set (DateTime $object, int $year, int $week, int $dayOfWeek = 1) +{} /** * Sets the date and time based on an unix timestamp @@ -1150,7 +1189,9 @@ function date_isodate_set (DateTime $object, int $year, int $week, int $dayOfWee * @return DateTime|false * {@see DateTime} object for call chaining or FALSE on failure */ -function date_timestamp_set (DateTime $object, int $timestamp) {} +#[LanguageLevelTypeAware(["8.0" => "DateTime"], default: "DateTime|false")] +function date_timestamp_set (DateTime $object, int $timestamp): DateTime|bool +{} /** * Gets the unix timestamp @@ -1161,7 +1202,8 @@ function date_timestamp_set (DateTime $object, int $timestamp) {} * @return int

Returns the Unix timestamp representing the date.

*/ #[Pure] -function date_timestamp_get (DateTimeInterface $object) {} +function date_timestamp_get (DateTimeInterface $object): int +{} /** * Returns new DateTimeZone object @@ -1173,7 +1215,8 @@ function date_timestamp_get (DateTimeInterface $object) {} * @return DateTimeZone|false DateTimeZone object on success or false on failure. */ #[Pure] -function timezone_open (string $timezone) {} +function timezone_open (string $timezone): DateTimeZone|false +{} /** * Alias: {@see DateTimeZone::getName} @@ -1183,7 +1226,8 @@ function timezone_open (string $timezone) {} * @return string One of the timezone names in the list of timezones. */ #[Pure] -function timezone_name_get (DateTimeZone $object) {} +function timezone_name_get (DateTimeZone $object): string +{} /** * Returns the timezone name from abbreviation @@ -1206,7 +1250,7 @@ function timezone_name_get (DateTimeZone $object) {} * @since 5.1.3 */ #[Pure] -function timezone_name_from_abbr (string $abbr, int $utcOffset, int $isDST) +function timezone_name_from_abbr (string $abbr, int $utcOffset, int $isDST): string|false {} /** @@ -1221,7 +1265,9 @@ function timezone_name_from_abbr (string $abbr, int $utcOffset, int $isDST) * @return int|false

Returns time zone offset in seconds on success or FALSE on failure.

*/ #[Pure] -function timezone_offset_get (DateTimeZone $object, DateTimeInterface $datetime) {} +#[LanguageLevelTypeAware(["8.0" => "int"], default: "int|false")] +function timezone_offset_get (DateTimeZone $object, DateTimeInterface $datetime) +{} /** * Returns all transitions for the timezone @@ -1236,16 +1282,18 @@ function timezone_offset_get (DateTimeZone $object, DateTimeInterface $datetime) * @return array|false

Returns numerically indexed array containing associative array with all transitions on success or FALSE on failure.

*/ #[Pure] -function timezone_transitions_get (DateTimeZone $object, int $timestampBegin, int $timestampEnd) {} +function timezone_transitions_get (DateTimeZone $object, int $timestampBegin, int $timestampEnd): array|false +{} /** * &Alias; {@see DateTimeZone::getLocation} * @link https://php.net/manual/en/function.timezone-location-get.php * @param DateTimeZone $object

Procedural style only: A {@see DateTimeZone} object returned by {@see timezone_open()} - * @return array

Array containing location information about timezone.

+ * @return array|false

Array containing location information about timezone.

*/ #[Pure] -function timezone_location_get (DateTimeZone $object) {} +function timezone_location_get (DateTimeZone $object): array|false +{} /** * Returns a numerically indexed array containing all defined timezone identifiers @@ -1258,7 +1306,9 @@ function timezone_location_get (DateTimeZone $object) {} * Note: This option is only used when what is set to DateTimeZone::PER_COUNTRY. */ #[Pure] -function timezone_identifiers_list (int $timezoneGroup = DateTimeZone::ALL, string $countryCode) {} +#[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] +function timezone_identifiers_list (int $timezoneGroup = DateTimeZone::ALL, string $countryCode) +{} /** * Returns associative array containing dst, offset and the timezone name @@ -1268,7 +1318,9 @@ function timezone_identifiers_list (int $timezoneGroup = DateTimeZone::ALL, stri * @return array|false Array on success or FALSE on failure. */ #[Pure] -function timezone_abbreviations_list () {} +#[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] +function timezone_abbreviations_list () +{} /** * Gets the version of the timezonedb @@ -1276,7 +1328,8 @@ function timezone_abbreviations_list () {} * @return string a string. */ #[Pure] -function timezone_version_get () {} +function timezone_version_get (): string +{} /** * Alias: @@ -1286,21 +1339,23 @@ function timezone_version_get () {} * {@see strtotime()} and * {@see DateTime} will be used to construct the * {@see DateInterval}.

- * @return DateInterval + * @return DateInterval|false *

Returns a new DateInterval instance.

*/ #[Pure] -function date_interval_create_from_date_string (string $datetime) {} +function date_interval_create_from_date_string (string $datetime): DateInterval|false +{} /** * &Alias; DateInterval::format * @link https://php.net/manual/en/function.date-interval-format.php * @param DateInterval $object * @param string $format - * @return DateInterval + * @return string */ #[Pure] -function date_interval_format (DateInterval $object, string $format) {} +function date_interval_format (DateInterval $object, string $format): string +{} /** * Sets the default timezone used by all date/time functions in a script @@ -1323,7 +1378,8 @@ function date_default_timezone_set (string $timezoneId): bool * @return string a string. */ #[Pure] -function date_default_timezone_get () {} +function date_default_timezone_get (): string +{} /** * Returns time of sunrise for a given day and location @@ -1369,11 +1425,12 @@ function date_default_timezone_get () {} * Default: date.sunrise_zenith *

* @param float $utcOffset [optional] - * @return mixed the sunrise time in a specified format on + * @return string|int|float|false the sunrise time in a specified format on * success or false on failure. */ #[Pure] -function date_sunrise (int $timestamp, int $returnFormat, float $latitude, float $longitude, float $zenith, float $utcOffset) {} +function date_sunrise (int $timestamp, int $returnFormat, float $latitude, float $longitude, float $zenith, float $utcOffset): string|int|float|false +{} /** * Returns time of sunset for a given day and location @@ -1419,11 +1476,12 @@ function date_sunrise (int $timestamp, int $returnFormat, float $latitude, float * Default: date.sunset_zenith *

* @param float $utcOffset [optional] - * @return mixed the sunset time in a specified format on + * @return string|int|float|false the sunset time in a specified format on * success or false on failure. */ #[Pure] -function date_sunset (int $timestamp, int $returnFormat, float $latitude, float $longitude, float $zenith, float $utcOffset) {} +function date_sunset (int $timestamp, int $returnFormat, float $latitude, float $longitude, float $zenith, float $utcOffset): string|int|float|false +{} /** * Returns an array with information about sunset/sunrise and twilight begin/end @@ -1441,6 +1499,8 @@ function date_sunset (int $timestamp, int $returnFormat, float $latitude, float * @since 5.1.2 */ #[Pure] -function date_sun_info (int $timestamp, float $latitude, float $longitude) {} +#[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] +function date_sun_info (int $timestamp, float $latitude, float $longitude) +{} // End of date v.5.3.2-0.dotdeb.1 diff --git a/dba/dba.php b/dba/dba.php index eb84fc767..6424c40dd 100644 --- a/dba/dba.php +++ b/dba/dba.php @@ -155,7 +155,7 @@ function dba_popen ($path, $mode, $handler, ...$handler_params) *

* @return void No value is returned. */ -function dba_close ($dba) {} +function dba_close ($dba): void {} /** * Delete DBA entry specified by key @@ -169,7 +169,8 @@ function dba_close ($dba) {} *

* @return bool TRUE on success or FALSE on failure. */ -function dba_delete ($key, $dba) {} +function dba_delete ($key, $dba): bool +{} /** * Check whether key exists @@ -183,7 +184,8 @@ function dba_delete ($key, $dba) {} *

* @return bool TRUE if the key exists, FALSE otherwise. */ -function dba_exists ($key, $dba) {} +function dba_exists ($key, $dba): bool +{} /** * Fetch data specified by key @@ -203,7 +205,8 @@ function dba_exists ($key, $dba) {} * @return string|false the associated string if the key/data pair is found, FALSE * otherwise. */ -function dba_fetch ($key, $handle) {} +function dba_fetch ($key, $handle): string|false +{} /** * Fetch data specified by key @@ -224,7 +227,8 @@ function dba_fetch ($key, $handle) {} * @return string|false the associated string if the key/data pair is found, FALSE * otherwise. */ -function dba_fetch ($key, $skip, $dba) {} +function dba_fetch ($key, $skip, $dba): string|false +{} /** * Insert entry @@ -243,7 +247,8 @@ function dba_fetch ($key, $skip, $dba) {} *

* @return bool TRUE on success or FALSE on failure. */ -function dba_insert ($key, string $value, $dba) {} +function dba_insert ($key, string $value, $dba): bool +{} /** * Replace or insert entry @@ -260,7 +265,8 @@ function dba_insert ($key, string $value, $dba) {} *

* @return bool TRUE on success or FALSE on failure. */ -function dba_replace ($key, string $value, $dba) {} +function dba_replace ($key, string $value, $dba): bool +{} /** * Fetch first key @@ -269,9 +275,10 @@ function dba_replace ($key, string $value, $dba) {} * The database handler, returned by dba_open or * dba_popen. *

- * @return string the key on success or FALSE on failure. + * @return string|false the key on success or FALSE on failure. */ -function dba_firstkey ($dba) {} +function dba_firstkey ($dba): string|false +{} /** * Fetch next key @@ -280,9 +287,10 @@ function dba_firstkey ($dba) {} * The database handler, returned by dba_open or * dba_popen. *

- * @return string the key on success or FALSE on failure. + * @return string|false the key on success or FALSE on failure. */ -function dba_nextkey ($dba) {} +function dba_nextkey ($dba): string|false +{} /** * Optimize database @@ -293,7 +301,8 @@ function dba_nextkey ($dba) {} *

* @return bool TRUE on success or FALSE on failure. */ -function dba_optimize ($dba) {} +function dba_optimize ($dba): bool +{} /** * Synchronize database @@ -304,7 +313,8 @@ function dba_optimize ($dba) {} *

* @return bool TRUE on success or FALSE on failure. */ -function dba_sync ($dba) {} +function dba_sync ($dba): bool +{} /** * List all the handlers available @@ -321,14 +331,16 @@ function dba_sync ($dba) {} * When the internal cdb library is used you will see * cdb and cdb_make. */ -function dba_handlers (bool $full_info = false) {} +function dba_handlers (bool $full_info = false): array +{} /** * List all open database files * @link https://php.net/manual/en/function.dba-list.php * @return array An associative array, in the form resourceid => filename. */ -function dba_list () {} +function dba_list (): array +{} /** * Splits a key in string representation into array representation @@ -340,6 +352,7 @@ function dba_list () {} * value_name). This function will return FALSE if * key is NULL or FALSE. */ -function dba_key_split (string|false|null $key) {} +function dba_key_split (string|false|null $key): array|false +{} // End of dba v. diff --git a/dom/dom.php b/dom/dom.php index d56143f61..65726de7f 100644 --- a/dom/dom.php +++ b/dom/dom.php @@ -11,7 +11,7 @@ *

* @return DOMElement|false The DOMElement node added or FALSE if any errors occur. */ -function dom_import_simplexml (object $node) {} +function dom_import_simplexml (object $node): DOMElement {} /** diff --git a/exif/exif.php b/exif/exif.php index c4e520e9f..7e0067762 100644 --- a/exif/exif.php +++ b/exif/exif.php @@ -11,7 +11,7 @@ * Since 7.2.0 this can either be a path to the file (stream wrappers are also supported as usual) * or a stream resource. *

- * @param null $required_sections [optional]

+ * @param string $required_sections [optional]

* Is a comma separated list of sections that need to be present in file * to produce a result array. If none of the requested * sections could be found the return value is FALSE. @@ -72,12 +72,12 @@ * When set to TRUE the thumbnail itself is read. Otherwise, only the * tagged data is read. *

- * @return array It returns an associative array where the array indexes are + * @return array|false It returns an associative array where the array indexes are * the header names and the array values are the values associated with * those headers. If no data can be returned, * exif_read_data will return FALSE. */ -function exif_read_data ($file, string $required_sections, bool $as_arrays = false, bool $read_thumbnail = false) +function exif_read_data ($file, string $required_sections, bool $as_arrays = false, bool $read_thumbnail = false): array|false {} /** @@ -101,7 +101,7 @@ function read_exif_data ($filename, $sections = null, $arrays = false, $thumbnai * @return string|false the header name, or FALSE if index is * not a defined EXIF tag id. */ -function exif_tagname (int $index) {} +function exif_tagname (int $index): string|false {} /** * Retrieve the embedded thumbnail of a TIFF or JPEG image @@ -124,7 +124,7 @@ function exif_tagname (int $index) {} * @return string|false the embedded thumbnail, or FALSE if the image contains no * thumbnail. */ -function exif_thumbnail ($file, &$width, &$height, &$image_type) {} +function exif_thumbnail ($file, &$width, &$height, &$image_type): string|false {} /** * Determine the type of an image @@ -140,7 +140,7 @@ function exif_thumbnail ($file, &$width, &$height, &$image_type) {} * and return FALSE if it is unable to read enough bytes from the file to * determine the image type. */ -function exif_imagetype (string $filename) {} +function exif_imagetype (string $filename): int|false {} define ('EXIF_USE_MBSTRING', 1); diff --git a/fileinfo/fileinfo.php b/fileinfo/fileinfo.php index e63b3ec19..bdec41691 100644 --- a/fileinfo/fileinfo.php +++ b/fileinfo/fileinfo.php @@ -82,7 +82,8 @@ public function buffer ($string = null, $options = FILEINFO_NONE, $context = nul *

* @return resource|false a magic database resource on success or FALSE on failure. */ -function finfo_open (int $flags, string $magic_database) {} +function finfo_open (int $flags, string $magic_database) +{} /** * (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)
@@ -93,7 +94,8 @@ function finfo_open (int $flags, string $magic_database) {} *

* @return bool TRUE on success or FALSE on failure. */ -function finfo_close ($finfo) {} +function finfo_close ($finfo): bool +{} /** * (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)
@@ -108,7 +110,8 @@ function finfo_close ($finfo) {} *

* @return bool TRUE on success or FALSE on failure. */ -function finfo_set_flags ($finfo, int $flags) {} +function finfo_set_flags ($finfo, int $flags): bool +{} /** * (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)
@@ -127,10 +130,10 @@ function finfo_set_flags ($finfo, int $flags) {} * @param resource $context [optional]

* For a description of contexts, refer to . *

- * @return mixed a textual description of the contents of the + * @return string|false a textual description of the contents of the * filename argument, or FALSE if an error occurred. */ -function finfo_file ($finfo, string $filename, int $flags, $context) +function finfo_file ($finfo, string $filename, int $flags, $context): string|false {} /** @@ -156,7 +159,8 @@ function finfo_file ($finfo, string $filename, int $flags, $context) * @return string|false a textual description of the string * argument, or FALSE if an error occurred. */ -function finfo_buffer ($finfo , string $string, int $flags = FILEINFO_NONE, $context) {} +function finfo_buffer ($finfo , string $string, int $flags = FILEINFO_NONE, $context): string|false +{} /** * Detect MIME Content-type for a file @@ -164,10 +168,11 @@ function finfo_buffer ($finfo , string $string, int $flags = FILEINFO_NONE, $con * @param string $filename

* Path to the tested file. *

- * @return string the content type in MIME format, like + * @return string|false the content type in MIME format, like * text/plain or application/octet-stream. */ -function mime_content_type ($filename) {} +function mime_content_type ($filename): string|false +{} /** diff --git a/filter/filter.php b/filter/filter.php index d4e8abce3..2e05354b7 100644 --- a/filter/filter.php +++ b/filter/filter.php @@ -28,7 +28,8 @@ * returns FALSE if the variable is not set and NULL if the filter fails. */ #[Pure] -function filter_input (int $type, string $var_name, int $filter = FILTER_DEFAULT, array|int $options) {} +function filter_input (int $type, string $var_name, int $filter = FILTER_DEFAULT, array|int $options): mixed +{} /** * Filters a variable with a specified filter @@ -84,7 +85,8 @@ function filter_input (int $type, string $var_name, int $filter = FILTER_DEFAULT * @return mixed the filtered data, or FALSE if the filter fails. */ #[Pure] -function filter_var (mixed $value, int $filter = FILTER_DEFAULT, array|int $options) {} +function filter_var (mixed $value, int $filter = FILTER_DEFAULT, array|int $options): mixed +{} /** * Gets external variables and optionally filters them @@ -111,14 +113,15 @@ function filter_var (mixed $value, int $filter = FILTER_DEFAULT, array|int $opti * @param bool $add_empty [optional]

* Add missing keys as NULL to the return value. *

- * @return mixed An array containing the values of the requested variables on success, or FALSE + * @return array|false|null An array containing the values of the requested variables on success, or FALSE * on failure. An array value will be FALSE if the filter fails, or NULL if * the variable is not set. Or if the flag FILTER_NULL_ON_FAILURE * is used, it returns FALSE if the variable is not set and NULL if the filter * fails. */ #[Pure] -function filter_input_array (int $type, array|int $options, bool $add_empty = true) {} +function filter_input_array (int $type, array|int $options, bool $add_empty = true): array|false|null +{} /** * Gets multiple variables and optionally filters them @@ -144,12 +147,13 @@ function filter_input_array (int $type, array|int $options, bool $add_empty = tr * @param bool $add_empty [optional]

* Add missing keys as NULL to the return value. *

- * @return mixed An array containing the values of the requested variables on success, or FALSE + * @return array|false|null An array containing the values of the requested variables on success, or FALSE * on failure. An array value will be FALSE if the filter fails, or NULL if * the variable is not set. */ #[Pure] -function filter_var_array (array $array, array|int $options, bool $add_empty = true) {} +function filter_var_array (array $array, array|int $options, bool $add_empty = true): array|false|null +{} /** * Returns a list of all supported filters @@ -159,7 +163,8 @@ function filter_var_array (array $array, array|int $options, bool $add_empty = t * obtained with filter_id from a name instead. */ #[Pure] -function filter_list () {} +function filter_list (): array +{} /** * Checks if variable of specified type exists @@ -175,7 +180,8 @@ function filter_list () {} * @return bool TRUE on success or FALSE on failure. */ #[Pure] -function filter_has_var (int $input_type, string $var_name) {} +function filter_has_var (int $input_type, string $var_name): bool +{} /** * Returns the filter ID belonging to a named filter @@ -186,7 +192,8 @@ function filter_has_var (int $input_type, string $var_name) {} * @return int|false ID of a filter on success or FALSE if filter doesn't exist. */ #[Pure] -function filter_id (string $name) {} +function filter_id (string $name): int|false +{} /** diff --git a/ftp/ftp.php b/ftp/ftp.php index a38d6223b..d29bd5d98 100644 --- a/ftp/ftp.php +++ b/ftp/ftp.php @@ -11,16 +11,18 @@ * @return bool * @since 7.2 */ -function ftp_append ($ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY){} +function ftp_append ($ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY): bool +{} /** * returns a list of files in the given directory * @param resource $ftp * @param string $directory - * @return array + * @return array|false * @since 7.2 */ -function ftp_mlsd ($ftp, string $directory) {} +function ftp_mlsd ($ftp, string $directory): array|false +{} /** * Opens an FTP connection @@ -41,7 +43,8 @@ function ftp_mlsd ($ftp, string $directory) {} *

* @return resource|false a FTP stream on success or FALSE on error. */ -function ftp_connect (string $hostname, int $port = 21, int $timeout = 90) {} +function ftp_connect (string $hostname, int $port = 21, int $timeout = 90) +{} /** * Opens a Secure SSL-FTP connection @@ -62,7 +65,8 @@ function ftp_connect (string $hostname, int $port = 21, int $timeout = 90) {} *

* @return resource|false a SSL-FTP stream on success or FALSE on error. */ -function ftp_ssl_connect (string $hostname, int $port = 21, int $timeout = 90) {} +function ftp_ssl_connect (string $hostname, int $port = 21, int $timeout = 90) +{} /** * Logs in to an FTP connection @@ -79,7 +83,8 @@ function ftp_ssl_connect (string $hostname, int $port = 21, int $timeout = 90) { * @return bool TRUE on success or FALSE on failure. * If login fails, PHP will also throw a warning. */ -function ftp_login ($ftp, string $username, string $password) {} +function ftp_login ($ftp, string $username, string $password): bool +{} /** * Returns the current directory name @@ -89,7 +94,8 @@ function ftp_login ($ftp, string $username, string $password) {} *

* @return string|false the current directory name or FALSE on error. */ -function ftp_pwd ($ftp) {} +function ftp_pwd ($ftp): string|false +{} /** * Changes to the parent directory @@ -99,7 +105,8 @@ function ftp_pwd ($ftp) {} *

* @return bool TRUE on success or FALSE on failure. */ -function ftp_cdup ($ftp) {} +function ftp_cdup ($ftp): bool +{} /** * Changes the current directory on a FTP server @@ -113,7 +120,8 @@ function ftp_cdup ($ftp) {} * @return bool TRUE on success or FALSE on failure. * If changing directory fails, PHP will also throw a warning. */ -function ftp_chdir ($ftp, string $directory) {} +function ftp_chdir ($ftp, string $directory): bool +{} /** * Requests execution of a command on the FTP server @@ -127,7 +135,8 @@ function ftp_chdir ($ftp, string $directory) {} * @return bool TRUE if the command was successful (server sent response code: * 200); otherwise returns FALSE. */ -function ftp_exec ($ftp, string $command) {} +function ftp_exec ($ftp, string $command): bool +{} /** * Sends an arbitrary command to an FTP server @@ -142,7 +151,8 @@ function ftp_exec ($ftp, string $command) {} * No parsing is performed on the response string, nor does * ftp_raw determine if the command succeeded. */ -function ftp_raw ($ftp, string $command) {} +function ftp_raw ($ftp, string $command): array +{} /** * Creates a directory @@ -155,7 +165,8 @@ function ftp_raw ($ftp, string $command) {} *

* @return string|false the newly created directory name on success or FALSE on error. */ -function ftp_mkdir ($ftp, string $directory) {} +function ftp_mkdir ($ftp, string $directory): string|false +{} /** * Removes a directory @@ -169,7 +180,8 @@ function ftp_mkdir ($ftp, string $directory) {} *

* @return bool TRUE on success or FALSE on failure. */ -function ftp_rmdir ($ftp, string $directory) {} +function ftp_rmdir ($ftp, string $directory): bool +{} /** * Set permissions on a file via FTP @@ -185,7 +197,8 @@ function ftp_rmdir ($ftp, string $directory) {} *

* @return int|false the new file permissions on success or FALSE on error. */ -function ftp_chmod ($ftp, int $permissions, string $filename) {} +function ftp_chmod ($ftp, int $permissions, string $filename): int|false +{} /** * Allocates space for a file to be uploaded @@ -202,7 +215,7 @@ function ftp_chmod ($ftp, int $permissions, string $filename) {} *

* @return bool TRUE on success or FALSE on failure. */ -function ftp_alloc ($ftp, int $size, &$response) +function ftp_alloc ($ftp, int $size, &$response): bool {} /** @@ -220,7 +233,8 @@ function ftp_alloc ($ftp, int $size, &$response) * @return array|false an array of filenames from the specified directory on success or * FALSE on error. */ -function ftp_nlist ($ftp, string $directory) {} +function ftp_nlist ($ftp, string $directory): array|false +{} /** * Returns a detailed list of files in the given directory @@ -235,14 +249,15 @@ function ftp_nlist ($ftp, string $directory) {} * @param bool $recursive [optional]

* If set to TRUE, the issued command will be LIST -R. *

- * @return array an array where each element corresponds to one line of text. + * @return array|false an array where each element corresponds to one line of text. *

*

* The output is not parsed in any way. The system type identifier returned by * ftp_systype can be used to determine how the results * should be interpreted. */ -function ftp_rawlist ($ftp, string $directory, bool $recursive = false) {} +function ftp_rawlist ($ftp, string $directory, bool $recursive = false): array|false +{} /** * Returns the system type identifier of the remote FTP server @@ -252,7 +267,8 @@ function ftp_rawlist ($ftp, string $directory, bool $recursive = false) {} *

* @return string|false the remote system type, or FALSE on error. */ -function ftp_systype ($ftp) {} +function ftp_systype ($ftp): string|false +{} /** * Turns passive mode on or off @@ -265,7 +281,8 @@ function ftp_systype ($ftp) {} *

* @return bool TRUE on success or FALSE on failure. */ -function ftp_pasv ($ftp, bool $enable) {} +function ftp_pasv ($ftp, bool $enable): bool +{} /** * Downloads a file from the FTP server @@ -288,7 +305,8 @@ function ftp_pasv ($ftp, bool $enable) {} *

* @return bool TRUE on success or FALSE on failure. */ -function ftp_get ($ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0) {} +function ftp_get ($ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool +{} /** * Downloads a file from the FTP server and saves to an open file @@ -311,7 +329,8 @@ function ftp_get ($ftp, string $local_filename, string $remote_filename, int $mo *

* @return bool TRUE on success or FALSE on failure. */ -function ftp_fget ($ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0) {} +function ftp_fget ($ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool +{} /** * Uploads a file to the FTP server @@ -332,7 +351,8 @@ function ftp_fget ($ftp, $stream, string $remote_filename, int $mode = FTP_BINAR * @param int $offset [optional]

The position in the remote file to start uploading to.

* @return bool TRUE on success or FALSE on failure. */ -function ftp_put ($ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0) {} +function ftp_put ($ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): bool +{} /** * Uploads from an open file to the FTP server @@ -353,7 +373,8 @@ function ftp_put ($ftp, string $remote_filename, string $local_filename, int $mo * @param int $offset [optional]

The position in the remote file to start uploading to.

* @return bool TRUE on success or FALSE on failure. */ -function ftp_fput ($ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0) {} +function ftp_fput ($ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): bool +{} /** * Returns the size of the given file @@ -366,7 +387,8 @@ function ftp_fput ($ftp, string $remote_filename, $stream, int $mode = FTP_BINAR *

* @return int the file size on success, or -1 on error. */ -function ftp_size ($ftp, string $filename) {} +function ftp_size ($ftp, string $filename): int +{} /** * Returns the last modified time of the given file @@ -380,7 +402,8 @@ function ftp_size ($ftp, string $filename) {} * @return int the last modified time as a Unix timestamp on success, or -1 on * error. */ -function ftp_mdtm ($ftp, string $filename) {} +function ftp_mdtm ($ftp, string $filename): int +{} /** * Renames a file or a directory on the FTP server @@ -396,7 +419,8 @@ function ftp_mdtm ($ftp, string $filename) {} *

* @return bool TRUE on success or FALSE on failure. */ -function ftp_rename ($ftp, string $from, string $to) {} +function ftp_rename ($ftp, string $from, string $to): bool +{} /** * Deletes a file on the FTP server @@ -409,7 +433,8 @@ function ftp_rename ($ftp, string $from, string $to) {} *

* @return bool TRUE on success or FALSE on failure. */ -function ftp_delete ($ftp, string $filename) {} +function ftp_delete ($ftp, string $filename): bool +{} /** * Sends a SITE command to the server @@ -423,7 +448,8 @@ function ftp_delete ($ftp, string $filename) {} *

* @return bool TRUE on success or FALSE on failure. */ -function ftp_site ($ftp, string $command) {} +function ftp_site ($ftp, string $command): bool +{} /** * Closes an FTP connection @@ -433,7 +459,8 @@ function ftp_site ($ftp, string $command) {} *

* @return bool TRUE on success or FALSE on failure. */ -function ftp_close ($ftp) {} +function ftp_close ($ftp): bool +{} /** * Set miscellaneous runtime FTP options @@ -473,7 +500,8 @@ function ftp_close ($ftp) {} * supported or the passed value doesn't match the * expected value for the given option. */ -function ftp_set_option ($ftp, int $option, $value) {} +function ftp_set_option ($ftp, int $option, $value): bool +{} /** * Retrieves various runtime behaviours of the current FTP stream @@ -499,11 +527,12 @@ function ftp_set_option ($ftp, int $option, $value) {} * * *

- * @return mixed the value on success or FALSE if the given + * @return int|bool the value on success or FALSE if the given * option is not supported. In the latter case, a * warning message is also thrown. */ -function ftp_get_option ($ftp, int $option) {} +function ftp_get_option ($ftp, int $option): int|bool +{} /** * Retrieves a file from the FTP server and writes it to an open file (non-blocking) @@ -525,7 +554,8 @@ function ftp_get_option ($ftp, int $option) {} * @return int FTP_FAILED or FTP_FINISHED * or FTP_MOREDATA. */ -function ftp_nb_fget ($ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0) {} +function ftp_nb_fget ($ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int +{} /** * Retrieves a file from the FTP server and writes it to a local file (non-blocking) @@ -547,7 +577,8 @@ function ftp_nb_fget ($ftp, $stream, string $remote_filename, int $mode = FTP_BI * @return int FTP_FAILED or FTP_FINISHED * or FTP_MOREDATA. */ -function ftp_nb_get ($ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0) {} +function ftp_nb_get ($ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int +{} /** * Continues retrieving/sending a file (non-blocking) @@ -558,7 +589,8 @@ function ftp_nb_get ($ftp, string $local_filename, string $remote_filename, int * @return int FTP_FAILED or FTP_FINISHED * or FTP_MOREDATA. */ -function ftp_nb_continue ($ftp) {} +function ftp_nb_continue ($ftp): int +{} /** * Stores a file on the FTP server (non-blocking) @@ -577,10 +609,11 @@ function ftp_nb_continue ($ftp) {} * FTP_BINARY. *

* @param int $offset [optional]

The position in the remote file to start uploading to.

- * @return int FTP_FAILED or FTP_FINISHED + * @return int|false FTP_FAILED or FTP_FINISHED * or FTP_MOREDATA. */ -function ftp_nb_put ($ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0) {} +function ftp_nb_put ($ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): int|false +{} /** * Stores a file from an open file to the FTP server (non-blocking) @@ -602,7 +635,8 @@ function ftp_nb_put ($ftp, string $remote_filename, string $local_filename, int * @return int FTP_FAILED or FTP_FINISHED * or FTP_MOREDATA. */ -function ftp_nb_fput ($ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0) {} +function ftp_nb_fput ($ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): int +{} /** * Alias of ftp_close @@ -610,7 +644,8 @@ function ftp_nb_fput ($ftp, string $remote_filename, $stream, int $mode = FTP_BI * @param resource $ftp * @return bool TRUE on success or FALSE on failure. */ -function ftp_quit ($ftp) {} +function ftp_quit ($ftp): bool +{} /** diff --git a/gettext/gettext.php b/gettext/gettext.php index d6e342fd1..0bc2e7a94 100644 --- a/gettext/gettext.php +++ b/gettext/gettext.php @@ -13,7 +13,8 @@ * @return string If successful, this function returns the current message * domain, after possibly changing it. */ -function textdomain (string $domain) {} +function textdomain (string $domain): string +{} /** * Lookup a message in the current domain @@ -25,7 +26,8 @@ function textdomain (string $domain) {} * translation table, or the submitted message if not found. */ #[Pure] -function _ (string $message) {} +function _ (string $message): string +{} /** * Lookup a message in the current domain @@ -37,7 +39,8 @@ function _ (string $message) {} * translation table, or the submitted message if not found. */ #[Pure] -function gettext (string $message) {} +function gettext (string $message): string +{} /** * Override the current domain @@ -50,7 +53,8 @@ function gettext (string $message) {} *

* @return string A string on success. */ -function dgettext (string $domain, string $message) {} +function dgettext (string $domain, string $message): string +{} /** * Overrides the domain for a single lookup @@ -66,7 +70,8 @@ function dgettext (string $domain, string $message) {} *

* @return string A string on success. */ -function dcgettext (string $domain, string $message, int $category) {} +function dcgettext (string $domain, string $message, int $category): string +{} /** * Sets the path for a domain @@ -77,9 +82,10 @@ function dcgettext (string $domain, string $message, int $category) {} * @param string $directory

* The directory path *

- * @return string The full pathname for the domain currently being set. + * @return string|false The full pathname for the domain currently being set. */ -function bindtextdomain (string $domain, string $directory) {} +function bindtextdomain (string $domain, string $directory): string|false +{} /** * Plural version of gettext @@ -92,7 +98,8 @@ function bindtextdomain (string $domain, string $directory) {} * for count n. */ #[Pure] -function ngettext (string $singular, string $plural, int $count) {} +function ngettext (string $singular, string $plural, int $count): string +{} /** * Plural version of dgettext @@ -106,7 +113,8 @@ function ngettext (string $singular, string $plural, int $count) {} * @return string A string on success. */ #[Pure] -function dngettext (string $domain, string $singular, string $plural, int $count) {} +function dngettext (string $domain, string $singular, string $plural, int $count): string +{} /** * Plural version of dcgettext @@ -121,7 +129,8 @@ function dngettext (string $domain, string $singular, string $plural, int $count * @return string A string on success. */ #[Pure] -function dcngettext (string $domain, string $singular, string $plural, int $count, int $category) {} +function dcngettext (string $domain, string $singular, string $plural, int $count, int $category): string +{} /** * Specify the character encoding in which the messages from the DOMAIN message catalog will be returned @@ -132,9 +141,10 @@ function dcngettext (string $domain, string $singular, string $plural, int $coun * @param string $codeset

* The code set *

- * @return string A string on success. + * @return string|false A string on success. */ -function bind_textdomain_codeset (string $domain, string $codeset) {} +function bind_textdomain_codeset (string $domain, string $codeset): string|false +{} // End of gettext v. ?> diff --git a/hash/hash.php b/hash/hash.php index 7a6f62560..22cff9640 100644 --- a/hash/hash.php +++ b/hash/hash.php @@ -17,12 +17,13 @@ * When set to TRUE, outputs raw binary data. * FALSE outputs lowercase hexits. *

- * @return string a string containing the calculated message digest as lowercase hexits + * @return string|false a string containing the calculated message digest as lowercase hexits * unless raw_output is set to true in which case the raw * binary representation of the message digest is returned. */ #[Pure] -function hash (string $algo, string $data, bool $binary = false) {} +function hash (string $algo, string $data, bool $binary = false): string|false +{} /** * Timing attack safe string comparison @@ -33,7 +34,8 @@ function hash (string $algo, string $data, bool $binary = false) {} * @since 5.6 */ #[Pure] -function hash_equals(string $known_string, string $user_string) {} +function hash_equals(string $known_string, string $user_string): bool +{} /** * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
@@ -49,12 +51,13 @@ function hash_equals(string $known_string, string $user_string) {} * When set to TRUE, outputs raw binary data. * FALSE outputs lowercase hexits. *

- * @return string a string containing the calculated message digest as lowercase hexits + * @return string|false a string containing the calculated message digest as lowercase hexits * unless raw_output is set to true in which case the raw * binary representation of the message digest is returned. */ #[Pure] -function hash_file (string $algo, string $filename, bool $binary = false) {} +function hash_file (string $algo, string $filename, bool $binary = false): string|false +{} /** * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
@@ -74,12 +77,13 @@ function hash_file (string $algo, string $filename, bool $binary = false) {} * When set to TRUE, outputs raw binary data. * FALSE outputs lowercase hexits. *

- * @return string a string containing the calculated message digest as lowercase hexits + * @return string|false a string containing the calculated message digest as lowercase hexits * unless raw_output is set to true in which case the raw * binary representation of the message digest is returned. */ #[Pure] -function hash_hmac (string $algo, string $data, string $key, bool $binary = false) {} +function hash_hmac (string $algo, string $data, string $key, bool $binary = false): string|false +{} /** * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
@@ -99,12 +103,13 @@ function hash_hmac (string $algo, string $data, string $key, bool $binary = fals * When set to TRUE, outputs raw binary data. * FALSE outputs lowercase hexits. *

- * @return string a string containing the calculated message digest as lowercase hexits + * @return string|false a string containing the calculated message digest as lowercase hexits * unless raw_output is set to true in which case the raw * binary representation of the message digest is returned. */ #[Pure] -function hash_hmac_file (string $algo, string $data, string $key, bool $binary = false) {} +function hash_hmac_file (string $algo, string $data, string $key, bool $binary = false): string|false +{} /** * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
@@ -129,7 +134,7 @@ function hash_hmac_file (string $algo, string $data, string $key, bool $binary = * and hash_final. */ #[Pure] -function hash_init (string $algo, int $flags = 0, string $key) +function hash_init (string $algo, int $flags = 0, string $key): HashContext {} /** @@ -144,7 +149,8 @@ function hash_init (string $algo, int $flags = 0, string $key) *

* @return bool TRUE. */ -function hash_update (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default: "resource")] $context, string $data){} +function hash_update (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default: "resource")] $context, string $data): bool +{} /** * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
@@ -162,7 +168,7 @@ function hash_update (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default *

* @return int Actual number of bytes added to the hashing context from handle. */ -function hash_update_stream (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default: "resource")] $context, $stream, int $length = -1) +function hash_update_stream (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default: "resource")] $context, $stream, int $length = -1): int {} /** @@ -180,7 +186,7 @@ function hash_update_stream (#[LanguageLevelTypeAware(["8.0" => "HashContext"], *

* @return bool TRUE on success or FALSE on failure. */ -function hash_update_file (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default: "resource")] $context, string $filename, $stream_context) +function hash_update_file (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default: "resource")] $context, string $filename, $stream_context): bool {} /** @@ -198,7 +204,7 @@ function hash_update_file (#[LanguageLevelTypeAware(["8.0" => "HashContext"], de * unless raw_output is set to true in which case the raw * binary representation of the message digest is returned. */ -function hash_final (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default: "resource")] $context, bool $binary = false) +function hash_final (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default: "resource")] $context, bool $binary = false): string {} /** @@ -210,7 +216,8 @@ function hash_final (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default: * @return HashContext|resource a copy of Hashing Context resource. */ #[Pure] -function hash_copy (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default: "resource")] $context) {} +function hash_copy (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default: "resource")] $context): HashContext +{} /** * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
@@ -220,7 +227,8 @@ function hash_copy (#[LanguageLevelTypeAware(["8.0" => "HashContext"], default: * hashing algorithms. */ #[Pure] -function hash_algos () {} +function hash_algos (): array +{} /** @@ -244,7 +252,9 @@ function hash_algos () {} * @link https://php.net/manual/en/function.hash-hkdf.php */ #[Pure] -function hash_hkdf(string $algo , string $key, int $length = 0, string $info = '', string $salt = '') {} +#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false")] +function hash_hkdf(string $algo , string $key, int $length = 0, string $info = '', string $salt = '') +{} /** * Return a list of registered hashing algorithms suitable for hash_hmac @@ -253,7 +263,8 @@ function hash_hkdf(string $algo , string $key, int $length = 0, string $info = ' * @return string[] Returns a numerically indexed array containing the list of supported hashing algorithms suitable for {@see hash_hmac()}. */ #[Pure] -function hash_hmac_algos() {} +function hash_hmac_algos(): array +{} /** * Generate a PBKDF2 key derivation of a supplied password @@ -279,13 +290,14 @@ function hash_hmac_algos() {} * @param bool $binary [optional]

* When set to TRUE, outputs raw binary data. FALSE outputs lowercase hexits. *

- * @return mixed a string containing the derived key as lowercase hexits unless + * @return string a string containing the derived key as lowercase hexits unless * raw_output is set to TRUE in which case the raw * binary representation of the derived key is returned. * @since 5.5 */ #[Pure] -function hash_pbkdf2 (string $algo, string $password, string $salt, int $iterations, int $length = 0, bool $binary = false) {} +function hash_pbkdf2 (string $algo, string $password, string $salt, int $iterations, int $length = 0, bool $binary = false): string +{} /** * Generates a key @@ -310,7 +322,8 @@ function hash_pbkdf2 (string $algo, string $password, string $salt, int $iterati * @return string|false the generated key as a string, or FALSE on error. */ #[Pure] -function mhash_keygen_s2k (int $algo, string $password, string $salt, int $length) {} +function mhash_keygen_s2k (int $algo, string $password, string $salt, int $length): string|false +{} /** * Gets the block size of the specified hash @@ -322,7 +335,8 @@ function mhash_keygen_s2k (int $algo, string $password, string $salt, int $lengt * does not exist. */ #[Pure] -function mhash_get_block_size (int $algo) {} +function mhash_get_block_size (int $algo): int|false +{} /** * Gets the name of the specified hash @@ -333,7 +347,8 @@ function mhash_get_block_size (int $algo) {} * @return string|false the name of the hash or FALSE, if the hash does not exist. */ #[Pure] -function mhash_get_hash_name (int $algo) {} +function mhash_get_hash_name (int $algo): string|false +{} /** * Gets the highest available hash ID @@ -342,7 +357,8 @@ function mhash_get_hash_name (int $algo) {} * hash ID. */ #[Pure] -function mhash_count () {} +function mhash_count (): int +{} /** * Computes hash @@ -359,11 +375,11 @@ function mhash_count () {} * digest that depends on the specified key. Not all algorithms * supported in mhash can be used in HMAC mode. *

- * @return string the resulting hash (also called digest) or HMAC as a string, or + * @return string|false the resulting hash (also called digest) or HMAC as a string, or * FALSE on error. */ #[Pure] -function mhash (int $algo, string $data, string $key) +function mhash (int $algo, string $data, string $key): string|false {} diff --git a/iconv/iconv.php b/iconv/iconv.php index c5cdeb8c9..569494e8a 100644 --- a/iconv/iconv.php +++ b/iconv/iconv.php @@ -28,7 +28,8 @@ * @return string|false the converted string or FALSE on failure. */ #[Pure] -function iconv (string $from_encoding, string $to_encoding, string $string) {} +function iconv (string $from_encoding, string $to_encoding, string $string): string|false +{} /** * Convert character encoding as output buffer handler @@ -39,7 +40,8 @@ function iconv (string $from_encoding, string $to_encoding, string $string) {} * return values. */ #[Pure] -function ob_iconv_handler (string $contents, int $status) {} +function ob_iconv_handler (string $contents, int $status): string +{} /** * Retrieve internal configuration variables of iconv extension @@ -61,7 +63,8 @@ function ob_iconv_handler (string $contents, int $status) {} *

*/ #[Pure] -function iconv_get_encoding (string $type = "all") {} +function iconv_get_encoding (string $type = "all"): array|string|false +{} /** * Set current setting for character encoding conversion @@ -77,7 +80,8 @@ function iconv_get_encoding (string $type = "all") {} *

* @return bool TRUE on success or FALSE on failure. */ -function iconv_set_encoding (string $type, string $encoding) {} +function iconv_set_encoding (string $type, string $encoding): bool +{} /** * Returns the character count of string @@ -93,7 +97,8 @@ function iconv_set_encoding (string $type, string $encoding) {} * @return int|false the character count of str, as an integer. False on error. */ #[Pure] -function iconv_strlen (string $string, string $encoding = 'ini_get("iconv.internal_encoding")') {} +function iconv_strlen (string $string, string $encoding = 'ini_get("iconv.internal_encoding")'): int|false +{} /** * Cut out part of a string @@ -149,7 +154,7 @@ function iconv_strlen (string $string, string $encoding = 'ini_get("iconv.intern *

*/ #[Pure] -function iconv_substr (string $string, int $offset, int $length, string $encoding = 'ini_get("iconv.internal_encoding")') +function iconv_substr (string $string, int $offset, int $length, string $encoding = 'ini_get("iconv.internal_encoding")'): string|false {} /** @@ -179,7 +184,8 @@ function iconv_substr (string $string, int $offset, int $length, string $encodin *

*/ #[Pure] -function iconv_strpos (string $haystack, string $needle, int $offset = 0, string $encoding = 'ini_get("iconv.internal_encoding")') {} +function iconv_strpos (string $haystack, string $needle, int $offset = 0, string $encoding = 'ini_get("iconv.internal_encoding")'): int|false +{} /** * Finds the last occurrence of a needle within a haystack @@ -204,7 +210,8 @@ function iconv_strpos (string $haystack, string $needle, int $offset = 0, string *

*/ #[Pure] -function iconv_strrpos (string $haystack, string $needle, string $encoding = 'ini_get("iconv.internal_encoding")') {} +function iconv_strrpos (string $haystack, string $needle, string $encoding = 'ini_get("iconv.internal_encoding")'): int|false +{} /** * Composes a MIME header field @@ -305,7 +312,7 @@ function iconv_strrpos (string $haystack, string $needle, string $encoding = 'in * or FALSE if an error occurs during the encoding. */ #[Pure] -function iconv_mime_encode (string $field_name, string $field_value, array $options) +function iconv_mime_encode (string $field_name, string $field_value, array $options): string|false {} /** @@ -358,7 +365,8 @@ function iconv_mime_encode (string $field_name, string $field_value, array $opti * or FALSE if an error occurs during the decoding. */ #[Pure] -function iconv_mime_decode (string $string, int $mode = 0, string $encoding = 'ini_get("iconv.internal_encoding")') {} +function iconv_mime_decode (string $string, int $mode = 0, string $encoding = 'ini_get("iconv.internal_encoding")'): string|false +{} /** * Decodes multiple MIME header fields at once @@ -420,7 +428,8 @@ function iconv_mime_decode (string $string, int $mode = 0, string $encoding = 'i *

*/ #[Pure] -function iconv_mime_decode_headers (string $headers, int $mode = 0, string $encoding = 'ini_get("iconv.internal_encoding")') {} +function iconv_mime_decode_headers (string $headers, int $mode = 0, string $encoding = 'ini_get("iconv.internal_encoding")'): array|false +{} /** diff --git a/json/json.php b/json/json.php index a533837d1..294400114 100644 --- a/json/json.php +++ b/json/json.php @@ -92,7 +92,7 @@ public function get ($options) {} *

* @return string|false a JSON encoded string on success or FALSE on failure. */ -function json_encode (mixed $value, int $flags = 0, int $depth = 512) {} +function json_encode (mixed $value, int $flags = 0, int $depth = 512): string|false {} /** * (PHP 5 >= 5.2.0, PECL json >= 1.2.0)
@@ -130,7 +130,7 @@ function json_encode (mixed $value, int $flags = 0, int $depth = 512) {} * json cannot be decoded or if the encoded * data is deeper than the recursion limit. */ -function json_decode (string $json, bool $associative = false, int $depth = 512, int $flags = 0) {} +function json_decode (string $json, bool $associative = false, int $depth = 512, int $flags = 0): mixed {} /** * Returns the last error occurred @@ -224,16 +224,16 @@ function json_decode (string $json, bool $associative = false, int $depth = 512, * */ #[Pure] -function json_last_error () {} +function json_last_error (): int {} /** * Returns the error string of the last json_encode() or json_decode() call, which did not specify JSON_THROW_ON_ERROR. * @link https://php.net/manual/en/function.json-last-error-msg.php - * @return string|false Returns the error message on success, "No error" if no error has occurred, or FALSE on failure. + * @return string Returns the error message on success, "No error" if no error has occurred. * @since 5.5 */ #[Pure] -function json_last_error_msg () {} +function json_last_error_msg (): string {} /** diff --git a/ldap/ldap.php b/ldap/ldap.php index a9ad65b22..5e22d46fa 100644 --- a/ldap/ldap.php +++ b/ldap/ldap.php @@ -14,7 +14,8 @@ * @return string|bool Returns the generated password if newpw is empty or omitted. Otherwise returns TRUE on success and FALSE on failure. * @since 7.2 */ -function ldap_exop_passwd ($ldap , string $user = "" , string $old_password = "" , string $new_password = "" , &$controls = []) {} +function ldap_exop_passwd ($ldap , string $user = "" , string $old_password = "" , string $new_password = "" , &$controls = []): string|bool +{} /** * Refresh extended operation helper @@ -25,7 +26,8 @@ function ldap_exop_passwd ($ldap , string $user = "" , string $old_password = "" * @return int|false From RFC: The responseTtl field is the time in seconds which the server chooses to have as the time-to-live field for that entry. It must not be any smaller than that which the client requested, and it may be larger. However, to allow servers to maintain a relatively accurate directory, and to prevent clients from abusing the dynamic extensions, servers are permitted to shorten a client-requested time-to-live value, down to a minimum of 86400 seconds (one day). FALSE will be returned on error. * @since 7.3 */ -function ldap_exop_refresh ($ldap, string $dn, int $ttl) {} +function ldap_exop_refresh ($ldap, string $dn, int $ttl): int|false +{} /** * WHOAMI extended operation helper @@ -34,7 +36,8 @@ function ldap_exop_refresh ($ldap, string $dn, int $ttl) {} * @return string|false The data returned by the server, or FALSE on error. * @since 7.2 */ -function ldap_exop_whoami ($ldap) {} +function ldap_exop_whoami ($ldap): string|bool +{} /** * Performs an extended operation on the specified link with reqoid the OID of the operation and reqdata the data. @@ -48,7 +51,8 @@ function ldap_exop_whoami ($ldap) {} * @return resource|bool When used with retdata, returns TRUE on success or FALSE on error. When used without retdata, returns a result identifier or FALSE on error. * @since 7.2 */ -function ldap_exop ($ldap , string $request_oid , string $request_data , array $controls = [], &$response_data, &$response_oid) {} +function ldap_exop ($ldap , string $request_oid , string $request_data , array $controls = [], &$response_data, &$response_oid) +{} /** * Parse LDAP extended operation data from result object result @@ -60,7 +64,8 @@ function ldap_exop ($ldap , string $request_oid , string $request_data , array $ * @return bool Returns TRUE on success or FALSE on failure. * @since 7.2 */ -function ldap_parse_exop ($ldap , $result, &$response_data, &$response_oid) {} +function ldap_parse_exop ($ldap , $result, &$response_data, &$response_oid): bool +{} /** * Translate 8859 characters to t61 characters @@ -68,7 +73,8 @@ function ldap_parse_exop ($ldap , $result, &$response_data, &$response_oid) {} * @param string $value * @return string */ -function ldap_8859_to_t61(string $value) {} +function ldap_8859_to_t61(string $value): string +{} /** * Translate t61 characters to 8859 characters @@ -76,7 +82,8 @@ function ldap_8859_to_t61(string $value) {} * @param string $value * @return string */ -function ldap_t61_to_8859(string $value) {} +function ldap_t61_to_8859(string $value): string +{} /** * Connect to an LDAP server @@ -101,14 +108,15 @@ function ldap_t61_to_8859(string $value) {} * If no arguments are specified then the link identifier of the already * opened link will be returned. */ -function ldap_connect (string $uri, int $port = 389) {} +function ldap_connect (string $uri, int $port = 389) +{} /** * Alias of ldap_unbind * @link https://php.net/manual/en/function.ldap-close.php * @param $ldap */ -function ldap_close ($ldap) {} +function ldap_close ($ldap): bool {} /** * Bind to LDAP directory @@ -120,7 +128,8 @@ function ldap_close ($ldap) {} * @param string $password [optional] * @return bool TRUE on success or FALSE on failure. */ -function ldap_bind ($ldap, string $dn, string $password) {} +function ldap_bind ($ldap, string $dn, string $password): bool +{} /** * Bind to LDAP directory @@ -135,7 +144,8 @@ function ldap_bind ($ldap, string $dn, string $password) {} * @return resource|false * @since 7.3 */ -function ldap_bind_ext ($ldap, string $dn, string $password, array $controls = []) {} +function ldap_bind_ext ($ldap, string $dn, string $password, array $controls = []) +{} /** @@ -151,7 +161,8 @@ function ldap_bind_ext ($ldap, string $dn, string $password, array $controls = [ * @param string $props [optional] * @return bool TRUE on success or FALSE on failure. */ -function ldap_sasl_bind ($ldap, $binddn = null, $password = null, $sasl_mech = null, $sasl_realm = null, $sasl_authc_id = null, $sasl_authz_id = null, $props = null) {} +function ldap_sasl_bind ($ldap, $binddn = null, $password = null, $sasl_mech = null, $sasl_realm = null, $sasl_authc_id = null, $sasl_authz_id = null, $props = null): bool +{} /** * Unbind from LDAP directory @@ -161,7 +172,8 @@ function ldap_sasl_bind ($ldap, $binddn = null, $password = null, $sasl_mech = n *

* @return bool TRUE on success or FALSE on failure. */ -function ldap_unbind ($ldap) {} +function ldap_unbind ($ldap): bool +{} /** * Read an entry @@ -225,7 +237,8 @@ function ldap_unbind ($ldap) {} * @param array $controls [optional] Array of LDAP Controls to send with the request. * @return resource|false a search result identifier or FALSE on error. */ -function ldap_read ($ldap, array|string $base, array|string $filter, array $attributes, int $attributes_only, int $sizelimit, int $timelimit, int $deref, array $controls = []) {} +function ldap_read ($ldap, array|string $base, array|string $filter, array $attributes, int $attributes_only, int $sizelimit, int $timelimit, int $deref, array $controls = []) +{} /** * Single-level search @@ -283,7 +296,8 @@ function ldap_read ($ldap, array|string $base, array|string $filter, array $attr * @param array $controls [optional] Array of LDAP Controls to send with the request. * @return resource|false a search result identifier or FALSE on error. */ -function ldap_list ($ldap, array|string $base, array|string $filter, array $attributes, int $attributes_only, int $sizelimit, int $timelimit, int $deref, array $controls = []) {} +function ldap_list ($ldap, array|string $base, array|string $filter, array $attributes, int $attributes_only, int $sizelimit, int $timelimit, int $deref, array $controls = []) +{} /** * Search LDAP tree @@ -345,7 +359,8 @@ function ldap_list ($ldap, array|string $base, array|string $filter, array $attr * @param array $controls [optional] Array of LDAP Controls to send with the request. * @return resource|false a search result identifier or FALSE on error. */ -function ldap_search ($ldap, array|string $base, array|string $filter, array $attributes, int $attributes_only, int $sizelimit, int $timelimit, int $deref, array $controls = []) {} +function ldap_search ($ldap, array|string $base, array|string $filter, array $attributes, int $attributes_only, int $sizelimit, int $timelimit, int $deref, array $controls = []) +{} /** * Free result memory @@ -353,7 +368,8 @@ function ldap_search ($ldap, array|string $base, array|string $filter, array $at * @param resource $ldap * @return bool TRUE on success or FALSE on failure. */ -function ldap_free_result ($ldap) {} +function ldap_free_result ($ldap): bool +{} /** * Count the number of entries in a search @@ -366,7 +382,9 @@ function ldap_free_result ($ldap) {} *

* @return int|false number of entries in the result or FALSE on error. */ -function ldap_count_entries ($ldap, $result) {} +#[LanguageLevelTypeAware(["8.0" => "int"], default: "int|false")] +function ldap_count_entries ($ldap, $result) +{} /** * Return first result id @@ -378,7 +396,8 @@ function ldap_count_entries ($ldap, $result) {} * @return resource|false the result entry identifier for the first entry on success and * FALSE on error. */ -function ldap_first_entry ($ldap, $result) {} +function ldap_first_entry ($ldap, $result) +{} /** * Get next result entry @@ -391,7 +410,8 @@ function ldap_first_entry ($ldap, $result) {} * are being read starting with ldap_first_entry. If * there are no more entries in the result then it returns FALSE. */ -function ldap_next_entry ($ldap, $result) {} +function ldap_next_entry ($ldap, $result) +{} /** * Get all result entries @@ -400,7 +420,7 @@ function ldap_next_entry ($ldap, $result) {} * An LDAP link identifier, returned by ldap_connect. *

* @param resource $result - * @return array a complete result information in a multi-dimensional array on + * @return array|false a complete result information in a multi-dimensional array on * success and FALSE on error. *

*

@@ -419,7 +439,8 @@ function ldap_next_entry ($ldap, $result) {} * return_value[i]["attribute"][j] = jth value of attribute in ith entry * */ -function ldap_get_entries ($ldap, $result) {} +function ldap_get_entries ($ldap, $result): array|false +{} /** * Return first attribute @@ -431,7 +452,8 @@ function ldap_get_entries ($ldap, $result) {} * @return string|false the first attribute in the entry on success and FALSE on * error. */ -function ldap_first_attribute ($ldap, $entry) {} +function ldap_first_attribute ($ldap, $entry): string|false +{} /** * Get the next attribute in result @@ -443,7 +465,8 @@ function ldap_first_attribute ($ldap, $entry) {} * @return string|false the next attribute in an entry on success and FALSE on * error. */ -function ldap_next_attribute ($ldap, $entry) {} +function ldap_next_attribute ($ldap, $entry): string|false +{} /** * Get attributes from a search result entry @@ -455,7 +478,8 @@ function ldap_next_attribute ($ldap, $entry) {} * @return array a complete entry information in a multi-dimensional array * on success and FALSE on error. */ -function ldap_get_attributes ($ldap, $entry) {} +function ldap_get_attributes ($ldap, $entry): array +{} /** * Get all values from a result entry @@ -478,7 +502,8 @@ function ldap_get_attributes ($ldap, $entry) {} * return_value[0] = first value of attribute * return_value[i] = ith value of attribute */ -function ldap_get_values ($ldap, $entry, string $attribute) {} +function ldap_get_values ($ldap, $entry, string $attribute): array|false +{} /** * Get all binary values from a result entry @@ -493,7 +518,8 @@ function ldap_get_values ($ldap, $entry, string $attribute) {} * first index is 0. The number of values can be found by indexing "count" * in the resultant array. */ -function ldap_get_values_len ($ldap, $entry, string $attribute) {} +function ldap_get_values_len ($ldap, $entry, string $attribute): array|false +{} /** * Get the DN of a result entry @@ -504,7 +530,8 @@ function ldap_get_values_len ($ldap, $entry, string $attribute) {} * @param resource $entry * @return string|false the DN of the result entry and FALSE on error. */ -function ldap_get_dn ($ldap, $entry) {} +function ldap_get_dn ($ldap, $entry): string|false +{} /** * Splits DN into its component parts @@ -518,12 +545,13 @@ function ldap_get_dn ($ldap, $entry) {} * attribute=value format) set with_attrib to 0 * and to get only values set it to 1. *

- * @return array an array of all DN components. + * @return array|false an array of all DN components. * The first element in this array has count key and * represents the number of returned values, next elements are numerically * indexed DN components. */ -function ldap_explode_dn (string $dn, int $with_attrib) {} +function ldap_explode_dn (string $dn, int $with_attrib): array|false +{} /** * Convert DN to User Friendly Naming format @@ -531,9 +559,10 @@ function ldap_explode_dn (string $dn, int $with_attrib) {} * @param string $dn

* The distinguished name of an LDAP entity. *

- * @return string the user friendly name. + * @return string|false the user friendly name. */ -function ldap_dn2ufn (string $dn) {} +function ldap_dn2ufn (string $dn): string|false +{} /** * Add entries to LDAP directory @@ -558,7 +587,8 @@ function ldap_dn2ufn (string $dn) {} * @param array $controls [optional] Array of LDAP Controls to send with the request. * @return bool TRUE on success or FALSE on failure. */ -function ldap_add ($ldap, string $dn, array $entry, array $controls = []) {} +function ldap_add ($ldap, string $dn, array $entry, array $controls = []): bool +{} /** * Add entries to LDAP directory @@ -585,7 +615,8 @@ function ldap_add ($ldap, string $dn, array $entry, array $controls = []) {} * @return resource|false * @since 7.4 */ -function ldap_add_ext ($ldap, string $dn, array $entry, array $controls = []) {} +function ldap_add_ext ($ldap, string $dn, array $entry, array $controls = []) +{} /** * Delete an entry from a directory @@ -599,7 +630,8 @@ function ldap_add_ext ($ldap, string $dn, array $entry, array $controls = []) {} * @param array $controls [optional] Array of LDAP Controls to send with the request. * @return bool TRUE on success or FALSE on failure. */ -function ldap_delete ($ldap, string $dn, array $controls = []) {} +function ldap_delete ($ldap, string $dn, array $controls = []): bool +{} /** * Delete an entry from a directory @@ -615,7 +647,8 @@ function ldap_delete ($ldap, string $dn, array $controls = []) {} * @return resource|false * @since 7.3 */ -function ldap_delete_ext ($ldap, string $dn, array $controls = []) {} +function ldap_delete_ext ($ldap, string $dn, array $controls = []) +{} /** * This function is an alias of: ldap_mod_replace(). @@ -632,7 +665,8 @@ function ldap_delete_ext ($ldap, string $dn, array $controls = []) {} * @return bool TRUE on success or FALSE on failure. * @since 7.0 */ -function ldap_modify ($ldap, string $dn, array $entry, array $controls = []) {} +function ldap_modify ($ldap, string $dn, array $entry, array $controls = []): bool +{} /** * Add attribute values to current attributes @@ -647,7 +681,8 @@ function ldap_modify ($ldap, string $dn, array $entry, array $controls = []) {} * @param array $controls [optional] Array of LDAP Controls to send with the request. * @return bool TRUE on success or FALSE on failure. */ -function ldap_mod_add ($ldap, string $dn, array $entry, array $controls = []) {} +function ldap_mod_add ($ldap, string $dn, array $entry, array $controls = []): bool +{} /** * Add attribute values to current attributes @@ -663,7 +698,8 @@ function ldap_mod_add ($ldap, string $dn, array $entry, array $controls = []) {} * @param array $controls [optional] Array of LDAP Controls to send with the request. * @return resource|false */ -function ldap_mod_add_ext ($ldap, string $dn, array $entry, array $controls = []) {} +function ldap_mod_add_ext ($ldap, string $dn, array $entry, array $controls = []) +{} /** * Replace attribute values with new ones @@ -678,7 +714,8 @@ function ldap_mod_add_ext ($ldap, string $dn, array $entry, array $controls = [] * @param array $controls [optional] Array of LDAP Controls to send with the request. * @return bool TRUE on success or FALSE on failure. */ -function ldap_mod_replace ($ldap, string $dn, array $entry, array $controls = []) {} +function ldap_mod_replace ($ldap, string $dn, array $entry, array $controls = []): bool +{} /** * Replace attribute values with new ones @@ -695,7 +732,8 @@ function ldap_mod_replace ($ldap, string $dn, array $entry, array $controls = [] * @return resource|false * @since 7.3 */ -function ldap_mod_replace_ext ($ldap, string $dn, array $entry, array $controls = []) {} +function ldap_mod_replace_ext ($ldap, string $dn, array $entry, array $controls = []) +{} /** * Delete attribute values from current attributes @@ -710,7 +748,8 @@ function ldap_mod_replace_ext ($ldap, string $dn, array $entry, array $controls * @param array $controls [optional] Array of LDAP Controls to send with the request. * @return bool TRUE on success or FALSE on failure. */ -function ldap_mod_del ($ldap, string $dn, array $entry, array $controls = []) {} +function ldap_mod_del ($ldap, string $dn, array $entry, array $controls = []): bool +{} /** * Delete attribute values from current attributes @@ -727,7 +766,8 @@ function ldap_mod_del ($ldap, string $dn, array $entry, array $controls = []) {} * @return resource|false * @since 7.3 */ -function ldap_mod_del_ext ($ldap, string $dn, array $entry, array $controls = []) {} +function ldap_mod_del_ext ($ldap, string $dn, array $entry, array $controls = []) +{} /** * Return the LDAP error number of the last LDAP command @@ -738,7 +778,8 @@ function ldap_mod_del_ext ($ldap, string $dn, array $entry, array $controls = [] * @return int Return the LDAP error number of the last LDAP command for this * link. */ -function ldap_errno ($ldap) {} +function ldap_errno ($ldap): int +{} /** * Convert LDAP error number into string error message @@ -748,7 +789,8 @@ function ldap_errno ($ldap) {} *

* @return string the error message, as a string. */ -function ldap_err2str (int $errno) {} +function ldap_err2str (int $errno): string +{} /** * Return the LDAP error message of the last LDAP command @@ -758,7 +800,8 @@ function ldap_err2str (int $errno) {} *

* @return string string error message. */ -function ldap_error ($ldap) {} +function ldap_error ($ldap): string +{} /** * Compare value of attribute found in entry specified with DN @@ -776,10 +819,11 @@ function ldap_error ($ldap) {} * The compared value. *

* @param array $controls [optional] Array of LDAP Controls to send with the request. - * @return mixed TRUE if value matches otherwise returns + * @return int|bool TRUE if value matches otherwise returns * FALSE. Returns -1 on error. */ -function ldap_compare ($ldap, string $dn, string $attribute, string $value, array $controls = []) {} +function ldap_compare ($ldap, string $dn, string $attribute, string $value, array $controls = []): int|bool +{} /** * Sort LDAP result entries @@ -798,7 +842,8 @@ function ldap_compare ($ldap, string $dn, string $attribute, string $value, arra * @return bool */ #[Deprecated(since: "7.0")] -function ldap_sort ($ldap, $result, string $sortfilter) {} +function ldap_sort ($ldap, $result, string $sortfilter): bool +{} /** * Modify the name of an entry @@ -822,7 +867,8 @@ function ldap_sort ($ldap, $result, string $sortfilter) {} * @param array $controls [optional] Array of LDAP Controls to send with the request. * @return bool TRUE on success or FALSE on failure. */ -function ldap_rename ($ldap, string $dn, string $new_rdn, string $new_parent, bool $delete_old_rdn, array $controls = []) {} +function ldap_rename ($ldap, string $dn, string $new_rdn, string $new_parent, bool $delete_old_rdn, array $controls = []): bool +{} /** * Modify the name of an entry @@ -848,7 +894,8 @@ function ldap_rename ($ldap, string $dn, string $new_rdn, string $new_parent, bo * @return resource|false * @since 7.3 */ -function ldap_rename_ext ($ldap, string $dn, string $new_rdn, string $new_parent, bool $delete_old_rdn, array $controls = []) {} +function ldap_rename_ext ($ldap, string $dn, string $new_rdn, string $new_parent, bool $delete_old_rdn, array $controls = []) +{} /** * Get the current value for given option @@ -920,7 +967,8 @@ function ldap_rename_ext ($ldap, string $dn, string $new_rdn, string $new_parent *

* @return bool TRUE on success or FALSE on failure. */ -function ldap_get_option ($ldap, int $option, &$value) {} +function ldap_get_option ($ldap, int $option, &$value): bool +{} /** * Set the value of the given option @@ -1021,7 +1069,8 @@ function ldap_get_option ($ldap, int $option, &$value) {} *

* @return bool TRUE on success or FALSE on failure. */ -function ldap_set_option ($ldap, int $option, $value) {} +function ldap_set_option ($ldap, int $option, $value): bool +{} /** * Return first reference @@ -1049,7 +1098,8 @@ function ldap_next_reference ($ldap, $entry) {} * @param array &$referrals * @return bool */ -function ldap_parse_reference ($ldap, $entry, &$referrals) {} +function ldap_parse_reference ($ldap, $entry, &$referrals): bool +{} /** * Extract information from result @@ -1063,7 +1113,8 @@ function ldap_parse_reference ($ldap, $entry, &$referrals) {} * @param array &$controls [optional] An array of LDAP Controls which have been sent with the response. * @return bool */ -function ldap_parse_result ($ldap, $result, &$error_code, &$matched_dn, &$error_message, &$referrals, &$controls = []) {} +function ldap_parse_result ($ldap, $result, &$error_code, &$matched_dn, &$error_message, &$referrals, &$controls = []): bool +{} /** * Start TLS @@ -1071,7 +1122,8 @@ function ldap_parse_result ($ldap, $result, &$error_code, &$matched_dn, &$error_ * @param resource $ldap * @return bool */ -function ldap_start_tls ($ldap) {} +function ldap_start_tls ($ldap): bool +{} /** * Set a callback function to do re-binds on referral chasing @@ -1080,7 +1132,8 @@ function ldap_start_tls ($ldap) {} * @param callable $callback * @return bool */ -function ldap_set_rebind_proc ($ldap, callable $callback) {} +function ldap_set_rebind_proc ($ldap, callable $callback): bool +{} /** * Send LDAP pagination control @@ -1105,7 +1158,8 @@ function ldap_set_rebind_proc ($ldap, callable $callback) {} * @removed 8.0 */ #[Deprecated(since: "7.4")] -function ldap_control_paged_result ($ldap, int $pagesize, $iscritical = false, $cookie = "") {} +function ldap_control_paged_result ($ldap, int $pagesize, $iscritical = false, $cookie = ""): bool +{} /** * Retrieve the LDAP pagination cookie @@ -1125,7 +1179,8 @@ function ldap_control_paged_result ($ldap, int $pagesize, $iscritical = false, $ * @removed 8.0 */ #[Deprecated(since: "7.4")] -function ldap_control_paged_result_response ($ldap, $result, &$cookie = null, &$estimated = null) {} +function ldap_control_paged_result_response ($ldap, $result, &$cookie = null, &$estimated = null): bool +{} /** * Escape a string for use in an LDAP filter or DN @@ -1136,7 +1191,8 @@ function ldap_control_paged_result_response ($ldap, $result, &$cookie = null, &$ * @since 5.6 */ -function ldap_escape (string $value, string $ignore = "", int $flags = 0) {} +function ldap_escape (string $value, string $ignore = "", int $flags = 0): string +{} /** * (PHP 5.4 >= 5.4.26, PHP 5.5 >= 5.5.10, PHP 5.6 >= 5.6.0) @@ -1217,7 +1273,8 @@ function ldap_escape (string $value, string $ignore = "", int $flags = 0) {} * @return bool TRUE on success or FALSE on failure. * @since 5.4 */ -function ldap_modify_batch ($ldap , string $dn , array $modifications_info, array $controls = []) {} +function ldap_modify_batch ($ldap , string $dn , array $modifications_info, array $controls = []): bool +{} /** * @param resource $ldap @@ -1225,7 +1282,8 @@ function ldap_modify_batch ($ldap , string $dn , array $modifications_info, arra * @return int returns the number of reference messages in a search result. * @since 8.0 */ -function ldap_count_references($ldap, $result){} +function ldap_count_references($ldap, $result): int +{} define('LDAP_ESCAPE_FILTER', 1); define ('LDAP_ESCAPE_DN', 2); diff --git a/libxml/libxml.php b/libxml/libxml.php index 5d278753e..7098c61ba 100644 --- a/libxml/libxml.php +++ b/libxml/libxml.php @@ -71,7 +71,7 @@ class LibXMLError { *

* @return void No value is returned. */ -function libxml_set_streams_context ($context) {} +function libxml_set_streams_context ($context):void {} /** * Disable libxml errors and allow user to fetch error information as needed @@ -82,23 +82,24 @@ function libxml_set_streams_context ($context) {} * @return bool This function returns the previous value of * use_errors. */ -function libxml_use_internal_errors (bool $use_errors = false) {} +function libxml_use_internal_errors (bool $use_errors = false): bool {} /** * Retrieve last error from libxml * @link https://php.net/manual/en/function.libxml-get-last-error.php - * @return LibXMLError a LibXMLError object if there is any error in the + * @return LibXMLError|false a LibXMLError object if there is any error in the * buffer, FALSE otherwise. */ #[Pure] -function libxml_get_last_error () {} +function libxml_get_last_error (): LibXMLError|false +{} /** * Clear libxml error buffer * @link https://php.net/manual/en/function.libxml-clear-errors.php * @return void No value is returned. */ -function libxml_clear_errors () {} +function libxml_clear_errors (): void {} /** * Retrieve array of errors @@ -107,7 +108,8 @@ function libxml_clear_errors () {} * errors in the buffer, or an empty array otherwise. */ #[Pure] -function libxml_get_errors () {} +function libxml_get_errors (): array +{} /** * Disable the ability to load external entities @@ -121,7 +123,8 @@ function libxml_get_errors () {} * @since 5.2.11 */ #[Deprecated(since: "8.0")] -function libxml_disable_entity_loader (bool $disable = true) {} +function libxml_disable_entity_loader (bool $disable = true): bool +{} /** * Changes the default external entity loader @@ -132,10 +135,10 @@ function libxml_disable_entity_loader (bool $disable = true) {} * This callback should return a resource, a string from which a resource can be * opened, or NULL. *

- * @return void No value is returned. + * @return bool * @since 5.4 */ -function libxml_set_external_entity_loader (callable $resolver_function) {} +function libxml_set_external_entity_loader (callable $resolver_function): bool {} /** diff --git a/mbstring/mbstring.php b/mbstring/mbstring.php index 35305adb6..b2d12cfb8 100644 --- a/mbstring/mbstring.php +++ b/mbstring/mbstring.php @@ -24,7 +24,8 @@ * way specified by mode. */ #[Pure] -function mb_convert_case (string $string, int $mode, string $encoding) {} +function mb_convert_case (string $string, int $mode, string $encoding): string +{} /** * Make a string uppercase @@ -36,7 +37,8 @@ function mb_convert_case (string $string, int $mode, string $encoding) {} * @return string str with all alphabetic characters converted to uppercase. */ #[Pure] -function mb_strtoupper (string $string, string $encoding) {} +function mb_strtoupper (string $string, string $encoding): string +{} /** * Make a string lowercase @@ -48,7 +50,8 @@ function mb_strtoupper (string $string, string $encoding) {} * @return string str with all alphabetic characters converted to lowercase. */ #[Pure] -function mb_strtolower (string $string, string $encoding) {} +function mb_strtolower (string $string, string $encoding): string +{} /** * Set/Get current language @@ -72,7 +75,8 @@ function mb_strtolower (string $string, string $encoding) {} * name as a string. If no language is set previously, it then returns * false. */ -function mb_language (string $language) {} +function mb_language (string $language): string|bool +{} /** * Set/Get internal character encoding @@ -88,7 +92,8 @@ function mb_language (string $language) {} * If encoding is omitted, then * the current character encoding name is returned. */ -function mb_internal_encoding (string $encoding) {} +function mb_internal_encoding (string $encoding): string|bool +{} /** * Detect HTTP input character encoding @@ -99,12 +104,13 @@ function mb_internal_encoding (string $encoding) {} * "I" for the whole list (will return array). * If type is omitted, it returns the last input type processed. *

- * @return false|string The character encoding name, as per the type. + * @return array|false|string The character encoding name, as per the type. * If mb_http_input does not process specified * HTTP input, it returns false. */ #[Pure] -function mb_http_input (string $type) {} +function mb_http_input (string $type): array|string|false +{} /** * Set/Get HTTP output character encoding @@ -124,7 +130,8 @@ function mb_http_input (string $type) {} * character encoding. Otherwise, * true on success or false on failure. */ -function mb_http_output (string $encoding) {} +function mb_http_output (string $encoding): string|bool +{} /** * Set/Get character encoding detection order @@ -169,7 +176,8 @@ function mb_http_output (string $encoding) {} * When getting the encoding detection order, an ordered array * of the encodings is returned. */ -function mb_detect_order (array|string $encoding = null) {} +function mb_detect_order (array|string $encoding = null): array|bool +{} /** * Set/Get substitution character @@ -185,7 +193,8 @@ function mb_detect_order (array|string $encoding = null) {} * If substchar is not set, it returns the Unicode value, * or "none" or "long". */ -function mb_substitute_character (string|int $substitute_character = null) {} +function mb_substitute_character (string|int $substitute_character = null): string|int|bool +{} #[PhpStormStubsElementAvailable(to: '7.4')] /** @@ -199,7 +208,7 @@ function mb_substitute_character (string|int $substitute_character = null) {} *

* @return bool true on success or false on failure. */ -function mb_parse_str (string $string, &$result) +function mb_parse_str (string $string, &$result): bool {} #[PhpStormStubsElementAvailable('8.0')] @@ -214,7 +223,8 @@ function mb_parse_str (string $string, &$result) *

* @return bool true on success or false on failure. */ -function mb_parse_str (string $string, &$result) {} +function mb_parse_str (string $string, &$result): bool +{} /** * Callback function converts character encoding in output buffer @@ -228,7 +238,8 @@ function mb_parse_str (string $string, &$result) {} * @return string The converted string. */ #[Pure] -function mb_output_handler (string $string, int $status) {} +function mb_output_handler (string $string, int $status): string +{} /** * Get MIME charset string @@ -236,11 +247,12 @@ function mb_output_handler (string $string, int $status) {} * @param string $encoding

* The encoding being checked. *

- * @return string The MIME charset string for character encoding + * @return string|false The MIME charset string for character encoding * encoding. */ #[Pure] -function mb_preferred_mime_name (string $encoding) {} +function mb_preferred_mime_name (string $encoding): string|false +{} /** * Get string length @@ -255,7 +267,8 @@ function mb_preferred_mime_name (string $encoding) {} * counted as 1. */ #[Pure] -function mb_strlen (string $string, string $encoding) {} +function mb_strlen (string $string, string $encoding): int +{} /** * Find position of first occurrence of string in a string @@ -276,7 +289,8 @@ function mb_strlen (string $string, string $encoding) {} * needle is not found, it returns false. */ #[Pure] -function mb_strpos (string $haystack, string $needle, int $offset = 0, string $encoding) {} +function mb_strpos (string $haystack, string $needle, int $offset = 0, string $encoding): int|false +{} /** * Find position of last occurrence of a string in a string @@ -298,7 +312,8 @@ function mb_strpos (string $haystack, string $needle, int $offset = 0, string $e * needle is not found, it returns false. */ #[Pure] -function mb_strrpos (string $haystack, string $needle, int $offset = 0, string $encoding) {} +function mb_strrpos (string $haystack, string $needle, int $offset = 0, string $encoding): int|false +{} /** * Finds position of first occurrence of a string within another, case insensitive @@ -323,7 +338,7 @@ function mb_strrpos (string $haystack, string $needle, int $offset = 0, string $ * string, or false if needle is not found. */ #[Pure] -function mb_stripos (string $haystack, string $needle, int $offset = 0, string $encoding) +function mb_stripos (string $haystack, string $needle, int $offset = 0, string $encoding): int|false {} /** @@ -350,7 +365,7 @@ function mb_stripos (string $haystack, string $needle, int $offset = 0, string $ * if needle is not found. */ #[Pure] -function mb_strripos (string $haystack, string $needle, int $offset = 0, string $encoding) +function mb_strripos (string $haystack, string $needle, int $offset = 0, string $encoding): int|false {} /** @@ -379,7 +394,7 @@ function mb_strripos (string $haystack, string $needle, int $offset = 0, string * or false if needle is not found. */ #[Pure] -function mb_strstr (string $haystack, string $needle, bool $before_needle = false, string $encoding) +function mb_strstr (string $haystack, string $needle, bool $before_needle = false, string $encoding): string|false {} /** @@ -408,7 +423,7 @@ function mb_strstr (string $haystack, string $needle, bool $before_needle = fals * or false if needle is not found. */ #[Pure] -function mb_strrchr (string $haystack, string $needle, bool $before_needle = false, string $encoding) +function mb_strrchr (string $haystack, string $needle, bool $before_needle = false, string $encoding): string|false {} /** @@ -437,7 +452,7 @@ function mb_strrchr (string $haystack, string $needle, bool $before_needle = fal * or false if needle is not found. */ #[Pure] -function mb_stristr (string $haystack, string $needle, bool $before_needle = false, string $encoding) +function mb_stristr (string $haystack, string $needle, bool $before_needle = false, string $encoding): string|false {} /** @@ -466,7 +481,7 @@ function mb_stristr (string $haystack, string $needle, bool $before_needle = fal * or false if needle is not found. */ #[Pure] -function mb_strrichr (string $haystack, string $needle, bool $before_needle = false, string $encoding) +function mb_strrichr (string $haystack, string $needle, bool $before_needle = false, string $encoding): string|false {} /** @@ -484,7 +499,8 @@ function mb_strrichr (string $haystack, string $needle, bool $before_needle = fa * haystack string. */ #[Pure] -function mb_substr_count (string $haystack, string $needle, string $encoding) {} +function mb_substr_count (string $haystack, string $needle, string $encoding): int +{} /** * Get part of string @@ -505,7 +521,7 @@ function mb_substr_count (string $haystack, string $needle, string $encoding) {} * length parameters. */ #[Pure] -function mb_substr (string $string, int $start, int $length, string $encoding) +function mb_substr (string $string, int $start, int $length, string $encoding): string {} /** @@ -527,7 +543,7 @@ function mb_substr (string $string, int $start, int $length, string $encoding) * length parameters. */ #[Pure] -function mb_strcut (string $string, int $start, int $length, string $encoding) +function mb_strcut (string $string, int $start, int $length, string $encoding): string {} /** @@ -540,7 +556,8 @@ function mb_strcut (string $string, int $start, int $length, string $encoding) * @return int The width of string str. */ #[Pure] -function mb_strwidth (string $string, string $encoding) {} +function mb_strwidth (string $string, string $encoding): int +{} /** * Get truncated string with specified width @@ -564,7 +581,7 @@ function mb_strwidth (string $string, string $encoding) {} * trimmarker is appended to the return value. */ #[Pure] -function mb_strimwidth (string $string, int $start, int $width, string $trim_marker, string $encoding) +function mb_strimwidth (string $string, int $start, int $width, string $trim_marker, string $encoding): string {} /** @@ -586,10 +603,10 @@ function mb_strimwidth (string $string, int $start, int $width, string $trim_mar * "auto" may be used, which expands to * "ASCII,JIS,UTF-8,EUC-JP,SJIS". *

- * @return string The encoded string. + * @return array|string|false The encoded string. */ #[Pure] -function mb_convert_encoding (array|string $string, string $to_encoding, array|string $from_encoding = null) +function mb_convert_encoding (array|string $string, string $to_encoding, array|string $from_encoding = null): array|string|false {} /** @@ -616,7 +633,7 @@ function mb_convert_encoding (array|string $string, string $to_encoding, array|s * detected from the given string. */ #[Pure] -function mb_detect_encoding (string $string, array|string $encodings = null, bool $strict = false) +function mb_detect_encoding (string $string, array|string $encodings = null, bool $strict = false): string|false {} /** @@ -625,7 +642,8 @@ function mb_detect_encoding (string $string, array|string $encodings = null, boo * @return string[] a numerically indexed array. */ #[Pure] -function mb_list_encodings () {} +function mb_list_encodings (): array +{} /** * Get aliases of a known encoding type @@ -634,7 +652,9 @@ function mb_list_encodings () {} * @link https://php.net/manual/en/function.mb-encoding-aliases.php */ #[Pure] -function mb_encoding_aliases (string $encoding) {} +#[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] +function mb_encoding_aliases (string $encoding) +{} /** * Convert "kana" one from another ("zen-kaku", "han-kaku" and more) @@ -751,7 +771,7 @@ function mb_encoding_aliases (string $encoding) {} * @return string The converted string. */ #[Pure] -function mb_convert_kana (string $string, string $mode, string $encoding) +function mb_convert_kana (string $string, string $mode, string $encoding): string {} /** @@ -787,7 +807,8 @@ function mb_convert_kana (string $string, string $mode, string $encoding) * @return string A converted version of the string represented in ASCII. */ #[Pure] -function mb_encode_mimeheader (string $string, string $charset, string $transfer_encoding, string $newline, int $indent) {} +function mb_encode_mimeheader (string $string, string $charset, string $transfer_encoding, string $newline, int $indent): string +{} /** * Decode string in MIME header field @@ -798,7 +819,8 @@ function mb_encode_mimeheader (string $string, string $charset, string $transfer * @return string The decoded string in internal character encoding. */ #[Pure] -function mb_decode_mimeheader (string $string) {} +function mb_decode_mimeheader (string $string): string +{} /** * Convert character code in variable(s) @@ -822,7 +844,8 @@ function mb_decode_mimeheader (string $string) {} * @return string|false The character encoding before conversion for success, * or false for failure. */ -function mb_convert_variables (string $to_encoding, array|string $from_encoding, mixed &$var, mixed &...$vars) {} +function mb_convert_variables (string $to_encoding, array|string $from_encoding, mixed &$var, mixed &...$vars): string|false +{} /** * Encode character to HTML numeric string reference @@ -836,10 +859,11 @@ function mb_convert_variables (string $to_encoding, array|string $from_encoding, *

* @param string $encoding &mbstring.encoding.parameter; * @param bool $hex [optional] - * @return string|false|null The converted string. + * @return string The converted string. */ #[Pure] -function mb_encode_numericentity (string $string, array $map, string $encoding, bool $hex = false) {} +function mb_encode_numericentity (string $string, array $map, string $encoding, bool $hex = false): string +{} #[PhpStormStubsElementAvailable(to: '7.4')] /** @@ -859,7 +883,8 @@ function mb_encode_numericentity (string $string, array $map, string $encoding, * @return string|false|null The converted string. */ #[Pure] -function mb_decode_numericentity ($string, array $map, string $encoding, $is_hex = false) {} +function mb_decode_numericentity ($string, array $map, string $encoding, $is_hex = false): string|false|null +{} #[PhpStormStubsElementAvailable('8.0')] /** @@ -873,10 +898,11 @@ function mb_decode_numericentity ($string, array $map, string $encoding, $is_hex * the code area to convert. *

* @param string $encoding &mbstring.encoding.parameter; - * @return string|false|null The converted string. + * @return string The converted string. */ #[Pure] -function mb_decode_numericentity ($string, array $map, string $encoding) {} +function mb_decode_numericentity ($string, array $map, string $encoding): string +{} /** * Send encoded mail @@ -907,7 +933,7 @@ function mb_decode_numericentity ($string, array $map, string $encoding) {} *

* @return bool true on success or false on failure. */ -function mb_send_mail (string $to, string $subject, string $message, array|string $additional_headers, string $additional_params) +function mb_send_mail (string $to, string $subject, string $message, array|string $additional_headers, string $additional_params): bool {} /** @@ -924,11 +950,12 @@ function mb_send_mail (string $to, string $subject, string $message, array|strin * "http_input", "internal_encoding", "func_overload", * the specified setting parameter will be returned. *

- * @return array|mixed An array of type information if type + * @return array|string|int|false An array of type information if type * is not specified, otherwise a specific type. */ #[Pure] -function mb_get_info (string $type) {} +function mb_get_info (string $type): array|string|int|false +{} /** * Check if the string is valid for the specified encoding @@ -944,7 +971,8 @@ function mb_get_info (string $type) {} * @since 5.1.3 */ #[Pure] -function mb_check_encoding (array|string $value = null, string $encoding) {} +function mb_check_encoding (array|string $value = null, string $encoding): bool +{} /** * Returns current encoding for multibyte regex as string @@ -955,7 +983,8 @@ function mb_check_encoding (array|string $value = null, string $encoding) {} * is NOT changed. If encoding is omitted, then the current character * encoding name for a multibyte regex is returned. */ -function mb_regex_encoding (string $encoding) {} +function mb_regex_encoding (string $encoding): string|bool +{} /** * Set/Get the default options for mbregex functions @@ -966,7 +995,8 @@ function mb_regex_encoding (string $encoding) {} * @return string The previous options. If options is omitted, * it returns the string that describes the current options. */ -function mb_regex_set_options (string $options) {} +function mb_regex_set_options (string $options): string +{} /** * Regular expression match with multibyte support @@ -980,9 +1010,10 @@ function mb_regex_set_options (string $options) {} * @param string[] &$matches [optional]

* Contains a substring of the matched string. *

- * @return int + * @return bool */ -function mb_ereg (string $pattern, string $string, &$matches) {} +function mb_ereg (string $pattern, string $string, &$matches): bool +{} /** * Regular expression match ignoring case with multibyte support @@ -996,9 +1027,10 @@ function mb_ereg (string $pattern, string $string, &$matches) {} * @param string[] &$matches [optional]

* Contains a substring of the matched string. *

- * @return int + * @return bool */ -function mb_eregi (string $pattern, string $string, &$matches) {} +function mb_eregi (string $pattern, string $string, &$matches): bool +{} /** * Replace regular expression with multibyte support @@ -1026,10 +1058,11 @@ function mb_eregi (string $pattern, string $string, &$matches) {} * is specified, replacement string will be * evaluated as PHP expression. *

PHP 7.1: The e modifier has been deprecated.

- * @return string|false The resultant string on success, or false on error. + * @return string|false|null The resultant string on success, or false on error. */ #[Pure] -function mb_ereg_replace (string $pattern, string $replacement, string $string, string $options = "msr") {} +function mb_ereg_replace (string $pattern, string $replacement, string $string, string $options = "msr"): string|false|null +{} /** * Perform a regular expresssion seach and replace with multibyte support using a callback @@ -1069,12 +1102,13 @@ function mb_ereg_replace (string $pattern, string $replacement, string $string, * will be considered as normal character. Note that e * cannot be used for mb_ereg_replace_callback(). *

- * @return string|false

+ * @return string|false|null

* The resultant string on success, or FALSE on error. *

* @since 5.4.1 */ -function mb_ereg_replace_callback (string $pattern, callable $callback, string $string, string $options = "msr") {} +function mb_ereg_replace_callback (string $pattern, callable $callback, string $string, string $options = "msr"): string|false|null +{} /** * Replace regular expression with multibyte support ignoring case @@ -1091,10 +1125,11 @@ function mb_ereg_replace_callback (string $pattern, callable $callback, string $ * @param string $options [optional] option has the same meaning as in * mb_ereg_replace. *

PHP 7.1: The e modifier has been deprecated.

- * @return string|false The resultant string or false on error. + * @return string|false|null The resultant string or false on error. */ #[Pure] -function mb_eregi_replace (string $pattern, string $replacement, string $string, string $options = "msr") {} +function mb_eregi_replace (string $pattern, string $replacement, string $string, string $options = "msr"): string|false|null +{} /** * Split multibyte string using regular expression @@ -1108,10 +1143,10 @@ function mb_eregi_replace (string $pattern, string $replacement, string $string, * @param int $limit [optional] If optional parameter limit is specified, * it will be split in limit elements as * maximum. - * @return string[] The result as an array. + * @return string[]|false The result as an array. */ #[Pure] -function mb_split (string $pattern, string $string, int $limit) +function mb_split (string $pattern, string $string, int $limit): array|false {} /** @@ -1128,7 +1163,7 @@ function mb_split (string $pattern, string $string, int $limit) * @return bool */ #[Pure] -function mb_ereg_match (string $pattern, string $string, string $options) +function mb_ereg_match (string $pattern, string $string, string $options): bool {} /** @@ -1143,7 +1178,8 @@ function mb_ereg_match (string $pattern, string $string, string $options) * @return bool */ #[Pure] -function mb_ereg_search (string $pattern, string $options) {} +function mb_ereg_search (string $pattern, string $options): bool +{} /** * Returns position and length of a matched part of the multibyte regular expression for a predefined multibyte string @@ -1160,7 +1196,8 @@ function mb_ereg_search (string $pattern, string $options) {} * length in bytes of the match. If an error occurs, FALSE is returned. */ #[Pure] -function mb_ereg_search_pos (string $pattern, string $options) {} +function mb_ereg_search_pos (string $pattern, string $options): array|false +{} /** * Returns the matched part of a multibyte regular expression @@ -1178,7 +1215,8 @@ function mb_ereg_search_pos (string $pattern, string $options) {} * part as third element, and so on. It returns FALSE on error. */ #[Pure] -function mb_ereg_search_regs (string $pattern, string $options) {} +function mb_ereg_search_regs (string $pattern, string $options): array|false +{} /** * Setup string and regular expression for a multibyte regular expression match @@ -1194,7 +1232,7 @@ function mb_ereg_search_regs (string $pattern, string $options) {} *

* @return bool */ -function mb_ereg_search_init (string $string, string $pattern, string $options) +function mb_ereg_search_init (string $string, string $pattern, string $options): bool {} /** @@ -1208,7 +1246,8 @@ function mb_ereg_search_init (string $string, string $pattern, string $options) * brackets, and so on. It returns FALSE on error; */ #[Pure] -function mb_ereg_search_getregs () {} +function mb_ereg_search_getregs (): array|false +{} /** * Returns start point for next regular expression match @@ -1217,7 +1256,8 @@ function mb_ereg_search_getregs () {} */ #[Pure] #[Deprecated(since: '7.3')] -function mb_ereg_search_getpos () {} +function mb_ereg_search_getpos (): int +{} /** * Set start point of next regular expression match @@ -1228,7 +1268,8 @@ function mb_ereg_search_getpos () {} * @return bool */ #[Pure] -function mb_ereg_search_setpos (int $offset) {} +function mb_ereg_search_setpos (int $offset): bool +{} /** * @param $encoding [optional] @@ -1279,7 +1320,8 @@ function mbereg_replace ($pattern, $replacement, $string, $option) {} * @removed 8.0 */ #[Deprecated(replacement: "mb_eregi_replace(%parametersList%)", since: "7.3")] -function mberegi_replace ($pattern, $replacement, $string, string $option = "msri") {} +function mberegi_replace ($pattern, $replacement, $string, string $option = "msri"): string +{} /** * @param $pattern @@ -1361,7 +1403,8 @@ function mbereg_search_getpos () {} * @since 7.2 */ #[Pure] -function mb_chr (int $codepoint, string $encoding) {} +function mb_chr (int $codepoint, string $encoding): string|false +{} /** * Get code point of character @@ -1372,7 +1415,8 @@ function mb_chr (int $codepoint, string $encoding) {} * @since 7.2 */ #[Pure] -function mb_ord (string $string, string $encoding) {} +function mb_ord (string $string, string $encoding): int|false +{} /** * Scrub broken multibyte strings. @@ -1383,7 +1427,9 @@ function mb_ord (string $string, string $encoding) {} * @since 7.2 */ #[Pure] -function mb_scrub (string $string, string $encoding) {} +#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false")] +function mb_scrub (string $string, string $encoding): bool|string +{} /** * @param $position @@ -1410,6 +1456,7 @@ function mbereg_search_setpos ($position) {} * @since 7.4 */ #[Pure] +#[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] function mb_str_split (string $string, int $length = 1, string $encoding) {} diff --git a/mysqli/mysqli.php b/mysqli/mysqli.php index a7aaa18e6..30620c8a8 100644 --- a/mysqli/mysqli.php +++ b/mysqli/mysqli.php @@ -1471,11 +1471,12 @@ public function get_result () {} * Gets the number of affected rows in a previous MySQL operation * @link https://secure.php.net/manual/en/mysqli.affected-rows.php * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() - * @return int An integer greater than zero indicates the number of rows affected or retrieved. + * @return string|int An integer greater than zero indicates the number of rows affected or retrieved. * Zero indicates that no records where updated for an UPDATE statement, * no rows matched the WHERE clause in the query or that no query has yet been executed. -1 indicates that the query returned an error. */ -function mysqli_affected_rows (mysqli $mysql) {} +function mysqli_affected_rows (mysqli $mysql): string|int +{} /** * Turns on or off auto-committing database modifications @@ -1484,7 +1485,8 @@ function mysqli_affected_rows (mysqli $mysql) {} * @param bool $enable Whether to turn on auto-commit or not. * @return bool */ -function mysqli_autocommit (mysqli $mysql, bool $enable) {} +function mysqli_autocommit (mysqli $mysql, bool $enable): bool +{} /** * Starts a transaction @@ -1495,7 +1497,8 @@ function mysqli_autocommit (mysqli $mysql, bool $enable) {} * @return bool true on success or false on failure. * @since 5.5 */ -function mysqli_begin_transaction (mysqli $mysql, int $flags = 0, string $name) {} +function mysqli_begin_transaction (mysqli $mysql, int $flags = 0, string $name): bool +{} /** * Changes the user of the specified database connection @@ -1506,7 +1509,8 @@ function mysqli_begin_transaction (mysqli $mysql, int $flags = 0, string $name) * @param string $database The database to change to. If desired, the NULL value may be passed resulting in only changing the user and not selecting a database. * @return bool */ -function mysqli_change_user (mysqli $mysql, string $username, string $password, string $database) {} +function mysqli_change_user (mysqli $mysql, string $username, string $password, string $database): bool +{} /** * Returns the default character set for the database connection @@ -1514,7 +1518,8 @@ function mysqli_change_user (mysqli $mysql, string $username, string $password, * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return string The default character set for the current connection */ -function mysqli_character_set_name (mysqli $mysql) {} +function mysqli_character_set_name (mysqli $mysql): string +{} /** * Closes a previously opened database connection @@ -1522,7 +1527,8 @@ function mysqli_character_set_name (mysqli $mysql) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return bool */ -function mysqli_close (mysqli $mysql) {} +function mysqli_close (mysqli $mysql): bool +{} /** * Commits the current transaction @@ -1532,7 +1538,8 @@ function mysqli_close (mysqli $mysql) {} * @param string $name [optional] If provided then COMMITname is executed * @return bool */ -function mysqli_commit (mysqli $mysql, int $flags = -1, string $name) {} +function mysqli_commit (mysqli $mysql, int $flags = -1, string $name): bool +{} /** * Open a new connection to the MySQL server @@ -1544,23 +1551,26 @@ function mysqli_commit (mysqli $mysql, int $flags = -1, string $name) {} * @param string $database If provided will specify the default database to be used when performing queries. * @param int $port Specifies the port number to attempt to connect to the MySQL server. * @param string $socket Specifies the socket or named pipe that should be used. - * @return mysqli|false object which represents the connection to a MySQL Server or false if an error occurred. + * @return mysqli|false|null object which represents the connection to a MySQL Server or false if an error occurred. */ -function mysqli_connect (string $hostname, string $username, string $password, string $database, int $port, string $socket) {} +function mysqli_connect (string $hostname, string $username, string $password, string $database, int $port, string $socket): mysqli|false|null +{} /** * Returns the error code from last connect call * @link https://php.net/manual/en/mysqli.connect-errno.php * @return int Last error code number from the last call to mysqli_connect(). Zero means no error occurred. */ -function mysqli_connect_errno () {} +function mysqli_connect_errno (): int +{} /** * Returns a string description of the last connect error * @link https://php.net/manual/en/mysqli.connect-error.php * @return string Last error message string from the last call to mysqli_connect(). */ -function mysqli_connect_error () {} +function mysqli_connect_error (): string +{} /** * Adjusts the result pointer to an arbitrary row in the result @@ -1570,7 +1580,8 @@ function mysqli_connect_error () {} * @param int $offset * @return bool Returns TRUE on success or FALSE on failure. */ -function mysqli_data_seek (mysqli_result $result, int $offset) {} +function mysqli_data_seek (mysqli_result $result, int $offset): bool +{} /** * Dump debugging information into the log @@ -1578,7 +1589,8 @@ function mysqli_data_seek (mysqli_result $result, int $offset) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return bool */ -function mysqli_dump_debug_info (mysqli $mysql) {} +function mysqli_dump_debug_info (mysqli $mysql): bool +{} /** * Performs debugging operations using the Fred Fish debugging library. @@ -1586,7 +1598,8 @@ function mysqli_dump_debug_info (mysqli $mysql) {} * @param string $options * @return bool */ -function mysqli_debug (string $options) {} +function mysqli_debug (string $options): bool +{} /** * Returns the error code for the most recent function call @@ -1594,7 +1607,8 @@ function mysqli_debug (string $options) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return int An error code value for the last call, if it failed. zero means no error occurred. */ -function mysqli_errno (mysqli $mysql) {} +function mysqli_errno (mysqli $mysql): int +{} /** * Returns a list of errors from the last command executed @@ -1603,7 +1617,7 @@ function mysqli_errno (mysqli $mysql) {} * @return array A list of errors, each as an associative array containing the errno, error, and sqlstate. * @since 5.4 */ -function mysqli_error_list (mysqli $mysql) {} +function mysqli_error_list (mysqli $mysql): array {} /** * Returns a list of errors from the last statement executed @@ -1612,7 +1626,7 @@ function mysqli_error_list (mysqli $mysql) {} * @return array A list of errors, each as an associative array containing the errno, error, and sqlstate. * @since 5.4 */ -function mysqli_stmt_error_list (mysqli_stmt $statement) {} +function mysqli_stmt_error_list (mysqli_stmt $statement): array {} /** * Returns a string description of the last error @@ -1620,7 +1634,7 @@ function mysqli_stmt_error_list (mysqli_stmt $statement) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return string */ -function mysqli_error (mysqli $mysql) {} +function mysqli_error (mysqli $mysql): string {} /** * Executes a prepared Query @@ -1628,7 +1642,7 @@ function mysqli_error (mysqli $mysql) {} * @param mysqli_stmt $statement * @return bool */ -function mysqli_stmt_execute (mysqli_stmt $statement) {} +function mysqli_stmt_execute (mysqli_stmt $statement): bool {} /** * Executes a prepared Query @@ -1637,7 +1651,7 @@ function mysqli_stmt_execute (mysqli_stmt $statement) {} * @param mysqli_stmt $statement */ #[Deprecated(since: '5.3')] -function mysqli_execute (mysqli_stmt $statement) {} +function mysqli_execute (mysqli_stmt $statement): bool {} /** * Returns the next field in the result set @@ -1646,7 +1660,7 @@ function mysqli_execute (mysqli_stmt $statement) {} * mysqli_store_result() or mysqli_use_result(). * @return object|false Returns an object which contains field definition information or FALSE if no field information is available. */ -function mysqli_fetch_field (mysqli_result $result) {} +function mysqli_fetch_field (mysqli_result $result): object|false {} /** * Returns an array of objects representing the fields in a result set @@ -1655,6 +1669,7 @@ function mysqli_fetch_field (mysqli_result $result) {} * mysqli_store_result() or mysqli_use_result(). * @return array|false Returns an array of objects which contains field definition information or FALSE if no field information is available. */ +#[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] function mysqli_fetch_fields (mysqli_result $result) {} /** @@ -1665,7 +1680,7 @@ function mysqli_fetch_fields (mysqli_result $result) {} * @param int $index The field number. This value must be in the range from 0 to number of fields - 1. * @return object|false Returns an object which contains field definition information or FALSE if no field information for specified fieldnr is available. */ -function mysqli_fetch_field_direct (mysqli_result $result, int $index) {} +function mysqli_fetch_field_direct (mysqli_result $result, int $index): object|false {} /** * Returns the lengths of the columns of the current row in the result set @@ -1674,7 +1689,7 @@ function mysqli_fetch_field_direct (mysqli_result $result, int $index) {} * mysqli_store_result() or mysqli_use_result(). * @return int[]|false An array of integers representing the size of each column (not including any terminating null characters). FALSE if an error occurred. */ -function mysqli_fetch_lengths (mysqli_result $result) {} +function mysqli_fetch_lengths (mysqli_result $result): array|false {} /** * Fetches all result rows as an associative array, a numeric array, or both. @@ -1683,9 +1698,9 @@ function mysqli_fetch_lengths (mysqli_result $result) {} * @param mysqli_result $result A result set identifier returned by mysqli_query(), * mysqli_store_result() or mysqli_use_result(). * @param int $mode - * @return array Returns an array of associative or numeric arrays holding result rows. + * @return array|false Returns an array of associative or numeric arrays holding result rows. */ -function mysqli_fetch_all (mysqli_result $result, int $mode = MYSQLI_NUM) {} +function mysqli_fetch_all (mysqli_result $result, int $mode = MYSQLI_NUM): array|false {} /** * Fetch a result row as an associative, a numeric array, or both. @@ -1693,22 +1708,22 @@ function mysqli_fetch_all (mysqli_result $result, int $mode = MYSQLI_NUM) {} * @param mysqli_result $result A result set identifier returned by mysqli_query(), * mysqli_store_result() or mysqli_use_result(). * @param int $mode - * @return array|null + * @return array|false|null */ -function mysqli_fetch_array (mysqli_result $result, int $mode = MYSQLI_BOTH) {} +function mysqli_fetch_array (mysqli_result $result, int $mode = MYSQLI_BOTH): array|false|null {} /** * Fetch a result row as an associative array * @link https://php.net/manual/en/mysqli-result.fetch-assoc.php * @param mysqli_result $result A result set identifier returned by mysqli_query(), * mysqli_store_result() or mysqli_use_result(). - * @return string[]|null Returns an associative array of strings representing the fetched row in the result set, + * @return string[] Returns an associative array of strings representing the fetched row in the result set, * where each key in the array represents the name of one of the result set's columns or NULL if there are no more rows in resultset. * If two or more columns of the result have the same field names, the last column will take precedence. * To access the other column(s) of the same name, * you either need to access the result with numeric indices by using mysqli_fetch_row() or add alias names. */ -function mysqli_fetch_assoc (mysqli_result $result) {} +function mysqli_fetch_assoc (mysqli_result $result): array {} /** * Returns the current row of a result set as an object. @@ -1717,23 +1732,23 @@ function mysqli_fetch_assoc (mysqli_result $result) {} * mysqli_store_result() or mysqli_use_result(). * @param string $class The name of the class to instantiate, set the properties of and return. If not specified, a stdClass object is returned. * @param array|null $constructor_args [optional] An optional array of parameters to pass to the constructor for class_name objects. - * @return object|null Returns an object with string properties that corresponds to the fetched row or NULL if there are no more rows in resultset. + * @return object Returns an object with string properties that corresponds to the fetched row or NULL if there are no more rows in resultset. * If two or more columns of the result have the same field names, the last column will take precedence. * To access the other column(s) of the same name, * you either need to access the result with numeric indices by using mysqli_fetch_row() or add alias names. */ -function mysqli_fetch_object (mysqli_result $result, string $class = 'stdClass', array $constructor_args) {} +function mysqli_fetch_object (mysqli_result $result, string $class = 'stdClass', array $constructor_args): object {} /** * Get a result row as an enumerated array * @link https://php.net/manual/en/mysqli-result.fetch-row.php * @param mysqli_result $result A result set identifier returned by mysqli_query(), * mysqli_store_result() or mysqli_use_result(). - * @return array|null mysqli_fetch_row returns an array of strings that corresponds to the fetched row + * @return array mysqli_fetch_row returns an array of strings that corresponds to the fetched row * or null if there are no more rows in result set. * @link https://php.net/manual/en/mysqli-result.fetch-row.php */ -function mysqli_fetch_row (mysqli_result $result) {} +function mysqli_fetch_row (mysqli_result $result): array {} /** * Returns the number of columns for the most recent query @@ -1741,7 +1756,7 @@ function mysqli_fetch_row (mysqli_result $result) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return int An integer representing the number of fields in a result set. */ -function mysqli_field_count (mysqli $mysql) {} +function mysqli_field_count (mysqli $mysql): int {} /** * Set result pointer to a specified field offset @@ -1751,7 +1766,7 @@ function mysqli_field_count (mysqli $mysql) {} * @param int $index The field number. This value must be in the range from 0 to number of fields - 1. * @return bool */ -function mysqli_field_seek (mysqli_result $result, int $index) {} +function mysqli_field_seek (mysqli_result $result, int $index): bool {} /** * Get current field offset of a result pointer @@ -1760,7 +1775,7 @@ function mysqli_field_seek (mysqli_result $result, int $index) {} * mysqli_store_result() or mysqli_use_result(). * @return int */ -function mysqli_field_tell (mysqli_result $result) {} +function mysqli_field_tell (mysqli_result $result): int {} /** * Frees the memory associated with a result @@ -1769,7 +1784,7 @@ function mysqli_field_tell (mysqli_result $result) {} * mysqli_store_result() or mysqli_use_result(). * @return void */ -function mysqli_free_result (mysqli_result $result) {} +function mysqli_free_result (mysqli_result $result): void {} /** * Returns client Zval cache statistics @@ -1787,6 +1802,7 @@ function mysqli_get_cache_stats (mysqli $mysql) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return array|false an array with connection stats if successful, FALSE otherwise. */ +#[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] function mysqli_get_connection_stats (mysqli $mysql) {} /** @@ -1794,6 +1810,7 @@ function mysqli_get_connection_stats (mysqli $mysql) {} * @link https://php.net/manual/en/function.mysqli-get-client-stats.php * @return array|false an array with client stats if success, false otherwise. */ +#[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] function mysqli_get_client_stats () {} /** @@ -1802,7 +1819,7 @@ function mysqli_get_client_stats () {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return object */ -function mysqli_get_charset (mysqli $mysql) {} +function mysqli_get_charset (mysqli $mysql): object {} /** * Get MySQL client info @@ -1810,14 +1827,14 @@ function mysqli_get_charset (mysqli $mysql) {} * @param mysqli $mysql [optional] A link identifier returned by mysqli_connect() or mysqli_init() * @return string A string that represents the MySQL client library version */ -function mysqli_get_client_info (mysqli $mysql) {} +function mysqli_get_client_info (mysqli $mysql): string {} /** * Returns the MySQL client version as an integer * @link https://php.net/manual/en/mysqli.get-client-version.php * @return int */ -function mysqli_get_client_version () {} +function mysqli_get_client_version (): int {} /** * Returns a string representing the type of connection used @@ -1825,7 +1842,7 @@ function mysqli_get_client_version () {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return string A character string representing the server hostname and the connection type. */ -function mysqli_get_host_info (mysqli $mysql) {} +function mysqli_get_host_info (mysqli $mysql): string {} /** * Return information about open and cached links @@ -1869,7 +1886,7 @@ function mysqli_get_host_info (mysqli $mysql) {} *

* @since 5.6 */ -function mysqli_get_links_stats() {} +function mysqli_get_links_stats(): array {} /** * Returns the version of the MySQL protocol used @@ -1877,7 +1894,7 @@ function mysqli_get_links_stats() {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return int Returns an integer representing the protocol version */ -function mysqli_get_proto_info (mysqli $mysql) {} +function mysqli_get_proto_info (mysqli $mysql): int {} /** * Returns the version of the MySQL server @@ -1885,7 +1902,7 @@ function mysqli_get_proto_info (mysqli $mysql) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return string A character string representing the server version. */ -function mysqli_get_server_info (mysqli $mysql) {} +function mysqli_get_server_info (mysqli $mysql): string {} /** * Returns the version of the MySQL server as an integer @@ -1894,23 +1911,23 @@ function mysqli_get_server_info (mysqli $mysql) {} * @return int An integer representing the server version. * The form of this version number is main_version * 10000 + minor_version * 100 + sub_version (i.e. version 4.1.0 is 40100). */ -function mysqli_get_server_version (mysqli $mysql) {} +function mysqli_get_server_version (mysqli $mysql): int {} /** * Get result of SHOW WARNINGS * @link https://php.net/manual/en/mysqli.get-warnings.php * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() - * @return mysqli_warning + * @return mysqli_warning|false */ -function mysqli_get_warnings (mysqli $mysql) {} +function mysqli_get_warnings (mysqli $mysql): mysqli_warning|false {} /** * Initializes MySQLi and returns a resource for use with mysqli_real_connect() * @link https://php.net/manual/en/mysqli.init.php - * @return mysqli + * @return mysqli|false * @see mysqli_real_connect() */ -function mysqli_init () {} +function mysqli_init (): mysqli|false {} /** * Retrieves information about the most recently executed query @@ -1918,7 +1935,7 @@ function mysqli_init () {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return string A character string representing additional information about the most recently executed query. */ -function mysqli_info (mysqli $mysql) {} +function mysqli_info (mysqli $mysql): string {} /** * Returns the auto generated id used in the last query @@ -1927,7 +1944,8 @@ function mysqli_info (mysqli $mysql) {} * @return int|string The value of the AUTO_INCREMENT field that was updated by the previous query. Returns zero if there was no previous query on the connection or if the query did not update an AUTO_INCREMENT value. * If the number is greater than maximal int value, mysqli_insert_id() will return a string. */ -function mysqli_insert_id (mysqli $mysql) {} +function mysqli_insert_id (mysqli $mysql): string|int +{} /** * Asks the server to kill a MySQL thread @@ -1937,7 +1955,8 @@ function mysqli_insert_id (mysqli $mysql) {} * @param int $process_id * @return bool */ -function mysqli_kill (mysqli $mysql, int $process_id) {} +function mysqli_kill (mysqli $mysql, int $process_id): bool +{} /** * Unsets user defined handler for load local infile command @@ -1954,7 +1973,8 @@ function mysqli_set_local_infile_default (mysqli $mysql) {} * @param callable $read_func * @return bool */ -function mysqli_set_local_infile_handler (mysqli $mysql, callable $read_func) {} +function mysqli_set_local_infile_handler (mysqli $mysql, callable $read_func): bool +{} /** * Check if there are any more query results from a multi query @@ -1963,7 +1983,8 @@ function mysqli_set_local_infile_handler (mysqli $mysql, callable $read_func) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return bool */ -function mysqli_more_results (mysqli $mysql) {} +function mysqli_more_results (mysqli $mysql): bool +{} /** * Performs a query on the database @@ -1972,7 +1993,8 @@ function mysqli_more_results (mysqli $mysql) {} * @param string $query One or more queries which are separated by semicolons. * @return bool Returns FALSE if the first statement failed. To retrieve subsequent errors from other statements you have to call mysqli_next_result() first. */ -function mysqli_multi_query (mysqli $mysql, string $query) {} +function mysqli_multi_query (mysqli $mysql, string $query): bool +{} /** * Prepare next result from multi_query @@ -1980,7 +2002,8 @@ function mysqli_multi_query (mysqli $mysql, string $query) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return bool */ -function mysqli_next_result (mysqli $mysql) {} +function mysqli_next_result (mysqli $mysql): bool +{} /** * Get the number of fields in a result @@ -1989,16 +2012,18 @@ function mysqli_next_result (mysqli $mysql) {} * mysqli_store_result() or mysqli_use_result(). * @return int */ -function mysqli_num_fields (mysqli_result $result) {} +function mysqli_num_fields (mysqli_result $result): int +{} /** * Gets the number of rows in a result * @link https://php.net/manual/en/mysqli-result.num-rows.php * @param mysqli_result $result A result set identifier returned by mysqli_query(), * mysqli_store_result() or mysqli_use_result(). - * @return int Returns number of rows in the result set. + * @return string|int Returns number of rows in the result set. */ -function mysqli_num_rows (mysqli_result $result) {} +function mysqli_num_rows (mysqli_result $result): string|int +{} /** * Set options @@ -2008,7 +2033,8 @@ function mysqli_num_rows (mysqli_result $result) {} * @param mixed $value * @return bool */ -function mysqli_options (mysqli $mysql, int $option, $value) {} +function mysqli_options (mysqli $mysql, int $option, $value): bool +{} /** * Pings a server connection, or tries to reconnect if the connection has gone down @@ -2016,7 +2042,8 @@ function mysqli_options (mysqli $mysql, int $option, $value) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return bool */ -function mysqli_ping (mysqli $mysql) {} +function mysqli_ping (mysqli $mysql): bool +{} /** * Poll connections @@ -2028,7 +2055,8 @@ function mysqli_ping (mysqli $mysql) {} * @param int $microseconds [optional] * @return int|false number of ready connections upon success, FALSE otherwise. */ -function mysqli_poll (array &$read, array &$write, array &$error, int $seconds, int $microseconds = 0) {} +function mysqli_poll (array &$read, array &$write, array &$error, int $seconds, int $microseconds = 0): int|false +{} /** * Prepare an SQL statement for execution @@ -2037,7 +2065,8 @@ function mysqli_poll (array &$read, array &$write, array &$error, int $seconds, * @param string $query * @return mysqli_stmt|false A statement object or FALSE if an error occurred. */ -function mysqli_prepare (mysqli $mysql, string $query) {} +function mysqli_prepare (mysqli $mysql, string $query): mysqli_stmt|false +{} /** * Enables or disables internal report functions @@ -2076,7 +2105,8 @@ function mysqli_prepare (mysqli $mysql, string $query) {} *

* @return bool */ -function mysqli_report (int $flags) {} +function mysqli_report (int $flags): bool +{} /** * Performs a query on the database @@ -2089,7 +2119,8 @@ function mysqli_report (int $flags) {} * For other successful queries mysqli_query() will return TRUE. * Returns FALSE on failure. */ -function mysqli_query (mysqli $mysql, string $query, int $result_mode = MYSQLI_STORE_RESULT) {} +function mysqli_query (mysqli $mysql, string $query, int $result_mode = MYSQLI_STORE_RESULT): mysqli_result|bool +{} /** * Opens a connection to a mysql server @@ -2105,7 +2136,8 @@ function mysqli_query (mysqli $mysql, string $query, int $result_mode = MYSQLI_S * @param int $flags [optional] * @return bool */ -function mysqli_real_connect (mysqli $mysql, string $hostname, string $username, string $password, string $database, int $port, string $socket, int $flags) {} +function mysqli_real_connect (mysqli $mysql, string $hostname, string $username, string $password, string $database, int $port, string $socket, int $flags): bool +{} /** * Escapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection @@ -2114,7 +2146,8 @@ function mysqli_real_connect (mysqli $mysql, string $hostname, string $username, * @param string $string The string to be escaped. Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and Control-Z. * @return string */ -function mysqli_real_escape_string (mysqli $mysql, string $string) {} +function mysqli_real_escape_string (mysqli $mysql, string $string): string +{} /** * Execute an SQL query @@ -2124,7 +2157,8 @@ function mysqli_real_escape_string (mysqli $mysql, string $string) {} * @param string $query * @return bool */ -function mysqli_real_query (mysqli $mysql, string $query) {} +function mysqli_real_query (mysqli $mysql, string $query): bool +{} /** * Get result from async query @@ -2132,9 +2166,10 @@ function mysqli_real_query (mysqli $mysql, string $query) {} * @link https://php.net/manual/en/mysqli.reap-async-query.php * @see mysqli_poll() * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() - * @return mysqli_result|false mysqli_result in success, FALSE otherwise. + * @return mysqli_result|bool mysqli_result in success, FALSE otherwise. */ -function mysqli_reap_async_query (mysqli $mysql) {} +function mysqli_reap_async_query (mysqli $mysql): mysqli_result|bool +{} /** * Removes the named savepoint from the set of savepoints of the current transaction @@ -2144,7 +2179,8 @@ function mysqli_reap_async_query (mysqli $mysql) {} * @return bool Returns TRUE on success or FALSE on failure. * @since 5.5 */ -function mysqli_release_savepoint (mysqli $mysql, string $name) {} +function mysqli_release_savepoint (mysqli $mysql, string $name): bool +{} /** * Rolls back current transaction @@ -2154,7 +2190,8 @@ function mysqli_release_savepoint (mysqli $mysql, string $name) {} * @param string $name [optional] If provided then ROLLBACKname is executed * @return bool */ -function mysqli_rollback (mysqli $mysql, int $flags = 0, string $name) {} +function mysqli_rollback (mysqli $mysql, int $flags = 0, string $name): bool +{} /** * Set a named transaction savepoint @@ -2164,7 +2201,8 @@ function mysqli_rollback (mysqli $mysql, int $flags = 0, string $name) {} * @return bool Returns TRUE on success or FALSE on failure. * @since 5.5 */ -function mysqli_savepoint (mysqli $mysql, string $name) {} +function mysqli_savepoint (mysqli $mysql, string $name): bool +{} /** * Selects the default database for database queries @@ -2173,7 +2211,8 @@ function mysqli_savepoint (mysqli $mysql, string $name) {} * @param string $database * @return bool */ -function mysqli_select_db (mysqli $mysql, string $database) {} +function mysqli_select_db (mysqli $mysql, string $database): bool +{} /** * Sets the default client character set @@ -2182,7 +2221,8 @@ function mysqli_select_db (mysqli $mysql, string $database) {} * @param string $charset * @return bool */ -function mysqli_set_charset (mysqli $mysql, string $charset) {} +function mysqli_set_charset (mysqli $mysql, string $charset): bool +{} /** * Returns the total number of rows changed, deleted, or inserted by the last executed statement @@ -2190,7 +2230,8 @@ function mysqli_set_charset (mysqli $mysql, string $charset) {} * @param mysqli_stmt $statement * @return int|string If the number of affected rows is greater than maximal PHP int value, the number of affected rows will be returned as a string value. */ -function mysqli_stmt_affected_rows (mysqli_stmt $statement) {} +function mysqli_stmt_affected_rows (mysqli_stmt $statement): string|int +{} /** * Used to get the current value of a statement attribute @@ -2199,7 +2240,9 @@ function mysqli_stmt_affected_rows (mysqli_stmt $statement) {} * @param int $attribute * @return int|false Returns FALSE if the attribute is not found, otherwise returns the value of the attribute. */ -function mysqli_stmt_attr_get (mysqli_stmt $statement, int $attribute) {} +#[LanguageLevelTypeAware(["8.0" => "int"], default: "int|false")] +function mysqli_stmt_attr_get (mysqli_stmt $statement, int $attribute): bool|int +{} /** * Used to modify the behavior of a prepared statement @@ -2209,7 +2252,8 @@ function mysqli_stmt_attr_get (mysqli_stmt $statement, int $attribute) {} * @param int $value * @return bool */ -function mysqli_stmt_attr_set (mysqli_stmt $statement, int $attribute, int $value) {} +function mysqli_stmt_attr_set (mysqli_stmt $statement, int $attribute, int $value): bool +{} /** * Returns the number of fields in the given statement @@ -2217,15 +2261,17 @@ function mysqli_stmt_attr_set (mysqli_stmt $statement, int $attribute, int $valu * @param mysqli_stmt $statement * @return int */ -function mysqli_stmt_field_count (mysqli_stmt $statement) {} +function mysqli_stmt_field_count (mysqli_stmt $statement): int +{} /** * Initializes a statement and returns an object for use with mysqli_stmt_prepare * @link https://php.net/manual/en/mysqli.stmt-init.php * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() - * @return mysqli_stmt + * @return mysqli_stmt|false */ -function mysqli_stmt_init (mysqli $mysql) {} +function mysqli_stmt_init (mysqli $mysql): mysqli_stmt|false +{} /** * Prepare an SQL statement for execution @@ -2234,7 +2280,8 @@ function mysqli_stmt_init (mysqli $mysql) {} * @param string $query * @return bool */ -function mysqli_stmt_prepare (mysqli_stmt $statement, string $query) {} +function mysqli_stmt_prepare (mysqli_stmt $statement, string $query): bool +{} /** * Returns result set metadata from a prepared statement @@ -2242,7 +2289,8 @@ function mysqli_stmt_prepare (mysqli_stmt $statement, string $query) {} * @param mysqli_stmt $statement * @return mysqli_result|false Returns a result object or FALSE if an error occurred */ -function mysqli_stmt_result_metadata (mysqli_stmt $statement) {} +function mysqli_stmt_result_metadata (mysqli_stmt $statement): mysqli_result|false +{} /** * Send data in blocks @@ -2252,7 +2300,8 @@ function mysqli_stmt_result_metadata (mysqli_stmt $statement) {} * @param string $data * @return bool */ -function mysqli_stmt_send_long_data (mysqli_stmt $statement, int $param_num, string $data) {} +function mysqli_stmt_send_long_data (mysqli_stmt $statement, int $param_num, string $data): bool +{} /** * Binds variables to a prepared statement as parameters @@ -2292,7 +2341,8 @@ function mysqli_stmt_send_long_data (mysqli_stmt $statement, int $param_num, str * @param mixed &...$_ [optional] * @return bool true on success or false on failure. */ -function mysqli_stmt_bind_param (mysqli_stmt $statement, string $types, mixed &$var1, &...$_) {} +function mysqli_stmt_bind_param (mysqli_stmt $statement, string $types, mixed &$var1, &...$_): bool +{} /** * Binds variables to a prepared statement for result storage @@ -2302,7 +2352,8 @@ function mysqli_stmt_bind_param (mysqli_stmt $statement, string $types, mixed &$ * @param mixed &...$_ The variables to be bound. * @return bool */ -function mysqli_stmt_bind_result (mysqli_stmt $statement, mixed &$var1, &...$_) {} +function mysqli_stmt_bind_result (mysqli_stmt $statement, mixed &$var1, &...$_): bool +{} /** * Fetch results from a prepared statement into the bound variables @@ -2310,7 +2361,8 @@ function mysqli_stmt_bind_result (mysqli_stmt $statement, mixed &$var1, &...$_) * @param mysqli_stmt $statement * @return bool|null */ -function mysqli_stmt_fetch (mysqli_stmt $statement) {} +function mysqli_stmt_fetch (mysqli_stmt $statement): ?bool +{} /** * Frees stored result memory for the given statement handle @@ -2318,7 +2370,7 @@ function mysqli_stmt_fetch (mysqli_stmt $statement) {} * @param mysqli_stmt $statement * @return void */ -function mysqli_stmt_free_result (mysqli_stmt $statement) {} +function mysqli_stmt_free_result (mysqli_stmt $statement): void {} /** * Gets a result set from a prepared statement @@ -2326,23 +2378,26 @@ function mysqli_stmt_free_result (mysqli_stmt $statement) {} * @param mysqli_stmt $statement * @return mysqli_result|false Returns a resultset or FALSE on failure. */ -function mysqli_stmt_get_result (mysqli_stmt $statement) {} +function mysqli_stmt_get_result (mysqli_stmt $statement): mysqli_result|false +{} /** * Get result of SHOW WARNINGS * @link https://php.net/manual/en/mysqli-stmt.get-warnings.php * @param mysqli_stmt $statement - * @return object (not documented, but it's probably a mysqli_warning object) + * @return mysqli_warning|false (not documented, but it's probably a mysqli_warning object) */ -function mysqli_stmt_get_warnings (mysqli_stmt $statement) {} +function mysqli_stmt_get_warnings (mysqli_stmt $statement): mysqli_warning|false +{} /** * Get the ID generated from the previous INSERT operation * @link https://php.net/manual/en/mysqli-stmt.insert-id.php * @param mysqli_stmt $statement - * @return mixed + * @return string|int */ -function mysqli_stmt_insert_id (mysqli_stmt $statement) {} +function mysqli_stmt_insert_id (mysqli_stmt $statement): string|int +{} /** * Resets a prepared statement @@ -2350,7 +2405,8 @@ function mysqli_stmt_insert_id (mysqli_stmt $statement) {} * @param mysqli_stmt $statement * @return bool */ -function mysqli_stmt_reset (mysqli_stmt $statement) {} +function mysqli_stmt_reset (mysqli_stmt $statement): bool +{} /** * Returns the number of parameter for the given statement @@ -2358,7 +2414,8 @@ function mysqli_stmt_reset (mysqli_stmt $statement) {} * @param mysqli_stmt $statement * @return int */ -function mysqli_stmt_param_count (mysqli_stmt $statement) {} +function mysqli_stmt_param_count (mysqli_stmt $statement): int +{} /** * Returns the SQLSTATE error from previous MySQL operation @@ -2366,7 +2423,8 @@ function mysqli_stmt_param_count (mysqli_stmt $statement) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return string Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. '00000' means no error. */ -function mysqli_sqlstate (mysqli $mysql) {} +function mysqli_sqlstate (mysqli $mysql): string +{} /** * Gets the current system status @@ -2374,7 +2432,8 @@ function mysqli_sqlstate (mysqli $mysql) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return string|false A string describing the server status. FALSE if an error occurred. */ -function mysqli_stat (mysqli $mysql) {} +function mysqli_stat (mysqli $mysql): string|false +{} /** * Used for establishing secure connections using SSL @@ -2387,7 +2446,8 @@ function mysqli_stat (mysqli $mysql) {} * @param string $cipher_algos A list of allowable ciphers to use for SSL encryption * @return bool This function always returns TRUE value. */ -function mysqli_ssl_set(mysqli $mysql, string $key , string $certificate , string $ca_certificate , string $ca_path , string $cipher_algos) {} +function mysqli_ssl_set(mysqli $mysql, string $key , string $certificate , string $ca_certificate , string $ca_path , string $cipher_algos): bool +{} /** * Closes a prepared statement @@ -2395,7 +2455,8 @@ function mysqli_ssl_set(mysqli $mysql, string $key , string $certificate , strin * @param mysqli_stmt $statement * @return bool */ -function mysqli_stmt_close (mysqli_stmt $statement) {} +function mysqli_stmt_close (mysqli_stmt $statement): bool +{} /** * Seeks to an arbitrary row in statement result set @@ -2404,7 +2465,7 @@ function mysqli_stmt_close (mysqli_stmt $statement) {} * @param int $offset * @return void */ -function mysqli_stmt_data_seek (mysqli_stmt $statement, int $offset) {} +function mysqli_stmt_data_seek (mysqli_stmt $statement, int $offset): void {} /** * Returns the error code for the most recent statement call @@ -2412,7 +2473,8 @@ function mysqli_stmt_data_seek (mysqli_stmt $statement, int $offset) {} * @param mysqli_stmt $statement * @return int */ -function mysqli_stmt_errno (mysqli_stmt $statement) {} +function mysqli_stmt_errno (mysqli_stmt $statement): int +{} /** * Returns a string description for last statement error @@ -2420,7 +2482,8 @@ function mysqli_stmt_errno (mysqli_stmt $statement) {} * @param mysqli_stmt $statement * @return string */ -function mysqli_stmt_error (mysqli_stmt $statement) {} +function mysqli_stmt_error (mysqli_stmt $statement): string +{} /** * Check if there are more query results from a multiple query @@ -2428,7 +2491,8 @@ function mysqli_stmt_error (mysqli_stmt $statement) {} * @param mysqli_stmt $statement * @return bool */ -function mysqli_stmt_more_results (mysqli_stmt $statement) {} +function mysqli_stmt_more_results (mysqli_stmt $statement): bool +{} /** * Reads the next result from a multiple query @@ -2436,15 +2500,17 @@ function mysqli_stmt_more_results (mysqli_stmt $statement) {} * @param mysqli_stmt $statement * @return bool */ -function mysqli_stmt_next_result (mysqli_stmt $statement) {} +function mysqli_stmt_next_result (mysqli_stmt $statement): bool +{} /** * Return the number of rows in statements result set * @link https://php.net/manual/en/mysqli-stmt.num-rows.php * @param mysqli_stmt $statement - * @return int + * @return string|int */ -function mysqli_stmt_num_rows (mysqli_stmt $statement) {} +function mysqli_stmt_num_rows (mysqli_stmt $statement): string|int +{} /** * Returns SQLSTATE error from previous statement operation @@ -2452,7 +2518,8 @@ function mysqli_stmt_num_rows (mysqli_stmt $statement) {} * @param mysqli_stmt $statement * @return string Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. '00000' means no error. */ -function mysqli_stmt_sqlstate (mysqli_stmt $statement) {} +function mysqli_stmt_sqlstate (mysqli_stmt $statement): string +{} /** * Transfers a result set from a prepared statement @@ -2460,7 +2527,8 @@ function mysqli_stmt_sqlstate (mysqli_stmt $statement) {} * @param mysqli_stmt $statement * @return bool */ -function mysqli_stmt_store_result (mysqli_stmt $statement) {} +function mysqli_stmt_store_result (mysqli_stmt $statement): bool +{} /** * Transfers a result set from the last query @@ -2469,7 +2537,8 @@ function mysqli_stmt_store_result (mysqli_stmt $statement) {} * @param int $mode [optional] The option that you want to set * @return mysqli_result|false */ -function mysqli_store_result (mysqli $mysql, int $mode) {} +function mysqli_store_result (mysqli $mysql, int $mode): mysqli_result|false +{} /** * Returns the thread ID for the current connection @@ -2477,14 +2546,16 @@ function mysqli_store_result (mysqli $mysql, int $mode) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return int Returns the Thread ID for the current connection. */ -function mysqli_thread_id (mysqli $mysql) {} +function mysqli_thread_id (mysqli $mysql): int +{} /** * Returns whether thread safety is given or not * @link https://php.net/manual/en/mysqli.thread-safe.php * @return bool */ -function mysqli_thread_safe () {} +function mysqli_thread_safe (): bool +{} /** * Initiate a result set retrieval @@ -2492,7 +2563,8 @@ function mysqli_thread_safe () {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return mysqli_result|false */ -function mysqli_use_result (mysqli $mysql) {} +function mysqli_use_result (mysqli $mysql): mysqli_result|false +{} /** * Returns the number of warnings from the last query for the given link @@ -2500,7 +2572,8 @@ function mysqli_use_result (mysqli $mysql) {} * @param mysqli $mysql A link identifier returned by mysqli_connect() or mysqli_init() * @return int */ -function mysqli_warning_count (mysqli $mysql) {} +function mysqli_warning_count (mysqli $mysql): int +{} /** * Flushes tables or caches, or resets the replication server information @@ -2509,7 +2582,8 @@ function mysqli_warning_count (mysqli $mysql) {} * @param int $flags * @return bool */ -function mysqli_refresh (mysqli $mysql, int $flags) {} +function mysqli_refresh (mysqli $mysql, int $flags): bool +{} /** * Alias for mysqli_stmt_bind_param @@ -2540,7 +2614,8 @@ function mysqli_bind_result (mysqli_stmt $statement, string $types, mixed &$var1 * @removed 5.4 */ #[Deprecated(since: '5.3')] -function mysqli_client_encoding (mysqli $mysql) {} +function mysqli_client_encoding (mysqli $mysql): string +{} /** * Alias of mysqli_real_escape_string @@ -2549,7 +2624,8 @@ function mysqli_client_encoding (mysqli $mysql) {} * @param string $string The string to be escaped * @return string */ -function mysqli_escape_string (mysqli $mysql, string $string) {} +function mysqli_escape_string (mysqli $mysql, string $string): string +{} /** * Alias for mysqli_stmt_fetch @@ -2559,7 +2635,8 @@ function mysqli_escape_string (mysqli $mysql, string $string) {} * @removed 5.4 */ #[Deprecated(since: '5.3')] -function mysqli_fetch (mysqli_stmt $statement) {} +function mysqli_fetch (mysqli_stmt $statement): bool +{} /** * Alias for mysqli_stmt_param_count @@ -2569,7 +2646,8 @@ function mysqli_fetch (mysqli_stmt $statement) {} * @removed 5.4 */ #[Deprecated(since: '5.3')] -function mysqli_param_count (mysqli_stmt $statement) {} +function mysqli_param_count (mysqli_stmt $statement): int +{} /** * Alias for mysqli_stmt_result_metadata @@ -2579,7 +2657,8 @@ function mysqli_param_count (mysqli_stmt $statement) {} * @removed 5.4 */ #[Deprecated(since: '5.3')] -function mysqli_get_metadata (mysqli_stmt $statement) {} +function mysqli_get_metadata (mysqli_stmt $statement): bool|mysqli_result +{} /** * Alias for mysqli_stmt_send_long_data @@ -2591,7 +2670,8 @@ function mysqli_get_metadata (mysqli_stmt $statement) {} * @removed 5.4 */ #[Deprecated(since: '5.3')] -function mysqli_send_long_data (mysqli_stmt $statement, int $param_num, string $data) {} +function mysqli_send_long_data (mysqli_stmt $statement, int $param_num, string $data): bool +{} /** * Alias of mysqli_options @@ -2601,7 +2681,8 @@ function mysqli_send_long_data (mysqli_stmt $statement, int $param_num, string $ * @param mixed $value * @return bool */ -function mysqli_set_opt (mysqli $mysql, int $option, mixed $value) {} +function mysqli_set_opt (mysqli $mysql, int $option, mixed $value): bool +{} /** diff --git a/openssl/openssl.php b/openssl/openssl.php index b7a83cdde..bbf801be6 100644 --- a/openssl/openssl.php +++ b/openssl/openssl.php @@ -12,7 +12,7 @@ * @return void */ #[Deprecated(since: '8.0')] -function openssl_pkey_free(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey"], default: "resource")] $key) { } +function openssl_pkey_free(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey"], default: "resource")] $key): void { } /** * Generates a new private key @@ -23,10 +23,12 @@ function openssl_pkey_free(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetric * openssl_csr_new for more information about * configargs. *

- * @return resource|false a resource identifier for the pkey on success, or false on + * @return OpenSSLAsymmetricKey|resource|false a resource identifier for the pkey on success, or false on * error. */ -function openssl_pkey_new(array $options) { } +#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey|false"], default: "resource|false")] +function openssl_pkey_new(array $options): bool +{ } /** * Gets an exportable representation of a key into a string @@ -44,7 +46,8 @@ function openssl_pkey_new(array $options) { } *

* @return bool true on success or false on failure. */ -function openssl_pkey_export($key, &$output, string $passphrase, array $options) { } +function openssl_pkey_export($key, &$output, string $passphrase, array $options): bool +{ } /** * Gets an exportable representation of a key into a file @@ -65,7 +68,8 @@ function openssl_pkey_export($key, &$output, string $passphrase, array $options) *

* @return bool true on success or false on failure. */ -function openssl_pkey_export_to_file($key, string $output_filename, string $passphrase, array $options) { } +function openssl_pkey_export_to_file($key, string $output_filename, string $passphrase, array $options): bool +{ } /** * Get a private key @@ -84,9 +88,11 @@ function openssl_pkey_export_to_file($key, string $output_filename, string $pass * The optional parameter passphrase must be used * if the specified key is encrypted (protected by a passphrase). *

- * @return resource|false Returns a positive key resource identifier on success, or FALSE on error. + * @return OpenSSLAsymmetricKey|resource|false Returns a positive key resource identifier on success, or FALSE on error. */ -function openssl_pkey_get_private($private_key, string $passphrase = "") { } +#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey|false"], default: "resource|false")] +function openssl_pkey_get_private($private_key, string $passphrase = ""): bool +{ } /** * Extract public key from certificate and prepare it for use @@ -101,9 +107,11 @@ function openssl_pkey_get_private($private_key, string $passphrase = "") { } * *
  • A PEM formatted public key.
  • *

    - * @return resource|false a positive key resource identifier on success, or false on error. + * @return OpenSSLAsymmetricKey|resource|false a positive key resource identifier on success, or false on error. */ -function openssl_pkey_get_public($public_key) { } +#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey|false"], default: "resource|false")] +function openssl_pkey_get_public($public_key): bool +{ } /** * Returns an array with the key details @@ -124,7 +132,8 @@ function openssl_pkey_get_public($public_key) { } * Depending on the key type used, additional details may be returned. Note that * some elements may not always be available. */ -function openssl_pkey_get_details(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey"], default: "resource")] $key) { } +function openssl_pkey_get_details(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey"], default: "resource")] $key): array|false +{ } /** * Free key resource @@ -133,7 +142,7 @@ function openssl_pkey_get_details(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsy * @return void */ #[Deprecated(since: '8.0')] -function openssl_free_key(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey"], default: "resource")] $key) { } +function openssl_free_key(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey"], default: "resource")] $key): void { } /** * Alias of openssl_pkey_get_private @@ -152,9 +161,11 @@ function openssl_free_key(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricK * The optional parameter passphrase must be used * if the specified key is encrypted (protected by a passphrase). *

    - * @return resource|false Returns a positive key resource identifier on success, or FALSE on error. + * @return OpenSSLAsymmetricKey|resource|false Returns a positive key resource identifier on success, or FALSE on error. */ -function openssl_get_privatekey($private_key, string $passphrase) { } +#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey|false"], default: "resource|false")] +function openssl_get_privatekey($private_key, string $passphrase): bool +{ } /** * Alias of openssl_pkey_get_public @@ -170,9 +181,11 @@ function openssl_get_privatekey($private_key, string $passphrase) { } * *
  • A PEM formatted public key.
  • *

    - * @return resource|false a positive key resource identifier on success, or FALSE on error. + * @return OpenSSLAsymmetricKey|false a positive key resource identifier on success, or FALSE on error. */ -function openssl_get_publickey($public_key) { } +#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey|false"], default: "resource|false")] +function openssl_get_publickey($public_key): bool +{ } /** * Generate a new signed public key and challenge @@ -186,10 +199,11 @@ function openssl_get_publickey($public_key) { } *

    * @param string &$challenge

    The challenge associated to associate with the SPKAC

    * @param int $digest_algo

    The digest algorithm. See openssl_get_md_method().

    - * @return string|null Returns a signed public key and challenge string or NULL on failure. + * @return string|false Returns a signed public key and challenge string or NULL on failure. * @since 5.6 */ -function openssl_spki_new(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey"], default: "resource")] &$private_key, string &$challenge, int $digest_algo = 0) {} +function openssl_spki_new(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey"], default: "resource")] &$private_key, string &$challenge, int $digest_algo = 0): string|false +{} /** @@ -199,33 +213,38 @@ function openssl_spki_new(#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricK * @return bool Returns a boolean on success or failure. * @since 5.6 */ -function openssl_spki_verify(string &$spki) {} +function openssl_spki_verify(string &$spki): bool +{} /** * Exports the challenge associated with a signed public key and challenge * @link https://php.net/manual/en/function.openssl-spki-export-challenge.php * @param string &$spki

    Expects a valid signed public key and challenge

    - * @return string|null Returns the associated challenge string or NULL on failure. + * @return string|false Returns the associated challenge string or NULL on failure. * @since 5.6 */ -function openssl_spki_export_challenge (string &$spki) {} +function openssl_spki_export_challenge (string &$spki): string|false +{} /** * Exports a valid PEM formatted public key signed public key and challenge * @link https://php.net/manual/en/function.openssl-spki-export.php * @param string &$spki

    Expects a valid signed public key and challenge

    - * @return string|null Returns the associated PEM formatted public key or NULL on failure. + * @return string|false Returns the associated PEM formatted public key or NULL on failure. * @since 5.6 */ -function openssl_spki_export (string &$spki ) {} +function openssl_spki_export (string &$spki ): string|false +{} /** * Parse an X.509 certificate and return a resource identifier for * it * @link https://php.net/manual/en/function.openssl-x509-read.php * @param OpenSSLCertificate|string|resource $certificate - * @return resource|false a resource identifier on success or false on failure. + * @return OpenSSLCertificate|resource|false a resource identifier on success or false on failure. */ -function openssl_x509_read(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate) { } +#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|false"], default: "resource|false")] +function openssl_x509_read(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate) +{ } /** * @param string $certificate @@ -234,7 +253,8 @@ function openssl_x509_read(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificat * @return string|false FALSE on failure * @since 5.6 */ -function openssl_x509_fingerprint(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, string $digest_algo, bool $binary) {} +function openssl_x509_fingerprint(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, string $digest_algo, bool $binary): string|false +{} /** * Free certificate resource * @link https://php.net/manual/en/function.openssl-x509-free.php @@ -242,7 +262,7 @@ function openssl_x509_fingerprint(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCer * @return void */ #[Deprecated(since: '8.0')] -function openssl_x509_free(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate"], default: "resource|string")] $certificate) { } +function openssl_x509_free(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate"], default: "resource|string")] $certificate): void { } /** * Parse an X509 certificate and return the information as an array @@ -257,7 +277,8 @@ function openssl_x509_free(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificat * @return array|false The structure of the returned data is (deliberately) not * yet documented, as it is still subject to change. */ -function openssl_x509_parse(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, bool $short_names = true) { } +function openssl_x509_parse(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, bool $short_names = true): array|false +{ } /** * Verifies if a certificate can be used for a particular purpose @@ -319,7 +340,8 @@ function openssl_x509_parse(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertifica * @return int|bool true if the certificate can be used for the intended purpose, * false if it cannot, or -1 on error. */ -function openssl_x509_checkpurpose(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, int $purpose, array $ca_info, string $untrusted_certificates_file) { } +function openssl_x509_checkpurpose(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, int $purpose, array $ca_info, string $untrusted_certificates_file): int|bool +{ } /** * Checks if a private key corresponds to a certificate @@ -333,7 +355,8 @@ function openssl_x509_checkpurpose(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCe * @return bool true if key is the private key that * corresponds to cert, or false otherwise. */ -function openssl_x509_check_private_key(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, $private_key) { } +function openssl_x509_check_private_key(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, $private_key): bool +{ } /** * Exports a certificate as a string @@ -345,7 +368,8 @@ function openssl_x509_check_private_key(#[LanguageLevelTypeAware(["8.0" => "Open * @param bool $no_text [optional] ¬e.openssl.param-notext; * @return bool true on success or false on failure. */ -function openssl_x509_export(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, &$output, bool $no_text = true) { } +function openssl_x509_export(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, &$output, bool $no_text = true): bool +{ } /** * Exports a certificate to file @@ -357,7 +381,8 @@ function openssl_x509_export(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertific * @param bool $no_text [optional] ¬e.openssl.param-notext; * @return bool true on success or false on failure. */ -function openssl_x509_export_to_file(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, string $output_filename, bool $no_text = true) { } +function openssl_x509_export_to_file(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, string $output_filename, bool $no_text = true): bool +{ } /** * Verifies digital signature of x509 certificate against a public key @@ -386,7 +411,8 @@ function openssl_x509_verify(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertific * @return bool true on success or false on failure. * @since 5.2.2 */ -function openssl_pkcs12_export(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, &$output, $private_key, string $passphrase, array $options) { } +function openssl_pkcs12_export(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, &$output, $private_key, string $passphrase, array $options): bool +{ } /** * Exports a PKCS#12 Compatible Certificate Store File @@ -405,7 +431,8 @@ function openssl_pkcs12_export(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertif * @return bool true on success or false on failure. * @since 5.2.2 */ -function openssl_pkcs12_export_to_file(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, string $output_filename, $private_key, string $passphrase, array $options) { } +function openssl_pkcs12_export_to_file(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, string $output_filename, $private_key, string $passphrase, array $options): bool +{ } /** * Parse a PKCS#12 Certificate Store into an array @@ -420,7 +447,8 @@ function openssl_pkcs12_export_to_file(#[LanguageLevelTypeAware(["8.0" => "OpenS * @return bool true on success or false on failure. * @since 5.2.2 */ -function openssl_pkcs12_read(string $pkcs12, &$certificates, string $passphrase) { } +function openssl_pkcs12_read(string $pkcs12, &$certificates, string $passphrase): bool +{ } /** * Generates a CSR @@ -513,9 +541,11 @@ function openssl_pkcs12_read(string $pkcs12, &$certificates, string $passphrase) * extraattribs are associative arrays whose keys are * converted to OIDs and applied to the relevant part of the request. *

    - * @return false|resource the CSR. + * @return OpenSSLCertificateSigningRequest|false|resource the CSR. */ -function openssl_csr_new(array $distinguished_names, &$private_key, array $options, array $extra_attributes) { } +#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificateSigningRequest|false"], default: "resource|false")] +function openssl_csr_new(array $distinguished_names, &$private_key, array $options, array $extra_attributes) +{ } /** * Exports a CSR as a string @@ -525,7 +555,8 @@ function openssl_csr_new(array $distinguished_names, &$private_key, array $optio * @param bool $no_text [optional] ¬e.openssl.param-notext; * @return bool true on success or false on failure. */ -function openssl_csr_export(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificateSigningRequest|string"], default: "resource|string")] $csr, &$output, bool $no_text = true) { } +function openssl_csr_export(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificateSigningRequest|string"], default: "resource|string")] $csr, &$output, bool $no_text = true): bool +{ } /** * Exports a CSR to a file @@ -537,7 +568,8 @@ function openssl_csr_export(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertifica * @param bool $no_text [optional] ¬e.openssl.param-notext; * @return bool true on success or false on failure. */ -function openssl_csr_export_to_file(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificateSigningRequest|string"], default: "resource|string")] $csr, string $output_filename, bool $no_text = true) { } +function openssl_csr_export_to_file(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificateSigningRequest|string"], default: "resource|string")] $csr, string $output_filename, bool $no_text = true): bool +{ } /** * Sign a CSR with another certificate (or itself) and generate a certificate @@ -570,9 +602,11 @@ function openssl_csr_export_to_file(#[LanguageLevelTypeAware(["8.0" => "OpenSSLC * An optional the serial number of issued certificate. If not specified * it will default to 0. *

    - * @return resource|false an x509 certificate resource on success, false on failure. + * @return OpenSSLCertificate|resource|false an x509 certificate resource on success, false on failure. */ -function openssl_csr_sign(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificateSigningRequest|string"], default: "resource|string")] $csr, #[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string|null"], default: "resource|string|null")] $ca_certificate, $private_key, int $days, array $options, int $serial = 0) { } +#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|false"], default: "resource|false")] +function openssl_csr_sign(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificateSigningRequest|string"], default: "resource|string")] $csr, #[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string|null"], default: "resource|string|null")] $ca_certificate, $private_key, int $days, array $options, int $serial = 0) +{ } /** * Returns the subject of a CERT @@ -581,16 +615,19 @@ function openssl_csr_sign(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate * @param bool $short_names [optional] * @return array|false */ -function openssl_csr_get_subject(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificateSigningRequest|string"], default: "resource|string")] $csr, bool $short_names = true) { } +function openssl_csr_get_subject(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificateSigningRequest|string"], default: "resource|string")] $csr, bool $short_names = true): array|false +{ } /** * Returns the public key of a CERT * @link https://php.net/manual/en/function.openssl-csr-get-public-key.php * @param OpenSSLCertificateSigningRequest|string|resource $csr * @param bool $short_names [optional] - * @return resource|false + * @return OpenSSLAsymmetricKey|resource|false */ -function openssl_csr_get_public_key(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificateSigningRequest|string"], default: "resource|string")] $csr, bool $short_names = true) { } +#[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey|false"], default: "resource|false")] +function openssl_csr_get_public_key(#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificateSigningRequest|string"], default: "resource|string")] $csr, bool $short_names = true): bool +{ } /** * Computes a digest @@ -607,7 +644,8 @@ function openssl_csr_get_public_key(#[LanguageLevelTypeAware(["8.0" => "OpenSSLC *

    * @return string|false the digested hash value on success or false on failure. */ -function openssl_digest(string $data, string $digest_algo, bool $binary = false) { } +function openssl_digest(string $data, string $digest_algo, bool $binary = false): string|false +{ } /** * Encrypts data @@ -634,7 +672,8 @@ function openssl_digest(string $data, string $digest_algo, bool $binary = false) *

    * @return string|false the encrypted string on success or false on failure. */ -function openssl_encrypt(string $data, string $cipher_algo, string $passphrase, int $options = 0, string $iv = "", &$tag, string $aad = "", int $tag_length = 16) { } +function openssl_encrypt(string $data, string $cipher_algo, string $passphrase, int $options = 0, string $iv = "", &$tag, string $aad = "", int $tag_length = 16): string|false +{ } /** * Decrypts data @@ -662,7 +701,8 @@ function openssl_encrypt(string $data, string $cipher_algo, string $passphrase, * @param string $aad [optional]

    Additional authentication data.

    * @return string|false The decrypted string on success or false on failure. */ -function openssl_decrypt(string $data, string $cipher_algo, string $passphrase, int $options = 0, string $iv = "", string $tag = "", string $aad = "") { } +function openssl_decrypt(string $data, string $cipher_algo, string $passphrase, int $options = 0, string $iv = "", string $tag = "", string $aad = ""): string|false +{ } /** * (PHP 5 >= PHP 5.3.3)
    @@ -673,7 +713,8 @@ function openssl_decrypt(string $data, string $cipher_algo, string $passphrase, *

    * @return int|false the cipher length on success, or false on failure. */ -function openssl_cipher_iv_length(string $cipher_algo) { } +function openssl_cipher_iv_length(string $cipher_algo): int|false +{ } /** * Generate signature @@ -689,7 +730,8 @@ function openssl_cipher_iv_length(string $cipher_algo) { } *

    * @return bool true on success or false on failure. */ -function openssl_sign(string $data, &$signature, $private_key, string|int $algorithm = OPENSSL_ALGO_SHA1) { } +function openssl_sign(string $data, &$signature, $private_key, string|int $algorithm = OPENSSL_ALGO_SHA1): bool +{ } /** * Verify signature @@ -700,10 +742,11 @@ function openssl_sign(string $data, &$signature, $private_key, string|int $algor * @param string|int $algorithm [optional]

    * For more information see the list of Signature Algorithms. *

    - * @return int 1 if the signature is correct, 0 if it is incorrect, and + * @return int|false 1 if the signature is correct, 0 if it is incorrect, and * -1 on error. */ -function openssl_verify(string $data, string $signature, $public_key, string|int $algorithm = OPENSSL_ALGO_SHA1) { } +function openssl_verify(string $data, string $signature, $public_key, string|int $algorithm = OPENSSL_ALGO_SHA1): int|false +{ } /** * Seal (encrypt) data @@ -719,7 +762,8 @@ function openssl_verify(string $data, string $signature, $public_key, string|int * sealed_data, and the envelope keys in * env_keys. */ -function openssl_seal(string $data, &$sealed_data, &$encrypted_keys, array $public_key, string $cipher_algo, &$iv = '') { } +function openssl_seal(string $data, &$sealed_data, &$encrypted_keys, array $public_key, string $cipher_algo, &$iv = ''): int|false +{ } /** * Open sealed data @@ -735,7 +779,8 @@ function openssl_seal(string $data, &$sealed_data, &$encrypted_keys, array $publ * @param string $iv [optional] The initialization vector. * @return bool true on success or false on failure. */ -function openssl_open(string $data, &$output, string $encrypted_key, $private_key, string $cipher_algo = "RC4", string $iv) { } +function openssl_open(string $data, &$output, string $encrypted_key, $private_key, string $cipher_algo = "RC4", string $iv): bool +{ } /** * Generates a PKCS5 v2 PBKDF2 string, defaults to SHA-1 @@ -748,7 +793,8 @@ function openssl_open(string $data, &$output, string $encrypted_key, $private_ke * @return string|false Returns string or FALSE on failure. * @since 5.5 */ -function openssl_pbkdf2(string $password, string $salt, int $key_length, int $iterations, string $digest_algo) { } +function openssl_pbkdf2(string $password, string $salt, int $key_length, int $iterations, string $digest_algo): string|false +{ } /** * Verifies the signature of an S/MIME signed message @@ -786,7 +832,8 @@ function openssl_pbkdf2(string $password, string $salt, int $key_length, int $it * (the message has been tampered with, or the signing certificate is invalid), * or -1 on error. */ -function openssl_pkcs7_verify(string $input_filename, int $flags, string $signers_certificates_filename, array $ca_info, string $untrusted_certificates_filename, string $content, string $output_filename) { } +function openssl_pkcs7_verify(string $input_filename, int $flags, string $signers_certificates_filename, array $ca_info, string $untrusted_certificates_filename, string $content, string $output_filename): int|bool +{ } /** * Decrypts an S/MIME encrypted message @@ -800,7 +847,8 @@ function openssl_pkcs7_verify(string $input_filename, int $flags, string $signer * @param mixed $private_key [optional] * @return bool true on success or false on failure. */ -function openssl_pkcs7_decrypt(string $input_filename, string $output_filename, $certificate, $private_key) { } +function openssl_pkcs7_decrypt(string $input_filename, string $output_filename, $certificate, $private_key): bool +{ } /** * Sign an S/MIME message @@ -825,7 +873,8 @@ function openssl_pkcs7_decrypt(string $input_filename, string $output_filename, *

    * @return bool true on success or false on failure. */ -function openssl_pkcs7_sign(string $input_filename, string $output_filename, #[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, $private_key, array $headers, int $flags = PKCS7_DETACHED, string $untrusted_certificates_filename) { } +function openssl_pkcs7_sign(string $input_filename, string $output_filename, #[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $certificate, $private_key, array $headers, int $flags = PKCS7_DETACHED, string $untrusted_certificates_filename): bool +{ } /** * Encrypt an S/MIME message @@ -854,7 +903,8 @@ function openssl_pkcs7_sign(string $input_filename, string $output_filename, #[L *

    * @return bool true on success or false on failure. */ -function openssl_pkcs7_encrypt(string $input_filename, string $output_filename, $certificate, array $headers, int $flags = 0, int $cipher_algo = OPENSSL_CIPHER_RC2_40) { } +function openssl_pkcs7_encrypt(string $input_filename, string $output_filename, $certificate, array $headers, int $flags = 0, int $cipher_algo = OPENSSL_CIPHER_RC2_40): bool +{ } /** * Encrypts data with private key @@ -869,7 +919,8 @@ function openssl_pkcs7_encrypt(string $input_filename, string $output_filename, *

    * @return bool true on success or false on failure. */ -function openssl_private_encrypt(string $data, &$encrypted_data, $private_key, int $padding = OPENSSL_PKCS1_PADDING) { } +function openssl_private_encrypt(string $data, &$encrypted_data, $private_key, int $padding = OPENSSL_PKCS1_PADDING): bool +{ } /** * Decrypts data with private key @@ -889,7 +940,8 @@ function openssl_private_encrypt(string $data, &$encrypted_data, $private_key, i *

    * @return bool true on success or false on failure. */ -function openssl_private_decrypt(string $data, &$decrypted_data, $private_key, int $padding = OPENSSL_PKCS1_PADDING) { } +function openssl_private_decrypt(string $data, &$decrypted_data, $private_key, int $padding = OPENSSL_PKCS1_PADDING): bool +{ } /** * Encrypts data with public key @@ -910,7 +962,8 @@ function openssl_private_decrypt(string $data, &$decrypted_data, $private_key, i *

    * @return bool true on success or false on failure. */ -function openssl_public_encrypt(string $data, &$encrypted_data, $public_key, int $padding = OPENSSL_PKCS1_PADDING) { } +function openssl_public_encrypt(string $data, &$encrypted_data, $public_key, int $padding = OPENSSL_PKCS1_PADDING): bool +{ } /** * Decrypts data with public key @@ -928,7 +981,8 @@ function openssl_public_encrypt(string $data, &$encrypted_data, $public_key, int *

    * @return bool true on success or false on failure. */ -function openssl_public_decrypt(string $data, &$decrypted_data, $public_key, int $padding = OPENSSL_PKCS1_PADDING) { } +function openssl_public_decrypt(string $data, &$decrypted_data, $public_key, int $padding = OPENSSL_PKCS1_PADDING): bool +{ } /** * Gets available digest methods @@ -939,7 +993,8 @@ function openssl_public_decrypt(string $data, &$decrypted_data, $public_key, int *

    * @return array An array of available digest methods. */ -function openssl_get_md_methods(bool $aliases = false) { } +function openssl_get_md_methods(bool $aliases = false): array +{ } /** * Gets available cipher methods @@ -950,7 +1005,8 @@ function openssl_get_md_methods(bool $aliases = false) { } *

    * @return array An array of available cipher methods. */ -function openssl_get_cipher_methods(bool $aliases = false) { } +function openssl_get_cipher_methods(bool $aliases = false): array +{ } /** * (No version information available, might only be in SVN)
    @@ -964,7 +1020,8 @@ function openssl_get_cipher_methods(bool $aliases = false) { } *

    * @return string|false computed key on success or false on failure. */ -function openssl_dh_compute_key(string $public_key, #[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey"], default: "resource")] $private_key) { } +function openssl_dh_compute_key(string $public_key, #[LanguageLevelTypeAware(["8.0" => "OpenSSLAsymmetricKey"], default: "resource")] $private_key): string|false +{ } /** * @param $public_key @@ -972,7 +1029,7 @@ function openssl_dh_compute_key(string $public_key, #[LanguageLevelTypeAware(["8 * @param $key_length * @since 7.3 */ -function openssl_pkey_derive($public_key, $private_key, int $key_length) {} +function openssl_pkey_derive($public_key, $private_key, int $key_length): string|false {} /** * Generates a string of pseudo-random bytes, with the number of bytes determined by the length parameter. @@ -990,7 +1047,9 @@ function openssl_pkey_derive($public_key, $private_key, int $key_length) {} *

    * @return string|false the generated string of bytes on success, or false on failure. */ -function openssl_random_pseudo_bytes(int $length, &$strong_result) { } +#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false")] +function openssl_random_pseudo_bytes(int $length, &$strong_result) +{ } /** * Return openSSL error message @@ -998,7 +1057,8 @@ function openssl_random_pseudo_bytes(int $length, &$strong_result) { } * @return string|false an error message string, or false if there are no more error * messages to return. */ -function openssl_error_string() { } +function openssl_error_string(): string|false +{ } /** * Retrieve the available certificate locations @@ -1006,9 +1066,10 @@ function openssl_error_string() { } * @return array an array with the available certificate locations * @since 5.6 */ -function openssl_get_cert_locations() { } +function openssl_get_cert_locations(): array +{ } -function openssl_get_curve_names() {} +function openssl_get_curve_names(): array|false {} /** * @param string $input_filename @@ -1016,7 +1077,8 @@ function openssl_get_curve_names() {} * @return bool * @since 7.2 */ -function openssl_pkcs7_read(string $input_filename, &$certificates) {} +function openssl_pkcs7_read(string $input_filename, &$certificates): bool +{} /** * Verifies that the data block is intact, the signer is who they say they are, and returns the certs of the signers. diff --git a/pcntl/pcntl.php b/pcntl/pcntl.php index d80d94677..32fe9ed9f 100644 --- a/pcntl/pcntl.php +++ b/pcntl/pcntl.php @@ -12,7 +12,8 @@ * parent's context, no child process will be created, and a PHP * error is raised. */ -function pcntl_fork () {} +function pcntl_fork (): int +{} /** * Waits on or returns the status of a forked child @@ -93,7 +94,8 @@ function pcntl_fork () {} * child which exited, -1 on error or zero if WNOHANG was used and no * child was available */ -function pcntl_waitpid (int $process_id, &$status, int $flags = 0, &$resource_usage) {} +function pcntl_waitpid (int $process_id, &$status, int $flags = 0, &$resource_usage): int +{} /** * Waits on or returns the status of a forked child @@ -139,7 +141,8 @@ function pcntl_waitpid (int $process_id, &$status, int $flags = 0, &$resource_us * child which exited, -1 on error or zero if WNOHANG was provided as an * option (on wait3-available systems) and no child was available. */ -function pcntl_wait (&$status, int $flags = 0, &$resource_usage) {} +function pcntl_wait (&$status, int $flags = 0, &$resource_usage): int +{} /** * Installs a signal handler @@ -169,14 +172,16 @@ function pcntl_wait (&$status, int $flags = 0, &$resource_usage) {} *

    * @return bool TRUE on success or FALSE on failure. */ -function pcntl_signal (int $signal, $handler, bool $restart_syscalls = true) {} +function pcntl_signal (int $signal, $handler, bool $restart_syscalls = true): bool +{} /** * Calls signal handlers for pending signals * @link https://php.net/manual/en/function.pcntl-signal-dispatch.php * @return bool TRUE on success or FALSE on failure. */ -function pcntl_signal_dispatch () {} +function pcntl_signal_dispatch (): bool +{} /** * Checks if status code represents a normal exit @@ -188,7 +193,8 @@ function pcntl_signal_dispatch () {} * otherwise. */ #[Pure] -function pcntl_wifexited (int $status) {} +function pcntl_wifexited (int $status): bool +{} /** * Checks whether the child process is currently stopped @@ -200,7 +206,8 @@ function pcntl_wifexited (int $status) {} * currently stopped, FALSE otherwise. */ #[Pure] -function pcntl_wifstopped (int $status) {} +function pcntl_wifstopped (int $status): bool +{} /** * Checks whether the status code represents a termination due to a signal @@ -212,7 +219,8 @@ function pcntl_wifstopped (int $status) {} * not caught, FALSE otherwise. */ #[Pure] -function pcntl_wifsignaled (int $status) {} +function pcntl_wifsignaled (int $status): bool +{} /** * Returns the return code of a terminated child @@ -220,17 +228,19 @@ function pcntl_wifsignaled (int $status) {} * @param int $status The status * parameter is the status parameter supplied to a successful * call to pcntl_waitpid.

    - * @return int the return code, as an integer. + * @return int|false the return code, as an integer. */ #[Pure] -function pcntl_wexitstatus (int $status) {} +function pcntl_wexitstatus (int $status): int|false +{} /** * @param int $status * @return bool */ #[Pure] -function pcntl_wifcontinued (int $status){} +function pcntl_wifcontinued (int $status): bool +{} /** * Returns the signal which caused the child to terminate @@ -238,10 +248,11 @@ function pcntl_wifcontinued (int $status){} * @param int $status The status * parameter is the status parameter supplied to a successful * call to pcntl_waitpid.

    - * @return int the signal number, as an integer. + * @return int|false the signal number, as an integer. */ #[Pure] -function pcntl_wtermsig (int $status) {} +function pcntl_wtermsig (int $status): int|false +{} /** * Returns the signal which caused the child to stop @@ -249,10 +260,11 @@ function pcntl_wtermsig (int $status) {} * @param int $status The status * parameter is the status parameter supplied to a successful * call to pcntl_waitpid.

    - * @return int the signal number. + * @return int|false the signal number. */ #[Pure] -function pcntl_wstopsig (int $status) {} +function pcntl_wstopsig (int $status): int|false +{} /** * Executes specified program in current process space @@ -273,9 +285,9 @@ function pcntl_wstopsig (int $status) {} * the key being the name of the environmental variable and the value being * the value of that variable. *

    - * @return void FALSE on error and does not return on success. + * @return bool FALSE on error and does not return on success. */ -function pcntl_exec (string $path, array $args, array $env_vars) +function pcntl_exec (string $path, array $args, array $env_vars): bool {} /** @@ -289,7 +301,8 @@ function pcntl_exec (string $path, array $args, array $env_vars) * remaining before it was to be delivered, or 0 if there * was no previously scheduled alarm. */ -function pcntl_alarm (int $seconds) {} +function pcntl_alarm (int $seconds): int +{} /** * Retrieve the error number set by the last pcntl function which failed @@ -298,7 +311,8 @@ function pcntl_alarm (int $seconds) {} * @since 5.3.4 */ #[Pure] -function pcntl_get_last_error () {} +function pcntl_get_last_error (): int +{} /** * Alias of pcntl_get_last_error @@ -307,7 +321,8 @@ function pcntl_get_last_error () {} * @since 5.3.4 */ #[Pure] -function pcntl_errno () {} +function pcntl_errno (): int +{} /** * Retrieve the system error message associated with the given errno @@ -318,7 +333,9 @@ function pcntl_errno () {} * @since 5.3.4 */ #[Pure] -function pcntl_strerror (int $error_code) {} +#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false")] +function pcntl_strerror (int $error_code): bool|string +{} /** * Get the priority of any process @@ -330,12 +347,13 @@ function pcntl_strerror (int $error_code) {} * One of PRIO_PGRP, PRIO_USER * or PRIO_PROCESS. *

    - * @return int pcntl_getpriority returns the priority of the process + * @return int|false pcntl_getpriority returns the priority of the process * or FALSE on error. A lower numerical value causes more favorable * scheduling. */ #[Pure] -function pcntl_getpriority (int $process_id, int $mode = PRIO_PROCESS) {} +function pcntl_getpriority (int $process_id, int $mode = PRIO_PROCESS): int|false +{} /** * Change the priority of any process @@ -357,7 +375,8 @@ function pcntl_getpriority (int $process_id, int $mode = PRIO_PROCESS) {} *

    * @return bool TRUE on success or FALSE on failure. */ -function pcntl_setpriority (int $priority, int $process_id, int $mode = PRIO_PROCESS) {} +function pcntl_setpriority (int $priority, int $process_id, int $mode = PRIO_PROCESS): bool +{} /** * Sets and retrieves blocked signals @@ -381,7 +400,7 @@ function pcntl_setpriority (int $priority, int $process_id, int $mode = PRIO_PRO *

    * @return bool TRUE on success or FALSE on failure. */ -function pcntl_sigprocmask (int $mode, array $signals, &$old_signals) +function pcntl_sigprocmask (int $mode, array $signals, &$old_signals): bool {} /** @@ -420,9 +439,10 @@ function pcntl_sigprocmask (int $mode, array $signals, &$old_signals) * band: Band event * fd: File descriptor number *

    - * @return int On success, pcntl_sigwaitinfo returns a signal number. + * @return int|false On success, pcntl_sigwaitinfo returns a signal number. */ -function pcntl_sigwaitinfo (array $signals, &$info) {} +function pcntl_sigwaitinfo (array $signals, &$info): int|false +{} /** * Waits for signals, with a timeout @@ -441,9 +461,10 @@ function pcntl_sigwaitinfo (array $signals, &$info) {} * @param int $nanoseconds [optional]

    * Timeout in nanoseconds. *

    - * @return int On success, pcntl_sigtimedwait returns a signal number. + * @return int|false On success, pcntl_sigtimedwait returns a signal number. */ -function pcntl_sigtimedwait (array $signals, &$info, int $seconds = 0, int $nanoseconds = 0) {} +function pcntl_sigtimedwait (array $signals, &$info, int $seconds = 0, int $nanoseconds = 0): int|false +{} /** * Enable/disable asynchronous signal handling or return the old setting.
    @@ -458,7 +479,8 @@ function pcntl_sigtimedwait (array $signals, &$info, int $seconds = 0, int $nano * @return bool * @since 7.1 */ -function pcntl_async_signals(bool $enable) {} +function pcntl_async_signals(bool $enable): bool +{} /** * Get the current handler for specified signal. @@ -468,18 +490,19 @@ function pcntl_async_signals(bool $enable) {} * The signal number. *

    * - * @return bool + * @return bool|resource * @since 7.1 */ -function pcntl_signal_get_handler(int $signal) {} +function pcntl_signal_get_handler(int $signal) +{} /** * @param int $flags * @return bool * @since 7.4 */ -function pcntl_unshare(int $flags){} +function pcntl_unshare(int $flags): bool{} define ('WNOHANG', 1); define ('WUNTRACED', 2); diff --git a/pcre/pcre.php b/pcre/pcre.php index 16948fd70..f0eada3fc 100644 --- a/pcre/pcre.php +++ b/pcre/pcre.php @@ -155,7 +155,8 @@ * matches given subject, 0 if it does not, or FALSE * if an error occurred. */ -function preg_match (string $pattern, string $subject, &$matches, int $flags = 0, int $offset = 0) {} +function preg_match (string $pattern, string $subject, &$matches, int $flags = 0, int $offset = 0): int|false +{} /** * Perform a global regular expression match @@ -212,10 +213,11 @@ function preg_match (string $pattern, string $subject, &$matches, int $flags = 0 *

    *

    * @param int $offset [optional] - * @return int|false the number of full pattern matches (which might be zero), + * @return int|false|null the number of full pattern matches (which might be zero), * or FALSE if an error occurred. */ -function preg_match_all (string $pattern, string $subject, &$matches, int $flags = PREG_PATTERN_ORDER, int $offset = 0) {} +function preg_match_all (string $pattern, string $subject, &$matches, int $flags = PREG_PATTERN_ORDER, int $offset = 0): int|false|null +{} /** * Perform a regular expression search and replace @@ -303,7 +305,7 @@ function preg_match_all (string $pattern, string $subject, &$matches, int $flags * be returned, otherwise subject will be * returned unchanged or NULL if an error occurred. */ -function preg_replace (array|string $pattern, array|string $replacement, array|string $subject, int $limit = -1, &$count) +function preg_replace (array|string $pattern, array|string $replacement, array|string $subject, int $limit = -1, &$count): array|string|null {} /** @@ -375,7 +377,7 @@ function preg_replace (array|string $pattern, array|string $replacement, array|s * If matches are found, the new subject will be returned, otherwise * subject will be returned unchanged. */ -function preg_replace_callback (array|string $pattern, callable $callback, array|string $subject, int $limit = -1, &$count, int $flags = 0) +function preg_replace_callback (array|string $pattern, callable $callback, array|string $subject, int $limit = -1, &$count, int $flags = 0): array|string|null {} /** @@ -389,7 +391,8 @@ function preg_replace_callback (array|string $pattern, callable $callback, array * @return string|string[]|null

    preg_replace_callback_array() returns an array if the subject parameter is an array, or a string otherwise. On errors the return value is NULL

    *

    If matches are found, the new subject will be returned, otherwise subject will be returned unchanged.

    */ -function preg_replace_callback_array (array $pattern, array|string $subject , int $limit = -1, &$count, int $flags = 0) {} +function preg_replace_callback_array (array $pattern, array|string $subject , int $limit = -1, &$count, int $flags = 0): array|string|null +{} /** * Perform a regular expression search and replace @@ -407,7 +410,8 @@ function preg_replace_callback_array (array $pattern, array|string $subject , in * is returned when subject is an array * or NULL otherwise. */ -function preg_filter (array|string $pattern, array|string $replacement, array|string $subject, int $limit = -1, &$count) {} +function preg_filter (array|string $pattern, array|string $replacement, array|string $subject, int $limit = -1, &$count): array|string|null +{} /** * Split string by a regular expression @@ -436,7 +440,8 @@ function preg_filter (array|string $pattern, array|string $replacement, array|st * if an error occurred. */ #[Pure] -function preg_split (string $pattern, string $subject, int $limit = -1, int $flags = 0) {} +function preg_split (string $pattern, string $subject, int $limit = -1, int $flags = 0): array|false +{} /** * Quote regular expression characters @@ -453,7 +458,7 @@ function preg_split (string $pattern, string $subject, int $limit = -1, int $fla * @return string the quoted (escaped) string. */ #[Pure] -function preg_quote (string $str, string $delimiter) +function preg_quote (string $str, string $delimiter): string {} /** @@ -474,7 +479,8 @@ function preg_quote (string $str, string $delimiter) * input array or false when pattern cannot be compiled. */ #[Pure] -function preg_grep (string $pattern, array $array, int $flags = 0) {} +function preg_grep (string $pattern, array $array, int $flags = 0): array|false +{} /** * Returns the error code of the last PCRE regex execution @@ -488,7 +494,8 @@ function preg_grep (string $pattern, array $array, int $flags = 0) {} * PREG_BAD_UTF8_OFFSET_ERROR (since PHP 5.3.0) */ #[Pure] -function preg_last_error () {} +function preg_last_error (): int +{} /** * Returns the error message of the last PCRE regex execution diff --git a/posix/posix.php b/posix/posix.php index b36884646..277416ae2 100644 --- a/posix/posix.php +++ b/posix/posix.php @@ -14,7 +14,8 @@ *

    * @return bool TRUE on success or FALSE on failure. */ -function posix_kill (int $process_id, int $signal) {} +function posix_kill (int $process_id, int $signal): bool +{} /** * Return the current process identifier @@ -22,7 +23,8 @@ function posix_kill (int $process_id, int $signal) {} * @return int the identifier, as an integer. */ #[Pure] -function posix_getpid () {} +function posix_getpid (): int +{} /** * Return the parent process identifier @@ -30,7 +32,8 @@ function posix_getpid () {} * @return int the identifier, as an integer. */ #[Pure] -function posix_getppid () {} +function posix_getppid (): int +{} /** * Return the real user ID of the current process @@ -38,7 +41,8 @@ function posix_getppid () {} * @return int the user id, as an integer */ #[Pure] -function posix_getuid () {} +function posix_getuid (): int +{} /** * Set the UID of the current process @@ -48,7 +52,8 @@ function posix_getuid () {} *

    * @return bool TRUE on success or FALSE on failure. */ -function posix_setuid (int $user_id) {} +function posix_setuid (int $user_id): bool +{} /** * Return the effective user ID of the current process @@ -56,7 +61,8 @@ function posix_setuid (int $user_id) {} * @return int the user id, as an integer */ #[Pure] -function posix_geteuid () {} +function posix_geteuid (): int +{} /** * Set the effective UID of the current process @@ -66,7 +72,8 @@ function posix_geteuid () {} *

    * @return bool TRUE on success or FALSE on failure. */ -function posix_seteuid (int $user_id) {} +function posix_seteuid (int $user_id): bool +{} /** * Set system resource limits @@ -81,14 +88,16 @@ function posix_seteuid (int $user_id) {} * @return bool Returns TRUE on success or FALSE on failure. * @since 7.0 */ -function posix_setrlimit (int $resource, int $soft_limit, int $hard_limit) {} +function posix_setrlimit (int $resource, int $soft_limit, int $hard_limit): bool +{} /** * Return the real group ID of the current process * @link https://php.net/manual/en/function.posix-getgid.php * @return int the real group id, as an integer. */ #[Pure] -function posix_getgid () {} +function posix_getgid (): int +{} /** * Set the GID of the current process @@ -98,7 +107,8 @@ function posix_getgid () {} *

    * @return bool TRUE on success or FALSE on failure. */ -function posix_setgid (int $group_id) {} +function posix_setgid (int $group_id): bool +{} /** * Return the effective group ID of the current process @@ -106,7 +116,8 @@ function posix_setgid (int $group_id) {} * @return int an integer of the effective group ID. */ #[Pure] -function posix_getegid () {} +function posix_getegid (): int +{} /** * Set the effective GID of the current process @@ -116,24 +127,27 @@ function posix_getegid () {} *

    * @return bool TRUE on success or FALSE on failure. */ -function posix_setegid (int $group_id) {} +function posix_setegid (int $group_id): bool +{} /** * Return the group set of the current process * @link https://php.net/manual/en/function.posix-getgroups.php - * @return array an array of integers containing the numeric group ids of the group + * @return array|false an array of integers containing the numeric group ids of the group * set of the current process. */ #[Pure] -function posix_getgroups () {} +function posix_getgroups (): array|false +{} /** * Return login name * @link https://php.net/manual/en/function.posix-getlogin.php - * @return string the login name of the user, as a string. + * @return string|false the login name of the user, as a string. */ #[Pure] -function posix_getlogin () {} +function posix_getlogin (): string|false +{} /** * Return the current process group identifier @@ -141,14 +155,16 @@ function posix_getlogin () {} * @return int the identifier, as an integer. */ #[Pure] -function posix_getpgrp () {} +function posix_getpgrp (): int +{} /** * Make the current process a session leader * @link https://php.net/manual/en/function.posix-setsid.php * @return int the session id, or -1 on errors. */ -function posix_setsid () {} +function posix_setsid (): int +{} /** * Set process group id for job control @@ -161,7 +177,8 @@ function posix_setsid () {} *

    * @return bool TRUE on success or FALSE on failure. */ -function posix_setpgid (int $process_id, int $process_group_id) {} +function posix_setpgid (int $process_id, int $process_group_id): bool +{} /** * Get process group id for job control @@ -169,10 +186,11 @@ function posix_setpgid (int $process_id, int $process_group_id) {} * @param int $process_id

    * The process id. *

    - * @return int the identifier, as an integer. + * @return int|false the identifier, as an integer. */ #[Pure] -function posix_getpgid (int $process_id) {} +function posix_getpgid (int $process_id): int|false +{} /** * Get the current sid of the process @@ -183,15 +201,16 @@ function posix_getpgid (int $process_id) {} * specified, then FALSE is returned and an error is set which * can be checked with posix_get_last_error. *

    - * @return int the identifier, as an integer. + * @return int|false the identifier, as an integer. */ #[Pure] -function posix_getsid (int $process_id) {} +function posix_getsid (int $process_id): int|false +{} /** * Get system name * @link https://php.net/manual/en/function.posix-uname.php - * @return array a hash of strings with information about the + * @return array|false a hash of strings with information about the * system. The indices of the hash are * sysname - operating system name (e.g. Linux) * nodename - system name (e.g. valiant) @@ -207,12 +226,13 @@ function posix_getsid (int $process_id) {} * libc. */ #[Pure] -function posix_uname () {} +function posix_uname (): array|false +{} /** * Get process times * @link https://php.net/manual/en/function.posix-times.php - * @return array a hash of strings with information about the current + * @return array|false a hash of strings with information about the current * process CPU usage. The indices of the hash are: * ticks - the number of clock ticks that have elapsed since * reboot. @@ -222,7 +242,8 @@ function posix_uname () {} * cstime - system time used by current process and children. */ #[Pure] -function posix_times () {} +function posix_times (): array|false +{} /** * Get path name of controlling terminal @@ -232,7 +253,8 @@ function posix_times () {} * is set, which can be checked with posix_get_last_error. */ #[Pure] -function posix_ctermid () {} +function posix_ctermid (): string|false +{} /** * Determine terminal device name @@ -244,7 +266,8 @@ function posix_ctermid () {} * fd. On failure, returns FALSE */ #[Pure] -function posix_ttyname ($file_descriptor) {} +function posix_ttyname ($file_descriptor): string|false +{} /** * Determine if a file descriptor is an interactive terminal @@ -259,17 +282,19 @@ function posix_ttyname ($file_descriptor) {} * to a terminal and FALSE otherwise. */ #[Pure] -function posix_isatty ($file_descriptor) {} +function posix_isatty ($file_descriptor): bool +{} /** * Pathname of current directory * @link https://php.net/manual/en/function.posix-getcwd.php - * @return string a string of the absolute pathname on success. + * @return string|false a string of the absolute pathname on success. * On error, returns FALSE and sets errno which can be checked with * posix_get_last_error. */ #[Pure] -function posix_getcwd () {} +function posix_getcwd (): string|false +{} /** * Create a fifo special file (a named pipe) @@ -286,7 +311,8 @@ function posix_getcwd () {} *

    * @return bool TRUE on success or FALSE on failure. */ -function posix_mkfifo (string $filename, int $permissions) {} +function posix_mkfifo (string $filename, int $permissions): bool +{} /** * Create a special or ordinary file (POSIX.1) @@ -310,7 +336,8 @@ function posix_mkfifo (string $filename, int $permissions) {} *

    * @return bool TRUE on success or FALSE on failure. */ -function posix_mknod (string $filename, int $flags, int $major = 0, int $minor = 0) {} +function posix_mknod (string $filename, int $flags, int $major = 0, int $minor = 0): bool +{} /** * Determine accessibility of a file @@ -332,13 +359,14 @@ function posix_mknod (string $filename, int $flags, int $major = 0, int $minor = *

    * @return bool TRUE on success or FALSE on failure. */ -function posix_access (string $filename, int $flags = POSIX_F_OK) {} +function posix_access (string $filename, int $flags = POSIX_F_OK): bool +{} /** * Return info about a group by name * @link https://php.net/manual/en/function.posix-getgrnam.php * @param string $name

    The name of the group

    - * @return array The array elements returned are: + * @return array|false The array elements returned are: * * The group information array * @@ -379,7 +407,8 @@ function posix_access (string $filename, int $flags = POSIX_F_OK) {} *
    */ #[Pure] -function posix_getgrnam (string $name) {} +function posix_getgrnam (string $name): array|false +{} /** * Return info about a group by group id @@ -387,7 +416,7 @@ function posix_getgrnam (string $name) {} * @param int $group_id

    * The group id. *

    - * @return array The array elements returned are: + * @return array|false The array elements returned are: * * The group information array * @@ -428,7 +457,8 @@ function posix_getgrnam (string $name) {} *
    */ #[Pure] -function posix_getgrgid (int $group_id) {} +function posix_getgrgid (int $group_id): array|false +{} /** * Return info about a user by username @@ -436,7 +466,7 @@ function posix_getgrgid (int $group_id) {} * @param string $username

    * An alphanumeric username. *

    - * @return array On success an array with the following elements is returned, else + * @return array|false On success an array with the following elements is returned, else * FALSE is returned: * * The user information array @@ -505,7 +535,8 @@ function posix_getgrgid (int $group_id) {} *
    */ #[Pure] -function posix_getpwnam (string $username) {} +function posix_getpwnam (string $username): array|false +{} /** * Return info about a user by user id @@ -513,7 +544,7 @@ function posix_getpwnam (string $username) {} * @param int $user_id

    * The user identifier. *

    - * @return array an associative array with the following elements: + * @return array|false an associative array with the following elements: * * The user information array * @@ -581,12 +612,13 @@ function posix_getpwnam (string $username) {} *
    */ #[Pure] -function posix_getpwuid (int $user_id) {} +function posix_getpwuid (int $user_id): array|false +{} /** * Return info about system resource limits * @link https://php.net/manual/en/function.posix-getrlimit.php - * @return array an associative array of elements for each + * @return array|false an associative array of elements for each * limit that is defined. Each limit has a soft and a hard limit. * * List of possible limits returned @@ -666,7 +698,8 @@ function posix_getpwuid (int $user_id) {} *
    */ #[Pure] -function posix_getrlimit () {} +function posix_getrlimit (): array|false +{} /** * Retrieve the error number set by the last posix function that failed @@ -675,14 +708,15 @@ function posix_getrlimit () {} * failed. If no errors exist, 0 is returned. */ #[Pure] -function posix_get_last_error () {} +function posix_get_last_error (): int +{} /** * Alias of posix_get_last_error * @link https://php.net/manual/en/function.posix-errno.php */ #[Pure] -function posix_errno () {} +function posix_errno (): int {} /** * Retrieve the system error message associated with the given errno @@ -695,7 +729,8 @@ function posix_errno () {} * @return string the error message, as a string. */ #[Pure] -function posix_strerror (int $error_code) {} +function posix_strerror (int $error_code): string +{} /** * Calculate the group access list @@ -709,7 +744,8 @@ function posix_strerror (int $error_code) {} * @return bool TRUE on success or FALSE on failure. */ #[Pure] -function posix_initgroups (string $username, int $group_id) {} +function posix_initgroups (string $username, int $group_id): bool +{} /** diff --git a/readline/readline.php b/readline/readline.php index 48c8686b3..6b5024e5a 100644 --- a/readline/readline.php +++ b/readline/readline.php @@ -11,7 +11,7 @@ * @return string|false a single string from the user. The line returned has the ending newline removed. * If there is no more data to read, then FALSE is returned. */ -function readline (string $prompt) {} +function readline (string $prompt): string|false {} /** * Gets/sets various internal readline variables @@ -31,7 +31,7 @@ function readline (string $prompt) {} *

    * If called with one or two parameters, the old value is returned. */ -function readline_info (string $var_name, $value) {} +function readline_info (string $var_name, $value): mixed {} /** * Adds a line to the history @@ -41,14 +41,16 @@ function readline_info (string $var_name, $value) {} *

    * @return bool TRUE on success or FALSE on failure. */ -function readline_add_history (string $prompt) {} +function readline_add_history (string $prompt): bool +{} /** * Clears the history * @link https://php.net/manual/en/function.readline-clear-history.php * @return bool TRUE on success or FALSE on failure. */ -function readline_clear_history () {} +function readline_clear_history (): bool +{} /** * Lists the history @@ -56,7 +58,8 @@ function readline_clear_history () {} * @return array an array of the entire command line history. The elements are * indexed by integers starting at zero. */ -function readline_list_history () {} +function readline_list_history (): array +{} /** * Reads the history @@ -66,7 +69,8 @@ function readline_list_history () {} *

    * @return bool TRUE on success or FALSE on failure. */ -function readline_read_history (string $filename) {} +function readline_read_history (string $filename): bool +{} /** * Writes the history @@ -76,7 +80,8 @@ function readline_read_history (string $filename) {} *

    * @return bool TRUE on success or FALSE on failure. */ -function readline_write_history (string $filename) {} +function readline_write_history (string $filename): bool +{} /** * Registers a completion function @@ -87,7 +92,8 @@ function readline_write_history (string $filename) {} *

    * @return bool TRUE on success or FALSE on failure. */ -function readline_completion_function (callable $callback) {} +function readline_completion_function (callable $callback): bool +{} /** * Initializes the readline callback interface and terminal, prints the prompt and returns immediately @@ -101,14 +107,15 @@ function readline_completion_function (callable $callback) {} *

    * @return bool TRUE on success or FALSE on failure. */ -function readline_callback_handler_install (string $prompt, callable $callback) {} +function readline_callback_handler_install (string $prompt, callable $callback): bool +{} /** * Reads a character and informs the readline callback interface when a line is received * @link https://php.net/manual/en/function.readline-callback-read-char.php * @return void No value is returned. */ -function readline_callback_read_char () {} +function readline_callback_read_char (): void {} /** * Removes a previously installed callback handler and restores terminal settings @@ -116,21 +123,22 @@ function readline_callback_read_char () {} * @return bool TRUE if a previously installed callback handler was removed, or * FALSE if one could not be found. */ -function readline_callback_handler_remove () {} +function readline_callback_handler_remove (): bool +{} /** * Redraws the display * @link https://php.net/manual/en/function.readline-redisplay.php * @return void No value is returned. */ -function readline_redisplay () {} +function readline_redisplay (): void {} /** * Inform readline that the cursor has moved to a new line * @link https://php.net/manual/en/function.readline-on-new-line.php * @return void No value is returned. */ -function readline_on_new_line () {} +function readline_on_new_line (): void {} define ('READLINE_LIB', "libedit"); diff --git a/session/session.php b/session/session.php index 4ff1b14f1..fa1f74267 100644 --- a/session/session.php +++ b/session/session.php @@ -21,9 +21,10 @@ * must be present. Otherwise a new session id is generated every time. *

    *

    - * @return string the name of the current session. + * @return string|false the name of the current session. */ -function session_name (string $name) {} +function session_name (string $name): string|false +{} /** * Get and/or set the current session module.
    @@ -33,9 +34,10 @@ function session_name (string $name) {} * If module is specified, that module will be * used instead. *

    - * @return string the name of the current session module. + * @return string|false the name of the current session module. */ -function session_module_name (string $module) {} +function session_module_name (string $module): string|false +{} /** * Get and/or set the current session save path @@ -52,9 +54,10 @@ function session_module_name (string $module) {} * on Linux, reiserfs may provide better performance than ext2fs. *

    *

    - * @return string the path of the current directory used for data storage. + * @return string|false the path of the current directory used for data storage. */ -function session_save_path (string $path) {} +function session_save_path (string $path): string|false +{} /** * Get and/or set the current session id @@ -71,11 +74,12 @@ function session_save_path (string $path) {} * for session_id will always send a new cookie * when session_start is called, regardless if the * current session id is identical to the one being set. - * @return string session_id returns the session id for the current + * @return string|false session_id returns the session id for the current * session or the empty string ("") if there is no current * session (no current session id exists). */ -function session_id (string $id) {} +function session_id (string $id): string|false +{} /** * Update the current session id with a newly generated one @@ -85,7 +89,8 @@ function session_id (string $id) {} *

    * @return bool true on success or false on failure. */ -function session_regenerate_id (bool $delete_old_session = false) {} +function session_regenerate_id (bool $delete_old_session = false): bool +{} /** * PHP > 5.4.0
    @@ -93,7 +98,7 @@ function session_regenerate_id (bool $delete_old_session = false) {} * @link https://secure.php.net/manual/en/function.session-register-shutdown.php * @return void */ -function session_register_shutdown () {} +function session_register_shutdown (): void {} /** * Decodes session data from a string @@ -103,7 +108,8 @@ function session_register_shutdown () {} *

    * @return bool true on success or false on failure. */ -function session_decode (string $data) {} +function session_decode (string $data): bool +{} /** * Register one or more global variables with the current session @@ -117,7 +123,8 @@ function session_decode (string $data) {} * @removed 5.4 */ #[Deprecated(since: '5.3')] -function session_register (mixed $name, ...$_) {} +function session_register (mixed $name, ...$_): bool +{} /** * Unregister a global variable from the current session @@ -129,7 +136,8 @@ function session_register (mixed $name, ...$_) {} * @removed 5.4 */ #[Deprecated(since: '5.3')] -function session_unregister (string $name) {} +function session_unregister (string $name): bool +{} /** * Find out whether a global variable is registered in a session @@ -143,14 +151,16 @@ function session_unregister (string $name) {} * @removed 5.4 */ #[Deprecated(since: '5.3')] -function session_is_registered (string $name) {} +function session_is_registered (string $name): bool +{} /** * Encodes the current session data as a string * @link https://php.net/manual/en/function.session-encode.php - * @return string the contents of the current session encoded. + * @return string|false the contents of the current session encoded. */ -function session_encode () {} +function session_encode (): string|false +{} /** * Initialize session data @@ -160,7 +170,8 @@ function session_encode () {} * @return bool This function returns true if a session was successfully started, * otherwise false. */ -function session_start (array $options = []) {} +function session_start (array $options = []): bool +{} /** * Create new session id @@ -168,32 +179,36 @@ function session_start (array $options = []) {} * @param string $prefix [optional] If prefix is specified, new session id is prefixed by prefix. * Not all characters are allowed within the session id. * Characters in the range a-z A-Z 0-9 , (comma) and - (minus) are allowed. - * @return string new collision free session id for the current session. + * @return string|false new collision free session id for the current session. * If it is used without active session, it omits collision check. * @since 7.1 */ -function session_create_id(string $prefix) {} +function session_create_id(string $prefix): string|false +{} /** * Perform session data garbage collection * @return int|false number of deleted session data for success, false for failure. * @since 7.1 */ -function session_gc() {} +function session_gc(): int|false +{} /** * Destroys all data registered to a session * @link https://php.net/manual/en/function.session-destroy.php * @return bool true on success or false on failure. */ -function session_destroy () {} +function session_destroy (): bool +{} /** * Free all session variables * @link https://php.net/manual/en/function.session-unset.php * @return void|bool since 7.2.0 returns true on success or false on failure. */ -function session_unset () {} +function session_unset (): bool +{} /** * Sets user-level session storage functions @@ -243,7 +258,7 @@ function session_unset () {} * @param callback $update_timestamp [optional] * @return bool true on success or false on failure. */ -function session_set_save_handler (callable $open, callable $close, callable $read, callable $write, callable $destroy, callable $gc, $create_sid, $validate_sid, $update_timestamp) +function session_set_save_handler (callable $open, callable $close, callable $read, callable $write, callable $destroy, callable $gc, $create_sid, $validate_sid, $update_timestamp): bool {} /** @@ -256,7 +271,8 @@ function session_set_save_handler (callable $open, callable $close, callable $re * @param bool $register_shutdown [optional] Register session_write_close() as a register_shutdown_function() function. * @return bool true on success or false on failure. */ -function session_set_save_handler (SessionHandlerInterface $session_handler, $register_shutdown = true) {} +function session_set_save_handler (SessionHandlerInterface $session_handler, $register_shutdown = true): bool +{} /** * Get and/or set the current cache limiter @@ -311,9 +327,10 @@ function session_set_save_handler (SessionHandlerInterface $session_handler, $re * * * - * @return string the name of the current cache limiter. + * @return string|false the name of the current cache limiter. */ -function session_cache_limiter (string $value) {} +function session_cache_limiter (string $value): string|false +{} /** * Return current cache expire @@ -327,10 +344,11 @@ function session_cache_limiter (string $value) {} * session.cache_limiter is set to a value * different from nocache. *

    - * @return int the current setting of session.cache_expire. + * @return int|false the current setting of session.cache_expire. * The value returned should be read in minutes, defaults to 180. */ -function session_cache_expire (int $value) {} +function session_cache_expire (int $value): int|false +{} /** * Set the session cookie parameters @@ -347,7 +365,8 @@ function session_cache_expire (int $value) {} * @return bool returns true on success or false on failure. * @since 7.3 */ -function session_set_cookie_params (array $options) {} +function session_set_cookie_params (array $options): bool +{} /** @@ -378,7 +397,7 @@ function session_set_cookie_params (array $options) {} *

    * @return void|bool since 7.2.0 returns true on success or false on failure. */ -function session_set_cookie_params (array|int $lifetime_or_options, string $path, string $domain, bool $secure = false, bool $httponly = false) +function session_set_cookie_params (array|int $lifetime_or_options, string $path, string $domain, bool $secure = false, bool $httponly = false): bool {} /** @@ -397,21 +416,24 @@ function session_set_cookie_params (array|int $lifetime_or_options, string $path * "httponly" - The * cookie can only be accessed through the HTTP protocol. */ -function session_get_cookie_params () {} +function session_get_cookie_params (): array +{} /** * Write session data and end session * @link https://php.net/manual/en/function.session-write-close.php * @return void|bool since 7.2.0 returns true on success or false on failure. */ -function session_write_close () {} +function session_write_close (): bool +{} /** * Alias of session_write_close * @link https://php.net/manual/en/function.session-commit.php * @return void|bool since 7.2.0 returns true on success or false on failure. */ -function session_commit () {} +function session_commit (): bool +{} /** * (PHP 5 >= 5.4.0)
    @@ -422,7 +444,8 @@ function session_commit () {} * PHP_SESSION_ACTIVE if sessions are enabled, and one exists. * @since 5.4 */ -function session_status () {} +function session_status (): int +{} /** * (PHP 5 >= 5.6.0)
    @@ -431,7 +454,8 @@ function session_status () {} * @return void|bool since 7.2.0 returns true if a session was successfully reinitialized or false on failure. * @since 5.6 */ -function session_abort() {} +function session_abort(): bool +{} /** * (PHP 5 >= 5.6.0)
    @@ -440,7 +464,8 @@ function session_abort() {} * @return void|bool since 7.2.0 returns true if a session was successfully reinitialized or false on failure. * @since 5.6 */ -function session_reset() {} +function session_reset(): bool +{} // End of session v. ?> diff --git a/shmop/shmop.php b/shmop/shmop.php index 8f5d609d6..7aba05350 100644 --- a/shmop/shmop.php +++ b/shmop/shmop.php @@ -27,6 +27,7 @@ * use to access the shared memory segment you've created. FALSE is * returned on failure. */ +#[LanguageLevelTypeAware(["8.0" => "Shmop|false"], default: "Shmop|false")] function shmop_open (int $key, string $mode, int $permissions, int $size) {} /** @@ -44,7 +45,7 @@ function shmop_open (int $key, string $mode, int $permissions, int $size) {} *

    * @return string|false the data or FALSE on failure. */ -function shmop_read (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "resource")] $shmop, int $offset, int $size) {} +function shmop_read (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "resource")] $shmop, int $offset, int $size): string {} /** * Close shared memory block @@ -56,7 +57,7 @@ function shmop_read (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "reso * @return void No value is returned. */ #[Deprecated(since: '8.0')] -function shmop_close (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "resource")] $shmop) {} +function shmop_close (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "resource")] $shmop): void {} /** * Get size of shared memory block @@ -68,7 +69,7 @@ function shmop_close (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "res * @return int an int, which represents the number of bytes the shared memory * block occupies. */ -function shmop_size (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "resource")] $shmop) {} +function shmop_size (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "resource")] $shmop): int {} /** * Write data into shared memory block @@ -87,7 +88,7 @@ function shmop_size (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "reso * @return int|false The size of the written data, or FALSE on * failure. */ -function shmop_write (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "resource")] $shmop, string $data, int $offset) {} +function shmop_write (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "resource")] $shmop, string $data, int $offset): int {} /** * Delete shared memory block @@ -98,7 +99,7 @@ function shmop_write (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "res *

    * @return bool TRUE on success or FALSE on failure. */ -function shmop_delete (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "resource")] $shmop) {} +function shmop_delete (#[LanguageLevelTypeAware(["8.0" => "Shmop"], default: "resource")] $shmop): bool {} /** * @since 8.0 diff --git a/soap/soap.php b/soap/soap.php index b8a46cb64..80aaa66d1 100644 --- a/soap/soap.php +++ b/soap/soap.php @@ -906,7 +906,7 @@ public function SoapHeader ($namespace, $name, $data = null, $mustunderstand = f *

    * @return bool the original value. */ -function use_soap_error_handler (bool $enable = true) {} +function use_soap_error_handler (bool $enable = true): bool {} /** * Checks if a SOAP call has failed @@ -916,7 +916,7 @@ function use_soap_error_handler (bool $enable = true) {} *

    * @return bool This will return TRUE on error, and FALSE otherwise. */ -function is_soap_fault (mixed $object) {} +function is_soap_fault (mixed $object): bool {} define ('SOAP_1_1', 1); define ('SOAP_1_2', 2); diff --git a/sodium/sodium.php b/sodium/sodium.php index 982135f74..5ee2902e8 100644 --- a/sodium/sodium.php +++ b/sodium/sodium.php @@ -112,14 +112,7 @@ function sodium_crypto_aead_aes256gcm_is_available(): bool * @throws SodiumException * @since 7.2 */ -function sodium_crypto_aead_aes256gcm_decrypt( - string $ciphertext, - string $additional_data, - string $nonce, - string $key -): string { - unset($ciphertext, $additional_data, $nonce, $key); - return ''; +function sodium_crypto_aead_aes256gcm_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false { } /** @@ -148,7 +141,7 @@ function sodium_crypto_aead_aes256gcm_encrypt(string $message, string $additiona * @throws SodiumException * @since 7.2 */ -function sodium_crypto_aead_chacha20poly1305_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string {} +function sodium_crypto_aead_chacha20poly1305_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} /** * Authenticated Encryption with Associated Data (encrypt) @@ -176,12 +169,7 @@ function sodium_crypto_aead_chacha20poly1305_encrypt(string $message, string $ad * @throws SodiumException * @since 7.2 */ -function sodium_crypto_aead_chacha20poly1305_ietf_decrypt( - string $ciphertext, - string $additional_data, - string $nonce, - string $key -): string { +function sodium_crypto_aead_chacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false { unset($ciphertext, $additional_data, $nonce, $key); return ''; } @@ -431,7 +419,7 @@ function sodium_crypto_box_keypair_from_secretkey_and_publickey(string $secret_k * @throws SodiumException * @since 7.2 */ -function sodium_crypto_box_open(string $ciphertext, string $nonce, string $key_pair): string {} +function sodium_crypto_box_open(string $ciphertext, string $nonce, string $key_pair): string|false {} /** * Get an X25519 public key from an X25519 keypair @@ -480,7 +468,7 @@ function sodium_crypto_box_seal(string $message, string $key_pair): string {} * @throws SodiumException * @since 7.2 */ -function sodium_crypto_box_seal_open(string $ciphertext, string $key_pair): string {} +function sodium_crypto_box_seal_open(string $ciphertext, string $key_pair): string|false {} /** * Extract the X25519 secret key from an X25519 keypair @@ -692,13 +680,7 @@ function sodium_crypto_secretbox(string $message, string $nonce, string $key): s * @throws SodiumException * @since 7.2 */ -function sodium_crypto_secretbox_open( - string $ciphertext, - string $nonce, - string $key -): string { - unset($ciphertext, $nonce, $key); - return ''; +function sodium_crypto_secretbox_open(string $ciphertext, string $nonce, string $key): string|false { } /** @@ -796,7 +778,7 @@ function sodium_crypto_sign_keypair_from_secretkey_and_publickey( * @throws SodiumException * @since 7.2 */ -function sodium_crypto_sign_open(string $ciphertext, string $public_key): string {} +function sodium_crypto_sign_open(string $ciphertext, string $public_key): string|false {} /** * Get the public key from an Ed25519 keypair @@ -976,7 +958,7 @@ function sodium_hex2bin(string $string, string $ignore): string {} * @throws SodiumException * @since 7.2 */ -function sodium_increment(string &$string) {} +function sodium_increment(string &$string): void {} /** * Add the right operand to the left @@ -986,7 +968,7 @@ function sodium_increment(string &$string) {} * @throws SodiumException * @since 7.2 */ -function sodium_add(string &$string1, string $string2) {} +function sodium_add(string &$string1, string $string2): void {} /** * Get the true major version of libsodium @@ -1024,9 +1006,7 @@ function sodium_memcmp(string $string1, string $string2): int {} * @throws SodiumException * @since 7.2 */ -function sodium_memzero( - &$reference -) { +function sodium_memzero(&$reference): void { $target = ''; } @@ -1104,7 +1084,7 @@ function sodium_crypto_aead_chacha20poly1305_ietf_keygen(): string {} * @since 7.2 * @see https://www.php.net/manual/en/function.sodium-crypto-aead-xchacha20poly1305-ietf-decrypt.php */ -function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string {} +function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {} /** * @throws SodiumException @@ -1161,7 +1141,7 @@ function sodium_crypto_secretstream_xchacha20poly1305_init_pull(string $header, * @since 7.2 * @see https://www.php.net/manual/en/function.sodium-crypto-secretstream-xchacha20poly1305-pull.php */ -function sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, string $ciphertext, string $additional_data = ''): array {} +function sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, string $ciphertext, string $additional_data = ''): array|false {} /** * @throws SodiumException @@ -1183,7 +1163,7 @@ function sodium_bin2base64(string $string, int $id): string {} * @see https://www.php.net/manual/en/function.sodium-base642bin.php * @return string */ -function sodium_base642bin(string $string, int $id, string $ignore = ''){} +function sodium_base642bin(string $string, int $id, string $ignore = ''): string {} class SodiumException extends Exception { diff --git a/standard/CSPRNG.php b/standard/CSPRNG.php index bf8c189eb..d9d30d172 100644 --- a/standard/CSPRNG.php +++ b/standard/CSPRNG.php @@ -7,7 +7,8 @@ * @since 7.0 * @throws Exception if it was not possible to gather sufficient entropy. */ -function random_bytes (int $length) {} +function random_bytes (int $length): string +{} /** * Generates cryptographically secure pseudo-random integers @@ -18,4 +19,5 @@ function random_bytes (int $length) {} * @since 7.0 * @throws Exception if it was not possible to gather sufficient entropy. */ -function random_int (int $min, int $max) {} +function random_int (int $min, int $max): int +{} diff --git a/standard/_standard_manual.php b/standard/_standard_manual.php index 22a08678a..4b244887f 100644 --- a/standard/_standard_manual.php +++ b/standard/_standard_manual.php @@ -32,11 +32,13 @@ function PS_UNRESERVE_PREFIX___halt_compiler(){} * @see unpack() * @since 5.4 */ -function hex2bin(string $string) {}; +function hex2bin(string $string): string|false +{}; /** * Get or Set the HTTP response code * @param int $response_code [optional] The optional response_code will set the response code. - * @return int The current response code. By default the return value is int(200). + * @return int|bool The current response code. By default the return value is int(200). */ -function http_response_code(int $response_code) {} +function http_response_code(int $response_code): int|bool +{} diff --git a/standard/_types.php b/standard/_types.php index 06724347c..e24c789de 100644 --- a/standard/_types.php +++ b/standard/_types.php @@ -16,7 +16,8 @@ *

    * @return array an array of the parameters. The parameters can be given an index with the => operator. */ - function PS_UNRESERVE_PREFIX_array(...$_){}; + function PS_UNRESERVE_PREFIX_array(...$_): array + {}; /** * Assigns a list of variables in one operation. @@ -25,7 +26,8 @@ function PS_UNRESERVE_PREFIX_array(...$_){}; * @param mixed ...$_ [optional]

    Another variable ...

    * @return array the assigned array. */ - function PS_UNRESERVE_PREFIX_list(mixed $var1, ...$_){}; + function PS_UNRESERVE_PREFIX_list(mixed $var1, ...$_): array + {}; /** *

    Terminates execution of the script. Shutdown functions and object destructors will always be executed even if exit is called.

    @@ -90,7 +92,8 @@ function PS_UNRESERVE_PREFIX_exit($status = ""){}; * *

    */ - function PS_UNRESERVE_PREFIX_empty(mixed $var){}; + function PS_UNRESERVE_PREFIX_empty(mixed $var): bool + {}; /** *

    Determine if a variable is set and is not NULL.

    @@ -103,7 +106,8 @@ function PS_UNRESERVE_PREFIX_empty(mixed $var){}; * @param mixed ...$_ [optional]

    Another variable ...

    * @return bool Returns TRUE if var exists and has value other than NULL, FALSE otherwise. */ - function PS_UNRESERVE_PREFIX_isset(mixed $var, ...$_){}; + function PS_UNRESERVE_PREFIX_isset(mixed $var, ...$_): bool + {}; /** *

    Destroys the specified variables.

    @@ -145,7 +149,8 @@ function PS_UNRESERVE_PREFIX_unset(mixed $var, ...$_){}; * case eval() returned FALSE and execution of the following code continued normally. It is not possible to catch a parse * error in eval() using set_error_handler(). */ - function PS_UNRESERVE_PREFIX_eval(string $code){}; + function PS_UNRESERVE_PREFIX_eval(string $code): mixed + {}; /** * Generator objects are returned from generators, cannot be instantiated via new. @@ -259,7 +264,8 @@ public function __destruct() {} * @return mixed * @link https://php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.methods */ - public function __call(string $name, array $arguments) {} + public function __call(string $name, array $arguments): mixed + {} /** * is triggered when invoking inaccessible methods in a static context. @@ -269,7 +275,8 @@ public function __call(string $name, array $arguments) {} * @return mixed * @link https://php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.methods */ - public static function __callStatic(string $name, array $arguments) {} + public static function __callStatic(string $name, array $arguments): mixed + {} /** * is utilized for reading data from inaccessible members. @@ -278,7 +285,8 @@ public static function __callStatic(string $name, array $arguments) {} * @return mixed * @link https://php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.members */ - public function __get(string $name) {} + public function __get(string $name): mixed + {} /** * run when writing data to inaccessible members. @@ -345,7 +353,8 @@ public function __toString(): string {} * @return mixed * @link https://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.invoke */ - public function __invoke() {} + public function __invoke(): mixed + {} /** * This method is called by var_dump() when dumping an object to get the properties that should be shown. diff --git a/standard/basic.php b/standard/basic.php index 552fca601..0750aa8c0 100644 --- a/standard/basic.php +++ b/standard/basic.php @@ -38,7 +38,8 @@ * @link https://php.net/manual/en/function.dl.php */ #[Deprecated(since: '5.3')] -function dl (string $extension_filename) {} +function dl (string $extension_filename): bool +{} /** * Sets the process title @@ -49,7 +50,8 @@ function dl (string $extension_filename) {} * @return bool TRUE on success or FALSE on failure. * @since 5.5 */ -function cli_set_process_title (string $title) {} +function cli_set_process_title (string $title): bool +{} /** * Returns the current process title @@ -58,7 +60,8 @@ function cli_set_process_title (string $title) {} * @since 5.5 */ #[Pure] -function cli_get_process_title () {} +function cli_get_process_title (): string +{} /** * Verify that the contents of a variable is accepted by the iterable pseudo-type, i.e. that it is an array or an object implementing Traversable @@ -68,7 +71,8 @@ function cli_get_process_title () {} * @link https://php.net/manual/en/function.is-iterable.php */ #[Pure] -function is_iterable(mixed $value) {} +function is_iterable(mixed $value): bool +{} /** * Encodes an ISO-8859-1 string to UTF-8 @@ -79,7 +83,8 @@ function is_iterable(mixed $value) {} * @return string the UTF-8 translation of data. */ #[Pure] -function utf8_encode (string $string) {} +function utf8_encode (string $string): string +{} /** * Converts a string with ISO-8859-1 characters encoded with UTF-8 @@ -91,7 +96,8 @@ function utf8_encode (string $string) {} * @return string the ISO-8859-1 translation of data. */ #[Pure] -function utf8_decode (string $string) {} +function utf8_decode (string $string): string +{} /** * Clear the most recent error @@ -99,7 +105,7 @@ function utf8_decode (string $string) {} * @return void * @since 7.0 */ -function error_clear_last () {} +function error_clear_last (): void {} /** * Get process codepage @@ -107,7 +113,8 @@ function error_clear_last () {} * @return int * @since 7.1 */ -function sapi_windows_cp_get(string $kind) {} +function sapi_windows_cp_get(string $kind): int +{} /** * Set process codepage @@ -115,7 +122,8 @@ function sapi_windows_cp_get(string $kind) {} * @return bool * @since 7.1 */ -function sapi_windows_cp_set(int $cp) {} +function sapi_windows_cp_set(int $cp): bool +{} /** * Convert string from one codepage to another @@ -125,14 +133,16 @@ function sapi_windows_cp_set(int $cp) {} * @return string * @since 7.1 */ -function sapi_windows_cp_conv(int|string $in_codepage, int|string $out_codepage, string $subject) {} +function sapi_windows_cp_conv(int|string $in_codepage, int|string $out_codepage, string $subject): string +{} /** * Indicates whether the codepage is utf-8 compatible * @return bool * @since 7.1 */ -function sapi_windows_cp_is_utf8() {} +function sapi_windows_cp_is_utf8(): bool +{} /** * Get or set VT100 support for the specified stream associated to an output buffer of a Windows console. @@ -155,7 +165,8 @@ function sapi_windows_cp_is_utf8() {} * If enable is specified: Returns TRUE on success or FALSE on failure. * @since 7.2 */ -function sapi_windows_vt100_support ($stream, bool $enable) {} +function sapi_windows_vt100_support ($stream, bool $enable): bool +{} /** * Set or remove a CTRL event handler. @@ -166,7 +177,8 @@ function sapi_windows_vt100_support ($stream, bool $enable) {} * @return bool TRUE on success or FALSE on failure. * @since 7.4 */ -function sapi_windows_set_ctrl_handler (callable $callable, bool $add = true) {} +function sapi_windows_set_ctrl_handler (callable $callable, bool $add = true): bool +{} /** * Send a CTRL event to another process. @@ -177,7 +189,8 @@ function sapi_windows_set_ctrl_handler (callable $callable, bool $add = true) {} * @return bool TRUE on success or FALSE on failure. * @since 7.4 */ -function sapi_windows_generate_ctrl_event (int $event, int $pid = 0) {} +function sapi_windows_generate_ctrl_event (int $event, int $pid = 0): bool +{} /** * The full path and filename of the file. If used inside an include, diff --git a/standard/password.php b/standard/password.php index f94a7a3d9..28d3661d7 100644 --- a/standard/password.php +++ b/standard/password.php @@ -161,7 +161,8 @@ * @since 5.5 */ #[ArrayShape(["algo" => "int", "algoName" => "string", "options" => "array"])] -function password_get_info (string $hash) {} +function password_get_info (string $hash): array +{} /** * (PHP 5 >= 5.5.0, PHP 5)
    @@ -180,7 +181,9 @@ function password_get_info (string $hash) {} * @return string|false|null Returns the hashed password, or FALSE on failure, or null if the algorithm is invalid * @since 5.5 */ -function password_hash (string $password, string|int|null $algo, array $options = []) {} +#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false|null")] +function password_hash (string $password, string|int|null $algo, array $options = []) +{} /** * Checks if the given hash matches the given options. @@ -191,7 +194,8 @@ function password_hash (string $password, string|int|null $algo, array $options * @return bool Returns TRUE if the hash should be rehashed to match the given algo and options, or FALSE otherwise. * @since 5.5 */ -function password_needs_rehash (string $hash, string|int|null $algo, array $options = []) {} +function password_needs_rehash (string $hash, string|int|null $algo, array $options = []): bool +{} /** * Checks if the given hash matches the given options. @@ -201,12 +205,14 @@ function password_needs_rehash (string $hash, string|int|null $algo, array $opti * @return bool Returns TRUE if the password and hash match, or FALSE otherwise. * @since 5.5 */ -function password_verify (string $password, string $hash) {} +function password_verify (string $password, string $hash): bool +{} /** * Return a complete list of all registered password hashing algorithms. * @return string[] * @since 7.4 */ -function password_algos(){} +function password_algos(): array +{} // End of password v. diff --git a/standard/standard_0.php b/standard/standard_0.php index 98b4c2d9b..139749213 100644 --- a/standard/standard_0.php +++ b/standard/standard_0.php @@ -132,7 +132,8 @@ public function read ($dir_handle = null) { } * defined. */ #[Pure] -function constant (string $name) {} +function constant (string $name): mixed +{} /** * Convert binary data into hexadecimal representation @@ -143,7 +144,8 @@ function constant (string $name) {} * @return string the hexadecimal representation of the given string. */ #[Pure] -function bin2hex (string $string) {} +function bin2hex (string $string): string +{} /** * Delay execution @@ -155,7 +157,9 @@ function bin2hex (string $string) {} * by a signal, sleep returns the number of seconds left * to sleep. */ -function sleep (int $seconds) {} +#[LanguageLevelTypeAware(["8.0" => "int"], default: "int|false")] +function sleep (int $seconds) +{} /** * Delay execution in microseconds @@ -166,7 +170,7 @@ function sleep (int $seconds) {} *

    * @return void */ -function usleep (int $microseconds) {} +function usleep (int $microseconds): void {} /** * Delay for a number of seconds and nanoseconds @@ -187,7 +191,8 @@ function usleep (int $microseconds) {} * nanoseconds - number of nanoseconds * remaining in the delay */ -function time_nanosleep (int $seconds, int $nanoseconds) {} +function time_nanosleep (int $seconds, int $nanoseconds): array|bool +{} /** * Make the script sleep until the specified time @@ -197,7 +202,8 @@ function time_nanosleep (int $seconds, int $nanoseconds) {} *

    * @return bool true on success or false on failure. */ -function time_sleep_until (float $timestamp) {} +function time_sleep_until (float $timestamp): bool +{} /** * Parse a time/date generated with strftime @@ -262,14 +268,15 @@ function time_sleep_until (float $timestamp) {} * */ #[Pure] -function strptime (string $timestamp, string $format) {} +function strptime (string $timestamp, string $format): array|false +{} /** * Flush the output buffer * @link https://php.net/manual/en/function.flush.php * @return void */ -function flush () {} +function flush (): void {} /** * Wraps a string to a given number of characters @@ -293,7 +300,8 @@ function flush () {} * @return string the given string wrapped at the specified column. */ #[Pure] -function wordwrap (string $string, int $width = 75, string $break = "\n", bool $cut_long_words = false) {} +function wordwrap (string $string, int $width = 75, string $break = "\n", bool $cut_long_words = false): string +{} /** * Convert special characters to HTML entities @@ -412,7 +420,7 @@ function wordwrap (string $string, int $width = 75, string $break = "\n", bool $ * @return string The converted string. */ #[Pure] -function htmlspecialchars (string $string, int $flags = ENT_COMPAT | ENT_HTML401, string $encoding = 'UTF-8', bool $double_encode = true) +function htmlspecialchars (string $string, int $flags = ENT_COMPAT | ENT_HTML401, string $encoding = 'UTF-8', bool $double_encode = true): string {} /** @@ -460,7 +468,7 @@ function htmlspecialchars (string $string, int $flags = ENT_COMPAT | ENT_HTML401 * @return string the encoded string. */ #[Pure] -function htmlentities (string $string, int $flags, string $encoding, bool $double_encode = true) +function htmlentities (string $string, int $flags, string $encoding, bool $double_encode = true): string {} /** @@ -503,7 +511,7 @@ function htmlentities (string $string, int $flags, string $encoding, bool $doubl * @return string the decoded string. */ #[Pure] -function html_entity_decode (string $string, int $flags, string $encoding) +function html_entity_decode (string $string, int $flags, string $encoding): string {} /** @@ -538,7 +546,7 @@ function html_entity_decode (string $string, int $flags, string $encoding) * @return string the decoded string. */ #[Pure] -function htmlspecialchars_decode (string $string, int $flags) +function htmlspecialchars_decode (string $string, int $flags): string {} /** @@ -717,7 +725,8 @@ function htmlspecialchars_decode (string $string, int $flags) * @return array the translation table as an array. */ #[Pure] -function get_html_translation_table (int $table, int $flags, string $encoding = "UTF-8") {} +function get_html_translation_table (int $table, int $flags, string $encoding = "UTF-8"): array +{} /** * Calculate the sha1 hash of a string @@ -734,7 +743,8 @@ function get_html_translation_table (int $table, int $flags, string $encoding = * @return string the sha1 hash as a string. */ #[Pure] -function sha1 (string $string, bool $binary = false) {} +function sha1 (string $string, bool $binary = false): string +{} /** * Calculate the sha1 hash of a file @@ -749,7 +759,8 @@ function sha1 (string $string, bool $binary = false) {} * @return string|false a string on success, false otherwise. */ #[Pure] -function sha1_file (string $filename, bool $binary = false) {} +function sha1_file (string $filename, bool $binary = false): string|false +{} /** * Calculate the md5 hash of a string @@ -765,7 +776,8 @@ function sha1_file (string $filename, bool $binary = false) {} * @return string the hash as a 32-character hexadecimal number. */ #[Pure] -function md5 (string $string, bool $binary = false) {} +function md5 (string $string, bool $binary = false): string +{} /** * Calculates the md5 hash of a given file @@ -780,7 +792,8 @@ function md5 (string $string, bool $binary = false) {} * @return string|false a string on success, false otherwise. */ #[Pure] -function md5_file (string $filename, bool $binary = false) {} +function md5_file (string $filename, bool $binary = false): string|false +{} /** * Calculates the crc32 polynomial of a string @@ -791,7 +804,8 @@ function md5_file (string $filename, bool $binary = false) {} * @return int the crc32 checksum of str as an integer..1 */ #[Pure] -function crc32 (string $string) {} +function crc32 (string $string): int +{} /** * Parse a binary IPTC block into single tags. @@ -804,7 +818,8 @@ function crc32 (string $string) {} * value. It returns false on error or if no IPTC data was found. */ #[Pure] -function iptcparse (string $iptc_block) {} +function iptcparse (string $iptc_block): array|false +{} /** * Embeds binary IPTC data into a JPEG image. @@ -823,7 +838,7 @@ function iptcparse (string $iptc_block) {} * @return string|bool If success and spool flag is lower than 2 then the JPEG will not be * returned as a string, false on errors. */ -function iptcembed (string $iptc_data, string $filename, int $spool) +function iptcembed (string $iptc_data, string $filename, int $spool): string|bool {} /** @@ -887,7 +902,7 @@ function iptcembed (string $iptc_data, string $filename, int $spool) *

    * On failure, false is returned. */ -function getimagesize (string $filename, &$image_info) +function getimagesize (string $filename, &$image_info): array|false {} /** @@ -976,7 +991,8 @@ function getimagesize (string $filename, &$image_info) * */ #[Pure] -function image_type_to_mime_type (int $image_type) {} +function image_type_to_mime_type (int $image_type): string +{} /** * Get file extension for image type @@ -988,10 +1004,11 @@ function image_type_to_mime_type (int $image_type) {} * Removed since 8.0. * Whether to prepend a dot to the extension or not. Default to true. *

    - * @return string A string with the extension corresponding to the given image type. + * @return string|false A string with the extension corresponding to the given image type. */ #[Pure] -function image_type_to_extension (int $image_type, $include_dot = true) {} +function image_type_to_extension (int $image_type, $include_dot = true): string|false +{} /** * Outputs information about PHP's configuration @@ -1077,7 +1094,8 @@ function image_type_to_extension (int $image_type, $include_dot = true) {} *

    * @return bool true on success or false on failure. */ -function phpinfo (int $flags) {} +function phpinfo (int $flags): bool +{} /** * Gets the current PHP version @@ -1085,13 +1103,14 @@ function phpinfo (int $flags) {} * @param string $extension [optional]

    * An optional extension name. *

    - * @return string If the optional extension parameter is + * @return string|false If the optional extension parameter is * specified, phpversion returns the version of that * extension, or false if there is no version information associated or * the extension isn't enabled. */ #[Pure] -function phpversion (string $extension) {} +function phpversion (string $extension): string|false +{} /** * Prints out the credits for PHP @@ -1156,7 +1175,8 @@ function phpversion (string $extension) {} *

    * @return bool true on success or false on failure. */ -function phpcredits (int $flags) {} +function phpcredits (int $flags): bool +{} /** * Gets the logo guid @@ -1165,7 +1185,8 @@ function phpcredits (int $flags) {} * @return string PHPE9568F34-D428-11d2-A769-00AA001ACF42. */ #[Pure] -function php_logo_guid () {} +function php_logo_guid (): string +{} /** * @removed 5.5 @@ -1183,12 +1204,13 @@ function php_egg_logo_guid () {} * @link https://php.net/manual/en/function.zend-logo-guid.php * @return string PHPE9568F35-D428-11d2-A769-00AA001ACF42. */ -function zend_logo_guid () {} +function zend_logo_guid (): string +{} /** * Returns the type of interface between web server and PHP * @link https://php.net/manual/en/function.php-sapi-name.php - * @return string the interface type, as a lowercase string. + * @return string|false the interface type, as a lowercase string. *

    *

    * Although not exhaustive, the possible return values include @@ -1203,7 +1225,8 @@ function zend_logo_guid () {} * thttpd, tux, and webjames. */ #[Pure] -function php_sapi_name () {} +function php_sapi_name (): string|false +{} /** * Returns information about the operating system PHP is running on @@ -1216,7 +1239,8 @@ function php_sapi_name () {} * @return string the description, as a string. */ #[Pure] -function php_uname (string $mode) {} +function php_uname (string $mode): string +{} /** * Return a list of .ini files parsed from the additional ini dir @@ -1230,7 +1254,8 @@ function php_uname (string $mode) {} * php_ini_scanned_files. */ #[Pure] -function php_ini_scanned_files () {} +function php_ini_scanned_files (): string|false +{} /** * Retrieve a path to the loaded php.ini file @@ -1239,7 +1264,8 @@ function php_ini_scanned_files () {} * @since 5.2.4 */ #[Pure] -function php_ini_loaded_file () {} +function php_ini_loaded_file (): string|false +{} /** * String comparisons using a "natural order" algorithm @@ -1256,7 +1282,8 @@ function php_ini_loaded_file () {} * str2, and 0 if they are equal. */ #[Pure] -function strnatcmp (string $string1, string $string2) {} +function strnatcmp (string $string1, string $string2): int +{} /** * Case insensitive string comparisons using a "natural order" algorithm @@ -1273,7 +1300,8 @@ function strnatcmp (string $string1, string $string2) {} * str2, and 0 if they are equal. */ #[Pure] -function strnatcasecmp (string $string1, string $string2) {} +function strnatcasecmp (string $string1, string $string2): int +{} /** * Count the number of substring occurrences @@ -1295,7 +1323,7 @@ function strnatcasecmp (string $string1, string $string2) {} * @return int This functions returns an integer. */ #[Pure] -function substr_count (string $haystack, string $needle, int $offset, int $length) +function substr_count (string $haystack, string $needle, int $offset, int $length): int {} /** @@ -1349,7 +1377,7 @@ function substr_count (string $haystack, string $needle, int $offset, int $lengt * which consists entirely of characters in str2. */ #[Pure] -function strspn (string $string, string $characters, int $offset, int $length) +function strspn (string $string, string $characters, int $offset, int $length): int {} /** @@ -1370,7 +1398,7 @@ function strspn (string $string, string $characters, int $offset, int $length) * @return int the length of the segment as an integer. */ #[Pure] -function strcspn (string $string, string $characters, int $offset, int $length) +function strcspn (string $string, string $characters, int $offset, int $length): int {} /** @@ -1387,7 +1415,7 @@ function strcspn (string $string, string $characters, int $offset, int $length) * @param string $token

    * The delimiter used when splitting up str. *

    - * @return string A string token. + * @return string|false A string token. */ -function strtok (string $string, string $token) +function strtok (string $string, string $token): string|false {} diff --git a/standard/standard_1.php b/standard/standard_1.php index 8a85ccac3..8925827f5 100644 --- a/standard/standard_1.php +++ b/standard/standard_1.php @@ -14,7 +14,8 @@ * @return string the uppercased string. */ #[Pure] -function strtoupper (string $string) {} +function strtoupper (string $string): string +{} /** * Make a string lowercase @@ -25,7 +26,8 @@ function strtoupper (string $string) {} * @return string the lowercased string. */ #[Pure] -function strtolower (string $string) {} +function strtolower (string $string): string +{} /** * Find the position of the first occurrence of a substring in a string @@ -52,7 +54,8 @@ function strtolower (string $string) {} *

    */ #[Pure] -function strpos (string $haystack, string $needle, int $offset = 0) {} +function strpos (string $haystack, string $needle, int $offset = 0): int|false +{} /** * Find position of first occurrence of a case-insensitive string @@ -78,7 +81,7 @@ function strpos (string $haystack, string $needle, int $offset = 0) {} * stripos will return boolean false. */ #[Pure] -function stripos (string $haystack, string $needle, int $offset) +function stripos (string $haystack, string $needle, int $offset): int|false {} /** @@ -104,7 +107,8 @@ function stripos (string $haystack, string $needle, int $offset) *

    */ #[Pure] -function strrpos (string $haystack, string $needle, int $offset = 0) {} +function strrpos (string $haystack, string $needle, int $offset = 0): int|false +{} /** * Find position of last occurrence of a case-insensitive string in a string @@ -133,7 +137,7 @@ function strrpos (string $haystack, string $needle, int $offset = 0) {} * If needle is not found, false is returned. */ #[Pure] -function strripos (string $haystack, string $needle, int $offset) +function strripos (string $haystack, string $needle, int $offset): int|false {} /** @@ -145,7 +149,8 @@ function strripos (string $haystack, string $needle, int $offset) * @return string the reversed string. */ #[Pure] -function strrev (string $string) {} +function strrev (string $string): string +{} /** * Convert logical Hebrew text to visual text @@ -160,7 +165,7 @@ function strrev (string $string) {} * @return string the visual string. */ #[Pure] -function hebrev (string $string, int $max_chars_per_line) +function hebrev (string $string, int $max_chars_per_line): string {} /** @@ -177,7 +182,7 @@ function hebrev (string $string, int $max_chars_per_line) * @removed 8.0 */ #[Deprecated(replacement: 'nl2br(hebrev(%parameter0%))', since: '7.4')] -function hebrevc (string $hebrew_text, $max_chars_per_line) +function hebrevc (string $hebrew_text, $max_chars_per_line): string {} /** @@ -192,7 +197,8 @@ function hebrevc (string $hebrew_text, $max_chars_per_line) * @return string the altered string. */ #[Pure] -function nl2br (string $string, bool $use_xhtml = true) {} +function nl2br (string $string, bool $use_xhtml = true): string +{} /** * Returns trailing name component of path @@ -212,7 +218,7 @@ function nl2br (string $string, bool $use_xhtml = true) {} * @return string the base name of the given path. */ #[Pure] -function basename (string $path, string $suffix) +function basename (string $path, string $suffix): string {} /** @@ -237,7 +243,8 @@ function basename (string $path, string $suffix) * /component removed. */ #[Pure] -function dirname (string $path, int $levels = 1) {} +function dirname (string $path, int $levels = 1): string +{} /** * Returns information about a file path @@ -263,7 +270,7 @@ function dirname (string $path, int $levels = 1) {} * string if not all elements are requested. */ #[Pure] -function pathinfo (string $path, int $flags) +function pathinfo (string $path, int $flags): array|string {} /** @@ -278,7 +285,8 @@ function pathinfo (string $path, int $flags) * backslash (\). */ #[Pure] -function stripslashes (string $string) {} +function stripslashes (string $string): string +{} /** * Un-quote string quoted with addcslashes @@ -289,7 +297,8 @@ function stripslashes (string $string) {} * @return string the unescaped string. */ #[Pure] -function stripcslashes (string $string) {} +function stripcslashes (string $string): string +{} /** * Find the first occurrence of a string @@ -310,7 +319,7 @@ function stripcslashes (string $string) {} * is not found. */ #[Pure] -function strstr (string $haystack, string $needle, bool $before_needle) +function strstr (string $haystack, string $needle, bool $before_needle): string|false {} /** @@ -332,7 +341,7 @@ function strstr (string $haystack, string $needle, bool $before_needle) * found, returns false. */ #[Pure] -function stristr (string $haystack, string $needle, bool $before_needle) +function stristr (string $haystack, string $needle, bool $before_needle): string|false {} /** @@ -355,7 +364,8 @@ function stristr (string $haystack, string $needle, bool $before_needle) *

    */ #[Pure] -function strrchr (string $haystack, string $needle) {} +function strrchr (string $haystack, string $needle): string|false +{} /** * Randomly shuffles a string @@ -366,7 +376,8 @@ function strrchr (string $haystack, string $needle) {} * @return string the shuffled string. */ #[Pure] -function str_shuffle (string $string) {} +function str_shuffle (string $string): string +{} /** * Return information about words used in a string @@ -386,7 +397,7 @@ function str_shuffle (string $string) {} * format chosen. */ #[Pure] -function str_word_count (string $string, int $format, string $characters) +function str_word_count (string $string, int $format, string $characters): array|int {} /** @@ -411,7 +422,9 @@ function str_word_count (string $string, int $format, string $characters) *

    */ #[Pure] -function str_split (string $string, int $length = 1) {} +#[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] +function str_split (string $string, int $length = 1): array|bool +{} /** * Search a string for any of a set of characters @@ -426,7 +439,8 @@ function str_split (string $string, int $length = 1) {} * not found. */ #[Pure] -function strpbrk (string $string, string $characters) {} +function strpbrk (string $string, string $characters): string|false +{} /** * Binary safe comparison of two strings from an offset, up to length characters @@ -448,7 +462,7 @@ function strpbrk (string $string, string $characters) {} * If case_insensitivity is true, comparison is * case insensitive. *

    - * @return int < 0 if main_str from position + * @return int if less than 0 if main_str from position * offset is less than str, > * 0 if it is greater than str, and 0 if they are equal. * If offset is equal to or greater than the length of @@ -457,7 +471,7 @@ function strpbrk (string $string, string $characters) {} * false. */ #[Pure] -function substr_compare (string $haystack, string $needle, int $offset, int $length, bool $case_insensitive) +function substr_compare (string $haystack, string $needle, int $offset, int $length, bool $case_insensitive): int {} /** @@ -469,13 +483,14 @@ function substr_compare (string $haystack, string $needle, int $offset, int $len * @param string $string2

    * The second string. *

    - * @return int < 0 if str1 is less than + * @return int if less than 0 if str1 is less than * str2; > 0 if * str1 is greater than * str2, and 0 if they are equal. */ #[Pure] -function strcoll (string $string1, string $string2) {} +function strcoll (string $string1, string $string2): int +{} /** * Formats a number as a currency string @@ -494,7 +509,8 @@ function strcoll (string $string1, string $string2) {} * @see NumberFormatter */ #[Deprecated(reason: 'Use the NumberFormatter functionality', since: '7.4')] -function money_format (string $format, float $number) {} +function money_format (string $format, float $number): ?string +{} /** * Return part of a string @@ -560,7 +576,8 @@ function money_format (string $format, float $number) {} * @return string|false the extracted part of string or false on failure. */ #[Pure] -function substr (string $string, int $offset, int $length) +#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false")] +function substr (string $string, int $offset, int $length): bool|string {} /** @@ -599,7 +616,7 @@ function substr (string $string, int $offset, int $length) * array then array is returned. */ #[Pure] -function substr_replace (array|string $string, array|string $replace, array|int $offset, array|int $length = null) +function substr_replace (array|string $string, array|string $replace, array|int $offset, array|int $length = null): array|string {} /** @@ -611,7 +628,8 @@ function substr_replace (array|string $string, array|string $replace, array|int * @return string the string with meta characters quoted. */ #[Pure] -function quotemeta (string $string) {} +function quotemeta (string $string): string +{} /** * Make a string's first character uppercase @@ -622,7 +640,8 @@ function quotemeta (string $string) {} * @return string the resulting string. */ #[Pure] -function ucfirst (string $string) {} +function ucfirst (string $string): string +{} /** * Make a string's first character lowercase @@ -633,7 +652,8 @@ function ucfirst (string $string) {} * @return string the resulting string. */ #[Pure] -function lcfirst (string $string) {} +function lcfirst (string $string): string +{} /** * Uppercase the first character of each word in a string @@ -645,7 +665,8 @@ function lcfirst (string $string) {} * @return string the modified string. */ #[Pure] -function ucwords (string $string, string $separators = " \t\r\n\f\v") {} +function ucwords (string $string, string $separators = " \t\r\n\f\v"): string +{} /** * Translate characters or replace substrings @@ -665,7 +686,8 @@ function ucwords (string $string, string $separators = " \t\r\n\f\v") {} * to. */ #[Pure] -function strtr (string $string, string $from, string $to) {} +function strtr (string $string, string $from, string $to): string +{} /** * Translate certain characters @@ -675,7 +697,8 @@ function strtr (string $string, string $from, string $to) {} * @return string A copy of str, translating all occurrences of each character in from to the corresponding character in to. */ #[Pure] -function strtr (string $str, array $replace_pairs) {} +function strtr (string $str, array $replace_pairs): string +{} /** * Quote string with slashes @@ -686,7 +709,8 @@ function strtr (string $str, array $replace_pairs) {} * @return string the escaped string. */ #[Pure] -function addslashes (string $string) {} +function addslashes (string $string): string +{} /** * Quote string with slashes in a C style @@ -739,7 +763,8 @@ function addslashes (string $string) {} * @return string the escaped string. */ #[Pure] -function addcslashes (string $string, string $characters) {} +function addcslashes (string $string, string $characters): string +{} /** * Strip whitespace (or other characters) from the end of a string. @@ -765,7 +790,8 @@ function addcslashes (string $string, string $characters) {} * @return string the modified string. */ #[Pure] -function rtrim (string $string, string $characters = " \t\n\r\0\x0B") {} +function rtrim (string $string, string $characters = " \t\n\r\0\x0B"): string +{} /** * Replace all occurrences of the search string with the replacement string @@ -791,7 +817,8 @@ function rtrim (string $string, string $characters = " \t\n\r\0\x0B") {} * @param int &$count [optional] If passed, this will hold the number of matched and replaced needles. * @return string|string[] This function returns a string or an array with the replaced values. */ -function str_replace (array|string $search, array|string $replace, array|string $subject, &$count) {} +function str_replace (array|string $search, array|string $replace, array|string $subject, &$count): array|string +{} /** * Case-insensitive version of str_replace. @@ -815,7 +842,7 @@ function str_replace (array|string $search, array|string $replace, array|string *

    * @return string|string[] a string or an array of replacements. */ -function str_ireplace (array|string $search, array|string $replace, array|string $subject, &$count) +function str_ireplace (array|string $search, array|string $replace, array|string $subject, &$count): array|string {} /** @@ -836,7 +863,8 @@ function str_ireplace (array|string $search, array|string $replace, array|string * @return string the repeated string. */ #[Pure] -function str_repeat (string $string, int $times) {} +function str_repeat (string $string, int $times): string +{} /** * Return information about characters used in a string @@ -859,7 +887,7 @@ function str_repeat (string $string, int $times) {} * 4 - a string containing all not used characters is returned. */ #[Pure] -function count_chars (string $string, int $mode) +function count_chars (string $string, int $mode): array|string {} /** @@ -877,7 +905,8 @@ function count_chars (string $string, int $mode) * @return string the chunked string. */ #[Pure] -function chunk_split (string $string, int $length = 76, string $separator = "\r\n") {} +function chunk_split (string $string, int $length = 76, string $separator = "\r\n"): string +{} /** * Strip whitespace (or other characters) from the beginning and end of a string @@ -894,7 +923,8 @@ function chunk_split (string $string, int $length = 76, string $separator = "\r\ * @return string The trimmed string. */ #[Pure] -function trim (string $string, string $characters = " \t\n\r\0\x0B") {} +function trim (string $string, string $characters = " \t\n\r\0\x0B"): string +{} /** * Strip whitespace (or other characters) from the beginning of a string @@ -926,7 +956,8 @@ function trim (string $string, string $characters = " \t\n\r\0\x0B") {} * (0x0B)), a vertical tab. */ #[Pure] -function ltrim (string $string, string $characters = " \t\n\r\0\x0B") {} +function ltrim (string $string, string $characters = " \t\n\r\0\x0B"): string +{} /** * Strip HTML and PHP tags from a string @@ -946,7 +977,7 @@ function ltrim (string $string, string $characters = " \t\n\r\0\x0B") {} * @return string the stripped string. */ #[Pure] -function strip_tags (string $string, array|string $allowed_tags = null) +function strip_tags (string $string, array|string $allowed_tags = null): string {} /** @@ -965,7 +996,7 @@ function strip_tags (string $string, array|string $allowed_tags = null) *

    * @return int the number of matching chars in both strings. */ -function similar_text (string $string1, string $string2, &$percent) +function similar_text (string $string1, string $string2, &$percent): int {} /** @@ -998,7 +1029,8 @@ function similar_text (string $string1, string $string2, &$percent) * string will be returned. */ #[Pure] -function explode (string $separator, string $string, int $limit) +#[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] +function explode (string $separator, string $string, int $limit): array|bool {} /** @@ -1016,7 +1048,8 @@ function explode (string $separator, string $string, int $limit) * elements in the same order, with the glue string between each element. */ #[Pure] -function implode (array|string $separator = "", array $array) {} +function implode (array|string $separator = "", array $array): string +{} /** * &Alias; implode @@ -1033,7 +1066,8 @@ function implode (array|string $separator = "", array $array) {} * elements in the same order, with the glue string between each element. */ #[Pure] -function join (array|string $separator = "", array $array) {} +function join (array|string $separator = "", array $array): string +{} /** * Set locale information @@ -1105,7 +1139,8 @@ function join (array|string $separator = "", array $array) {} * on the system that PHP is running. It returns exactly * what the system setlocale function returns. */ -function setlocale (int $category, array|string $locales, ...$rest) {} +function setlocale (int $category, array|string $locales, ...$rest): string|false +{} /** * Get numeric formatting information @@ -1227,4 +1262,5 @@ function setlocale (int $category, array|string $locales, ...$rest) {} */ #[ArrayShape(["decimal_point" => "string", "thousands_sep" => "string", "grouping" => "array", "int_curr_symbol" => "string", "currency_symbol" => "string", "mon_decimal_point" => "string", "mon_thousands_sep" => "string", "mon_grouping" => "string", "positive_sign" => "string", "negative_sign" => "string", "int_frac_digits" => "string", "frac_digits" => "string", "p_cs_precedes" => "bool", "p_sep_by_space" => "bool", "n_cs_precedes" => "bool", "n_sep_by_space" => "bool", "p_sign_posn" => "int", "n_sign_posn" => "int",])] #[Pure] -function localeconv () {} +function localeconv (): array +{} diff --git a/standard/standard_2.php b/standard/standard_2.php index 251e81617..4202c2656 100644 --- a/standard/standard_2.php +++ b/standard/standard_2.php @@ -147,7 +147,8 @@ * is not valid. */ #[Pure] -function nl_langinfo (int $item) {} +function nl_langinfo (int $item): string|false +{} /** * Calculate the soundex key of a string @@ -158,7 +159,8 @@ function nl_langinfo (int $item) {} * @return string the soundex key as a string. */ #[Pure] -function soundex (string $string) {} +function soundex (string $string): string +{} /** * Calculate Levenshtein distance between two strings @@ -188,7 +190,8 @@ function soundex (string $string) {} * two argument strings or -1, if one of the argument strings * is longer than the limit of 255 characters. */ -function levenshtein (string $string1, string $string2, int $insertion_cost, int $repetition_cost, int $deletion_cost) { +function levenshtein (string $string1, string $string2, int $insertion_cost, int $repetition_cost, int $deletion_cost): int +{ } /** @@ -200,7 +203,8 @@ function levenshtein (string $string1, string $string2, int $insertion_cost, int * @return string the specified character. */ #[Pure] -function chr (int $codepoint) {} +function chr (int $codepoint): string +{} /** * Convert the first byte of a string to a value between 0 and 255 @@ -211,7 +215,8 @@ function chr (int $codepoint) {} * @return int the ASCII value as an integer. */ #[Pure] -function ord (string $character) {} +function ord (string $character): int +{} /** * Parses the string into variables @@ -226,7 +231,7 @@ function ord (string $character) {} *

    * @return void */ -function parse_str (string $string, &$result) +function parse_str (string $string, &$result): void {} /** @@ -248,7 +253,8 @@ function parse_str (string $string, &$result) * @return array an indexed array containing the fields read. */ #[Pure] -function str_getcsv (string $string, string $separator = ",", string $enclosure = '"', string $escape = "\\") {} +function str_getcsv (string $string, string $separator = ",", string $enclosure = '"', string $escape = "\\"): array +{} /** * Pad a string to a certain length with another string @@ -276,7 +282,8 @@ function str_getcsv (string $string, string $separator = ",", string $enclosure * @return string the padded string. */ #[Pure] -function str_pad (string $string, int $length, string $pad_string = " ", int $pad_type = STR_PAD_RIGHT) {} +function str_pad (string $string, int $length, string $pad_string = " ", int $pad_type = STR_PAD_RIGHT): string +{} /** * &Alias; rtrim @@ -287,7 +294,8 @@ function str_pad (string $string, int $length, string $pad_string = " ", int $pa * @see rtrim() */ #[Pure] -function chop (string $string, string $characters) {} +function chop (string $string, string $characters): string +{} /** * &Alias; strstr @@ -302,7 +310,8 @@ function chop (string $string, string $characters) {} * @return string|false Returns the portion of string, or FALSE if needle is not found. */ #[Pure] -function strchr (string $haystack, string $needle, bool $before_needle = false) {} +function strchr (string $haystack, string $needle, bool $before_needle = false): string|false +{} /** * Return a formatted string @@ -329,7 +338,8 @@ function strchr (string $haystack, string $needle, bool $before_needle = false) * format. */ #[Pure] -function sprintf (string $format, ...$values) {} +function sprintf (string $format, ...$values): string +{} /** * Output a formatted string @@ -342,7 +352,8 @@ function sprintf (string $format, ...$values) {} *

    * @return int the length of the outputted string. */ -function printf (string $format, ...$values) {} +function printf (string $format, ...$values): int +{} /** * Output a formatted string @@ -355,7 +366,8 @@ function printf (string $format, ...$values) {} *

    * @return int the length of the outputted string. */ -function vprintf (string $format, array $values) {} +function vprintf (string $format, array $values): int +{} /** * Return a formatted string @@ -371,7 +383,8 @@ function vprintf (string $format, array $values) {} * for sprintf). */ #[Pure] -function vsprintf (string $format, array $values) {} +function vsprintf (string $format, array $values): string +{} /** * Write a formatted string to a stream @@ -385,7 +398,8 @@ function vsprintf (string $format, array $values) {} *

    * @return int the length of the string written. */ -function fprintf ($stream, string $format, ...$values) {} +function fprintf ($stream, string $format, ...$values): int +{} /** * Write a formatted string to a stream @@ -400,7 +414,8 @@ function fprintf ($stream, string $format, ...$values) {} *

    * @return int the length of the outputted string. */ -function vfprintf ($stream, string $format, array $values) {} +function vfprintf ($stream, string $format, array $values): int +{} /** * Parses input from a string according to a format @@ -420,13 +435,14 @@ function vfprintf ($stream, string $format, array $values) {} * n stands for number of characters processed so far. *

    * @param mixed &...$vars - * @return array|int If only + * @return array|int|null If only * two parameters were passed to this function, the values parsed * will be returned as an array. Otherwise, if optional parameters are passed, * the function will return the number of assigned values. The optional * parameters must be passed by reference. */ -function sscanf (string $string, string $format, mixed &...$vars) {} +function sscanf (string $string, string $format, mixed &...$vars): array|int|null +{} /** * Parses input from a file according to a format @@ -437,12 +453,13 @@ function sscanf (string $string, string $format, mixed &...$vars) {} * sprintf documentation. *

    * @param mixed &...$vars [optional] - * @return array|int If only two parameters were passed to this function, the values parsed will be + * @return array|int|false|null If only two parameters were passed to this function, the values parsed will be * returned as an array. Otherwise, if optional parameters are passed, the * function will return the number of assigned values. The optional * parameters must be passed by reference. */ -function fscanf ($stream, string $format, mixed &...$vars) {} +function fscanf ($stream, string $format, mixed &...$vars): array|int|false|null +{} /** * Parse a URL and return its components @@ -486,7 +503,8 @@ function fscanf ($stream, string $format, mixed &...$vars) {} "fragment" => "string", ])] #[Pure] -function parse_url (string $url, int $component = -1) {} +function parse_url (string $url, int $component = -1) +{} /** * URL-encodes string @@ -505,7 +523,8 @@ function parse_url (string $url, int $component = -1) {} * are encoded as plus (+) signs. */ #[Pure] -function urlencode (string $string) {} +function urlencode (string $string): string +{} /** * Decodes URL-encoded string @@ -516,7 +535,8 @@ function urlencode (string $string) {} * @return string the decoded string. */ #[Pure] -function urldecode (string $string) {} +function urldecode (string $string): string +{} /** * URL-encode according to RFC 3986 @@ -533,7 +553,8 @@ function urldecode (string $string) {} * media with character conversions (like some email systems). */ #[Pure] -function rawurlencode (string $string) {} +function rawurlencode (string $string): string +{} /** * Decode URL-encoded strings @@ -544,7 +565,8 @@ function rawurlencode (string $string) {} * @return string the decoded URL, as a string. */ #[Pure] -function rawurldecode (string $string) {} +function rawurldecode (string $string): string +{} /** * Generate URL-encoded query string @@ -580,7 +602,8 @@ function rawurldecode (string $string) {} * @return string a URL-encoded string. */ #[Pure] -function http_build_query (object|array $data, string $numeric_prefix = "", string $arg_separator = "&", int $encoding_type = PHP_QUERY_RFC1738){} +function http_build_query (object|array $data, string $numeric_prefix = "", string $arg_separator = "&", int $encoding_type = PHP_QUERY_RFC1738): string +{} /** * Returns the target of a symbolic link @@ -590,7 +613,8 @@ function http_build_query (object|array $data, string $numeric_prefix = "", stri *

    * @return string|false the contents of the symbolic link path or false on error. */ -function readlink (string $path) {} +function readlink (string $path): string|false +{} /** * Gets information about a link @@ -598,12 +622,13 @@ function readlink (string $path) {} * @param string $path

    * Path to the link. *

    - * @return int linkinfo returns the st_dev field + * @return int|false linkinfo returns the st_dev field * of the Unix C stat structure returned by the lstat * system call. Returns 0 or false in case of error. */ #[Pure] -function linkinfo (string $path) {} +function linkinfo (string $path): int|false +{} /** * Creates a symbolic link @@ -616,7 +641,8 @@ function linkinfo (string $path) {} *

    * @return bool true on success or false on failure. */ -function symlink (string $target, string $link) {} +function symlink (string $target, string $link): bool +{} /** * Create a hard link @@ -660,7 +686,7 @@ function unlink (string $filename, $context):bool {} * return status of the executed command will be written to this * variable. *

    - * @return string The last line from the result of the command. If you need to execute a + * @return string|false The last line from the result of the command. If you need to execute a * command and have all the data from the command passed directly back without * any interference, use the passthru function. *

    @@ -668,7 +694,7 @@ function unlink (string $filename, $context):bool {} * To get the output of the executed command, be sure to set and use the * output parameter. */ -function exec (string $command, &$output, &$result_code) +function exec (string $command, &$output, &$result_code): string|false {} /** @@ -685,7 +711,7 @@ function exec (string $command, &$output, &$result_code) * @return string|false the last line of the command output on success, and false * on failure. */ -function system (string $command, &$result_code) +function system (string $command, &$result_code): string|false {} /** @@ -697,7 +723,8 @@ function system (string $command, &$result_code) * @return string The escaped string. */ #[Pure] -function escapeshellcmd (string $command) {} +function escapeshellcmd (string $command): string +{} /** * Escape a string to be used as a shell argument @@ -708,7 +735,8 @@ function escapeshellcmd (string $command) {} * @return string The escaped string. */ #[Pure] -function escapeshellarg (string $arg) {} +function escapeshellarg (string $arg): string +{} /** * Execute an external program and display raw output @@ -720,9 +748,9 @@ function escapeshellarg (string $arg) {} * If the return_var argument is present, the * return status of the Unix command will be placed here. *

    - * @return void + * @return bool */ -function passthru (string $command, &$result_code) +function passthru (string $command, &$result_code): bool {} /** @@ -731,9 +759,10 @@ function passthru (string $command, &$result_code) * @param string $command

    * The command that will be executed. *

    - * @return string|null The output from the executed command or NULL if an error occurred or the command produces no output. + * @return string|false|null The output from the executed command or NULL if an error occurred or the command produces no output. */ -function shell_exec (string $command) {} +function shell_exec (string $command): string|false|null +{} /** * Execute a command and open file pointers for input/output @@ -817,7 +846,8 @@ function proc_open (array|string $command, array $descriptor_spec, &$pipes, stri *

    * @return int the termination status of the process that was run. */ -function proc_close ($process) {} +function proc_close ($process): int +{} /** * Kills a process opened by proc_open @@ -834,7 +864,8 @@ function proc_close ($process) {} *

    * @return bool the termination status of the process that was run. */ -function proc_terminate ($process, int $signal = 15) {} +function proc_terminate ($process, int $signal = 15): bool +{} /** * Get information about a process opened by {@see proc_open} @@ -921,7 +952,9 @@ function proc_terminate ($process, int $signal = 15) {} "termsig" => "int", "stopsig" => "int", ])] -function proc_get_status ($process) {} +#[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] +function proc_get_status ($process) +{} /** * Change the priority of the current process.
    @@ -934,7 +967,8 @@ function proc_get_status ($process) {} * If an error occurs, like the user lacks permission to change the priority, * an error of level E_WARNING is also generated. */ -function proc_nice (int $priority) {} +function proc_nice (int $priority): bool +{} /** * Generate a random integer @@ -944,7 +978,8 @@ function proc_nice (int $priority) {} * @return int A pseudo random value between min * (or 0) and max (or getrandmax, inclusive). */ -function rand (int $min = 0, int $max) {} +function rand (int $min = 0, int $max): int +{} /** * Seed the random number generator @@ -960,7 +995,7 @@ function rand (int $min = 0, int $max) {} *

    * @return void */ -function srand (int $seed, int $mode = MT_RAND_MT19937) {} +function srand (int $seed, int $mode = MT_RAND_MT19937): void {} /** * Show largest possible random value @@ -968,7 +1003,8 @@ function srand (int $seed, int $mode = MT_RAND_MT19937) {} * @return int The largest possible random value returned by rand */ #[Pure] -function getrandmax () {} +function getrandmax (): int +{} /** * Generate a random value via the Mersenne Twister Random Number Generator @@ -982,7 +1018,8 @@ function getrandmax () {} * @return int A random integer value between min (or 0) * and max (or mt_getrandmax, inclusive) */ -function mt_rand (int $min = 0, int $max) {} +function mt_rand (int $min = 0, int $max): int +{} /** * Seeds the Mersenne Twister Random Number Generator @@ -995,7 +1032,7 @@ function mt_rand (int $min = 0, int $max) {} *

    * @return void */ -function mt_srand (int $seed, int $mode = MT_RAND_MT19937) {} +function mt_srand (int $seed, int $mode = MT_RAND_MT19937): void {} /** * Show largest possible random value @@ -1003,7 +1040,8 @@ function mt_srand (int $seed, int $mode = MT_RAND_MT19937) {} * @return int the maximum random value returned by mt_rand */ #[Pure] -function mt_getrandmax () {} +function mt_getrandmax (): int +{} /** * Get port number associated with an Internet service and protocol @@ -1019,7 +1057,8 @@ function mt_getrandmax () {} * protocol is not found. */ #[Pure] -function getservbyname (string $service, string $protocol) {} +function getservbyname (string $service, string $protocol): int|false +{} /** * Get Internet service which corresponds to port and protocol @@ -1031,10 +1070,11 @@ function getservbyname (string $service, string $protocol) {} * protocol is either "tcp" * or "udp" (in lowercase). *

    - * @return string the Internet service name as a string. + * @return string|false the Internet service name as a string. */ #[Pure] -function getservbyport (int $port, string $protocol) {} +function getservbyport (int $port, string $protocol): string|false +{} /** * Get protocol number associated with protocol name @@ -1042,10 +1082,11 @@ function getservbyport (int $port, string $protocol) {} * @param string $protocol

    * The protocol name. *

    - * @return int the protocol number or -1 if the protocol is not found. + * @return int|false the protocol number or -1 if the protocol is not found. */ #[Pure] -function getprotobyname (string $protocol) {} +function getprotobyname (string $protocol): int|false +{} /** * Get protocol name associated with protocol number @@ -1053,10 +1094,11 @@ function getprotobyname (string $protocol) {} * @param int $protocol

    * The protocol number. *

    - * @return string the protocol name as a string. + * @return string|false the protocol name as a string. */ #[Pure] -function getprotobynumber (int $protocol) {} +function getprotobynumber (int $protocol): string|false +{} /** * Gets PHP script owner's UID @@ -1064,7 +1106,8 @@ function getprotobynumber (int $protocol) {} * @return int|false the user ID of the current script, or false on error. */ #[Pure] -function getmyuid () {} +function getmyuid (): int|false +{} /** * Get PHP script owner's GID @@ -1072,7 +1115,8 @@ function getmyuid () {} * @return int|false the group ID of the current script, or false on error. */ #[Pure] -function getmygid () {} +function getmygid (): int|false +{} /** * Gets PHP's process ID @@ -1080,7 +1124,8 @@ function getmygid () {} * @return int|false the current PHP process ID, or false on error. */ #[Pure] -function getmypid () {} +function getmypid (): int|false +{} /** * Gets the inode of the current script @@ -1088,4 +1133,5 @@ function getmypid () {} * @return int|false the current script's inode as an integer, or false on error. */ #[Pure] -function getmyinode () {} +function getmyinode (): int|false +{} diff --git a/standard/standard_3.php b/standard/standard_3.php index 6eb55f010..4db8e1ff0 100644 --- a/standard/standard_3.php +++ b/standard/standard_3.php @@ -7,12 +7,13 @@ /** * Gets time of last page modification * @link https://php.net/manual/en/function.getlastmod.php - * @return int the time of the last modification of the current + * @return int|false the time of the last modification of the current * page. The value returned is a Unix timestamp, suitable for * feeding to date. Returns false on error. */ #[Pure] -function getlastmod () {} +function getlastmod (): int|false +{} /** * Decodes data encoded with MIME base64 @@ -28,7 +29,7 @@ function getlastmod () {} * binary. */ #[Pure] -function base64_decode (string $string, bool $strict) +function base64_decode (string $string, bool $strict): string|false {} /** @@ -40,7 +41,8 @@ function base64_decode (string $string, bool $strict) * @return string The encoded data, as a string. */ #[Pure] -function base64_encode (string $string) {} +function base64_encode (string $string): string +{} /** * Uuencode a string @@ -51,7 +53,8 @@ function base64_encode (string $string) {} * @return string the uuencoded data. */ #[Pure] -function convert_uuencode (string $string) {} +function convert_uuencode (string $string): string +{} /** * Decode a uuencoded string @@ -59,10 +62,11 @@ function convert_uuencode (string $string) {} * @param string $string

    * The uuencoded data. *

    - * @return string the decoded data as a string. + * @return string|false the decoded data as a string. */ #[Pure] -function convert_uudecode (string $string) {} +function convert_uudecode (string $string): string|false +{} /** * Absolute value @@ -77,7 +81,9 @@ function convert_uudecode (string $string) {} * bigger value range than integer). */ #[Pure] -function abs (int|float $num) {} +function abs (int|float $num): int|float +{} + /** * Round fractions up @@ -92,8 +98,9 @@ function abs (int|float $num) {} * usually bigger than that of integer. */ #[Pure] -function ceil (int|float $num) {} - +#[LanguageLevelTypeAware(["8.0" => "float"], default: "float|false")] +function ceil (int|float $num) +{} /** * Round fractions down * @link https://php.net/manual/en/function.floor.php @@ -106,7 +113,9 @@ function ceil (int|float $num) {} * usually bigger than that of integer. */ #[Pure] -function floor (int|float $num) {} +#[LanguageLevelTypeAware(["8.0" => "float"], default: "float|false")] +function floor (int|float $num) +{} /** * Returns the rounded value of val to specified precision (number of digits after the decimal point). @@ -128,7 +137,8 @@ function floor (int|float $num) {} * @return float The rounded value */ #[Pure] -function round (int|float $num, int $precision = 0, int $mode = PHP_ROUND_HALF_UP) {} +function round (int|float $num, int $precision = 0, int $mode = PHP_ROUND_HALF_UP): float +{} /** * Sine @@ -139,7 +149,8 @@ function round (int|float $num, int $precision = 0, int $mode = PHP_ROUND_HALF_U * @return float The sine of arg */ #[Pure] -function sin (float $num) {} +function sin (float $num): float +{} /** * Cosine @@ -150,7 +161,8 @@ function sin (float $num) {} * @return float The cosine of arg */ #[Pure] -function cos (float $num) {} +function cos (float $num): float +{} /** * Tangent @@ -161,7 +173,8 @@ function cos (float $num) {} * @return float The tangent of arg */ #[Pure] -function tan (float $num) {} +function tan (float $num): float +{} /** * Arc sine @@ -172,7 +185,8 @@ function tan (float $num) {} * @return float The arc sine of arg in radians */ #[Pure] -function asin (float $num) {} +function asin (float $num): float +{} /** * Arc cosine @@ -183,7 +197,8 @@ function asin (float $num) {} * @return float The arc cosine of arg in radians. */ #[Pure] -function acos (float $num) {} +function acos (float $num): float +{} /** * Arc tangent @@ -194,7 +209,8 @@ function acos (float $num) {} * @return float The arc tangent of arg in radians. */ #[Pure] -function atan (float $num) {} +function atan (float $num): float +{} /** * Inverse hyperbolic tangent @@ -205,7 +221,8 @@ function atan (float $num) {} * @return float Inverse hyperbolic tangent of arg */ #[Pure] -function atanh (float $num) {} +function atanh (float $num): float +{} /** * Arc tangent of two variables @@ -220,7 +237,8 @@ function atanh (float $num) {} * in radians. */ #[Pure] -function atan2 (float $y, float $x) {} +function atan2 (float $y, float $x): float +{} /** * Hyperbolic sine @@ -231,7 +249,8 @@ function atan2 (float $y, float $x) {} * @return float The hyperbolic sine of arg */ #[Pure] -function sinh (float $num) {} +function sinh (float $num): float +{} /** * Hyperbolic cosine @@ -242,7 +261,8 @@ function sinh (float $num) {} * @return float The hyperbolic cosine of arg */ #[Pure] -function cosh (float $num) {} +function cosh (float $num): float +{} /** * Hyperbolic tangent @@ -253,7 +273,8 @@ function cosh (float $num) {} * @return float The hyperbolic tangent of arg */ #[Pure] -function tanh (float $num) {} +function tanh (float $num): float +{} /** * Inverse hyperbolic sine @@ -264,7 +285,8 @@ function tanh (float $num) {} * @return float The inverse hyperbolic sine of arg */ #[Pure] -function asinh (float $num) {} +function asinh (float $num): float +{} /** * Inverse hyperbolic cosine @@ -275,7 +297,8 @@ function asinh (float $num) {} * @return float The inverse hyperbolic cosine of arg */ #[Pure] -function acosh (float $num) {} +function acosh (float $num): float +{} /** * Returns exp(number) - 1, computed in a way that is accurate even @@ -287,7 +310,8 @@ function acosh (float $num) {} * @return float 'e' to the power of arg minus one */ #[Pure] -function expm1(float $num) {} +function expm1(float $num): float +{} /** * Returns log(1 + number), computed in a way that is accurate even when @@ -299,7 +323,8 @@ function expm1(float $num) {} * @return float log(1 + number) */ #[Pure] -function log1p(float $num) {} +function log1p(float $num): float +{} /** * Get value of pi @@ -307,7 +332,8 @@ function log1p(float $num) {} * @return float The value of pi as float. */ #[Pure] -function pi () {} +function pi (): float +{} /** * Finds whether a value is a legal finite number @@ -320,7 +346,8 @@ function pi () {} * else false. */ #[Pure] -function is_finite (float $num) {} +function is_finite (float $num): bool +{} /** * Finds whether a value is not a number @@ -332,7 +359,8 @@ function is_finite (float $num) {} * else false. */ #[Pure] -function is_nan (float $num) {} +function is_nan (float $num): bool +{} /** * Integer division @@ -347,7 +375,8 @@ function is_nan (float $num) {} * @since 7.0 */ #[Pure] -function intdiv (int $num1, int $num2) {} +function intdiv (int $num1, int $num2): int +{} /** * Finds whether a value is infinite @@ -358,7 +387,8 @@ function intdiv (int $num1, int $num2) {} * @return bool true if val is infinite, else false. */ #[Pure] -function is_infinite (float $num) {} +function is_infinite (float $num): bool +{} /** * Exponential expression @@ -369,13 +399,14 @@ function is_infinite (float $num) {} * @param mixed $exponent

    * The exponent *

    - * @return int|float base raised to the power of exp. + * @return object|int|float base raised to the power of exp. * If the result can be represented as integer it will be returned as type * integer, else it will be returned as type float. * If the power cannot be computed false will be returned instead. */ #[Pure] -function pow (mixed $num, mixed $exponent) {} +function pow (mixed $num, mixed $exponent): object|int|float +{} /** * Calculates the exponent of e @@ -386,7 +417,8 @@ function pow (mixed $num, mixed $exponent) {} * @return float 'e' raised to the power of arg */ #[Pure] -function exp (float $num) {} +function exp (float $num): float +{} /** * Natural logarithm @@ -403,7 +435,7 @@ function exp (float $num) {} * natural logarithm. */ #[Pure] -function log (float $num, float $base) +function log (float $num, float $base): float {} /** @@ -415,7 +447,8 @@ function log (float $num, float $base) * @return float The base-10 logarithm of arg */ #[Pure] -function log10 (float $num) {} +function log10 (float $num): float +{} /** * Square root @@ -427,7 +460,8 @@ function log10 (float $num) {} * or the special value NAN for negative numbers. */ #[Pure] -function sqrt (float $num) {} +function sqrt (float $num): float +{} /** * Calculate the length of the hypotenuse of a right-angle triangle @@ -441,7 +475,8 @@ function sqrt (float $num) {} * @return float Calculated length of the hypotenuse */ #[Pure] -function hypot (float $x, float $y) {} +function hypot (float $x, float $y): float +{} /** * Converts the number in degrees to the radian equivalent @@ -452,7 +487,8 @@ function hypot (float $x, float $y) {} * @return float The radian equivalent of number */ #[Pure] -function deg2rad (float $num) {} +function deg2rad (float $num): float +{} /** * Converts the radian number to the equivalent number in degrees @@ -463,7 +499,8 @@ function deg2rad (float $num) {} * @return float The equivalent of number in degrees */ #[Pure] -function rad2deg (float $num) {} +function rad2deg (float $num): float +{} /** * Binary to decimal @@ -474,7 +511,8 @@ function rad2deg (float $num) {} * @return int|float The decimal value of binary_string */ #[Pure] -function bindec (string $binary_string) {} +function bindec (string $binary_string): int|float +{} /** * Hexadecimal to decimal @@ -485,7 +523,8 @@ function bindec (string $binary_string) {} * @return int|float The decimal representation of hex_string */ #[Pure] -function hexdec (string $hex_string) {} +function hexdec (string $hex_string): int|float +{} /** * Octal to decimal @@ -496,7 +535,8 @@ function hexdec (string $hex_string) {} * @return int|float The decimal representation of octal_string */ #[Pure] -function octdec (string $octal_string) {} +function octdec (string $octal_string): int|float +{} /** * Decimal to binary @@ -615,7 +655,8 @@ function octdec (string $octal_string) {} * @return string Binary string representation of number */ #[Pure] -function decbin (int $num) {} +function decbin (int $num): string +{} /** * Decimal to octal @@ -626,7 +667,8 @@ function decbin (int $num) {} * @return string Octal string representation of number */ #[Pure] -function decoct (int $num) {} +function decoct (int $num): string +{} /** * Decimal to hexadecimal @@ -637,7 +679,8 @@ function decoct (int $num) {} * @return string Hexadecimal string representation of number */ #[Pure] -function dechex (int $num) {} +function dechex (int $num): string +{} /** * Convert a number between arbitrary bases @@ -654,7 +697,8 @@ function dechex (int $num) {} * @return string number converted to base tobase */ #[Pure] -function base_convert (string $num, int $from_base, int $to_base) {} +function base_convert (string $num, int $from_base, int $to_base): string +{} /** * Format a number with grouped thousands @@ -670,7 +714,8 @@ function base_convert (string $num, int $from_base, int $to_base) {} * @return string A formatted version of number. */ #[Pure] -function number_format (float $num , int $decimals = 0 , string $decimal_separator = '.' , string $thousands_separator = ',') {} +function number_format (float $num , int $decimals = 0 , string $decimal_separator = '.' , string $thousands_separator = ','): string +{} /** * Returns the floating point remainder (modulo) of the division @@ -686,7 +731,8 @@ function number_format (float $num , int $decimals = 0 , string $decimal_separat * x/y */ #[Pure] -function fmod(float $num1, float $num2) {} +function fmod(float $num1, float $num2): float +{} /** * Performs a floating-point division under @@ -706,7 +752,8 @@ function fdiv(float $num1, float $num2): float {} * @return string|false a string representation of the address or false on failure. */ #[Pure] -function inet_ntop (string $ip) {} +function inet_ntop (string $ip): string|false +{} /** * Converts a human readable IP address to its packed in_addr representation @@ -714,11 +761,12 @@ function inet_ntop (string $ip) {} * @param string $ip

    * A human readable IPv4 or IPv6 address. *

    - * @return string the in_addr representation of the given + * @return string|false the in_addr representation of the given * address */ #[Pure] -function inet_pton (string $ip) {} +function inet_pton (string $ip): string|false +{} /** * Converts a string containing an (IPv4) Internet Protocol dotted address into a long integer @@ -730,7 +778,8 @@ function inet_pton (string $ip) {} * is invalid. */ #[Pure] -function ip2long (string $ip) {} +function ip2long (string $ip): int|false +{} /** * Converts an long integer address into a string in (IPv4) internet standard dotted format @@ -738,10 +787,11 @@ function ip2long (string $ip) {} * @param int $ip

    * A proper address representation. *

    - * @return string the Internet IP address as a string. + * @return string|false the Internet IP address as a string. */ #[Pure] -function long2ip (int $ip) {} +function long2ip (int $ip): string|false +{} /** * Gets the value of an environment variable @@ -757,7 +807,8 @@ function long2ip (int $ip) {} * is provided, or false on an error. */ #[Pure] -function getenv (string $name, bool $local_only = false) {} +function getenv (string $name, bool $local_only = false): array|string|false +{} /** * Sets the value of an environment variable @@ -767,7 +818,8 @@ function getenv (string $name, bool $local_only = false) {} *

    * @return bool true on success or false on failure. */ -function putenv (string $assignment) {} +function putenv (string $assignment): bool +{} /** * Gets options from the command line argument list @@ -788,18 +840,19 @@ function putenv (string $assignment) {} * @return string[]|false[]|false This function will return an array of option / argument pairs or false on * failure. */ -function getopt (string $short_options, array $long_options, &$rest_index) +function getopt (string $short_options, array $long_options, &$rest_index): array|false {} /** * Gets system load average * @link https://php.net/manual/en/function.sys-getloadavg.php - * @return array an array with three samples (last 1, 5 and 15 + * @return array|false an array with three samples (last 1, 5 and 15 * minutes). * @since 5.1.3 */ #[Pure] -function sys_getloadavg () {} +function sys_getloadavg (): array|false +{} /** * Return current Unix timestamp with microseconds @@ -818,7 +871,8 @@ function sys_getloadavg () {} * @return string|float */ #[Pure] -function microtime (bool $as_float) {} +function microtime (bool $as_float): string|float +{} /** * Get current time @@ -837,7 +891,8 @@ function microtime (bool $as_float) {} * "dsttime" - type of dst correction */ #[Pure] -function gettimeofday (bool $as_float) {} +function gettimeofday (bool $as_float): array|float +{} /** * Gets the current resource usages @@ -846,11 +901,12 @@ function gettimeofday (bool $as_float) {} * If who is 1, getrusage will be called with * RUSAGE_CHILDREN. *

    - * @return array an associative array containing the data returned from the system + * @return array|false an associative array containing the data returned from the system * call. All entries are accessible by using their documented field names. */ #[Pure] -function getrusage (int $mode) {} +function getrusage (int $mode): array|false +{} /** * Generate a unique ID @@ -873,7 +929,8 @@ function getrusage (int $mode) {} * @return string the unique identifier, as a string. */ #[Pure] -function uniqid (string $prefix = "", bool $more_entropy = false) {} +function uniqid (string $prefix = "", bool $more_entropy = false): string +{} /** * Convert a quoted-printable string to an 8 bit string @@ -884,7 +941,8 @@ function uniqid (string $prefix = "", bool $more_entropy = false) {} * @return string the 8-bit binary string. */ #[Pure] -function quoted_printable_decode (string $string) {} +function quoted_printable_decode (string $string): string +{} /** * Convert a 8 bit string to a quoted-printable string @@ -895,7 +953,8 @@ function quoted_printable_decode (string $string) {} * @return string the encoded string. */ #[Pure] -function quoted_printable_encode (string $string) {} +function quoted_printable_encode (string $string): string +{} /** * Convert from one Cyrillic character set to another @@ -917,7 +976,8 @@ function quoted_printable_encode (string $string) {} */ #[Pure] #[Deprecated(since: '7.4',reason: 'Us mb_convert_string(), iconv() or UConverter instead.')] -function convert_cyr_string (string $str, string $from, string $to) {} +function convert_cyr_string (string $str, string $from, string $to): string +{} /** * Gets the name of the owner of the current PHP script @@ -925,7 +985,8 @@ function convert_cyr_string (string $str, string $from, string $to) {} * @return string the username as a string. */ #[Pure] -function get_current_user () {} +function get_current_user (): string +{} /** * Limits the maximum execution time @@ -936,7 +997,8 @@ function get_current_user () {} *

    * @return bool Returns TRUE on success, or FALSE on failure. */ -function set_time_limit (int $seconds) {} +function set_time_limit (int $seconds): bool +{} /** * Gets the value of a PHP configuration option @@ -944,11 +1006,12 @@ function set_time_limit (int $seconds) {} * @param string $option

    * The configuration option name. *

    - * @return string the current value of the PHP configuration variable specified by + * @return array|string|false the current value of the PHP configuration variable specified by * option, or false if an error occurs. */ #[Pure] -function get_cfg_var (string $option) {} +function get_cfg_var (string $option): array|string|false +{} /** * &Alias; set_magic_quotes_runtime @@ -969,7 +1032,8 @@ function magic_quotes_runtime (bool $new_setting) {} * @removed 7.0 */ #[Deprecated(reason: "This function has been DEPRECATED as of PHP 5.4.0. Raises an E_CORE_ERROR", since: "5.3")] -function set_magic_quotes_runtime (bool $new_setting) {} +function set_magic_quotes_runtime (bool $new_setting): bool +{} /** * Gets the current configuration setting of magic quotes gpc @@ -978,7 +1042,8 @@ function set_magic_quotes_runtime (bool $new_setting) {} * @removed 8.0 */ #[Deprecated(since: '7.4')] -function get_magic_quotes_gpc () {} +function get_magic_quotes_gpc (): int +{} /** * Gets the current active configuration setting of magic_quotes_runtime @@ -986,7 +1051,8 @@ function get_magic_quotes_gpc () {} * @return int 0 if magic quotes runtime is off, 1 otherwise. */ #[Deprecated(since: '7.4')] -function get_magic_quotes_runtime () {} +function get_magic_quotes_runtime (): int +{} /** * Import GET/POST/Cookie variables into the global scope @@ -1022,7 +1088,7 @@ function get_magic_quotes_runtime () {} * @removed 5.4 */ #[Deprecated(reason: "This function has been DEPRECATED as of PHP 5.3.0", since: "5.3")] -function import_request_variables (string $types, $prefix = null) +function import_request_variables (string $types, $prefix = null): bool {} /** @@ -1091,5 +1157,6 @@ function import_request_variables (string $types, $prefix = null) *

    * @return bool true on success or false on failure. */ -function error_log (string $message, int $message_type, string $destination, string $additional_headers) { +function error_log (string $message, int $message_type, string $destination, string $additional_headers): bool +{ } diff --git a/standard/standard_4.php b/standard/standard_4.php index 16fb5374a..11a0d1a0d 100644 --- a/standard/standard_4.php +++ b/standard/standard_4.php @@ -18,7 +18,8 @@ "line" => "int", ])] #[Pure] -function error_get_last () {} +function error_get_last (): ?array +{} /** * Call the callback given by the first parameter @@ -41,7 +42,8 @@ function error_get_last () {} *

    * @return mixed|false the function result, or false on error. */ -function call_user_func (callable $callback, mixed ...$args) {} +function call_user_func (callable $callback, mixed ...$args): mixed +{} /** * Call a callback with an array of parameters @@ -54,7 +56,8 @@ function call_user_func (callable $callback, mixed ...$args) {} *

    * @return mixed|false the function result, or false on error. */ -function call_user_func_array (callable $callback, array $args) {} +function call_user_func_array (callable $callback, array $args): mixed +{} /** * Call a user method on an specific object @@ -67,7 +70,8 @@ function call_user_func_array (callable $callback, array $args) {} * @see call_user_func() */ #[Deprecated(reason: "use call_user_func() instead", since: "5.3")] -function call_user_method (string $method_name, object &$obj, ...$parameter) {} +function call_user_method (string $method_name, object &$obj, ...$parameter): mixed +{} /** * Call a user method given with an array of parameters @@ -80,7 +84,8 @@ function call_user_method (string $method_name, object &$obj, ...$parameter) {} * @see call_user_func() */ #[Deprecated(reason: "use call_user_func() instead", since: "5.3")] -function call_user_method_array (string $method_name, object &$obj, array $params) {} +function call_user_method_array (string $method_name, object &$obj, array $params): mixed +{} /** * Call a static method @@ -95,7 +100,8 @@ function call_user_method_array (string $method_name, object &$obj, array $param *

    * @return mixed|false the function result, or false on error. */ -function forward_static_call (callable $callback, ...$args) {} +function forward_static_call (callable $callback, ...$args): mixed +{} /** * Call a static method and pass the arguments as array @@ -108,7 +114,8 @@ function forward_static_call (callable $callback, ...$args) {} * @param array $args * @return mixed|false the function result, or false on error. */ -function forward_static_call_array (callable $callback, array $args) {} +function forward_static_call_array (callable $callback, array $args): mixed +{} /** * Generates a storable representation of a value @@ -136,7 +143,8 @@ function forward_static_call_array (callable $callback, array $args) {} * @return string a string containing a byte-stream representation of * value that can be stored anywhere. */ -function serialize (mixed $value) {} +function serialize (mixed $value): string +{} /** * Creates a PHP value from a stored representation @@ -179,7 +187,8 @@ function serialize (mixed $value) {} * In case the passed string is not unserializeable, false is returned and * E_NOTICE is issued. */ -function unserialize (string $data, array $options = []) {} +function unserialize (string $data, array $options = []): mixed +{} /** * Dumps information about a variable @@ -190,7 +199,7 @@ function unserialize (string $data, array $options = []) {} * @param mixed ...$values [optional] * @return void */ -function var_dump (mixed $value, ...$values) {} +function var_dump (mixed $value, ...$values): void {} /** * Outputs or returns a parsable string representation of a variable @@ -207,7 +216,7 @@ function var_dump (mixed $value, ...$values) {} * parameter is used and evaluates to true. Otherwise, this function will * return null. */ -function var_export (mixed $value, bool $return) +function var_export (mixed $value, bool $return): ?string {} /** @@ -219,7 +228,7 @@ function var_export (mixed $value, bool $return) *

    * @return void */ -function debug_zval_dump (mixed $value, mixed ...$values) {} +function debug_zval_dump (mixed $value, mixed ...$values): void {} /** * Prints human-readable information about a variable @@ -233,12 +242,12 @@ function debug_zval_dump (mixed $value, mixed ...$values) {} * to true, print_r will return its output, instead of * printing it (which it does by default). *

    - * @return string|true If given a string, integer or float, + * @return string|bool If given a string, integer or float, * the value itself will be printed. If given an array, values * will be presented in a format that shows keys and elements. Similar * notation is used for objects. */ -function print_r (mixed $value, bool $return) +function print_r (mixed $value, bool $return): string|bool {} /** @@ -252,7 +261,8 @@ function print_r (mixed $value, bool $return) * @return int the memory amount in bytes. */ #[Pure] -function memory_get_usage (bool $real_usage = false) {} +function memory_get_usage (bool $real_usage = false): int +{} /** * Returns the peak of memory allocated by PHP @@ -265,7 +275,8 @@ function memory_get_usage (bool $real_usage = false) {} * @return int the memory peak in bytes. */ #[Pure] -function memory_get_peak_usage (bool $real_usage = false) {} +function memory_get_peak_usage (bool $real_usage = false): int +{} /** * Register a function for execution on shutdown @@ -288,9 +299,9 @@ function memory_get_peak_usage (bool $real_usage = false) {} * It is possible to pass parameters to the shutdown function by passing * additional parameters. *

    - * @return void + * @return bool */ -function register_shutdown_function (callable $callback, ...$args) {} +function register_shutdown_function (callable $callback, ...$args): bool {} /** * Register a function for execution on each tick @@ -303,7 +314,8 @@ function register_shutdown_function (callable $callback, ...$args) {} *

    * @return bool true on success or false on failure. */ -function register_tick_function (callable $callback, ...$args) {} +function register_tick_function (callable $callback, ...$args): bool +{} /** * De-register a function for execution on each tick @@ -314,7 +326,7 @@ function register_tick_function (callable $callback, ...$args) {} *

    * @return void */ -function unregister_tick_function (callable $callback) {} +function unregister_tick_function (callable $callback): void {} /** * Syntax highlighting of a file @@ -330,7 +342,8 @@ function unregister_tick_function (callable $callback) {} * code as a string instead of printing it out. Otherwise, it will return * true on success, false on failure. */ -function highlight_file (string $filename, bool $return = false) {} +function highlight_file (string $filename, bool $return = false): string|bool +{} /** * &Alias; highlight_file @@ -339,7 +352,8 @@ function highlight_file (string $filename, bool $return = false) {} * @param bool $return [optional] * @return string|bool */ -function show_source (string $filename, bool $return = false) {} +function show_source (string $filename, bool $return = false): string|bool +{} /** * Syntax highlighting of a string @@ -355,18 +369,20 @@ function show_source (string $filename, bool $return = false) {} * code as a string instead of printing it out. Otherwise, it will return * true on success, false on failure. */ -function highlight_string (string $string, bool $return = false) {} +function highlight_string (string $string, bool $return = false): string|bool +{} /** * Get the system's high resolution time * @link https://secure.php.net/manual/en/function.hrtime.php * @param bool $as_number

    Whether the high resolution time should be returned as array or number.

    * @since 7.3 - * @return int[]|int|float Returns an array of integers in the form [seconds, nanoseconds], if the parameter get_as_number is false. + * @return int[]|int|float|false Returns an array of integers in the form [seconds, nanoseconds], if the parameter get_as_number is false. * Otherwise the nanoseconds are returned as integer (64bit platforms) or float (32bit platforms). */ #[Pure] -function hrtime(bool $as_number = false) {} +function hrtime(bool $as_number = false): array|int|float|false +{} /** * Return source with stripped comments and whitespace @@ -384,7 +400,8 @@ function hrtime(bool $as_number = false) {} * #29606. */ #[Pure] -function php_strip_whitespace (string $filename) {} +function php_strip_whitespace (string $filename): string +{} /** * Gets the value of a configuration option @@ -393,11 +410,12 @@ function php_strip_whitespace (string $filename) {} * @param string $option

    * The configuration option name. *

    - * @return string the value of the configuration option as a string on success, or + * @return string|false the value of the configuration option as a string on success, or * an empty string on failure or for null values. */ #[Pure] -function ini_get (string $option) {} +function ini_get (string $option): string|false +{} /** * Gets all configuration options @@ -411,7 +429,7 @@ function ini_get (string $option) {} * Retrieve details settings or only the current value for each setting. * Default is true (retrieve details). *

    - * @return array an associative array with directive name as the array key. + * @return array|false an associative array with directive name as the array key. *

    *

    * When details is true (default) the array will @@ -433,7 +451,8 @@ function ini_get (string $option) {} * why access shows the appropriate bitmask values. */ #[Pure] -function ini_get_all (string $extension, bool $details) {} +function ini_get_all (string $extension, bool $details): array|false +{} /** * Sets the value of a configuration option @@ -451,7 +470,8 @@ function ini_get_all (string $extension, bool $details) {} *

    * @return string|false the old value on success, false on failure. */ -function ini_set (string $option, string $value) {} +function ini_set (string $option, string $value): string|false +{} /** * &Alias; ini_set @@ -461,7 +481,8 @@ function ini_set (string $option, string $value) {} * @param string $value * @return string|false */ -function ini_alter (string $option, string $value) {} +function ini_alter (string $option, string $value): string|false +{} /** * Restores the value of a configuration option @@ -472,15 +493,16 @@ function ini_alter (string $option, string $value) {} *

    * @return void */ -function ini_restore (string $option) {} +function ini_restore (string $option): void {} /** * Gets the current include_path configuration option * @link https://php.net/manual/en/function.get-include-path.php - * @return string the path, as a string. + * @return string|false the path, as a string. */ #[Pure] -function get_include_path () {} +function get_include_path (): string|false +{} /** * Sets the include_path configuration option @@ -488,10 +510,11 @@ function get_include_path () {} * @param string $include_path

    * The new value for the include_path *

    - * @return string|bool the old include_path on + * @return string|false the old include_path on * success or false on failure. */ -function set_include_path (string $include_path) {} +function set_include_path (string $include_path): string|false +{} /** * Restores the value of the include_path configuration option @@ -577,7 +600,8 @@ function restore_include_path () {} * setcookie successfully runs, it will return true. * This does not indicate whether the user accepted the cookie. */ -function setcookie (string $name, $value = "", $expires_or_options = 0, $path = "", $domain = "", $secure = false, $httponly = false) {} +function setcookie (string $name, $value = "", $expires_or_options = 0, $path = "", $domain = "", $secure = false, $httponly = false): bool +{} /** * Send a cookie @@ -600,7 +624,8 @@ function setcookie (string $name, $value = "", $expires_or_options = 0, $path = * This does not indicate whether the user accepted the cookie. * @since 7.3 */ -function setcookie(string $name, $value = '', array $options = []) {} +function setcookie(string $name, $value = '', array $options = []): bool +{} /** * Send a cookie without urlencoding the cookie value @@ -614,7 +639,8 @@ function setcookie(string $name, $value = '', array $options = []) {} * @param bool $httponly [optional] * @return bool true on success or false on failure. */ -function setrawcookie (string $name, $value = '', $expires_or_options = 0, $path = "", $domain = "", $secure = false, $httponly = false) {} +function setrawcookie (string $name, $value = '', $expires_or_options = 0, $path = "", $domain = "", $secure = false, $httponly = false): bool +{} /** * Send a cookie without urlencoding the cookie value @@ -636,7 +662,8 @@ function setrawcookie (string $name, $value = '', $expires_or_options = 0, $path * setcookie successfully runs, it will return true. * This does not indicate whether the user accepted the cookie. */ -function setrawcookie (string $name, $value = '', array $options = []) {} +function setrawcookie (string $name, $value = '', array $options = []): bool +{} /** * Send a raw HTTP header @@ -672,7 +699,7 @@ function setrawcookie (string $name, $value = '', array $options = []) {} *

    * @return void */ -function header (string $header, bool $replace = true, int $response_code) +function header (string $header, bool $replace = true, int $response_code): void {} /** @@ -684,7 +711,7 @@ function header (string $header, bool $replace = true, int $response_code) * This parameter is case-insensitive. * @return void */ -function header_remove (string $name) {} +function header_remove (string $name): void {} /** * Checks if or where headers have been sent @@ -702,7 +729,8 @@ function header_remove (string $name) {} * @return bool headers_sent will return false if no HTTP headers * have already been sent or true otherwise. */ -function headers_sent (&$filename, &$line) {} +function headers_sent (&$filename, &$line): bool +{} /** * Returns a list of response headers sent (or ready to send) @@ -710,7 +738,8 @@ function headers_sent (&$filename, &$line) {} * @return array a numerically indexed array of headers. */ #[Pure] -function headers_list () {} +function headers_list (): array +{} /** * Fetches all HTTP request headers from the current request @@ -718,7 +747,8 @@ function headers_list () {} * @return array|false An associative array of all the HTTP headers in the current request, or FALSEFALSE on failure. */ #[Pure] -function getallheaders () {} +function getallheaders (): bool|array +{} /** * Check whether client disconnected @@ -735,7 +766,8 @@ function getallheaders () {} * @return int 1 if client disconnected, 0 otherwise. */ #[Pure] -function connection_aborted () {} +function connection_aborted (): int +{} /** * Returns connection status bitfield @@ -745,7 +777,8 @@ function connection_aborted () {} * status. */ #[Pure] -function connection_status () {} +function connection_status (): int +{} /** * Set whether a client disconnect should abort script execution @@ -757,7 +790,8 @@ function connection_status () {} *

    * @return int the previous setting, as an integer. */ -function ignore_user_abort (bool $enable) {} +function ignore_user_abort (bool $enable): int +{} /** * Parse a configuration file @@ -787,7 +821,8 @@ function ignore_user_abort (bool $enable) {} * @return array|false The settings are returned as an associative array on success, * and false on failure. */ -function parse_ini_file (string $filename, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL) {} +function parse_ini_file (string $filename, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array|false +{} /** * Parse a configuration string @@ -810,7 +845,8 @@ function parse_ini_file (string $filename, bool $process_sections = false, int $ * and false on failure. */ #[Pure] -function parse_ini_string (string $ini_string, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL) {} +function parse_ini_string (string $ini_string, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array|false +{} /** * Tells whether the file was uploaded via HTTP POST @@ -821,7 +857,8 @@ function parse_ini_string (string $ini_string, bool $process_sections = false, i * @return bool true on success or false on failure. */ #[Pure] -function is_uploaded_file (string $filename) {} +function is_uploaded_file (string $filename): bool +{} /** * Moves an uploaded file to a new location @@ -843,14 +880,16 @@ function is_uploaded_file (string $filename) {} * move_uploaded_file will return * false. Additionally, a warning will be issued. */ -function move_uploaded_file (string $from, string $to) {} +function move_uploaded_file (string $from, string $to): bool +{} /** * @return array|false * @since 7.3 */ #[Pure] -function net_get_interfaces() {} +function net_get_interfaces(): array|false +{} /** * Get the Internet host name corresponding to a given IP address @@ -858,11 +897,12 @@ function net_get_interfaces() {} * @param string $ip

    * The host IP address. *

    - * @return string the host name or the unmodified ip_address + * @return string|false the host name or the unmodified ip_address * on failure. */ #[Pure] -function gethostbyaddr (string $ip) {} +function gethostbyaddr (string $ip): string|false +{} /** * Get the IPv4 address corresponding to a given Internet host name @@ -874,7 +914,8 @@ function gethostbyaddr (string $ip) {} * hostname on failure. */ #[Pure] -function gethostbyname (string $hostname) {} +function gethostbyname (string $hostname): string +{} /** * Get a list of IPv4 addresses corresponding to a given Internet host @@ -887,7 +928,8 @@ function gethostbyname (string $hostname) {} * hostname could not be resolved. */ #[Pure] -function gethostbynamel(string $hostname) {} +function gethostbynamel(string $hostname): array|false +{} /** * Gets the host name @@ -896,7 +938,8 @@ function gethostbynamel(string $hostname) {} * returned. */ #[Pure] -function gethostname () {} +function gethostname (): string|false +{} /** * &Alias; checkdnsrr @@ -911,7 +954,8 @@ function gethostname () {} *

    * @return bool Returns TRUE if any records are found; returns FALSE if no records were found or if an error occurred. */ -function dns_check_record (string $hostname, string $type = 'MX') {} +function dns_check_record (string $hostname, string $type = 'MX'): bool +{} /** * Check DNS records corresponding to a given Internet host name or IP address @@ -928,7 +972,7 @@ function dns_check_record (string $hostname, string $type = 'MX') {} * were found or if an error occurred. */ #[Pure] -function checkdnsrr (string $hostname, string $type) +function checkdnsrr (string $hostname, string $type): bool {} /** @@ -939,7 +983,8 @@ function checkdnsrr (string $hostname, string $type) * @param array &$weights [optional] * @return bool */ -function dns_get_mx (string $hostname, &$hosts, &$weights) {} +function dns_get_mx (string $hostname, &$hosts, &$weights): bool +{} /** * Get MX records corresponding to a given Internet host name @@ -958,7 +1003,7 @@ function dns_get_mx (string $hostname, &$hosts, &$weights) {} * @return bool true if any records are found; returns false if no records * were found or if an error occurred. */ -function getmxrr (string $hostname, &$hosts, &$weights) +function getmxrr (string $hostname, &$hosts, &$weights): bool {} /** @@ -1008,7 +1053,7 @@ function getmxrr (string $hostname, &$hosts, &$weights) * In case of raw mode, we query only the requested type * instead of looping type by type before going with the additional info stuff. *

    - * @return array This function returns an array of associative arrays. Each associative array contains + * @return array|false This function returns an array of associative arrays. Each associative array contains * at minimum the following keys: * * Basic DNS attributes @@ -1168,5 +1213,5 @@ function getmxrr (string $hostname, &$hosts, &$weights) * *
    */ -function dns_get_record (string $hostname, int $type = DNS_ANY, &$authoritative_name_servers, &$additional_records, bool $raw = false) +function dns_get_record (string $hostname, int $type = DNS_ANY, &$authoritative_name_servers, &$additional_records, bool $raw = false): array|false {} diff --git a/standard/standard_5.php b/standard/standard_5.php index 59c037831..c4502a319 100644 --- a/standard/standard_5.php +++ b/standard/standard_5.php @@ -11,7 +11,8 @@ * @since 5.5 */ #[Pure] -function boolval(mixed $value) {} +function boolval(mixed $value): bool +{} /** * Get the integer value of a variable @@ -40,7 +41,8 @@ function boolval(mixed $value) {} * apply. */ #[Pure] -function intval (mixed $value, int $base = 10) {} +function intval (mixed $value, int $base = 10): int +{} /** * Get float value of a variable @@ -49,7 +51,8 @@ function intval (mixed $value, int $base = 10) {} * @return float value of the given variable. Empty arrays return 0, non-empty arrays return 1. */ #[Pure] -function floatval (mixed $value) {} +function floatval (mixed $value): float +{} /** * (PHP 4.2.0, PHP 5)
    @@ -61,7 +64,8 @@ function floatval (mixed $value) {} * @return float value of the given variable. Empty arrays return 0, non-empty arrays return 1. */ #[Pure] -function doubleval (mixed $value) {} +function doubleval (mixed $value): float +{} /** * Get string value of a variable @@ -76,7 +80,8 @@ function doubleval (mixed $value) {} * @return string The string value of var. */ #[Pure] -function strval (mixed $value) {} +function strval (mixed $value): string +{} /** * Get the type of a variable @@ -99,7 +104,8 @@ function strval (mixed $value) {} * "resource (closed)" since 7.2.0 */ #[Pure] -function gettype (mixed $value) {} +function gettype (mixed $value): string +{} /** * Set the type of a variable @@ -135,7 +141,8 @@ function gettype (mixed $value) {} * * @return bool true on success or false on failure. */ -function settype (mixed &$var, string $type) {} +function settype (mixed &$var, string $type): bool +{} /** * Finds whether a variable is null. @@ -147,7 +154,8 @@ function settype (mixed &$var, string $type) {} * otherwise. */ #[Pure] -function is_null (mixed $value) {} +function is_null (mixed $value): bool +{} /** * Finds whether a variable is a resource @@ -159,7 +167,8 @@ function is_null (mixed $value) {} * false otherwise. */ #[Pure] -function is_resource (mixed $value) {} +function is_resource (mixed $value): bool +{} /** * Finds out whether a variable is a boolean @@ -171,7 +180,8 @@ function is_resource (mixed $value) {} * false otherwise. */ #[Pure] -function is_bool (mixed $value) {} +function is_bool (mixed $value): bool +{} /** * &Alias; is_int @@ -183,7 +193,8 @@ function is_bool (mixed $value) {} * false otherwise. */ #[Pure] -function is_long (mixed $value) {} +function is_long (mixed $value): bool +{} /** * Finds whether the type of a variable is float @@ -195,7 +206,8 @@ function is_long (mixed $value) {} * false otherwise. */ #[Pure] -function is_float (mixed $value) {} +function is_float (mixed $value): bool +{} /** * Find whether the type of a variable is integer @@ -207,7 +219,8 @@ function is_float (mixed $value) {} * false otherwise. */ #[Pure] -function is_int (mixed $value) {} +function is_int (mixed $value): bool +{} /** * &Alias; is_int @@ -219,7 +232,8 @@ function is_int (mixed $value) {} * false otherwise. */ #[Pure] -function is_integer (mixed $value) {} +function is_integer (mixed $value): bool +{} /** * &Alias; is_float @@ -231,7 +245,8 @@ function is_integer (mixed $value) {} * false otherwise. */ #[Pure] -function is_double (mixed $value) {} +function is_double (mixed $value): bool +{} /** * &Alias; is_float @@ -244,7 +259,8 @@ function is_double (mixed $value) {} */ #[Pure] #[Deprecated(since: '7.4')] -function is_real (mixed $var) {} +function is_real (mixed $var): bool +{} /** * Finds whether a variable is a number or a numeric string @@ -256,7 +272,8 @@ function is_real (mixed $var) {} * string, false otherwise. */ #[Pure] -function is_numeric (mixed $value) {} +function is_numeric (mixed $value): bool +{} /** * Find whether the type of a variable is string @@ -268,7 +285,8 @@ function is_numeric (mixed $value) {} * false otherwise. */ #[Pure] -function is_string (mixed $value) {} +function is_string (mixed $value): bool +{} /** * Finds whether a variable is an array @@ -280,7 +298,8 @@ function is_string (mixed $value) {} * false otherwise. */ #[Pure] -function is_array (mixed $value) {} +function is_array (mixed $value): bool +{} /** * Finds whether a variable is an object @@ -292,7 +311,8 @@ function is_array (mixed $value) {} * Since 7.2.0 returns true for unserialized objects without a class definition (class of __PHP_Incomplete_Class). */ #[Pure] -function is_object (mixed $value) {} +function is_object (mixed $value): bool +{} /** * Finds whether a variable is a scalar @@ -304,7 +324,8 @@ function is_object (mixed $value) {} * otherwise. */ #[Pure] -function is_scalar (mixed $value) {} +function is_scalar (mixed $value): bool +{} /** * Verify that the contents of a variable can be called as a function @@ -329,7 +350,7 @@ function is_scalar (mixed $value) {} * @return bool TRUE if $var is callable, FALSE * otherwise. */ -function is_callable (mixed $value, bool $syntax_only, &$callable_name) +function is_callable (mixed $value, bool $syntax_only, &$callable_name): bool {} /** @@ -341,7 +362,8 @@ function is_callable (mixed $value, bool $syntax_only, &$callable_name) * @since 7.3 */ #[Pure] -function is_countable(mixed $value) {} +function is_countable(mixed $value): bool +{} /** * Closes process file pointer @@ -355,7 +377,8 @@ function is_countable(mixed $value) {} *

    * If PHP has been compiled with --enable-sigchild, the return value of this function is undefined. */ -function pclose ($handle) {} +function pclose ($handle): int +{} /** * Opens process file pointer @@ -376,7 +399,8 @@ function pclose ($handle) {} *

    * If an error occurs, returns false. */ -function popen (string $command, string $mode) {} +function popen (string $command, string $mode) +{} /** * Outputs a file @@ -393,7 +417,7 @@ function popen (string $command, string $mode) {} *

    * @return false|int the number of bytes read from the file, or FALSE on failure */ -function readfile (string $filename, bool $use_include_path, $context) +function readfile (string $filename, bool $use_include_path, $context): int|false {} /** @@ -405,7 +429,8 @@ function readfile (string $filename, bool $use_include_path, $context) *

    * @return bool true on success or false on failure. */ -function rewind ($stream) {} +function rewind ($stream): bool +{} /** * Removes directory @@ -416,7 +441,8 @@ function rewind ($stream) {} * @param resource $context [optional] ¬e.context-support; * @return bool true on success or false on failure. */ -function rmdir (string $directory, $context) {} +function rmdir (string $directory, $context): bool +{} /** * Changes the current umask @@ -427,7 +453,8 @@ function rmdir (string $directory, $context) {} * @return int umask without arguments simply returns the * current umask otherwise the old umask is returned. */ -function umask (int $mask) {} +function umask (int $mask): int +{} /** * Closes an open file pointer @@ -438,7 +465,8 @@ function umask (int $mask) {} *

    * @return bool true on success or false on failure. */ -function fclose ($stream) {} +function fclose ($stream): bool +{} /** * Tests for end-of-file on a file pointer @@ -447,7 +475,8 @@ function fclose ($stream) {} * @return bool true if the file pointer is at EOF or an error occurs * (including socket timeout); otherwise returns false. */ -function feof ($stream) {} +function feof ($stream): bool +{} /** * Gets character from file pointer @@ -456,7 +485,8 @@ function feof ($stream) {} * @return string|false a string containing a single character read from the file pointed * to by handle. Returns false on EOF. */ -function fgetc ($stream) {} +function fgetc ($stream): string|false +{} /** * Gets line from file pointer @@ -480,7 +510,8 @@ function fgetc ($stream) {} *

    * If an error occurs, returns false. */ -function fgets ($stream, int $length) {} +function fgets ($stream, int $length): string|false +{} /** * Gets line from file pointer and strip HTML tags @@ -502,7 +533,8 @@ function fgets ($stream, int $length) {} * @removed 8.0 */ #[Deprecated(since: '7.3')] -function fgetss ($handle, int $length = null, $allowable_tags = null) {} +function fgetss ($handle, int $length = null, $allowable_tags = null): bool|string +{} /** * Binary-safe file read @@ -513,7 +545,8 @@ function fgetss ($handle, int $length = null, $allowable_tags = null) {} *

    * @return string|false the read string or false on failure. */ -function fread ($stream, int $length) {} +function fread ($stream, int $length): string|false +{} /** * Opens file or URL @@ -696,7 +729,8 @@ function fread ($stream, int $length) {} * @param resource $context [optional] ¬e.context-support; * @return resource|false a file pointer resource on success, or false on error. */ -function fopen (string $filename, string $mode, bool $use_include_path = false, $context) {} +function fopen (string $filename, string $mode, bool $use_include_path = false, $context) +{} /** * Output all remaining data on a file pointer @@ -707,7 +741,9 @@ function fopen (string $filename, string $mode, bool $use_include_path = false, * the number of characters read from handle * and passed through to the output. */ -function fpassthru ($stream) {} +#[LanguageLevelTypeAware(["8.0" => "int"], default: "int|false")] +function fpassthru ($stream) +{} /** * Truncates a file to a given length @@ -731,16 +767,18 @@ function fpassthru ($stream) {} *

    * @return bool true on success or false on failure. */ -function ftruncate ($stream, int $size) {} +function ftruncate ($stream, int $size): bool +{} /** * Gets information about a file using an open file pointer * @link https://php.net/manual/en/function.fstat.php * @param resource $stream &fs.file.pointer; - * @return array an array with the statistics of the file; the format of the array + * @return array|false an array with the statistics of the file; the format of the array * is described in detail on the stat manual page. */ -function fstat ($stream) {} +function fstat ($stream): array|false +{} /** * Seeks on a file pointer @@ -768,7 +806,8 @@ function fstat ($stream) {} * @return int Upon success, returns 0; otherwise, returns -1. Note that seeking * past EOF is not considered an error. */ -function fseek ($stream, int $offset, int $whence = SEEK_SET) {} +function fseek ($stream, int $offset, int $whence = SEEK_SET): int +{} /** * Returns the current position of the file read/write pointer @@ -785,7 +824,8 @@ function fseek ($stream, int $offset, int $whence = SEEK_SET) {} *

    * If an error occurs, returns false. */ -function ftell ($stream) {} +function ftell ($stream): int|false +{} /** * Flushes the output to a file @@ -793,7 +833,8 @@ function ftell ($stream) {} * @param resource $stream The file pointer must be valid, and must point to a file successfully opened by fopen() or fsockopen() (and not yet closed by fclose()). * @return bool true on success or false on failure. */ -function fflush ($stream) {} +function fflush ($stream): bool +{} /** * Binary-safe file write @@ -816,7 +857,7 @@ function fflush ($stream) {} *

    * @return int|false the number of bytes written, or FALSE on error. */ -function fwrite ($stream, string $data, int $length) +function fwrite ($stream, string $data, int $length): int|false {} /** @@ -842,7 +883,7 @@ function fwrite ($stream, string $data, int $length) * @link https://php.net/manual/en/function.fputs.php * Binary-safe file write */ -function fputs ($stream, string $data, int $length) +function fputs ($stream, string $data, int $length): int|false {} /** @@ -871,7 +912,8 @@ function fputs ($stream, string $data, int $length) * @param resource $context [optional] ¬e.context-support; * @return bool true on success or false on failure. */ -function mkdir (string $directory, int $permissions = 0777, bool $recursive = false, $context) {} +function mkdir (string $directory, int $permissions = 0777, bool $recursive = false, $context): bool +{} /** * Renames a file or directory @@ -889,7 +931,8 @@ function mkdir (string $directory, int $permissions = 0777, bool $recursive = fa * @param resource $context [optional] ¬e.context-support; * @return bool true on success or false on failure. */ -function rename (string $from, string $to, $context) {} +function rename (string $from, string $to, $context): bool +{} /** * Copies file @@ -911,7 +954,7 @@ function rename (string $from, string $to, $context) {} *

    * @return bool true on success or false on failure. */ -function copy (string $from, string $to, $context) +function copy (string $from, string $to, $context): bool {} /** @@ -927,7 +970,8 @@ function copy (string $from, string $to, $context) * @return string|false the new temporary filename, or false on * failure. */ -function tempnam (string $directory, string $prefix) {} +function tempnam (string $directory, string $prefix): string|false +{} /** * Creates a temporary file @@ -935,7 +979,8 @@ function tempnam (string $directory, string $prefix) {} * @return resource|false a file handle, similar to the one returned by * fopen, for the new file or false on failure. */ -function tmpfile () {} +function tmpfile () +{} /** * Reads entire file into an array @@ -966,7 +1011,7 @@ function tmpfile () {} * use rtrim if you do not want the line ending * present. */ -function file (string $filename, int $flags, $context) +function file (string $filename, int $flags, $context): array|false {} /** @@ -993,7 +1038,7 @@ function file (string $filename, int $flags, $context) *

    * @return string|false The function returns the read data or false on failure. */ -function file_get_contents (string $filename, bool $use_include_path = false, $context, int $offset = 0, int $length) +function file_get_contents (string $filename, bool $use_include_path = false, $context, int $offset = 0, int $length): string|false {} /** @@ -1067,5 +1112,5 @@ function file_get_contents (string $filename, bool $use_include_path = false, $c * @return int|false The function returns the number of bytes that were written to the file, or * false on failure. */ -function file_put_contents (string $filename, mixed $data, int $flags = 0, $context) +function file_put_contents (string $filename, mixed $data, int $flags = 0, $context): int|false {} diff --git a/standard/standard_6.php b/standard/standard_6.php index 90b5e2338..3c04a1f10 100644 --- a/standard/standard_6.php +++ b/standard/standard_6.php @@ -71,13 +71,13 @@ * @param int $microseconds [optional]

    * See tv_sec description. *

    - * @return int On success stream_select returns the number of + * @return int|false On success stream_select returns the number of * stream resources contained in the modified arrays, which may be zero if * the timeout expires before anything interesting happens. On error false * is returned and a warning raised (this can happen if the system call is * interrupted by an incoming signal). */ -function stream_select (array &$read, array &$write, array &$except, int $seconds, int $microseconds) +function stream_select (array &$read, array &$write, array &$except, int $seconds, int $microseconds): int|false {} /** @@ -115,7 +115,8 @@ function stream_context_create (array $options, array $params) {} *

    * @return bool true on success or false on failure. */ -function stream_context_set_params ($context, array $params) {} +function stream_context_set_params ($context, array $params): bool +{} /** * Retrieves parameters from a context @@ -126,7 +127,8 @@ function stream_context_set_params ($context, array $params) {} *

    * @return array an associate array containing all context options and parameters. */ -function stream_context_get_params ($context) {} +function stream_context_get_params ($context): array +{} /** * Sets an option for a stream/wrapper/context @@ -139,7 +141,8 @@ function stream_context_get_params ($context) {} * @param mixed $value * @return bool true on success or false on failure. */ -function stream_context_set_option ($context, string $wrapper_or_options, string $option_name, mixed $value) {} +function stream_context_set_option ($context, string $wrapper_or_options, string $option_name, mixed $value): bool +{} /** * Sets an option for a stream/wrapper/context @@ -148,7 +151,8 @@ function stream_context_set_option ($context, string $wrapper_or_options, string * @param array $options The options to set for the default context. * @return bool true on success or false on failure. */ -function stream_context_set_option ($stream_or_context, array $options) {} +function stream_context_set_option ($stream_or_context, array $options): bool +{} /** * Retrieve options for a stream/wrapper/context @@ -158,7 +162,8 @@ function stream_context_set_option ($stream_or_context, array $options) {} *

    * @return array an associative array with the options. */ -function stream_context_get_options ($stream_or_context) {} +function stream_context_get_options ($stream_or_context): array +{} /** * Retreive the default stream context @@ -268,7 +273,8 @@ function stream_filter_append ($stream, string $filter_name, int $mode, mixed $p *

    * @return bool true on success or false on failure. */ -function stream_filter_remove ($stream_filter) {} +function stream_filter_remove ($stream_filter): bool +{} /** * Open Internet or Unix domain socket connection @@ -310,7 +316,8 @@ function stream_filter_remove ($stream_filter) {} * fwrite, fclose, and * feof), false on failure. */ -function stream_socket_client (string $address, &$error_code, &$error_message, float $timeout, int $flags, $context) {} +function stream_socket_client (string $address, &$error_code, &$error_message, float $timeout, int $flags, $context) +{} /** * Create an Internet or Unix domain server socket @@ -360,7 +367,8 @@ function stream_socket_client (string $address, &$error_code, &$error_message, f *

    * @return resource|false the created stream, or false on error. */ -function stream_socket_server (string $address, &$error_code, &$error_message, int $flags, $context) {} +function stream_socket_server (string $address, &$error_code, &$error_message, int $flags, $context) +{} /** * Accept a connection on a socket created by {@see stream_socket_server} @@ -380,7 +388,8 @@ function stream_socket_server (string $address, &$error_code, &$error_message, i *

    * @return resource|false Returns a stream to the accepted socket connection or FALSE on failure. */ -function stream_socket_accept ($socket, float $timeout, &$peer_name) {} +function stream_socket_accept ($socket, float $timeout, &$peer_name) +{} /** * Retrieve the name of the local or remote sockets @@ -394,7 +403,8 @@ function stream_socket_accept ($socket, float $timeout, &$peer_name) {} *

    * @return string|false The name of the socket or false on error. */ -function stream_socket_get_name ($socket, bool $remote) {} +function stream_socket_get_name ($socket, bool $remote): string|false +{} /** * Receives data from a socket, connected or not @@ -433,7 +443,7 @@ function stream_socket_get_name ($socket, bool $remote) {} *

    * @return string|false the read data, as a string, or false on error */ -function stream_socket_recvfrom ($socket, int $length, int $flags, &$address) +function stream_socket_recvfrom ($socket, int $length, int $flags, &$address): string|false {} /** @@ -467,7 +477,7 @@ function stream_socket_recvfrom ($socket, int $length, int $flags, &$address) *

    * @return int|false a result code, as an integer. */ -function stream_socket_sendto ($socket, string $data, int $flags, string $address) +function stream_socket_sendto ($socket, string $data, int $flags, string $address): int|false {} /** @@ -490,7 +500,7 @@ function stream_socket_sendto ($socket, string $data, int $flags, string $addres * 0 if there isn't enough data and you should try again * (only for non-blocking sockets). */ -function stream_socket_enable_crypto ($stream, bool $enable, int $crypto_method, $session_stream) +function stream_socket_enable_crypto ($stream, bool $enable, int $crypto_method, $session_stream): int|bool {} /** @@ -510,7 +520,8 @@ function stream_socket_enable_crypto ($stream, bool $enable, int $crypto_method, * @return bool true on success or false on failure. * @since 5.2.1 */ -function stream_socket_shutdown ($stream, int $mode) {} +function stream_socket_shutdown ($stream, int $mode): bool +{} /** * Creates a pair of connected, indistinguishable socket streams @@ -538,7 +549,8 @@ function stream_socket_shutdown ($stream, int $mode) {} * @return array|false an array with the two socket resources on success, or * false on failure. */ -function stream_socket_pair (int $domain, int $type, int $protocol) {} +function stream_socket_pair (int $domain, int $type, int $protocol): array|false +{} /** * Copies data from one stream to another @@ -557,7 +569,8 @@ function stream_socket_pair (int $domain, int $type, int $protocol) {} *

    * @return int|false the total count of bytes copied, or false on failure. */ -function stream_copy_to_stream ($from, $to, int $length, int $offset) {} +function stream_copy_to_stream ($from, $to, int $length, int $offset): int|false +{} /** * Reads remainder of a stream into a string @@ -574,7 +587,8 @@ function stream_copy_to_stream ($from, $to, int $length, int $offset) {} *

    * @return string|false a string or false on failure. */ -function stream_get_contents ($stream, int $length = -1, int $offset = -1) {} +function stream_get_contents ($stream, int $length = -1, int $offset = -1): string|false +{} /** * Tells whether the stream supports locking. @@ -584,7 +598,8 @@ function stream_get_contents ($stream, int $length = -1, int $offset = -1) {} *

    * @return bool true on success or false on failure. */ -function stream_supports_lock ($stream) {} +function stream_supports_lock ($stream): bool +{} /** * Gets line from file pointer and parse for CSV fields @@ -610,7 +625,7 @@ function stream_supports_lock ($stream) {} * @param string $escape [optional]

    * Set the escape character (one character only). Defaults as a backslash. *

    - * @return array|null|false an indexed array containing the fields read. + * @return array|false an indexed array containing the fields read. *

    *

    * A blank line in a CSV file will be returned as an array @@ -623,7 +638,8 @@ function stream_supports_lock ($stream) {} * handle is supplied or false on other errors, * including end of file. */ -function fgetcsv ($stream, int $length = 0, string $separator = ',', string $enclosure = '"', string $escape = '\\') {} +function fgetcsv ($stream, int $length = 0, string $separator = ',', string $enclosure = '"', string $escape = '\\'): array|false +{} /** * Format line as CSV and write to file pointer @@ -643,7 +659,8 @@ function fgetcsv ($stream, int $length = 0, string $separator = ',', string $enc * @param string $escape The optional escape_char parameter sets the escape character (one character only). * @return int|false the length of the written string or false on failure. */ -function fputcsv ($stream, array $fields, string $separator = ",", string $enclosure = '"', string $escape = "\\") {} +function fputcsv ($stream, array $fields, string $separator = ",", string $enclosure = '"', string $escape = "\\"): int|false +{} /** * Portable advisory file locking @@ -660,7 +677,7 @@ function fputcsv ($stream, array $fields, string $separator = ",", string $enclo *

    * @return bool true on success or false on failure. */ -function flock ($stream, int $operation, &$would_block) +function flock ($stream, int $operation, &$would_block): bool {} /** @@ -690,7 +707,7 @@ function flock ($stream, int $operation, &$would_block) * the include_path directive. * This is used for local files, not URLs. *

    - * @return array an array with all the parsed meta tags. + * @return array|false an array with all the parsed meta tags. *

    *

    * The value of the name property becomes the key, the value of the content @@ -701,7 +718,7 @@ function flock ($stream, int $operation, &$would_block) * name, only the last one is returned. */ #[Pure] -function get_meta_tags (string $filename, bool $use_include_path) +function get_meta_tags (string $filename, bool $use_include_path): array|false {} /** @@ -719,7 +736,8 @@ function get_meta_tags (string $filename, bool $use_include_path) * @return int 0 on success, or EOF if the request cannot be honored. * @see stream_set_read_buffer() */ -function stream_set_write_buffer ($stream, int $size) {} +function stream_set_write_buffer ($stream, int $size): int +{} /** * Sets read file buffering on the given stream @@ -736,7 +754,8 @@ function stream_set_write_buffer ($stream, int $size) {} * @return int 0 on success, or EOF if the request cannot be honored. * @see stream_set_write_buffer() */ -function stream_set_read_buffer ($stream, int $size) {} +function stream_set_read_buffer ($stream, int $size): int +{} /** * &Alias; stream_set_write_buffer @@ -750,7 +769,8 @@ function stream_set_read_buffer ($stream, int $size) {} * This ensures that all writes with fwrite() are completed before other processes are allowed to write to that output stream. * @return int */ -function set_file_buffer ($stream, int $size) {} +function set_file_buffer ($stream, int $size): int +{} /** * &Alias; stream_set_blocking @@ -766,7 +786,8 @@ function set_file_buffer ($stream, int $size) {} * @see stream_set_blocking() */ #[Deprecated(replacement: "stream_set_blocking(%parametersList%)", since: 5.3)] -function set_socket_blocking ($socket, bool $mode) {} +function set_socket_blocking ($socket, bool $mode): bool +{} /** * Set blocking/non-blocking mode on a stream @@ -786,7 +807,8 @@ function set_socket_blocking ($socket, bool $mode) {} *

    * @return bool true on success or false on failure. */ -function stream_set_blocking ($stream, bool $enable) {} +function stream_set_blocking ($stream, bool $enable): bool +{} /** * &Alias; stream_set_blocking @@ -806,7 +828,8 @@ function stream_set_blocking ($stream, bool $enable) {} *

    * @return bool true on success or false on failure. */ -function socket_set_blocking ($stream, bool $enable) {} +function socket_set_blocking ($stream, bool $enable): bool +{} /** * Retrieves header/meta data from streams/file pointers @@ -884,7 +907,8 @@ function socket_set_blocking ($stream, bool $enable) {} "crypto" => "array", "mediatype" => "string", ])] -function stream_get_meta_data ($stream) {} +function stream_get_meta_data ($stream): array +{} /** * Gets line from stream resource up to a given delimiter @@ -904,7 +928,7 @@ function stream_get_meta_data ($stream) {} *

    * If an error occurs, returns false. */ -function stream_get_line ($stream, int $length, string $ending) +function stream_get_line ($stream, int $length, string $ending): string|false {} /** @@ -927,7 +951,7 @@ function stream_get_line ($stream, int $length, string $ending) * stream_wrapper_register will return false if the * protocol already has a handler. */ -function stream_wrapper_register (string $protocol, string $class, int $flags) +function stream_wrapper_register (string $protocol, string $class, int $flags): bool {} /** @@ -951,7 +975,8 @@ function stream_wrapper_register (string $protocol, string $class, int $flags) * stream_wrapper_register will return false if the * protocol already has a handler. */ -function stream_register_wrapper (string $protocol, string $class, int $flags = 0) {} +function stream_register_wrapper (string $protocol, string $class, int $flags = 0): bool +{} /** * Resolve filename against the include path according to the same rules as fopen()/include(). @@ -961,7 +986,8 @@ function stream_register_wrapper (string $protocol, string $class, int $flags = * @return string|false containing the resolved absolute filename, or FALSE on failure. * @since 5.3.2 */ -function stream_resolve_include_path (string $filename) {} +function stream_resolve_include_path (string $filename): string|false +{} /** * Unregister a URL wrapper @@ -970,7 +996,8 @@ function stream_resolve_include_path (string $filename) {} *

    * @return bool true on success or false on failure. */ -function stream_wrapper_unregister (string $protocol) {} +function stream_wrapper_unregister (string $protocol): bool +{} /** * Restores a previously unregistered built-in wrapper @@ -979,7 +1006,8 @@ function stream_wrapper_unregister (string $protocol) {} *

    * @return bool true on success or false on failure. */ -function stream_wrapper_restore (string $protocol) {} +function stream_wrapper_restore (string $protocol): bool +{} /** * Retrieve list of registered streams @@ -988,7 +1016,8 @@ function stream_wrapper_restore (string $protocol) {} * available on the running system. */ #[Pure] -function stream_get_wrappers () {} +function stream_get_wrappers (): array +{} /** * Retrieve list of registered socket transports @@ -996,7 +1025,8 @@ function stream_get_wrappers () {} * @return array an indexed array of socket transports names. */ #[Pure] -function stream_get_transports () {} +function stream_get_transports (): array +{} /** * Checks if a stream is a local stream @@ -1008,7 +1038,8 @@ function stream_get_transports () {} * @since 5.2.4 */ #[Pure] -function stream_is_local ($stream) {} +function stream_is_local ($stream): bool +{} /** * Fetches all the headers sent by the server in response to an HTTP request @@ -1026,7 +1057,7 @@ function stream_is_local ($stream) {} * failure. */ #[Pure] -function get_headers (string $url, bool $associative, $context) +function get_headers (string $url, bool $associative, $context): array|false {} /** @@ -1043,7 +1074,7 @@ function get_headers (string $url, bool $associative, $context) *

    * @return bool true on success or false on failure. */ -function stream_set_timeout ($stream, int $seconds, int $microseconds) +function stream_set_timeout ($stream, int $seconds, int $microseconds): bool {} /** @@ -1061,7 +1092,8 @@ function stream_set_timeout ($stream, int $seconds, int $microseconds) *

    * @return bool true on success or false on failure. */ -function socket_set_timeout ($stream, int $seconds, int $microseconds = 0) {} +function socket_set_timeout ($stream, int $seconds, int $microseconds = 0): bool +{} /** * &Alias; stream_get_meta_data @@ -1126,7 +1158,8 @@ function socket_set_timeout ($stream, int $seconds, int $microseconds = 0) {} * uri (string) - the URI/filename associated with this * stream. */ -function socket_get_status ($stream) {} +function socket_get_status ($stream): array +{} /** * Returns canonicalized absolute pathname @@ -1142,7 +1175,8 @@ function socket_get_status ($stream) {} * the file does not exist. */ #[Pure] -function realpath (string $path) {} +function realpath (string $path): string|false +{} /** * Match filename against a pattern @@ -1200,6 +1234,6 @@ function realpath (string $path) {} *

    * @return bool true if there is a match, false otherwise. */ -function fnmatch (string $pattern, string $filename, int $flags) +function fnmatch (string $pattern, string $filename, int $flags): bool {} ?> diff --git a/standard/standard_7.php b/standard/standard_7.php index 2318b280b..95c2f0678 100644 --- a/standard/standard_7.php +++ b/standard/standard_7.php @@ -46,7 +46,8 @@ * fwrite, fclose, and * feof). If the call fails, it will return false */ -function fsockopen (string $hostname, int $port, &$error_code, &$error_message, float $timeout) {} +function fsockopen (string $hostname, int $port, &$error_code, &$error_message, float $timeout) +{} /** * Open persistent Internet or Unix domain socket connection @@ -59,7 +60,8 @@ function fsockopen (string $hostname, int $port, &$error_code, &$error_message, * @param float $timeout [optional] * @return resource|false */ -function pfsockopen (string $hostname, int $port, &$error_code, &$error_message, float $timeout) {} +function pfsockopen (string $hostname, int $port, &$error_code, &$error_message, float $timeout) +{} /** * Pack data into binary string @@ -166,7 +168,9 @@ function pfsockopen (string $hostname, int $port, &$error_code, &$error_message, * @return string|false a binary string containing data or false if the format string contains errors */ #[Pure] -function pack (string $format, ...$values) {} +#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false")] +function pack (string $format, ...$values) +{} /** * Unpack data from binary string @@ -182,7 +186,8 @@ function pack (string $format, ...$values) {} * string or false if the format string contains errors */ #[Pure] -function unpack (string $format, string $string, int $offset = 0) {} +function unpack (string $format, string $string, int $offset = 0): array|false +{} /** * Tells what the user's browser is capable of @@ -212,7 +217,8 @@ function unpack (string $format, string $string, int $offset = 0) {} * reload, and check for the value. */ #[Pure] -function get_browser (string $user_agent, bool $return_array) {} +function get_browser (string $user_agent, bool $return_array): object|array|false +{} #[PhpStormStubsElementAvailable(to: '7.4')] /** @@ -234,7 +240,7 @@ function get_browser (string $user_agent, bool $return_array) {} * @return string|null the encrypted string or NULL if an error occurs */ #[Pure] -function crypt ($string, $salt = null) +function crypt ($string, $salt = null): ?string {} #[PhpStormStubsElementAvailable('8.0')] @@ -257,7 +263,8 @@ function crypt ($string, $salt = null) * @return string|null the encrypted string or NULL if an error occurs */ #[Pure] -function crypt (string $string, string $salt) {} +function crypt (string $string, string $salt): ?string +{} /** * Open directory handle @@ -297,7 +304,7 @@ function opendir (string $directory, $context) *

    * @return void */ -function closedir ($dir_handle) {} +function closedir ($dir_handle): void {} /** * Change directory @@ -307,7 +314,8 @@ function closedir ($dir_handle) {} *

    * @return bool true on success or false on failure. */ -function chdir (string $directory) {} +function chdir (string $directory): bool +{} /** * Change the root directory @@ -317,7 +325,8 @@ function chdir (string $directory) {} *

    * @return bool true on success or false on failure. */ -function chroot (string $directory) {} +function chroot (string $directory): bool +{} /** * Gets the current working directory @@ -334,7 +343,8 @@ function chroot (string $directory) {} *

    */ #[Pure] -function getcwd () {} +function getcwd (): string|false +{} /** * Rewind directory handle @@ -347,7 +357,7 @@ function getcwd () {} *

    * @return void */ -function rewinddir ($dir_handle) {} +function rewinddir ($dir_handle): void {} /** * Read entry from directory handle @@ -360,7 +370,8 @@ function rewinddir ($dir_handle) {} *

    * @return string|false the filename on success or false on failure. */ -function readdir ($dir_handle) {} +function readdir ($dir_handle): string|false +{} /** * Return an instance of the Directory class @@ -369,10 +380,11 @@ function readdir ($dir_handle) {} * Directory to open *

    * @param resource $context [optional] - * @return Directory|null|false an instance of Directory, or NULL with wrong + * @return Directory|false an instance of Directory, or NULL with wrong * parameters, or FALSE in case of another error */ -function dir (string $directory, $context) {} +function dir (string $directory, $context): Directory|false +{} /** * Alias of dir() @@ -381,7 +393,8 @@ function dir (string $directory, $context) {} * @return Directory|false * @see dir() */ -function getdir(string $directory, $context) {} +function getdir(string $directory, $context): Directory|false +{} /** * List files and directories inside the specified path @@ -404,7 +417,7 @@ function getdir(string $directory, $context) {} * boolean false is returned, and an error of level * E_WARNING is generated. */ -function scandir (string $directory, int $sorting_order, $context) +function scandir (string $directory, int $sorting_order, $context): array|false {} /** @@ -430,7 +443,7 @@ function scandir (string $directory, int $sorting_order, $context) * error. */ #[Pure] -function glob (string $pattern, int $flags) +function glob (string $pattern, int $flags): array|false {} /** @@ -443,7 +456,8 @@ function glob (string $pattern, int $flags) * The time is returned as a Unix timestamp. */ #[Pure] -function fileatime (string $filename) {} +function fileatime (string $filename): int|false +{} /** * Gets inode change time of file @@ -455,7 +469,8 @@ function fileatime (string $filename) {} * The time is returned as a Unix timestamp. */ #[Pure] -function filectime (string $filename) {} +function filectime (string $filename): int|false +{} /** * Gets file group @@ -469,7 +484,8 @@ function filectime (string $filename) {} * Upon failure, false is returned. */ #[Pure] -function filegroup (string $filename) {} +function filegroup (string $filename): int|false +{} /** * Gets file inode @@ -480,7 +496,8 @@ function filegroup (string $filename) {} * @return int|false the inode number of the file, or false on failure. */ #[Pure] -function fileinode (string $filename) {} +function fileinode (string $filename): int|false +{} /** * Gets file modification time @@ -493,7 +510,8 @@ function fileinode (string $filename) {} * suitable for the date function. */ #[Pure] -function filemtime (string $filename) {} +function filemtime (string $filename): int|false +{} /** * Gets file owner @@ -506,7 +524,8 @@ function filemtime (string $filename) {} * posix_getpwuid to resolve it to a username. */ #[Pure] -function fileowner (string $filename) {} +function fileowner (string $filename): int|false +{} /** * Gets file permissions @@ -517,7 +536,8 @@ function fileowner (string $filename) {} * @return int|false the permissions on the file, or false on failure. */ #[Pure] -function fileperms (string $filename) {} +function fileperms (string $filename): int|false +{} /** * Gets file size @@ -529,7 +549,8 @@ function fileperms (string $filename) {} * of level E_WARNING) in case of an error. */ #[Pure] -function filesize (string $filename) {} +function filesize (string $filename): int|false +{} /** * Gets file type @@ -546,7 +567,8 @@ function filesize (string $filename) {} * or if the file type is unknown. */ #[Pure] -function filetype (string $filename) {} +function filetype (string $filename): string|false +{} /** * Checks whether a file or directory exists @@ -575,7 +597,8 @@ function filetype (string $filename) {} * The check is done using the real UID/GID instead of the effective one. */ #[Pure] -function file_exists (string $filename) {} +function file_exists (string $filename): bool +{} /** * Tells whether the filename is writable @@ -587,7 +610,8 @@ function file_exists (string $filename) {} * writable. */ #[Pure] -function is_writable (string $filename) {} +function is_writable (string $filename): bool +{} /** * &Alias; is_writable @@ -599,7 +623,8 @@ function is_writable (string $filename) {} * writable. */ #[Pure] -function is_writeable (string $filename) {} +function is_writeable (string $filename): bool +{} /** * Tells whether a file or a directory exists and is readable @@ -611,7 +636,8 @@ function is_writeable (string $filename) {} * filename exists and is readable, false otherwise. */ #[Pure] -function is_readable (string $filename) {} +function is_readable (string $filename): bool +{} /** * Tells whether the filename is executable @@ -623,7 +649,8 @@ function is_readable (string $filename) {} * error. */ #[Pure] -function is_executable (string $filename) {} +function is_executable (string $filename): bool +{} /** * Tells whether the filename is a regular file @@ -635,7 +662,8 @@ function is_executable (string $filename) {} * otherwise. */ #[Pure] -function is_file (string $filename) {} +function is_file (string $filename): bool +{} /** * Tells whether the filename is a directory @@ -650,7 +678,8 @@ function is_file (string $filename) {} * otherwise. */ #[Pure] -function is_dir (string $filename) {} +function is_dir (string $filename): bool +{} /** * Tells whether the filename is a symbolic link @@ -662,7 +691,8 @@ function is_dir (string $filename) {} * otherwise. */ #[Pure] -function is_link (string $filename) {} +function is_link (string $filename): bool +{} /** * Gives information about a file @@ -754,7 +784,8 @@ function is_link (string $filename) {} * In case of error, stat returns false. */ #[Pure] -function stat (string $filename) {} +function stat (string $filename): array|false +{} /** * Gives information about a file or symbolic link @@ -771,7 +802,8 @@ function stat (string $filename) {} * file pointed to by the symbolic link. */ #[Pure] -function lstat (string $filename) {} +function lstat (string $filename): array|false +{} /** * Changes file owner @@ -784,7 +816,8 @@ function lstat (string $filename) {} *

    * @return bool true on success or false on failure. */ -function chown (string $filename, string|int $user) {} +function chown (string $filename, string|int $user): bool +{} /** * Changes file group @@ -797,7 +830,8 @@ function chown (string $filename, string|int $user) {} *

    * @return bool true on success or false on failure. */ -function chgrp (string $filename, string|int $group) {} +function chgrp (string $filename, string|int $group): bool +{} /** * Changes user ownership of symlink @@ -811,7 +845,8 @@ function chgrp (string $filename, string|int $group) {} * @return bool true on success or false on failure. * @since 5.1.2 */ -function lchown (string $filename, string|int $user) {} +function lchown (string $filename, string|int $user): bool +{} /** * Changes group ownership of symlink @@ -825,7 +860,8 @@ function lchown (string $filename, string|int $user) {} * @return bool true on success or false on failure. * @since 5.1.2 */ -function lchgrp (string $filename, string|int $group) {} +function lchgrp (string $filename, string|int $group): bool +{} /** * Changes file mode @@ -861,7 +897,8 @@ function lchgrp (string $filename, string|int $group) {} *

    * @return bool true on success or false on failure. */ -function chmod (string $filename, int $permissions) {} +function chmod (string $filename, int $permissions): bool +{} /** * Sets access and modification time of file @@ -880,7 +917,7 @@ function chmod (string $filename, int $permissions) {} *

    * @return bool true on success or false on failure. */ -function touch (string $filename, int $mtime, int $atime) +function touch (string $filename, int $mtime, int $atime): bool {} /** @@ -895,7 +932,7 @@ function touch (string $filename, int $mtime, int $atime) *

    * @return void */ -function clearstatcache (bool $clear_realpath_cache, string $filename) {} +function clearstatcache (bool $clear_realpath_cache, string $filename): void {} /** * Returns the total size of a filesystem or disk partition @@ -906,7 +943,8 @@ function clearstatcache (bool $clear_realpath_cache, string $filename) {} * @return float|false the total number of bytes as a float * or false on failure. */ -function disk_total_space (string $directory) {} +function disk_total_space (string $directory): float|false +{} /** * Returns available space in directory @@ -923,7 +961,8 @@ function disk_total_space (string $directory) {} * or false on failure. */ #[Pure] -function disk_free_space (string $directory) {} +function disk_free_space (string $directory): float|false +{} /** * Alias of {@see disk_free_space} @@ -933,7 +972,8 @@ function disk_free_space (string $directory) {} * @return float|false */ #[Pure] -function diskfreespace (string $directory) {} +function diskfreespace (string $directory): float|false +{} /** * Send mail @@ -1021,7 +1061,7 @@ function diskfreespace (string $directory) {} * It is important to note that just because the mail was accepted for delivery, * it does NOT mean the mail will actually reach the intended destination. */ -function mail (string $to, string $subject, string $message, array|string $additional_headers, string $additional_params) +function mail (string $to, string $subject, string $message, array|string $additional_headers, string $additional_params): bool {} /** @@ -1034,7 +1074,8 @@ function mail (string $to, string $subject, string $message, array|string $addit * @removed 8.0 */ #[Deprecated(since: '7.4')] -function ezmlm_hash (string $addr) {} +function ezmlm_hash (string $addr): int +{} /** * Open connection to system logger @@ -1156,6 +1197,7 @@ function ezmlm_hash (string $addr) {} *

    * @return bool true on success or false on failure. */ -function openlog (string $prefix, int $flags, int $facility) {} +function openlog (string $prefix, int $flags, int $facility): bool +{} ?> diff --git a/standard/standard_8.php b/standard/standard_8.php index ca5801c0c..aec6b8706 100644 --- a/standard/standard_8.php +++ b/standard/standard_8.php @@ -58,14 +58,16 @@ *

    * @return bool true on success or false on failure. */ -function syslog (int $priority, string $message) {} +function syslog (int $priority, string $message): bool +{} /** * Close connection to system logger * @link https://php.net/manual/en/function.closelog.php * @return bool true on success or false on failure. */ -function closelog () {} +function closelog (): bool +{} /** * Registers a function that will be called when PHP starts sending output. @@ -75,7 +77,8 @@ function closelog () {} * @param callable $callback Function called just before the headers are sent. * @return bool true on success or false on failure. */ -function header_register_callback ( callable $callback ) {} +function header_register_callback ( callable $callback ): bool +{} /** * Get the size of an image from a string. @@ -97,7 +100,7 @@ function header_register_callback ( callable $callback ) {} * @link https://secure.php.net/manual/en/function.getimagesizefromstring.php * @since 5.4 */ -function getimagesizefromstring (string $string , &$image_info) +function getimagesizefromstring (string $string , &$image_info): array|false {} /** @@ -109,6 +112,7 @@ function getimagesizefromstring (string $string , &$image_info) * @link https://secure.php.net/manual/en/function.stream-set-chunk-size.php * @since 5.4 */ +#[LanguageLevelTypeAware(["8.0" => "int"], default: "int|false")] function stream_set_chunk_size ($stream , int $size) {} @@ -126,7 +130,8 @@ function define_syslog_variables () {} * @link https://php.net/manual/en/function.lcg-value.php * @return float A pseudo random float value in the range of (0, 1) */ -function lcg_value () {} +function lcg_value (): float +{} /** * Calculate the metaphone key of a string @@ -141,7 +146,9 @@ function lcg_value () {} * @return string|false the metaphone key as a string, or FALSE on failure */ #[Pure] -function metaphone (string $string, int $max_phonemes = 0) {} +#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false")] +function metaphone (string $string, int $max_phonemes = 0): bool|string +{} /** * Turn on output buffering @@ -208,21 +215,22 @@ function metaphone (string $string, int $max_phonemes = 0) {} *

    * @return bool true on success or false on failure. */ -function ob_start ($callback, int $chunk_size, int $flags = PHP_OUTPUT_HANDLER_STDFLAGS) {} +function ob_start ($callback, int $chunk_size, int $flags = PHP_OUTPUT_HANDLER_STDFLAGS): bool +{} /** * Flush (send) the output buffer * @link https://php.net/manual/en/function.ob-flush.php - * @return void + * @return bool */ -function ob_flush () {} +function ob_flush (): bool {} /** * Clean (erase) the output buffer * @link https://php.net/manual/en/function.ob-clean.php - * @return void + * @return bool */ -function ob_clean () {} +function ob_clean (): bool {} /** * Flush (send) the output buffer and turn off output buffering @@ -231,7 +239,8 @@ function ob_clean () {} * function without an active buffer or that for some reason a buffer could * not be deleted (possible for special buffer). */ -function ob_end_flush () {} +function ob_end_flush (): bool +{} /** * Clean (erase) the output buffer and turn off output buffering @@ -240,14 +249,16 @@ function ob_end_flush () {} * function without an active buffer or that for some reason a buffer could * not be deleted (possible for special buffer). */ -function ob_end_clean () {} +function ob_end_clean (): bool +{} /** * Flush the output buffer, return it as a string and turn off output buffering * @link https://php.net/manual/en/function.ob-get-flush.php * @return string|false the output buffer or false if no buffering is active. */ -function ob_get_flush () {} +function ob_get_flush (): string|false +{} /** * Get current buffer contents and delete current output buffer @@ -255,7 +266,8 @@ function ob_get_flush () {} * @return string|false the contents of the output buffer and end output buffering. * If output buffering isn't active then false is returned. */ -function ob_get_clean () {} +function ob_get_clean (): string|false +{} /** * Return the length of the output buffer @@ -263,7 +275,8 @@ function ob_get_clean () {} * @return int|false the length of the output buffer contents or false if no * buffering is active. */ -function ob_get_length () {} +function ob_get_length (): int|false +{} /** * Return the nesting level of the output buffering mechanism @@ -271,7 +284,8 @@ function ob_get_length () {} * @return int the level of nested output buffering handlers or zero if output * buffering is not active. */ -function ob_get_level () {} +function ob_get_level (): int +{} /** * Get status of output buffers @@ -342,7 +356,8 @@ function ob_get_level () {} * blocksize... * */ -function ob_get_status (bool $full_status) {} +function ob_get_status (bool $full_status): array +{} /** * Return the contents of the output buffer @@ -350,7 +365,8 @@ function ob_get_status (bool $full_status) {} * @return string|false This will return the contents of the output buffer or false, if output * buffering isn't active. */ -function ob_get_contents () {} +function ob_get_contents (): string|false +{} /** * Turn implicit flush on/off @@ -360,7 +376,7 @@ function ob_get_contents () {} *

    * @return void */ -function ob_implicit_flush (bool $enable = true) {} +function ob_implicit_flush (bool $enable = true): void {} /** * List all output handlers in use @@ -371,7 +387,8 @@ function ob_implicit_flush (bool $enable = true) {} * ob_list_handlers will return "default output * handler". */ -function ob_list_handlers () {} +function ob_list_handlers (): array +{} /** * Sort an array by key @@ -386,7 +403,8 @@ function ob_list_handlers () {} *

    * @return bool true on success or false on failure. */ -function ksort (array &$array, int $flags) {} +function ksort (array &$array, int $flags): bool +{} /** * Sort an array by key in reverse order @@ -401,7 +419,8 @@ function ksort (array &$array, int $flags) {} *

    * @return bool true on success or false on failure. */ -function krsort (array &$array, int $flags) {} +function krsort (array &$array, int $flags): bool +{} /** * Sort an array using a "natural order" algorithm @@ -411,7 +430,8 @@ function krsort (array &$array, int $flags) {} *

    * @return bool true on success or false on failure. */ -function natsort (array &$array) {} +function natsort (array &$array): bool +{} /** * Sort an array using a case insensitive "natural order" algorithm @@ -421,7 +441,8 @@ function natsort (array &$array) {} *

    * @return bool true on success or false on failure. */ -function natcasesort (array &$array) {} +function natcasesort (array &$array): bool +{} /** * Sort an array and maintain index association @@ -436,7 +457,8 @@ function natcasesort (array &$array) {} *

    * @return bool true on success or false on failure. */ -function asort (array &$array, int $flags) {} +function asort (array &$array, int $flags): bool +{} /** * Sort an array in reverse order and maintain index association @@ -451,7 +473,8 @@ function asort (array &$array, int $flags) {} *

    * @return bool true on success or false on failure. */ -function arsort (array &$array, int $flags) {} +function arsort (array &$array, int $flags): bool +{} /** * Sort an array @@ -469,7 +492,8 @@ function arsort (array &$array, int $flags) {} * (don't change types) * @return bool true on success or false on failure. */ -function sort (array &$array, int $flags) {} +function sort (array &$array, int $flags): bool +{} /** * Sort an array in reverse order @@ -484,7 +508,8 @@ function sort (array &$array, int $flags) {} *

    * @return bool true on success or false on failure. */ -function rsort (array &$array, int $flags) {} +function rsort (array &$array, int $flags): bool +{} /** * Sort an array by values using a user-defined comparison function @@ -499,7 +524,8 @@ function rsort (array &$array, int $flags) {} *

    * @return bool true on success or false on failure. */ -function usort (array &$array, callable $callback) {} +function usort (array &$array, callable $callback): bool +{} /** * Sort an array with a user-defined comparison function and maintain index association @@ -513,7 +539,8 @@ function usort (array &$array, callable $callback) {} *

    * @return bool true on success or false on failure. */ -function uasort (array &$array, callable $callback) {} +function uasort (array &$array, callable $callback): bool +{} /** * Sort an array by keys using a user-defined comparison function @@ -534,7 +561,8 @@ function uasort (array &$array, callable $callback) {} *

    * @return bool true on success or false on failure. */ -function uksort (array &$array, callable $callback) {} +function uksort (array &$array, callable $callback): bool +{} /** * Shuffle an array @@ -544,7 +572,8 @@ function uksort (array &$array, callable $callback) {} *

    * @return bool true on success or false on failure. */ -function shuffle (array &$array) {} +function shuffle (array &$array): bool +{} /** * Apply a user function to every member of an array @@ -578,7 +607,7 @@ function shuffle (array &$array) {} *

    * @return bool true on success or false on failure. */ -function array_walk (object|array &$array, callable $callback, mixed $arg) +function array_walk (object|array &$array, callable $callback, mixed $arg): bool {} /** @@ -607,7 +636,7 @@ function array_walk (object|array &$array, callable $callback, mixed $arg) *

    * @return bool true on success or false on failure. */ -function array_walk_recursive (object|array &$array, callable $callback, mixed $arg) +function array_walk_recursive (object|array &$array, callable $callback, mixed $arg): bool {} /** @@ -638,7 +667,8 @@ function array_walk_recursive (object|array &$array, callable $callback, mixed $ * empty array. Use isset to test if a variable is set. */ #[Pure] -function count (Countable|array $value, int $mode = COUNT_NORMAL) {} +function count (Countable|array $value, int $mode = COUNT_NORMAL): int +{} /** * Set the internal pointer of an array to its last element @@ -649,10 +679,10 @@ function count (Countable|array $value, int $mode = COUNT_NORMAL) {} * a function returning an array because only actual variables may be * passed by reference. *

    - * @return mixed|false the value of the last element or false for empty array. + * @return mixed the value of the last element or false for empty array. * @meta */ -function end (object|array &$array) {} +function end (object|array &$array): mixed {} /** * Rewind the internal array pointer @@ -665,7 +695,7 @@ function end (object|array &$array) {} * elements. * @meta */ -function prev (object|array &$array) {} +function prev (object|array &$array): mixed {} /** * Advance the internal array pointer of an array @@ -677,7 +707,7 @@ function prev (object|array &$array) {} * internal array pointer, or false if there are no more elements. * @meta */ -function next (object|array &$array) {} +function next (object|array &$array): mixed {} /** * Set the internal pointer of an array to its first element @@ -685,11 +715,11 @@ function next (object|array &$array) {} * @param ArrayAccess|array &$array

    * The input array. *

    - * @return mixed|false the value of the first array element, or false if the array is + * @return mixed the value of the first array element, or false if the array is * empty. * @meta */ -function reset (object|array &$array) {} +function reset (object|array &$array): mixed {} /** * Return the current element in an array @@ -705,7 +735,7 @@ function reset (object|array &$array) {} * @meta */ #[Pure] -function current (object|array $array) {} +function current (object|array $array): mixed {} /** * Fetch a key from an array @@ -720,7 +750,8 @@ function current (object|array $array) {} * empty, key returns null. */ #[Pure] -function key (object|array $array) {} +function key (object|array $array): string|int|null +{} /** * Find lowest value @@ -731,7 +762,8 @@ function key (object|array $array) {} * parameter values. */ #[Pure] -function min (mixed $value, mixed ...$values) {} +function min (mixed $value, mixed ...$values): mixed +{} /** * Find highest value @@ -742,7 +774,8 @@ function min (mixed $value, mixed ...$values) {} * parameter values, either within a arg array or two arguments. */ #[Pure] -function max (mixed $value, mixed ...$values) {} +function max (mixed $value, mixed ...$values): mixed +{} /** * Checks if a value exists in an array @@ -767,7 +800,8 @@ function max (mixed $value, mixed ...$values) {} * false otherwise. */ #[Pure] -function in_array (mixed $needle, array $haystack, bool $strict = false) {} +function in_array (mixed $needle, array $haystack, bool $strict = false): bool +{} /** * Searches the array for a given value and returns the first corresponding key if successful @@ -798,7 +832,7 @@ function in_array (mixed $needle, array $haystack, bool $strict = false) {} * search_value parameter instead. */ #[Pure] -function array_search (mixed $needle, array $haystack, bool $strict) +function array_search (mixed $needle, array $haystack, bool $strict): string|int|false {} /** @@ -827,7 +861,8 @@ function array_search (mixed $needle, array $haystack, bool $strict) * @return int the number of variables successfully imported into the symbol * table. */ -function extract (array $array, int $flags, string $prefix) {} +function extract (array $array, int $flags, string $prefix): int +{} /** * Create array containing variables and their values @@ -843,7 +878,8 @@ function extract (array $array, int $flags, string $prefix) {} * @return array the output array with all the variables added to it. */ #[Pure] -function compact (mixed $var_name, ...$var_names) {} +function compact (mixed $var_name, ...$var_names): array +{} /** * Fill an array with values @@ -861,7 +897,8 @@ function compact (mixed $var_name, ...$var_names) {} * @return array the filled array */ #[Pure] -function array_fill (int $start_index, int $count, mixed $value) {} +function array_fill (int $start_index, int $count, mixed $value): array +{} /** * Fill an array with values, specifying keys @@ -876,7 +913,8 @@ function array_fill (int $start_index, int $count, mixed $value) {} * @return array the filled array */ #[Pure] -function array_fill_keys (array $keys, mixed $value) {} +function array_fill_keys (array $keys, mixed $value): array +{} /** * Create an array containing a range of elements @@ -897,7 +935,7 @@ function array_fill_keys (array $keys, mixed $value) {} * end, inclusive. */ #[Pure] -function range ($start, $end, int|float $step = 1) +function range ($start, $end, int|float $step = 1): array {} /** @@ -913,7 +951,8 @@ function range ($start, $end, int|float $step = 1) *

    * @return bool true on success or false on failure. */ -function array_multisort (&$array, &...$rest) {} +function array_multisort (&$array, &...$rest): bool +{} /** * Push elements onto the end of array @@ -928,7 +967,8 @@ function array_multisort (&$array, &...$rest) {} *

    * @return int the number of elements in the array. */ -function array_push (array &$array, ...$values) {} +function array_push (array &$array, ...$values): int +{} /** * Pop the element off the end of array @@ -941,7 +981,7 @@ function array_push (array &$array, ...$values) {} * null will be returned. * @meta */ -function array_pop (array &$array) {} +function array_pop (array &$array): mixed {} /** * Shift an element off the beginning of array @@ -953,7 +993,7 @@ function array_pop (array &$array) {} * empty or is not an array. * @meta */ -function array_shift (array &$array) {} +function array_shift (array &$array): mixed {} /** * Prepend elements to the beginning of an array @@ -968,7 +1008,8 @@ function array_shift (array &$array) {} *

    * @return int the number of elements in the array. */ -function array_unshift (array &$array, ...$values) {} +function array_unshift (array &$array, ...$values): int +{} /** * Remove a portion of the array and replace it with something else @@ -1014,7 +1055,7 @@ function array_unshift (array &$array, ...$values) {} *

    * @return array the array consisting of the extracted elements. */ -function array_splice (array &$array, int $offset, int $length, mixed $replacement) +function array_splice (array &$array, int $offset, int $length, mixed $replacement): array {} /** @@ -1047,7 +1088,7 @@ function array_splice (array &$array, int $offset, int $length, mixed $replaceme * @meta */ #[Pure] -function array_slice (array $array, int $offset, int $length, bool $preserve_keys = false) +function array_slice (array $array, int $offset, int $length, bool $preserve_keys = false): array {} /** @@ -1059,4 +1100,5 @@ function array_slice (array $array, int $offset, int $length, bool $preserve_key * @return array the resulting array. */ #[Pure] -function array_merge (array ...$arrays) {} +function array_merge (array ...$arrays): array +{} diff --git a/standard/standard_9.php b/standard/standard_9.php index d59d01d9c..3f0471720 100644 --- a/standard/standard_9.php +++ b/standard/standard_9.php @@ -22,7 +22,8 @@ * @return array An array of values resulted from merging the arguments together. */ #[Pure] -function array_merge_recursive(array ...$arrays) { } +function array_merge_recursive(array ...$arrays): array +{ } /** @@ -42,7 +43,8 @@ function array_merge_recursive(array ...$arrays) { } * @return array or null if an error occurs. */ #[Pure] -function array_replace(array $array, array ...$replacements) { } +function array_replace(array $array, array ...$replacements): array +{ } /** * Replaces elements from passed arrays into the first array recursively @@ -56,7 +58,8 @@ function array_replace(array $array, array ...$replacements) { } * @return array|null an array, or null if an error occurs. */ #[Pure] -function array_replace_recursive(array $array, array ...$replacements) { } +function array_replace_recursive(array $array, array ...$replacements): ?array +{ } /** * Return all the keys or a subset of the keys of an array @@ -73,7 +76,8 @@ function array_replace_recursive(array $array, array ...$replacements) { } * @return array an array of all the keys in input. */ #[Pure] -function array_keys(array $array, mixed $filter_value, bool $strict) { } +function array_keys(array $array, mixed $filter_value, bool $strict): array +{ } /** * Return all the values of an array @@ -85,7 +89,7 @@ function array_keys(array $array, mixed $filter_value, bool $strict) { } * @meta */ #[Pure] -function array_values(array $array) { } +function array_values(array $array): array { } /** * Counts all the values of an array @@ -97,7 +101,8 @@ function array_values(array $array) { } * keys and their count as value. */ #[Pure] -function array_count_values(array $array) { } +function array_count_values(array $array): array +{ } /** * (PHP 5 >=5.5.0)
    @@ -110,7 +115,8 @@ function array_count_values(array $array) { } * @since 5.5 */ #[Pure] -function array_column(array $array, string|int|null $column_key, string|int $index_key = null) { } +function array_column(array $array, string|int|null $column_key, string|int $index_key = null): array +{ } /** * Return an array with elements in reverse order @@ -125,7 +131,7 @@ function array_column(array $array, string|int|null $column_key, string|int $ind * @meta */ #[Pure] -function array_reverse(array $array, bool $preserve_keys) { } +function array_reverse(array $array, bool $preserve_keys): array { } /** * Iteratively reduce the array to a single value using a callback function @@ -157,7 +163,7 @@ function array_reverse(array $array, bool $preserve_keys) { } *
    * @meta */ -function array_reduce(array $array, callable $callback, mixed $initial) { } +function array_reduce(array $array, callable $callback, mixed $initial): mixed { } /** * Pad array to the specified length with a value @@ -180,7 +186,8 @@ function array_reduce(array $array, callable $callback, mixed $initial) { } * the length of the input then no padding takes place. */ #[Pure] -function array_pad(array $array, int $length, mixed $value) { } +function array_pad(array $array, int $length, mixed $value): array +{ } /** * Exchanges all keys with their associated values in an array @@ -191,7 +198,8 @@ function array_pad(array $array, int $length, mixed $value) { } * @return array Returns the flipped array. */ #[Pure] -function array_flip(array $array) { } +function array_flip(array $array): array +{ } /** * Changes the case of all keys in an arra @@ -207,7 +215,7 @@ function array_flip(array $array) { } * @meta */ #[Pure] -function array_change_key_case(array $array, int $case) { } +function array_change_key_case(array $array, int $case): array { } /** * Pick one or more random keys out of an array @@ -224,7 +232,8 @@ function array_change_key_case(array $array, int $case) { } * random keys as well as values out of the array. */ #[Pure] -function array_rand(array $array, int $num) { } +function array_rand(array $array, int $num): array|string|int +{ } /** * Removes duplicate values from an array @@ -258,7 +267,7 @@ function array_rand(array $array, int $num) { } * @meta */ #[Pure] -function array_unique(array $array, int $flags = SORT_STRING) { } +function array_unique(array $array, int $flags = SORT_STRING): array { } #[PhpStormStubsElementAvailable('8.0')] /** @@ -275,7 +284,7 @@ function array_unique(array $array, int $flags = SORT_STRING) { } * @meta */ #[Pure] -function array_intersect(array $array, ...$arrays) { } +function array_intersect(array $array, ...$arrays): array { } #[PhpStormStubsElementAvailable(to: '7.4')] /** @@ -293,7 +302,7 @@ function array_intersect(array $array, ...$arrays) { } * @meta */ #[Pure] -function array_intersect(array $array1, array $array2, array ...$_) { } +function array_intersect(array $array1, array $array2, array ...$_): array { } /** * Computes the intersection of arrays using keys for comparison @@ -311,7 +320,7 @@ function array_intersect(array $array1, array $array2, array ...$_) { } * @meta */ #[Pure] -function array_intersect_key(array $array1, array $array2, array ...$_) { } +function array_intersect_key(array $array1, array $array2, array ...$_): array { } /** * Computes the intersection of arrays using a callback function on the keys for comparison @@ -330,7 +339,7 @@ function array_intersect_key(array $array1, array $array2, array ...$_) { } * in all the arguments. * @meta */ -function array_intersect_ukey(array $array1, array $array2, array $_ = null, callable $key_compare_func) { } +function array_intersect_ukey(array $array1, array $array2, array $_ = null, callable $key_compare_func): array { } /** * Computes the intersection of arrays, compares data by a callback function @@ -355,7 +364,7 @@ function array_intersect_ukey(array $array1, array $array2, array $_ = null, cal * that are present in all the arguments. * @meta */ -function array_uintersect(array $array1, array $array2, array $_ = null, callable $data_compare_func) { } +function array_uintersect(array $array1, array $array2, array $_ = null, callable $data_compare_func): array { } /** * Computes the intersection of arrays with additional index check @@ -372,7 +381,7 @@ function array_uintersect(array $array1, array $array2, array $_ = null, callabl * @meta */ #[Pure] -function array_intersect_assoc(array $array1, array $array2, array $_ = null) { } +function array_intersect_assoc(array $array1, array $array2, array $_ = null): array { } /** * Computes the intersection of arrays with additional index check, compares data by a callback function @@ -395,7 +404,7 @@ function array_intersect_assoc(array $array1, array $array2, array $_ = null) { * array1 that are present in all the arguments. * @meta */ -function array_uintersect_assoc(array $array1, array $array2, array $_ = null, callable $data_compare_func) { } +function array_uintersect_assoc(array $array1, array $array2, array $_ = null, callable $data_compare_func): array { } /** * Computes the intersection of arrays with additional index check, compares indexes by a callback function @@ -414,7 +423,7 @@ function array_uintersect_assoc(array $array1, array $array2, array $_ = null, c * in all of the arguments. * @meta */ -function array_intersect_uassoc(array $array1, array $array2, array $_ = null, callable $key_compare_func) { } +function array_intersect_uassoc(array $array1, array $array2, array $_ = null, callable $key_compare_func): array { } /** * Computes the intersection of arrays with additional index check, compares data and indexes by separate callback functions @@ -441,7 +450,7 @@ function array_intersect_uassoc(array $array1, array $array2, array $_ = null, c * @meta */ #[Pure] -function array_uintersect_uassoc(array $array1, array $array2, array $_ = null, callable $data_compare_func, callable $key_compare_func) { } +function array_uintersect_uassoc(array $array1, array $array2, array $_ = null, callable $data_compare_func, callable $key_compare_func): array { } #[PhpStormStubsElementAvailable('8.0')] /** @@ -457,7 +466,7 @@ function array_uintersect_uassoc(array $array1, array $array2, array $_ = null, * @meta */ #[Pure] -function array_diff(array $array, ...$excludes) { } +function array_diff(array $array, ...$excludes): array { } #[PhpStormStubsElementAvailable(to: '7.4')] /** @@ -475,7 +484,7 @@ function array_diff(array $array, ...$excludes) { } * @meta */ #[Pure] -function array_diff(array $array1, array $array2, array ...$_) { } +function array_diff(array $array1, array $array2, array ...$_): array { } /** * Computes the difference of arrays using keys for comparison @@ -493,7 +502,7 @@ function array_diff(array $array1, array $array2, array ...$_) { } * @meta */ #[Pure] -function array_diff_key(array $array1, array $array2, array ...$_) { } +function array_diff_key(array $array1, array $array2, array ...$_): array { } /** * Computes the difference of arrays using a callback function on the keys for comparison @@ -515,7 +524,7 @@ function array_diff_key(array $array1, array $array2, array ...$_) { } * array1 that are not present in any of the other arrays. * @meta */ -function array_diff_ukey(array $array1, array $array2, array $_ = null, callable $key_compare_func) { } +function array_diff_ukey(array $array1, array $array2, array $_ = null, callable $key_compare_func): array { } /** * Computes the difference of arrays by using a callback function for data comparison @@ -540,7 +549,7 @@ function array_diff_ukey(array $array1, array $array2, array $_ = null, callable * that are not present in any of the other arguments. * @meta */ -function array_udiff(array $array1, array $array2, array $_ = null, callable $data_compare_func) { } +function array_udiff(array $array1, array $array2, array $_ = null, callable $data_compare_func): array { } /** * Computes the difference of arrays with additional index check @@ -557,7 +566,7 @@ function array_udiff(array $array1, array $array2, array $_ = null, callable $da * @meta */ #[Pure] -function array_diff_assoc(array $array1, array $array2, array ...$_) { } +function array_diff_assoc(array $array1, array $array2, array ...$_): array { } /** * Computes the difference of arrays with additional index check, compares data by a callback function @@ -589,7 +598,7 @@ function array_diff_assoc(array $array1, array $array2, array ...$_) { } * comparison. * @meta */ -function array_udiff_assoc(array $array1, array $array2, array $_ = null, callable $data_compare_func) { } +function array_udiff_assoc(array $array1, array $array2, array $_ = null, callable $data_compare_func): array { } /** * Computes the difference of arrays with additional index check which is performed by a user supplied callback function @@ -611,7 +620,7 @@ function array_udiff_assoc(array $array1, array $array2, array $_ = null, callab * array1 that are not present in any of the other arrays. * @meta */ -function array_diff_uassoc(array $array1, array $array2, array $_ = null, callable $key_compare_func) { } +function array_diff_uassoc(array $array1, array $array2, array $_ = null, callable $key_compare_func): array { } /** * Computes the difference of arrays with additional index check, compares data and indexes by a callback function @@ -650,7 +659,7 @@ function array_diff_uassoc(array $array1, array $array2, array $_ = null, callab * arguments. * @meta */ -function array_udiff_uassoc(array $array1, array $array2, array $_ = null, callable $data_compare_func, callable $key_compare_func) { } +function array_udiff_uassoc(array $array1, array $array2, array $_ = null, callable $data_compare_func, callable $key_compare_func): array { } /** * Calculate the sum of values in an array @@ -661,7 +670,8 @@ function array_udiff_uassoc(array $array1, array $array2, array $_ = null, calla * @return int|float the sum of values as an integer or float. */ #[Pure] -function array_sum(array $array) { } +function array_sum(array $array): int|float +{ } /** * Calculate the product of values in an array @@ -672,7 +682,8 @@ function array_sum(array $array) { } * @return int|float the product as an integer or float. */ #[Pure] -function array_product(array $array) { } +function array_product(array $array): int|float +{ } /** * Iterates over each value in the array @@ -708,7 +719,7 @@ function array_product(array $array) { } * @return array the filtered array. * @meta */ -function array_filter(array $array, callable $callback, int $mode = 0) { } +function array_filter(array $array, callable $callback, int $mode = 0): array { } /** * Applies the callback to the elements of the given arrays @@ -724,7 +735,7 @@ function array_filter(array $array, callable $callback, int $mode = 0) { } * after applying the callback function to each one. * @meta */ -function array_map(callable $callback, array $array, array ...$arrays) { } +function array_map(callable $callback, array $array, array ...$arrays): array { } /** * Split an array into chunks @@ -743,7 +754,7 @@ function array_map(callable $callback, array $array, array ...$arrays) { } * with each dimension containing size elements. */ #[Pure] -function array_chunk(array $array, int $length, bool $preserve_keys) +function array_chunk(array $array, int $length, bool $preserve_keys): array { } /** @@ -761,7 +772,7 @@ function array_chunk(array $array, int $length, bool $preserve_keys) * @meta */ #[Pure] -function array_combine(array $keys, array $values) { } +function array_combine(array $keys, array $values): array { } /** * Checks if the given key or index exists in the array @@ -775,7 +786,7 @@ function array_combine(array $keys, array $values) { } * @return bool true on success or false on failure. */ #[Pure] -function array_key_exists($key, array $array) +function array_key_exists($key, array $array): bool { } /** @@ -789,7 +800,8 @@ function array_key_exists($key, array $array) * @since 7.3 */ #[Pure] -function array_key_first(array $array) { } +function array_key_first(array $array): string|int|null +{ } /** * Gets the last key of an array @@ -802,7 +814,8 @@ function array_key_first(array $array) { } * @since 7.3 */ #[Pure] -function array_key_last(array $array) { } +function array_key_last(array $array): string|int|null +{ } /** * &Alias; current @@ -811,7 +824,8 @@ function array_key_last(array $array) { } * @return mixed */ #[Pure] -function pos(object|array $array) { } +function pos(object|array $array): mixed +{ } /** * &Alias; count @@ -821,7 +835,8 @@ function pos(object|array $array) { } * @return int */ #[Pure] -function sizeof(Countable|array $value, int $mode = COUNT_NORMAL) { } +function sizeof(Countable|array $value, int $mode = COUNT_NORMAL): int +{ } /** * Checks if the given key or index exists in the array. The name of this function is array_key_exists() in PHP > 4.0.6. @@ -835,7 +850,8 @@ function sizeof(Countable|array $value, int $mode = COUNT_NORMAL) { } * @return bool true on success or false on failure. */ #[Pure] -function key_exists($key, array $array) { } +function key_exists($key, array $array): bool +{ } /** * Checks if assertion is &false; @@ -851,7 +867,8 @@ function key_exists($key, array $array) { } *

    An optional description that will be included in the failure message if the assertion fails.

    * @return bool false if the assertion is false, true otherwise. */ -function assert(mixed $assertion, $description = '') { } +function assert(mixed $assertion, $description = ''): bool +{ } /** * AssertionError is thrown when an assertion made via {@see assert()} fails. @@ -912,9 +929,10 @@ class AssertionError extends Error { * @param mixed $value [optional]

    * An optional new value for the option. *

    - * @return mixed|false the original setting of any option or false on errors. + * @return object|array|string|int|null the original setting of any option or false on errors. */ -function assert_options(int $option, mixed $value) { } +function assert_options(int $option, mixed $value): object|array|string|int|null +{ } /** * Compares two "PHP-standardized" version number strings @@ -950,7 +968,7 @@ function assert_options(int $option, mixed $value) { } * function will return true if the relationship is the one specified * by the operator, false otherwise. */ -function version_compare(string $version1, string $version2, string $operator) +function version_compare(string $version1, string $version2, string $operator): int|bool { } /** @@ -966,7 +984,8 @@ function version_compare(string $version1, string $version2, string $operator) * -1 is returned. */ #[Pure] -function ftok(string $filename, string $project_id) { } +function ftok(string $filename, string $project_id): int +{ } /** * Perform the rot13 transform on a string @@ -977,7 +996,8 @@ function ftok(string $filename, string $project_id) { } * @return string the ROT13 version of the given string. */ #[Pure] -function str_rot13(string $string) { } +function str_rot13(string $string): string +{ } /** * Retrieve list of registered filters @@ -986,7 +1006,8 @@ function str_rot13(string $string) { } * available. */ #[Pure] -function stream_get_filters() { } +function stream_get_filters(): array +{ } /** * Check if a stream is a TTY @@ -996,7 +1017,8 @@ function stream_get_filters() { } * @since 7.2 */ #[Pure] -function stream_isatty($stream) {} +function stream_isatty($stream): bool +{} /** * Register a user defined stream filter @@ -1112,7 +1134,8 @@ function stream_isatty($stream) {} * stream_filter_register will return false if the * filtername is already defined. */ -function stream_filter_register(string $filter_name, string $class) { } +function stream_filter_register(string $filter_name, string $class): bool +{ } /** * Return a bucket object from the brigade for operating on @@ -1120,7 +1143,8 @@ function stream_filter_register(string $filter_name, string $class) { } * @param resource $brigade * @return object */ -function stream_bucket_make_writeable($brigade) { } +function stream_bucket_make_writeable($brigade): object +{ } /** * Prepend bucket to brigade @@ -1129,7 +1153,7 @@ function stream_bucket_make_writeable($brigade) { } * @param object $bucket * @return void */ -function stream_bucket_prepend($brigade, object $bucket) { } +function stream_bucket_prepend($brigade, object $bucket): void { } /** * Append bucket to brigade @@ -1138,7 +1162,7 @@ function stream_bucket_prepend($brigade, object $bucket) { } * @param object $bucket * @return void */ -function stream_bucket_append($brigade, object $bucket) { } +function stream_bucket_append($brigade, object $bucket): void { } /** * Create a new bucket for use on the current stream @@ -1147,7 +1171,8 @@ function stream_bucket_append($brigade, object $bucket) { } * @param string $buffer * @return object */ -function stream_bucket_new($stream, string $buffer) { } +function stream_bucket_new($stream, string $buffer): object +{ } /** * Add URL rewriter values @@ -1160,7 +1185,8 @@ function stream_bucket_new($stream, string $buffer) { } *

    * @return bool true on success or false on failure. */ -function output_add_rewrite_var(string $name, string $value) { } +function output_add_rewrite_var(string $name, string $value): bool +{ } /** * Reset URL rewriter values @@ -1191,7 +1217,8 @@ function output_add_rewrite_var(string $name, string $value) { } * @link https://php.net/manual/en/function.output-reset-rewrite-vars.php * @return bool true on success or false on failure. */ -function output_reset_rewrite_vars() { } +function output_reset_rewrite_vars(): bool +{ } /** * Returns directory path used for temporary files @@ -1199,7 +1226,8 @@ function output_reset_rewrite_vars() { } * @return string the path of the temporary directory. * @since 5.2.1 */ -function sys_get_temp_dir() { } +function sys_get_temp_dir(): string +{ } /** * Get the contents of the realpath cache. @@ -1211,7 +1239,8 @@ function sys_get_temp_dir() { } * @since 5.3.2 */ #[Pure] -function realpath_cache_get() { } +function realpath_cache_get(): array +{ } /** * Get the amount of memory used by the realpath cache. @@ -1220,7 +1249,8 @@ function realpath_cache_get() { } * @since 5.3.2 */ #[Pure] -function realpath_cache_size() { } +function realpath_cache_size(): int +{ } /** * It returns the same result as (array) $object, with the @@ -1230,7 +1260,8 @@ function realpath_cache_size() { } * @return array returns the mangled object properties * @since 7.4 */ -function get_mangled_object_vars(object $object){} +function get_mangled_object_vars(object $object): array +{} /** * Get the type or object name of a variable diff --git a/sysvmsg/sysvmsg.php b/sysvmsg/sysvmsg.php index ea1d70160..a5a927d37 100644 --- a/sysvmsg/sysvmsg.php +++ b/sysvmsg/sysvmsg.php @@ -12,8 +12,9 @@ * Queue permissions. Default to 0666. If the message queue already * exists, the perms will be ignored. *

    - * @return resource|SysvMessageQueue a resource handle that can be used to access the System V message queue. + * @return resource|SysvMessageQueue|false a resource handle that can be used to access the System V message queue. */ +#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue|false"], default: "resource|false")] function msg_get_queue (int $key, int $permissions = 0666) {} /** @@ -52,7 +53,7 @@ function msg_get_queue (int $key, int $permissions = 0666) {} * calling process, msg_qnum is incremented by 1 and * msg_stime is set to the current time. */ -function msg_send (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], default: "resource")] $queue, int $message_type, $message, bool $serialize = true, bool $blocking = true, &$error_code) {} +function msg_send (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], default: "resource")] $queue, int $message_type, $message, bool $serialize = true, bool $blocking = true, &$error_code): bool {} /** * Receive a message from a message queue @@ -139,7 +140,7 @@ function msg_send (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], defau * calling process, msg_qnum is decremented by 1 and * msg_rtime is set to the current time. */ -function msg_receive (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], default: "resource")] $queue, int $desired_message_type, &$received_message_type, int $max_message_size, mixed &$message, bool $unserialize = true, int $flags = 0, &$error_code) {} +function msg_receive (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], default: "resource")] $queue, int $desired_message_type, &$received_message_type, int $max_message_size, mixed &$message, bool $unserialize = true, int $flags = 0, &$error_code): bool {} /** * Destroy a message queue @@ -149,7 +150,7 @@ function msg_receive (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], de *

    * @return bool TRUE on success or FALSE on failure. */ -function msg_remove_queue (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], default: "resource")] $queue) {} +function msg_remove_queue (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], default: "resource")] $queue): bool {} /** * Returns information from the message queue data structure @@ -157,7 +158,7 @@ function msg_remove_queue (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue" * @param SysvMessageQueue|resource $queue

    * Message queue resource handle *

    - * @return array The return value is an array whose keys and values have the following + * @return array|false The return value is an array whose keys and values have the following * meanings: * * Array structure for msg_stat_queue @@ -225,7 +226,7 @@ function msg_remove_queue (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue" * *
    */ -function msg_stat_queue (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], default: "resource")] $queue) {} +function msg_stat_queue (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], default: "resource")] $queue): array|false {} /** * Set information in the message queue data structure @@ -239,7 +240,7 @@ function msg_stat_queue (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], *

    * @return bool TRUE on success or FALSE on failure. */ -function msg_set_queue (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], default: "resource")] $queue, array $data) {} +function msg_set_queue (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], default: "resource")] $queue, array $data): bool {} /** * Check whether a message queue exists @@ -249,7 +250,7 @@ function msg_set_queue (#[LanguageLevelTypeAware(["8.0" => "SysvMessageQueue"], *

    * @return bool TRUE on success or FALSE on failure. */ -function msg_queue_exists (int $key) {} +function msg_queue_exists (int $key): bool {} define ('MSG_IPC_NOWAIT', 1); define ('MSG_EAGAIN', 11); diff --git a/sysvsem/sysvsem.php b/sysvsem/sysvsem.php index 1d91e8aa6..5620ac7e9 100644 --- a/sysvsem/sysvsem.php +++ b/sysvsem/sysvsem.php @@ -22,6 +22,7 @@ * @return resource|false|SysvSemaphore a positive semaphore identifier on success, or FALSE on * error. */ +#[LanguageLevelTypeAware(["8.0" => "SysvSemaphore|false"], default: "resource|false")] function sem_get (int $key, int $max_acquire = 1, int $permissions = 0666, bool $auto_release) {} /** @@ -38,7 +39,7 @@ function sem_get (int $key, int $max_acquire = 1, int $permissions = 0666, bool *

    * @return bool TRUE on success or FALSE on failure. */ -function sem_acquire (#[LanguageLevelTypeAware(["8.0" => "SysvSemaphore"], default: "resource")] $semaphore, bool $non_blocking = false) {} +function sem_acquire (#[LanguageLevelTypeAware(["8.0" => "SysvSemaphore"], default: "resource")] $semaphore, bool $non_blocking = false): bool {} /** * Release a semaphore @@ -49,7 +50,7 @@ function sem_acquire (#[LanguageLevelTypeAware(["8.0" => "SysvSemaphore"], defau *

    * @return bool TRUE on success or FALSE on failure. */ -function sem_release (#[LanguageLevelTypeAware(["8.0" => "SysvSemaphore"], default: "resource")] $semaphore) {} +function sem_release (#[LanguageLevelTypeAware(["8.0" => "SysvSemaphore"], default: "resource")] $semaphore): bool {} /** * Remove a semaphore @@ -60,7 +61,7 @@ function sem_release (#[LanguageLevelTypeAware(["8.0" => "SysvSemaphore"], defau *

    * @return bool TRUE on success or FALSE on failure. */ -function sem_remove (#[LanguageLevelTypeAware(["8.0" => "SysvSemaphore"], default: "resource")] $semaphore) {} +function sem_remove (#[LanguageLevelTypeAware(["8.0" => "SysvSemaphore"], default: "resource")] $semaphore): bool {} /** * @since 8.0 diff --git a/sysvshm/sysvshm.php b/sysvshm/sysvshm.php index 689865c85..b0bf50e9d 100644 --- a/sysvshm/sysvshm.php +++ b/sysvshm/sysvshm.php @@ -16,8 +16,9 @@ * @param int $permissions [optional]

    * The optional permission bits. Default to 0666. *

    - * @return resource|SysvSharedMemory a shared memory segment identifier. + * @return resource|SysvSharedMemory|false a shared memory segment identifier. */ +#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory|false"], default: "resource|false")] function shm_attach (int $key, int $size, int $permissions = 0666) {} /** @@ -29,7 +30,7 @@ function shm_attach (int $key, int $size, int $permissions = 0666) {} *

    * @return bool TRUE on success or FALSE on failure. */ -function shm_remove (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], default: "resource")] $shm) {} +function shm_remove (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], default: "resource")] $shm): bool {} /** * Disconnects from shared memory segment @@ -40,7 +41,7 @@ function shm_remove (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], def *

    * @return bool shm_detach always returns TRUE. */ -function shm_detach (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], default: "resource")] $shm) {} +function shm_detach (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], default: "resource")] $shm): bool {} /** * Inserts or updates a variable in shared memory @@ -60,7 +61,7 @@ function shm_detach (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], def *

    * @return bool TRUE on success or FALSE on failure. */ -function shm_put_var (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], default: "resource")] $shm, int $key, mixed $value) {} +function shm_put_var (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], default: "resource")] $shm, int $key, mixed $value): bool {} /** * Check whether a specific entry exists @@ -73,7 +74,7 @@ function shm_put_var (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], de *

    * @return bool TRUE if the entry exists, otherwise FALSE */ -function shm_has_var (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], default: "resource")] $shm, int $key) {} +function shm_has_var (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], default: "resource")] $shm, int $key): bool {} /** * Returns a variable from shared memory @@ -86,7 +87,7 @@ function shm_has_var (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], de *

    * @return mixed the variable with the given key. */ -function shm_get_var (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], default: "resource")] $shm, int $key) {} +function shm_get_var (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], default: "resource")] $shm, int $key): mixed {} /** * Removes a variable from shared memory @@ -100,7 +101,7 @@ function shm_get_var (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], de *

    * @return bool TRUE on success or FALSE on failure. */ -function shm_remove_var (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], default: "resource")] $shm, int $key) {} +function shm_remove_var (#[LanguageLevelTypeAware(["8.0" => "SysvSharedMemory"], default: "resource")] $shm, int $key): bool {} /** * @since 8.0 diff --git a/tests/Model/BasePHPElement.php b/tests/Model/BasePHPElement.php index ded806277..8367e0c73 100644 --- a/tests/Model/BasePHPElement.php +++ b/tests/Model/BasePHPElement.php @@ -5,6 +5,15 @@ use Exception; use PhpParser\Node; +use PhpParser\Node\Expr\Array_; +use PhpParser\Node\Identifier; +use PhpParser\Node\Name; +use PhpParser\Node\NullableType; +use PhpParser\Node\Scalar\String_; +use PhpParser\Node\UnionType; +use ReflectionNamedType; +use ReflectionType; +use ReflectionUnionType; use Reflector; use stdClass; @@ -35,6 +44,69 @@ protected function getFQN(Node $node): string return rtrim($fqn, "\\"); } + protected static function convertReflectionTypeToString(?ReflectionType $type): string + { + if ($type instanceof ReflectionNamedType) { + return $type->getName(); + } + if ($type instanceof ReflectionUnionType) { + $reflectionType = ''; + foreach ($type->getTypes() as $type) { + $reflectionType .= $type->getName() . '|'; + } + return substr($reflectionType, 0, -1); + } + return ''; + } + + protected static function convertParsedTypeToString(Name|Identifier|NullableType|string|UnionType|null $type): string + { + if ($type !== null) { + if ($type instanceof UnionType) { + $unionType = ''; + foreach ($type->types as $type) { + $unionType .= self::getTypeNameFromNode($type) . '|'; + } + return substr($unionType, 0, -1); + } else { + return self::getTypeNameFromNode($type); + } + } + return ''; + } + + protected static function getTypeNameFromNode(Name|Identifier|NullableType|string $type): string + { + if($type instanceof NullableType){ + $type = $type->type; + } + if (empty($type->name)) { + if (!empty($type->parts)) { + return $type->parts[0]; + } + } else { + return $type->name; + } + } + + protected static function findTypeFromAttribute(array $attrGroups): ?string + { + foreach ($attrGroups as $attrGroup) { + foreach ($attrGroup->attrs as $attr) { + if ($attr->name->toString() === "LanguageLevelTypeAware") { + $arg = $attr->args[0]->value; + if ($arg instanceof Array_) { + $value = $arg->items[0]->value; + if ($value instanceof String_) { + return $value->value; + } + } + } + } + } + return null; + } + public function hasMutedProblem(int $stubProblemType): bool { return in_array($stubProblemType, $this->mutedProblems, true); diff --git a/tests/Model/PHPFunction.php b/tests/Model/PHPFunction.php index 6a440cc01..33b8d56e1 100644 --- a/tests/Model/PHPFunction.php +++ b/tests/Model/PHPFunction.php @@ -27,7 +27,7 @@ class PHPFunction extends BasePHPElement public ?Type $returnTag = null; - public ?NodeAbstract $returnType = null; + public string $returnType = ''; public ?Doc $doc = null; @@ -42,6 +42,7 @@ public function readObjectFromReflection($reflectionObject): static foreach ($reflectionObject->getParameters() as $parameter) { $this->parameters[] = (new PHPParameter())->readObjectFromReflection($parameter); } + $this->returnType = self::convertReflectionTypeToString($reflectionObject->getReturnType()); return $this; } @@ -53,12 +54,17 @@ public function readObjectFromStubNode($node): static { $functionName = $this->getFQN($node); $this->name = $functionName; + $typeFromAttribute = self::findTypeFromAttribute($node->attrGroups); + if ($typeFromAttribute != null) { + $this->returnType = $typeFromAttribute; + } else{ + $this->returnType = self::convertParsedTypeToString($node->getReturnType()); + } foreach ($node->getParams() as $parameter) { $this->parameters[] = (new PHPParameter())->readObjectFromStubNode($parameter); } - $this->returnType = $node->getReturnType(); $this->collectTags($node); $this->checkDeprecationTag($node); $this->checkReturnTag($node); diff --git a/tests/Model/PHPMethod.php b/tests/Model/PHPMethod.php index 1e42bb667..f41af481c 100644 --- a/tests/Model/PHPMethod.php +++ b/tests/Model/PHPMethod.php @@ -47,7 +47,7 @@ public function readObjectFromStubNode($node): static $this->parentName = $this->getFQN($node->getAttribute('parent')); $this->name = $node->name->name; - $this->returnType = $node->getReturnType(); + $this->returnType = self::convertParsedTypeToString($node->getReturnType()); $this->collectTags($node); $this->checkDeprecationTag($node); $this->checkReturnTag($node); diff --git a/tests/Model/PHPParameter.php b/tests/Model/PHPParameter.php index 3c62661b3..0ddca53b0 100644 --- a/tests/Model/PHPParameter.php +++ b/tests/Model/PHPParameter.php @@ -29,16 +29,7 @@ class PHPParameter extends BasePHPElement public function readObjectFromReflection($reflectionObject): static { $this->name = $reflectionObject->name; - $parameterType = $reflectionObject->getType(); - if ($parameterType instanceof ReflectionNamedType) { - $this->type = $parameterType->getName(); - } - if ($parameterType instanceof ReflectionUnionType) { - foreach ($parameterType->getTypes() as $type) { - $this->type .= $type->getName() . '|'; - } - $this->type = substr($this->type, 0, -1); - } + $this->type = self::convertReflectionTypeToString($reflectionObject->getType()); $this->is_vararg = $reflectionObject->isVariadic(); $this->is_passed_by_ref = $reflectionObject->isPassedByReference(); return $this; @@ -53,21 +44,11 @@ public function readObjectFromStubNode($node): static // #[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|string"], default: "resource|string")] $this->name = $node->var->name; - $typeFromAttribute = $this->findTypeFromAttribute($node); + $typeFromAttribute = self::findTypeFromAttribute($node->attrGroups); if ($typeFromAttribute != null) { $this->type = $typeFromAttribute; } else { - $type = $node->type; - if ($type !== null) { - if ($type instanceof UnionType) { - foreach ($type->types as $type) { - $this->type .= $this->getTypeNameFromNode($type) . '|'; - } - $this->type = substr($this->type, 0, -1); - } else { - $this->type = $this->getTypeNameFromNode($type); - } - } + $this->type = self::convertParsedTypeToString($node->type); } if($node->default instanceof Expr\ConstFetch && $node->default->name->parts[0] === "null"){ $this->type .= "|null"; @@ -96,36 +77,4 @@ public function readMutedProblems(stdClass|array $jsonData): void } } } - - protected function getTypeNameFromNode(Name|Identifier|NullableType|string $type): string - { - if($type instanceof NullableType){ - $type = $type->type; - } - if (empty($type->name)) { - if (!empty($type->parts)) { - return $type->parts[0]; - } - } else { - return $type->name; - } - } - - protected function findTypeFromAttribute(Param $node): ?string - { - foreach ($node->attrGroups as $attrGroup) { - foreach ($attrGroup->attrs as $attr) { - if ($attr->name->toString() === "LanguageLevelTypeAware") { - $arg = $attr->args[0]->value; - if ($arg instanceof Array_) { - $value = $arg->items[0]->value; - if ($value instanceof String_) { - return $value->value; - } - } - } - } - } - return null; - } } diff --git a/tests/StubsTest.php b/tests/StubsTest.php index 435da6b2c..f55bebcbe 100644 --- a/tests/StubsTest.php +++ b/tests/StubsTest.php @@ -122,6 +122,7 @@ public function testFunctions(PHPFunction $function): void } } } + self::assertEquals($function->returnType, $phpstormFunction->returnType, "Function $functionName has invalid return type"); } private function printParameters(array $params): string @@ -552,10 +553,10 @@ private static function checkFunctionDoesNotHaveScalarTypeHints(int $sinceVersio private static function checkFunctionDoesNotHaveReturnTypeHints(int $sinceVersion, PHPFunction $function) { - $returnTypeHint = $function->returnType === null ? $function->returnType : $function->returnType->getType(); + $returnTypeHint = $function->returnType; if ($sinceVersion < 7) { if (!$function->hasMutedProblem(StubProblemType::FUNCTION_HAS_RETURN_TYPEHINT)) { - self::assertNull($returnTypeHint, "Function '$function->name' has since version '$sinceVersion' + self::assertEmpty($returnTypeHint, "Function '$function->name' has since version '$sinceVersion' but has return typehint '$returnTypeHint' that supported only since PHP 7. Please declare return type via PhpDoc"); } else { self::markTestSkipped("Skipped"); diff --git a/tokenizer/tokenizer.php b/tokenizer/tokenizer.php index a5ccfbcd5..f92792039 100644 --- a/tokenizer/tokenizer.php +++ b/tokenizer/tokenizer.php @@ -28,7 +28,7 @@ * content of the original token in element 1 and the line number in element 2. */ #[Pure] -function token_get_all (string $code, int $flags = 0) {} +function token_get_all (string $code, int $flags = 0): array {} /** * Get the symbolic name of a given PHP token @@ -39,7 +39,7 @@ function token_get_all (string $code, int $flags = 0) {} * @return string The symbolic name of the given token. */ #[Pure] -function token_name (int $id) {} +function token_name (int $id): string {} define('TOKEN_PARSE', 1); define('T_REQUIRE_ONCE', 263); diff --git a/xml/xml.php b/xml/xml.php index ca0f02179..f09efe5a2 100644 --- a/xml/xml.php +++ b/xml/xml.php @@ -22,6 +22,7 @@ * @return resource|false|XmlParser a resource handle for the new XML parser. */ #[Pure] +#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] function xml_parser_create (string $encoding) {} /** @@ -46,6 +47,7 @@ function xml_parser_create (string $encoding) {} * @return resource|false|XmlParser a resource handle for the new XML parser. */ #[Pure] +#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] function xml_parser_create_ns (string $encoding, string $separator = ':') {} /** @@ -59,7 +61,8 @@ function xml_parser_create_ns (string $encoding, string $separator = ':') {} *

    * @return bool TRUE on success or FALSE on failure. */ -function xml_set_object (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, object &$object) {} +function xml_set_object (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, object &$object): bool +{} /** * Set up start and end element handlers @@ -88,7 +91,7 @@ function xml_set_object (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], defaul * reference to the XML parser calling the handler. * @return bool TRUE on success or FALSE on failure. */ -function xml_set_element_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $start_handler, $end_handler) {} +function xml_set_element_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $start_handler, $end_handler): bool {} /** * Set up character data handler @@ -112,7 +115,7 @@ function xml_set_element_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser" * reference to the XML parser calling the handler. * @return bool TRUE on success or FALSE on failure. */ -function xml_set_character_data_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler) {} +function xml_set_character_data_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler): bool {} /** * Set up processing instruction (PI) handler @@ -137,7 +140,7 @@ function xml_set_character_data_handler (#[LanguageLevelTypeAware(["8.0" => "Xml * reference to the XML parser calling the handler. * @return bool TRUE on success or FALSE on failure. */ -function xml_set_processing_instruction_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler) {} +function xml_set_processing_instruction_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler): bool {} /** * Set up default handler @@ -161,7 +164,7 @@ function xml_set_processing_instruction_handler (#[LanguageLevelTypeAware(["8.0" * reference to the XML parser calling the handler. * @return bool TRUE on success or FALSE on failure. */ -function xml_set_default_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler) {} +function xml_set_default_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler): bool {} /** * Set up unparsed entity declaration handler @@ -190,7 +193,7 @@ function xml_set_default_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser" * handler. * @return bool TRUE on success or FALSE on failure. */ -function xml_set_unparsed_entity_decl_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler) {} +function xml_set_unparsed_entity_decl_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler): bool {} /** * Set up notation declaration handler @@ -217,7 +220,8 @@ function xml_set_unparsed_entity_decl_handler (#[LanguageLevelTypeAware(["8.0" = * reference to the XML parser calling the handler. * @return bool TRUE on success or FALSE on failure. */ -function xml_set_notation_decl_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler) {} +function xml_set_notation_decl_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler): bool +{} /** * Set up external entity reference handler @@ -248,7 +252,8 @@ function xml_set_notation_decl_handler (#[LanguageLevelTypeAware(["8.0" => "XmlP * reference to the XML parser calling the handler. * @return bool TRUE on success or FALSE on failure. */ -function xml_set_external_entity_ref_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler) {} +function xml_set_external_entity_ref_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler): bool +{} /** * Set up start namespace declaration handler @@ -277,7 +282,8 @@ function xml_set_external_entity_ref_handler (#[LanguageLevelTypeAware(["8.0" => * reference to the XML parser calling the handler. * @return bool TRUE on success or FALSE on failure. */ -function xml_set_start_namespace_decl_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler) {} +function xml_set_start_namespace_decl_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler): bool +{} /** * Set up end namespace declaration handler @@ -305,7 +311,8 @@ function xml_set_start_namespace_decl_handler (#[LanguageLevelTypeAware(["8.0" = * reference to the XML parser calling the handler. * @return bool TRUE on success or FALSE on failure. */ -function xml_set_end_namespace_decl_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler) {} +function xml_set_end_namespace_decl_handler (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, $handler): bool +{} /** * Start parsing an XML document @@ -337,7 +344,8 @@ function xml_set_end_namespace_decl_handler (#[LanguageLevelTypeAware(["8.0" => * Entity errors are reported at the end of the data thus only if * is_final is set and TRUE. */ -function xml_parse (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, string $data, bool $is_final = false) {} +function xml_parse (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, string $data, bool $is_final = false): int +{} /** * Parse XML data into an array structure @@ -358,7 +366,7 @@ function xml_parse (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "r * success. This is not the same as FALSE and TRUE, be careful with * operators such as ===. */ -function xml_parse_into_struct (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, string $data, &$values, &$index) +function xml_parse_into_struct (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, string $data, &$values, &$index): int {} /** @@ -373,7 +381,7 @@ function xml_parse_into_struct (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], * section. */ #[Pure] -function xml_get_error_code (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser) {} +function xml_get_error_code (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser): int {} /** * Get XML parser error string @@ -385,7 +393,8 @@ function xml_get_error_code (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], de * code, or FALSE if no description was found. */ #[Pure] -function xml_error_string (int $error_code) {} +function xml_error_string (int $error_code): string +{} /** * Get current line number for an XML parser @@ -398,7 +407,9 @@ function xml_error_string (int $error_code) {} * parser is currently at in its data buffer. */ #[Pure] -function xml_get_current_line_number (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser) {} +#[LanguageLevelTypeAware(["8.0" => "int"], default: "int|false")] +function xml_get_current_line_number (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser) +{} /** * Get current column number for an XML parser @@ -413,7 +424,9 @@ function xml_get_current_line_number (#[LanguageLevelTypeAware(["8.0" => "XmlPar * currently at. */ #[Pure] -function xml_get_current_column_number (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser) {} +#[LanguageLevelTypeAware(["8.0" => "int"], default: "int|false")] +function xml_get_current_column_number (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser) +{} /** * Get current byte index for an XML parser @@ -426,7 +439,9 @@ function xml_get_current_column_number (#[LanguageLevelTypeAware(["8.0" => "XmlP * the parser is currently at in its data buffer (starting at 0). */ #[Pure] -function xml_get_current_byte_index (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser) {} +#[LanguageLevelTypeAware(["8.0" => "int"], default: "int|false")] +function xml_get_current_byte_index (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser) +{} /** * Free an XML parser @@ -435,7 +450,8 @@ function xml_get_current_byte_index (#[LanguageLevelTypeAware(["8.0" => "XmlPars * @return bool This function returns FALSE if parser does not * refer to a valid parser, or else it frees the parser and returns TRUE. */ -function xml_parser_free (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser) {} +function xml_parser_free (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser): bool +{} /** * Set options in an XML parser @@ -498,7 +514,8 @@ function xml_parser_free (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], defau * refer to a valid parser, or if the option could not be set. Else the * option is set and TRUE is returned. */ -function xml_parser_set_option (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, int $option, $value) {} +function xml_parser_set_option (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, int $option, $value): bool +{} /** * Get options from an XML parser @@ -507,13 +524,14 @@ function xml_parser_set_option (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], * @param int $option Which option to fetch. XML_OPTION_CASE_FOLDING * and XML_OPTION_TARGET_ENCODING are available. * See xml_parser_set_option for their description. - * @return mixed This function returns FALSE if parser does + * @return string|int This function returns FALSE if parser does * not refer to a valid parser or if option isn't * valid (generates also a E_WARNING). * Else the option's value is returned. */ #[Pure] -function xml_parser_get_option (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, int $option) {} +function xml_parser_get_option (#[LanguageLevelTypeAware(["8.0" => "XmlParser"], default: "resource")] $parser, int $option): string|int +{} define ('XML_ERROR_NONE', 0); define ('XML_ERROR_NO_MEMORY', 1); diff --git a/xmlwriter/xmlwriter.php b/xmlwriter/xmlwriter.php index 683ffe73b..037ec6ef7 100644 --- a/xmlwriter/xmlwriter.php +++ b/xmlwriter/xmlwriter.php @@ -517,25 +517,29 @@ public function flush ($empty = true) {} * @param string $uri

    * The URI of the resource for the output. *

    - * @return bool Object oriented style: Returns TRUE on success or FALSE on failure. + * @return bool|resource Object oriented style: Returns TRUE on success or FALSE on failure. *

    *

    * Procedural style: Returns a new xmlwriter resource for later use with the * xmlwriter functions on success, FALSE on error. */ -function xmlwriter_open_uri (string $uri) {} +#[LanguageLevelTypeAware(["8.0" => "XMLWriter|false"], default: "resource|false")] +function xmlwriter_open_uri (string $uri) +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    * Create new xmlwriter using memory for string output * @link https://php.net/manual/en/function.xmlwriter-open-memory.php - * @return bool Object oriented style: Returns TRUE on success or FALSE on failure. + * @return XMLWriter|false|resource Object oriented style: Returns TRUE on success or FALSE on failure. *

    *

    * Procedural style: Returns a new xmlwriter resource for later use with the * xmlwriter functions on success, FALSE on error. */ -function xmlwriter_open_memory () {} +#[LanguageLevelTypeAware(["8.0" => "XMLWriter|false"], default: "resource|false")] +function xmlwriter_open_memory (): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -551,7 +555,8 @@ function xmlwriter_open_memory () {} *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_set_indent (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, bool $enable) {} +function xmlwriter_set_indent (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, bool $enable): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -567,7 +572,8 @@ function xmlwriter_set_indent (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_set_indent_string (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $indentation) {} +function xmlwriter_set_indent_string (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $indentation): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
    @@ -579,7 +585,8 @@ function xmlwriter_set_indent_string (#[LanguageLevelTypeAware(["8.0" => "XMLWri * This resource comes from a call to {@link https://php.net/manual/en/function.xmlwriter-open-uri.php" xmlwriter_open_uri()} * or {@link https://php.net/manual/en/function.xmlwriter-open-memory.php" xmlwriter_open_memory()}.

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_start_comment (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_start_comment (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
    @@ -592,7 +599,8 @@ function xmlwriter_start_comment (#[LanguageLevelTypeAware(["8.0" => "XMLWriter" * or {@link https://php.net/manual/en/function.xmlwriter-open-memory.php" xmlwriter_open_memory()}.

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_end_comment (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_end_comment (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -608,7 +616,8 @@ function xmlwriter_end_comment (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_start_attribute (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name) {} +function xmlwriter_start_attribute (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -620,7 +629,8 @@ function xmlwriter_start_attribute (#[LanguageLevelTypeAware(["8.0" => "XMLWrite * This resource comes from a call to {@link https://php.net/manual/en/function.xmlwriter-open-uri.php" xmlwriter_open_uri()} * or {@link https://php.net/manual/en/function.xmlwriter-open-memory.php" xmlwriter_open_memory()}.

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_end_attribute (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_end_attribute (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -639,7 +649,8 @@ function xmlwriter_end_attribute (#[LanguageLevelTypeAware(["8.0" => "XMLWriter" *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_write_attribute (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name, string $value) {} +function xmlwriter_write_attribute (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name, string $value): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -661,7 +672,8 @@ function xmlwriter_write_attribute (#[LanguageLevelTypeAware(["8.0" => "XMLWrite *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_start_attribute_ns (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $prefix, string $name, string $namespace) {} +function xmlwriter_start_attribute_ns (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $prefix, string $name, string $namespace): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -686,7 +698,8 @@ function xmlwriter_start_attribute_ns (#[LanguageLevelTypeAware(["8.0" => "XMLWr *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_write_attribute_ns (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $prefix, string $name, string $namespace, string $value) {} +function xmlwriter_write_attribute_ns (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $prefix, string $name, string $namespace, string $value): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -702,7 +715,8 @@ function xmlwriter_write_attribute_ns (#[LanguageLevelTypeAware(["8.0" => "XMLWr *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_start_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name) {} +function xmlwriter_start_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -714,7 +728,8 @@ function xmlwriter_start_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter" * This resource comes from a call to {@link https://php.net/manual/en/function.xmlwriter-open-uri.php" xmlwriter_open_uri()} * or {@link https://php.net/manual/en/function.xmlwriter-open-memory.php" xmlwriter_open_memory()}.

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_end_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_end_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.2.0, PECL xmlwriter >= 2.0.4)
    @@ -726,7 +741,8 @@ function xmlwriter_end_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], * This resource comes from a call to {@link https://php.net/manual/en/function.xmlwriter-open-uri.php" xmlwriter_open_uri()} * or {@link https://php.net/manual/en/function.xmlwriter-open-memory.php" xmlwriter_open_memory()}.

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_full_end_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_full_end_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -748,7 +764,8 @@ function xmlwriter_full_end_element (#[LanguageLevelTypeAware(["8.0" => "XMLWrit *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_start_element_ns (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $prefix, string $name, string $namespace) {} +function xmlwriter_start_element_ns (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $prefix, string $name, string $namespace): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -767,7 +784,8 @@ function xmlwriter_start_element_ns (#[LanguageLevelTypeAware(["8.0" => "XMLWrit *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_write_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name, string $content) {} +function xmlwriter_write_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name, string $content): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -792,7 +810,8 @@ function xmlwriter_write_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter" *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_write_element_ns (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $prefix, string $name, string $namespace, string $content) {} +function xmlwriter_write_element_ns (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $prefix, string $name, string $namespace, string $content): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -808,7 +827,8 @@ function xmlwriter_write_element_ns (#[LanguageLevelTypeAware(["8.0" => "XMLWrit *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_start_pi (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $target) {} +function xmlwriter_start_pi (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $target): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -820,7 +840,8 @@ function xmlwriter_start_pi (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], de * This resource comes from a call to {@link https://php.net/manual/en/function.xmlwriter-open-uri.php" xmlwriter_open_uri()} * or {@link https://php.net/manual/en/function.xmlwriter-open-memory.php" xmlwriter_open_memory()}.

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_end_pi (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_end_pi (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -840,7 +861,8 @@ function xmlwriter_end_pi (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], defa * * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_write_pi (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $target, string $content) {} +function xmlwriter_write_pi (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $target, string $content): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -853,7 +875,8 @@ function xmlwriter_write_pi (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], de * or {@link https://php.net/manual/en/function.xmlwriter-open-memory.php" xmlwriter_open_memory()}.

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_start_cdata (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_start_cdata (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -866,7 +889,8 @@ function xmlwriter_start_cdata (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], * or {@link https://php.net/manual/en/function.xmlwriter-open-memory.php" xmlwriter_open_memory()}.

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_end_cdata (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_end_cdata (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -882,7 +906,8 @@ function xmlwriter_end_cdata (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], d *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_write_cdata (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $content) {} +function xmlwriter_write_cdata (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $content): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -898,7 +923,8 @@ function xmlwriter_write_cdata (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_text (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $content) {} +function xmlwriter_text (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $content): bool +{} /** * (PHP 5 >= 5.2.0, PECL xmlwriter >= 2.0.4)
    @@ -914,7 +940,8 @@ function xmlwriter_text (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], defaul *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_write_raw (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $content) {} +function xmlwriter_write_raw (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $content): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -936,7 +963,8 @@ function xmlwriter_write_raw (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], d *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_start_document (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $version = '1.0', string $encoding, string $standalone) {} +function xmlwriter_start_document (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $version = '1.0', string $encoding, string $standalone): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -949,7 +977,8 @@ function xmlwriter_start_document (#[LanguageLevelTypeAware(["8.0" => "XMLWriter * or {@link https://php.net/manual/en/function.xmlwriter-open-memory.php" xmlwriter_open_memory()}.

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_end_document (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_end_document (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -965,7 +994,8 @@ function xmlwriter_end_document (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"] *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_write_comment (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $content) {} +function xmlwriter_write_comment (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $content): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -987,7 +1017,8 @@ function xmlwriter_write_comment (#[LanguageLevelTypeAware(["8.0" => "XMLWriter" *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_start_dtd (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $qualifiedName, string $publicId, string $systemId) {} +function xmlwriter_start_dtd (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $qualifiedName, string $publicId, string $systemId): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -999,7 +1030,8 @@ function xmlwriter_start_dtd (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], d * This resource comes from a call to {@link https://php.net/manual/en/function.xmlwriter-open-uri.php" xmlwriter_open_uri()} * or {@link https://php.net/manual/en/function.xmlwriter-open-memory.php" xmlwriter_open_memory()}.

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_end_dtd (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_end_dtd (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -1024,7 +1056,8 @@ function xmlwriter_end_dtd (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], def *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_write_dtd (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name, string $publicId, string $systemId, string $content) {} +function xmlwriter_write_dtd (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name, string $publicId, string $systemId, string $content): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -1040,7 +1073,8 @@ function xmlwriter_write_dtd (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], d *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_start_dtd_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $qualifiedName) {} +function xmlwriter_start_dtd_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $qualifiedName): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -1049,7 +1083,8 @@ function xmlwriter_start_dtd_element (#[LanguageLevelTypeAware(["8.0" => "XMLWri * @param $writer * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_end_dtd_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_end_dtd_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -1068,7 +1103,8 @@ function xmlwriter_end_dtd_element (#[LanguageLevelTypeAware(["8.0" => "XMLWrite *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_write_dtd_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name, string $content) {} +function xmlwriter_write_dtd_element (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name, string $content): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -1084,7 +1120,8 @@ function xmlwriter_write_dtd_element (#[LanguageLevelTypeAware(["8.0" => "XMLWri *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_start_dtd_attlist (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name) {} +function xmlwriter_start_dtd_attlist (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -1096,7 +1133,8 @@ function xmlwriter_start_dtd_attlist (#[LanguageLevelTypeAware(["8.0" => "XMLWri * This resource comes from a call to {@link https://php.net/manual/en/function.xmlwriter-open-uri.php" xmlwriter_open_uri()} * or {@link https://php.net/manual/en/function.xmlwriter-open-memory.php" xmlwriter_open_memory()}.

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_end_dtd_attlist (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_end_dtd_attlist (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -1115,7 +1153,8 @@ function xmlwriter_end_dtd_attlist (#[LanguageLevelTypeAware(["8.0" => "XMLWrite *

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_write_dtd_attlist (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name, string $content) {} +function xmlwriter_write_dtd_attlist (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name, string $content): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -1132,7 +1171,8 @@ function xmlwriter_write_dtd_attlist (#[LanguageLevelTypeAware(["8.0" => "XMLWri * @param bool $isParam * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_start_dtd_entity (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name, bool $isParam) {} +function xmlwriter_start_dtd_entity (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, string $name, bool $isParam): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -1144,7 +1184,8 @@ function xmlwriter_start_dtd_entity (#[LanguageLevelTypeAware(["8.0" => "XMLWrit * This resource comes from a call to {@link https://php.net/manual/en/function.xmlwriter-open-uri.php" xmlwriter_open_uri()} * or {@link https://php.net/manual/en/function.xmlwriter-open-memory.php" xmlwriter_open_memory()}.

    * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_end_dtd_entity (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer) {} +function xmlwriter_end_dtd_entity (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -1167,7 +1208,8 @@ function xmlwriter_end_dtd_entity (#[LanguageLevelTypeAware(["8.0" => "XMLWriter * @param string $ndataid * @return bool TRUE on success or FALSE on failure. */ -function xmlwriter_write_dtd_entity (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, $name, $content, $pe, $pubid, $sysid, $ndataid) {} +function xmlwriter_write_dtd_entity (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, $name, $content, $pe, $pubid, $sysid, $ndataid): bool +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
    @@ -1183,7 +1225,8 @@ function xmlwriter_write_dtd_entity (#[LanguageLevelTypeAware(["8.0" => "XMLWrit *

    * @return string the current buffer as a string. */ -function xmlwriter_output_memory (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, bool $flush = true) {} +function xmlwriter_output_memory (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, bool $flush = true): string +{} /** * (PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
    @@ -1197,8 +1240,9 @@ function xmlwriter_output_memory (#[LanguageLevelTypeAware(["8.0" => "XMLWriter" * @param bool $empty [optional]

    * Whether to empty the buffer or not. Default is TRUE. *

    - * @return mixed If you opened the writer in memory, this function returns the generated XML buffer, + * @return string|int If you opened the writer in memory, this function returns the generated XML buffer, * Else, if using URI, this function will write the buffer and return the number of * written bytes. */ -function xmlwriter_flush (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, bool $empty = true) {} +function xmlwriter_flush (#[LanguageLevelTypeAware(["8.0" => "XMLWriter"], default: "resource")] $writer, bool $empty = true): string|int +{} diff --git a/zlib/zlib.php b/zlib/zlib.php index 877bcecf4..c6b63c32f 100644 --- a/zlib/zlib.php +++ b/zlib/zlib.php @@ -17,7 +17,7 @@ *

    * @return int|false the number of (uncompressed) bytes read from the file, or FALSE on error */ -function readgzfile (string $filename, int $use_include_path = 0) {} +function readgzfile (string $filename, int $use_include_path = 0): int|false {} /** * Rewind the position of a gz-file pointer @@ -28,7 +28,8 @@ function readgzfile (string $filename, int $use_include_path = 0) {} *

    * @return bool TRUE on success or FALSE on failure. */ -function gzrewind ($stream) {} +function gzrewind ($stream): bool +{} /** * Close an open gz-file pointer @@ -39,7 +40,8 @@ function gzrewind ($stream) {} *

    * @return bool TRUE on success or FALSE on failure. */ -function gzclose ($stream) {} +function gzclose ($stream): bool +{} /** * Test for EOF on a gz-file pointer @@ -48,10 +50,10 @@ function gzclose ($stream) {} * The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. *

    - * @return int|bool TRUE if the gz-file pointer is at EOF or an error occurs; + * @return bool TRUE if the gz-file pointer is at EOF or an error occurs; * otherwise returns FALSE. */ -function gzeof ($stream) {} +function gzeof ($stream): bool {} /** * Get character from gz-file pointer @@ -62,7 +64,7 @@ function gzeof ($stream) {} *

    * @return string|false The uncompressed character or FALSE on EOF (unlike gzeof). */ -function gzgetc ($stream) {} +function gzgetc ($stream): string|false {} /** * Get line from file pointer @@ -76,7 +78,7 @@ function gzgetc ($stream) {} *

    * @return string|false The uncompressed string, or FALSE on error. */ -function gzgets ($stream, int $length) {} +function gzgets ($stream, int $length): string|false {} /** * Get line from gz-file pointer and strip HTML tags @@ -109,9 +111,9 @@ function gzgetss ($zp, int $length, $allowable_tags) * @param int $length

    * The number of bytes to read. *

    - * @return string The data that have been read. + * @return string|false The data that have been read. */ -function gzread ($stream, int $length) {} +function gzread ($stream, int $length): string|false {} /** * Open gz-file @@ -152,7 +154,8 @@ function gzopen (string $filename, string $mode, int $use_include_path = 0) {} * @return int The number of uncompressed characters read from gz * and passed through to the input, or FALSE on error. */ -function gzpassthru ($stream) {} +function gzpassthru ($stream): int +{} /** * Seek on a gz-file pointer @@ -176,7 +179,8 @@ function gzpassthru ($stream) {} * @return int Upon success, returns 0; otherwise, returns -1. Note that seeking * past EOF is not considered an error. */ -function gzseek ($stream, int $offset, int $whence = SEEK_SET) {} +function gzseek ($stream, int $offset, int $whence = SEEK_SET): int +{} /** * Tell gz-file pointer read/write position @@ -187,7 +191,7 @@ function gzseek ($stream, int $offset, int $whence = SEEK_SET) {} *

    * @return int|false The position of the file pointer or FALSE if an error occurs. */ -function gztell ($stream) {} +function gztell ($stream): int|false {} /** * Binary-safe gz-file write @@ -211,10 +215,10 @@ function gztell ($stream) {} * configuration option will be ignored and no slashes will be * stripped from string. *

    - * @return int the number of (uncompressed) bytes written to the given gz-file + * @return int|false the number of (uncompressed) bytes written to the given gz-file * stream. */ -function gzwrite ($stream, string $data, int $length) +function gzwrite ($stream, string $data, int $length): int|false {} /** @@ -224,7 +228,7 @@ function gzwrite ($stream, string $data, int $length) * @param string $data * @param int $length [optional] */ -function gzputs ($stream, string $data, int $length) {} +function gzputs ($stream, string $data, int $length): int|false {} /** * Read entire gz-file into an array @@ -236,9 +240,9 @@ function gzputs ($stream, string $data, int $length) {} * You can set this optional parameter to 1, if you * want to search for the file in the include_path too. *

    - * @return array An array containing the file, one line per cell. + * @return array|false An array containing the file, one line per cell. */ -function gzfile (string $filename, int $use_include_path = 0) {} +function gzfile (string $filename, int $use_include_path = 0): array|false {} /** * Compress a string @@ -259,7 +263,7 @@ function gzfile (string $filename, int $use_include_path = 0) {} * @return string|false The compressed string or FALSE if an error occurred. */ #[Pure] -function gzcompress (string $data, int $level = -1, int $encoding = ZLIB_ENCODING_DEFLATE) {} +function gzcompress (string $data, int $level = -1, int $encoding = ZLIB_ENCODING_DEFLATE): string|false {} /** * Uncompress a compressed string @@ -278,7 +282,7 @@ function gzcompress (string $data, int $level = -1, int $encoding = ZLIB_ENCODIN * or more than the optional parameter length. */ #[Pure] -function gzuncompress (string $data, int $max_length = 0) {} +function gzuncompress (string $data, int $max_length = 0): string|false {} /** * Deflate a string @@ -297,7 +301,7 @@ function gzuncompress (string $data, int $max_length = 0) {} * @return string|false The deflated string or FALSE if an error occurred. */ #[Pure] -function gzdeflate (string $data, int $level = -1, int $encoding = ZLIB_ENCODING_RAW) {} +function gzdeflate (string $data, int $level = -1, int $encoding = ZLIB_ENCODING_RAW): string|false {} /** * Inflate a deflated string @@ -316,7 +320,7 @@ function gzdeflate (string $data, int $level = -1, int $encoding = ZLIB_ENCODING * or more than the optional parameter length. */ #[Pure] -function gzinflate (string $data, int $max_length = 0) {} +function gzinflate (string $data, int $max_length = 0): string|false {} /** * Create a gzip compressed string @@ -346,7 +350,7 @@ function gzinflate (string $data, int $max_length = 0) {} * @return string|false The encoded string, or FALSE if an error occurred. */ #[Pure] -function gzencode (string $data, int $level = -1, int $encoding = FORCE_GZIP) {} +function gzencode (string $data, int $level = -1, int $encoding = FORCE_GZIP): string|false {} /** * Decodes a gzip compressed string @@ -361,7 +365,7 @@ function gzencode (string $data, int $level = -1, int $encoding = FORCE_GZIP) {} * @since 5.4 */ #[Pure] -function gzdecode (string $data, int $max_length) +function gzdecode (string $data, int $max_length): string|false {} /** @@ -373,43 +377,43 @@ function gzdecode (string $data, int $max_length) *

    * @param int $level [optional] default -1

    *

    - * @return string + * @return string|false * @since 5.4 */ #[Pure] -function zlib_encode (string $data, int $encoding, int $level) {} +function zlib_encode (string $data, int $encoding, int $level): string|false {} /** * Uncompress any raw/gzip/zlib encoded data * @link https://php.net/manual/en/function.zlib-decode.php * @param string $data

    *

    - * @param string $max_length [optional]

    + * @param int $max_length [optional]

    *

    - * @return string + * @return string|false * @since 5.4 */ #[Pure] -function zlib_decode (string $data, int $max_length) +function zlib_decode (string $data, int $max_length): string|false {} /** * Returns the coding type used for output compression * @link https://php.net/manual/en/function.zlib-get-coding-type.php - * @return string Possible return values are gzip, deflate, + * @return string|false Possible return values are gzip, deflate, * or FALSE. */ #[Pure] -function zlib_get_coding_type () {} +function zlib_get_coding_type (): string|false {} /** * ob_start callback function to gzip output buffer * @link https://php.net/manual/en/function.ob-gzhandler.php * @param string $data * @param int $flags - * @return string + * @return string|false */ -function ob_gzhandler (string $data, int $flags) {} +function ob_gzhandler (string $data, int $flags): string|false {} /** * Initialize an incremental deflate context @@ -433,6 +437,7 @@ function ob_gzhandler (string $data, int $flags) {} * @since 7.0 */ #[Pure] +#[LanguageLevelTypeAware(["8.0" => "DeflateContext|false"], default: "resource|false")] function deflate_init (int $encoding, array $options = array()) {} /** @@ -456,7 +461,7 @@ function deflate_init (int $encoding, array $options = array()) {} *

    * @since 7.0 */ -function deflate_add (#[LanguageLevelTypeAware(["8.0" => "DeflateContext"], default: "resource")] $context, string $data, int $flush_mode = ZLIB_SYNC_FLUSH) {} +function deflate_add (#[LanguageLevelTypeAware(["8.0" => "DeflateContext"], default: "resource")] $context, string $data, int $flush_mode = ZLIB_SYNC_FLUSH): string|false {} /** * Initialize an incremental inflate context @@ -480,6 +485,7 @@ function deflate_add (#[LanguageLevelTypeAware(["8.0" => "DeflateContext"], defa * @since 7.0 */ #[Pure] +#[LanguageLevelTypeAware(["8.0" => "InflateContext|false"], default: "resource|false")] function inflate_init (int $encoding, array $options = array()) {} /** @@ -503,25 +509,25 @@ function inflate_init (int $encoding, array $options = array()) {} *

    * @since 7.0 */ -function inflate_add (#[LanguageLevelTypeAware(["8.0" => "InflateContext"], default: "resource")] $context, string $data, int $flush_mode = ZLIB_SYNC_FLUSH) {} +function inflate_add (#[LanguageLevelTypeAware(["8.0" => "InflateContext"], default: "resource")] $context, string $data, int $flush_mode = ZLIB_SYNC_FLUSH): string|false {} /** * Get number of bytes read so far * @param InflateContext|resource $context - * @return bool + * @return int * @since 7.2 */ #[Pure] -function inflate_get_read_len (#[LanguageLevelTypeAware(["8.0" => "InflateContext"], default: "resource")] $context){} +function inflate_get_read_len (#[LanguageLevelTypeAware(["8.0" => "InflateContext"], default: "resource")] $context): int{} /** * Get decompression status * @param InflateContext|resource $context - * @return bool + * @return int * @since 7.2 */ #[Pure] -function inflate_get_status(#[LanguageLevelTypeAware(["8.0" => "InflateContext"], default: "resource")] $context) {} +function inflate_get_status(#[LanguageLevelTypeAware(["8.0" => "InflateContext"], default: "resource")] $context): int {} /** * @since 8.0