Emacs interface to Psalm, includes checker for Flycheck.
M-x package-install flycheck-psalm
(defun my-php-mode-setup () "My PHP-mode hook." (require 'flycheck-psalm) (flycheck-mode t)) (add-hook 'php-mode-hook 'my-php-mode-setup)
(add-hook 'php-mode-hook #'flymake-psalm-turn-on)
Install Docker. There is currently no official Docker image we can trust, so if you want to use it, you are at your own risk.
If you always use Docker for Psalm, add the following into your .emacs
file (~~/.emacs.d/init.el~)
;; Be sure to replace it with a Docker image you trust (setq-default psalm-docker-image "your/dockerhub-image") (setq-default psalm-executable 'docker)
Put the following into .dir-locals.el
files on the root directory of project.
((nil . ((php-project-root . git) (psalm-executable . docker) (psalm-working-dir . (root . "path/to/dir")) (psalm-config-file . (root . "path/to/dir/psalm-docker.neon")) (psalm-level . 7))))Using composer (project specific)
If your project Composer relies on psalm, you do not need to set anything.
((nil . ((php-project-root . git) (psalm-executable . docker) (psalm-working-dir . (root . "path/to/dir")) (psalm-config-file . (root . "path/to/dir/psalm-docker.neon")) (psalm-level . 7))))
Please install vimeo/psalm package for each user environment or project by using Composer.
If you are unfamiliar with resolving dependencies, the following shell commands are recommended.
$ composer global require vimeo/psalm
NOTICE: We strongly recommend using the latest Psalm.
Please download psalm.phar
from Releases · vimeo/psalm.
Variables for psalm are mainly controlled by directory variables (.dir-locals.el
).
Frequently (root. "path/to/file")
notation appears in these variables. It is relative to the top level directory of the project. In general, the directory containing one of .projectile
, composer.json
, .git
file (or directory) is at the top level.
Please be aware that the root directory of the PHP project may NOT match either of Psalm’s %rootDir%
and/or %currentWorkingDirectory%
.
Typically, you would set the following .dir-locals.el
.
((nil . ((php-project-root . auto) (psalm-executable . docker) (psalm-working-dir . (root . "path/to/dir/")) (psalm-config-file . (root . "path/to/dir/psalm-custom.neon")) (psalm-level . max))))
If there is a psalm.neon
file in the root directory of the project, you do not need to set both psalm-working-dir
and psalm-config-file
.
Most variables defined in this package are buffer local. If you want to set it for multiple projects, use setq-default.
Local variablepsalm-working-dir
Path to working directory of Psalm.
"/path/to/psalm.phar"
(root . STRING)
(root . "path/to/dir")
nil
(php-project-get-root-dir)
as working directory.
psalm-config-file
Path to project specific configuration file of Psalm.
psalm
configuration file.
(root . STRING)
psalm
configuration file from project root directory.
psalm.neon(.dist)
in (psalm-get-working-dir)
.
psalm-executable
"/path/to/psalm.phar"
docker
(root . STRING)
(root . "script/psalm")
(STRING . (ARGUMENTS ...))
("docker" "run" "--rm" "-v" "/path/to/project-dir/:/app" "your/docker-image")
nil
psalm
executable file by composer dependencies of the project or executable command in PATH
environment variable.
psalm-flycheck-auto-set-executable
Set flycheck psalm-executable automatically when non-NIL.
Custom variable (local)psalm-show-info
If non-NIL, add --show-info=true
option to command line argument. This variable can be overridden locally.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4