Skip to content

Commit 4649609

Browse files
committed
Init repository
0 parents  commit 4649609

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.cask

Cask

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(package "phpstan" "0.0.1" "Interface to PHPStan (PHP static analyzer)")
2+
(source "melpa" "https://melpa.org/packages/")
3+
4+
(package-file "phpstan.el")
5+
(development
6+
(depends-on "flycheck"))

README.org

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* phpstan.el
2+
Emacs interface to [[https://github.com/phpstan/phpstan][PHPStan]], includes checker for [[http://www.flycheck.org/en/latest/][Flycheck]].

phpstan.el

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
;;; phpstan.el --- Interface to PHPStan. -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2018 Friends of Emacs-PHP development
4+
5+
;; Author: USAMI Kenta <tadsan@zonu.me>
6+
;; Created: 15 Mar 2018
7+
;; Version: 0.0.1
8+
;; Keywords: tools, php
9+
;; Homepage: https://github.com/emacs-php/phpstan.el
10+
;; Package-Requires: ((emacs "24"))
11+
12+
;; This program is free software; you can redistribute it and/or modify
13+
;; it under the terms of the GNU General Public License as published by
14+
;; the Free Software Foundation, either version 3 of the License, or
15+
;; (at your option) any later version.
16+
17+
;; This program is distributed in the hope that it will be useful,
18+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
;; GNU General Public License for more details.
21+
22+
;; You should have received a copy of the GNU General Public License
23+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
24+
25+
;;; Commentary:
26+
27+
;; Static analyze for PHP code using PHPStan.
28+
;; https://github.com/phpstan/phpstan
29+
30+
;;; Code:
31+
(require 'flycheck nil)
32+
33+
;;;###autoload
34+
(when (featurep 'flycheck)
35+
(flycheck-define-checker phpstan-checker
36+
"PHP static analyzer based on PHPStan."
37+
:command ("phpstan" "analyze" "--errorFormat=raw" source)
38+
:working-directory (lambda (_) (php-project-get-root-dir))
39+
:enabled (lambda () (locate-dominating-file "phpstan.neon" default-directory))
40+
:error-patterns
41+
((error line-start (1+ (not (any ":"))) ":" line ":" (message) line-end))
42+
:modes (php-mode)
43+
:next-checkers (php)))
44+
45+
(provide 'phpstan)
46+
;;; phpstan.el ends here

0 commit comments

Comments
 (0)