diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8c9d053 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog + +All notable changes of the phpactor.el are documented in this file using the [Keep a Changelog](https://keepachangelog.com/) principles. + +## Unreleased + +### Added + +* Add `phpstan-analyze-this-file` command diff --git a/phpstan.el b/phpstan.el index b05f3dd..143ab94 100644 --- a/phpstan.el +++ b/phpstan.el @@ -283,8 +283,15 @@ it returns the value of `SOURCE' as it is." "Return --memory-limit value." phpstan-memory-limit) +(defun phpstan-analyze-this-file () + "Analyze current buffer-file using PHPStan." + (interactive) + (let ((file (expand-file-name (or buffer-file-name + (read-file-name "Choose a PHP script: "))))) + (compile (mapconcat #'shell-quote-argument (append (phpstan-get-command-args t) (list file)) " ")))) + (defun phpstan-analyze-file (file) - "Analyze a PHPScript FILE using PHPStan." + "Analyze a PHP script FILE using PHPStan." (interactive (list (expand-file-name (read-file-name "Choose a PHP script: ")))) (compile (mapconcat #'shell-quote-argument (append (phpstan-get-command-args t) (list file)) " ")))