Browse Source

DX: Add more type hints (#6383)

SpacePossum 2 years ago
parent
commit
e8c11696a9

+ 1 - 1
src/AbstractPhpdocTypesFixer.php

@@ -33,7 +33,7 @@ abstract class AbstractPhpdocTypesFixer extends AbstractFixer
      *
      * @var string[]
      */
-    protected $tags;
+    protected array $tags;
 
     /**
      * {@inheritdoc}

+ 1 - 1
src/AbstractProxyFixer.php

@@ -28,7 +28,7 @@ abstract class AbstractProxyFixer extends AbstractFixer
     /**
      * @var array<string, FixerInterface>
      */
-    protected $proxyFixers;
+    protected array $proxyFixers = [];
 
     public function __construct()
     {

+ 1 - 4
src/Console/ConfigurationResolver.php

@@ -75,10 +75,7 @@ final class ConfigurationResolver
      */
     private $configFile;
 
-    /**
-     * @var string
-     */
-    private $cwd;
+    private string $cwd;
 
     private ConfigInterface $defaultConfig;
 

+ 1 - 1
src/DocBlock/Annotation.php

@@ -48,7 +48,7 @@ final class Annotation
      *
      * @var Line[]
      */
-    private $lines;
+    private array $lines;
 
     /**
      * The position of the first line of the annotation in the docblock.

+ 1 - 4
src/DocBlock/DocBlock.php

@@ -41,10 +41,7 @@ final class DocBlock
      */
     private $annotations;
 
-    /**
-     * @var null|NamespaceAnalysis
-     */
-    private $namespace;
+    private ?NamespaceAnalysis $namespace;
 
     /**
      * @var NamespaceUseAnalysis[]

+ 3 - 9
src/DocBlock/TypeExpression.php

@@ -105,10 +105,7 @@ final class TypeExpression
     )
     ';
 
-    /**
-     * @var string
-     */
-    private $value;
+    private string $value;
 
     private bool $isUnionType = false;
 
@@ -119,15 +116,12 @@ final class TypeExpression
 
     private string $typesGlue = '|';
 
-    /**
-     * @var null|NamespaceAnalysis
-     */
-    private $namespace;
+    private ?NamespaceAnalysis $namespace;
 
     /**
      * @var NamespaceUseAnalysis[]
      */
-    private $namespaceUses;
+    private array $namespaceUses;
 
     /**
      * @param NamespaceUseAnalysis[] $namespaceUses

+ 1 - 4
src/Documentation/DocumentationLocator.php

@@ -23,10 +23,7 @@ use PhpCsFixer\Utils;
  */
 final class DocumentationLocator
 {
-    /**
-     * @var string
-     */
-    private $path;
+    private string $path;
 
     public function __construct()
     {

+ 2 - 8
src/Error/Error.php

@@ -42,17 +42,11 @@ final class Error
 
     private string $filePath;
 
-    /**
-     * @var null|\Throwable
-     */
-    private $source;
+    private ?\Throwable $source;
 
     private array $appliedFixers;
 
-    /**
-     * @var null|string
-     */
-    private $diff;
+    private ?string $diff;
 
     public function __construct(int $type, string $filePath, ?\Throwable $source = null, array $appliedFixers = [], ?string $diff = null)
     {

+ 1 - 1
src/Fixer/Alias/MbStrFunctionsFixer.php

@@ -49,7 +49,7 @@ final class MbStrFunctionsFixer extends AbstractFunctionReferenceFixer
     /**
      * @var array<string, array>
      */
-    private $functions;
+    private array $functions;
 
     public function __construct()
     {

+ 1 - 4
src/Fixer/Basic/EncodingFixer.php

@@ -28,10 +28,7 @@ use PhpCsFixer\Tokenizer\Tokens;
  */
 final class EncodingFixer extends AbstractFixer
 {
-    /**
-     * @var string
-     */
-    private $BOM;
+    private string $BOM;
 
     public function __construct()
     {

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