Skip to content

Commit aee3583

Browse files
committed
fix psalm
1 parent d57d406 commit aee3583

2 files changed

Lines changed: 32 additions & 10 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of CodeIgniter 4 framework.
7+
*
8+
* (c) CodeIgniter Foundation <admin@codeigniter.com>
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*/
13+
14+
namespace Tests\Support\Entity;
15+
16+
use ArrayObject;
17+
18+
/**
19+
* @extends ArrayObject<string, string>
20+
*/
21+
final class ArrayObjectWithToArray extends ArrayObject
22+
{
23+
/**
24+
* @return array<string, string>
25+
*/
26+
public function toArray(): array
27+
{
28+
return ['array' => 'same'];
29+
}
30+
}

tests/system/Entity/EntityTest.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use PHPUnit\Framework\Attributes\Group;
3131
use ReflectionException;
3232
use stdClass;
33+
use Tests\Support\Entity\ArrayObjectWithToArray;
3334
use Tests\Support\Entity\Cast\CastBase64;
3435
use Tests\Support\Entity\Cast\CastPassParameters;
3536
use Tests\Support\Entity\Cast\NotExtendsBaseCast;
@@ -2368,16 +2369,7 @@ public function testHasChangedPrefersToArrayOverTraversable(): void
23682369
];
23692370
};
23702371

2371-
/** @extends ArrayObject<string, string> */
2372-
$items = new class (['iterator' => 'original']) extends ArrayObject {
2373-
/**
2374-
* @return array<string, string>
2375-
*/
2376-
public function toArray(): array
2377-
{
2378-
return ['array' => 'same'];
2379-
}
2380-
};
2372+
$items = new ArrayObjectWithToArray(['iterator' => 'original']);
23812373

23822374
$entity->items = $items;
23832375
$entity->syncOriginal();

0 commit comments

Comments
 (0)