File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
programming-language/php/laravel/code-style Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ function sidebarProgrammingLanguage()
54
54
items : [
55
55
{ text : "重定向 redirect" , link : "/programming-language/php/laravel/route/redirect" } ,
56
56
{ text : "@each 渲染集合视图" , link : "/programming-language/php/laravel/blade/each" } ,
57
+ { text : "pint 代码风格" , link : "/programming-language/php/laravel/code-style/pint" } ,
57
58
]
58
59
}
59
60
] ;
Original file line number Diff line number Diff line change
1
+ # pint 代码风格
2
+
3
+ [ Laravel Pint] ( https://laravel.com/docs/master/pint#main-content ) 支持开箱即用的代码风格检查和修复。
4
+
5
+ 通过在项目根目录下添加 ` pint.json ` 来制定自定义的代码风格,更多自定义风格配置可以[ 查看这里] ( https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/rules/index.rst ) 。
6
+
7
+ 文件内容如下:
8
+
9
+ ``` yml
10
+ {
11
+ " preset " : " laravel" ,
12
+ " rules " : {
13
+ " ordered_imports " : {
14
+ " sort_algorithm " : " length" ,
15
+ " imports_order " : [
16
+ " const" ,
17
+ " class" ,
18
+ " function"
19
+ ]
20
+ }
21
+ }
22
+ }
23
+ ```
24
+
25
+ ` ordered_imports ` 格式化 PHP 中类的 ` use ` 语句,排序的规则使用字符长度,导入顺序按照 ` const ` 、` class ` 和 ` function ` 。
You can’t perform that action at this time.
0 commit comments