diff --git a/composer.json b/composer.json index 74807a0..1dc0cc9 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,11 @@ "description": "Libero PHP coding standard", "type": "phpcodesniffer-standard", "license": "MIT", + "autoload": { + "psr-4": { + "Libero\\CodingStandard\\": "src/" + } + }, "autoload-dev": { "psr-4": { "tests\\Libero\\CodingStandard\\": "tests/" diff --git a/src/Libero/Sniffs/WhiteSpace/ObjectStaticOperatorSpacingSniff.php b/src/Libero/Sniffs/WhiteSpace/ObjectStaticOperatorSpacingSniff.php new file mode 100644 index 0000000..c1cf95b --- /dev/null +++ b/src/Libero/Sniffs/WhiteSpace/ObjectStaticOperatorSpacingSniff.php @@ -0,0 +1,18 @@ + + @@ -44,10 +45,11 @@ - + + diff --git a/tests/cases/whitespace/method-call b/tests/cases/whitespace/method-call index 2a3edb0..e37ff33 100644 --- a/tests/cases/whitespace/method-call +++ b/tests/cases/whitespace/method-call @@ -5,7 +5,7 @@ Method calls must not have unnecessary whitespace declare(strict_types=1); -$foo -> bar ( $arg1 ); +$foo -> bar ( $arg1 ) -> baz ( ); $foo -> bar ($arg1 @@ -13,19 +13,30 @@ $foo -> baz ($arg1 ,$arg2); +$fooBar() + ->baz() + ->qux() +; + ---FIXED--- bar($arg1); +$foo->bar($arg1)->baz(); -$foo->bar( - $arg1, - $arg2 -)->baz( - $arg1, - $arg2 -); +$foo + ->bar( + $arg1, + $arg2 + ) + ->baz( + $arg1, + $arg2 + ); + +$fooBar() + ->baz() + ->qux(); ---