Skip to content

Commit 3f5a536

Browse files
committed
Even more test fixes
1 parent 54085eb commit 3f5a536

File tree

12 files changed

+25
-15
lines changed

12 files changed

+25
-15
lines changed

Zend/zend_interfaces.stub.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ public function getIterator(): Traversable;
1212

1313
interface Iterator extends Traversable
1414
{
15-
/** @return mixed */
15+
/** @tentative-return-type */
1616
public function current(): mixed;
1717

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

21-
/** @return mixed */
21+
/** @tentative-return-type */
2222
public function key(): mixed;
2323

2424
/** @tentative-return-type */
@@ -57,6 +57,7 @@ public function unserialize(string $data);
5757

5858
interface Countable
5959
{
60+
/** @tentative-return-type */
6061
public function count(): int;
6162
}
6263

Zend/zend_interfaces_arginfo.h

Lines changed: 6 additions & 5 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: b43f6527e45ee22732e3227e933a8950a641a8b5 */
2+
* Stub hash: 339e326a82a7fd1e2ae419c8c86095e29028fbd6 */
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_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Iterator_current, 0, 0, IS_MIXED, 0)
7+
ZEND_BEGIN_ARG_WITH_TENTATIVE_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)
@@ -41,17 +41,18 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Serializable_unserialize, 0, 0, 1)
4141
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
4242
ZEND_END_ARG_INFO()
4343

44-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Countable_count, 0, 0, IS_LONG, 0)
44+
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Countable_count, 0, 0, IS_LONG, 0)
4545
ZEND_END_ARG_INFO()
4646

4747
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Stringable___toString, 0, 0, IS_STRING, 0)
4848
ZEND_END_ARG_INFO()
4949

5050
#define arginfo_class_InternalIterator___construct arginfo_class_Serializable_serialize
5151

52-
#define arginfo_class_InternalIterator_current arginfo_class_Iterator_current
52+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_InternalIterator_current, 0, 0, IS_MIXED, 0)
53+
ZEND_END_ARG_INFO()
5354

54-
#define arginfo_class_InternalIterator_key arginfo_class_Iterator_current
55+
#define arginfo_class_InternalIterator_key arginfo_class_InternalIterator_current
5556

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

ext/reflection/tests/intersection_types.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dumpType($rp->getType());
2929

3030
interface y {}
3131
class x implements Y, Countable {
32-
public function count() {}
32+
public function count(): int { return 0; }
3333
}
3434
$test = new Test;
3535
$test->prop = new x;

ext/spl/tests/countable_class_basic1.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Interface [ <internal%s> interface Countable ] {
2424

2525
- Parameters [0] {
2626
}
27+
- Tentative return [ int ]
2728
}
2829
}
2930
}

ext/spl/tests/countable_count_variation1.phpt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,34 @@ SPL: Countable::count() with wrong return types and exception.
44
<?php
55

66
Class returnNull implements Countable {
7-
function count() {
7+
function count(): int {
8+
return 0;
89
}
910
}
1011

1112
Class returnString implements Countable {
13+
#[ReturnTypeWillChange]
1214
function count() {
1315
return "hello";
1416
}
1517
}
1618

1719
Class returnObject implements Countable {
20+
#[ReturnTypeWillChange]
1821
function count() {
1922
return new returnObject;
2023
}
2124
}
2225

2326
Class returnArray implements Countable {
27+
#[ReturnTypeWillChange]
2428
function count() {
2529
return array(1,2,3);
2630
}
2731
}
2832

2933
Class throwException implements Countable {
34+
#[ReturnTypeWillChange]
3035
function count() {
3136
throw new Exception('Thrown from count');
3237
}

ext/spl/tests/observer_002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class SubjectImpl implements SplSubject
7979
$this->observers->detach($observer);
8080
}
8181

82-
function count()
82+
function count(): int
8383
{
8484
return $this->observers->count();
8585
}

ext/spl/tests/spl_002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SPL: Countable
55

66
class Test implements Countable
77
{
8-
function count()
8+
function count(): int
99
{
1010
return 4;
1111
}

ext/standard/tests/array/bug43505.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ error_reporting=0
55
--FILE--
66
<?php
77
class Test implements Countable {
8+
#[ReturnTypeWillChange]
89
public function count() {
910
return $some;
1011
}

ext/standard/tests/array/count_recursive.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class count_class implements Countable {
5858
public $var_public;
5959
protected $var_protected;
6060

61-
public function count() {
61+
public function count(): int {
6262
return 3;
6363
}
6464
}

ext/standard/tests/array/sizeof_object1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class sizeof_class implements Countable
1111
private $member2;
1212
protected $member3;
1313

14-
public function count()
14+
public function count(): int
1515
{
1616
return 3; // return the count of member variables in the object
1717
}

ext/standard/tests/general_functions/is_countable_with_classes.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Gabriel Caruso ([email protected])
77
var_dump(is_countable(new class extends ArrayIterator {}));
88
var_dump(is_countable((array) new stdClass()));
99
var_dump(is_countable(new class implements Countable {
10-
public function count()
10+
public function count(): int
1111
{
1212
return count(1, 'foo');
1313
}

sapi/cli/tests/005.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ string(183) "Class [ <internal:Core> class stdClass ] {
3737
}
3838

3939
"
40-
string(2201) "Class [ <internal:Core> class Exception implements Throwable, Stringable ] {
40+
string(2235) "Class [ <internal:Core> class Exception implements Throwable, Stringable ] {
4141

4242
- Constants [0] {
4343
}
@@ -79,6 +79,7 @@ string(2201) "Class [ <internal:Core> class Exception implements Throwable, Stri
7979

8080
- Parameters [0] {
8181
}
82+
- Tentative return [ void ]
8283
}
8384

8485
Method [ <internal:Core, prototype Throwable> final public method getMessage ] {

0 commit comments

Comments
 (0)