Closed
Description
How to reproduce:
- Install
$ curl -sSL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar -o $(which phpcs) \
&& chmod +x $(which phpcs) \
&& phpcs --version
> PHP_CodeSniffer version 3.1.0 (stable) by Squiz (http://www.squiz.net)
- test.php
<?php
namespace Test;
class Foo
{
public function bar($a, $b)
{
if (!$a || !$b) {
return;
}
(new stdClass())->a = $a;
}
}
- Run test
$ phpcs --standard=PSR2 $(pwd)/test.php
FILE: $(pwd)/test.php
---------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------
11 | ERROR | [x] Space before opening parenthesis of function call prohibited
11 | ERROR | [x] Opening parenthesis of a multi-line function call must be the last content on the line
13 | ERROR | [x] Closing parenthesis of a multi-line function call must be on a line by itself
---------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------