X Tutup
Skip to content

Commit c15fb91

Browse files
author
Robert Currall
authored
chore: add explicit return types to address Symfony deprecations (#2200)
1 parent 1530583 commit c15fb91

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/Collection.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Collection extends Model implements \Iterator, \Countable
1111
{
1212
protected $collection_key = 'items';
1313

14+
/** @return void */
1415
#[\ReturnTypeWillChange]
1516
public function rewind()
1617
{
@@ -20,6 +21,7 @@ public function rewind()
2021
}
2122
}
2223

24+
/** @return mixed */
2325
#[\ReturnTypeWillChange]
2426
public function current()
2527
{
@@ -29,6 +31,7 @@ public function current()
2931
}
3032
}
3133

34+
/** @return mixed */
3235
#[\ReturnTypeWillChange]
3336
public function key()
3437
{
@@ -38,19 +41,22 @@ public function key()
3841
}
3942
}
4043

44+
/** @return void */
4145
#[\ReturnTypeWillChange]
4246
public function next()
4347
{
4448
return next($this->{$this->collection_key});
4549
}
4650

51+
/** @return bool */
4752
#[\ReturnTypeWillChange]
4853
public function valid()
4954
{
5055
$key = $this->key();
5156
return $key !== null && $key !== false;
5257
}
5358

59+
/** @return int */
5460
#[\ReturnTypeWillChange]
5561
public function count()
5662
{
@@ -60,6 +66,7 @@ public function count()
6066
return count($this->{$this->collection_key});
6167
}
6268

69+
/** @return bool */
6370
public function offsetExists($offset)
6471
{
6572
if (!is_numeric($offset)) {
@@ -68,6 +75,7 @@ public function offsetExists($offset)
6875
return isset($this->{$this->collection_key}[$offset]);
6976
}
7077

78+
/** @return mixed */
7179
public function offsetGet($offset)
7280
{
7381
if (!is_numeric($offset)) {
@@ -77,6 +85,7 @@ public function offsetGet($offset)
7785
return $this->{$this->collection_key}[$offset];
7886
}
7987

88+
/** @return void */
8089
public function offsetSet($offset, $value)
8190
{
8291
if (!is_numeric($offset)) {
@@ -85,6 +94,7 @@ public function offsetSet($offset, $value)
8594
$this->{$this->collection_key}[$offset] = $value;
8695
}
8796

97+
/** @return void */
8898
public function offsetUnset($offset)
8999
{
90100
if (!is_numeric($offset)) {

src/Model.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,14 @@ public function assertIsArray($obj, $method)
253253
}
254254
}
255255

256+
/** @return bool */
256257
#[\ReturnTypeWillChange]
257258
public function offsetExists($offset)
258259
{
259260
return isset($this->$offset) || isset($this->modelData[$offset]);
260261
}
261262

263+
/** @return mixed */
262264
#[\ReturnTypeWillChange]
263265
public function offsetGet($offset)
264266
{
@@ -267,6 +269,7 @@ public function offsetGet($offset)
267269
$this->__get($offset);
268270
}
269271

272+
/** @return void */
270273
#[\ReturnTypeWillChange]
271274
public function offsetSet($offset, $value)
272275
{
@@ -278,6 +281,7 @@ public function offsetSet($offset, $value)
278281
}
279282
}
280283

284+
/** @return void */
281285
#[\ReturnTypeWillChange]
282286
public function offsetUnset($offset)
283287
{

0 commit comments

Comments
 (0)
X Tutup