Skip to content

Commit

Permalink
PHP 8.0 | Squiz/ObjectOperatorSpacing: sniff for nullsafe object oper…
Browse files Browse the repository at this point in the history
…ator

This adds sniffing for the spacing around nullsafe object operators to the sniff.

Includes unit test.
  • Loading branch information
jrfnl committed Sep 1, 2020
1 parent 85f3521 commit a4f0110
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function register()
return [
T_OBJECT_OPERATOR,
T_DOUBLE_COLON,
T_NULLSAFE_OBJECT_OPERATOR,
];

}//end register()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ thisObject::
testThis();

// phpcs:set Squiz.WhiteSpace.ObjectOperatorSpacing ignoreNewlines false

$this?->testThis();
$this?-> testThis();
$this ?-> testThis();
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ thisObject::
testThis();

// phpcs:set Squiz.WhiteSpace.ObjectOperatorSpacing ignoreNewlines false

$this?->testThis();
$this?->testThis();
$this?->testThis();
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public function getErrorList()
39 => 1,
40 => 2,
42 => 2,
51 => 1,
52 => 2,
];

}//end getErrorList()
Expand Down

0 comments on commit a4f0110

Please sign in to comment.