diff --git a/src/Analyser/DirectScopeFactory.php b/src/Analyser/DirectScopeFactory.php index 3b669627fd4..eb4f890e06e 100644 --- a/src/Analyser/DirectScopeFactory.php +++ b/src/Analyser/DirectScopeFactory.php @@ -45,8 +45,7 @@ public function __construct( } /** - * @param array $constantTypes - * @param FunctionReflection|MethodReflection|null $function + * @param array $constantTypes * @param VariableTypeHolder[] $variablesTypes * @param VariableTypeHolder[] $moreSpecificTypes * @param array $conditionalExpressions @@ -59,7 +58,7 @@ public function create( ScopeContext $context, bool $declareStrictTypes = false, array $constantTypes = [], - $function = null, + FunctionReflection|MethodReflection|null $function = null, ?string $namespace = null, array $variablesTypes = [], array $moreSpecificTypes = [], diff --git a/src/Analyser/Error.php b/src/Analyser/Error.php index a1f938a1c9b..d32a6bf8bf0 100644 --- a/src/Analyser/Error.php +++ b/src/Analyser/Error.php @@ -14,15 +14,12 @@ class Error implements JsonSerializable { - private bool|Throwable $canBeIgnored; - /** @phpstan-var class-string|null */ private ?string $nodeType; /** * Error constructor. * - * @param bool|Throwable $canBeIgnored * @param class-string|null $nodeType * @param mixed[] $metadata */ @@ -30,7 +27,7 @@ public function __construct( private string $message, private string $file, private ?int $line = null, - $canBeIgnored = true, + private bool|Throwable $canBeIgnored = true, private ?string $filePath = null, private ?string $traitFilePath = null, private ?string $tip = null, @@ -40,7 +37,6 @@ public function __construct( private array $metadata = [], ) { - $this->canBeIgnored = $canBeIgnored; $this->nodeType = $nodeType; } diff --git a/src/Analyser/LazyScopeFactory.php b/src/Analyser/LazyScopeFactory.php index a506929d859..3ed6b777c0d 100644 --- a/src/Analyser/LazyScopeFactory.php +++ b/src/Analyser/LazyScopeFactory.php @@ -35,7 +35,6 @@ public function __construct( /** * @param array $constantTypes - * @param FunctionReflection|MethodReflection|null $function * @param VariableTypeHolder[] $variablesTypes * @param VariableTypeHolder[] $moreSpecificTypes * @param array $conditionalExpressions @@ -48,7 +47,7 @@ public function create( ScopeContext $context, bool $declareStrictTypes = false, array $constantTypes = [], - $function = null, + FunctionReflection|MethodReflection|null $function = null, ?string $namespace = null, array $variablesTypes = [], array $moreSpecificTypes = [], diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index e90619f6ec8..eb9c64a699f 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -146,17 +146,11 @@ class MutatingScope implements Scope /** @var Type[] */ private array $resolvedTypes = []; - private FunctionReflection|MethodReflection|null $function = null; - private ?string $namespace; - /** @var VariableTypeHolder[] */ - private array $variableTypes; - /** * @param array $constantTypes - * @param FunctionReflection|MethodReflection|null $function - * @param VariableTypeHolder[] $variablesTypes + * @param VariableTypeHolder[] $variableTypes * @param VariableTypeHolder[] $moreSpecificTypes * @param array $conditionalExpressions * @param array $currentlyAssignedExpressions @@ -178,9 +172,9 @@ public function __construct( private PhpVersion $phpVersion, private bool $declareStrictTypes = false, private array $constantTypes = [], - $function = null, + private FunctionReflection|MethodReflection|null $function = null, ?string $namespace = null, - array $variablesTypes = [], + private array $variableTypes = [], private array $moreSpecificTypes = [], private array $conditionalExpressions = [], private ?string $inClosureBindScopeClass = null, @@ -199,9 +193,7 @@ public function __construct( $namespace = null; } - $this->function = $function; $this->namespace = $namespace; - $this->variableTypes = $variablesTypes; } /** @api */ diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php index 4d4048e16b3..3340dafcba9 100644 --- a/src/Analyser/NodeScopeResolver.php +++ b/src/Analyser/NodeScopeResolver.php @@ -154,9 +154,6 @@ class NodeScopeResolver private const LOOP_SCOPE_ITERATIONS = 3; private const GENERALIZE_AFTER_ITERATION = 1; - /** @var string[][] className(string) => methods(string[]) */ - private array $earlyTerminatingMethodCalls; - /** @var bool[] filePath(string) => bool(true) */ private array $analysedFiles = []; @@ -178,12 +175,11 @@ public function __construct( private DynamicThrowTypeExtensionProvider $dynamicThrowTypeExtensionProvider, private bool $polluteScopeWithLoopInitialAssignments, private bool $polluteScopeWithAlwaysIterableForeach, - array $earlyTerminatingMethodCalls, + private array $earlyTerminatingMethodCalls, private array $earlyTerminatingFunctionCalls, private bool $implicitThrows, ) { - $this->earlyTerminatingMethodCalls = $earlyTerminatingMethodCalls; } /** diff --git a/src/Analyser/ResultCache/ResultCacheManager.php b/src/Analyser/ResultCache/ResultCacheManager.php index b0546d81fca..50ebcf3251f 100644 --- a/src/Analyser/ResultCache/ResultCacheManager.php +++ b/src/Analyser/ResultCache/ResultCacheManager.php @@ -74,7 +74,7 @@ public function __construct( private array $bootstrapFiles, private array $scanFiles, private array $scanDirectories, - private array $fileReplacements = [], + private array $fileReplacements, private bool $checkDependenciesOfProjectExtensionFiles, ) { diff --git a/src/Analyser/ScopeFactory.php b/src/Analyser/ScopeFactory.php index 15294d0501e..1d7db30f3e1 100644 --- a/src/Analyser/ScopeFactory.php +++ b/src/Analyser/ScopeFactory.php @@ -13,7 +13,6 @@ interface ScopeFactory /** * @api * @param array $constantTypes - * @param FunctionReflection|MethodReflection|null $function * @param VariableTypeHolder[] $variablesTypes * @param VariableTypeHolder[] $moreSpecificTypes * @param array $conditionalExpressions @@ -26,7 +25,7 @@ public function create( ScopeContext $context, bool $declareStrictTypes = false, array $constantTypes = [], - $function = null, + FunctionReflection|MethodReflection|null $function = null, ?string $namespace = null, array $variablesTypes = [], array $moreSpecificTypes = [], diff --git a/src/Command/InceptionResult.php b/src/Command/InceptionResult.php index b59d2d8014e..35ad6672222 100644 --- a/src/Command/InceptionResult.php +++ b/src/Command/InceptionResult.php @@ -16,7 +16,7 @@ class InceptionResult /** * @param callable(): (array{string[], bool}) $filesCallback - * @param mixed[] $projectConfigArray + * @param mixed[]|null $projectConfigArray */ public function __construct( callable $filesCallback, diff --git a/src/Node/BooleanAndNode.php b/src/Node/BooleanAndNode.php index e931dbc22b1..c4b750de009 100644 --- a/src/Node/BooleanAndNode.php +++ b/src/Node/BooleanAndNode.php @@ -11,15 +11,9 @@ class BooleanAndNode extends NodeAbstract implements VirtualNode { - private BooleanAnd|LogicalAnd $originalNode; - - /** - * @param BooleanAnd|LogicalAnd $originalNode - */ - public function __construct($originalNode, private Scope $rightScope) + public function __construct(private BooleanAnd|LogicalAnd $originalNode, private Scope $rightScope) { parent::__construct($originalNode->getAttributes()); - $this->originalNode = $originalNode; } /** diff --git a/src/Node/BooleanOrNode.php b/src/Node/BooleanOrNode.php index 9d20b0a0cd2..fb0e04134ae 100644 --- a/src/Node/BooleanOrNode.php +++ b/src/Node/BooleanOrNode.php @@ -11,15 +11,9 @@ class BooleanOrNode extends NodeAbstract implements VirtualNode { - private BooleanOr|LogicalOr $originalNode; - - /** - * @param BooleanOr|LogicalOr $originalNode - */ - public function __construct($originalNode, private Scope $rightScope) + public function __construct(private BooleanOr|LogicalOr $originalNode, private Scope $rightScope) { parent::__construct($originalNode->getAttributes()); - $this->originalNode = $originalNode; } /** diff --git a/src/Node/ClassPropertyNode.php b/src/Node/ClassPropertyNode.php index 5dbbbcf19ac..b45d2fd931b 100644 --- a/src/Node/ClassPropertyNode.php +++ b/src/Node/ClassPropertyNode.php @@ -13,15 +13,10 @@ class ClassPropertyNode extends NodeAbstract implements VirtualNode { - private Identifier|Name|Node\ComplexType|null $type = null; - - /** - * @param Identifier|Name|Node\ComplexType|null $type - */ public function __construct( private string $name, private int $flags, - $type, + private Identifier|Name|Node\ComplexType|null $type, private ?Expr $default, private ?string $phpDoc, private bool $isPromoted, @@ -29,7 +24,6 @@ public function __construct( ) { parent::__construct($originalNode->getAttributes()); - $this->type = $type; } public function getName(): string diff --git a/src/Node/FunctionCallableNode.php b/src/Node/FunctionCallableNode.php index d25b07dbe50..4b2c5589d90 100644 --- a/src/Node/FunctionCallableNode.php +++ b/src/Node/FunctionCallableNode.php @@ -9,16 +9,12 @@ class FunctionCallableNode extends Expr implements VirtualNode { - private Name|Expr $name; - /** - * @param Expr|Name $name * @param mixed[] $attributes */ - public function __construct($name, array $attributes = []) + public function __construct(private Name|Expr $name, array $attributes = []) { parent::__construct($attributes); - $this->name = $name; } /** diff --git a/src/Node/InstantiationCallableNode.php b/src/Node/InstantiationCallableNode.php index 5823c26565c..acf9a44bf93 100644 --- a/src/Node/InstantiationCallableNode.php +++ b/src/Node/InstantiationCallableNode.php @@ -9,16 +9,12 @@ class InstantiationCallableNode extends Expr implements VirtualNode { - private Name|Expr $class; - /** - * @param Expr|Name $class * @param mixed[] $attributes */ - public function __construct($class, array $attributes = []) + public function __construct(private Name|Expr $class, array $attributes = []) { parent::__construct($attributes); - $this->class = $class; } /** diff --git a/src/Node/Method/MethodCall.php b/src/Node/Method/MethodCall.php index aabe70fc6fc..19c77316fb7 100644 --- a/src/Node/Method/MethodCall.php +++ b/src/Node/Method/MethodCall.php @@ -11,14 +11,11 @@ class MethodCall { - private Node\Expr\MethodCall|StaticCall|Array_ $node; - - /** - * @param Node\Expr\MethodCall|StaticCall|Array_ $node - */ - public function __construct($node, private Scope $scope) + public function __construct( + private Node\Expr\MethodCall|StaticCall|Array_ $node, + private Scope $scope, + ) { - $this->node = $node; } /** diff --git a/src/Node/MethodCallableNode.php b/src/Node/MethodCallableNode.php index 2fa679e64c8..aff7b5cefc8 100644 --- a/src/Node/MethodCallableNode.php +++ b/src/Node/MethodCallableNode.php @@ -9,15 +9,13 @@ class MethodCallableNode extends Expr implements VirtualNode { - private Identifier|Expr $name; - - /** - * @param Expr|Identifier $name - */ - public function __construct(private Expr $var, $name, private Expr\MethodCall $originalNode) + public function __construct( + private Expr $var, + private Identifier|Expr $name, + private Expr\MethodCall $originalNode, + ) { parent::__construct($originalNode->getAttributes()); - $this->name = $name; } public function getVar(): Expr diff --git a/src/Node/Property/PropertyRead.php b/src/Node/Property/PropertyRead.php index f95416a5f13..27bc3ba5c47 100644 --- a/src/Node/Property/PropertyRead.php +++ b/src/Node/Property/PropertyRead.php @@ -10,16 +10,11 @@ class PropertyRead { - private PropertyFetch|StaticPropertyFetch $fetch; - - /** - * PropertyWrite constructor. - * - * @param PropertyFetch|StaticPropertyFetch $fetch - */ - public function __construct($fetch, private Scope $scope) + public function __construct( + private PropertyFetch|StaticPropertyFetch $fetch, + private Scope $scope, + ) { - $this->fetch = $fetch; } /** diff --git a/src/Node/Property/PropertyWrite.php b/src/Node/Property/PropertyWrite.php index 06e0704215f..00970b832d6 100644 --- a/src/Node/Property/PropertyWrite.php +++ b/src/Node/Property/PropertyWrite.php @@ -10,16 +10,8 @@ class PropertyWrite { - private PropertyFetch|StaticPropertyFetch $fetch; - - /** - * PropertyWrite constructor. - * - * @param PropertyFetch|StaticPropertyFetch $fetch - */ - public function __construct($fetch, private Scope $scope) + public function __construct(private PropertyFetch|StaticPropertyFetch $fetch, private Scope $scope) { - $this->fetch = $fetch; } /** diff --git a/src/Node/StaticMethodCallableNode.php b/src/Node/StaticMethodCallableNode.php index 82b646b24d2..a4c6e675ef2 100644 --- a/src/Node/StaticMethodCallableNode.php +++ b/src/Node/StaticMethodCallableNode.php @@ -10,19 +10,13 @@ class StaticMethodCallableNode extends Expr implements VirtualNode { - private Name|Expr $class; - - private Identifier|Expr $name; - - /** - * @param Name|Expr $class - * @param Identifier|Expr $name - */ - public function __construct($class, $name, private Expr\StaticCall $originalNode) + public function __construct( + private Name|Expr $class, + private Identifier|Expr $name, + private Expr\StaticCall $originalNode, + ) { parent::__construct($originalNode->getAttributes()); - $this->class = $class; - $this->name = $name; } /** diff --git a/src/Type/Constant/ConstantArrayTypeBuilder.php b/src/Type/Constant/ConstantArrayTypeBuilder.php index f972e7972b7..997a31acf54 100644 --- a/src/Type/Constant/ConstantArrayTypeBuilder.php +++ b/src/Type/Constant/ConstantArrayTypeBuilder.php @@ -23,7 +23,7 @@ class ConstantArrayTypeBuilder private bool $degradeToGeneralArray = false; /** - * @param array $keyTypes + * @param array $keyTypes * @param array $valueTypes * @param array $optionalKeys */