PhpStorm PhpUnit via phar autocomplete not working

前端 未结 2 942
野趣味
野趣味 2021-02-07 03:57

I have PHPStorm 8.0.1.

PHPUnit is installed via PHAR archive like:

wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
sudo mv phpunit.phar /         


        
相关标签:
2条回答
  • 2021-02-07 04:46

    In order to have PHAR archive indexed by IDE it has to have .phar extension (that's a requirement).

    The easiest solution is to place phpunit.phar somewhere in your project (usually it would be PROJECT_ROOT/vendor/ folder).

    If having local copy is not desired (for whatever reason; although composer and other similar kind of tools (bower/npm/etc) are primarily aimed at keeping dependency stuff/packages locally), you may use symbolic links: either create a symbolic link to that file locally (e.g. PROJECT_ROOT/phpunit.phar --> /usr/bin/phpunit) .. or place a full copy (or such symbolic link) in separate folder somewhere on your disk and then reference it via PhpStorm's Settings | PHP | Include Paths functionality.

    0 讨论(0)
  • 2021-02-07 04:57

    The above fix by Calin worked for me too on PhpStorm 2019.1.1, so I'll post it as an answer for easier visibility:

    Try right clicking on the .phar and clicking "Exclude phar from project", then clicking "Include phar into project" to refresh it.

    In my case, both the .phar file and my .idea folder were pulled from a git commit. I guess PhpStorm didnt realise that the file needed reimporting.

    0 讨论(0)
提交回复
热议问题