Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"require": {
"php": "^7.4 || ^8.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0.0",
"slevomat/coding-standard": "^8.29",
"slevomat/coding-standard": "^8.31",
"squizlabs/php_codesniffer": "^4"
},
"config": {
Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
<property name="spacesCountAfterKeyword" value="1"/>
<property name="spacesCountBeforeArrow" value="1"/>
<property name="spacesCountAfterArrow" value="1"/>
<property name="disallowReturnTypeHint" value="true"/>
</properties>
</rule>
<!-- Disallow trailing commas in single line function calls -->
Expand Down
6 changes: 3 additions & 3 deletions tests/expected_report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FILE ERRORS WARNINGS
----------------------------------------------------------------------
tests/input/annotation-name.php 8 0
tests/input/array_indentation.php 10 0
tests/input/arrow-functions-format.php 12 0
tests/input/arrow-functions-format.php 16 0
tests/input/assignment-operators.php 4 0
tests/input/attributes.php 15 0
tests/input/binary_operators.php 9 0
Expand Down Expand Up @@ -56,9 +56,9 @@ tests/input/use-ordering.php 2 0
tests/input/useless-semicolon.php 2 0
tests/input/UselessConditions.php 21 0
----------------------------------------------------------------------
A TOTAL OF 487 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
A TOTAL OF 491 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 401 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
PHPCBF CAN FIX 405 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


8 changes: 4 additions & 4 deletions tests/fixed/arrow-functions-format.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

$uselessParentheses = static fn ($x) => $x + $y;

$withReturnType = static fn (): int => 1 + 2;
$withReturnType = static fn () => 1 + 2;

$withTypesInArguments = static fn (int $a, int $b): int => $a + $b;
$withTypesInArguments = static fn (int $a, int $b) => $a + $b;

$spacing = static fn (int $x) => $x * 2;

Expand All @@ -18,10 +18,10 @@

$multiLineArrowFunctions = Collection::from([1, 2])
->map(
static fn (int $v): int => $v * 2,
static fn (int $v) => $v * 2,
)
->reduce(
static fn (int $tmp, int $v): int => $tmp + $v,
static fn (int $tmp, int $v) => $tmp + $v,
);

$thisIsNotAnArrowFunction = [$this->fn => 'value'];
Expand Down
Loading