Skip to content
Merged
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: 2 additions & 0 deletions lib/Doctrine/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@
<rule ref="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn"/>
<!-- Forbid usage of boolean-only ternary operator usage (e.g. $foo ? true : false) -->
<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator"/>
<!-- Require catch exception types to be sorted alphabetically -->
<rule ref="SlevomatCodingStandard.Exceptions.CatchExceptionsOrder"/>
<!-- Forbid useless unreachable catch blocks -->
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
<!-- Require using Throwable instead of Exception -->
Expand Down
6 changes: 3 additions & 3 deletions tests/expected_report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tests/input/duplicate-assignment-variable.php 1 0
tests/input/EarlyReturn.php 8 0
tests/input/example-class.php 49 0
tests/input/ExampleBackedEnum.php 5 0
tests/input/Exceptions.php 1 0
tests/input/Exceptions.php 2 0
tests/input/forbidden-comments.php 14 0
tests/input/forbidden-functions.php 6 0
tests/input/inline_type_hint_assertions.php 10 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 486 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
A TOTAL OF 487 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 400 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
PHPCBF CAN FIX 401 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


7 changes: 7 additions & 0 deletions tests/fixed/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
namespace Exceptions;

use Exception;
use LogicException;
use RuntimeException;
use Throwable;

try {
throw new Exception();
} catch (Throwable) {
}

try {
throw new LogicException();
} catch (LogicException | RuntimeException) {
}
7 changes: 7 additions & 0 deletions tests/input/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
namespace Exceptions;

use Exception;
use LogicException;
use RuntimeException;
use Throwable;

try {
throw new Exception();
} catch (Throwable $throwable) {
}

try {
throw new LogicException();
} catch (RuntimeException | LogicException) {
}
28 changes: 21 additions & 7 deletions tests/php74-compatibility.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ index 8547171..f01ece0 100644
-tests/input/EarlyReturn.php 8 0
-tests/input/example-class.php 49 0
-tests/input/ExampleBackedEnum.php 5 0
-tests/input/Exceptions.php 1 0
-tests/input/Exceptions.php 2 0
+tests/input/EarlyReturn.php 7 0
+tests/input/example-class.php 44 0
tests/input/forbidden-comments.php 14 0
Expand Down Expand Up @@ -57,10 +57,10 @@ index 8547171..f01ece0 100644
-tests/input/UselessConditions.php 21 0
+tests/input/UselessConditions.php 20 0
----------------------------------------------------------------------
-A TOTAL OF 486 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
-A TOTAL OF 487 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
+A TOTAL OF 435 ERRORS AND 2 WARNINGS WERE FOUND IN 48 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 400 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
-PHPCBF CAN FIX 401 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 350 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
diff --git a/tests/fixed/ClassKeywordOrder.php b/tests/fixed/ClassKeywordOrder.php
Expand Down Expand Up @@ -142,21 +142,28 @@ index fd701eb..fe54eb9 100644
- case BAM = 1234;
-}
diff --git a/tests/fixed/Exceptions.php b/tests/fixed/Exceptions.php
index db7408b..9b146c6 100644
index eba1df2..9b146c6 100644
--- a/tests/fixed/Exceptions.php
+++ b/tests/fixed/Exceptions.php
@@ -3,11 +3,3 @@
@@ -3,18 +3,3 @@
declare(strict_types=1);

namespace Exceptions;
-
-use Exception;
-use LogicException;
-use RuntimeException;
-use Throwable;
-
-try {
- throw new Exception();
-} catch (Throwable) {
-}
-
-try {
- throw new LogicException();
-} catch (LogicException | RuntimeException) {
-}
diff --git a/tests/fixed/NamingCamelCase.php b/tests/fixed/NamingCamelCase.php
index 5493471..57d9f2b 100644
--- a/tests/fixed/NamingCamelCase.php
Expand Down Expand Up @@ -466,21 +473,28 @@ index 3b09f47..fe54eb9 100644
- case BAM = 1234;
-}
diff --git a/tests/input/Exceptions.php b/tests/input/Exceptions.php
index 3aaa30f..9b146c6 100644
index 048b7fb..9b146c6 100644
--- a/tests/input/Exceptions.php
+++ b/tests/input/Exceptions.php
@@ -3,11 +3,3 @@
@@ -3,18 +3,3 @@
declare(strict_types=1);

namespace Exceptions;
-
-use Exception;
-use LogicException;
-use RuntimeException;
-use Throwable;
-
-try {
- throw new Exception();
-} catch (Throwable $throwable) {
-}
-
-try {
- throw new LogicException();
-} catch (RuntimeException | LogicException) {
-}
diff --git a/tests/input/PropertyDeclaration.php b/tests/input/PropertyDeclaration.php
index acdc445..0891e12 100644
--- a/tests/input/PropertyDeclaration.php
Expand Down
10 changes: 5 additions & 5 deletions tests/php80-compatibility.patch
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ index 9b19b9e..760ee4a 100644
-tests/input/example-class.php 49 0
-tests/input/ExampleBackedEnum.php 5 0
+tests/input/example-class.php 48 0
tests/input/Exceptions.php 1 0
tests/input/Exceptions.php 2 0
tests/input/forbidden-comments.php 14 0
tests/input/forbidden-functions.php 6 0
@@ -34,8 +33,8 @@ tests/input/null_coalesce_equal_operator.php 5 0
Expand All @@ -33,11 +33,11 @@ index 9b19b9e..760ee4a 100644
tests/input/useless-semicolon.php 2 0
tests/input/UselessConditions.php 21 0
----------------------------------------------------------------------
-A TOTAL OF 486 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
+A TOTAL OF 468 ERRORS AND 2 WARNINGS WERE FOUND IN 50 FILES
-A TOTAL OF 487 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
+A TOTAL OF 469 ERRORS AND 2 WARNINGS WERE FOUND IN 50 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 400 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 383 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
-PHPCBF CAN FIX 401 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 384 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
diff --git a/tests/fixed/ClassKeywordOrder.php b/tests/fixed/ClassKeywordOrder.php
index 29f6164..4b28352 100644
Expand Down
10 changes: 5 additions & 5 deletions tests/php81-compatibility.patch
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ index 8547171..a7a42fa 100644
-tests/input/example-class.php 49 0
+tests/input/example-class.php 48 0
tests/input/ExampleBackedEnum.php 5 0
tests/input/Exceptions.php 1 0
tests/input/Exceptions.php 2 0
tests/input/forbidden-comments.php 14 0
@@ -55,7 +54,7 @@ tests/input/use-ordering.php 1 0
tests/input/useless-semicolon.php 2 0
tests/input/UselessConditions.php 21 0
----------------------------------------------------------------------
-A TOTAL OF 486 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
+A TOTAL OF 478 ERRORS AND 2 WARNINGS WERE FOUND IN 51 FILES
-A TOTAL OF 487 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
+A TOTAL OF 479 ERRORS AND 2 WARNINGS WERE FOUND IN 51 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 400 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 393 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
-PHPCBF CAN FIX 401 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 394 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
diff --git a/tests/fixed/ClassKeywordOrder.php b/tests/fixed/ClassKeywordOrder.php
index 29f6164..4b28352 100644
Expand Down
10 changes: 5 additions & 5 deletions tests/php82-compatibility.patch
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ index 8547171..a7a42fa 100644
-tests/input/example-class.php 49 0
+tests/input/example-class.php 48 0
tests/input/ExampleBackedEnum.php 5 0
tests/input/Exceptions.php 1 0
tests/input/Exceptions.php 2 0
tests/input/forbidden-comments.php 14 0
@@ -55,7 +55,7 @@ tests/input/use-ordering.php 2 0
tests/input/useless-semicolon.php 2 0
tests/input/UselessConditions.php 21 0
----------------------------------------------------------------------
-A TOTAL OF 486 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
+A TOTAL OF 479 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
-A TOTAL OF 487 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
+A TOTAL OF 480 ERRORS AND 2 WARNINGS WERE FOUND IN 52 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 400 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 394 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
-PHPCBF CAN FIX 401 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 395 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
diff --git a/tests/fixed/constants-var.php b/tests/fixed/constants-var.php
index f10c235..d4268cb 100644
Expand Down