Make DirectoryIterator current() / key() return types tentative

Fixes GH-8192.
This commit is contained in:
Nikita Popov 2022-03-12 17:31:38 +01:00
parent 0b1bca6b9c
commit d0a0518798
3 changed files with 12 additions and 4 deletions

2
NEWS
View File

@ -23,6 +23,8 @@ PHP NEWS
- SPL:
. Fixed bug GH-8121 (SplFileObject - seek and key with csv file inconsistent).
(cmb)
. Fixed bug GH-8192 (Cannot override DirectoryIterator::current() without
return typehint in 8.1). (Nikita)
- Standard:
. Fixed bug GH-8048 (Force macOS to use statfs). (risner)

View File

@ -123,10 +123,16 @@ class DirectoryIterator extends SplFileInfo implements SeekableIterator
/** @tentative-return-type */
public function valid(): bool {}
/** @return int */
/**
* @tentative-return-type
* @return int
*/
public function key(): mixed {} // TODO change return type to string
/** @return DirectoryIterator */
/**
* @tentative-return-type
* @return DirectoryIterator
*/
public function current(): mixed {} // TODO narrow return type
/** @tentative-return-type */

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: eab71d8a7172dba2dac3c6fa97b2064c7a99191f */
* Stub hash: 3f2caf1c46760d8ef629ccb2e94ab0dba09f713b */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
@ -102,7 +102,7 @@ ZEND_END_ARG_INFO()
#define arginfo_class_DirectoryIterator_valid arginfo_class_SplFileInfo_isWritable
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_DirectoryIterator_key, 0, 0, IS_MIXED, 0)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_DirectoryIterator_key, 0, 0, IS_MIXED, 0)
ZEND_END_ARG_INFO()
#define arginfo_class_DirectoryIterator_current arginfo_class_DirectoryIterator_key