Browse Source

Merge branch '2.18'

Dariusz Ruminski 4 years ago
parent
commit
e70b0aab46

+ 6 - 0
src/RuleSet/RuleSet.php

@@ -12,6 +12,8 @@
 
 namespace PhpCsFixer\RuleSet;
 
+use PhpCsFixer\ConfigurationException\InvalidFixerConfigurationException;
+
 /**
  * Set of rules to be used by fixer.
  *
@@ -41,6 +43,10 @@ class RuleSet implements RuleSetInterface
             if (\is_int($key)) {
                 throw new \InvalidArgumentException(sprintf('Missing value for "%s" rule/set.', $value));
             }
+
+            if (true !== $value && false !== $value && !\is_array($value)) {
+                throw new InvalidFixerConfigurationException($key, 'Configuration must be an array and may not be empty.');
+            }
         }
 
         $this->resolveSet($set);

+ 1 - 1
tests/Console/ConfigurationResolverTest.php

@@ -231,7 +231,7 @@ final class ConfigurationResolverTest extends TestCase
         $resolver = $this->createConfigurationResolver(
             ['path' => [$path]],
             null,
-            $cwdPath
+            $cwdPath ?: ''
         );
 
         static::assertSame($expectedFile, $resolver->getConfigFile());

+ 3 - 3
tests/DocBlock/ShortDescriptionTest.php

@@ -24,12 +24,12 @@ use PhpCsFixer\Tests\TestCase;
 final class ShortDescriptionTest extends TestCase
 {
     /**
-     * @param mixed      $expected
-     * @param null|mixed $input
+     * @param null|int $expected
+     * @param string   $input
      *
      * @dataProvider provideGetEndCases
      */
-    public function testGetEnd($expected, $input = null)
+    public function testGetEnd($expected, $input)
     {
         $doc = new DocBlock($input);
         $shortDescription = new ShortDescription($doc);

+ 2 - 2
tests/Fixer/ControlStructure/NoAlternativeSyntaxFixerTest.php

@@ -26,8 +26,8 @@ final class NoAlternativeSyntaxFixerTest extends AbstractFixerTestCase
     /**
      * @dataProvider provideFixCases
      *
-     * @param mixed      $expected
-     * @param null|mixed $input
+     * @param string      $expected
+     * @param null|string $input
      */
     public function testFix($expected, $input = null)
     {

+ 2 - 2
tests/Fixer/LanguageConstruct/DeclareEqualNormalizeFixerTest.php

@@ -38,8 +38,8 @@ final class DeclareEqualNormalizeFixerTest extends AbstractFixerTestCase
     }
 
     /**
-     * @param string $expected
-     * @param string $input
+     * @param string      $expected
+     * @param null|string $input
      *
      * @dataProvider provideFixCases
      */

+ 4 - 4
tests/Fixer/Naming/NoHomoglyphNamesFixerTest.php

@@ -26,8 +26,8 @@ final class NoHomoglyphNamesFixerTest extends AbstractFixerTestCase
     /**
      * @dataProvider provideFixCases
      *
-     * @param mixed      $expected
-     * @param null|mixed $input
+     * @param string      $expected
+     * @param null|string $input
      */
     public function testFix($expected, $input = null)
     {
@@ -106,8 +106,8 @@ final class NoHomoglyphNamesFixerTest extends AbstractFixerTestCase
      * @dataProvider provideFix74Cases
      * @requires PHP 7.4
      *
-     * @param mixed      $expected
-     * @param null|mixed $input
+     * @param string      $expected
+     * @param null|string $input
      */
     public function testFix74($expected, $input = null)
     {

+ 3 - 3
tests/Fixer/PhpUnit/PhpUnitInternalClassFixerTest.php

@@ -26,9 +26,9 @@ final class PhpUnitInternalClassFixerTest extends AbstractFixerTestCase
     /**
      * @dataProvider provideFixCases
      *
-     * @param string     $expected
-     * @param null|mixed $input
-     * @param array      $config
+     * @param string      $expected
+     * @param null|string $input
+     * @param array       $config
      */
     public function testFix($expected, $input = null, $config = [])
     {

+ 2 - 2
tests/Fixer/PhpUnit/PhpUnitMethodCasingFixerTest.php

@@ -38,8 +38,8 @@ final class PhpUnitMethodCasingFixerTest extends AbstractFixerTestCase
     /**
      * @dataProvider provideFixCases
      *
-     * @param mixed      $camelExpected
-     * @param null|mixed $camelInput
+     * @param string      $camelExpected
+     * @param null|string $camelInput
      */
     public function testFixToSnakeCase($camelExpected, $camelInput = null)
     {

+ 3 - 3
tests/Fixer/PhpUnit/PhpUnitSizeClassFixerTest.php

@@ -26,9 +26,9 @@ final class PhpUnitSizeClassFixerTest extends AbstractFixerTestCase
     /**
      * @dataProvider provideFixCases
      *
-     * @param string     $expected
-     * @param null|mixed $input
-     * @param array      $config
+     * @param string      $expected
+     * @param null|string $input
+     * @param array       $config
      */
     public function testFix($expected, $input = null, $config = [])
     {

+ 3 - 3
tests/Test/AbstractIntegrationCaseFactory.php

@@ -77,7 +77,7 @@ abstract class AbstractIntegrationCaseFactory implements IntegrationCaseFactoryI
     /**
      * Parses the '--CONFIG--' block of a '.test' file.
      *
-     * @param string $config
+     * @param ?string $config
      *
      * @return array
      */
@@ -108,7 +108,7 @@ abstract class AbstractIntegrationCaseFactory implements IntegrationCaseFactoryI
     /**
      * Parses the '--REQUIREMENTS--' block of a '.test' file and determines requirements.
      *
-     * @param string $config
+     * @param ?string $config
      *
      * @return array
      */
@@ -155,7 +155,7 @@ abstract class AbstractIntegrationCaseFactory implements IntegrationCaseFactoryI
     /**
      * Parses the '--SETTINGS--' block of a '.test' file and determines settings.
      *
-     * @param string $config
+     * @param ?string $config
      *
      * @return array
      */

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