You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug symfony#45572 [HttpKernel] fix using Target attribute with controller arguments (kbond)
This PR was merged into the 5.4 branch.
Discussion
----------
[HttpKernel] fix using Target attribute with controller arguments
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fixsymfony#45021
| License | MIT
| Doc PR | n/a
This was supposed to fixsymfony#45021 but after adding what I suspected was a failing test, it works as expected. I guess I'm not testing the correct thing?
Here's a quick reproducer that shows the problem in a "real app":
```php
class HomepageController extends AbstractController
{
public function __construct(#[Target('request.logger')] private LoggerInterface $logger)
{
}
#[Route('/', name: 'app_homepage')]
public function index(#[Target('request.logger')] LoggerInterface $logger): Response
{
dd(
$this->logger->getName(), // "request" (expected)
$logger->getName() // "app" (not-expected)
);
// ...
}
}
```
Commits
-------
448cc3a [HttpKernel] fix using Target with controller args
0 commit comments