diff options
Diffstat (limited to 'oni-php')
| -rw-r--r-- | oni-php/oni-php.el | 11 | ||||
| -rw-r--r-- | oni-php/snippets/php-mode/arrow-function | 1 | ||||
| -rw-r--r-- | oni-php/snippets/php-mode/function-expression | 1 | ||||
| -rw-r--r-- | oni-php/snippets/php-mode/function-statement | 1 |
4 files changed, 13 insertions, 1 deletions
diff --git a/oni-php/oni-php.el b/oni-php/oni-php.el index e631d72..88af7af 100644 --- a/oni-php/oni-php.el +++ b/oni-php/oni-php.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse <tom@ryuslash.org> ;; Keywords: local -;; Version: 2025.1222.143742 +;; Version: 2026.0107.143829 ;; Package-Requires: (php-mode oni-yasnippet oni-flycheck oni-company oni-hydra oni-smartparens ggtags fic-mode company-php rainbow-delimiters rainbow-identifiers) ;; This program is free software; you can redistribute it and/or modify @@ -239,5 +239,14 @@ Otherwise call FUNC with ARGS. This is meant as advice around "}" > "\n" "}"))) +(defun oni-php-in-expression-context-p () + (not (oni-php-in-static-call-context-p))) + +(defun oni-php-in-test-file () + (string-suffix-p "Test.php" buffer-file-name)) + +(defun oni-php-in-static-call-context-p () + (looking-back "::\\w+" (- (point) (line-beginning-position)))) + (provide 'oni-php) ;;; oni-php.el ends here diff --git a/oni-php/snippets/php-mode/arrow-function b/oni-php/snippets/php-mode/arrow-function index 53e0525..3b44e01 100644 --- a/oni-php/snippets/php-mode/arrow-function +++ b/oni-php/snippets/php-mode/arrow-function @@ -1,5 +1,6 @@ # -*- mode: snippet -*- # name: arrow-function # key: f +# condition: (oni-php-in-expression-context-p) # -- fn($1): $2 => $3
\ No newline at end of file diff --git a/oni-php/snippets/php-mode/function-expression b/oni-php/snippets/php-mode/function-expression index 5628e8e..fa59b03 100644 --- a/oni-php/snippets/php-mode/function-expression +++ b/oni-php/snippets/php-mode/function-expression @@ -1,6 +1,7 @@ # -*- mode: snippet -*- # name: function expression # key: f +# condition: (oni-php-in-expression-context-p) # -- function ($1) ${2:use ($3)} { $0 diff --git a/oni-php/snippets/php-mode/function-statement b/oni-php/snippets/php-mode/function-statement index 6a1cbe6..9c44aef 100644 --- a/oni-php/snippets/php-mode/function-statement +++ b/oni-php/snippets/php-mode/function-statement @@ -1,6 +1,7 @@ # -*- mode: snippet -*- # name: function statement # key: f +# condition: (oni-php-in-expression-context-p) # -- /** * $5 |
