Browse Source

Merge branch 'master' into 3.0

# Conflicts:
#	doc/ruleSets/PHP56Migration.rst
#	doc/ruleSets/index.rst
#	src/RuleSet/Sets/PHP56MigrationSet.php
Dariusz Ruminski 4 years ago
parent
commit
bfe83d72b0

+ 12 - 0
doc/ruleSets/PHP54Migration.rst

@@ -0,0 +1,12 @@
+============================
+Rule set ``@PHP54Migration``
+============================
+
+Rules to improve code for PHP 5.6 compatibility.
+
+Rules
+-----
+
+- `array_syntax <./../rules/array_notation/array_syntax.rst>`_
+  config:
+  ``['syntax' => 'short']``

+ 1 - 0
doc/ruleSets/PHP70Migration.rst

@@ -7,4 +7,5 @@ Rules to improve code for PHP 7.0 compatibility.
 Rules
 -----
 
+- `@PHP54Migration <./PHP54Migration.rst>`_
 - `ternary_to_null_coalescing <./../rules/operator/ternary_to_null_coalescing.rst>`_

+ 3 - 0
doc/ruleSets/PHP71Migration.rst

@@ -8,6 +8,9 @@ Rules
 -----
 
 - `@PHP70Migration <./PHP70Migration.rst>`_
+- `list_syntax <./../rules/list_notation/list_syntax.rst>`_
+  config:
+  ``['syntax' => 'short']``
 - `visibility_required <./../rules/class_notation/visibility_required.rst>`_
   config:
   ``['elements' => ['const', 'method', 'property']]``

+ 1 - 1
doc/ruleSets/PSR12.rst

@@ -2,7 +2,7 @@
 Rule set ``@PSR12``
 ===================
 
-Rules that follow `PSR-2 <https://www.php-fig.org/psr/psr-2/>`_ standard.
+Rules that follow `PSR-12 <https://www.php-fig.org/psr/psr-12/>`_ standard.
 
 Rules
 -----

+ 1 - 1
doc/ruleSets/PSR12Risky.rst

@@ -2,7 +2,7 @@
 Rule set ``@PSR12:risky``
 =========================
 
-Rules that follow `PSR-2 <https://www.php-fig.org/psr/psr-2/>`_ standard. This set contains rules that are risky.
+Rules that follow `PSR-12 <https://www.php-fig.org/psr/psr-12/>`_ standard. This set contains rules that are risky.
 
 Rules
 -----

+ 1 - 0
doc/ruleSets/index.rst

@@ -2,6 +2,7 @@
 List of Available Rule sets
 ===========================
 - `@DoctrineAnnotation <./DoctrineAnnotation.rst>`_
+- `@PHP54Migration <./PHP54Migration.rst>`_
 - `@PHP56Migration:risky <./PHP56MigrationRisky.rst>`_
 - `@PHP70Migration <./PHP70Migration.rst>`_
 - `@PHP70Migration:risky <./PHP70MigrationRisky.rst>`_

+ 30 - 0
doc/rules/array_notation/array_syntax.rst

@@ -52,6 +52,36 @@ Rule sets
 
 The rule is part of the following rule sets:
 
+@PHP54Migration
+  Using the `@PHP54Migration <./../../ruleSets/PHP54Migration.rst>`_ rule set will enable the ``array_syntax`` rule with the config below:
+
+  ``['syntax' => 'short']``
+
+@PHP70Migration
+  Using the `@PHP70Migration <./../../ruleSets/PHP70Migration.rst>`_ rule set will enable the ``array_syntax`` rule with the config below:
+
+  ``['syntax' => 'short']``
+
+@PHP71Migration
+  Using the `@PHP71Migration <./../../ruleSets/PHP71Migration.rst>`_ rule set will enable the ``array_syntax`` rule with the config below:
+
+  ``['syntax' => 'short']``
+
+@PHP73Migration
+  Using the `@PHP73Migration <./../../ruleSets/PHP73Migration.rst>`_ rule set will enable the ``array_syntax`` rule with the config below:
+
+  ``['syntax' => 'short']``
+
+@PHP74Migration
+  Using the `@PHP74Migration <./../../ruleSets/PHP74Migration.rst>`_ rule set will enable the ``array_syntax`` rule with the config below:
+
+  ``['syntax' => 'short']``
+
+@PHP80Migration
+  Using the `@PHP80Migration <./../../ruleSets/PHP80Migration.rst>`_ rule set will enable the ``array_syntax`` rule with the config below:
+
+  ``['syntax' => 'short']``
+
 @PhpCsFixer
   Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``array_syntax`` rule with the config below:
 

+ 25 - 0
doc/rules/list_notation/list_syntax.rst

@@ -47,3 +47,28 @@ With configuration: ``['syntax' => 'short']``.
     <?php
    -list($sample) = $array;
    +[$sample] = $array;
+
+Rule sets
+---------
+
+The rule is part of the following rule sets:
+
+@PHP71Migration
+  Using the `@PHP71Migration <./../../ruleSets/PHP71Migration.rst>`_ rule set will enable the ``list_syntax`` rule with the config below:
+
+  ``['syntax' => 'short']``
+
+@PHP73Migration
+  Using the `@PHP73Migration <./../../ruleSets/PHP73Migration.rst>`_ rule set will enable the ``list_syntax`` rule with the config below:
+
+  ``['syntax' => 'short']``
+
+@PHP74Migration
+  Using the `@PHP74Migration <./../../ruleSets/PHP74Migration.rst>`_ rule set will enable the ``list_syntax`` rule with the config below:
+
+  ``['syntax' => 'short']``
+
+@PHP80Migration
+  Using the `@PHP80Migration <./../../ruleSets/PHP80Migration.rst>`_ rule set will enable the ``list_syntax`` rule with the config below:
+
+  ``['syntax' => 'short']``

+ 4 - 4
phpunit.xml.dist

@@ -15,14 +15,14 @@
     convertErrorsToExceptions="true"
     convertNoticesToExceptions="true"
     convertWarningsToExceptions="true"
-    defaultTimeLimit="3"
+    defaultTimeLimit="10"
     enforceTimeLimit="true"
     failOnWarning="true"
     processIsolation="false"
     stopOnFailure="false"
-    timeoutForSmallTests="3"
-    timeoutForMediumTests="6"
-    timeoutForLargeTests="9"
+    timeoutForSmallTests="10"
+    timeoutForMediumTests="20"
+    timeoutForLargeTests="30"
     verbose="false"
 >
     <testsuites>

+ 12 - 6
src/Fixer/PhpUnit/PhpUnitMethodCasingFixer.php

@@ -126,16 +126,22 @@ class MyTest extends \\PhpUnit\\FrameWork\\TestCase
      */
     private function updateMethodCasing($functionName)
     {
+        $parts = explode('::', $functionName);
+
+        $functionNamePart = array_pop($parts);
+
         if (self::CAMEL_CASE === $this->configuration['case']) {
-            $newFunctionName = $functionName;
-            $newFunctionName = ucwords($newFunctionName, '_');
-            $newFunctionName = str_replace('_', '', $newFunctionName);
-            $newFunctionName = lcfirst($newFunctionName);
+            $newFunctionNamePart = $functionNamePart;
+            $newFunctionNamePart = ucwords($newFunctionNamePart, '_');
+            $newFunctionNamePart = str_replace('_', '', $newFunctionNamePart);
+            $newFunctionNamePart = lcfirst($newFunctionNamePart);
         } else {
-            $newFunctionName = Utils::camelCaseToUnderscore($functionName);
+            $newFunctionNamePart = Utils::camelCaseToUnderscore($functionNamePart);
         }
 
-        return $newFunctionName;
+        $parts[] = $newFunctionNamePart;
+
+        return implode('::', $parts);
     }
 
     /**

Some files were not shown because too many files changed in this diff