1
0
Fork 0

Compare commits

...

8 commits

5 changed files with 37 additions and 9 deletions

View file

@ -4,8 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2025.0210.125238
;; Package-Requires: (php-mode oni-yasnippet oni-flycheck oni-company oni-hydra ggtags fic-mode company-php)
;; Version: 2025.0407.141956
;; Package-Requires: (php-mode oni-yasnippet oni-flycheck oni-company oni-hydra oni-smartparens ggtags fic-mode company-php rainbow-delimiters)
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@ -90,9 +90,10 @@ nil for some reason."
(forward-line)
(insert "\n"))
(let ((start (point)))
(insert "use " class ";\n")
(pulse-momentary-highlight-region start (point))))))
(unless (search-backward class nil t)
(let ((start (point)))
(insert "use " class ";\n")
(pulse-momentary-highlight-region start (point)))))))
(defun oni-php-insert-dot-dwim (N)
"Insert either a concatenation or access operator depending on context.
@ -126,9 +127,10 @@ Do the insert N times."
Otherwise call FUNC with ARGS. This is meant as advice around
comment-dwim to make it smarter for PHP code."
(if (and (derived-mode-p 'php-mode)
(looking-back (rx blank) (line-beginning-position))
(looking-back (rx (minimal-match (zero-or-more blank))) (line-beginning-position))
(looking-at (rx (minimal-match (zero-or-more (any whitespace "\n")))
(regexp php-beginning-of-defun-regexp))))
(or (regexp php-beginning-of-defun-regexp)
(regexp php--re-classlike-pattern)))))
(oni-php-doc-comment)
(apply func args)))
@ -142,13 +144,14 @@ Otherwise call FUNC with ARGS. This is meant as advice around
(add-hook 'php-mode-hook 'company-mode)
(add-hook 'php-mode-hook 'display-fill-column-indicator-mode)
(add-hook 'php-mode-hook 'electric-indent-local-mode)
(add-hook 'php-mode-hook 'electric-pair-local-mode)
(add-hook 'php-mode-hook 'fic-mode)
(add-hook 'php-mode-hook 'flycheck-mode)
(add-hook 'php-mode-hook 'ggtags-mode)
(add-hook 'php-mode-hook 'oni-php--auto-fill-mode)
(add-hook 'php-mode-hook 'yas-minor-mode)
(add-hook 'php-mode-hook 'rainbow-delimiters-mode)
(add-hook 'php-mode-hook 'smartparens-mode)
(add-hook 'php-mode-hook 'subword-mode)
(add-hook 'php-mode-hook 'yas-minor-mode)
(with-eval-after-load 'company
(add-to-list 'company-backends 'company-ac-php-backend))

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: arrow-function
# key: fn
# --
fn($1) => $0

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: casts
# key: casts
# --
protected $casts = [
'$1' => $0,
];

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: constructor
# key: constructor
# --
public function __construct($1)
{
$0
}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: strict-types
# key: strict-types
# --
declare(strict_types=1);