Skip to content

Commit 4f990bf

Browse files
authored
Merge pull request #42 from emacs-php/feature/phpstan-analyze-this-file
Add phpstan-analyze-this-file
2 parents 0869b15 + b0088be commit 4f990bf

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
All notable changes of the phpactor.el are documented in this file using the [Keep a Changelog](https://keepachangelog.com/) principles.
4+
5+
## Unreleased
6+
7+
### Added
8+
9+
* Add `phpstan-analyze-this-file` command

phpstan.el

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,15 @@ it returns the value of `SOURCE' as it is."
283283
"Return --memory-limit value."
284284
phpstan-memory-limit)
285285

286+
(defun phpstan-analyze-this-file ()
287+
"Analyze current buffer-file using PHPStan."
288+
(interactive)
289+
(let ((file (expand-file-name (or buffer-file-name
290+
(read-file-name "Choose a PHP script: ")))))
291+
(compile (mapconcat #'shell-quote-argument (append (phpstan-get-command-args t) (list file)) " "))))
292+
286293
(defun phpstan-analyze-file (file)
287-
"Analyze a PHPScript FILE using PHPStan."
294+
"Analyze a PHP script FILE using PHPStan."
288295
(interactive (list (expand-file-name (read-file-name "Choose a PHP script: "))))
289296
(compile (mapconcat #'shell-quote-argument (append (phpstan-get-command-args t) (list file)) " ")))
290297

0 commit comments

Comments
 (0)