diff --git a/wiki/Customisable-Sniff-Properties.md b/wiki/Customisable-Sniff-Properties.md index 9ee7e9d..ffdf5e5 100644 --- a/wiki/Customisable-Sniff-Properties.md +++ b/wiki/Customisable-Sniff-Properties.md @@ -1093,8 +1093,34 @@ This sniff checks the depth of imported namespaces inside compound use statement ``` -

back to top

+### PSR12.Operators.OperatorSpacing + +| Property Name | Type | Default | Available Since | +| ------------- | ------ | ------- | --------------- | +| perCompatible | string | 1.0 | 4.0.2 | + +This sniff checks the spacing around operators. By default, this sniff is compatible with [PER Coding Style](https://www.php-fig.org/per/coding-style/) 1.0. The setting `perCompatible` can be set to 3.0 or higher to get different behaviour for spacing around multi-catch `|` operators. +```xml + + + + + +``` + +Valid: no spaces around the '|' operator in a multi-catch with 'perCompatible=3.0' (or higher): +```php +try { +} catch (Exception|RuntimeException $e) { +} +``` +Invalid: spaces around the '|' operator in a multi-catch with 'perCompatible=3.0' (or higher). +```php +try { +} catch (Exception | RuntimeException $e) { +} +``` +

back to top

+ ## Squiz Sniffs