D
D
digtyarenko2020-08-31 15:58:14
phpstorm
digtyarenko, 2020-08-31 15:58:14

How to teach PhpStorm to understand __callStatic?

The project has an implementation similar to facades in Laravel.
The essence is exactly the same: get a static interface to services from the container. Under the hood, __callStatic works, which looks for the desired service and calls it using call_user_func_array .

Of course, the called method is not directly in the class that implements this interface, and PhpStorm, when using this approach, indicates the error Method not found in... Accordingly, there is no autocomplete or other conveniences.

What can be done to resolve this?

(The project itself is not on Laravel, so using the https://github.com/barryvdh/laravel-ide-helper solution will not work).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Flying, 2020-08-31
@Flying

You need to describe the mappings between arguments and result types in the PHPStorm Advanced Metadata format .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question