Skip to content

Commit 668a5f7

Browse files
minor symfony#18168 FrameworkBundle: Client: getContainer(): fixed phpdoc (MacDada)
This PR was merged into the 2.3 branch. Discussion ---------- FrameworkBundle: Client: getContainer(): fixed phpdoc | Q | A | ------------- | --- | Branch | lowest applicable and maintained version | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ The kernel [might be shut down](https://github.com/symfony/symfony/blob/2.3/src/Symfony/Component/HttpKernel/Kernel.php#L164) and then the method will return null instead of a ContainerInterface object. --- I've stumbled upon when I was trying to do this in my [test](https://github.com/symfony/framework-bundle/blob/master/Test/WebTestCase.php): ```php /** * @var Client|null */ private static $client; public static function tearDownAfterClass() { $entityManager = $client->getContainer() ->get('doctrine') ->getManager(); // remove entities created by tests } public function testWhatever() { self::$client = self::createClient(); // entities are created } ``` `$client->getContainer()` has given me `null` while I was expecting the container, as the PHPDoc say I would. Unpleasant debugging and WTFing. Commits ------- 7462fa5 FrameworkBundle: Client: getContainer(): fixed phpdoc
2 parents a908185 + 7462fa5 commit 668a5f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(KernelInterface $kernel, array $server = array(), Hi
4141
/**
4242
* Returns the container.
4343
*
44-
* @return ContainerInterface
44+
* @return ContainerInterface|null Returns null when the Kernel has been shutdown or not started yet
4545
*/
4646
public function getContainer()
4747
{

0 commit comments

Comments
 (0)