Haehnchen / idea-php-symfony2-plugin

IntelliJ IDEA / PhpStorm Symfony Plugin
https://plugins.jetbrains.com/plugin/7219
MIT License
913 stars 137 forks source link

services.yaml >> factory-created service arguments are hinted as the class being factoried #1140

Open luispabon opened 6 years ago

luispabon commented 6 years ago

Given a class that is instantiated via a factory, the arguments part of the service definition refers to the factory method, not the class being generated.

However, the symfony plugin thinks otherwise - it thinks the arguments are for the class being generated.

I've created a repo illustrating the issue: https://github.com/luispabon/idea-symfony-plugin-woes

image

Powerhamster commented 5 years ago

I have the same issue with the common case of creating a service for a Repository using

factory: ["@doctrine.orm.entity_manager", getRepository]
blowski commented 2 years ago

As a hacky workaround to suppress the linting error, if you're using expression language, you can have an expression that returns a string. For example, instead of:

arguments: ['something']

you can do:

arguments: ['@="something"']