Skip to content

Commit

Permalink
Use when-let* instead of let and when
Browse files Browse the repository at this point in the history
  • Loading branch information
zonuexe committed Dec 22, 2024
1 parent 878e313 commit 6af84c2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lisp/php.el
Original file line number Diff line number Diff line change
Expand Up @@ -664,17 +664,15 @@ Currently there are `php-mode' and `php-ts-mode'."
(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 ()
Expand Down

0 comments on commit 6af84c2

Please sign in to comment.