Skip to content

Commit

Permalink
bug #36017 [HttpKernel] Fix support for single-colon syntax for contr…
Browse files Browse the repository at this point in the history
…ollers (nicolas-grekas)

This PR was merged into the 5.0 branch.

Discussion
----------

[HttpKernel] Fix support for single-colon syntax for controllers

| Q             | A
| ------------- | ---
| Branch?       | master for features / 3.4, 4.4 or 5.0 for bug fixes <!-- see below -->
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35983
| License       | MIT
| Doc PR        | -

This reverts commit 6bb6473, reversing
changes made to 4cce23d.

As spotted by @stof in #35983 (comment)

Commits
-------

fbea81c Revert "minor #35559 [FrameworkBundle] remove mention of the old Controller class (nicolas-grekas)"
  • Loading branch information
fabpot committed Mar 11, 2020
2 parents 8c778cb + fbea81c commit ca41e35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Expand Up @@ -51,6 +51,9 @@ public function process(ContainerBuilder $container)
}
}
if (!$reason) {
// see Symfony\Component\HttpKernel\Controller\ContainerControllerResolver
$controllers[$id.':'.$action] = $argumentRef;

if ('__invoke' === $action) {
$controllers[$id] = $argumentRef;
}
Expand Down
Expand Up @@ -49,7 +49,7 @@ public function testProcess()

$controllers = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);

$this->assertSame(['c1::fooAction'], array_keys($controllers));
$this->assertSame(['c1::fooAction', 'c1:fooAction'], array_keys($controllers));
$this->assertSame(['bar'], array_keys($container->getDefinition((string) $controllers['c1::fooAction']->getValues()[0])->getArgument(0)));

$expectedLog = [
Expand All @@ -73,7 +73,7 @@ public function testInvoke()
(new RemoveEmptyControllerArgumentLocatorsPass())->process($container);

$this->assertEquals(
['invokable::__invoke', 'invokable'],
['invokable::__invoke', 'invokable:__invoke', 'invokable'],
array_keys($container->getDefinition((string) $resolver->getArgument(0))->getArgument(0))
);
}
Expand Down

0 comments on commit ca41e35

Please sign in to comment.