spacing.accessorfixable
Ensure consistent accessor ->
spacing.
Examples
- Examples of correct code for this rule using default options
Correct accessor spacing
php
<?php
$b->foo = 2;
echo $a->foo."\n";
$d->foo = 2;
echo $c->foo."\n";
function foo($obj) {
$obj->foo = 2;
}
echo $e->foo."\n";
$this->callFirst("one", "two")->
callSecond("three", "four")
->callThird("five", "six");
$this->callFirst("one", "two")->callSecond("three", "four")
->callThird("five", "six");
ClassName::callFirst("one", "two")->callSecond("three", "four");
A::b;
- Examples of incorrect code for this rule using default options
Incorrect accessor spacing
php
<?php
$b-> foo = 2;
echo $a -> foo."\n";
$d ->foo = 2;
echo $c-> foo."\n";
function foo($obj) {
$obj -> foo = 2;
}
echo $e -> foo."\n";
$this -> callFirst("one", "two") ->
callSecond("three", "four")
-> callThird("five", "six");
$this -> callFirst("one", "two") ->callSecond("three", "four")
-> callThird("five", "six");
ClassName :: callFirst("one", "two") ->callSecond("three", "four");
A :: b;
ClassName ::
classProperty;