Can I write an PHP extension to define "undefined" magic methods

I have a class that handles dependency injection via __callStatic

 

$foo = Injector::Foo();  // <= returns a Foo object, either by passing a previously registered class for injection or by calling new Foo()

 

I've written a custom plugin that contains a TypeProvider3 which means that $foo is correctly typed as a 'Foo', but what I can't figure out is how to get rid of the Method 'Foo' not found in Injector.

 

I don't want a huge set of @method declarations, as that makes indexing take a long time, ideally I'd be able to add a separate extension in my plugin which could tell that inspection that this is a legitimate method reference.

 

Any pointers to what (if any) extension I could add to plugin to achieve this would be greatly appreciated.

Thanks,

Tim

 

1 comment

Hello!

Unfortunately, for now there is no way to provide custom references on method call programatically. We have technical issue about this ability: https://youtrack.jetbrains.com/issue/WI-42266.

Also we have issue about resolving magic methods via __call (applicable to __callStatic  as well) - https://youtrack.jetbrains.com/issue/WI-16002.

0

Please sign in to leave a comment.