Skip to content

Commit 4913b1f

Browse files
committed
Add ReturnTypeWillChange attributes to prevent PHP Deprecation warnings
1 parent 3d47986 commit 4913b1f

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/json/JsonReference.php

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public function getReference(): string
126126
* @return mixed data which can be serialized by <b>json_encode</b>,
127127
* which is a value of any type other than a resource.
128128
*/
129+
#[\ReturnTypeWillChange]
129130
public function jsonSerialize()
130131
{
131132
return (object)['$ref' => $this->getReference()];

src/spec/Paths.php

+6
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ public function getErrors(): array
183183
* @return boolean true on success or false on failure.
184184
* The return value will be casted to boolean if non-boolean was returned.
185185
*/
186+
#[\ReturnTypeWillChange]
186187
public function offsetExists($offset)
187188
{
188189
return $this->hasPath($offset);
@@ -194,6 +195,7 @@ public function offsetExists($offset)
194195
* @param mixed $offset The offset to retrieve.
195196
* @return PathItem Can return all value types.
196197
*/
198+
#[\ReturnTypeWillChange]
197199
public function offsetGet($offset)
198200
{
199201
return $this->getPath($offset);
@@ -205,6 +207,7 @@ public function offsetGet($offset)
205207
* @param mixed $offset The offset to assign the value to.
206208
* @param mixed $value The value to set.
207209
*/
210+
#[\ReturnTypeWillChange]
208211
public function offsetSet($offset, $value)
209212
{
210213
$this->addPath($offset, $value);
@@ -215,6 +218,7 @@ public function offsetSet($offset, $value)
215218
* @link http://php.net/manual/en/arrayaccess.offsetunset.php
216219
* @param mixed $offset The offset to unset.
217220
*/
221+
#[\ReturnTypeWillChange]
218222
public function offsetUnset($offset)
219223
{
220224
$this->removePath($offset);
@@ -226,6 +230,7 @@ public function offsetUnset($offset)
226230
* @return int The custom count as an integer.
227231
* The return value is cast to an integer.
228232
*/
233+
#[\ReturnTypeWillChange]
229234
public function count()
230235
{
231236
return count($this->_paths);
@@ -236,6 +241,7 @@ public function count()
236241
* @link http://php.net/manual/en/iteratoraggregate.getiterator.php
237242
* @return Traversable An instance of an object implementing <b>Iterator</b> or <b>Traversable</b>
238243
*/
244+
#[\ReturnTypeWillChange]
239245
public function getIterator()
240246
{
241247
return new ArrayIterator($this->_paths);

src/spec/Responses.php

+6
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ public function getErrors(): array
173173
* @return boolean true on success or false on failure.
174174
* The return value will be casted to boolean if non-boolean was returned.
175175
*/
176+
#[\ReturnTypeWillChange]
176177
public function offsetExists($offset)
177178
{
178179
return $this->hasResponse($offset);
@@ -184,6 +185,7 @@ public function offsetExists($offset)
184185
* @param mixed $offset The offset to retrieve.
185186
* @return mixed Can return all value types.
186187
*/
188+
#[\ReturnTypeWillChange]
187189
public function offsetGet($offset)
188190
{
189191
return $this->getResponse($offset);
@@ -195,6 +197,7 @@ public function offsetGet($offset)
195197
* @param mixed $offset The offset to assign the value to.
196198
* @param mixed $value The value to set.
197199
*/
200+
#[\ReturnTypeWillChange]
198201
public function offsetSet($offset, $value)
199202
{
200203
$this->addResponse($offset, $value);
@@ -205,6 +208,7 @@ public function offsetSet($offset, $value)
205208
* @link http://php.net/manual/en/arrayaccess.offsetunset.php
206209
* @param mixed $offset The offset to unset.
207210
*/
211+
#[\ReturnTypeWillChange]
208212
public function offsetUnset($offset)
209213
{
210214
$this->removeResponse($offset);
@@ -216,6 +220,7 @@ public function offsetUnset($offset)
216220
* @return int The custom count as an integer.
217221
* The return value is cast to an integer.
218222
*/
223+
#[\ReturnTypeWillChange]
219224
public function count()
220225
{
221226
return count($this->_responses);
@@ -226,6 +231,7 @@ public function count()
226231
* @link http://php.net/manual/en/iteratoraggregate.getiterator.php
227232
* @return Traversable An instance of an object implementing <b>Iterator</b> or <b>Traversable</b>
228233
*/
234+
#[\ReturnTypeWillChange]
229235
public function getIterator()
230236
{
231237
return new ArrayIterator($this->_responses);

0 commit comments

Comments
 (0)