File tree 4 files changed +79
-0
lines changed
4 files changed +79
-0
lines changed Original file line number Diff line number Diff line change
1
+ .idea
2
+ /vendor /
Original file line number Diff line number Diff line change
1
+ # MessageCloud Coding Standard
2
+
3
+ The PHP coding standard for MessageCloud.
4
+
5
+ ## Installation
6
+
7
+ 1 . Require the package in your ` composer.json ` :
8
+ ``` json
9
+ {
10
+ "repositories" : [
11
+ {
12
+ "type" : " vcs" ,
13
+ "url" :
" [email protected] :MessageCloud/messagecloud-coding-standard.git"
14
+ }
15
+ ],
16
+ "require-dev" : {
17
+ "messagecloud/messagecloud-coding-standard" : " ^1.0"
18
+ }
19
+ }
20
+ ```
21
+
22
+ 2 . Create a PHP Code Sniffer configuration file ` phpcs.xml ` :
23
+ ``` xml
24
+ <?xml version =" 1.0" ?>
25
+ <ruleset name =" MessageCloud Coding Standard" >
26
+ <rule ref =" ./vendor/messagecloud/messagecloud-coding-standard/ruleset.xml" />
27
+
28
+ <!-- Path to check -->
29
+ <file >./src</file >
30
+
31
+ <!-- Allow test methods to be snake case -->
32
+ <rule ref =" PSR1.Methods.CamelCapsMethodName" >
33
+ <exclude-pattern >./test</exclude-pattern >
34
+ </rule >
35
+ </ruleset >
36
+ ```
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " messagecloud/messagecloud-coding-standard" ,
3
+ "description" : " MessageCloud Coding Standard" ,
4
+ "require" : {
5
+ "squizlabs/php_codesniffer" : " ^3.0"
6
+ },
7
+ "authors" : [
8
+ {
9
+ "name" : " Ethan Bray" ,
10
+
11
+ }
12
+ ]
13
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <ruleset name =" MessageCloud Coding Standard" >
3
+ <description >MessageCloud PHP Coding Standard. Essentially PSR2 with some modifications.</description >
4
+
5
+ <arg name =" colors" />
6
+ <arg value =" p" />
7
+
8
+ <!-- PSR2 extends PSR1 -->
9
+ <rule ref =" PSR2" />
10
+ <rule ref =" Generic.Arrays.DisallowLongArraySyntax" />
11
+
12
+ <!-- Extend the line length warning and error to 130 characters -->
13
+ <rule ref =" Generic.Files.LineLength" >
14
+ <properties >
15
+ <property name =" lineLimit" value =" 130" />
16
+ <property name =" absoluteLineLimit" value =" 130" />
17
+ </properties >
18
+ </rule >
19
+
20
+ <!--
21
+ We exclude the PSR2 Use Declaration rule as it clashes with PHP7 style grouped Use statements.
22
+ This is supposedly being fixed in a proposed PSR (https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md)
23
+ so we'll keep our eye on this.
24
+ -->
25
+ <rule ref =" PSR2.Namespaces.UseDeclaration" >
26
+ <exclude-pattern >*</exclude-pattern >
27
+ </rule >
28
+ </ruleset >
You can’t perform that action at this time.
0 commit comments