Skip to content
On this page

OperatorSpacing

Verifies that operators have valid spacing surrounding them.

Scope

PSR12.Operators.OperatorSpacing

Description

All binary and ternary (but not unary) operators MUST be preceded and followed by at least one space. This includes all arithmetic, comparison, assignment, bitwise, logical (excluding ! which is unary), string concatenation, type operators, trait operators (insteadof and as), and the single pipe operator (e.g. ExceptionType1 | ExceptionType2 $e).

Properties

Property NameTypeDefaultAvailable Since
ignoreNewlinesboolfalse3.3.0
ignoreSpacingBeforeAssignmentsbooltrue3.5.0

Usage

xml
<rule ref="PSR12.Operators.OperatorSpacing"></rule>

Examples

No Examples Available

Please edit this page through Github to add examples.

Released under the MIT License.