Skip to content

Commit b45992a

Browse files
authored
Merge pull request #800 from emacs-php/refactor/when-let
Use `when-let*` instead of `let` and `when`
2 parents 878e313 + 6af84c2 commit b45992a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Diff for: lisp/php.el

+4-6
Original file line numberDiff line numberDiff line change
@@ -664,17 +664,15 @@ Currently there are `php-mode' and `php-ts-mode'."
664664
(defun php-current-class ()
665665
"Insert current class name if cursor in class context."
666666
(interactive)
667-
(let ((matched (php-get-current-element php--re-classlike-pattern)))
668-
(when matched
669-
(insert (concat matched php-class-suffix-when-insert)))))
667+
(when-let* ((matched (php-get-current-element php--re-classlike-pattern)))
668+
(insert (concat matched php-class-suffix-when-insert))))
670669

671670
;;;###autoload
672671
(defun php-current-namespace ()
673672
"Insert current namespace if cursor in namespace context."
674673
(interactive)
675-
(let ((matched (php-get-current-element php--re-namespace-pattern)))
676-
(when matched
677-
(insert (concat matched php-namespace-suffix-when-insert)))))
674+
(when-let* ((matched (php-get-current-element php--re-namespace-pattern)))
675+
(insert (concat matched php-namespace-suffix-when-insert))))
678676

679677
;;;###autoload
680678
(defun php-copyit-fqsen ()

0 commit comments

Comments
 (0)