Skip to content

Commit aa635ea

Browse files
gsherwoodjrfnl
authored andcommitted
Updated Customisable Sniff Properties (markdown)
1 parent 7cc2f64 commit aa635ea

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

wiki/Customisable-Sniff-Properties.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,10 @@ One of the rules that this sniff enforces is the indent of each function argumen
765765

766766
### PEAR.WhiteSpace.ObjectOperatorIndent
767767

768-
Property Name | Type | Default | Available Since
769-
------------ | ---- | ------- | ---------------
770-
indent | int | 4 | 1.4.6
768+
Property Name | Type | Default | Available Since
769+
------------ | ----- | ------- | ---------------
770+
indent | int | 4 | 1.4.6
771+
multilevel | bool | false | 3.5.0
771772

772773
One of the rules that this sniff enforces is the indent of each line in a multi-line object chain. By default, this sniff ensures that each line is indented 4 spaces, but you can change the size of the indent by setting the `indent` property.
773774

@@ -779,6 +780,29 @@ One of the rules that this sniff enforces is the indent of each line in a multi-
779780
</rule>
780781
```
781782

783+
Another common way of indenting multi-line object chains is to increase and decrease the indent by one level at a time to show balanced method calls, as shown in the following code snippet:
784+
785+
```php
786+
$rootNode
787+
->children()
788+
->booleanNode('foo')
789+
->defaultTrue()
790+
->end()
791+
->scalarNode('bar')
792+
->defaultValue('default')
793+
->end()
794+
->end();
795+
```
796+
If you want to allow mutli-level indenting, set the `multilevel` property to `true`. This will allow each line to be indented 1 more or 1 less level than the previous line, while still ensuring that all lines are indented at least once.
797+
798+
```xml
799+
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent">
800+
<properties>
801+
<property name="multilevel" value="true" />
802+
</properties>
803+
</rule>
804+
```
805+
782806
### PEAR.WhiteSpace.ScopeClosingBrace
783807

784808
Property Name | Type | Default | Available Since

0 commit comments

Comments
 (0)