Skip to content

Commit 869175b

Browse files
easbarbahlissner
authored andcommitted
snippet(php): add snippets
Close: #97
1 parent 3186b70 commit 869175b

14 files changed

+107
-0
lines changed

php-mode/class-final

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -*- mode: snippet -*-
2+
# name: PHP class
3+
# key: clf
4+
# uuid: clf
5+
# --
6+
final class ${1:Name}${2: extends ${3:Parent}}
7+
{
8+
`%`$0
9+
}

php-mode/constructor

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -*- mode: snippet -*-
2+
# name: class construct
3+
# key: ct
4+
# uuid: ct
5+
# --
6+
${1:public} function __construct(\$${1:property})
7+
{
8+
`%`$0
9+
}

php-mode/do-while

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- mode: snippet -*-
2+
# name: do while loop
3+
# key: do
4+
# uuid: do
5+
# --
6+
do {
7+
$0
8+
} while (${1:condition});

php-mode/enumeration

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -*- mode: snippet -*-
2+
# name: enumeration
3+
# key: enu
4+
# uuid: enu
5+
# --
6+
enum ${1:Name}
7+
{
8+
case ${2:name};$0
9+
}

php-mode/for-classic

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- mode: snippet -*-
2+
# name: for loop w/ $i
3+
# key: fori
4+
# uuid: fori
5+
# --
6+
for (\$i = ${1:0}; \$i < ${2:10}; ++\$i) {
7+
`%`$0
8+
}

php-mode/function-anonymous

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- mode: snippet -*-
2+
# name: anonymous function
3+
# key: fuan
4+
# uuid: fuan
5+
# --
6+
function ($${2:variable}) {
7+
$0;
8+
}

php-mode/function-arrow

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -*- mode: snippet -*-
2+
# name: arrow function
3+
# key: fuar
4+
# uuid: fuar
5+
# --
6+
fn(\$${1:variable}) => $0;

php-mode/match

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- mode: snippet -*-
2+
# name: match expression
3+
# key: match
4+
# uuid: match
5+
# --
6+
match (\$${1:subject_expression}) {
7+
${2:conditional_expression} => ${3:return_expression},
8+
};

php-mode/namespace

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -*- mode: snippet -*-
2+
# name: namespace
3+
# key: name
4+
# uuid: name
5+
# --
6+
namespace ${1:name};

php-mode/object-property

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -*- mode: snippet -*-
2+
# name: $object->prop
3+
# key: op
4+
# uuid: op
5+
# --
6+
\$${1:object}->${2:property};

php-mode/phpdoc-tag

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- mode: snippet -*-
2+
# name: docblock tag
3+
# key: dot
4+
# uuid: dot
5+
# --
6+
/**
7+
* @${1:tag} ${2:type} ${0:optional}
8+
*/

php-mode/ternary

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -*- mode: snippet -*-
2+
# name: ternary
3+
# key: te
4+
# uuid: te
5+
# --
6+
${1:condition} ? ${2:truthy} : ${0:falsy};

php-mode/try-catch

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# -*- mode: snippet -*-
2+
# name: try-catch
3+
# key: try
4+
# uuid: try
5+
# --
6+
try {
7+
${1:statement}
8+
} catch (${2:Exception} \$${3:variable}) {
9+
$0
10+
}

php-mode/variable

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -*- mode: snippet -*-
2+
# name: variable
3+
# key: va
4+
# uuid: va
5+
# --
6+
\$${1:name} = ${value};

0 commit comments

Comments
 (0)