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
9 changes: 9 additions & 0 deletions lib/Doctrine/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,9 @@
<element value="Doctrine\Common\Collections\Collection"/>
</property>
</properties>

<!-- Tools like PHPStan or Psalm check this better -->
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<properties>
Expand All @@ -407,6 +410,9 @@
<element value="Doctrine\Common\Collections\Collection"/>
</property>
</properties>

<!-- Tools like PHPStan or Psalm check this better -->
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHintSpacing"/>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
Expand All @@ -418,6 +424,9 @@
<element value="Doctrine\Common\Collections\Collection"/>
</property>
</properties>

<!-- Tools like PHPStan or Psalm check this better -->
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<!-- Forbid useless @var for constants -->
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/>
Expand Down
3 changes: 1 addition & 2 deletions tests/expected_report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ tests/input/superfluous-naming.php 11 0
tests/input/test-case.php 8 0
tests/input/trailing_comma_on_array.php 1 0
tests/input/traits-uses.php 11 0
tests/input/type-hints.php 4 0
tests/input/UnusedVariables.php 1 0
tests/input/use-ordering.php 1 0
tests/input/useless-semicolon.php 2 0
tests/input/UselessConditions.php 20 0
----------------------------------------------------------------------
A TOTAL OF 377 ERRORS AND 0 WARNINGS WERE FOUND IN 41 FILES
A TOTAL OF 373 ERRORS AND 0 WARNINGS WERE FOUND IN 40 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 313 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Expand Down
24 changes: 0 additions & 24 deletions tests/fixed/type-hints.php

This file was deleted.

24 changes: 0 additions & 24 deletions tests/input/type-hints.php

This file was deleted.

27 changes: 6 additions & 21 deletions tests/php74-compatibility.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index fd5432c..233e24d 100644
tests/input/duplicate-assignment-variable.php 1 0
tests/input/EarlyReturn.php 6 0
-tests/input/example-class.php 38 0
+tests/input/example-class.php 41 0
+tests/input/example-class.php 39 0
tests/input/forbidden-comments.php 14 0
tests/input/forbidden-functions.php 6 0
tests/input/inline_type_hint_assertions.php 7 0
Expand All @@ -23,22 +23,20 @@ index fd5432c..233e24d 100644
tests/input/null_coalesce_operator.php 3 0
tests/input/optimized-functions.php 1 0
tests/input/PropertyTypeHintSpacing.php 6 0
@@ -39,15 +39,15 @@ tests/input/superfluous-naming.php 11 0
@@ -39,14 +39,14 @@ tests/input/superfluous-naming.php 11 0
tests/input/test-case.php 8 0
tests/input/trailing_comma_on_array.php 1 0
tests/input/traits-uses.php 11 0
-tests/input/type-hints.php 4 0
+tests/input/type-hints.php 5 0
tests/input/UnusedVariables.php 1 0
tests/input/use-ordering.php 1 0
tests/input/useless-semicolon.php 2 0
tests/input/UselessConditions.php 20 0
----------------------------------------------------------------------
-A TOTAL OF 377 ERRORS AND 0 WARNINGS WERE FOUND IN 41 FILES
+A TOTAL OF 386 ERRORS AND 0 WARNINGS WERE FOUND IN 41 FILES
-A TOTAL OF 373 ERRORS AND 0 WARNINGS WERE FOUND IN 40 FILES
+A TOTAL OF 379 ERRORS AND 0 WARNINGS WERE FOUND IN 40 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 313 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 322 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 321 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


Expand Down Expand Up @@ -110,17 +108,4 @@ index 8846dd1..51c361c 100644
+$bar ??= 'bar';

$bar = $bar['baz'] ?? 'baz';

diff --git a/tests/fixed/type-hints.php b/tests/fixed/type-hints.php
index 0e952fc..9824fb0 100644
--- a/tests/fixed/type-hints.php
+++ b/tests/fixed/type-hints.php
@@ -10,7 +10,7 @@ use Traversable;
class TraversableTypeHints
{
/** @var Traversable */
- private $parameter;
+ private Traversable $parameter;

/**
* @param Iterator $iterator

25 changes: 5 additions & 20 deletions tests/php80-compatibility.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index c644926..d0f0a44 100644
tests/input/duplicate-assignment-variable.php 1 0
tests/input/EarlyReturn.php 6 0
-tests/input/example-class.php 38 0
+tests/input/example-class.php 42 0
+tests/input/example-class.php 40 0
tests/input/forbidden-comments.php 14 0
tests/input/forbidden-functions.php 6 0
tests/input/inline_type_hint_assertions.php 7 0
Expand All @@ -26,22 +26,20 @@ index c644926..d0f0a44 100644
tests/input/optimized-functions.php 1 0
tests/input/PropertyTypeHintSpacing.php 6 0
tests/input/return_type_on_closures.php 21 0
@@ -39,15 +40,15 @@ tests/input/superfluous-naming.php 11 0
@@ -39,14 +40,14 @@ tests/input/superfluous-naming.php 11 0
tests/input/test-case.php 8 0
tests/input/trailing_comma_on_array.php 1 0
tests/input/traits-uses.php 11 0
-tests/input/type-hints.php 4 0
+tests/input/type-hints.php 5 0
tests/input/UnusedVariables.php 1 0
tests/input/use-ordering.php 1 0
tests/input/useless-semicolon.php 2 0
tests/input/UselessConditions.php 20 0
----------------------------------------------------------------------
-A TOTAL OF 377 ERRORS AND 0 WARNINGS WERE FOUND IN 41 FILES
+A TOTAL OF 391 ERRORS AND 0 WARNINGS WERE FOUND IN 42 FILES
-A TOTAL OF 373 ERRORS AND 0 WARNINGS WERE FOUND IN 40 FILES
+A TOTAL OF 384 ERRORS AND 0 WARNINGS WERE FOUND IN 41 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 313 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 327 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 326 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


Expand Down Expand Up @@ -150,16 +148,3 @@ index 5bbb636..7ce8a3d 100644

-$var = $object === null ? null : $object->property;
+$var = $object?->property;
diff --git a/tests/fixed/type-hints.php b/tests/fixed/type-hints.php
index 0e952fc..9824fb0 100644
--- a/tests/fixed/type-hints.php
+++ b/tests/fixed/type-hints.php
@@ -10,7 +10,7 @@ use Traversable;
class TraversableTypeHints
{
/** @var Traversable */
- private $parameter;
+ private Traversable $parameter;

/**
* @param Iterator $iterator