Skip to content

Commit 03c3cbb

Browse files
committed
Address review comments
1 parent 587ff49 commit 03c3cbb

4 files changed

+13
-14
lines changed

ext/spl/spl_directory.stub.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ public function rewind(): void {}
123123
public function valid(): bool {}
124124

125125
/** @return int */
126-
public function key() {}
126+
public function key() {} // TODO change return type to string
127127

128128
/** @return DirectoryIterator */
129-
public function current() {}
129+
public function current() {} // TODO fix return type so that FilesystemIterator::current() remains compatible
130130

131131
/** @tentative-return-type */
132132
public function next(): void {}
@@ -145,8 +145,8 @@ public function __construct(string $directory, int $flags = FilesystemIterator::
145145
/** @tentative-return-type */
146146
public function rewind(): void {}
147147

148-
/** @return string */
149-
public function key() {}
148+
/** @tentative-return-type */
149+
public function key(): string {}
150150

151151
/** @return string|SplFileInfo|FilesystemIterator */
152152
public function current() {}
@@ -206,7 +206,7 @@ public function fgets(): string {}
206206
public function fread(int $length): string|false {}
207207

208208
/** @tentative-return-type */
209-
public function fgetcsv(string $separator = ",", string $enclosure = "\"", string $escape = "\\"): array|false|null {}
209+
public function fgetcsv(string $separator = ",", string $enclosure = "\"", string $escape = "\\"): array|false {}
210210

211211
/** @tentative-return-type */
212212
public function fputcsv(array $fields, string $separator = ",", string $enclosure = "\"", string $escape = "\\", string $eol = "\n"): int|false {}
@@ -251,7 +251,7 @@ public function fstat(): array {}
251251
public function ftruncate(int $size): bool {}
252252

253253
/** @tentative-return-type */
254-
public function current(): string|array|false {}
254+
public function current(): string|false {}
255255

256256
/** @tentative-return-type */
257257
public function key(): int {}

ext/spl/spl_directory_arginfo.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 075912b601422bba070eab7618a915a01327eb5d */
2+
* Stub hash: d14bdc42fcf352bcfaadab01c44856d72ec4ee26 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
@@ -122,7 +122,7 @@ ZEND_END_ARG_INFO()
122122

123123
#define arginfo_class_FilesystemIterator_rewind arginfo_class_SplFileInfo__bad_state_ex
124124

125-
#define arginfo_class_FilesystemIterator_key arginfo_class_DirectoryIterator_key
125+
#define arginfo_class_FilesystemIterator_key arginfo_class_SplFileInfo_getPath
126126

127127
#define arginfo_class_FilesystemIterator_current arginfo_class_DirectoryIterator_key
128128

@@ -180,7 +180,7 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_SplFileObject_fr
180180
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
181181
ZEND_END_ARG_INFO()
182182

183-
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_SplFileObject_fgetcsv, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE|MAY_BE_NULL)
183+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_SplFileObject_fgetcsv, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
184184
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, separator, IS_STRING, 0, "\",\"")
185185
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enclosure, IS_STRING, 0, "\"\\\"\"")
186186
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, escape, IS_STRING, 0, "\"\\\\\"")
@@ -236,8 +236,7 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplFileObject_ft
236236
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
237237
ZEND_END_ARG_INFO()
238238

239-
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_SplFileObject_current, 0, 0, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_FALSE)
240-
ZEND_END_ARG_INFO()
239+
#define arginfo_class_SplFileObject_current arginfo_class_SplFileInfo_getType
241240

242241
#define arginfo_class_SplFileObject_key arginfo_class_FilesystemIterator_getFlags
243242

ext/spl/tests/SplFileObject_getCurrentLine_invalid_override.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Invalid SplFileObject::getCurrentLine() return type
44
<?php
55

66
class MySplFileObject extends SplFileObject {
7-
public function getCurrentLine(): array {
7+
public function getCurrentLine(): string {
88
return [1, 2, 3];
99
}
1010
}
@@ -18,4 +18,4 @@ try {
1818

1919
?>
2020
--EXPECT--
21-
getCurrentLine(): Return value must be of type string, array returned
21+
MySplFileObject::getCurrentLine(): Return value must be of type string, array returned

ext/spl/tests/recursivedualiterator.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class RecursiveDualIterator extends DualIterator implements RecursiveIterator
4040
/** @return RecursiveDualIterator (late binding) for the two inner
4141
* iterators current children.
4242
*/
43-
function getChildren(): object
43+
function getChildren(): RecursiveDualIterator
4444
{
4545
if (empty($this->ref))
4646
{

0 commit comments

Comments
 (0)