aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha/snips/ft/php.lua
diff options
context:
space:
mode:
authorAriel D'Alessandro <dalessandro.ariel@gmail.com>2022-02-13 21:07:49 +0100
committerAriel D'Alessandro <dalessandro.ariel@gmail.com>2022-02-13 21:07:49 +0100
commit09f8ad69981a66c211dc11819094760d6df8b80c (patch)
tree963057b0a8039157027226e447437309d807a96f /lua/alpha/snips/ft/php.lua
parenta9430e56a302a66d57fa3f7af80a74e6d037bd2c (diff)
downloadnvim-conf-09f8ad69981a66c211dc11819094760d6df8b80c.tar.gz
nvim-conf-09f8ad69981a66c211dc11819094760d6df8b80c.zip
add env variable for laravel, add snippet for strict type
Diffstat (limited to 'lua/alpha/snips/ft/php.lua')
-rw-r--r--lua/alpha/snips/ft/php.lua37
1 files changed, 34 insertions, 3 deletions
diff --git a/lua/alpha/snips/ft/php.lua b/lua/alpha/snips/ft/php.lua
index c2210a9..4e2506f 100644
--- a/lua/alpha/snips/ft/php.lua
+++ b/lua/alpha/snips/ft/php.lua
@@ -39,11 +39,16 @@ local promoted_property
promoted_property = function()
return snippet_from_nodes(nil, {
c(1, {
- t(""),
+ t "",
snippet_from_nodes(nil, {
newline "\t",
d(1, visibility, {}, "private"),
- i(2, '$var'),
+ t " ",
+ i(2, 'Type'),
+ t " $",
+ f( function (args)
+ return args[1][1]:gsub("^%u", string.lower)
+ end, {2}),
t ",",
d(3, promoted_property, {})
}),
@@ -84,7 +89,7 @@ local M = {
{} ${};
]], {
i(1, "type"),
- d(2, visibility, { 1 }, "private"),
+ d(2, visibility, {}, "private"),
i(3, "var")
}),
class = fmt(
@@ -105,6 +110,32 @@ class []
f(class_name),
i(0),
}, { delimiters = "[]"}),
+
+ _c = {
+ d(1, visibility, {}, "public"),
+ t(' function __construct('),
+ i(2, ''),
+ t {")", "{", "\t"},
+ i(0),
+ newline "}"
+ },
+
+ _p = {
+ d(1, visibility, {}, "public"),
+ t " function __construct(",
+ d(2, promoted_property),
+ t {"", ") {", "}"},
+ },
+
+ pro = {
+ d(1, visibility, {}, "private"),
+ t " ",
+ i(2, "type"),
+ t " $",
+ i(3),
+ },
+
+ strict = t "declare(strict_types=1);",
}
return M