Skip to content

Commit 0902894

Browse files
committed
Add php-mode-replace-flymake-diag-function
1 parent dc67eae commit 0902894

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this
1717
* Psalm: [Atomic Type Reference](https://psalm.dev/docs/annotating_code/type_syntax/atomic_types/)
1818
* Psalm: [Supported Annotations](https://psalm.dev/docs/annotating_code/supported_annotations/)
1919
* Psalm: [Template Annotations](https://psalm.dev/docs/annotating_code/templated_annotations/)
20+
* Add `php-mode-replace-flymake-diag-function` custom variable and default activated it ([#718])
2021

2122
### Changed
2223

lisp/php-mode.el

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
(require 'rx)
8383
(require 'cl-lib)
8484
(require 'flymake)
85+
(require 'php-flymake)
8586
(require 'regexp-opt)
8687
(defvar add-log-current-defun-header-regexp)
8788
(defvar add-log-current-defun-function)
@@ -180,6 +181,15 @@ Turning this on will open it whenever `php-mode' is loaded."
180181
:tag "PHP Mode Page Delimiter"
181182
:type 'regexp)
182183

184+
(defcustom php-mode-replace-flymake-diag-function
185+
(eval-when-compile (when (boundp 'flymake-diagnostic-functions)
186+
#'php-flymake))
187+
"Flymake function to replace, if NIL do not replace."
188+
:group 'php-mode
189+
:tag "PHP Mode Replace Flymake Diag Function"
190+
:type '(choice 'function
191+
(const :tag "Disable to replace" nil)))
192+
183193
(define-obsolete-variable-alias 'php-do-not-use-semantic-imenu 'php-mode-do-not-use-semantic-imenu "1.20.0")
184194
(defcustom php-mode-do-not-use-semantic-imenu t
185195
"Customize `imenu-create-index-function' for `php-mode'.
@@ -1262,6 +1272,10 @@ After setting the stylevars run hooks according to STYLENAME
12621272
(setq-local add-log-current-defun-function nil)
12631273
(setq-local add-log-current-defun-header-regexp php-beginning-of-defun-regexp)
12641274

1275+
(when (and (eval-when-compile (boundp 'flymake-diagnostic-functions))
1276+
php-mode-replace-flymake-diag-function)
1277+
(add-hook 'flymake-diagnostic-functions php-mode-replace-flymake-diag-function nil t))
1278+
12651279
(when (fboundp 'c-looking-at-or-maybe-in-bracelist)
12661280
(advice-add #'c-looking-at-or-maybe-in-bracelist
12671281
:override 'php-c-looking-at-or-maybe-in-bracelist '(local)))

0 commit comments

Comments
 (0)