diff --git a/ext/phar/tests/phar_oo_004.phpt b/ext/phar/tests/phar_oo_004.phpt index 097af93bbd9d..09c941bd4b84 100644 --- a/ext/phar/tests/phar_oo_004.phpt +++ b/ext/phar/tests/phar_oo_004.phpt @@ -43,13 +43,13 @@ class MyDirectoryIterator extends DirectoryIterator return parent::valid(); } - function key(): mixed + function key(): int { echo __METHOD__ . "\n"; return parent::key(); } - function current(): mixed + function current(): MyDirectoryIterator { echo __METHOD__ . "\n"; return parent::current(); diff --git a/ext/spl/spl_directory.stub.php b/ext/spl/spl_directory.stub.php index 6194a8617b43..953069d7f51a 100644 --- a/ext/spl/spl_directory.stub.php +++ b/ext/spl/spl_directory.stub.php @@ -123,17 +123,11 @@ public function rewind(): void {} /** @tentative-return-type */ public function valid(): bool {} - /** - * @tentative-return-type - * @return int - */ - public function key(): mixed {} // TODO change return type to string + /** @tentative-return-type */ + public function key(): int|string {} - /** - * @tentative-return-type - * @return DirectoryIterator - */ - public function current(): mixed {} // TODO narrow return type + /** @tentative-return-type */ + public function current(): string|SplFileInfo|RecursiveDirectoryIterator {} /** @tentative-return-type */ public function next(): void {} diff --git a/ext/spl/spl_directory_arginfo.h b/ext/spl/spl_directory_arginfo.h index 16860be558d7..7ffb51a62325 100644 --- a/ext/spl/spl_directory_arginfo.h +++ b/ext/spl/spl_directory_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit spl_directory.stub.php instead. - * Stub hash: 802429d736404c2d66601f640942c827b6e6e94b */ + * Stub hash: fee85b1938fe217aba54b1d6438dbe9034f6bbb1 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) @@ -103,10 +103,11 @@ ZEND_END_ARG_INFO() #define arginfo_class_DirectoryIterator_valid arginfo_class_SplFileInfo_isWritable -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_DirectoryIterator_key, 0, 0, IS_MIXED, 0) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_DirectoryIterator_key, 0, 0, MAY_BE_LONG|MAY_BE_STRING) ZEND_END_ARG_INFO() -#define arginfo_class_DirectoryIterator_current arginfo_class_DirectoryIterator_key +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_DirectoryIterator_current, 0, 0, SplFileInfo|RecursiveDirectoryIterator, MAY_BE_STRING) +ZEND_END_ARG_INFO() #define arginfo_class_DirectoryIterator_next arginfo_class_DirectoryIterator_rewind