Skip to content

php-mode: improve existent snippets and add a few more #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions php-mode/abstract-class
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: snippet -*-
# name: abstract class
# key: acl
# uuid: acl
# key: ab
# uuid: ab
# --
abstract class ${1:Name}${2: extends ${3:Parent}}
{
Expand Down
4 changes: 2 additions & 2 deletions php-mode/array
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- mode: snippet -*-
# name: array(...)
# key: arr
# uuid: arr
# key: ar
# uuid: ar
# --
array(`%`$0)
4 changes: 2 additions & 2 deletions php-mode/assignment
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- mode: snippet -*-
# name: $var = value;
# key: =
# uuid: =
# key: va
# uuid: va
# --
\$${1:var_name} = `%`$0;
9 changes: 9 additions & 0 deletions php-mode/class-final
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: PHP class
# key: clf
# uuid: clf
# --
final class ${1:Name}${2: extends ${3:Parent}}
{
`%`$0
}
9 changes: 9 additions & 0 deletions php-mode/constructor
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: class construct
# key: ct
# uuid: ct
# --
${1:public} function __construct(\$${1:property})
{
`%`$0
}
8 changes: 8 additions & 0 deletions php-mode/do-while
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: do while loop
# key: do
# uuid: do
# --
do {
$0
} while (${1:condition});
4 changes: 2 additions & 2 deletions php-mode/echo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- mode: snippet -*-
# name: echo ...;
# key: e
# uuid: e
# key: ec
# uuid: ec
# --
echo `%`$0;
4 changes: 2 additions & 2 deletions php-mode/elseif
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: snippet -*-
# name: elseif (...) { ... }
# key: eli
# uuid: eli
# key: ei
# uuid: ei
# --
elseif ($1) {
`%`$0
Expand Down
9 changes: 9 additions & 0 deletions php-mode/enumeration
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: enumeration
# key: enu
# uuid: enu
# --
enum ${1:Name}
{
case ${2:name};$0
}
File renamed without changes.
8 changes: 8 additions & 0 deletions php-mode/function-anonymous
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: anonymous function
# key: fuan
# uuid: fuan
# --
function ($${2:variable}) {
$0;
}
6 changes: 6 additions & 0 deletions php-mode/function-arrow
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: arrow function
# key: fuar
# uuid: fuar
# --
fn(\$${1:variable}) => $0;
8 changes: 8 additions & 0 deletions php-mode/match
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: match expression
# key: match
# uuid: match
# --
match (\$${1:subject_expression}) {
${2:conditional_expression} => ${3:return_expression},
};
2 changes: 1 addition & 1 deletion php-mode/method
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# key: met
# uuid: met
# --
${1:public} function ${2:name}($3)
${1:public} function ${2:name}($3)${4::} ${5:type}
{
`%`$0
}
6 changes: 6 additions & 0 deletions php-mode/namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: namespace
# key: name
# uuid: name
# --
namespace ${1:name};
6 changes: 0 additions & 6 deletions php-mode/object-accessor

This file was deleted.

6 changes: 6 additions & 0 deletions php-mode/object-property
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: $object->prop
# key: op
# uuid: op
# --
\$${1:object}->${2:property};
2 changes: 1 addition & 1 deletion php-mode/php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# key: php
# uuid: php
# --
<?php $0 ?>
<?php ${1:declare(strict_types=1);} ${0:?>}
6 changes: 3 additions & 3 deletions php-mode/phpdoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: snippet -*-
# name: /** ... */
# key: /**
# uuid: /**
# name: docblock summary
# key: doc
# uuid: doc
# --
/**
* ${0:`(if % (s-replace "\n" "\n * " %))`}
Expand Down
8 changes: 8 additions & 0 deletions php-mode/phpdoc-tag
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: docblock tag
# key: dot
# uuid: dot
# --
/**
* @${1:tag} ${2:type} ${0:optional}
*/
4 changes: 2 additions & 2 deletions php-mode/shebang
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- mode: snippet -*-
# name: #!/usr/bin/env php
# name: php shebang
# key: #!
# uuid: #!
# --
#!/usr/bin/env php
<?php
<?php ${1:declare(strict_types=1);}

$0
10 changes: 8 additions & 2 deletions php-mode/switch
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# -*- mode: snippet -*-
# name: switch (...) {...}
# key: switch
# uuid: switch
# --
switch (${on}) {
$0
switch (\$${1:expression}) {
case ${2:condition}:
${3:statement}
break;
default:
$0
}
6 changes: 6 additions & 0 deletions php-mode/ternary
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: ternary
# key: te
# uuid: te
# --
${1:condition} ? ${2:truthy} : ${0:falsy};
2 changes: 1 addition & 1 deletion php-mode/this
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# key: thi
# uuid: thi
# --
\$this->$0
\$this->$0;
10 changes: 10 additions & 0 deletions php-mode/try-catch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: try-catch
# key: try
# uuid: try
# --
try {
${1:statement}
} catch (${2:Exception} \$${3:variable}) {
$0
}
6 changes: 6 additions & 0 deletions php-mode/variable
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: variable
# key: va
# uuid: va
# --
\$${1:name} = ${value};
2 changes: 2 additions & 0 deletions php-mode/while
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- mode: snippet -*-
# name: while loop
# key: whi
# uuid: whi
# --
while (${1:condition}) {
`%`$0
Expand Down