All notable changes of the phpstan.el are documented in this file using the Keep a Changelog principles.
- [experimental] Add new
phpstan-hover.el.- Add
phpstan-hover-modeminor mode to show PHPStan type info at point without publishing diagnostics to Flycheck/Flymake.- Hover support for variables, assignments, function/method/static calls, constants, class constants,
return,yield, andyield from. - PHPDoc type collection in hover data and display integration when available.
- Hover support for variables, assignments, function/method/static calls, constants, class constants,
- Add
phpstan-hover-show-kind-labelcustom variable to toggle verbose labels likereturn:/yield:in hover text. - Add
phpstan-hover-message-prefixcustom variable preset choices, including emoji labels.
- Add
phpstan-copy-dumped-typenow prefers PHPDoc type from hover data by default, and can copy non-PHPDoc type with a prefix argument (C-u).- Add
containertophpstan-executableto run PHPStan with Apple container on macOS. It uses the samephpstan-docker-imageasdocker.
phpstan-copy-dumped-typecommand now prioritizesphpstan-hover-modedata at point before falling back to dumped-type messages.flycheck-phpstanis now a Flycheck generic checker instead of a command checker.- The whole command line is built from
phpstan-executable, so the checker no longer injects an executable into flycheck'sflycheck-phpstan-executablevariable as a side effect of its:enabledpredicate, and no longer advisesflycheck-finish-checker-process. phpis no longer required inexec-pathto enable the checker. Previously the dummy"php"in:commandwas resolved by Flycheck before the:enabledpredicate ran, so a Docker-only setup could not enable the checker at all.M-x flycheck-verify-setupnow reports the real PHPStan command and configuration file instead of"php".
- The whole command line is built from
phpstan-flycheck-auto-set-executableis obsolete and ignored.flymake-phpstannow reads PHPStan's JSON output instead of the raw text format, bringing it to parity withflycheck-phpstan.- Each message shows its identifier and tip (configurable with
flymake-phpstan-ignore-metadata-listandflymake-phpstan-metadata-separator). phpstan-insert-ignoreandphpstan-copy-dumped-typenow work from a Flymake session, because the backend refreshesphpstan--ignorable-errorsandphpstan--dumped-types.- Progress a container runtime writes to STDERR no longer confuses the parser, and a PHPStan failure that produces no report is surfaced as a warning rather than dropped.
- Each message shows its identifier and tip (configurable with
- Fix
phpstan-get-command-argsto keep:optionsin the correct position and pass target arguments correctly when editor mode options are used. - Fix
phpstan-executablein the(STRING . (ARGUMENTS ...))form dropping the command name, which made the first argument run as the program (("docker" "run" ...)executedrun). - Fix
phpstan-get-command-argsdestructively modifying its inputs withnconc. Each call appended the PHPStan arguments onto the caller's own list, growingphpstan-executablein the(STRING . (ARGUMENTS ...))form on every check, and appending"--"tophpstan-generate-baseline-optionson everyphpstan-generate-baseline. - Fix Flycheck getting stuck on a syntax check when PHPStan reported no files to analyse in a modified buffer. The check now finishes with an empty result instead of never reporting a status.
- Fix the analyzed file being passed to a containerized PHPStan as a host path.
flycheck-phpstanreported no errors at all with(phpstan-executable . docker), because PHPStan answeredPath /Users/... does not exist.flymake-phpstanwas affected for unmodified buffers. - Fix the
--tmp-filecopy being created in the system temporary directory when running containerized, where the container cannot see it. - Fix the JSON report being ignored when the container runtime prefixes it with progress output on STDERR, which made every check with
(phpstan-executable . container)report no errors. - Fix
flycheck-phpstansilently discarding the fallback warning when PHPStan produced no JSON report, hiding failures such as a broken configuration file behind a clean buffer. - Fix editor mode detection asking the wrong program for its version. Only the first element of the command line was probed, which is the container runtime for
(phpstan-executable . docker)/containerandphpfor a PHAR without the executable bit — sodocker --versionandphp --versionwere parsed as PHPStan versions (d1c06ef,Technologies) and editor mode was silently disabled for every setup except a directly executablephpstan. phpstan-versionandphpstan-editor-mode-available-pnow take the whole command line, as returned byphpstan-get-executable-and-args. A bare string is still accepted.phpstan-versionno longer merges STDERR into the version string, which a container runtime pollutes with its progress report.- Fix
declare-functionforms fortrampthat quoted the function name and argument list (and misspelledtrampastamp), so the byte compiler warned thattramp-dissect-file-namemight not be defined at runtime. - Fix a container run erroring when the project has no configuration file.
phpstan-normalize-pathwas handed the nil fromphpstan-get-config-fileand passed it toreplace-regexp-in-string; it now returns nil for a nil path, so the command line simply omits-c. - Fix
phpstan--parse-jsonreading JSONfalse(and, onjson-parse-buffer,null) as a truthy symbol. A non-ignorable message ("ignorable":false) was treated as ignorable by both backends, so its identifier was shown with the 🪪 prefix andphpstan-insert-ignoreoffered it — even though it cannot be ignored. Both parser paths now mapfalse/nullto nil.
- Drop support for Emacs 26 and earlier. All files now require Emacs 27.1, which is also the floor of
php-modeandflycheckthemselves, so anything older could not have resolved its dependencies anyway.
- Add
phpstan-copy-dumped-typecommand to copy the nearest dumped type fromPHPStan\dumpType()orPHPStan\dumpPhpDocType()messages - Add support for PHPStan Editor Mode
- Improved error handling when no JSON response is returned
- Fixed erroneous dependency from
flymake-phpstanto Flycheck functions
- Drop support for Emacs 25.3
- Fix compilation errors on Emacs 30
- Add
phpstan-enable-remote-experimentalcustom variable for activate PHPStan on TRAMP. - Add support for
php-ts-mode. - Add
phpstan-insert-dumptypecommand - Add
phpstan-insert-ignorecommand
- Refactored
phpstan-check-buffercommand for improved performance. - Improved logic for detecting phpstan executable.
- Drop support for Emacs 24.3.
- Add
phpstan-analyze-this-filecommand - Add
phpstan.dist.neontophpstan-get-config-fileas PHPStan config files. - Add
phpstan-procommand to launch PHPStan Pro. - Add
phpstan-find-baseline-filecommand. - Add
phpstan-generate-baseline-filecommand.
- Make flycheck analyze the original file directly instead of temporary files when there are no changes to the file.
- [Internal] Use JSON format for flycheck-phpstan.
- Support 💡 tips