You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-3Lines changed: 26 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ PHPFmt is a PHP code formatter tailored for Sublime Text 4 with full support for
7
7
## Features
8
8
9
9
-**PHP 8 Support**: Seamlessly format PHP >= 5.6 code.
10
-
-**Rich Formatting Options**: Includes PSR-1, PSR-2, and WordPress coding standards, among others.
10
+
-**Rich Formatting Options**: Includes PSR-1, PSR-2, PSR-12, and WordPress coding standards, among others.
11
11
-**Customization**: Supports a wide array of transformations and formatting tweaks.
12
12
-**Easy Integration**: Simple setup and configuration within Sublime Text.
13
13
@@ -32,7 +32,9 @@ Edit the configuration file at `%AppData%\Sublime Text\Packages\phpfmt\phpfmt.su
32
32
33
33
```json
34
34
{
35
-
"php_bin": "c:/PHP/php.exe"
35
+
"php_bin": "c:/PHP/php.exe",
36
+
"psr2": true,
37
+
"psr12": false
36
38
}
37
39
```
38
40
@@ -42,10 +44,14 @@ Edit `phpfmt.sublime-settings` and set the `php_bin` path:
42
44
43
45
```json
44
46
{
45
-
"php_bin": "/usr/local/bin/php"
47
+
"php_bin": "/usr/local/bin/php",
48
+
"psr2": true,
49
+
"psr12": false
46
50
}
47
51
```
48
52
53
+
`psr12` is opt-in and does not change the existing `psr2` profile. In the Sublime plugin, `psr12` and `psr2` are treated as mutually exclusive profile toggles so enabling one disables the other.
54
+
49
55
You may find an example configuration file in https://github.com/driade/phpfmt8/blob/master/driade.sublime-settings , where you can see how to configure the extension.
50
56
51
57
## Usage
@@ -55,9 +61,19 @@ PHPFmt provides a variety of commands accessible via the command palette (`Ctrl+
55
61
-`phpfmt: format now`
56
62
-`phpfmt: toggle format on save`
57
63
-`phpfmt: toggle PSR2`
64
+
-`phpfmt: toggle PSR-12`
58
65
59
66
... and more.
60
67
68
+
## PSR Profiles
69
+
70
+
-`psr1`: enables the PSR-1 profile.
71
+
-`psr1_naming`: enables PSR-1 naming rules for classes and methods.
72
+
-`psr2`: keeps the legacy PSR-2 behavior unchanged.
73
+
-`psr12`: enables the newer PSR-12 profile on top of the existing PSR base without changing `psr2` semantics.
74
+
75
+
In the Sublime plugin, enabling `psr12` disables `psr2`, and enabling `psr2` disables `psr12`.
76
+
61
77
62
78
## Currently Supported Transformations:
63
79
@@ -102,6 +118,13 @@ PHPFmt provides a variety of commands accessible via the command palette (`Ctrl+
102
118
* PrettyPrintDocBlocks Prettify Doc Blocks
103
119
* PSR2EmptyFunction Merges in the same line of function header the body of empty functions.
104
120
* PSR2MultilineFunctionParams Break function parameters into multiple lines.
121
+
* PSR12ControlStructureBlocks Expand control-structure blocks, switch cases, and block declare syntax to multiline PSR-12 form.
122
+
* PSR12IndentImplementsList Indent wrapped anonymous-class implements lists for PSR-12.
123
+
* PSR12MultilineCalls Normalize multiline function and method calls to PSR-12 hanging indentation.
124
+
* PSR12TernaryConditions Normalize multiline ternary operators to PSR-12 hanging indentation.
125
+
* PSR12TopFileFormat Normalize top-of-file PSR-12 blocks and import grouping.
126
+
* PSR12TraitUseSpacing Ensure a blank line after trait use blocks before class members.
127
+
* PSR12TypeHints Normalize nullable and return-type spacing for PSR-12.
105
128
* ReindentAndAlignObjOps Align object operators.
106
129
* ReindentSwitchBlocks Reindent one level deeper the content of switch blocks.
107
130
* ReindentEnumBlocks Reindent one level deeper the content of enum blocks.
0 commit comments