Merge branch 'main' of labs.scarif.space:chris/nvim
This commit is contained in:
@@ -16,6 +16,7 @@ local fmta = extend_decorator.apply(fmt, { delimiters = '#~' })
|
||||
local utils = require 'snippets.snip_utils'
|
||||
local tr = utils.tr
|
||||
local etr = utils.etr
|
||||
local Etr = utils.Etr
|
||||
local atr = utils.atr
|
||||
local ctr = utils.ctr
|
||||
local bs = utils.bs
|
||||
@@ -69,10 +70,10 @@ return {
|
||||
---------------
|
||||
-- DEBUGGING --
|
||||
---------------
|
||||
s(etr('du ', 'Dump a variable to the dump server'), fmta('dump(#~);', { i(0) })),
|
||||
bs(atr('du ', 'Dump a variable to the dump server'), fmta('dump(#~)', { i(0) })),
|
||||
s(etr('r ', 'ray'), fmta('ray(#~);', { i(0) })),
|
||||
bs(atr('r ', 'ray'), fmta('ray(#~)', { i(0) })),
|
||||
s(etr('du ', 'Dump a variable to the dump server', { priority = 1001 }), fmta('dump(#~);', { i(0) })),
|
||||
bs(etr('du ', 'Dump a variable to the dump server'), fmta('dump(#~)', { i(0) })),
|
||||
s(etr('r ', 'ray', { priority = 1001 }), fmta('ray(#~);', { i(0) })),
|
||||
bs(etr('r ', 'ray'), fmta('ray(#~)', { i(0) })),
|
||||
s(etr('dt ', 'Dump PHPStan type definition'), fmta('\\PhpStan\\dumpType(#~);', { i(0) })),
|
||||
s(
|
||||
etr('ql ', 'Log all queries'),
|
||||
@@ -107,6 +108,7 @@ return {
|
||||
}),
|
||||
s(etr('@v', '@var docblock'), fmta('/** @var #~ $#~ */', { i(1), i(0) })),
|
||||
s(ctr('@v', '@var docblock'), fmta('@var #~ $#~', { i(1), i(0) })),
|
||||
s(Etr('@pi', '@phpstan-ignore'), fmta('// @phpstan-ignore #~ (#~)', { i(1), i(0) })),
|
||||
s(ctr('* @pr', 'Class property docblock'), fmta('* @property #~ $#~', { i(1), i(0) })),
|
||||
s(ctr('* @pb', 'Class boolean property docblock'), fmta('* @property bool $#~', { i(0) })),
|
||||
s(ctr('* @pi', 'Class int property docblock'), fmta('* @property int $#~', { i(0) })),
|
||||
@@ -212,36 +214,36 @@ return {
|
||||
),
|
||||
}),
|
||||
}),
|
||||
s(
|
||||
etr('con', 'Constructor function block'),
|
||||
c(1, {
|
||||
sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
public function __construct(#~)
|
||||
{
|
||||
#~
|
||||
}
|
||||
]],
|
||||
{ i(1), i(2) }
|
||||
)
|
||||
),
|
||||
sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
public function __construct(
|
||||
#~
|
||||
) {
|
||||
#~
|
||||
}
|
||||
]],
|
||||
{ i(1), i(2) }
|
||||
)
|
||||
),
|
||||
})
|
||||
),
|
||||
-- s(
|
||||
-- etr('con', 'Constructor function block'),
|
||||
-- c(1, {
|
||||
-- sn(
|
||||
-- nil,
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- public function __construct(#~)
|
||||
-- {
|
||||
-- #~
|
||||
-- }
|
||||
-- ]],
|
||||
-- { i(1), i(2) }
|
||||
-- )
|
||||
-- ),
|
||||
-- sn(
|
||||
-- nil,
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- public function __construct(
|
||||
-- #~
|
||||
-- ) {
|
||||
-- #~
|
||||
-- }
|
||||
-- ]],
|
||||
-- { i(1), i(2) }
|
||||
-- )
|
||||
-- ),
|
||||
-- })
|
||||
-- ),
|
||||
bs(atr('function', 'Shorthand function block'), fmta('fun', {})),
|
||||
bs(atr('s%$', 'string type parameter'), fmta('string $#~', { i(0, 'var') })),
|
||||
bs(atr('i%$', 'int type parameter'), fmta('int $#~', { i(0, 'var') })),
|
||||
@@ -358,9 +360,20 @@ return {
|
||||
etr('test', 'Create a test function'),
|
||||
fmta(
|
||||
[[
|
||||
test(#~ function () {
|
||||
test('#~', function () {
|
||||
#~
|
||||
})
|
||||
});
|
||||
]],
|
||||
{ i(1), i(0) }
|
||||
)
|
||||
),
|
||||
s(
|
||||
etr('it ', 'Create a test function'),
|
||||
fmta(
|
||||
[[
|
||||
it('#~', function () {
|
||||
#~
|
||||
});
|
||||
]],
|
||||
{ i(1), i(0) }
|
||||
)
|
||||
@@ -509,92 +522,92 @@ return {
|
||||
),
|
||||
})
|
||||
),
|
||||
s(
|
||||
atr('->wr', 'Eloquent where method'),
|
||||
c(1, {
|
||||
sn(nil, fmta("->where('#~', #~)", { i(1), i(2) })),
|
||||
sn(nil, fmta('->where(fn ($query) => #~)', { i(1) })),
|
||||
sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
->where(function ($query) {
|
||||
#~
|
||||
})
|
||||
]],
|
||||
{ i(1) }
|
||||
)
|
||||
),
|
||||
sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
->where(function ($query) use (#~) {
|
||||
#~
|
||||
})
|
||||
]],
|
||||
{ i(1), i(2) }
|
||||
)
|
||||
),
|
||||
})
|
||||
),
|
||||
s(atr('->wi', 'Eloquent where in method'), fmta("->whereIn('#~', #~)", { i(1), i(0) })),
|
||||
s(atr('->wn', 'Eloquent where not in method'), fmta("->whereNotIn('#~', #~)", { i(1), i(0) })),
|
||||
s(
|
||||
atr('->wha', 'Eloquent where has method'),
|
||||
c(1, {
|
||||
sn(nil, fmta("->whereHas('#~')", { i(1) })),
|
||||
sn(nil, fmta("->whereHas('#~', fn ($query) => #~)", { i(1), i(0) })),
|
||||
sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
->whereHas('#~', function ($query) {
|
||||
#~
|
||||
})
|
||||
]],
|
||||
{ i(1), i(1) }
|
||||
)
|
||||
),
|
||||
sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
->whereHas('#~', function ($query) use (#~) {
|
||||
#~
|
||||
})
|
||||
]],
|
||||
{ i(1), i(2), i(3) }
|
||||
)
|
||||
),
|
||||
})
|
||||
),
|
||||
s(
|
||||
atr('->we', 'Eloquent where exists method'),
|
||||
c(1, {
|
||||
sn(nil, fmta('->whereExists(fn ($query) => #~)', { i(0) })),
|
||||
sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
->whereExists(function ($query) {
|
||||
#~
|
||||
})
|
||||
]],
|
||||
{ i(1) }
|
||||
)
|
||||
),
|
||||
sn(
|
||||
nil,
|
||||
fmta(
|
||||
[[
|
||||
->whereExists(function ($query) use (#~) {
|
||||
#~
|
||||
})
|
||||
]],
|
||||
{ i(1), i(2) }
|
||||
)
|
||||
),
|
||||
})
|
||||
),
|
||||
-- s(
|
||||
-- atr('->wr', 'Eloquent where method'),
|
||||
-- c(0, {
|
||||
-- sn(nil, fmta("->where('#~', #~)", { i(1), i(0) })),
|
||||
-- sn(nil, fmta('->where(fn ($query) => #~)', { i(0) })),
|
||||
-- sn(
|
||||
-- nil,
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- ->where(function ($query) {
|
||||
-- #~
|
||||
-- })
|
||||
-- ]],
|
||||
-- { i(0) }
|
||||
-- )
|
||||
-- ),
|
||||
-- sn(
|
||||
-- nil,
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- ->where(function ($query) use (#~) {
|
||||
-- #~
|
||||
-- })
|
||||
-- ]],
|
||||
-- { i(1), i(0) }
|
||||
-- )
|
||||
-- ),
|
||||
-- })
|
||||
-- ),
|
||||
-- s(atr('->wi', 'Eloquent where in method'), fmta("->whereIn('#~', #~)", { i(1), i(0) })),
|
||||
-- s(atr('->wn', 'Eloquent where not in method'), fmta("->whereNotIn('#~', #~)", { i(1), i(0) })),
|
||||
-- s(
|
||||
-- atr('->wha', 'Eloquent where has method'),
|
||||
-- c(0, {
|
||||
-- sn(nil, fmta("->whereHas('#~')", { i(1) })),
|
||||
-- sn(nil, fmta("->whereHas('#~', fn ($query) => #~)", { i(1), i(0) })),
|
||||
-- sn(
|
||||
-- nil,
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- ->whereHas('#~', function ($query) {
|
||||
-- #~
|
||||
-- })
|
||||
-- ]],
|
||||
-- { i(1), i(0) }
|
||||
-- )
|
||||
-- ),
|
||||
-- sn(
|
||||
-- nil,
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- ->whereHas('#~', function ($query) use (#~) {
|
||||
-- #~
|
||||
-- })
|
||||
-- ]],
|
||||
-- { i(1), i(2), i(0) }
|
||||
-- )
|
||||
-- ),
|
||||
-- })
|
||||
-- ),
|
||||
-- s(
|
||||
-- atr('->we', 'Eloquent where exists method'),
|
||||
-- c(0, {
|
||||
-- sn(nil, fmta('->whereExists(fn ($query) => #~)', { i(0) })),
|
||||
-- sn(
|
||||
-- nil,
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- ->whereExists(function ($query) {
|
||||
-- #~
|
||||
-- })
|
||||
-- ]],
|
||||
-- { i(0) }
|
||||
-- )
|
||||
-- ),
|
||||
-- sn(
|
||||
-- nil,
|
||||
-- fmta(
|
||||
-- [[
|
||||
-- ->whereExists(function ($query) use (#~) {
|
||||
-- #~
|
||||
-- })
|
||||
-- ]],
|
||||
-- { i(1), i(0) }
|
||||
-- )
|
||||
-- ),
|
||||
-- })
|
||||
-- ),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user