Skip to content

[Yaml] Expected instance of: <FQCN of last parameter> #710

@MisatoTremor

Description

@MisatoTremor

I think this started after updating to 0.12.115.
I get warnings for every service defined in YAML using multiple arguments. Using the following definition

services:
    foo_bar.baz_subscriber:
        class: 'Foo\BarBundle\EventSubscriber\BazSubscriber'
        arguments: ['@security.authorization_checker', '@security.token_storage', '@router']
        tags:
            - { name: 'kernel.event_subscriber' }
namespace Foo\BarBundle\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

class BazSubscriber implements EventSubscriberInterface
{
    /**
     * @var AuthorizationCheckerInterface
     */
    private $authorizationChecker;
    /**
     * @var TokenStorageInterface
     */
    private $tokenStorage;
    /**
     * @var RouterInterface
     */
    private $router;

    /**
     * @param AuthorizationCheckerInterface $authorizationChecker
     * @param TokenStorageInterface         $tokenStorage
     * @param RouterInterface               $router
     */
    public function __construct(
        AuthorizationCheckerInterface $authorizationChecker,
        TokenStorageInterface $tokenStorage,
        RouterInterface $router
    ) {
        $this->authorizationChecker = $authorizationChecker;
        $this->tokenStorage = $tokenStorage;
        $this->router = $router;
    }

    // ...
}

Will show warnings for the first 2 arguments:
Expected instance of: Symfony\Component\Routing\RouterInterface

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions