Browse Source

fix: fix typing of few properties wrongly typed as non-nullable (#8285)

Dariusz Rumiński 3 months ago
parent
commit
ab83245608

+ 0 - 24
dev-tools/phpstan/baseline.php

@@ -2107,30 +2107,6 @@ $ignoreErrors[] = [
 	'count' => 1,
 	'path' => __DIR__ . '/../../src/RuleSet/RuleSet.php',
 ];
-$ignoreErrors[] = [
-	// identifier: method.notFound
-	'message' => '#^Call to an undefined method object\\:\\:getName\\(\\)\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/../../src/RuleSet/RuleSets.php',
-];
-$ignoreErrors[] = [
-	// identifier: return.type
-	'message' => '#^Method PhpCsFixer\\\\RuleSet\\\\RuleSets\\:\\:getSetDefinitions\\(\\) should return array\\<string, PhpCsFixer\\\\RuleSet\\\\RuleSetDescriptionInterface\\> but returns array\\<int\\|string, object\\>\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/../../src/RuleSet/RuleSets.php',
-];
-$ignoreErrors[] = [
-	// identifier: argument.type
-	'message' => '#^Parameter \\#2 \\$callback of function uksort expects callable\\(int\\|string, int\\|string\\)\\: int, Closure\\(string, string\\)\\: int\\<\\-1, 1\\> given\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/../../src/RuleSet/RuleSets.php',
-];
-$ignoreErrors[] = [
-	// identifier: assign.propertyType
-	'message' => '#^Static property PhpCsFixer\\\\RuleSet\\\\RuleSets\\:\\:\\$setDefinitions \\(array\\<string, PhpCsFixer\\\\RuleSet\\\\RuleSetDescriptionInterface\\>\\) does not accept array\\<int\\|string, object\\>\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/../../src/RuleSet/RuleSets.php',
-];
 $ignoreErrors[] = [
 	// identifier: offsetAccess.notFound
 	'message' => '#^Offset \'action\' might not exist on array\\.$#',

+ 1 - 1
src/Console/ConfigurationResolver.php

@@ -181,7 +181,7 @@ final class ConfigurationResolver
     private $usingCache;
 
     /**
-     * @var FixerFactory
+     * @var null|FixerFactory
      */
     private $fixerFactory;
 

+ 1 - 1
src/Fixer/LanguageConstruct/FunctionToConstantFixer.php

@@ -45,7 +45,7 @@ final class FunctionToConstantFixer extends AbstractFixer implements Configurabl
     use ConfigurableFixerTrait;
 
     /**
-     * @var array<string, list<Token>>
+     * @var null|array<string, list<Token>>
      */
     private static $availableFunctions;
 

+ 1 - 1
src/FixerConfiguration/FixerOptionBuilder.php

@@ -21,7 +21,7 @@ final class FixerOptionBuilder
     private string $description;
 
     /**
-     * @var mixed
+     * @var null|mixed
      */
     private $default;
 

+ 2 - 1
src/RuleSet/RuleSets.php

@@ -24,7 +24,7 @@ use Symfony\Component\Finder\Finder;
 final class RuleSets
 {
     /**
-     * @var array<string, RuleSetDescriptionInterface>
+     * @var null|array<string, RuleSetDescriptionInterface>
      */
     private static $setDefinitions;
 
@@ -38,6 +38,7 @@ final class RuleSets
 
             foreach (Finder::create()->files()->in(__DIR__.'/Sets') as $file) {
                 $class = 'PhpCsFixer\RuleSet\Sets\\'.$file->getBasename('.php');
+                /** @var RuleSetDescriptionInterface */
                 $set = new $class();
 
                 self::$setDefinitions[$set->getName()] = $set;