Browse Source

AbstractFunctionReferenceFixerTest::testCountArguments - remove extra parameter

Dariusz Ruminski 8 years ago
parent
commit
a7da7e9e47
3 changed files with 10 additions and 10 deletions
  1. 3 3
      README.rst
  2. 1 1
      src/AbstractFunctionReferenceFixer.php
  3. 6 6
      tests/AbstractFunctionReferenceFixerTest.php

+ 3 - 3
README.rst

@@ -501,7 +501,7 @@ Choose from the list of available fixers:
 * **phpdoc_var_without_name** [@Symfony]
    @var and @type annotations should not contain the variable name.
 
-* **pow_to_exponentiation**
+* **pow_to_exponentiation** [@PHP56Migration, @PHP70Migration, @PHP71Migration]
    Converts 'pow()' to '**'. (Risky fixer!)
 
 * **pre_increment** [@Symfony]
@@ -518,7 +518,7 @@ Choose from the list of available fixers:
 * **psr4**
    Class names should match the file name. (Risky fixer!)
 
-* **random_api_migration** [@PHP70Migration]
+* **random_api_migration** [@PHP70Migration, @PHP71Migration]
    Replaces rand, srand, getrandmax functions calls with their mt_*
    analogs. (Risky fixer!)
 
@@ -606,7 +606,7 @@ Choose from the list of available fixers:
 * **unix_line_endings** [@PSR2, @Symfony]
    All PHP files must use the Unix LF line ending.
 
-* **visibility_required** [@PSR2, @Symfony]
+* **visibility_required** [@PSR2, @Symfony, @PHP71Migration]
    Visibility MUST be declared on all properties and methods; abstract and
    final MUST be declared before the visibility; static MUST be declared
    after the visibility.

+ 1 - 1
src/AbstractFunctionReferenceFixer.php

@@ -66,7 +66,7 @@ abstract class AbstractFunctionReferenceFixer extends AbstractFixer
         $matches = $tokens->findSequence($candidateSequence, $start, $end, false);
         if (null === $matches) {
             // not found, simply return without further attempts
-            return null;
+            return;
         }
 
         // translate results for humans

+ 6 - 6
tests/AbstractFunctionReferenceFixerTest.php

@@ -25,22 +25,22 @@ final class AbstractFunctionReferenceFixerTest extends \PHPUnit_Framework_TestCa
     /**
      * @dataProvider provideCases
      */
-    public function testCountArguments($code, $openIndex, $closeIndex, $argumentsCount, $arguments)
+    public function testCountArguments($code, $openIndex, $closeIndex, array $arguments)
     {
         $tokens = Tokens::fromCode($code);
         $mock = new AccessibleObject($this->getMockForAbstractClass('\\PhpCsFixer\\AbstractFunctionReferenceFixer'));
 
-        $this->assertSame($argumentsCount, $mock->countArguments($tokens, $openIndex, $closeIndex));
+        $this->assertSame(count($arguments), $mock->countArguments($tokens, $openIndex, $closeIndex));
         $this->assertSame($arguments, $mock->getArguments($tokens, $openIndex, $closeIndex));
     }
 
     public function provideCases()
     {
         return array(
-            array('<?php fnc();', 2, 3, 0, array()),
-            array('<?php fnc($a);', 2, 4, 1, array(3 => 3)),
-            array('<?php fnc($a, $b);', 2, 7, 2, array(3 => 3, 5 => 6)),
-            array('<?php fnc($a, $b = array(1,2), $c = 3);', 2, 23, 3, array(3 => 3, 5 => 15, 17 => 22)),
+            array('<?php fnc();', 2, 3, array()),
+            array('<?php fnc($a);', 2, 4, array(3 => 3)),
+            array('<?php fnc($a, $b);', 2, 7, array(3 => 3, 5 => 6)),
+            array('<?php fnc($a, $b = array(1,2), $c = 3);', 2, 23, array(3 => 3, 5 => 15, 17 => 22)),
         );
     }
 }