Skip to content

Commit 8be3103

Browse files
committed
Fix tests
1 parent 70acaf5 commit 8be3103

5 files changed

+25
-26
lines changed

ext/spl/spl_observer.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ public function contains(object $object): bool {}
3434
public function addAll(SplObjectStorage $storage): int {}
3535

3636
/** @tentative-return-type */
37-
public function removeAll(SplObjectStorage $storage): void {}
37+
public function removeAll(SplObjectStorage $storage): int {}
3838

3939
/** @tentative-return-type */
40-
public function removeAllExcept(SplObjectStorage $storage): void {}
40+
public function removeAllExcept(SplObjectStorage $storage): int {}
4141

4242
/** @tentative-return-type */
4343
public function getInfo(): mixed {}

ext/spl/spl_observer_arginfo.h

Lines changed: 3 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: 743017a29d50b11d3e18476664ad4c5f648d2571 */
2+
* Stub hash: 7afd0fa1170cb9c21bef514336e6cfb38dccdacd */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_SplObserver_update, 0, 1, IS_VOID, 0)
55
ZEND_ARG_OBJ_INFO(0, subject, SplSubject, 0)
@@ -31,11 +31,9 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplObjectStorage
3131
ZEND_ARG_OBJ_INFO(0, storage, SplObjectStorage, 0)
3232
ZEND_END_ARG_INFO()
3333

34-
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplObjectStorage_removeAll, 0, 1, IS_VOID, 0)
35-
ZEND_ARG_OBJ_INFO(0, storage, SplObjectStorage, 0)
36-
ZEND_END_ARG_INFO()
34+
#define arginfo_class_SplObjectStorage_removeAll arginfo_class_SplObjectStorage_addAll
3735

38-
#define arginfo_class_SplObjectStorage_removeAllExcept arginfo_class_SplObjectStorage_removeAll
36+
#define arginfo_class_SplObjectStorage_removeAllExcept arginfo_class_SplObjectStorage_addAll
3937

4038
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplObjectStorage_getInfo, 0, 0, IS_MIXED, 0)
4139
ZEND_END_ARG_INFO()

ext/spl/tests/SplObjectStorage_getHash.phpt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ $s[$o1] = "some_value\n";
99
echo $s->offsetGet($o1);
1010

1111
class MySplObjectStorage extends SplObjectStorage {
12-
public function getHash($obj): string {
13-
return "2";
12+
#[ReturnTypeWillChange]
13+
public function getHash($obj) {
14+
return 2;
1415
}
1516
}
1617

1718
try {
1819
$s1 = new MySplObjectStorage;
1920
$s1[$o1] = "foo";
2021
} catch(Exception $e) {
21-
echo "caught\n";
22+
echo "caught 1\n";
2223
}
2324

2425
class MySplObjectStorage2 extends SplObjectStorage {
@@ -32,7 +33,7 @@ try {
3233
$s2 = new MySplObjectStorage2;
3334
$s2[$o2] = "foo";
3435
} catch(Exception $e) {
35-
echo "caught\n";
36+
echo "caught 2\n";
3637
}
3738

3839
class MySplObjectStorage3 extends SplObjectStorage {
@@ -51,8 +52,8 @@ var_dump($s3[$o1] === $s3[$o2]);
5152
?>
5253
--EXPECT--
5354
some_value
54-
caught
55-
caught
55+
caught 1
56+
caught 2
5657
object(stdClass)#2 (0) {
5758
}
5859
bool(true)

ext/spl/tests/SplObjectStorage_removeAllExcept_basic.phpt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ Matthew Turland ([email protected])
55
--FILE--
66
<?php
77

8-
$a = (object) 'a';
9-
$b = (object) 'b';
10-
$c = (object) 'c';
8+
$a = (object) 'a';
9+
$b = (object) 'b';
10+
$c = (object) 'c';
1111

12-
$foo = new SplObjectStorage;
13-
$foo->attach($a);
14-
$foo->attach($b);
12+
$foo = new SplObjectStorage;
13+
$foo->attach($a);
14+
$foo->attach($b);
1515

16-
$bar = new SplObjectStorage;
17-
$bar->attach($b);
18-
$bar->attach($c);
16+
$bar = new SplObjectStorage;
17+
$bar->attach($b);
18+
$bar->attach($c);
1919

20-
$foo->removeAllExcept($bar);
21-
var_dump($foo->contains($a));
22-
var_dump($foo->contains($b));
20+
$foo->removeAllExcept($bar);
21+
var_dump($foo->contains($a));
22+
var_dump($foo->contains($b));
2323

2424
?>
2525
--EXPECT--

ext/spl/tests/observer_008.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $a = new A;
1212
$a->attach($o1);
1313
$a->attach($o2);
1414

15-
$b = new SplObjectSTorage();
15+
$b = new SplObjectStorage();
1616
$b->attach($o2);
1717
$b->attach($o3);
1818

0 commit comments

Comments
 (0)