diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bfe04578..41fa23bb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: - "26.3" - "27.2" - "28.2" - - "29.1" + - "29.4" experimental: [false] include: - os: ubuntu-latest @@ -35,8 +35,13 @@ jobs: - os: windows-latest emacs-version: snapshot experimental: true + exclude: + - os: macos-latest + emacs-version: "26.3" + - os: macos-latest + emacs-version: "27.2" steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.11' architecture: 'x64' diff --git a/AUTHORS.md b/AUTHORS.md index bdd02614..2c25aaee 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -24,6 +24,7 @@ Names Sorted Alphabetically: - Aaron S. Hawley - Alan Pearce +- Alex Figl-Brick - Andreas Röhler - Andrei Chițu - Antoine Brand diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ffd2693..2408957b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,56 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this +## [1.26.1] - 2024-09-13 + +### Added + + * Add `php-base-mode` which is the base of php related modes ([#772]) + * `php-base-mode` is designed as a common parent mode for `php-mode` ~~and [`php-ts-mode`](https://github.com/emacs-php/php-ts-mode)~~. + +### Changed + + * Make `php-mode` inherit from `php-base-mode` instead of `c-mode` ([#772]) + * Modify indentation of [PEAR Coding Standards] ([#774], [#777]) + * No longer overindent it by default, since we don't see any mention in the coding style that it should hang `.`. (refs [#227] and [#229]) + * **If you have any feedback on PEAR style, please let us know in [the discussion #776][#776].** + * Remove `$` from face names for interoperability with treesit ([#780], [emacs-php/php-ts-mode#68]) + * `php-$this` → `php-this` + * `php-$this-sigil` → `php-this-sigil` + * Add `php-function-call-standard` face inherit `font-lock-function-call-face` on Emacs 29.1 and above ([#782], thanks [@bricka]!) + * Add `-tranditional` suffix to the `php-*-call` faces. + * `php-function-call` → `php-function-call-traditional` + * `php-method-call` → `php-method-call-traditional` + * `php-static-method-call` → `php-static-method-call-traditional` + * Add variables for the `php-function-call`, `php-method-call`, and `php-static-method-call` faces, defaulting to the `-traditional` face. + * Changes how php-syntax-propertize-rules are applied for the first time. ([#785] and [#786]) + * This change is expected to make heredoc and attribute coloring more stable and reduce flicker. + +### Removed + + * Remove `php-mode-disable-c-mode-hook` custom variable and `php-mode-neutralize-cc-mode-effect` function ([#775]) + * `php-mode` no longer inherits `c-mode`, so this variable won't work. + +[#227]: https://github.com/emacs-php/php-mode/pull/227 +[#229]: https://github.com/emacs-php/php-mode/pull/229 +[#772]: https://github.com/emacs-php/php-mode/pull/772 +[#774]: https://github.com/emacs-php/php-mode/issues/774 +[#775]: https://github.com/emacs-php/php-mode/pull/775 +[#776]: https://github.com/emacs-php/php-mode/discussions/776 +[#777]: https://github.com/emacs-php/php-mode/pull/777 +[#780]: https://github.com/emacs-php/php-mode/issues/780 +[#782]: https://github.com/emacs-php/php-mode/issues/782 +[#785]: https://github.com/emacs-php/php-mode/issues/785 +[#786]: https://github.com/emacs-php/php-mode/pull/786 +[@bricka]: https://github.com/bricka +[emacs-php/php-ts-mode#68]: https://github.com/emacs-php/php-ts-mode/pull/68 +[PEAR Coding Standards]: https://pear.php.net/manual/en/standards.php + +## [1.26.0] - 2024-09-13 + +> [!NOTE] +> This version was cancelled due to a release error. + ## [1.25.1] - 2023-11-24 ### Added diff --git a/Eask b/Eask index 23cc3463..2a90ee52 100644 --- a/Eask +++ b/Eask @@ -1,5 +1,5 @@ (package "php-mode" - "1.25.1" + "1.26.1" "Major mode for editing PHP code") (website-url "https://github.com/emacs-php/php-mode") diff --git a/LICENSE b/LICENSE index 94a9ed02..f288702d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. diff --git a/Makefile b/Makefile index 52665554..9b722e9b 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,10 @@ AUTHORS.md: etc/git/AUTHORS.md.in .mailmap @printf "Generating AUTHORS.md file..." @test -d .git \ && (cat $< > $@ \ - && git log --pretty=format:'- %aN' | \ - cat etc/git/former-contributors - | LANG=C sort -u >> $@ \ + && git log --pretty=format:'- %aN' \ + | cat etc/git/former-contributors - \ + | grep -v dependabot \ + | LANG=C sort -u >> $@ \ && cat etc/git/AUTHORS2.md.in >> $@ \ && printf "FINISHED\n" ; ) \ || printf "FAILED (non-fatal)\n" diff --git a/README.ja.md b/README.ja.md index f6c61ba1..5c0dd082 100644 --- a/README.ja.md +++ b/README.ja.md @@ -1,8 +1,8 @@

Emacs PHP Mode

-[![Emacs: 29.1](https://img.shields.io/badge/Emacs-29.1-blue.svg)](https://www.gnu.org/software/emacs/) -[![lang: PHP 8.2](https://img.shields.io/badge/lang-PHP%208.2-brightgreen.svg)](https://php.net/manual/migration82.php) +[![Emacs: 29.2](https://img.shields.io/badge/Emacs-29.2-blue.svg)](https://www.gnu.org/software/emacs/) +[![lang: PHP 8.3](https://img.shields.io/badge/lang-PHP%208.3-brightgreen.svg)](https://php.net/manual/migration83.php) [![lang: PHP 7](https://img.shields.io/badge/lang-PHP%207-green.svg)](https://php.net/downloads.php) [![Build Status](https://github.com/emacs-php/php-mode/workflows/CI/badge.svg)](https://github.com/emacs-php/php-mode/actions) [![GPL v3](https://img.shields.io/badge/license-GPL_v3-green.svg)][gpl-v3]
diff --git a/README.md b/README.md index f02e9428..b2726c5d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@

Emacs PHP Mode

-[![Emacs: 29.1](https://img.shields.io/badge/Emacs-29.1-blue.svg)](https://www.gnu.org/software/emacs/) -[![lang: PHP 8.2](https://img.shields.io/badge/lang-PHP%208.2-brightgreen.svg)](https://php.net/manual/migration82.php) -[![lang: PHP 7](https://img.shields.io/badge/lang-PHP%207-green.svg)](https://php.net/downloads.php) +[![Emacs: 29.2](https://img.shields.io/badge/Emacs-29.2-blue.svg)](https://www.gnu.org/software/emacs/) +[![lang: PHP 8.3](https://img.shields.io/badge/lang-PHP%208.3-brightgreen.svg)](https://www.php.net/manual/migration83.php) +[![lang: PHP 7](https://img.shields.io/badge/lang-PHP%207-green.svg)](https://www.php.net/downloads.php) [![Build Status](https://github.com/emacs-php/php-mode/workflows/CI/badge.svg)](https://github.com/emacs-php/php-mode/actions) [![GPL v3](https://img.shields.io/badge/license-GPL_v3-green.svg)][gpl-v3]
[![NonGNU ELPA][nongnu-elpa-badge]][nongnu-elpa] diff --git a/lisp/php-align.el b/lisp/php-align.el index de4fe3cf..e9acc469 100644 --- a/lisp/php-align.el +++ b/lisp/php-align.el @@ -7,7 +7,7 @@ ;; Maintainer: USAMI Kenta ;; Keywords: php languages convenience align ;; Homepage: https://github.com/emacs-php/php-mode -;; Version: 1.25.1 +;; Version: 1.26.1 ;; License: GPL-3.0-or-later ;; This program is free software; you can redistribute it and/or modify diff --git a/lisp/php-complete.el b/lisp/php-complete.el index 28ac52fe..f2b1aa42 100644 --- a/lisp/php-complete.el +++ b/lisp/php-complete.el @@ -6,7 +6,7 @@ ;; Author: USAMI Kenta ;; Created: 18 Sep 2022 -;; Version: 1.25.1 +;; Version: 1.26.1 ;; Keywords: languages, php ;; This program is free software; you can redistribute it and/or modify diff --git a/lisp/php-defs.el b/lisp/php-defs.el index 37bd682d..8be83138 100644 --- a/lisp/php-defs.el +++ b/lisp/php-defs.el @@ -4,7 +4,7 @@ ;; Author: USAMI Kenta ;; Created: 5 Mar 2022 -;; Version: 1.25.1 +;; Version: 1.26.1 ;; Keywords: languages, php ;; This program is free software; you can redistribute it and/or modify diff --git a/lisp/php-face.el b/lisp/php-face.el index 70db33e0..147fb813 100644 --- a/lisp/php-face.el +++ b/lisp/php-face.el @@ -4,7 +4,7 @@ ;; Author: USAMI Kenta ;; Created: 5 May 2019 -;; Version: 1.25.1 +;; 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 Standard") + +(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") + :tag "PHP Method Call Traditional") -(defface php-static-method-call '((t (:inherit php-method-call))) +(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 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") + :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 diff --git a/lisp/php-flymake.el b/lisp/php-flymake.el index 37e4aea4..8efad224 100644 --- a/lisp/php-flymake.el +++ b/lisp/php-flymake.el @@ -4,7 +4,7 @@ ;; Author: USAMI Kenta ;; Created: 5 Mar 2022 -;; Version: 1.25.1 +;; Version: 1.26.1 ;; Keywords: tools, languages, php ;; This program is free software; you can redistribute it and/or modify diff --git a/lisp/php-ide-phpactor.el b/lisp/php-ide-phpactor.el index 831f49be..f0a98c82 100644 --- a/lisp/php-ide-phpactor.el +++ b/lisp/php-ide-phpactor.el @@ -5,7 +5,7 @@ ;; Author: USAMI Kenta ;; Keywords: tools, files ;; URL: https://github.com/emacs-php/php-mode -;; Version: 1.25.1 +;; Version: 1.26.1 ;; License: GPL-3.0-or-later ;; This program is free software; you can redistribute it and/or modify diff --git a/lisp/php-ide.el b/lisp/php-ide.el index 9f63cdee..a48cf1e0 100644 --- a/lisp/php-ide.el +++ b/lisp/php-ide.el @@ -5,7 +5,7 @@ ;; Author: USAMI Kenta ;; Keywords: tools, files ;; URL: https://github.com/emacs-php/php-mode -;; Version: 1.25.1 +;; Version: 1.26.1 ;; License: GPL-3.0-or-later ;; This program is free software; you can redistribute it and/or modify @@ -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,9 +189,7 @@ 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 diff --git a/lisp/php-mode-debug.el b/lisp/php-mode-debug.el index a3e2d1da..efe6e48e 100644 --- a/lisp/php-mode-debug.el +++ b/lisp/php-mode-debug.el @@ -5,7 +5,7 @@ ;; Author: USAMI Kenta ;; URL: https://github.com/emacs-php/php-mode ;; Keywords: maint -;; Version: 1.25.1 +;; Version: 1.26.1 ;; License: GPL-3.0-or-later ;; This program is free software; you can redistribute it and/or modify diff --git a/lisp/php-mode.el b/lisp/php-mode.el index 022b2a62..d9b73264 100644 --- a/lisp/php-mode.el +++ b/lisp/php-mode.el @@ -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 ;; URL: https://github.com/emacs-php/php-mode ;; Keywords: languages php -;; Version: 1.25.1 +;; Version: 1.26.1 ;; Package-Requires: ((emacs "26.1")) ;; License: GPL-3.0-or-later (eval-and-compile (make-obsolete-variable - (defconst php-mode-version-number "1.25.1" "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 @@ -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) @@ -715,7 +709,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))) @@ -1131,13 +1125,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 +1137,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 +1241,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)) @@ -1331,6 +1315,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 +1366,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 +1408,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 +1452,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) diff --git a/lisp/php-project.el b/lisp/php-project.el index 6d20e455..81899803 100644 --- a/lisp/php-project.el +++ b/lisp/php-project.el @@ -5,7 +5,7 @@ ;; Author: USAMI Kenta ;; Keywords: tools, files ;; URL: https://github.com/emacs-php/php-mode -;; Version: 1.25.1 +;; Version: 1.26.1 ;; License: GPL-3.0-or-later ;; This program is free software; you can redistribute it and/or modify diff --git a/lisp/php.el b/lisp/php.el index 3c5f3490..aa09b5df 100644 --- a/lisp/php.el +++ b/lisp/php.el @@ -5,7 +5,7 @@ ;; Author: USAMI Kenta ;; Created: 5 Dec 2018 -;; Version: 1.25.1 +;; Version: 1.26.1 ;; Keywords: languages, php ;; Homepage: https://github.com/emacs-php/php-mode ;; License: GPL-3.0-or-later @@ -209,6 +209,24 @@ a completion list." :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 @@ -627,6 +645,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." @@ -665,7 +692,9 @@ Look at the `php-executable' variable instead of the constant \"php\" command." "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\)\)" + + (add-to-list \\='topsy-mode-functions + \\='(php-mode . php-topsy-beginning-of-defun-with-class))" (save-excursion (goto-char (window-start)) (mapconcat diff --git a/script/data/module_id_prefixes.php b/script/data/module_id_prefixes.php index bd379958..93a01f5e 100644 --- a/script/data/module_id_prefixes.php +++ b/script/data/module_id_prefixes.php @@ -496,6 +496,7 @@ 'curl' => [ 'curlfile.', 'function.curl-', + 'function.curl_upkeep', ], 'dba' => [ 'function.dba-', @@ -705,6 +706,9 @@ 'function.recode', 'function.recode-', ], + 'rnp' => [ + 'function.rnp-', + ], 'runkit7' => [ 'function.runkit7-', ], @@ -721,6 +725,9 @@ 'shmop' => [ 'function.shmop-', ], + 'simdjson' => [ + 'function.simdjson-' + ], 'simplexml' => [ 'function.dom-import-simplexml', 'function.simplexml-', diff --git a/tests/7.4/typed-property.php.faces b/tests/7.4/typed-property.php.faces index fac03f33..660b7b0a 100644 --- a/tests/7.4/typed-property.php.faces +++ b/tests/7.4/typed-property.php.faces @@ -32,8 +32,8 @@ (" ") ("null" . php-constant) (")\n {\n ") - ("$" . php-$this-sigil) - ("this" . php-$this) + ("$" . php-this-sigil) + ("this" . php-this) ("->" . php-object-op) ("string" . php-property-name) (" ") @@ -48,10 +48,10 @@ (" ") ("print" . php-function-name) ("()\n {\n ") - ("var_dump" . php-function-call) + ("var_dump" . php-function-call-traditional) ("(") - ("$" . php-$this-sigil) - ("this" . php-$this) + ("$" . php-this-sigil) + ("this" . php-this) ("->" . php-object-op) ("string" . php-property-name) (");\n }\n}\n\n(") @@ -60,5 +60,5 @@ ("Typed" . font-lock-type-face) (")") ("->" . php-object-op) - ("print" . php-method-call) + ("print" . php-method-call-traditional) ("();\n")) diff --git a/tests/8.0/attribute/class.php.faces b/tests/8.0/attribute/class.php.faces index a4381657..1d249b6a 100644 --- a/tests/8.0/attribute/class.php.faces +++ b/tests/8.0/attribute/class.php.faces @@ -24,10 +24,10 @@ #[WithoutArgument] #[") - ("SingleArgument" . php-function-call) + ("SingleArgument" . php-function-call-traditional) ("(0)] #[") - ("FewArguments" . php-function-call) + ("FewArguments" . php-function-call-traditional) ("(") ("'Hello'" . php-string) (", ") @@ -40,9 +40,9 @@ ("() {} #[WithoutArgument] #[") - ("SingleArgument" . php-function-call) + ("SingleArgument" . php-function-call-traditional) ("(0)] #[") - ("FewArguments" . php-function-call) + ("FewArguments" . php-function-call-traditional) ("(") ("'Hello'" . php-string) (", ") @@ -55,11 +55,11 @@ ("() {} #[") - ("Attr2" . php-function-call) + ("Attr2" . php-function-call-traditional) ("(") ("\"foo\"" . php-string) ("), ") - ("Attr2" . php-function-call) + ("Attr2" . php-function-call-traditional) ("(") ("\"bar\"" . php-string) (")] diff --git a/tests/8.0/attribute/function.php.faces b/tests/8.0/attribute/function.php.faces index da2aea6c..00cedf07 100644 --- a/tests/8.0/attribute/function.php.faces +++ b/tests/8.0/attribute/function.php.faces @@ -11,10 +11,10 @@ #[WithoutArgument] #[") - ("SingleArgument" . php-function-call) + ("SingleArgument" . php-function-call-traditional) ("(0)] #[") - ("FewArguments" . php-function-call) + ("FewArguments" . php-function-call-traditional) ("(") ("'Hello'" . php-string) (", ") @@ -27,9 +27,9 @@ ("() {} #[WithoutArgument]#[") - ("SingleArgument" . php-function-call) + ("SingleArgument" . php-function-call-traditional) ("(0)]#[") - ("FewArguments" . php-function-call) + ("FewArguments" . php-function-call-traditional) ("(") ("'Hello'" . php-string) (", ") diff --git a/tests/constants.php.faces b/tests/constants.php.faces index 28f9523d..6718eb44 100644 --- a/tests/constants.php.faces +++ b/tests/constants.php.faces @@ -46,7 +46,7 @@ (";\n") ("SomeClass" . php-constant) ("::" . php-paamayim-nekudotayim) - ("classIdentifier" . php-static-method-call) + ("classIdentifier" . php-static-method-call-traditional) ("();\n\n") ("__halt_compiler" . php-keyword) ("();\n\n") diff --git a/tests/identifiers.php.faces b/tests/identifiers.php.faces index fbb56dfa..df098c90 100644 --- a/tests/identifiers.php.faces +++ b/tests/identifiers.php.faces @@ -43,15 +43,15 @@ ("the constant face. Just like c++-mode \"NS::Class::method()\"\n" . font-lock-comment-face) ("ClassName" . php-constant) ("::" . php-paamayim-nekudotayim) - ("method" . php-static-method-call) + ("method" . php-static-method-call-traditional) ("();\n") ("\\SpaceName\\ClassName" . php-constant) ("::" . php-paamayim-nekudotayim) - ("method" . php-static-method-call) + ("method" . php-static-method-call-traditional) ("();\n") ("\\My_Class" . php-constant) ("::" . php-paamayim-nekudotayim) - ("method" . php-static-method-call) + ("method" . php-static-method-call-traditional) ("();\n\n") ("__halt_compiler" . php-keyword) ("();\n\n") diff --git a/tests/issue-227.php b/tests/indent/issue-227.php similarity index 77% rename from tests/issue-227.php rename to tests/indent/issue-227.php index daf9200f..6f3c83f8 100644 --- a/tests/issue-227.php +++ b/tests/indent/issue-227.php @@ -8,5 +8,5 @@ function my_func() { return "a really long string with = inside " . -"some more text"; // ###php-mode-test### ((indent 49)) +"some more text"; // ###php-mode-test### ((indent 8)) } diff --git a/tests/indent/issue-774.php b/tests/indent/issue-774.php new file mode 100644 index 00000000..118cfc06 --- /dev/null +++ b/tests/indent/issue-774.php @@ -0,0 +1,11 @@ +someFunction("some", "parameter") // ###php-mode-test### ((indent 0)) + ->someOtherFunc(23, 42) // ###php-mode-test### ((indent 4)) + ->andAThirdFunction(); // ###php-mode-test### ((indent 4)) + +$result = DateTime::createFromFormat('Y-m-d', '2112-09-03') // ###php-mode-test### ((indent 0)) + ->someFunction(); // ###php-mode-test### ((indent 4)) + +$pages = $dbOld->createQueryBuilder() // ###php-mode-test### ((indent 0)) + ->select('*'); // ###php-mode-test### ((indent 4)) diff --git a/tests/issue-136.php.faces b/tests/issue-136.php.faces index 538cdd97..0e5d6b71 100644 --- a/tests/issue-136.php.faces +++ b/tests/issue-136.php.faces @@ -103,8 +103,8 @@ ("$" . php-variable-sigil) ("name" . php-variable-name) (")\n {\n ") - ("$" . php-$this-sigil) - ("this" . php-$this) + ("$" . php-this-sigil) + ("this" . php-this) ("->" . php-object-op) ("name" . php-property-name) (" = ") diff --git a/tests/issue-197.php.faces b/tests/issue-197.php.faces index 94f2abef..85469d9d 100644 --- a/tests/issue-197.php.faces +++ b/tests/issue-197.php.faces @@ -21,10 +21,10 @@ ("$" . php-variable-sigil) ("test" . php-variable-name) ("->" . php-object-op) - ("int" . php-method-call) + ("int" . php-method-call-traditional) ("();\n") ("$" . php-variable-sigil) ("test" . php-variable-name) ("->" . php-object-op) - ("string" . php-method-call) + ("string" . php-method-call-traditional) ("();\n")) diff --git a/tests/issue-201.php.faces b/tests/issue-201.php.faces index 7cd5f111..5c3ccda8 100644 --- a/tests/issue-201.php.faces +++ b/tests/issue-201.php.faces @@ -8,21 +8,21 @@ ("\n\n") ("// " . font-lock-comment-delimiter-face) ("Start:\n" . font-lock-comment-face) - ("$" . php-$this-sigil) - ("this" . php-$this) + ("$" . php-this-sigil) + ("this" . php-this) (";\n") ("$" . php-variable-sigil) ("that" . php-variable-name) (";\n") ("self" . php-keyword) ("::" . php-paamayim-nekudotayim) - ("test" . php-static-method-call) + ("test" . php-static-method-call-traditional) ("();\n") ("static" . php-keyword) ("::" . php-paamayim-nekudotayim) - ("test" . php-static-method-call) + ("test" . php-static-method-call-traditional) ("();\n") ("parent" . php-keyword) ("::" . php-paamayim-nekudotayim) - ("test" . php-static-method-call) + ("test" . php-static-method-call-traditional) ("();\n")) diff --git a/tests/issue-439.php.faces b/tests/issue-439.php.faces index 595bcbab..bc3094e6 100644 --- a/tests/issue-439.php.faces +++ b/tests/issue-439.php.faces @@ -52,7 +52,7 @@ (" ") ("<<<\"いろは\"\nLet'go Justin\nいろは" . php-string) (";\n\n") - ("var_dump" . php-function-call) + ("var_dump" . php-function-call-traditional) ("(") ("<<<\"ABC\"\nLet'go Justin\nABC" . php-string) (");\n\n") @@ -60,7 +60,7 @@ (" (1 ") ("===" . php-comparison-op) (" 1) {\n ") - ("var_dump" . php-function-call) + ("var_dump" . php-function-call-traditional) ("(") ("<<<\"ABC\"\n Let'go Justin\n ABC" . php-string) (");\n}\n")) diff --git a/tests/lang/class/anonymous-class.php.faces b/tests/lang/class/anonymous-class.php.faces index 415bcaa2..bd0df9ce 100644 --- a/tests/lang/class/anonymous-class.php.faces +++ b/tests/lang/class/anonymous-class.php.faces @@ -17,7 +17,7 @@ ("// " . font-lock-comment-delimiter-face) ("###php-mode-test### ((indent 4))\n" . font-lock-comment-face) ("};\n\n") - ("is_object" . php-function-call) + ("is_object" . php-function-call-traditional) ("(1, ") ("new" . php-keyword) (" ") diff --git a/tests/lang/doc-comment/comments.php.24.faces b/tests/lang/doc-comment/comments.php.24.faces index 593bb49e..06f70485 100644 --- a/tests/lang/doc-comment/comments.php.24.faces +++ b/tests/lang/doc-comment/comments.php.24.faces @@ -105,8 +105,8 @@ ("$" . php-variable-sigil) ("name" . php-variable-name) (")\n {\n ") - ("$" . php-$this-sigil) - ("this" . php-$this) + ("$" . php-this-sigil) + ("this" . php-this) ("->" . php-object-op) ("name" . php-property-name) (" ") @@ -134,7 +134,7 @@ (" ") ("=" . php-assignment-op) (" ") - ("hoge" . php-function-call) + ("hoge" . php-function-call-traditional) ("();\n\n ") ("// " . font-lock-comment-delimiter-face) ("one-line comment\n" . font-lock-comment-face) diff --git a/tests/lang/doc-comment/comments.php.27.faces b/tests/lang/doc-comment/comments.php.27.faces index 8b3b78e5..70c23fb3 100644 --- a/tests/lang/doc-comment/comments.php.27.faces +++ b/tests/lang/doc-comment/comments.php.27.faces @@ -106,8 +106,8 @@ ("$" . php-variable-sigil) ("name" . php-variable-name) (")\n {\n ") - ("$" . php-$this-sigil) - ("this" . php-$this) + ("$" . php-this-sigil) + ("this" . php-this) ("->" . php-object-op) ("name" . php-property-name) (" ") @@ -135,7 +135,7 @@ (" ") ("=" . php-assignment-op) (" ") - ("hoge" . php-function-call) + ("hoge" . php-function-call-traditional) ("();\n\n ") ("// " . font-lock-comment-delimiter-face) ("one-line comment\n" . font-lock-comment-face) diff --git a/tests/lang/doc-comment/comments.php.faces b/tests/lang/doc-comment/comments.php.faces index 593bb49e..06f70485 100644 --- a/tests/lang/doc-comment/comments.php.faces +++ b/tests/lang/doc-comment/comments.php.faces @@ -105,8 +105,8 @@ ("$" . php-variable-sigil) ("name" . php-variable-name) (")\n {\n ") - ("$" . php-$this-sigil) - ("this" . php-$this) + ("$" . php-this-sigil) + ("this" . php-this) ("->" . php-object-op) ("name" . php-property-name) (" ") @@ -134,7 +134,7 @@ (" ") ("=" . php-assignment-op) (" ") - ("hoge" . php-function-call) + ("hoge" . php-function-call-traditional) ("();\n\n ") ("// " . font-lock-comment-delimiter-face) ("one-line comment\n" . font-lock-comment-face) diff --git a/tests/lang/function/calls.php.faces b/tests/lang/function/calls.php.faces index 19d681c5..7713374a 100644 --- a/tests/lang/function/calls.php.faces +++ b/tests/lang/function/calls.php.faces @@ -9,73 +9,73 @@ ("foo" . php-variable-name) (")) {\n 1") ("+" . php-arithmetic-op) - ("bar" . php-function-call) + ("bar" . php-function-call-traditional) ("()+") - ("foo" . php-function-call) + ("foo" . php-function-call-traditional) ("();\n}\n\n") ("$" . php-variable-sigil) ("foo" . php-variable-name) ("->" . php-object-op) - ("string" . php-method-call) + ("string" . php-method-call-traditional) ("();\n") ("$" . php-variable-sigil) ("foo" . php-variable-name) ("->" . php-object-op) - ("isset" . php-method-call) + ("isset" . php-method-call-traditional) ("();\n\n\n") ("$" . php-variable-sigil) ("a" . php-variable-name) ("->" . php-object-op) - ("b" . php-method-call) + ("b" . php-method-call-traditional) ("();\n") ("$" . php-variable-sigil) ("a" . php-variable-name) (" ") ("=" . php-assignment-op) (" ") - ("a" . php-function-call) + ("a" . php-function-call-traditional) ("();\n") ("$" . php-variable-sigil) ("aaa" . php-variable-name) (" ") ("=" . php-assignment-op) (" ") - ("aaa" . php-function-call) + ("aaa" . php-function-call-traditional) ("();\n") ("$" . php-variable-sigil) ("_aa" . php-variable-name) (" ") ("=" . php-assignment-op) (" ") - ("_aa" . php-function-call) + ("_aa" . php-function-call-traditional) ("();\n") ("$" . php-variable-sigil) ("a_a" . php-variable-name) (" ") ("=" . php-assignment-op) (" ") - ("a_a" . php-function-call) + ("a_a" . php-function-call-traditional) ("();\n") ("$" . php-variable-sigil) ("aa_" . php-variable-name) (" ") ("=" . php-assignment-op) (" ") - ("aa_" . php-function-call) + ("aa_" . php-function-call-traditional) ("();\n") ("$" . php-variable-sigil) ("a1c" . php-variable-name) (" ") ("=" . php-assignment-op) (" ") - ("a1c" . php-function-call) + ("a1c" . php-function-call-traditional) ("();\n") ("$" . php-variable-sigil) ("あ" . php-variable-name) (" ") ("=" . php-assignment-op) (" ") - ("あ" . php-function-call) + ("あ" . php-function-call-traditional) ("();\n") ("$" . php-variable-sigil) ("_a" . php-variable-name) diff --git a/tests/lang/function/closure.php.faces b/tests/lang/function/closure.php.faces index 1d671f72..9bf83b50 100644 --- a/tests/lang/function/closure.php.faces +++ b/tests/lang/function/closure.php.faces @@ -1,7 +1,7 @@ ;; -*- mode: emacs-lisp -*- (("" . php-object-op) - ("funCall" . php-method-call) + ("funCall" . php-method-call-traditional) ("();\n"))