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

Merge 9.0.x up into 10.0.x #271

Merged
merged 8 commits into from Jun 26, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/continuous-integration.yml
Expand Up @@ -90,10 +90,11 @@ jobs:
strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -126,9 +127,10 @@ jobs:
strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.4"
- "8.0"
- "8.1"

steps:
- name: "Checkout"
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Expand Up @@ -28,9 +28,16 @@ update-compatibility-patch-80:
@git apply tests/php80-compatibility.patch
@printf "Please open your editor and apply your changes\n"
@until [ "$${compatibility_resolved}" == "y" ]; do read -p "Have finished your changes (y|n)? " compatibility_resolved; done && compatibility_resolved=
@git diff -- tests/expected_report.txt tests/fixed tests/input > .tmp-patch-80 && mv .tmp-patch-80 tests/php80-compatibility.patch && git apply -R tests/php80-compatibility.patch
@git diff -- tests/expected_report.txt tests/fixed tests/input > .tmp-patch && mv .tmp-patch tests/php80-compatibility.patch && git apply -R tests/php80-compatibility.patch
@git commit -m 'Update compatibility patch' tests/php80-compatibility.patch

update-compatibility-patch-81:
@git apply tests/php81-compatibility.patch
@printf "Please open your editor and apply your changes\n"
@until [ "$${compatibility_resolved}" == "y" ]; do read -p "Have finished your changes (y|n)? " compatibility_resolved; done && compatibility_resolved=
@git diff -- tests/expected_report.txt tests/fixed tests/input > .tmp-patch && mv .tmp-patch tests/php81-compatibility.patch && git apply -R tests/php81-compatibility.patch
simPod marked this conversation as resolved.
Show resolved Hide resolved
@git commit -m 'Update compatibility patch' tests/php81-compatibility.patch

vendor: composer.json
composer update
touch -c vendor
6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -21,10 +21,10 @@
{"name": "Steve Müller", "email": "st.mueller@dzh-online.de"}
],
"require": {
"php": "^7.1 || ^8.0",
"php": "^7.2 || ^8.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7",
"slevomat/coding-standard": "^7.0.0",
"squizlabs/php_codesniffer": "^3.6.0"
"slevomat/coding-standard": "^8",
"squizlabs/php_codesniffer": "^3.7"
},
"config": {
"sort-packages": true
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/ruleset.xml
Expand Up @@ -133,6 +133,8 @@
</rule>
<!-- Require usage of ::class instead of __CLASS__, get_class(), get_class($this), get_called_class() and get_parent_class() -->
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
<!-- https://github.com/slevomat/coding-standard#slevomatcodingstandardclassespropertydeclaration- -->
<rule ref="SlevomatCodingStandard.Classes.PropertyDeclaration"/>
<!-- Forbid uses of multiple traits separated by comma -->
<rule ref="SlevomatCodingStandard.Classes.TraitUseDeclaration"/>
<!-- Require no spaces before trait use, between trait uses and one space after trait uses -->
Expand Down Expand Up @@ -416,7 +418,6 @@
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHintSpacing"/>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<properties>
<property name="traversableTypeHints" type="array">
Expand Down
2 changes: 1 addition & 1 deletion tests/expected_report.txt
Expand Up @@ -28,7 +28,7 @@ tests/input/not_spacing.php 8 0
tests/input/null_coalesce_equal_operator.php 1 0
tests/input/null_coalesce_operator.php 3 0
tests/input/optimized-functions.php 1 0
tests/input/PropertyTypeHintSpacing.php 6 0
tests/input/PropertyDeclaration.php 6 0
tests/input/return_type_on_closures.php 21 0
tests/input/return_type_on_methods.php 17 0
tests/input/semicolon_spacing.php 3 0
Expand Down
2 changes: 1 addition & 1 deletion tests/fixed/EarlyReturn.php
Expand Up @@ -13,7 +13,7 @@ public function bar(): bool

public function foo(): ?string
{
foreach ($itens as $item) {
foreach ($items as $item) {
if (! $item->isItem()) {
return 'There is an item that is not an item';
}
Expand Down
Expand Up @@ -4,7 +4,7 @@

namespace Spacing;

final class PropertyTypeHintSpacing
final class PropertyDeclaration
{
public bool $boolPropertyWithDefaultValue = false;
public string $stringProperty;
Expand Down
2 changes: 1 addition & 1 deletion tests/input/EarlyReturn.php
Expand Up @@ -17,7 +17,7 @@ public function bar(): bool

public function foo(): ?string
{
foreach ($itens as $item) {
foreach ($items as $item) {
if (! ($item->isItem())) {
return 'There is an item that is not an item';
} else {
Expand Down
Expand Up @@ -4,7 +4,7 @@

namespace Spacing;

final class PropertyTypeHintSpacing
final class PropertyDeclaration
{
public bool $boolPropertyWithDefaultValue = false;
public string $stringProperty;
Expand Down
2 changes: 1 addition & 1 deletion tests/php74-compatibility.patch
Expand Up @@ -22,7 +22,7 @@ index c644926..7d122d2 100644
+tests/input/null_coalesce_equal_operator.php 5 0
tests/input/null_coalesce_operator.php 3 0
tests/input/optimized-functions.php 1 0
tests/input/PropertyTypeHintSpacing.php 6 0
tests/input/PropertyDeclaration.php 6 0
@@ -35,19 +35,20 @@ tests/input/semicolon_spacing.php 3 0
tests/input/single-line-array-spacing.php 5 0
tests/input/spread-operator.php 6 0
Expand Down
43 changes: 25 additions & 18 deletions tests/php80-compatibility.patch
@@ -1,8 +1,8 @@
diff --git a/tests/expected_report.txt b/tests/expected_report.txt
index c644926..d2640a7 100644
index 476a58b..54630dd 100644
--- a/tests/expected_report.txt
+++ b/tests/expected_report.txt
@@ -14,21 +14,22 @@ tests/input/constants-var.php 6 0
@@ -14,40 +14,43 @@ tests/input/constants-var.php 6 0
tests/input/ControlStructures.php 28 0
tests/input/doc-comment-spacing.php 11 0
tests/input/duplicate-assignment-variable.php 1 0
Expand All @@ -26,28 +26,35 @@ index c644926..d2640a7 100644
tests/input/null_coalesce_operator.php 3 0
+tests/input/null_safe_operator.php 1 0
tests/input/optimized-functions.php 1 0
-tests/input/PropertyTypeHintSpacing.php 6 0
+tests/input/PropertyTypeHintSpacing.php 7 0
tests/input/return_type_on_closures.php 21 0
tests/input/return_type_on_methods.php 17 0
-tests/input/PropertyDeclaration.php 6 0
-tests/input/return_type_on_closures.php 21 0
-tests/input/return_type_on_methods.php 17 0
+tests/input/PropertyDeclaration.php 7 0
+tests/input/return_type_on_closures.php 26 0
+tests/input/return_type_on_methods.php 22 0
tests/input/semicolon_spacing.php 3 0
@@ -39,15 +40,15 @@ tests/input/superfluous-naming.php 11 0
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/strings.php 1 0
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/TrailingCommaOnFunctions.php 2 0
tests/input/traits-uses.php 11 0
-tests/input/type-hints.php 4 0
+tests/input/type-hints.php 5 0
+tests/input/type-hints.php 9 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
+tests/input/UselessConditions.php 21 0
----------------------------------------------------------------------
-A TOTAL OF 377 ERRORS AND 0 WARNINGS WERE FOUND IN 41 FILES
+A TOTAL OF 395 ERRORS AND 0 WARNINGS WERE FOUND IN 42 FILES
+A TOTAL OF 412 ERRORS AND 0 WARNINGS WERE FOUND IN 44 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 313 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 331 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 346 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


Expand All @@ -62,7 +69,7 @@ index 5a82a93..7d5eb01 100644
- public function foo(): ?string
+ public function foo(): string|null
{
foreach ($itens as $item) {
foreach ($items as $item) {
if (! $item->isItem()) {
diff --git a/tests/fixed/NamingCamelCase.php b/tests/fixed/NamingCamelCase.php
index 57d9f2b..5493471 100644
Expand All @@ -86,19 +93,19 @@ index 57d9f2b..5493471 100644

public function fcn(string $A): void
{
diff --git a/tests/fixed/PropertyTypeHintSpacing.php b/tests/fixed/PropertyTypeHintSpacing.php
index 1421913..d52353c 100644
--- a/tests/fixed/PropertyTypeHintSpacing.php
+++ b/tests/fixed/PropertyTypeHintSpacing.php
@@ -9,5 +9,5 @@ final class PropertyTypeHintSpacing
diff --git a/tests/fixed/PropertyDeclaration.php b/tests/fixed/PropertyDeclaration.php
index 5c3f27b..7f286ad 100644
--- a/tests/fixed/PropertyDeclaration.php
+++ b/tests/fixed/PropertyDeclaration.php
@@ -9,5 +9,5 @@ final class PropertyDeclaration
public bool $boolPropertyWithDefaultValue = false;
public string $stringProperty;
public int $intProperty;
- public ?string $nullableString = null;
+ public string|null $nullableString = null;
}
diff --git a/tests/fixed/TrailingCommaOnFunctions.php b/tests/fixed/TrailingCommaOnFunctions.php
index ed304c9..001650f 100644
index 6e5cca4..c5fdccb 100644
--- a/tests/fixed/TrailingCommaOnFunctions.php
+++ b/tests/fixed/TrailingCommaOnFunctions.php
@@ -11,7 +11,7 @@ class TrailingCommaOnFunctions
Expand Down Expand Up @@ -337,7 +344,7 @@ index 10e6f34..5e26ed8 100644
+ private int|string|null $x = 1;
}
diff --git a/tests/input/TrailingCommaOnFunctions.php b/tests/input/TrailingCommaOnFunctions.php
index ed304c9..e383ee2 100644
index 6e5cca4..1d24bb6 100644
--- a/tests/input/TrailingCommaOnFunctions.php
+++ b/tests/input/TrailingCommaOnFunctions.php
@@ -6,7 +6,7 @@ namespace Doctrine;
Expand Down