@@ -160,7 +160,7 @@ it is the character that will terminate the string, or t if the string should be
160
160
(symbol-value 'poly-php-html-mode )))
161
161
162
162
(defconst php-beginning-of-defun-regexp
163
- " ^\\ s-*\\ (?:\\ (?:abstract\\ |final\\ |private\\ |protected\\ |public\\ |static\\ )\\ s-+\\ )*function\\ s-+&?\\ (\\ (?: \\ sw\\ |\\ s_\\ )+\\ )\\ s-*("
163
+ " ^\\ s-*\\ (?:\\ (?:abstract\\ |final\\ |private\\ |protected\\ |public\\ |static\\ )\\ s-+\\ )*function\\ s-+&?\\ (\\ (\\ sw\\ |\\ s_\\ )+\\ )\\ s-*("
164
164
" Regular expression for a PHP function." )
165
165
166
166
(eval-when-compile
@@ -175,6 +175,8 @@ The regular expression this function returns will check for other
175
175
keywords that can appear in method signatures, e.g. 'final' and
176
176
'static'. The regular expression will have one capture group
177
177
which will be the name of the method."
178
+ (when (stringp visibility)
179
+ (setq visibility (list visibility)))
178
180
(rx-form `(: line-start
179
181
(* (syntax whitespace))
180
182
,@(if visibility
@@ -185,10 +187,11 @@ which will be the name of the method."
185
187
(* (or " abstract" " final" " static" )
186
188
(+ (syntax whitespace))))
187
189
'((* (* (or " abstract" " final" " static"
188
- " private" " protected" " public" ))
189
- (+ (syntax whitespace)))))
190
+ " private" " protected" " public" )
191
+ (+ (syntax whitespace) )))))
190
192
" function"
191
193
(+ (syntax whitespace))
194
+ (? " &" (* (syntax whitespace)))
192
195
(group (+ (or (syntax word) (syntax symbol))))
193
196
(* (syntax whitespace))
194
197
" (" )))
@@ -244,8 +247,9 @@ can be used to match against definitions for that classlike."
244
247
(defun php-get-current-element (re-pattern )
245
248
" Return backward matched element by RE-PATTERN."
246
249
(save-excursion
247
- (when (re-search-backward re-pattern nil t )
248
- (match-string-no-properties 1 ))))
250
+ (save-match-data
251
+ (when (re-search-backward re-pattern nil t )
252
+ (match-string-no-properties 1 )))))
249
253
250
254
; ;; Provide support for Flymake so that users can see warnings and
251
255
; ;; errors in real-time as they write code.
@@ -349,6 +353,17 @@ Look at the `php-executable' variable instead of the constant \"php\" command."
349
353
(when matched
350
354
(insert (concat matched php-namespace-suffix-when-insert)))))
351
355
356
+ ;;;### autoload
357
+ (defun php-copyit-fqsen ()
358
+ " Copy/kill class/method FQSEN."
359
+ (interactive )
360
+ (let ((namespace (or (php-get-current-element php--re-namespace-pattern) " " ))
361
+ (class (or (php-get-current-element php--re-classlike-pattern) " " ))
362
+ (namedfunc (php-get-current-element php-beginning-of-defun-regexp)))
363
+ (kill-new (concat (if (string= namespace " " ) " " namespace)
364
+ (if (string= class " " ) " " (concat " \\ " class " ::" ))
365
+ (if (string= namedfunc " " ) " " (concat namedfunc " ()" ))))))
366
+
352
367
;;;### autoload
353
368
(defun php-run-builtin-web-server (router-or-dir hostname port &optional document-root )
354
369
" Run PHP Built-in web server.
0 commit comments