Closed
Description
Symfony version(s) affected
6.1.0
Description
#44695 added @return TestContainer
to KernelTestCase::getContainer()
. However, TestContainer
is marked @internal
, which makes any calls static::getContainer()->get(MyService::class)
invalid, for example to Psalm (and possibly also to IDEs):
ERROR: InternalMethod - MyTest.php:16:49 - The method Symfony\Bundle\FrameworkBundle\Test\TestContainer::get is internal to Symfony but called from MyTest (see https://psalm.dev/175)
$this->client = static::getContainer()->get(MyService::class);
How to reproduce
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
final class MyTest extends KernelTestCase
{
public function test_container_get(): void
{
static::getContainer()->get(MyService::class);
}
}
Possible Solution
Remove @internal
from TestContainer
.
Additional Context
No response