Treat 2 implementations of the same class as a single class (for autocompletion) Follow
I'm starting a project with Laravel, and I see its facades don't help the IDE get autocompletion working fine. Luckily there's a package called laravel-ide-helper that helps by generating a file `_ide_helper.php` with the classes and their methods, but now the IDE shows a message saying `multiple implementations`.
So for example now I have the class `Illuminate\Support\Facades\Validator` in two locations: `vendor/laravel/framework/src/Illuminate/Support/Facades/Validator.php` (this extends `Facade`) and in `_ide_helper.php` (this doesn't extend anything but adds the methods that the Validator class has available at runtime).
Is there a way to make PhpStorm recognize them as a single class (and merge the autocompletion of both)?
To reproduce run the following in a console:
$ composer global require laravel/installer
$ laravel new testautocomplete
$ cd testautocomplete/
$ composer require --dev barryvdh/laravel-ide-helper
$ php artisan ide-helper:generate
Now you can open the testautocomplete directory with PhpStorm, go to file `app/Http/Controllers/Auth/RegisterController.php` and see in the function `validator` the Validator class with squigly lines and on mouse over the message: `Multiple definitions exist for class Validator`.
Would it be possible to map this for PhpStorm to avoid the warning? Maybe by putting this generated file in `.phpstorm.meta.php` dir as if it was a stub. Or is there any other way to tell PhpStorm about the dynamic methods in a class from another file? So not using `@method` in its docstring since I don't want to edit the vendor files.
Please sign in to leave a comment.
Hi there,
Just disable that inspection.