Skip to content

fix: ApiPlatform\Symfony\Bundle\Test\Client::getContainer return type #7230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2025

Conversation

VincentLanglet
Copy link
Contributor

Q A
Branch? 4.1 for bugfix
Tickets Closes #...
License MIT
Doc PR api-platform/docs#...

Implementation was

    public function getContainer(): ?ContainerInterface
    {
        return $this->kernelBrowser->getContainer();
    }

but this->kernelBrowser is not nullable and KernelBrowser implementation is

    public function getContainer(): ContainerInterface
    {
        $container = $this->kernel->getContainer();

        return $container->has('test.service_container') ? $container->get('test.service_container') : $container;
    }

so it's never nullable.

@VincentLanglet VincentLanglet changed the title Fix ApiPlatform\Symfony\Bundle\Test\Client::getContainer return type fix: ApiPlatform\Symfony\Bundle\Test\Client::getContainer return type Jun 18, 2025
@soyuka
Copy link
Member

soyuka commented Jun 19, 2025

I like the change but its a bc break to change a return type https://symfony.com/doc/current/contributing/code/bc.html#changing-classes. Would you be able to target the main branch?

@VincentLanglet
Copy link
Contributor Author

I like the change but its a bc break to change a return type

I don't think it is since the class is final, no ?

@soyuka soyuka merged commit f0604a0 into api-platform:4.1 Jun 20, 2025
110 of 111 checks passed
@soyuka
Copy link
Member

soyuka commented Jun 20, 2025

thanks @VincentLanglet !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants