------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 31 ERRORS AND 1 WARNING AFFECTING 16 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------
1 | WARNING | [ ] A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute
| | logic with side effects, but should not do both. The first symbol is defined on line 3 and the first side effect is on line 13.
3 | ERROR | [x] Opening brace should be on a new line
5 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 0
6 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 0
6 | ERROR | [x] Multi-line function call not indented correctly; expected 4 spaces but found 0
6 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
7 | ERROR | [x] Line indented incorrectly; expected at least 8 spaces, found 0
7 | ERROR | [x] Multi-line function call not indented correctly; expected 4 spaces but found 0
8 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 0
8 | ERROR | [x] Multi-line function call not indented correctly; expected 4 spaces but found 0
8 | ERROR | [x] No space found after comma in argument list
8 | ERROR | [x] Only one argument is allowed per line in a multi-line function call
9 | ERROR | [x] Empty lines are not allowed in multi-line function calls
10 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 0
10 | ERROR | [x] Closing brace must be on a line by itself
16 | ERROR | [x] Multi-line function call not indented correctly; expected 4 spaces but found 0
17 | ERROR | [x] Empty lines are not allowed in multi-line function calls
18 | ERROR | [x] Multi-line function call not indented correctly; expected 4 spaces but found 0
19 | ERROR | [x] Multi-line function call not indented correctly; expected 4 spaces but found 0
19 | ERROR | [x] Multi-line function call not indented correctly; expected 4 spaces but found 0
19 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
19 | ERROR | [x] Expected 1 space before opening brace; found 0
20 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 0
20 | ERROR | [x] Multi-line function call not indented correctly; expected 4 spaces but found 0
20 | ERROR | [x] Multi-line function call not indented correctly; expected 4 spaces but found 0
21 | ERROR | [x] Multi-line function call not indented correctly; expected 4 spaces but found 0
21 | ERROR | [x] Multi-line function call not indented correctly; expected 4 spaces but found 0
21 | ERROR | [x] Only one argument is allowed per line in a multi-line function call
22 | ERROR | [x] Empty lines are not allowed in multi-line function calls
23 | ERROR | [x] No space found after comma in argument list
23 | ERROR | [x] Closing parenthesis of a multi-line function call must be on a line by itself
23 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 31 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------
---------- begin diff ----------
@@ @@
function allToInt(array $arr): array{
return array_map(
-static function(mixed $val): int {
-return (int)$val;
-},$arr,
+static fn(mixed $val): int => (int)$val,$arr,
);}
@@ @@
', ',
array_map(
-static function(mixed $val): string{
-return gettype($val);
-}, $result,
+static fn(mixed $val): string => gettype($val), $result,
-),);
+),);
----------- end diff -----------
function allToInt(array $arr): array
{
return array_map(
static function(mixed $val): int {
return (int)$val;
},
$arr,
);
}
$result = allToInt([1.5, 2.6, 3, 4, 5]);
echo implode(
', ',
array_map(
static function(mixed $val): string
{
return gettype($val);
},
$result,
),
);