Idea-php-symfony2-plugin: "Missing method" in service calls

Created on 20 Jun 2016  路  7Comments  路  Source: Haehnchen/idea-php-symfony2-plugin

origin: https://github.com/Haehnchen/idea-php-annotation-plugin/issues/57

PhpStorm annotates Missing method in all my service calls that call a method that is in a trait.
Example :

my_service:
    class: My\Service
    calls:
        - [setContainer, ["@service_container"]] #"Missing method"
namespace My;

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

class Service implements ContainerAwareInterface {
    use ContainerAwareTrait;
}

The ContainerAwareTrait contains the setContainer method.

Using PhpStorm 2016.1.2 with plugin 0.12.120.

fixed

Most helpful comment

This even happens on simple classes, no extensions, no traits, no interfaces.

@Haehnchen can you please rename the title to remove the "when using traits" part?

All 7 comments

Seems like same behavior happens when extending from abstract class.

This even happens on simple classes, no extensions, no traits, no interfaces.

@Haehnchen can you please rename the title to remove the "when using traits" part?

I can confirm that.

calls:
      - [setLocale, [ %locale%] ]

Says that %locale% is "Method not found"... but it's not a method, it's a parameter.

Also you should now be putting %locale% in quotes, as per latest Yaml spec, and for Symfony3 compat.

You are correct, but that doesn't change the issue.

fixed

Was this page helpful?
0 / 5 - 0 ratings