Skip to content

Commit

Permalink
Merge pull request #800 from emacs-php/refactor/when-let
Browse files Browse the repository at this point in the history
Use `when-let*` instead of `let` and `when`
  • Loading branch information
zonuexe authored Jan 3, 2025
2 parents 878e313 + 6af84c2 commit b45992a
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 b45992a

Please sign in to comment.