Issue with PHPStorm & PHPStan on WSL2
While working on a PHPStan extension at a hackathon last month, I had some issues with the code completion for PHPStan classes in PHPStorm.
While working on a PHPStan extension at a hackathon last month, I had some issues with the code completion for PHPStan classes in PHPStorm.
For a while we've been using DDEV to standardize our docker setup for development and to have a consistent way of interacting with Docker across all our projects (e.g., Magento, Symfony, Sulu, Sylius, API Platform, ...). Since most of our developers are using PHPStorm as their IDE of choice, using the DDEV Tool Integration for IntelliJ IDEA plugin was a natural choice.
A few tools, e.g. PHPStan Pro make use of the phpstorm:// protocol to be able to open files directly from your console with a click of a button.
Whilst I migrated from Linux to Windows and WSL 2 more than a year ago, I had a plan to install any development-related tools like Git or PHPStorm in WSL2. PHPStorm worked quite ok in WSL 2 except that filesystem changes (e.g. adding or removing files) made directly in WSL 2 were not properly recognized by PHPStorm. Even triggering a manual refresh from the disk did not always work. That made me install PHPStorm on Windows and open PHP projects via the WSL 2 integration of PHPStorm. That works better but still has its issues with larger projects.
Current situation: I have no local webserver running and just php5-cli (plus a few extensions) installed as most of the development I do will make use of a Vagrant machine. From time to time I develop small tools or libs which I like to debug on the command line. This is an overview how I configured my Ubuntu 14.04 box to handle debugging with Xdebug and phpstorm.