Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions ext/spl/spl_directory.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ public function rewind(): void {}
public function valid(): bool {}

/** @return int */
public function key() {}
public function key() {} // TODO change return type to string

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

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

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

/** @return string|SplFileInfo|FilesystemIterator */
public function current() {}
Expand Down Expand Up @@ -206,7 +206,7 @@ public function fgets(): string {}
public function fread(int $length): string|false {}

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

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

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

/** @tentative-return-type */
public function key(): int {}
Expand Down
9 changes: 4 additions & 5 deletions ext/spl/spl_directory_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 075912b601422bba070eab7618a915a01327eb5d */
* Stub hash: d14bdc42fcf352bcfaadab01c44856d72ec4ee26 */

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
Expand Down Expand Up @@ -122,7 +122,7 @@ ZEND_END_ARG_INFO()

#define arginfo_class_FilesystemIterator_rewind arginfo_class_SplFileInfo__bad_state_ex

#define arginfo_class_FilesystemIterator_key arginfo_class_DirectoryIterator_key
#define arginfo_class_FilesystemIterator_key arginfo_class_SplFileInfo_getPath

#define arginfo_class_FilesystemIterator_current arginfo_class_DirectoryIterator_key

Expand Down Expand Up @@ -180,7 +180,7 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_SplFileObject_fr
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_SplFileObject_fgetcsv, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE|MAY_BE_NULL)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_SplFileObject_fgetcsv, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, separator, IS_STRING, 0, "\",\"")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enclosure, IS_STRING, 0, "\"\\\"\"")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, escape, IS_STRING, 0, "\"\\\\\"")
Expand Down Expand Up @@ -236,8 +236,7 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplFileObject_ft
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_SplFileObject_current, 0, 0, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_END_ARG_INFO()
#define arginfo_class_SplFileObject_current arginfo_class_SplFileInfo_getType

#define arginfo_class_SplFileObject_key arginfo_class_FilesystemIterator_getFlags

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Invalid SplFileObject::getCurrentLine() return type
<?php

class MySplFileObject extends SplFileObject {
public function getCurrentLine(): array {
public function getCurrentLine(): string {
return [1, 2, 3];
}
}
Expand All @@ -18,4 +18,4 @@ try {

?>
--EXPECT--
getCurrentLine(): Return value must be of type string, array returned
MySplFileObject::getCurrentLine(): Return value must be of type string, array returned
2 changes: 1 addition & 1 deletion ext/spl/tests/recursivedualiterator.inc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class RecursiveDualIterator extends DualIterator implements RecursiveIterator
/** @return RecursiveDualIterator (late binding) for the two inner
* iterators current children.
*/
function getChildren(): object
function getChildren(): RecursiveDualIterator
{
if (empty($this->ref))
{
Expand Down