Skip to content

Commit 2c7907e

Browse files
author
Gilberto Junior
committed
First commit
0 parents  commit 2c7907e

17 files changed

+328
-0
lines changed

Preferences.sublime-settings

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
{
3+
"bold_folder_labels": true,
4+
"highlight_line": true,
5+
"highlight_modified_tabs": true,
6+
"ignored_packages":
7+
[
8+
"Vintage"
9+
],
10+
"line_padding_bottom": 1,
11+
"line_padding_top": 1,
12+
"rulers":
13+
[
14+
80
15+
],
16+
"scroll_past_end": true,
17+
"tab_completion": true,
18+
"tab_size": 4,
19+
"translate_tabs_to_spaces": true,
20+
"trim_trailing_white_space_on_save": true,
21+
"word_wrap": true,
22+
"update_check": false
23+
}

php-attribute.sublime-snippet

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* @var ${1:type}
5+
*/
6+
protected ${2:attribute};
7+
]]></content>
8+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
9+
<tabTrigger>attr</tabTrigger>
10+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
11+
<scope>source.php</scope>
12+
</snippet>

php-constant.sublime-snippet

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* @const ${1:type}
5+
*/
6+
const ${2:constant};
7+
]]></content>
8+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
9+
<tabTrigger>constant</tabTrigger>
10+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
11+
<scope>source.php</scope>
12+
</snippet>

php-construct-1.sublime-snippet

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* @var ${1:type}
5+
*/
6+
protected \$${2:param};
7+
8+
/**
9+
* @param ${1:type} \$${2:param}
10+
* @return void
11+
*/
12+
public function __construct(${1:type} \$${2:param})
13+
{
14+
\$this->${2:param} = \$${2:param};
15+
}
16+
]]></content>
17+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
18+
<tabTrigger>construct1</tabTrigger>
19+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
20+
<scope>source.php</scope>
21+
</snippet>

php-construct-2.sublime-snippet

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* @var ${1:type}
5+
*/
6+
protected \$${2:param};
7+
8+
/**
9+
* @var ${3:type}
10+
*/
11+
protected \$${4:param};
12+
13+
/**
14+
* @param ${1:type} \$${2:param}
15+
* @param ${3:type} \$${4:param}
16+
* @return void
17+
*/
18+
public function __construct(${1:type} \$${2:param}, ${3:type} \$${4:param})
19+
{
20+
\$this->${2:param} = \$${2:param};
21+
\$this->${4:param} = \$${4:param};
22+
}
23+
]]></content>
24+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
25+
<tabTrigger>construct2</tabTrigger>
26+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
27+
<scope>source.php</scope>
28+
</snippet>

php-construct-3.sublime-snippet

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* @var ${1:type}
5+
*/
6+
protected \$${2:param};
7+
8+
/**
9+
* @var ${3:type}
10+
*/
11+
protected \$${4:param};
12+
13+
/**
14+
* @var ${5:type}
15+
*/
16+
protected \$${6:param};
17+
18+
/**
19+
* @param ${1:type} \$${2:param}
20+
* @param ${3:type} \$${4:param}
21+
* @param ${5:type} \$${6:param}
22+
* @return void
23+
*/
24+
public function __construct(
25+
${1:type} \$${2:param},
26+
${3:type} \$${4:param},
27+
${5:type} \$${6:param}
28+
) {
29+
\$this->${2:param} = \$${2:param};
30+
\$this->${4:param} = \$${4:param};
31+
\$this->${6:param} = \$${6:param};
32+
}
33+
]]></content>
34+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
35+
<tabTrigger>construct3</tabTrigger>
36+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
37+
<scope>source.php</scope>
38+
</snippet>

php-construct.sublime-snippet

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* @return void
5+
*/
6+
public function __construct()
7+
{
8+
9+
}
10+
]]></content>
11+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
12+
<tabTrigger>construct</tabTrigger>
13+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
14+
<scope>source.php</scope>
15+
</snippet>

php-debug-1.sublime-snippet

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<snippet>
2+
<content><![CDATA[
3+
echo '<pre>${1:param}=' . print_r(\$${1:param}, 1) . '</pre>'; exit;
4+
]]></content>
5+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
6+
<tabTrigger>echop</tabTrigger>
7+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
8+
<scope>source.php</scope>
9+
</snippet>

php-debug-2.sublime-snippet

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<snippet>
2+
<content><![CDATA[
3+
echo '<pre>${1:param}=';
4+
var_dump(\$${1:param});
5+
exit('</pre>');
6+
]]></content>
7+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
8+
<tabTrigger>echov</tabTrigger>
9+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
10+
<scope>source.php</scope>
11+
</snippet>

php-getter.sublime-snippet

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* ${1:description of method}
5+
*
6+
* @return ${2:string}
7+
*/
8+
public function get${3:Attribute}(): ${2:string}
9+
{
10+
return \$this->${4:attribute};
11+
}
12+
]]></content>
13+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
14+
<tabTrigger>getter</tabTrigger>
15+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
16+
<scope>source.php</scope>
17+
</snippet>

php-method-1.sublime-snippet

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* ${1:description of method}
5+
*
6+
* @param ${2:type} ${3:param}
7+
* @return ${4:boolean}
8+
*/
9+
public function ${5:methodName}(${2:type} ${3:param}): ${4:boolean}
10+
{
11+
return ${6:true};
12+
}
13+
]]></content>
14+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
15+
<tabTrigger>method1</tabTrigger>
16+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
17+
<scope>source.php</scope>
18+
</snippet>

php-method-2.sublime-snippet

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* ${1:description of method}
5+
*
6+
* @param ${2:type} ${3:param}
7+
* @param ${4:type} ${5:param}
8+
* @return ${6:boolean}
9+
*/
10+
public function ${5:methodName}(${2:type} ${3:param}, ${4:type} ${5:param}): ${6:boolean}
11+
{
12+
return ${7:true};
13+
}
14+
]]></content>
15+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
16+
<tabTrigger>method2</tabTrigger>
17+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
18+
<scope>source.php</scope>
19+
</snippet>

php-method-3.sublime-snippet

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* ${1:description of method}
5+
*
6+
* @param ${2:type} ${3:param}
7+
* @param ${4:type} ${5:param}
8+
* @param ${6:type} ${7:param}
9+
* @return ${9:boolean}
10+
*/
11+
public function ${5:methodName}(
12+
${2:type} ${3:param},
13+
${4:type} ${5:param},
14+
${6:type} ${7:param}
15+
): ${8:boolean}
16+
{
17+
return ${9:true};
18+
}
19+
]]></content>
20+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
21+
<tabTrigger>method3</tabTrigger>
22+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
23+
<scope>source.php</scope>
24+
</snippet>

php-method.sublime-snippet

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* ${1:description of method}
5+
*
6+
* @return ${2:boolean}
7+
*/
8+
public function ${3:methodName}(): ${2:boolean}
9+
{
10+
return ${4:true};
11+
}
12+
]]></content>
13+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
14+
<tabTrigger>method</tabTrigger>
15+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
16+
<scope>source.php</scope>
17+
</snippet>

php-setter.sublime-snippet

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* ${1:description of method}
5+
*
6+
* @param ${2:string} \$${3:param}
7+
* @return \$this
8+
*/
9+
public function set${3:Attribute}(${2:string} \$${3:param}): self
10+
{
11+
\$this->${3:param} = \$${3:param};
12+
return \$this;
13+
}
14+
]]></content>
15+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
16+
<tabTrigger>setter</tabTrigger>
17+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
18+
<scope>source.php</scope>
19+
</snippet>

php-test.sublime-snippet

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<snippet>
2+
<content><![CDATA[
3+
/**
4+
* @test
5+
*/
6+
public function ${1:methodName}()
7+
{
8+
9+
}
10+
]]></content>
11+
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
12+
<tabTrigger>test</tabTrigger>
13+
<!-- Optional: Set a scope to limit where the snippet will trigger -->
14+
<scope>source.php</scope>
15+
</snippet>

readme.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## PHP Snippets for Sublime Text
2+
3+
### Installation
4+
5+
Clone or download zip to install snippets.
6+
7+
Copy or extract to sublime text config path.
8+
```sh
9+
/home/${whoami}/.config/sublime-text/Packages/User/
10+
```
11+
12+
### Usage
13+
14+
* Type **attr** to create a new Attribute for class
15+
* Type **const** to create a new Constant for class
16+
* Type **construct** to create a new Constructor method for class
17+
* Type **construct1** to create a new Constructor method using 1 parameter for class
18+
* Type **construct2** to create a new Constructor method using 2 parameters for class
19+
* Type **construct3** to create a new Constructor method using 3 parameters for class
20+
* Type **getter** to create a new Getter method for class
21+
* Type **setter** to create a new Setter method for class
22+
* Type **method** to create a new Method without parameters for class
23+
* Type **method1** to create a new Method using 1 parameter for class
24+
* Type **method2** to create a new Method using 2 parameters for class
25+
* Type **method3** to create a new Method using 3 parameters for class
26+
* Type **test** to create a new Test method based in PHPUnit
27+
* Type **echop** to debug the code using `print_r()`
28+
* Type **echov** to debug the code using `var_dump()`
29+
30+
I hope you enjoy it ;).

0 commit comments

Comments
 (0)