From 6ba24e96150fd0f536338c785412a19ab33792e1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Mon, 3 Aug 2020 00:45:12 +0200 Subject: [PATCH] Improve a few parameter names in ext/spl Use the same names which are used by zend functions. --- ext/spl/php_spl.stub.php | 17 ++++--- ext/spl/php_spl_arginfo.h | 17 +++---- ext/spl/tests/bug79432.phpt | 2 +- .../tests/class_implements_variation1.phpt | 44 +++++++++---------- ext/spl/tests/class_uses_variation1.phpt | 44 +++++++++---------- 5 files changed, 62 insertions(+), 62 deletions(-) diff --git a/ext/spl/php_spl.stub.php b/ext/spl/php_spl.stub.php index 23c858dbb9..9171e4756f 100755 --- a/ext/spl/php_spl.stub.php +++ b/ext/spl/php_spl.stub.php @@ -2,15 +2,18 @@ /** @generate-function-entries */ -function class_implements($what, bool $autoload = true): array|false {} +/** @param object|string $object_or_class */ +function class_implements($object_or_class, bool $autoload = true): array|false {} -function class_parents($instance, bool $autoload = true): array|false {} +/** @param object|string $object_or_class */ +function class_parents($object_or_class, bool $autoload = true): array|false {} -function class_uses($what, bool $autoload = true): array|false {} +/** @param object|string $object_or_class */ +function class_uses($object_or_class, bool $autoload = true): array|false {} -function spl_autoload(string $class_name, ?string $file_extensions = null): void {} +function spl_autoload(string $class, ?string $file_extensions = null): void {} -function spl_autoload_call(string $class_name): void {} +function spl_autoload_call(string $class): void {} function spl_autoload_extensions(?string $file_extensions = null): string {} @@ -22,9 +25,9 @@ function spl_autoload_unregister(callable $autoload_function): bool {} function spl_classes(): array {} -function spl_object_hash(object $obj): string {} +function spl_object_hash(object $object): string {} -function spl_object_id(object $obj): int {} +function spl_object_id(object $object): int {} function iterator_apply(Traversable $iterator, callable $function, ?array $args = null): int {} diff --git a/ext/spl/php_spl_arginfo.h b/ext/spl/php_spl_arginfo.h index 6e3caac7b6..841dff23b9 100644 --- a/ext/spl/php_spl_arginfo.h +++ b/ext/spl/php_spl_arginfo.h @@ -1,25 +1,22 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: cc1dc8de91f503a88cc7bc47ad239957c2de8303 */ + * Stub hash: 31d99979ea43e3d0d2592495977465976ca67760 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_implements, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) - ZEND_ARG_INFO(0, what) + ZEND_ARG_INFO(0, object_or_class) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, autoload, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_parents, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) - ZEND_ARG_INFO(0, instance) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, autoload, _IS_BOOL, 0, "true") -ZEND_END_ARG_INFO() +#define arginfo_class_parents arginfo_class_implements #define arginfo_class_uses arginfo_class_implements ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_autoload, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, class, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, file_extensions, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_autoload_call, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, class, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_autoload_extensions, 0, 0, IS_STRING, 0) @@ -42,11 +39,11 @@ ZEND_END_ARG_INFO() #define arginfo_spl_classes arginfo_spl_autoload_functions ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_object_hash, 0, 1, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, obj, IS_OBJECT, 0) + ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_object_id, 0, 1, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, obj, IS_OBJECT, 0) + ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_iterator_apply, 0, 2, IS_LONG, 0) diff --git a/ext/spl/tests/bug79432.phpt b/ext/spl/tests/bug79432.phpt index cce017cb63..1230340e99 100644 --- a/ext/spl/tests/bug79432.phpt +++ b/ext/spl/tests/bug79432.phpt @@ -11,4 +11,4 @@ try { ?> --EXPECT-- -spl_autoload_call(): Argument #1 ($class_name) must be of type string, array given +spl_autoload_call(): Argument #1 ($class) must be of type string, array given diff --git a/ext/spl/tests/class_implements_variation1.phpt b/ext/spl/tests/class_implements_variation1.phpt index b44838a120..2843745171 100644 --- a/ext/spl/tests/class_implements_variation1.phpt +++ b/ext/spl/tests/class_implements_variation1.phpt @@ -113,61 +113,61 @@ fclose($res); *** Testing class_implements() : variation *** --int 0-- -class_implements(): Argument #1 ($what) must be of type object|string, int given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, int given --int 1-- -class_implements(): Argument #1 ($what) must be of type object|string, int given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, int given --int 12345-- -class_implements(): Argument #1 ($what) must be of type object|string, int given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, int given --int -12345-- -class_implements(): Argument #1 ($what) must be of type object|string, int given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, int given --float 10.5-- -class_implements(): Argument #1 ($what) must be of type object|string, float given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given --float -10.5-- -class_implements(): Argument #1 ($what) must be of type object|string, float given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given --float 12.3456789000e10-- -class_implements(): Argument #1 ($what) must be of type object|string, float given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given --float -12.3456789000e10-- -class_implements(): Argument #1 ($what) must be of type object|string, float given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given --float .5-- -class_implements(): Argument #1 ($what) must be of type object|string, float given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, float given --empty array-- -class_implements(): Argument #1 ($what) must be of type object|string, array given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, array given --int indexed array-- -class_implements(): Argument #1 ($what) must be of type object|string, array given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, array given --associative array-- -class_implements(): Argument #1 ($what) must be of type object|string, array given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, array given --nested arrays-- -class_implements(): Argument #1 ($what) must be of type object|string, array given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, array given --uppercase NULL-- -class_implements(): Argument #1 ($what) must be of type object|string, null given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given --lowercase null-- -class_implements(): Argument #1 ($what) must be of type object|string, null given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given --lowercase true-- -class_implements(): Argument #1 ($what) must be of type object|string, bool given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, bool given --lowercase false-- -class_implements(): Argument #1 ($what) must be of type object|string, bool given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, bool given --uppercase TRUE-- -class_implements(): Argument #1 ($what) must be of type object|string, bool given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, bool given --uppercase FALSE-- -class_implements(): Argument #1 ($what) must be of type object|string, bool given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, bool given --empty string DQ-- Error: 2 - class_implements(): Class does not exist and could not be loaded, %s(%d) @@ -188,10 +188,10 @@ array(0) { } --undefined var-- -class_implements(): Argument #1 ($what) must be of type object|string, null given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given --unset var-- -class_implements(): Argument #1 ($what) must be of type object|string, null given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, null given --resource-- -class_implements(): Argument #1 ($what) must be of type object|string, resource given +class_implements(): Argument #1 ($object_or_class) must be of type object|string, resource given diff --git a/ext/spl/tests/class_uses_variation1.phpt b/ext/spl/tests/class_uses_variation1.phpt index 50865f4327..da26b26301 100644 --- a/ext/spl/tests/class_uses_variation1.phpt +++ b/ext/spl/tests/class_uses_variation1.phpt @@ -113,61 +113,61 @@ fclose($res); *** Testing class_uses() : variation *** --int 0-- -class_uses(): Argument #1 ($what) must be of type object|string, int given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, int given --int 1-- -class_uses(): Argument #1 ($what) must be of type object|string, int given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, int given --int 12345-- -class_uses(): Argument #1 ($what) must be of type object|string, int given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, int given --int -12345-- -class_uses(): Argument #1 ($what) must be of type object|string, int given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, int given --float 10.5-- -class_uses(): Argument #1 ($what) must be of type object|string, float given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given --float -10.5-- -class_uses(): Argument #1 ($what) must be of type object|string, float given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given --float 12.3456789000e10-- -class_uses(): Argument #1 ($what) must be of type object|string, float given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given --float -12.3456789000e10-- -class_uses(): Argument #1 ($what) must be of type object|string, float given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given --float .5-- -class_uses(): Argument #1 ($what) must be of type object|string, float given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, float given --empty array-- -class_uses(): Argument #1 ($what) must be of type object|string, array given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, array given --int indexed array-- -class_uses(): Argument #1 ($what) must be of type object|string, array given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, array given --associative array-- -class_uses(): Argument #1 ($what) must be of type object|string, array given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, array given --nested arrays-- -class_uses(): Argument #1 ($what) must be of type object|string, array given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, array given --uppercase NULL-- -class_uses(): Argument #1 ($what) must be of type object|string, null given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, null given --lowercase null-- -class_uses(): Argument #1 ($what) must be of type object|string, null given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, null given --lowercase true-- -class_uses(): Argument #1 ($what) must be of type object|string, bool given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, bool given --lowercase false-- -class_uses(): Argument #1 ($what) must be of type object|string, bool given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, bool given --uppercase TRUE-- -class_uses(): Argument #1 ($what) must be of type object|string, bool given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, bool given --uppercase FALSE-- -class_uses(): Argument #1 ($what) must be of type object|string, bool given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, bool given --empty string DQ-- Error: 2 - class_uses(): Class does not exist and could not be loaded, %s(%d) @@ -186,10 +186,10 @@ array(0) { } --undefined var-- -class_uses(): Argument #1 ($what) must be of type object|string, null given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, null given --unset var-- -class_uses(): Argument #1 ($what) must be of type object|string, null given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, null given --resource-- -class_uses(): Argument #1 ($what) must be of type object|string, resource given +class_uses(): Argument #1 ($object_or_class) must be of type object|string, resource given -- 2.40.0