Skip to content

Commit ecb3b00

Browse files
committed
Add more precise type info for ArrayAccess methods
1 parent 517c993 commit ecb3b00

12 files changed

+49
-58
lines changed

Zend/zend_weakrefs.stub.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@ final class WeakMap implements ArrayAccess, Countable, IteratorAggregate
1515
{
1616
/**
1717
* @param object $object
18-
* @return mixed
1918
*/
20-
public function offsetGet($object) {}
19+
public function offsetGet($object): mixed {}
2120

22-
/**
23-
* @param object $object
24-
* @param mixed $value
25-
*/
26-
public function offsetSet($object, $value): void {}
21+
/** @param object $object */
22+
public function offsetSet($object, mixed $value): void {}
2723

2824
/** @param object $object */
2925
public function offsetExists($object): bool {}

Zend/zend_weakrefs_arginfo.h

Lines changed: 3 additions & 3 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: 8a90ffe614346c65d312bc5061fd304056b5640a */
2+
* Stub hash: 0569bc7e10a1ec15a3a9eec481da27b647eb1d1d */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_WeakReference___construct, 0, 0, 0)
55
ZEND_END_ARG_INFO()
@@ -11,13 +11,13 @@ ZEND_END_ARG_INFO()
1111
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_WeakReference_get, 0, 0, IS_OBJECT, 1)
1212
ZEND_END_ARG_INFO()
1313

14-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_WeakMap_offsetGet, 0, 0, 1)
14+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_WeakMap_offsetGet, 0, 1, IS_MIXED, 0)
1515
ZEND_ARG_INFO(0, object)
1616
ZEND_END_ARG_INFO()
1717

1818
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_WeakMap_offsetSet, 0, 2, IS_VOID, 0)
1919
ZEND_ARG_INFO(0, object)
20-
ZEND_ARG_INFO(0, value)
20+
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
2121
ZEND_END_ARG_INFO()
2222

2323
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_WeakMap_offsetExists, 0, 1, _IS_BOOL, 0)

ext/spl/spl_array.stub.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,25 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Count
88
public function __construct($input = [], int $flags = 0, string $iterator_class = ArrayIterator::class) {}
99

1010
/**
11-
* @param mixed $index
11+
* @param array|string|float|int|bool|null $index
1212
* @return bool
1313
*/
1414
public function offsetExists($index) {}
1515

1616
/**
17-
* @param mixed $index
17+
* @param array|string|float|int|bool|null $index
1818
* @return mixed
1919
*/
2020
public function offsetGet($index) {}
2121

2222
/**
23-
* @param mixed $index
24-
* @param mixed $value
23+
* @param array|string|float|int|bool|null $index
2524
* @return void
2625
*/
27-
public function offsetSet($index, $value) {}
26+
public function offsetSet($index, mixed $value) {}
2827

2928
/**
30-
* @param mixed $index
29+
* @param array|string|float|int|bool|null $index
3130
* @return void
3231
*/
3332
public function offsetUnset($index) {}
@@ -132,11 +131,10 @@ public function offsetGet($index) {}
132131

133132
/**
134133
* @param mixed $index
135-
* @param mixed $value
136134
* @return void
137135
* @alias ArrayObject::offsetSet
138136
*/
139-
public function offsetSet($index, $value) {}
137+
public function offsetSet($index, mixed $value) {}
140138

141139
/**
142140
* @param mixed $index

ext/spl/spl_array_arginfo.h

Lines changed: 2 additions & 2 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: 1230e3161d7c7fb549c5ac2ec5cde2dec585d849 */
2+
* Stub hash: df41901acc9accd0f2eb21c4886a54cfb6362f66 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject___construct, 0, 0, 0)
55
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, input, "[]")
@@ -15,7 +15,7 @@ ZEND_END_ARG_INFO()
1515

1616
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject_offsetSet, 0, 0, 2)
1717
ZEND_ARG_INFO(0, index)
18-
ZEND_ARG_INFO(0, value)
18+
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
1919
ZEND_END_ARG_INFO()
2020

2121
#define arginfo_class_ArrayObject_offsetUnset arginfo_class_ArrayObject_offsetExists

ext/spl/spl_dllist.stub.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,23 @@ public function setIteratorMode(int $mode) {}
5050
/** @return int */
5151
public function getIteratorMode() {}
5252

53-
/**
54-
* @param int $index
55-
* @return bool
56-
*/
57-
public function offsetExists($index) {}
53+
/** @return bool */
54+
public function offsetExists(mixed $index) {}
5855

5956
/**
60-
* @param mixed $index
57+
* @param resource|string|int|float|bool $index
6158
* @return mixed
6259
*/
6360
public function offsetGet($index) {}
6461

6562
/**
66-
* @param mixed $index
67-
* @param mixed $value
63+
* @param resource|string|int|float|bool|null $index
6864
* @return void
6965
*/
70-
public function offsetSet($index, $value) {}
66+
public function offsetSet($index, mixed $value) {}
7167

7268
/**
73-
* @param mixed $index
69+
* @param resource|string|int|float|bool $index
7470
* @return void
7571
*/
7672
public function offsetUnset($index) {}

ext/spl/spl_dllist_arginfo.h

Lines changed: 10 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: 9d2c9ec251d72065d4502bbbc29e927c6b597731 */
2+
* Stub hash: 875e7a8dc94a423d567a2fcc46769a99ccbd47f0 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplDoublyLinkedList_add, 0, 0, 2)
55
ZEND_ARG_INFO(0, index)
@@ -34,14 +34,19 @@ ZEND_END_ARG_INFO()
3434
#define arginfo_class_SplDoublyLinkedList_getIteratorMode arginfo_class_SplDoublyLinkedList_pop
3535

3636
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplDoublyLinkedList_offsetExists, 0, 0, 1)
37-
ZEND_ARG_INFO(0, index)
37+
ZEND_ARG_TYPE_INFO(0, index, IS_MIXED, 0)
3838
ZEND_END_ARG_INFO()
3939

40-
#define arginfo_class_SplDoublyLinkedList_offsetGet arginfo_class_SplDoublyLinkedList_offsetExists
40+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplDoublyLinkedList_offsetGet, 0, 0, 1)
41+
ZEND_ARG_INFO(0, index)
42+
ZEND_END_ARG_INFO()
4143

42-
#define arginfo_class_SplDoublyLinkedList_offsetSet arginfo_class_SplDoublyLinkedList_add
44+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplDoublyLinkedList_offsetSet, 0, 0, 2)
45+
ZEND_ARG_INFO(0, index)
46+
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
47+
ZEND_END_ARG_INFO()
4348

44-
#define arginfo_class_SplDoublyLinkedList_offsetUnset arginfo_class_SplDoublyLinkedList_offsetExists
49+
#define arginfo_class_SplDoublyLinkedList_offsetUnset arginfo_class_SplDoublyLinkedList_offsetGet
4550

4651
#define arginfo_class_SplDoublyLinkedList_rewind arginfo_class_SplDoublyLinkedList_pop
4752

ext/spl/spl_fixedarray.stub.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,23 @@ public function getSize() {}
2424
/** @return bool */
2525
public function setSize(int $size) {}
2626

27-
/**
28-
* @param mixed $index
29-
* @return bool
30-
*/
31-
public function offsetExists($index) {}
27+
/** @return bool */
28+
public function offsetExists(mixed $index) {}
3229

3330
/**
34-
* @param mixed $index
31+
* @param resource|string|int|float|bool $index
3532
* @return mixed
3633
*/
3734
public function offsetGet($index) {}
3835

3936
/**
40-
* @param mixed $index
41-
* @param mixed $value
37+
* @param resource|string|int|float|bool $index
4238
* @return void
4339
*/
44-
public function offsetSet($index, $value) {}
40+
public function offsetSet($index, mixed $value) {}
4541

4642
/**
47-
* @param int $index
43+
* @param resource|string|int|float|bool $index
4844
* @return void
4945
*/
5046
public function offsetUnset($index) {}

ext/spl/spl_fixedarray_arginfo.h

Lines changed: 7 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: a14156d542422823fcee53eb8a151576d055f38f */
2+
* Stub hash: a7ea56878916417b15ed8e43eefd3e06b4b46238 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFixedArray___construct, 0, 0, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, size, IS_LONG, 0, "0")
@@ -24,17 +24,19 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFixedArray_setSize, 0, 0, 1)
2424
ZEND_END_ARG_INFO()
2525

2626
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFixedArray_offsetExists, 0, 0, 1)
27-
ZEND_ARG_INFO(0, index)
27+
ZEND_ARG_TYPE_INFO(0, index, IS_MIXED, 0)
2828
ZEND_END_ARG_INFO()
2929

30-
#define arginfo_class_SplFixedArray_offsetGet arginfo_class_SplFixedArray_offsetExists
30+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFixedArray_offsetGet, 0, 0, 1)
31+
ZEND_ARG_INFO(0, index)
32+
ZEND_END_ARG_INFO()
3133

3234
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFixedArray_offsetSet, 0, 0, 2)
3335
ZEND_ARG_INFO(0, index)
34-
ZEND_ARG_INFO(0, value)
36+
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
3537
ZEND_END_ARG_INFO()
3638

37-
#define arginfo_class_SplFixedArray_offsetUnset arginfo_class_SplFixedArray_offsetExists
39+
#define arginfo_class_SplFixedArray_offsetUnset arginfo_class_SplFixedArray_offsetGet
3840

3941
#define arginfo_class_SplFixedArray_rewind arginfo_class_SplFixedArray___wakeup
4042

ext/spl/spl_iterators.stub.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,9 @@ public function offsetGet($index) {}
232232

233233
/**
234234
* @param string $index
235-
* @param mixed $value
236235
* @return void
237236
*/
238-
public function offsetSet($index, $value) {}
237+
public function offsetSet($index, mixed $value) {}
239238

240239
/**
241240
* @param string $index

ext/spl/spl_iterators_arginfo.h

Lines changed: 2 additions & 2 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: fcf9d56587eb60bdc7824ff7587a5c7365eee5c0 */
2+
* Stub hash: 46708c8aa0ea191974eaa08ef3130ecfde8ade2b */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_EmptyIterator_current, 0, 0, 0)
55
ZEND_END_ARG_INFO()
@@ -165,7 +165,7 @@ ZEND_END_ARG_INFO()
165165

166166
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CachingIterator_offsetSet, 0, 0, 2)
167167
ZEND_ARG_INFO(0, index)
168-
ZEND_ARG_INFO(0, value)
168+
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
169169
ZEND_END_ARG_INFO()
170170

171171
#define arginfo_class_CachingIterator_offsetUnset arginfo_class_CachingIterator_offsetGet

ext/spl/spl_observer.stub.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,10 @@ public function offsetGet($object) {}
9191

9292
/**
9393
* @param object $object
94-
* @param mixed $info
9594
* @return void
9695
* @alias SplObjectStorage::attach
9796
*/
98-
public function offsetSet($object, $info = null) {}
97+
public function offsetSet($object, mixed $info = null) {}
9998

10099
/**
101100
* @param object $object

ext/spl/spl_observer_arginfo.h

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

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplObserver_update, 0, 0, 1)
55
ZEND_ARG_OBJ_INFO(0, subject, SplSubject, 0)
@@ -67,7 +67,7 @@ ZEND_END_ARG_INFO()
6767

6868
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplObjectStorage_offsetSet, 0, 0, 1)
6969
ZEND_ARG_INFO(0, object)
70-
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, info, "null")
70+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, info, IS_MIXED, 0, "null")
7171
ZEND_END_ARG_INFO()
7272

7373
#define arginfo_class_SplObjectStorage_offsetUnset arginfo_class_SplObjectStorage_offsetExists

0 commit comments

Comments
 (0)