Closed
Description
API Platform version(s) affected: 3.0.7
Description
In
core/src/State/ProviderInterface.php
Line 23 in 3a845f1
ERROR: InvalidTemplateParam - src/TestProvider.php:13:31 - Extended template param T expects type object, type array<array-key, mixed> given (see https://psalm.dev/183)
class TestProvider implements ProviderInterface
How to reproduce
<?php
declare(strict_types=1);
namespace App;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface;
/**
* @implements ProviderInterface<array>
*/
class TestProvider implements ProviderInterface
{
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
{
return [];
}
}
Possible Solution
Change it to T of object|array
. I'm not sure if this is incorrect, but I think it's valid, and it does fix the issue.
Additional Context