From f9976096ec345c44195e6776ee35489efe6d4348 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Sun, 18 Jul 2021 11:38:08 +0200 Subject: [PATCH] Require Null Safe Object operator --- lib/Doctrine/ruleset.xml | 2 ++ tests/expected_report.txt | 5 +++-- tests/fixed/null_safe_operator.php | 5 +++++ tests/input/null_safe_operator.php | 5 +++++ tests/php-compatibility.patch | 11 ++++++----- 5 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 tests/fixed/null_safe_operator.php create mode 100644 tests/input/null_safe_operator.php diff --git a/lib/Doctrine/ruleset.xml b/lib/Doctrine/ruleset.xml index 50809b49..d841c154 100644 --- a/lib/Doctrine/ruleset.xml +++ b/lib/Doctrine/ruleset.xml @@ -266,6 +266,8 @@ + + diff --git a/tests/expected_report.txt b/tests/expected_report.txt index c6449260..e249b312 100644 --- a/tests/expected_report.txt +++ b/tests/expected_report.txt @@ -27,6 +27,7 @@ tests/input/new_with_parentheses.php 18 0 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/null_safe_operator.php 1 0 tests/input/optimized-functions.php 1 0 tests/input/PropertyTypeHintSpacing.php 6 0 tests/input/return_type_on_closures.php 21 0 @@ -45,9 +46,9 @@ 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 378 ERRORS AND 0 WARNINGS WERE FOUND IN 42 FILES ---------------------------------------------------------------------- -PHPCBF CAN FIX 313 OF THESE SNIFF VIOLATIONS AUTOMATICALLY +PHPCBF CAN FIX 314 OF THESE SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------- diff --git a/tests/fixed/null_safe_operator.php b/tests/fixed/null_safe_operator.php new file mode 100644 index 00000000..7ce8a3dc --- /dev/null +++ b/tests/fixed/null_safe_operator.php @@ -0,0 +1,5 @@ +property; diff --git a/tests/input/null_safe_operator.php b/tests/input/null_safe_operator.php new file mode 100644 index 00000000..5bbb636c --- /dev/null +++ b/tests/input/null_safe_operator.php @@ -0,0 +1,5 @@ +property; diff --git a/tests/php-compatibility.patch b/tests/php-compatibility.patch index 1301ea75..8af185ad 100644 --- a/tests/php-compatibility.patch +++ b/tests/php-compatibility.patch @@ -11,7 +11,7 @@ index fd5432c..233e24d 100644 tests/input/forbidden-comments.php 14 0 tests/input/forbidden-functions.php 6 0 tests/input/inline_type_hint_assertions.php 7 0 -@@ -23,9 +23,9 @@ tests/input/LowCaseTypes.php 2 0 +@@ -23,10 +23,10 @@ tests/input/LowCaseTypes.php 2 0 tests/input/namespaces-spacing.php 7 0 tests/input/NamingCamelCase.php 6 0 tests/input/negation-operator.php 2 0 @@ -21,6 +21,7 @@ index fd5432c..233e24d 100644 -tests/input/null_coalesce_equal_operator.php 1 0 +tests/input/null_coalesce_equal_operator.php 5 0 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 @@ -39,15 +39,15 @@ tests/input/superfluous-naming.php 11 0 @@ -34,11 +35,11 @@ index fd5432c..233e24d 100644 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 378 ERRORS AND 0 WARNINGS WERE FOUND IN 42 FILES ++A TOTAL OF 387 ERRORS AND 0 WARNINGS WERE FOUND IN 42 FILES ---------------------------------------------------------------------- --PHPCBF CAN FIX 313 OF THESE SNIFF VIOLATIONS AUTOMATICALLY -+PHPCBF CAN FIX 322 OF THESE SNIFF VIOLATIONS AUTOMATICALLY +-PHPCBF CAN FIX 314 OF THESE SNIFF VIOLATIONS AUTOMATICALLY ++PHPCBF CAN FIX 323 OF THESE SNIFF VIOLATIONS AUTOMATICALLY ----------------------------------------------------------------------