Skip to content

Commit 54085eb

Browse files
committed
Test fixes
1 parent a594b89 commit 54085eb

25 files changed

+69
-67
lines changed

Zend/tests/bug32993.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Test implements Iterator {
88

99
public function rewind(): void { reset($this->arr); }
1010
public function current(): mixed { throw new Exception(); }
11-
public function key() { return key($this->arr); }
11+
public function key(): mixed { return key($this->arr); }
1212
public function next(): void { next($this->arr); }
1313
public function valid(): bool { return (current($this->arr) !== false); }
1414
}

Zend/tests/tentative_type_early_binding.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Check that both warning and unresolved during early binding is handled
33
--FILE--
44
<?php
55
class Test extends SplObjectStorage {
6-
function valid(): bool {}
6+
function valid() {}
77
function current(): Unknown {}
88
}
99
?>

Zend/zend_exceptions.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ private function __clone(): void {}
3636

3737
public function __construct(string $message = "", int $code = 0, ?Throwable $previous = null) {}
3838

39-
/** @return void */
40-
public function __wakeup() {}
39+
/** @tentative-return-type */
40+
public function __wakeup(): void {}
4141

4242
final public function getMessage(): string {}
4343

Zend/zend_exceptions_arginfo.h

Lines changed: 4 additions & 4 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: e77ba21c194c4c6b47cdabc8766fb5f37179d155 */
2+
* Stub hash: 48d8444730a0e1fbc5d81965733deb3d3c11e122 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Throwable_getMessage, 0, 0, IS_STRING, 0)
55
ZEND_END_ARG_INFO()
@@ -29,7 +29,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Exception___construct, 0, 0, 0)
2929
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, previous, Throwable, 1, "null")
3030
ZEND_END_ARG_INFO()
3131

32-
#define arginfo_class_Exception___wakeup arginfo_class_Throwable_getCode
32+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Exception___wakeup, 0, 0, IS_VOID, 0)
33+
ZEND_END_ARG_INFO()
3334

3435
#define arginfo_class_Exception_getMessage arginfo_class_Throwable_getMessage
3536

@@ -62,8 +63,7 @@ ZEND_END_ARG_INFO()
6263

6364
#define arginfo_class_Error___construct arginfo_class_Exception___construct
6465

65-
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Error___wakeup, 0, 0, IS_VOID, 0)
66-
ZEND_END_ARG_INFO()
66+
#define arginfo_class_Error___wakeup arginfo_class_Exception___wakeup
6767

6868
#define arginfo_class_Error_getMessage arginfo_class_Throwable_getMessage
6969

Zend/zend_interfaces.stub.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ public function getIterator(): Traversable;
1313
interface Iterator extends Traversable
1414
{
1515
/** @return mixed */
16-
public function current(); // TODO Can't add tentative return tyoe due to DirectoryIterator::current()
16+
public function current(): mixed;
1717

1818
/** @tentative-return-type */
1919
public function next(): void;
2020

2121
/** @return mixed */
22-
public function key(); // TODO Can't add tentative return tyoe due to DirectoryIterator::key()
22+
public function key(): mixed;
2323

2424
/** @tentative-return-type */
2525
public function valid(): bool;
@@ -42,8 +42,8 @@ public function offsetGet(mixed $offset): mixed;
4242
/** @tentative-return-type */
4343
public function offsetSet(mixed $offset, mixed $value): void;
4444

45-
/** @return void */
46-
public function offsetUnset(mixed $offset); // TODO Can't add tentative return type due to Phar::offsetUnset
45+
/** @tentative-return-type */
46+
public function offsetUnset(mixed $offset): void;
4747
}
4848

4949
interface Serializable
@@ -57,8 +57,7 @@ public function unserialize(string $data);
5757

5858
interface Countable
5959
{
60-
/** @return int */
61-
public function count(); // TODO Can't add tentatie return type due to DOMNodeList::count() and DOMNamedNodeMap::count()
60+
public function count(): int;
6261
}
6362

6463
interface Stringable

Zend/zend_interfaces_arginfo.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 29ecd0161c7f7521f2f149e438182c247e658bb2 */
2+
* Stub hash: b43f6527e45ee22732e3227e933a8950a641a8b5 */
33

44
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_IteratorAggregate_getIterator, 0, 0, Traversable, 0)
55
ZEND_END_ARG_INFO()
66

7-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Iterator_current, 0, 0, 0)
7+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Iterator_current, 0, 0, IS_MIXED, 0)
88
ZEND_END_ARG_INFO()
99

1010
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Iterator_next, 0, 0, IS_VOID, 0)
@@ -30,27 +30,28 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ArrayAccess_offs
3030
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
3131
ZEND_END_ARG_INFO()
3232

33-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayAccess_offsetUnset, 0, 0, 1)
33+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ArrayAccess_offsetUnset, 0, 1, IS_VOID, 0)
3434
ZEND_ARG_TYPE_INFO(0, offset, IS_MIXED, 0)
3535
ZEND_END_ARG_INFO()
3636

37-
#define arginfo_class_Serializable_serialize arginfo_class_Iterator_current
37+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Serializable_serialize, 0, 0, 0)
38+
ZEND_END_ARG_INFO()
3839

3940
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Serializable_unserialize, 0, 0, 1)
4041
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
4142
ZEND_END_ARG_INFO()
4243

43-
#define arginfo_class_Countable_count arginfo_class_Iterator_current
44+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Countable_count, 0, 0, IS_LONG, 0)
45+
ZEND_END_ARG_INFO()
4446

4547
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Stringable___toString, 0, 0, IS_STRING, 0)
4648
ZEND_END_ARG_INFO()
4749

48-
#define arginfo_class_InternalIterator___construct arginfo_class_Iterator_current
50+
#define arginfo_class_InternalIterator___construct arginfo_class_Serializable_serialize
4951

50-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_InternalIterator_current, 0, 0, IS_MIXED, 0)
51-
ZEND_END_ARG_INFO()
52+
#define arginfo_class_InternalIterator_current arginfo_class_Iterator_current
5253

53-
#define arginfo_class_InternalIterator_key arginfo_class_InternalIterator_current
54+
#define arginfo_class_InternalIterator_key arginfo_class_Iterator_current
5455

5556
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_InternalIterator_next, 0, 0, IS_VOID, 0)
5657
ZEND_END_ARG_INFO()

ext/phar/tests/bug45218_SLOWTEST.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class myIterator implements Iterator
1919
var $a;
2020
var $count = 1;
2121

22-
function next(): void {
22+
#[ReturnTypeWillChange]
23+
function next() {
2324
return (++$this->count < 3000) ? 'f' . $this->count : false;
2425
}
2526
function current(): mixed {
@@ -34,7 +35,8 @@ class myIterator implements Iterator
3435
function valid(): bool {
3536
return $this->count < 3000;
3637
}
37-
function rewind(): void {
38+
#[ReturnTypeWillChange]
39+
function rewind() {
3840
$this->count = 1;
3941
return $GLOBALS['fname2'];
4042
}

ext/phar/tests/phar_buildfromiterator4.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class myIterator implements Iterator
1616
}
1717
function next(): void {
1818
echo "next\n";
19-
return next($this->a);
19+
next($this->a);
2020
}
2121
function current(): mixed {
2222
echo "current\n";
@@ -32,7 +32,7 @@ class myIterator implements Iterator
3232
}
3333
function rewind(): void {
3434
echo "rewind\n";
35-
return reset($this->a);
35+
reset($this->a);
3636
}
3737
}
3838
try {

ext/phar/tests/phar_buildfromiterator5.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class myIterator implements Iterator
1616
}
1717
function next(): void {
1818
echo "next\n";
19-
return next($this->a);
19+
next($this->a);
2020
}
2121
function current(): mixed {
2222
echo "current\n";
@@ -28,11 +28,11 @@ class myIterator implements Iterator
2828
}
2929
function valid(): bool {
3030
echo "valid\n";
31-
return current($this->a);
31+
return is_object(current($this->a));
3232
}
3333
function rewind(): void {
3434
echo "rewind\n";
35-
return reset($this->a);
35+
reset($this->a);
3636
}
3737
}
3838
try {

ext/phar/tests/phar_buildfromiterator6.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class myIterator implements Iterator
1616
}
1717
function next(): void {
1818
echo "next\n";
19-
return next($this->a);
19+
next($this->a);
2020
}
2121
function current(): mixed {
2222
echo "current\n";
@@ -32,7 +32,7 @@ class myIterator implements Iterator
3232
}
3333
function rewind(): void {
3434
echo "rewind\n";
35-
return reset($this->a);
35+
reset($this->a);
3636
}
3737
}
3838
try {

ext/phar/tests/phar_buildfromiterator7.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class myIterator implements Iterator
1616
}
1717
function next(): void {
1818
echo "next\n";
19-
return next($this->a);
19+
next($this->a);
2020
}
2121
function current(): mixed {
2222
echo "current\n";
@@ -32,7 +32,7 @@ class myIterator implements Iterator
3232
}
3333
function rewind(): void {
3434
echo "rewind\n";
35-
return reset($this->a);
35+
reset($this->a);
3636
}
3737
}
3838
try {

ext/phar/tests/phar_buildfromiterator9.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class myIterator implements Iterator
1616
}
1717
function next(): void {
1818
echo "next\n";
19-
return next($this->a);
19+
next($this->a);
2020
}
2121
function current(): mixed {
2222
echo "current\n";
@@ -28,11 +28,11 @@ class myIterator implements Iterator
2828
}
2929
function valid(): bool {
3030
echo "valid\n";
31-
return current($this->a);
31+
return (bool) current($this->a);
3232
}
3333
function rewind(): void {
3434
echo "rewind\n";
35-
return reset($this->a);
35+
reset($this->a);
3636
}
3737
}
3838
try {

ext/phar/tests/tar/phar_buildfromiterator4.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class myIterator implements Iterator
1616
}
1717
function next(): void {
1818
echo "next\n";
19-
return next($this->a);
19+
next($this->a);
2020
}
2121
function current(): mixed {
2222
echo "current\n";
@@ -32,7 +32,7 @@ class myIterator implements Iterator
3232
}
3333
function rewind(): void {
3434
echo "rewind\n";
35-
return reset($this->a);
35+
reset($this->a);
3636
}
3737
}
3838
try {

ext/phar/tests/tar/phar_buildfromiterator5.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class myIterator implements Iterator
1616
}
1717
function next(): void {
1818
echo "next\n";
19-
return next($this->a);
19+
next($this->a);
2020
}
2121
function current(): mixed {
2222
echo "current\n";
@@ -28,11 +28,11 @@ class myIterator implements Iterator
2828
}
2929
function valid(): bool {
3030
echo "valid\n";
31-
return current($this->a);
31+
return (bool) current($this->a);
3232
}
3333
function rewind(): void {
3434
echo "rewind\n";
35-
return reset($this->a);
35+
reset($this->a);
3636
}
3737
}
3838
try {

ext/phar/tests/tar/phar_buildfromiterator6.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class myIterator implements Iterator
1616
}
1717
function next(): void {
1818
echo "next\n";
19-
return next($this->a);
19+
next($this->a);
2020
}
2121
function current(): mixed {
2222
echo "current\n";
@@ -32,7 +32,7 @@ class myIterator implements Iterator
3232
}
3333
function rewind(): void {
3434
echo "rewind\n";
35-
return reset($this->a);
35+
reset($this->a);
3636
}
3737
}
3838
try {

ext/phar/tests/tar/phar_buildfromiterator7.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class myIterator implements Iterator
1616
}
1717
function next(): void {
1818
echo "next\n";
19-
return next($this->a);
19+
next($this->a);
2020
}
2121
function current(): mixed {
2222
echo "current\n";
@@ -32,7 +32,7 @@ class myIterator implements Iterator
3232
}
3333
function rewind(): void {
3434
echo "rewind\n";
35-
return reset($this->a);
35+
reset($this->a);
3636
}
3737
}
3838
try {

ext/phar/tests/tar/phar_buildfromiterator9.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class myIterator implements Iterator
1616
}
1717
function next(): void {
1818
echo "next\n";
19-
return next($this->a);
19+
next($this->a);
2020
}
2121
function current(): mixed {
2222
echo "current\n";
@@ -28,11 +28,11 @@ class myIterator implements Iterator
2828
}
2929
function valid(): bool {
3030
echo "valid\n";
31-
return current($this->a);
31+
return (bool) current($this->a);
3232
}
3333
function rewind(): void {
3434
echo "rewind\n";
35-
return reset($this->a);
35+
reset($this->a);
3636
}
3737
}
3838
try {

ext/phar/tests/zip/phar_buildfromiterator4.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class myIterator implements Iterator
1616
}
1717
function next(): void {
1818
echo "next\n";
19-
return next($this->a);
19+
next($this->a);
2020
}
2121
function current(): mixed {
2222
echo "current\n";
@@ -32,7 +32,7 @@ class myIterator implements Iterator
3232
}
3333
function rewind(): void {
3434
echo "rewind\n";
35-
return reset($this->a);
35+
reset($this->a);
3636
}
3737
}
3838
try {

0 commit comments

Comments
 (0)