aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorAriel D'Alessandro <ariel.dalessandro@auto1.com>2022-09-09 17:46:53 +0200
committerAriel D'Alessandro <ariel.dalessandro@auto1.com>2022-09-09 17:46:53 +0200
commit90490a7beb094c64e1177ca6314cf17115b7efc4 (patch)
treeb6a8bec1eb960ed8812ebb03f4bbf6f0cfe9850d /lua
parent118e3f5a2a1f6792d60c5474ed7c829598690b6d (diff)
downloadnvim-conf-90490a7beb094c64e1177ca6314cf17115b7efc4.tar.gz
nvim-conf-90490a7beb094c64e1177ca6314cf17115b7efc4.zip
small refactor
Diffstat (limited to 'lua')
-rw-r--r--lua/alpha/snips/ft/php.lua126
1 files changed, 63 insertions, 63 deletions
diff --git a/lua/alpha/snips/ft/php.lua b/lua/alpha/snips/ft/php.lua
index dbd872e..70cf49b 100644
--- a/lua/alpha/snips/ft/php.lua
+++ b/lua/alpha/snips/ft/php.lua
@@ -34,7 +34,7 @@ end
local namespace = function()
local dir = vim.fn.expand("%:h")
- local autoloads = composer.query({"autoload", "psr-4"})
+ local autoloads = composer.query({ "autoload", "psr-4" })
if autoloads == nil then
return (dir:gsub("^%l", string.upper))
end
@@ -56,22 +56,23 @@ local class_name = function()
return vim.fn.expand("%:t:r")
end
-local M = {
- v = fmt(
- [[
+local M = {}
+
+M.v = fmt(
+ [[
/**
* @var {}
*/
{} ${};
]],
- {
- i(1, "type"),
- visibility(2, "private"),
- i(3, "var"),
- }
- ),
- class = fmt(
- [[
+ {
+ i(1, "type"),
+ visibility(2, "private"),
+ i(3, "var"),
+ }
+)
+M.class = fmt(
+ [[
<?php
declare(strict_types=1);
@@ -83,64 +84,63 @@ class {}
{}
}}
]],
- {
- f(namespace),
- f(class_name),
- i(0),
- }
- ),
-
- pro = fmt([[{} {} ${},]], {
- visibility(1, "private"),
- i(2, "Type"),
- f(function(args)
- return args[1][1]:gsub("^%u", string.lower)
- end, { 2 }),
- }),
-
- _c = fmt(
-[[{} function __construct({}) {{
+ {
+ f(namespace),
+ f(class_name),
+ i(0),
+ }
+)
+
+M.pro = fmt([[{} {} ${},]], {
+ visibility(1, "private"),
+ i(2, "Type"),
+ f(function(args)
+ return args[1][1]:gsub("^%u", string.lower)
+ end, { 2 }),
+})
+
+M._c = fmt(
+ [[{} function __construct({}) {{
{}
}}]],
- {
- visibility(1, "public"),
- i(2),
- i(0),
- }
- ),
-
- _p = fmt(
- [[{} function __construct(
+ {
+ visibility(1, "public"),
+ i(2),
+ i(0),
+ }
+)
+
+M._p = fmt(
+ [[{} function __construct(
{}
) {{
}}]],
- {
- visibility(1, "public"),
- i(2),
- }
- ),
-
- fn = {
+ {
visibility(1, "public"),
- t(" function "),
- i(2, "name"),
- t("("),
- i(3, "$arg"),
- t(")"),
- c(4, {
- t(""),
- snippet_from_nodes(nil, {
- t(": "),
- i(1, "void"),
- }),
+ i(2),
+ }
+)
+
+M.strict = t("declare(strict_types=1);")
+
+M.fn = {
+ visibility(1, "public"),
+ t(" function "),
+ i(2, "name"),
+ t("("),
+ i(3, "$arg"),
+ t(")"),
+ c(4, {
+ t(""),
+ snippet_from_nodes(nil, {
+ t(": "),
+ i(1, "void"),
}),
- newline("{"),
- newline("\t"),
- i(0, ""),
- newline("}"),
- },
-
- strict = t("declare(strict_types=1);"),
+ }),
+ newline("{"),
+ newline("\t"),
+ i(0, ""),
+ newline("}"),
}
return M