Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disallow multiple structures per file #206

Open
wants to merge 4 commits into
base: 8.2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/Doctrine/ruleset.xml
Expand Up @@ -42,6 +42,8 @@
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
<!-- Forbid inline HTML in PHP code -->
<rule ref="Generic.Files.InlineHTML"/>
<!-- Only one structure (class/interface/trait) should be allowed per file -->
<rule ref="Generic.Files.OneObjectStructurePerFile" />
Comment on lines +45 to +46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that part of some other rule already? Can you add some tests to check it, please?

<!-- Align corresponding assignment statement tokens -->
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
Expand Down
6 changes: 3 additions & 3 deletions tests/expected_report.txt
Expand Up @@ -6,7 +6,7 @@ FILE ERRORS WARNINGS
tests/input/array_indentation.php 10 0
tests/input/arrow-functions-format.php 10 0
tests/input/assignment-operators.php 4 0
tests/input/class-references.php 10 0
tests/input/class-references.php 11 0
tests/input/concatenation_spacing.php 24 0
tests/input/constants-no-lsb.php 2 0
tests/input/constants-var.php 6 0
Expand All @@ -31,10 +31,10 @@ tests/input/return_type_on_methods.php 17 0
tests/input/semicolon_spacing.php 3 0
tests/input/spread-operator.php 6 0
tests/input/static-closures.php 1 0
tests/input/superfluous-naming.php 11 0
tests/input/superfluous-naming.php 14 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/traits-uses.php 12 0
tests/input/type-hints.php 4 0
tests/input/UnusedVariables.php 1 0
tests/input/use-ordering.php 1 0
Expand Down
10 changes: 5 additions & 5 deletions tests/php-compatibility.patch
Expand Up @@ -8,7 +8,7 @@ index 1e809f9..490fcbd 100644
tests/input/arrow-functions-format.php 10 0
tests/input/assignment-operators.php 4 0
+tests/input/binary_operators.php 9 0
tests/input/class-references.php 10 0
tests/input/class-references.php 11 0
-tests/input/concatenation_spacing.php 24 0
+tests/input/concatenation_spacing.php 49 0
tests/input/constants-no-lsb.php 2 0
Expand All @@ -21,7 +21,7 @@ index 1e809f9..490fcbd 100644
-tests/input/example-class.php 34 0
-tests/input/forbidden-comments.php 8 0
+tests/input/example-class.php 39 0
+tests/input/forbidden-comments.php 14 0
+tests/input/forbidden-comments.php 16 0
tests/input/forbidden-functions.php 6 0
tests/input/inline_type_hint_assertions.php 7 0
tests/input/LowCaseTypes.php 2 0
Expand All @@ -42,10 +42,10 @@ index 1e809f9..490fcbd 100644
+tests/input/single-line-array-spacing.php 5 0
tests/input/spread-operator.php 6 0
tests/input/static-closures.php 1 0
tests/input/superfluous-naming.php 11 0
tests/input/superfluous-naming.php 14 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/traits-uses.php 12 0
-tests/input/type-hints.php 4 0
+tests/input/type-hints.php 5 0
tests/input/UnusedVariables.php 1 0
Expand All @@ -54,7 +54,7 @@ index 1e809f9..490fcbd 100644
tests/input/UselessConditions.php 20 0
----------------------------------------------------------------------
-A TOTAL OF 310 ERRORS AND 0 WARNINGS WERE FOUND IN 37 FILES
+A TOTAL OF 384 ERRORS AND 0 WARNINGS WERE FOUND IN 41 FILES
+A TOTAL OF 391 ERRORS AND 0 WARNINGS WERE FOUND IN 41 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 249 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 319 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
Expand Down