-
-
Notifications
You must be signed in to change notification settings - Fork 185
Closed
Description
$ composer show | grep -P 'coding-standard|php_codesniffer'
doctrine/coding-standard 8.2.x-dev fb2caa8 The Doctrine Coding Sta...
slevomat/coding-standard dev-master d5ad187 Slevomat Coding Standar...
squizlabs/php_codesniffer dev-master 1106d65 PHP_CodeSniffer tokeniz...
Consider the following code example:
<?php
declare(strict_types=1);
function test($a)
{
return match ($a) {
'foo' => 'bar',
};
}
$ phpcs --sniffs=SlevomatCodingStandard.PHP.UselessSemicolon test.php
E 1 / 1 (100%)
FILE: test.php
------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
9 | ERROR | [x] Useless semicolon.
| | (SlevomatCodingStandard.PHP.UselessSemicolon.UselessSemicolon)
------------------------------------------------------------------------------------------------
$ phpcbf --sniffs=SlevomatCodingStandard.PHP.UselessSemicolon test.php
F 1 / 1 (100%)
PHPCBF RESULT SUMMARY
----------------------------------------------------------------------
FILE FIXED REMAINING
----------------------------------------------------------------------
test.php 1 0
----------------------------------------------------------------------
A TOTAL OF 1 ERROR WERE FIXED IN 1 FILE
----------------------------------------------------------------------
$ php -l test.php
Parse error: syntax error, unexpected token "}", expecting ";" in test.php on line 10