Skip to content

Commit 0bbe50e

Browse files
authored
Merge branch 'master' into font-locking-fixes
2 parents 7e4ba4e + ff86ba6 commit 0bbe50e

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/.cask/
2+
/php-mode-autoloads.el
23
*~
34
*.elc

php-mode-test.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,8 @@ style from Drupal."
757757
(get-text-property (point) 'face)))))
758758
;; Type situations
759759
(let ((variables '("(array)"
760-
"array $test"
760+
"array $byValue"
761+
"array &$byReference"
761762
": array")))
762763
(dolist (variable variables)
763764
(search-forward variable)

php-mode.el

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
(defconst php-mode-version-number "1.18.4"
1616
"PHP Mode version number.")
1717

18-
(defconst php-mode-modified "2018-01-23"
18+
(defconst php-mode-modified "2018-01-29"
1919
"PHP Mode build date.")
2020

2121
;; This file is free software; you can redistribute it and/or
@@ -81,8 +81,11 @@
8181
(require 'flymake)
8282
(require 'etags)
8383
(require 'speedbar)
84+
(require 'imenu)
85+
(require 'semantic/imenu)
8486

8587
(require 'cl-lib)
88+
(require 'mode-local)
8689

8790
(eval-when-compile
8891
(require 'regexp-opt)
@@ -259,6 +262,16 @@ can be used to match against definitions for that classlike."
259262
"^\\s-*function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1))
260263
"Imenu generic expression for PHP Mode. See `imenu-generic-expression'.")
261264

265+
(defcustom php-do-not-use-semantic-imenu nil
266+
"Customize `imenu-create-index-function' for `php-mode'.
267+
268+
If using `semantic-mode' `imenu-create-index-function' will be
269+
set to `semantic-create-imenu-index' due to `c-mode' being its
270+
parent. Set this variable to t if you want to use
271+
`imenu-default-create-index-function' even with `semantic-mode'
272+
enabled."
273+
:type 'boolean)
274+
262275
(defcustom php-site-url "http://php.net/"
263276
"Default PHP.net site URL.
264277
@@ -1218,6 +1231,12 @@ After setting the stylevars run hooks according to STYLENAME
12181231
(save-excursion
12191232
(php-syntax-propertize-function (point-min) (point-max))))))
12201233

1234+
(defvar-mode-local php-mode imenu-create-index-function
1235+
(if php-do-not-use-semantic-imenu
1236+
#'imenu-default-create-index-function
1237+
#'semantic-create-imenu-index)
1238+
"Imenu index function for PHP.")
1239+
12211240

12221241
;; Define function name completion function
12231242
(defvar php-completion-table nil
@@ -1542,7 +1561,7 @@ a completion list."
15421561
;; - when used as a type hint
15431562
;; - when used as a return type
15441563
("(\\(array\\))" 1 font-lock-type-face)
1545-
("\\b\\(array\\)\\s-+\\$" 1 font-lock-type-face)
1564+
("\\b\\(array\\)\\s-+&?\\$" 1 font-lock-type-face)
15461565
(")\\s-*:\\s-*\\??\\(array\\)\\b" 1 font-lock-type-face)
15471566

15481567
;; namespaces

tests/arrays.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
// - return type, should look like `: int`
1313
$test = (array)$test;
1414

15-
$test = function(array $test): array {
15+
$test = function(array $byValue, array &$byReference): array {
1616
};

0 commit comments

Comments
 (0)