update packages

This commit is contained in:
2025-03-11 21:14:26 +01:00
parent 45d49daef0
commit 14dcaaddde
440 changed files with 13229 additions and 8718 deletions

View File

@@ -7,7 +7,7 @@
;; Maintainer: USAMI Kenta <tadsan@zonu.me>
;; Keywords: php languages convenience align
;; Homepage: https://github.com/emacs-php/php-mode
;; Version: 1.25.0
;; Version: 1.26.1
;; License: GPL-3.0-or-later
;; This program is free software; you can redistribute it and/or modify

View File

@@ -6,7 +6,7 @@
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Created: 18 Sep 2022
;; Version: 1.25.0
;; Version: 1.26.1
;; Keywords: languages, php
;; This program is free software; you can redistribute it and/or modify

View File

@@ -4,7 +4,7 @@
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Created: 5 Mar 2022
;; Version: 1.25.0
;; Version: 1.26.1
;; Keywords: languages, php
;; This program is free software; you can redistribute it and/or modify

View File

@@ -4,7 +4,7 @@
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Created: 5 May 2019
;; Version: 1.25.0
;; Version: 1.26.1
;; Keywords: faces, php
;; Homepage: https://github.com/emacs-php/php-mode
;; License: GPL-3.0-or-later
@@ -55,20 +55,42 @@
:group 'php-faces
:tag "PHP Function Name")
(defface php-function-call '((t ()))
(defface php-function-call-standard `((t ,(when (eval-when-compile (get 'font-lock-function-call-face 'face-defface-spec))
'(:inherit font-lock-function-call-face))))
"PHP Mode face used to highlight function names in calles."
:group 'php-faces
:tag "PHP Function Call")
:tag "PHP Function Call Standard")
(defface php-method-call '((t (:inherit php-function-call)))
(defface php-function-call-traditional '((t ()))
"PHP Mode face used to highlight function names in calles."
:group 'php-faces
:tag "PHP Function Call Traditional")
(define-obsolete-face-alias 'php-function-call 'php-function-call-traditional "1.26.0")
(defface php-method-call-standard '((t (:inherit php-function-call-standard)))
"PHP Mode face used to highlight method names in calles."
:group 'php-faces
:tag "PHP Method Call")
:tag "PHP Method Call Standard")
(defface php-static-method-call '((t (:inherit php-method-call)))
(defface php-method-call-traditional '((t (:inherit php-function-call-traditional)))
"PHP Mode face used to highlight method names in calles."
:group 'php-faces
:tag "PHP Method Call Traditional")
(define-obsolete-face-alias 'php-method-call 'php-method-call-traditional "1.26.0")
(defface php-static-method-call-standard '((t (:inherit php-method-call-standard)))
"PHP Mode face used to highlight static method names in calles."
:group 'php-faces
:tag "PHP Static Method Call")
:tag "PHP Static Method Call Standard")
(defface php-static-method-call-traditional '((t (:inherit php-method-call-traditional)))
"PHP Mode face used to highlight static method names in calles."
:group 'php-faces
:tag "PHP Static Method Call Traditional")
(define-obsolete-face-alias 'php-static-method-call 'php-static-method-call-traditional "1.26.0")
(defface php-variable-name '((t (:inherit font-lock-variable-name-face)))
"PHP Mode face used to highlight variable names."
@@ -156,16 +178,19 @@ The operator is also knows as \"Paamayim Nekudotayim\"."
:group 'php-faces
:tag "PHP Magical Constant")
(defface php-$this '((t (:inherit php-constant)))
(defface php-this '((t (:inherit php-constant)))
"PHP Mode face used to highlight $this variables."
:group 'php-faces
:tag "PHP $this")
(defface php-$this-sigil '((t (:inherit php-constant)))
(defface php-this-sigil '((t (:inherit php-constant)))
"PHP Mode face used to highlight sigils($) of $this variable."
:group 'php-faces
:tag "PHP $this Sigil")
(define-obsolete-face-alias 'php-$this 'php-this "1.26.0")
(define-obsolete-face-alias 'php-$this-sigil 'php-this-sigil "1.26.0")
(defface php-errorcontrol-op '((t (:inherit font-lock-type-face)))
"PHP Mode face used to highlight errorcontrol operators (@).."
:group 'php-faces

View File

@@ -4,7 +4,7 @@
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Created: 5 Mar 2022
;; Version: 1.25.0
;; Version: 1.26.1
;; Keywords: tools, languages, php
;; This program is free software; you can redistribute it and/or modify
@@ -26,8 +26,9 @@
;;; Code:
(require 'flymake)
(require 'flymake-proc)
(require 'cl-lib)
(eval-and-compile
(require 'flymake-proc))
(eval-when-compile
(require 'pcase)
(require 'rx))

View File

@@ -176,7 +176,7 @@
files)
return sym))
(setq-local php-format-command cmd))
(when-let (tup (plist-get (cdr-safe (assq cmd php-format-formatter-alist)) :command))
(when-let* ((tup (plist-get (cdr-safe (assq cmd php-format-formatter-alist)) :command)))
(setq executable (car tup))
(setq args (cdr tup))
(setq vendor (expand-file-name executable (expand-file-name php-format-command-dir default-directory)))

View File

@@ -5,7 +5,7 @@
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Keywords: tools, files
;; URL: https://github.com/emacs-php/php-mode
;; Version: 1.25.0
;; Version: 1.26.1
;; License: GPL-3.0-or-later
;; This program is free software; you can redistribute it and/or modify
@@ -30,8 +30,7 @@
(require 'phpactor nil t)
(require 'popup nil t)
(require 'smart-jump nil t)
(eval-when-compile
(require 'cl-lib))
(require 'cl-lib)
(defvar-local php-ide-phpactor-buffer nil)
(defvar-local php-ide-phpactor-hover-last-pos nil)
@@ -55,10 +54,11 @@
(defcustom php-ide-phpactor-activate-features '(all)
"A set of Phpactor features you want to enable."
:tag "PHP-IDE Phpactor Activate Features"
:type '(set (const all :tag "All")
:type '(set (const :tag "All" all)
(const hover)
(const navigation))
:safe (lambda (v) (and (listp v)))
:safe (lambda (xs) (and (listp xs)
(cl-every (lambda (x) (memq x '(all hover navigation))) xs)))
:group 'php-ide-phpactor)
(defvar php-ide-phpactor-timer nil

View File

@@ -5,7 +5,7 @@
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Keywords: tools, files
;; URL: https://github.com/emacs-php/php-mode
;; Version: 1.25.0
;; Version: 1.26.1
;; License: GPL-3.0-or-later
;; This program is free software; you can redistribute it and/or modify
@@ -166,7 +166,7 @@
(cond
((stringp php-ide-eglot-executable) (list php-ide-eglot-executable))
((listp php-ide-eglot-executable) php-ide-eglot-executable)
((when-let (command (assq php-ide-eglot-executable php-ide-lsp-command-alist))
((when-let* ((command (assq php-ide-eglot-executable php-ide-lsp-command-alist)))
(cond
((functionp command) (funcall command))
((listp command) command))))))
@@ -178,6 +178,7 @@
:type 'string
:safe #'stringp)
;;;###autoload
(defcustom php-ide-mode-functions nil
"Hook functions called when before activating or deactivating PHP-IDE.
Notice that two arguments (FEATURE ACTIVATE) are given.
@@ -188,18 +189,16 @@ ACTIVATE: T is given when activeting, NIL when deactivating PHP-IDE."
:group 'php-ide
:type '(repeat function)
:safe (lambda (functions)
(and (listp functions)
(cl-loop for function in functions
always (functionp function)))))
(and (listp functions) (cl-every #'functionp functions))))
;;;###autoload
(define-minor-mode php-ide-mode
"Minor mode for integrate IDE-like tools."
:lighter php-ide-mode-lighter
(let ((ide-features php-ide-features))
(when-let (unavailable-features (cl-loop for feature in ide-features
unless (assq feature php-ide-feature-alist)
collect feature))
(when-let* ((unavailable-features (cl-loop for feature in ide-features
unless (assq feature php-ide-feature-alist)
collect feature)))
(user-error "%s includes unavailable PHP-IDE features. (available features are: %s)"
ide-features
(mapconcat (lambda (feature) (concat "'" (symbol-name feature)))

View File

@@ -5,7 +5,7 @@
;; Author: USAMI Kenta <tadsan@zonu.me>
;; URL: https://github.com/emacs-php/php-mode
;; Keywords: maint
;; Version: 1.25.0
;; Version: 1.26.1
;; License: GPL-3.0-or-later
;; This program is free software; you can redistribute it and/or modify

View File

@@ -1,6 +1,6 @@
(define-package "php-mode" "20230929.123" "Major mode for editing PHP code"
'((emacs "26.1"))
:commit "4a29636243ba7f4afba476348587713531d994bc" :maintainers
(define-package "php-mode" "20250109.2103" "Major mode for editing PHP code"
'((emacs "27.1"))
:commit "0f756a8c0782ebdc00557addc68763305c91ca51" :maintainers
'(("USAMI Kenta" . "tadsan@zonu.me"))
:maintainer
'("USAMI Kenta" . "tadsan@zonu.me")

View File

@@ -1,6 +1,6 @@
;;; php-mode.el --- Major mode for editing PHP code -*- lexical-binding: t; -*-
;; Copyright (C) 2023 Friends of Emacs-PHP development
;; Copyright (C) 2024 Friends of Emacs-PHP development
;; Copyright (C) 1999, 2000, 2001, 2003, 2004 Turadg Aleahmad
;; 2008 Aaron S. Hawley
;; 2011, 2012, 2013, 2014, 2015, 2016, 2017 Eric James Michael Ritz
@@ -9,13 +9,13 @@
;; Maintainer: USAMI Kenta <tadsan@zonu.me>
;; URL: https://github.com/emacs-php/php-mode
;; Keywords: languages php
;; Version: 1.25.0
;; Package-Requires: ((emacs "26.1"))
;; Version: 1.26.1
;; Package-Requires: ((emacs "27.1"))
;; License: GPL-3.0-or-later
(eval-and-compile
(make-obsolete-variable
(defconst php-mode-version-number "1.25.0" "PHP Mode version number.")
(defconst php-mode-version-number "1.26.1" "PHP Mode version number.")
"Please call (php-mode-version :as-number t) for compatibility." "1.24.2"))
;; This program is free software; you can redistribute it and/or modify
@@ -191,7 +191,7 @@ Turning this on will open it whenever `php-mode' is loaded."
#'php-flymake))
"Flymake function to replace, if NIL do not replace."
:tag "PHP Mode Replace Flymake Diag Function"
:type '(choice 'function
:type '(choice function
(const :tag "Disable to replace" nil)))
(define-obsolete-variable-alias 'php-do-not-use-semantic-imenu 'php-mode-do-not-use-semantic-imenu "1.20.0")
@@ -253,7 +253,7 @@ mumamo-mode turned on. Detects if there are any HTML tags in the
buffer before warning, but this is is not very smart; e.g. if you
have any tags inside a PHP string, it will be fooled."
:tag "PHP Mode Warn If MuMaMo Off"
:type '(choice (const :tag "Warn" t) (const "Don't warn" nil)))
:type '(choice (const :tag "Warn" t) (const :tag "Don't warn" nil)))
(defcustom php-mode-coding-style 'pear
"Select default coding style to use with `php-mode'.
@@ -292,13 +292,6 @@ In that case set to `NIL'."
:tag "PHP Mode Enable Backup Style Variables"
:type 'boolean)
(define-obsolete-variable-alias 'php-mode-disable-parent-mode-hooks 'php-mode-disable-c-mode-hook "1.21.0")
(defcustom php-mode-disable-c-mode-hook t
"When set to `T', do not run hooks of parent modes (`java-mode', `c-mode')."
:tag "PHP Mode Disable C Mode Hook"
:type 'boolean)
(make-obsolete-variable 'php-mode-disable-c-mode-hook nil "1.24.2")
(defcustom php-mode-enable-project-local-variable t
"When set to `T', apply project local variable to buffer local variable."
:tag "PHP Mode Enable Project Local Variable"
@@ -327,6 +320,7 @@ as a function. Call with AS-NUMBER keyword to compare by `version<'.
(defvar php-mode-map
(let ((map (make-sparse-keymap "PHP Mode")))
(set-keymap-parent map c-mode-base-map)
;; Remove menu item for c-mode
(define-key map [menu-bar C] nil)
@@ -633,8 +627,7 @@ but only if the setting is enabled."
((assq 'defun-block-intro c-syntactic-context) nil)
((assq 'defun-close c-syntactic-context) nil)
((assq 'statement-cont c-syntactic-context) nil)
(t
(save-excursion
((save-excursion
(beginning-of-line)
(let ((beginning-of-langelem (cdr langelem))
(beginning-of-current-line (point))
@@ -657,8 +650,10 @@ but only if the setting is enabled."
(skip-chars-backward " \r\n")
(backward-char 1))
(and (not (eq (point) beginning-of-current-line))
(not (php-in-string-or-comment-p))
(not (looking-at-p ","))
(not (php-in-string-or-comment-p))))
(save-excursion
(backward-char) (not (looking-at-p ",")))))
'+)
(t nil)))))))
@@ -715,7 +710,7 @@ a backward search limit."
"pear"
'("php"
(c-basic-offset . 4)
(c-offsets-alist . ((case-label . 0)))
(c-offsets-alist . ((case-label . 0) (statement-cont . +)))
(tab-width . 4)
(php-mode-lineup-cascaded-calls . nil)))
@@ -1044,17 +1039,24 @@ HEREDOC-START."
(unwind-protect
(let (new-start new-end)
(goto-char start)
;; Consider bounding this backwards search by `beginning-of-defun'.
;; (Benchmarking for a wide range of cases may be needed to decide
;; whether that's an improvement, as `php-beginning-of-defun' also
;; uses `re-search-backward'.)
(when (re-search-backward php-heredoc-start-re nil t)
(let ((maybe (point)))
(when (and (re-search-forward (php-heredoc-end-re (match-string 0)) nil t)
(> (point) start))
(setq new-start maybe))))
(goto-char end)
(when (re-search-backward php-heredoc-start-re nil t)
(if (re-search-forward (php-heredoc-end-re (match-string 0)) nil t)
(setq new-start maybe)
(when (> (point) end)
(setq new-end (point)))
(setq new-end (point-max))))
(setq new-end (point))))))
(unless new-end
(goto-char end)
(when (re-search-backward php-heredoc-start-re start t)
(if (re-search-forward (php-heredoc-end-re (match-string 0)) nil t)
(when (> (point) end)
(setq new-end (point)))
(setq new-end (point-max)))))
(when (or new-start new-end)
(cons (or new-start start) (or new-end end))))
;; Cleanup
@@ -1131,13 +1133,6 @@ After setting the stylevars run hook `php-mode-STYLENAME-hook'."
(php-project-apply-local-variables)
(remove-hook 'hack-local-variables-hook #'php-mode-set-local-variable-delay))
(defun php-mode-neutralize-cc-mode-effect ()
"Reset PHP-irrelevant variables set by Cc Mode initialization."
(setq-local c-mode-hook nil)
(setq-local java-mode-hook nil)
(remove-hook 'flymake-diagnostic-functions 'flymake-cc t)
t)
(defvar php-mode-syntax-table
(let ((table (make-syntax-table)))
(c-populate-syntax-table table)
@@ -1150,26 +1145,28 @@ After setting the stylevars run hook `php-mode-STYLENAME-hook'."
table))
;;;###autoload
(define-derived-mode php-mode c-mode "PHP"
(define-derived-mode php-mode php-base-mode "PHP"
"Major mode for editing PHP code.
\\{php-mode-map}"
:syntax-table php-mode-syntax-table
;; :after-hook (c-update-modeline)
;; (setq abbrev-mode t)
:after-hook (progn (c-make-noise-macro-regexps)
(c-make-macro-with-semi-re)
(c-update-modeline))
(unless (string= php-mode-cc-version c-version)
(php-mode-debug-reinstall nil))
(if php-mode-disable-c-mode-hook
(php-mode-neutralize-cc-mode-effect)
(display-warning 'php-mode
"`php-mode-disable-c-mode-hook' will be removed. Do not depends on this variable."
:warning))
(c-initialize-cc-mode t)
(setq abbrev-mode t)
;; Must be called once as c-mode to enable font-lock for Heredoc.
;; TODO: This call may be removed in the future.
(c-common-init 'c-mode)
(c-init-language-vars php-mode)
(c-common-init 'php-mode)
(cc-imenu-init cc-imenu-c-generic-expression)
(setq-local c-auto-align-backslashes nil)
(setq-local comment-start "// ")
@@ -1252,13 +1249,8 @@ After setting the stylevars run hook `php-mode-STYLENAME-hook'."
(advice-add 'acm-backend-tabnine-candidate-expand
:filter-args #'php-acm-backend-tabnine-candidate-expand-filter-args)
(when (>= emacs-major-version 25)
(with-silent-modifications
(save-excursion
(let* ((start (point-min))
(end (min (point-max)
(+ start syntax-propertize-chunk-size))))
(php-syntax-propertize-function start end))))))
(when (eval-when-compile (>= emacs-major-version 25))
(syntax-ppss-flush-cache (point-min))))
(declare-function semantic-create-imenu-index "semantic/imenu" (&optional stream))
@@ -1310,18 +1302,20 @@ for \\[find-tag] (which see)."
;; Font Lock
(defconst php-phpdoc-type-names
(list "string" "integer" "int" "boolean" "bool" "float"
"double" "object" "mixed" "array" "resource"
"void" "null" "false" "true" "self" "static"
"callable" "iterable" "number"
;; PHPStan and Psalm types
"array-key" "associative-array" "callable-array" "callable-object"
"callable-string" "class-string" "empty" "enum-string" "list"
"literal-string" "negative-int" "non-positive-int" "non-negative-int"
"never" "never-return" "never-returns" "no-return" "non-empty-array"
"non-empty-list" "non-empty-string" "non-falsy-string"
"numeric" "numeric-string" "positive-int" "scalar"
"trait-string" "truthy-string" "key-of" "value-of")
'(;; PHPStan and Psalm types
"__stringandstringable" "array" "array-key" "associative-array" "bool" "boolean"
"callable" "callable-array" "callable-object" "callable-string" "class-string"
"closed-resource" "double" "empty" "empty-scalar" "enum-string" "false" "float"
"int" "integer" "interface-string" "iterable" "list" "literal-string" "lowercase-string"
"mixed" "negative-int" "never" "never-return" "never-returns" "no-return" "non-empty-array"
"non-empty-list" "non-empty-literal-string" "non-empty-lowercase-string" "non-empty-mixed"
"non-empty-scalar" "non-empty-string" "non-empty-uppercase-string" "non-falsy-string"
"non-negative-int" "non-positive-int" "non-zero-int" "noreturn" "null" "number" "numeric"
"numeric-string" "object" "open-resource" "parent" "positive-int" "pure-callable"
"pure-closure" "resource" "scalar" "self" "static" "string" "trait-string" "true"
"truthy-string" "uppercase-string" "void"
;; PHPStan Generic Types
"key-of" "value-of" "int-mask-of" "int-mask" "__benevolent" "template-type" "new")
"A list of type and pseudotype names that can be used in PHPDoc.")
(make-obsolete-variable 'php-phpdoc-type-keywords 'php-phpdoc-type-names "1.24.2")
@@ -1331,6 +1325,7 @@ for \\[find-tag] (which see)."
"return" "throws" "var" "self-out" "this-out" "param-out"
"type" "extends" "require-extends" "implemtents" "require-implements"
"template" "template-covariant" "template-extends" "template-implements"
"require-extends" "require-implements"
"assert" "assert-if-true" "assert-if-false" "if-this-is")
"A list of tags specifying type names.")
@@ -1381,14 +1376,14 @@ for \\[find-tag] (which see)."
;; Highlight variables, e.g. 'var' in '$var' and '$obj->var', but
;; not in $obj->var()
("\\(->\\)\\(\\sw+\\)\\s-*(" (1 'php-object-op) (2 'php-method-call))
("\\(->\\)\\(\\sw+\\)\\s-*(" (1 'php-object-op) (2 php-method-call))
("\\<\\(const\\)\\s-+\\(\\_<.+?\\_>\\)" (1 'php-keyword) (2 'php-constant-assign))
;; Logical operator (!)
("\\(!\\)[^=]" 1 'php-logical-op)
;; Highlight special variables
("\\(\\$\\)\\(this\\)\\>" (1 'php-$this-sigil) (2 'php-$this))
("\\(\\$\\)\\(this\\)\\>" (1 'php-this-sigil) (2 'php-this))
("\\(\\$+\\)\\(\\sw+\\)" (1 'php-variable-sigil) (2 'php-variable-name))
("\\(->\\)\\([a-zA-Z0-9_]+\\)" (1 'php-object-op) (2 'php-property-name))
@@ -1423,7 +1418,7 @@ for \\[find-tag] (which see)."
;; Highlight static method calls as such. This is necessary for method
;; names which are identical to keywords to be highlighted correctly.
("\\sw+::\\(\\sw+\\)(" 1 'php-static-method-call)
("\\sw+::\\(\\sw+\\)(" 1 php-static-method-call)
;; Multiple catch (FooException | BarException $e)
(,(rx symbol-start "catch" symbol-end
(* (syntax whitespace)) "(" (* (syntax whitespace))
@@ -1467,7 +1462,7 @@ for \\[find-tag] (which see)."
(1 'php-import-declaration)
(,(rx (group (+ (or (syntax word) (syntax symbol) "\\" "{" "}")))) nil nil (1 'php-constant-assign t)))
;; Highlight function calls
("\\(\\_<\\(?:\\sw\\|\\s_\\)+?\\_>\\)\\s-*(" 1 'php-function-call)
("\\(\\_<\\(?:\\sw\\|\\s_\\)+?\\_>\\)\\s-*(" 1 php-function-call)
;; Highlight all upper-cased symbols as constant
("\\<\\([A-Z_][A-Z0-9_]+\\)\\>" 1 'php-constant)
@@ -1525,7 +1520,9 @@ for \\[find-tag] (which see)."
;; Not operator (!) is defined in "before cc-mode" section above.
("\\(&&\\|||\\)" 1 'php-logical-op)
;; string interpolation ("$var, ${var}, {$var}")
(php-mode--string-interpolated-variable-font-lock-find 0 nil)))
(php-mode--string-interpolated-variable-font-lock-find 0 nil)
(,(rx symbol-start (group (or "get" "set")) (+ (syntax whitespace)) (or "{" "=>"))
1 'php-builtin)))
"Detailed highlighting for PHP Mode.")
(defvar php-font-lock-keywords php-font-lock-keywords-3

View File

@@ -5,7 +5,7 @@
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Keywords: tools, files
;; URL: https://github.com/emacs-php/php-mode
;; Version: 1.25.0
;; Version: 1.26.1
;; License: GPL-3.0-or-later
;; This program is free software; you can redistribute it and/or modify
@@ -267,7 +267,7 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.")
This function is compatible with `project-find-functions'."
(let ((default-directory dir))
(when-let (root (php-project-get-root-dir))
(when-let* ((root (php-project-get-root-dir)))
(if (file-exists-p (expand-file-name ".git" root))
(cons 'vc root)
(cons 'transient root)))))

View File

@@ -5,7 +5,7 @@
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Created: 5 Dec 2018
;; Version: 1.25.0
;; Version: 1.26.1
;; Keywords: languages, php
;; Homepage: https://github.com/emacs-php/php-mode
;; License: GPL-3.0-or-later
@@ -99,8 +99,8 @@ You can replace \"en\" with your ISO language code."
"Function to search PHP Manual at cursor position."
:group 'php
:tag "PHP Search Documentation Function"
:type '(choice (const :tag "Use online documentation" #'php-search-web-documentation)
(const :tag "Use local documentation" #'php-local-manual-search)
:type '(choice (const :tag "Use online documentation" php-search-web-documentation)
(const :tag "Use local documentation" php-local-manual-search)
(function :tag "Use other function")))
(defcustom php-search-documentation-browser-function nil
@@ -203,6 +203,30 @@ a completion list."
:type 'integer
:link '(url-link :tag "Built-in web server"
"https://www.php.net/manual/features.commandline.webserver.php"))
(defcustom php-topsy-separator " > "
"Separator string for `php-topsy-beginning-of-defun-with-class'."
:group 'php
:tag "PHP Topsy Separator"
:type 'string)
(defcustom php-function-call 'php-function-call-traditional
"Face name to use for method call."
:group 'php
:tag "PHP Function Call"
:type 'face)
(defcustom php-method-call 'php-method-call-traditional
"Face name to use for method call."
:group 'php
:tag "PHP Method Call"
:type 'face)
(defcustom php-static-method-call 'php-static-method-call-traditional
"Face name to use for method call."
:group 'php
:tag "PHP Static Method Call"
:type 'face)
;;; PHP Keywords
(defconst php-magical-constants
@@ -429,7 +453,7 @@ can be used to match against definitions for that classlike."
(defcustom php-imenu-generic-expression 'php-imenu-generic-expression-default
"Default Imenu generic expression for PHP Mode. See `imenu-generic-expression'."
:type '(choice (alist :key-type string :value-type list)
:type '(choice (alist :key-type string :value-type (list string))
(const php-imenu-generic-expression-legacy)
(const php-imenu-generic-expression-simple)
variable)
@@ -529,15 +553,14 @@ The order is reversed by calling as follows:
(c-backward-token-2 1 nil))
collect
(cond
((when-let (bounds (php--thing-at-point-bounds-of-string-at-point))
((when-let* ((bounds (php--thing-at-point-bounds-of-string-at-point)))
(prog1 (buffer-substring-no-properties (car bounds) (cdr bounds))
(goto-char (car bounds)))))
((looking-at php-re-token-symbols)
(prog1 (match-string-no-properties 0)
(goto-char (match-beginning 0))))
(t
(buffer-substring-no-properties (point)
(save-excursion (php--c-end-of-token) (point))))))))))
((buffer-substring-no-properties (point)
(save-excursion (php--c-end-of-token) (point))))))))))
(defun php-get-pattern ()
"Find the pattern we want to complete.
@@ -621,6 +644,15 @@ Look at the `php-executable' variable instead of the constant \"php\" command."
(setq mode nil)))
(or mode php-default-major-mode)))
;;;###autoload
(define-derived-mode php-base-mode prog-mode "PHP"
"Generic major mode for editing PHP.
This mode is intended to be inherited by concrete major modes.
Currently there are `php-mode' and `php-ts-mode'."
:group 'php
nil)
;;;###autoload
(defun php-mode-maybe ()
"Select PHP mode or other major mode."
@@ -632,17 +664,15 @@ Look at the `php-executable' variable instead of the constant \"php\" command."
(defun php-current-class ()
"Insert current class name if cursor in class context."
(interactive)
(let ((matched (php-get-current-element php--re-classlike-pattern)))
(when matched
(insert (concat matched php-class-suffix-when-insert)))))
(when-let* ((matched (php-get-current-element php--re-classlike-pattern)))
(insert (concat matched php-class-suffix-when-insert))))
;;;###autoload
(defun php-current-namespace ()
"Insert current namespace if cursor in namespace context."
(interactive)
(let ((matched (php-get-current-element php--re-namespace-pattern)))
(when matched
(insert (concat matched php-namespace-suffix-when-insert)))))
(when-let* ((matched (php-get-current-element php--re-namespace-pattern)))
(insert (concat matched php-namespace-suffix-when-insert))))
;;;###autoload
(defun php-copyit-fqsen ()
@@ -655,6 +685,33 @@ Look at the `php-executable' variable instead of the constant \"php\" command."
(if (string= class "") "" (concat "\\" class "::"))
(if (string= namedfunc "") "" (concat namedfunc "()"))))))
(defun php-topsy-beginning-of-defun-with-class ()
"Return function signature and class name string for header line in topsy.
You can add the function to topsy with the code below:
(add-to-list \\='topsy-mode-functions
\\='(php-mode . php-topsy-beginning-of-defun-with-class))"
(save-excursion
(goto-char (window-start))
(mapconcat
#'identity
(append
(save-match-data
(save-excursion
(when (re-search-backward php--re-classlike-pattern nil t)
(font-lock-ensure (point) (line-end-position))
(list (string-trim (buffer-substring (point) (line-end-position)))))))
(progn
(beginning-of-defun)
(font-lock-ensure (point) (line-end-position))
(list (string-trim
(replace-regexp-in-string
(eval-when-compile (rx bos "<?php"))
""
(buffer-substring (point) (line-end-position)))))))
php-topsy-separator)))
;;;###autoload
(defun php-run-builtin-web-server (router-or-dir hostname port &optional document-root)
"Run PHP Built-in web server.