Skip to content

Commit 0a1d9a4

Browse files
committed
Add array declaration sniff
1 parent 5472318 commit 0a1d9a4

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

CHANGELOG.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
# Changelog
22

3-
## v0.2.1
3+
## v0.3.x
4+
5+
### v0.3.0
6+
7+
- Added Squiz ArrayDeclaration sniff to check spacing in the array declaration
8+
9+
---
10+
11+
## v0.2.x
12+
13+
### v0.2.1
414

515
- Fixed bug - PHP CS Strict disable checking double quotes (#1)
616
- Fixed bug - Strict Rules conflict (#2)
717

8-
## v0.2
18+
### v0.2
919

1020
- Add ruleset for space indentation and tabs indentation
1121

22+
---
23+
24+
## v0.1.x
1225

13-
## v0.1
26+
### v0.1.0
1427

1528
- Initial release of custom ruleset

Rules/Parts/phpcs-squiz.xml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
<?xml version="1.0"?>
22
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Arxeiss PHP Standard - Squiz rules">
3-
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/> <!-- No spaces in the beginning and end of array -->
3+
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/> <!-- No spaces in the beginning and end of array access -->
4+
<rule ref="Squiz.Arrays.ArrayDeclaration">
5+
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine"/><!-- does not handle wrapped content -->
6+
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"/><!-- expects closing brace at the same level as opening brace -->
7+
<exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned"/><!-- we don't want spacing with alignment -->
8+
<exclude name="Squiz.Arrays.ArrayDeclaration.FirstIndexNoNewline"/><!-- expects multi-value array always written on multiple lines -->
9+
<exclude name="Squiz.Arrays.ArrayDeclaration.FirstValueNoNewline"/><!-- expects multi-value array always written on multiple lines -->
10+
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"/><!-- uses indentation of only single space -->
11+
<exclude name="Squiz.Arrays.ArrayDeclaration.KeySpecified"/><!-- If used keys, all entries must have a key -->
12+
<exclude name="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed"/><!-- even a single-value array can be written on multiple lines -->
13+
<exclude name="Squiz.Arrays.ArrayDeclaration.NoComma"/><!-- does not handle nested array access with complex keys on multiple lines; also already checked better by SlevomatCodingStandard.Arrays.TrailingArrayComma -->
14+
<exclude name="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast"/><!-- expects multi-value array always written on multiple lines -->
15+
<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed"/><!-- multiple values can be written on a single line -->
16+
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"/><!-- we don't want spacing with alignment -->
17+
</rule>
418
<rule ref="Squiz.Classes.ClassFileName"/> <!-- File name match class name -->
519
<rule ref="Squiz.Classes.SelfMemberReference"/> <!-- self:: is lowercase and without extra whitespace -->
620
<rule ref="Squiz.Commenting.DocCommentAlignment"/> <!-- Stars in comment are aligned -->

0 commit comments

Comments
 (0)