Home

Awesome

coc-phpstan

PHPStan (PHP Static Analysis tool) extension for coc.nvim.

<img width="780" alt="coc-phpstan-demo" src="https://user-images.githubusercontent.com/188642/119638316-7fc24a80-be51-11eb-8b0e-5ec592a90154.gif">

Install

CocInstall:

:CocInstall @yaegassy/coc-phpstan

scoped package

vim-plug:

Plug 'yaegassy/coc-phpstan', {'do': 'yarn install --frozen-lockfile'}

Features

Detect tool: phpstan

  1. phpstan.toolPath setting
  2. vendor/bin/phpstan (project)
  3. Extension-only phpstan retrieved by the download feature (:CocCommand phpstan.download)
    • Mac/Linux: ~/.config/coc/extensions/@yaegassy/coc-phpstan-data/phpstan
    • Windows: ~/AppData/Local/coc/extensions/@yaegassy/coc-phpstan-data/phpstan

"phpstan.neon", "phpstan.neon.dist" or "phpstan.dist.neon" configuration file

If you wish to use a configuration file you should place the phpstan.neon, phpstan.neon.dist or phpstan.dist.neon file in the root of your project folder

Linting of NEON file

This extension includes a feature to perform linting using the neon-js library in a phpstan configuration file (phpstan.neon, phpstan.neon.dist or phpstan.dist.neon).

To run this linting feature, the filetype must be neon.

Install "neon" related plugin (e.g. yaegassy/nette-neon.vim).


Configuration options ("coc-settings.json" or ".vim/coc-settings.json")

Commands

Code Actions

Example key mapping (Code Action related):

nmap <silent> ga <Plug>(coc-codeaction-line)

Usage:

In the line with diagnostic message, enter the mapped key (e.g. ga) and you will see a list of code actions that can be performed.

Actions:

Thanks

License

MIT


This extension is built with create-coc-extension