Skip to content

Commit d0c4606

Browse files
author
Aleksandr Burov
committed
Allow support php 8.1
There is now an error when using preload + opcache: Fatal error: During inheritance of Countable: Uncaught ErrorException: Return type of Mindbox\DTO\DTO::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vendor/mindbox/sdk/src/DTO/DTO.php:228
1 parent f420806 commit d0c4606

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/DTO/DTO.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ function ($value) use ($unsetXmlMetaInfo) {
225225
*
226226
* @return int
227227
*/
228-
public function count()
228+
public function count(): int
229229
{
230230
$fields = $this->items;
231231
return count($this->unsetMetaInfo($fields));
@@ -236,7 +236,7 @@ public function count()
236236
*
237237
* @return ArrayIterator
238238
*/
239-
public function getIterator()
239+
public function getIterator(): ArrayIterator
240240
{
241241
return new ArrayIterator($this->items);
242242
}
@@ -249,6 +249,7 @@ public function getIterator()
249249
* @return mixed
250250
* @throws MindboxException
251251
*/
252+
#[\ReturnTypeWillChange]
252253
public function offsetGet($key)
253254
{
254255
if (!$this->offsetExists($key)) {
@@ -265,7 +266,7 @@ public function offsetGet($key)
265266
*
266267
* @return bool
267268
*/
268-
public function offsetExists($key)
269+
public function offsetExists($key): bool
269270
{
270271
return array_key_exists($key, $this->items);
271272
}
@@ -278,7 +279,7 @@ public function offsetExists($key)
278279
*
279280
* @return void
280281
*/
281-
public function offsetSet($key, $value)
282+
public function offsetSet($key, $value): void
282283
{
283284
if (is_null($key)) {
284285
$this->items[] = $value;
@@ -294,7 +295,7 @@ public function offsetSet($key, $value)
294295
*
295296
* @return void
296297
*/
297-
public function offsetUnset($key)
298+
public function offsetUnset($key): void
298299
{
299300
unset($this->items[$key]);
300301
}

0 commit comments

Comments
 (0)