Skip to content

Commit 93b26ea

Browse files
committed
feat: add php class with extends and implements
1 parent f7772f7 commit 93b26ea

File tree

3 files changed

+55
-9
lines changed

3 files changed

+55
-9
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ You can use it to avoid wasting time typing Class blocks, function signatures or
1414
### Class related
1515
| Snippet | Output | Language
1616
| --- | --- | --- |
17-
| phpclass | `standard php class` | html+php |
18-
| phpclano | `php class without strict type and namespace` | html |
19-
| phpclanostr | `php class without strict type` | html |
20-
| phpclanonam | `php class without namespace` | html |
17+
| php-class | `standard php class` | html+php |
18+
| php-class-no | `php class without strict type and namespace` | html |
19+
| php-class-no-strict | `php class without strict type` | html |
20+
| php-class-no-namespace | `php class without namespace` | html |
21+
| php-class-extends | `php class with extends` | html |
22+
| php-class-implements | `php class with implements` | html |
2123

2224
## Special Thanks
2325
This extension is forked from [h4kst3r/php-awesome-snippets](https://github.com/h4kst3r/php-awesome-snippets). Because its author seems to have not maintained it for a long time. So I made this fork to make the extension suitable for new version of PHP. I re-planned the shortcut keys, and add more standardized writing methods. Great thanks to h4kst3r's excellent work.

snippets/html/class.json

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"php class": {
3-
"prefix": "phpcla",
3+
"prefix": "php-class",
44
"body": [
55
"<?php",
66
"",
@@ -17,12 +17,12 @@
1717
"description": "php class"
1818
},
1919
"php class no": {
20-
"prefix": "phpclano",
20+
"prefix": "php-class-no",
2121
"body": ["<?php", "", "class $TM_FILENAME_BASE", "{", " $0", "}", ""],
2222
"description": "php class without strict type and namespace"
2323
},
2424
"php class no strict": {
25-
"prefix": "phpclanostr",
25+
"prefix": "php-class-no-strict",
2626
"body": [
2727
"<?php",
2828
"",
@@ -37,7 +37,7 @@
3737
"description": "php class without strict type"
3838
},
3939
"php class no namespace": {
40-
"prefix": "phpclanonam",
40+
"prefix": "php-class-no-namespace",
4141
"body": [
4242
"<?php",
4343
"",
@@ -50,5 +50,39 @@
5050
""
5151
],
5252
"description": "php class without namespace"
53+
},
54+
"php class extends": {
55+
"prefix": "php-class-extends",
56+
"body": [
57+
"<?php",
58+
"",
59+
"declare(strict_types=1);",
60+
"",
61+
"namespace $1;",
62+
"",
63+
"class $TM_FILENAME_BASE extends $2",
64+
"{",
65+
" $0",
66+
"}",
67+
""
68+
],
69+
"description": "php class with extends"
70+
},
71+
"php class implements": {
72+
"prefix": "php-class-implements",
73+
"body": [
74+
"<?php",
75+
"",
76+
"declare(strict_types=1);",
77+
"",
78+
"namespace $1;",
79+
"",
80+
"class $TM_FILENAME_BASE implements $2",
81+
"{",
82+
" $0",
83+
"}",
84+
""
85+
],
86+
"description": "php class with implements"
5387
}
5488
}

snippets/php/class.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
{
22
"php class": {
3-
"prefix": "phpcla",
3+
"prefix": "php-class",
44
"body": ["class $TM_FILENAME_BASE", "{", " $0", "}", ""],
55
"description": "php class"
6+
},
7+
"php class extends": {
8+
"prefix": "php-class-extends",
9+
"body": ["class $TM_FILENAME_BASE extends $1", "{", " $0", "}", ""],
10+
"description": "php class with extends"
11+
},
12+
"php class implements": {
13+
"prefix": "php-class-implements",
14+
"body": ["class $TM_FILENAME_BASE implements $1", "{", " $0", "}", ""],
15+
"description": "php class with implements"
616
}
717
}

0 commit comments

Comments
 (0)