diff --git a/build/rector-downgrade.php b/build/rector-downgrade.php
index 76224ef58e..afdb07beef 100644
--- a/build/rector-downgrade.php
+++ b/build/rector-downgrade.php
@@ -7,7 +7,9 @@
use Rector\DowngradePhp74\Rector\ArrowFunction\ArrowFunctionToAnonymousFunctionRector;
use Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector;
use Rector\DowngradePhp80\Rector\Catch_\DowngradeNonCapturingCatchesRector;
+use Rector\DowngradePhp80\Rector\Class_\DowngradePropertyPromotionRector;
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeTrailingCommasInParamUseRector;
+use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector;
use Rector\DowngradePhp80\Rector\Property\DowngradeUnionTypeTypedPropertyRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
@@ -41,6 +43,8 @@
$services->set(DowngradeTrailingCommasInParamUseRector::class);
$services->set(DowngradeNonCapturingCatchesRector::class);
$services->set(DowngradeUnionTypeTypedPropertyRector::class);
+ $services->set(DowngradePropertyPromotionRector::class);
+ $services->set(DowngradeUnionTypeDeclarationRector::class);
}
if ($targetPhpVersionId < 70400) {
diff --git a/compiler/src/Console/CompileCommand.php b/compiler/src/Console/CompileCommand.php
index 43862caa07..16834d69e2 100644
--- a/compiler/src/Console/CompileCommand.php
+++ b/compiler/src/Console/CompileCommand.php
@@ -34,26 +34,14 @@
final class CompileCommand extends Command
{
- private Filesystem $filesystem;
-
- private ProcessFactory $processFactory;
-
- private string $dataDir;
-
- private string $buildDir;
-
public function __construct(
- Filesystem $filesystem,
- ProcessFactory $processFactory,
- string $dataDir,
- string $buildDir,
+ private Filesystem $filesystem,
+ private ProcessFactory $processFactory,
+ private string $dataDir,
+ private string $buildDir,
)
{
parent::__construct();
- $this->filesystem = $filesystem;
- $this->processFactory = $processFactory;
- $this->dataDir = $dataDir;
- $this->buildDir = $buildDir;
}
protected function configure(): void
diff --git a/compiler/src/Filesystem/SymfonyFilesystem.php b/compiler/src/Filesystem/SymfonyFilesystem.php
index b6ebb63a3f..e74d01fd74 100644
--- a/compiler/src/Filesystem/SymfonyFilesystem.php
+++ b/compiler/src/Filesystem/SymfonyFilesystem.php
@@ -9,11 +9,8 @@
final class SymfonyFilesystem implements Filesystem
{
- private \Symfony\Component\Filesystem\Filesystem $filesystem;
-
- public function __construct(\Symfony\Component\Filesystem\Filesystem $filesystem)
+ public function __construct(private \Symfony\Component\Filesystem\Filesystem $filesystem)
{
- $this->filesystem = $filesystem;
}
public function exists(string $dir): bool
diff --git a/composer.json b/composer.json
index 56772ab075..23b5a0deb8 100644
--- a/composer.json
+++ b/composer.json
@@ -56,7 +56,7 @@
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^9.5.4",
- "rector/rector": "0.12.5",
+ "rector/rector": "^0.12.11",
"vaimo/composer-patches": "^4.22"
},
"config": {
diff --git a/composer.lock b/composer.lock
index 1b630b62f6..70254caebd 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "886b912d42d02d217110cf59cb654a08",
+ "content-hash": "975b4d6e65c7398e1e6bf7a5e34d32cd",
"packages": [
{
"name": "clue/block-react",
@@ -5777,21 +5777,21 @@
},
{
"name": "rector/rector",
- "version": "0.12.5",
+ "version": "0.12.11",
"source": {
"type": "git",
"url": "https://github.com/rectorphp/rector.git",
- "reference": "e50e40e0fe73b88a46f27e086441e1998ceeca3c"
+ "reference": "348f392aa15fa19e9bd7489aa7bc69bc31c148a4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/rectorphp/rector/zipball/e50e40e0fe73b88a46f27e086441e1998ceeca3c",
- "reference": "e50e40e0fe73b88a46f27e086441e1998ceeca3c",
+ "url": "https://api.github.com/repos/rectorphp/rector/zipball/348f392aa15fa19e9bd7489aa7bc69bc31c148a4",
+ "reference": "348f392aa15fa19e9bd7489aa7bc69bc31c148a4",
"shasum": ""
},
"require": {
"php": "^7.1|^8.0",
- "phpstan/phpstan": "^1.1.1"
+ "phpstan/phpstan": "^1.3"
},
"conflict": {
"phpstan/phpdoc-parser": "<1.2",
@@ -5825,7 +5825,7 @@
"description": "Prefixed and PHP 7.1 downgraded version of rector/rector",
"support": {
"issues": "https://github.com/rectorphp/rector/issues",
- "source": "https://github.com/rectorphp/rector/tree/0.12.5"
+ "source": "https://github.com/rectorphp/rector/tree/0.12.11"
},
"funding": [
{
@@ -5833,7 +5833,7 @@
"type": "github"
}
],
- "time": "2021-11-23T17:38:29+00:00"
+ "time": "2022-01-05T18:37:59+00:00"
},
{
"name": "sebastian/cli-parser",
diff --git a/patches/AnonymousFunctionFactory.patch b/patches/AnonymousFunctionFactory.patch
deleted file mode 100644
index 0362229621..0000000000
--- a/patches/AnonymousFunctionFactory.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-@package rector/rector
-
---- rules/Php72/NodeFactory/AnonymousFunctionFactory.php 2021-11-23 18:38:29.000000000 +0100
-+++ rules/Php72/NodeFactory/AnonymousFunctionFactory.php 2021-12-17 18:06:56.000000000 +0100
-@@ -174,13 +174,19 @@
- */
- private function cleanClosureUses(array $uses) : array
- {
-- $variableNames = \array_map(function ($use) : string {
-- return (string) $this->nodeNameResolver->getName($use->var);
-- }, $uses, []);
-- $variableNames = \array_unique($variableNames);
-- return \array_map(static function ($variableName) : ClosureUse {
-- return new \PhpParser\Node\Expr\ClosureUse(new \PhpParser\Node\Expr\Variable($variableName));
-- }, $variableNames, []);
-+ $uniqueUses = [];
-+ foreach ($uses as $use) {
-+ if (!\is_string($use->var->name)) {
-+ continue;
-+ }
-+ $variableName = $use->var->name;
-+ if (\array_key_exists($variableName, $uniqueUses)) {
-+ continue;
-+ }
-+
-+ $uniqueUses[$variableName] = $use;
-+ }
-+ return \array_values($uniqueUses);
- }
- private function applyNestedUses(\PhpParser\Node\Expr\Closure $anonymousFunctionNode, \PhpParser\Node\Expr\Variable $useVariable) : \PhpParser\Node\Expr\Closure
- {
-@@ -269,7 +275,11 @@
- }
- $parentArrowFunction = $this->betterNodeFinder->findParentType($subNode, \PhpParser\Node\Expr\ArrowFunction::class);
- if ($parentArrowFunction instanceof \PhpParser\Node\Expr\ArrowFunction) {
-- return !(bool) $this->betterNodeFinder->findParentType($parentArrowFunction, \PhpParser\Node\Expr\ArrowFunction::class);
-+ $parentCallLike = $this->betterNodeFinder->findParentType($subNode, \PhpParser\Node\Expr\CallLike::class);
-+
-+ if (! $parentCallLike instanceof \PhpParser\Node\Expr\CallLike) {
-+ return ! (bool) $this->betterNodeFinder->findParentType($parentArrowFunction, \PhpParser\Node\Expr\ArrowFunction::class);
-+ }
- }
- return \true;
- });
diff --git a/patches/BooleanTypeMapper.patch b/patches/BooleanTypeMapper.patch
new file mode 100644
index 0000000000..dfb247bb93
--- /dev/null
+++ b/patches/BooleanTypeMapper.patch
@@ -0,0 +1,13 @@
+@package rector/rector
+
+--- packages/PHPStanStaticTypeMapper/TypeMapper/BooleanTypeMapper.php 2021-12-31 13:57:22.000000000 +0100
++++ packages/PHPStanStaticTypeMapper/TypeMapper/BooleanTypeMapper.php 2022-01-05 00:05:20.000000000 +0100
+@@ -45,7 +45,7 @@
+ }
+ if ($type instanceof \PHPStan\Type\Constant\ConstantBooleanType) {
+ // cannot be parent of union
+- return new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode('true');
++ return new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode('false');
+ }
+ return new \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode('bool');
+ }
diff --git a/patches/DowngradeTrailingCommasInFunctionCallsRector.patch b/patches/DowngradeTrailingCommasInFunctionCallsRector.patch
deleted file mode 100644
index b29bf9a108..0000000000
--- a/patches/DowngradeTrailingCommasInFunctionCallsRector.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-@package rector/rector
-
---- rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php 2021-12-17 08:20:27.000000000 +0100
-+++ rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php 2021-12-17 08:20:45.000000000 +0100
-@@ -58,7 +58,7 @@
- */
- public function getNodeTypes() : array
- {
-- return [\PhpParser\Node\Expr\FuncCall::class, \PhpParser\Node\Expr\MethodCall::class, \PhpParser\Node\Expr\StaticCall::class];
-+ return [\PhpParser\Node\Expr\FuncCall::class, \PhpParser\Node\Expr\MethodCall::class, \PhpParser\Node\Expr\StaticCall::class, Node\Expr\New_::class];
- }
- /**
- * @param FuncCall|MethodCall|StaticCall $node
diff --git a/patches/PHPStanNodeScopeResolver.patch b/patches/PHPStanNodeScopeResolver.patch
deleted file mode 100644
index 29413cdf88..0000000000
--- a/patches/PHPStanNodeScopeResolver.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-@package rector/rector
-
---- packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php 2021-12-16 21:10:20.000000000 +0100
-+++ packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php 2021-12-16 21:10:27.000000000 +0100
-@@ -226,12 +226,12 @@
- {
- // 1. get PHPStan locator
- /** @var ClassReflector $classReflector */
-- $classReflector = $this->privatesAccessor->getPrivateProperty($nodeScopeResolver, 'classReflector');
-+ //$classReflector = $this->privatesAccessor->getPrivateProperty($nodeScopeResolver, 'classReflector');
- /** @var SourceLocator $sourceLocator */
-- $sourceLocator = $this->privatesAccessor->getPrivateProperty($classReflector, 'sourceLocator');
-+ //$sourceLocator = $this->privatesAccessor->getPrivateProperty($classReflector, 'sourceLocator');
- // 2. get Rector locator
-- $aggregateSourceLocator = new \PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator([$sourceLocator, $this->renamedClassesSourceLocator, $this->parentAttributeSourceLocator]);
-- $this->privatesAccessor->setPrivateProperty($classReflector, 'sourceLocator', $aggregateSourceLocator);
-+ //$aggregateSourceLocator = new \PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator([$sourceLocator, $this->renamedClassesSourceLocator, $this->parentAttributeSourceLocator]);
-+ //$this->privatesAccessor->setPrivateProperty($classReflector, 'sourceLocator', $aggregateSourceLocator);
- }
- private function createDummyClassScopeContext(\PHPStan\Analyser\MutatingScope $mutatingScope) : \PHPStan\Analyser\ScopeContext
- {
diff --git a/patches/TypeFactory.patch b/patches/TypeFactory.patch
deleted file mode 100644
index 2c61d1adda..0000000000
--- a/patches/TypeFactory.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-@package rector/rector
-
---- packages/NodeTypeResolver/PHPStan/Type/TypeFactory.php 2021-11-23 18:38:29.000000000 +0100
-+++ packages/NodeTypeResolver/PHPStan/Type/TypeFactory.php 2021-12-18 22:49:01.000000000 +0100
-@@ -122,9 +122,6 @@
- if ($type instanceof \PHPStan\Type\Constant\ConstantIntegerType) {
- return new \PHPStan\Type\IntegerType();
- }
-- if ($type instanceof \PHPStan\Type\Constant\ConstantBooleanType) {
-- return new \PHPStan\Type\BooleanType();
-- }
- return $type;
- }
- /**
diff --git a/patches/parser.patch b/patches/parser.patch
new file mode 100644
index 0000000000..9088bdc8e0
--- /dev/null
+++ b/patches/parser.patch
@@ -0,0 +1,25 @@
+@package rector/rector
+
+--- config/phpstan/parser.neon 2022-01-05 19:37:59.000000000 +0100
++++ config/phpstan/parser.neon 2022-01-06 21:31:23.000000000 +0100
+@@ -5,11 +5,18 @@
+ factory: @pathRoutingParser
+ arguments!: []
+
++ cachedRectorParser:
++ class: PHPStan\Parser\CachedParser
++ arguments:
++ originalParser: @rectorParser
++ cachedNodesByStringCountMax: %cache.nodesByStringCountMax%
++ autowired: false
++
+ pathRoutingParser:
+ class: PHPStan\Parser\PathRoutingParser
+ arguments:
+- currentPhpVersionRichParser: @rectorParser
+- currentPhpVersionSimpleParser: @rectorParser
++ currentPhpVersionRichParser: @cachedRectorParser
++ currentPhpVersionSimpleParser: @cachedRectorParser
+ php8Parser: @php8Parser
+ autowired: false
+
diff --git a/phpcs.xml b/phpcs.xml
index 87e4a92d51..a8579080da 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -165,6 +165,11 @@
+
+
+
+
+
tests/*/data
tests/*/Fixture
tests/e2e/resultCache_1.php
diff --git a/src/Analyser/Analyser.php b/src/Analyser/Analyser.php
index d672009e72..1c722cc3f0 100644
--- a/src/Analyser/Analyser.php
+++ b/src/Analyser/Analyser.php
@@ -18,28 +18,16 @@
class Analyser
{
- private FileAnalyser $fileAnalyser;
-
- private Registry $registry;
-
- private NodeScopeResolver $nodeScopeResolver;
-
- private int $internalErrorsCountLimit;
-
/** @var Error[] */
private array $collectedErrors = [];
public function __construct(
- FileAnalyser $fileAnalyser,
- Registry $registry,
- NodeScopeResolver $nodeScopeResolver,
- int $internalErrorsCountLimit,
+ private FileAnalyser $fileAnalyser,
+ private Registry $registry,
+ private NodeScopeResolver $nodeScopeResolver,
+ private int $internalErrorsCountLimit,
)
{
- $this->fileAnalyser = $fileAnalyser;
- $this->registry = $registry;
- $this->nodeScopeResolver = $nodeScopeResolver;
- $this->internalErrorsCountLimit = $internalErrorsCountLimit;
}
/**
diff --git a/src/Analyser/AnalyserResult.php b/src/Analyser/AnalyserResult.php
index 4405685c1d..4bddb599a3 100644
--- a/src/Analyser/AnalyserResult.php
+++ b/src/Analyser/AnalyserResult.php
@@ -11,20 +11,6 @@ class AnalyserResult
/** @var Error[] */
private array $unorderedErrors;
- /** @var Error[] */
- private array $errors;
-
- /** @var string[] */
- private array $internalErrors;
-
- /** @var array>|null */
- private ?array $dependencies;
-
- /** @var array> */
- private array $exportedNodes;
-
- private bool $reachedInternalErrorsCountLimit;
-
/**
* @param Error[] $errors
* @param string[] $internalErrors
@@ -32,11 +18,11 @@ class AnalyserResult
* @param array> $exportedNodes
*/
public function __construct(
- array $errors,
- array $internalErrors,
- ?array $dependencies,
- array $exportedNodes,
- bool $reachedInternalErrorsCountLimit,
+ private array $errors,
+ private array $internalErrors,
+ private ?array $dependencies,
+ private array $exportedNodes,
+ private bool $reachedInternalErrorsCountLimit,
)
{
$this->unorderedErrors = $errors;
@@ -53,12 +39,6 @@ public function __construct(
$b->getMessage(),
],
);
-
- $this->errors = $errors;
- $this->internalErrors = $internalErrors;
- $this->dependencies = $dependencies;
- $this->exportedNodes = $exportedNodes;
- $this->reachedInternalErrorsCountLimit = $reachedInternalErrorsCountLimit;
}
/**
diff --git a/src/Analyser/ConditionalExpressionHolder.php b/src/Analyser/ConditionalExpressionHolder.php
index 7fb0419e9f..b36e35bc26 100644
--- a/src/Analyser/ConditionalExpressionHolder.php
+++ b/src/Analyser/ConditionalExpressionHolder.php
@@ -12,24 +12,17 @@
class ConditionalExpressionHolder
{
- /** @var array */
- private array $conditionExpressionTypes;
-
- private VariableTypeHolder $typeHolder;
-
/**
* @param array $conditionExpressionTypes
*/
public function __construct(
- array $conditionExpressionTypes,
- VariableTypeHolder $typeHolder,
+ private array $conditionExpressionTypes,
+ private VariableTypeHolder $typeHolder,
)
{
if (count($conditionExpressionTypes) === 0) {
throw new ShouldNotHappenException();
}
- $this->conditionExpressionTypes = $conditionExpressionTypes;
- $this->typeHolder = $typeHolder;
}
/**
diff --git a/src/Analyser/DirectScopeFactory.php b/src/Analyser/DirectScopeFactory.php
index 838696b1b3..eb4f890e06 100644
--- a/src/Analyser/DirectScopeFactory.php
+++ b/src/Analyser/DirectScopeFactory.php
@@ -23,63 +23,29 @@
class DirectScopeFactory implements ScopeFactory
{
- private string $scopeClass;
-
- private ReflectionProvider $reflectionProvider;
-
- private DynamicReturnTypeExtensionRegistryProvider $dynamicReturnTypeExtensionRegistryProvider;
-
- private OperatorTypeSpecifyingExtensionRegistryProvider $operatorTypeSpecifyingExtensionRegistryProvider;
-
- private Standard $printer;
-
- private TypeSpecifier $typeSpecifier;
-
- private PropertyReflectionFinder $propertyReflectionFinder;
-
- private Parser $parser;
-
- private NodeScopeResolver $nodeScopeResolver;
-
- private bool $treatPhpDocTypesAsCertain;
-
/** @var string[] */
private array $dynamicConstantNames;
- private PhpVersion $phpVersion;
-
public function __construct(
- string $scopeClass,
- ReflectionProvider $reflectionProvider,
- DynamicReturnTypeExtensionRegistryProvider $dynamicReturnTypeExtensionRegistryProvider,
- OperatorTypeSpecifyingExtensionRegistryProvider $operatorTypeSpecifyingExtensionRegistryProvider,
- Standard $printer,
- TypeSpecifier $typeSpecifier,
- PropertyReflectionFinder $propertyReflectionFinder,
- Parser $parser,
- NodeScopeResolver $nodeScopeResolver,
- bool $treatPhpDocTypesAsCertain,
+ private string $scopeClass,
+ private ReflectionProvider $reflectionProvider,
+ private DynamicReturnTypeExtensionRegistryProvider $dynamicReturnTypeExtensionRegistryProvider,
+ private OperatorTypeSpecifyingExtensionRegistryProvider $operatorTypeSpecifyingExtensionRegistryProvider,
+ private Standard $printer,
+ private TypeSpecifier $typeSpecifier,
+ private PropertyReflectionFinder $propertyReflectionFinder,
+ private Parser $parser,
+ private NodeScopeResolver $nodeScopeResolver,
+ private bool $treatPhpDocTypesAsCertain,
Container $container,
- PhpVersion $phpVersion,
+ private PhpVersion $phpVersion,
)
{
- $this->scopeClass = $scopeClass;
- $this->reflectionProvider = $reflectionProvider;
- $this->dynamicReturnTypeExtensionRegistryProvider = $dynamicReturnTypeExtensionRegistryProvider;
- $this->operatorTypeSpecifyingExtensionRegistryProvider = $operatorTypeSpecifyingExtensionRegistryProvider;
- $this->printer = $printer;
- $this->typeSpecifier = $typeSpecifier;
- $this->propertyReflectionFinder = $propertyReflectionFinder;
- $this->parser = $parser;
- $this->nodeScopeResolver = $nodeScopeResolver;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
$this->dynamicConstantNames = $container->getParameter('dynamicConstantNames');
- $this->phpVersion = $phpVersion;
}
/**
- * @param array $constantTypes
- * @param FunctionReflection|MethodReflection|null $function
+ * @param array $constantTypes
* @param VariableTypeHolder[] $variablesTypes
* @param VariableTypeHolder[] $moreSpecificTypes
* @param array $conditionalExpressions
@@ -92,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/EnsuredNonNullabilityResult.php b/src/Analyser/EnsuredNonNullabilityResult.php
index 3b8fa3be75..258a16b18b 100644
--- a/src/Analyser/EnsuredNonNullabilityResult.php
+++ b/src/Analyser/EnsuredNonNullabilityResult.php
@@ -5,18 +5,11 @@
class EnsuredNonNullabilityResult
{
- private MutatingScope $scope;
-
- /** @var EnsuredNonNullabilityResultExpression[] */
- private array $specifiedExpressions;
-
/**
* @param EnsuredNonNullabilityResultExpression[] $specifiedExpressions
*/
- public function __construct(MutatingScope $scope, array $specifiedExpressions)
+ public function __construct(private MutatingScope $scope, private array $specifiedExpressions)
{
- $this->scope = $scope;
- $this->specifiedExpressions = $specifiedExpressions;
}
public function getScope(): MutatingScope
diff --git a/src/Analyser/EnsuredNonNullabilityResultExpression.php b/src/Analyser/EnsuredNonNullabilityResultExpression.php
index 5f71f082cd..a7ed1572f8 100644
--- a/src/Analyser/EnsuredNonNullabilityResultExpression.php
+++ b/src/Analyser/EnsuredNonNullabilityResultExpression.php
@@ -8,21 +8,12 @@
class EnsuredNonNullabilityResultExpression
{
- private Expr $expression;
-
- private Type $originalType;
-
- private Type $originalNativeType;
-
public function __construct(
- Expr $expression,
- Type $originalType,
- Type $originalNativeType,
+ private Expr $expression,
+ private Type $originalType,
+ private Type $originalNativeType,
)
{
- $this->expression = $expression;
- $this->originalType = $originalType;
- $this->originalNativeType = $originalNativeType;
}
public function getExpression(): Expr
diff --git a/src/Analyser/Error.php b/src/Analyser/Error.php
index 98fcc5b244..d32a6bf8bf 100644
--- a/src/Analyser/Error.php
+++ b/src/Analyser/Error.php
@@ -14,62 +14,30 @@
class Error implements JsonSerializable
{
- private string $message;
-
- private string $file;
-
- private ?int $line;
-
- private bool|Throwable $canBeIgnored;
-
- private ?string $filePath;
-
- private ?string $traitFilePath;
-
- private ?string $tip;
-
- private ?int $nodeLine;
-
/** @phpstan-var class-string|null */
private ?string $nodeType;
- private ?string $identifier;
-
- /** @var mixed[] */
- private array $metadata;
-
/**
* Error constructor.
*
- * @param bool|Throwable $canBeIgnored
* @param class-string|null $nodeType
* @param mixed[] $metadata
*/
public function __construct(
- string $message,
- string $file,
- ?int $line = null,
- $canBeIgnored = true,
- ?string $filePath = null,
- ?string $traitFilePath = null,
- ?string $tip = null,
- ?int $nodeLine = null,
+ private string $message,
+ private string $file,
+ private ?int $line = null,
+ private bool|Throwable $canBeIgnored = true,
+ private ?string $filePath = null,
+ private ?string $traitFilePath = null,
+ private ?string $tip = null,
+ private ?int $nodeLine = null,
?string $nodeType = null,
- ?string $identifier = null,
- array $metadata = [],
+ private ?string $identifier = null,
+ private array $metadata = [],
)
{
- $this->message = $message;
- $this->file = $file;
- $this->line = $line;
- $this->canBeIgnored = $canBeIgnored;
- $this->filePath = $filePath;
- $this->traitFilePath = $traitFilePath;
- $this->tip = $tip;
- $this->nodeLine = $nodeLine;
$this->nodeType = $nodeType;
- $this->identifier = $identifier;
- $this->metadata = $metadata;
}
public function getMessage(): string
diff --git a/src/Analyser/ExpressionContext.php b/src/Analyser/ExpressionContext.php
index 15c024a209..df1f55d284 100644
--- a/src/Analyser/ExpressionContext.php
+++ b/src/Analyser/ExpressionContext.php
@@ -7,21 +7,12 @@
class ExpressionContext
{
- private bool $isDeep;
-
- private ?string $inAssignRightSideVariableName;
-
- private ?Type $inAssignRightSideType;
-
private function __construct(
- bool $isDeep,
- ?string $inAssignRightSideVariableName,
- ?Type $inAssignRightSideType,
+ private bool $isDeep,
+ private ?string $inAssignRightSideVariableName,
+ private ?Type $inAssignRightSideType,
)
{
- $this->isDeep = $isDeep;
- $this->inAssignRightSideVariableName = $inAssignRightSideVariableName;
- $this->inAssignRightSideType = $inAssignRightSideType;
}
public static function createTopLevel(): self
diff --git a/src/Analyser/ExpressionResult.php b/src/Analyser/ExpressionResult.php
index e0c03f4966..93a3bdca25 100644
--- a/src/Analyser/ExpressionResult.php
+++ b/src/Analyser/ExpressionResult.php
@@ -5,13 +5,6 @@
class ExpressionResult
{
- private MutatingScope $scope;
-
- private bool $hasYield;
-
- /** @var ThrowPoint[] $throwPoints */
- private array $throwPoints;
-
/** @var (callable(): MutatingScope)|null */
private $truthyScopeCallback;
@@ -28,16 +21,13 @@ class ExpressionResult
* @param (callable(): MutatingScope)|null $falseyScopeCallback
*/
public function __construct(
- MutatingScope $scope,
- bool $hasYield,
- array $throwPoints,
+ private MutatingScope $scope,
+ private bool $hasYield,
+ private array $throwPoints,
?callable $truthyScopeCallback = null,
?callable $falseyScopeCallback = null,
)
{
- $this->scope = $scope;
- $this->hasYield = $hasYield;
- $this->throwPoints = $throwPoints;
$this->truthyScopeCallback = $truthyScopeCallback;
$this->falseyScopeCallback = $falseyScopeCallback;
}
diff --git a/src/Analyser/FileAnalyser.php b/src/Analyser/FileAnalyser.php
index aac25c0206..7b39d68ba2 100644
--- a/src/Analyser/FileAnalyser.php
+++ b/src/Analyser/FileAnalyser.php
@@ -34,29 +34,14 @@
class FileAnalyser
{
- private ScopeFactory $scopeFactory;
-
- private NodeScopeResolver $nodeScopeResolver;
-
- private Parser $parser;
-
- private DependencyResolver $dependencyResolver;
-
- private bool $reportUnmatchedIgnoredErrors;
-
public function __construct(
- ScopeFactory $scopeFactory,
- NodeScopeResolver $nodeScopeResolver,
- Parser $parser,
- DependencyResolver $dependencyResolver,
- bool $reportUnmatchedIgnoredErrors,
+ private ScopeFactory $scopeFactory,
+ private NodeScopeResolver $nodeScopeResolver,
+ private Parser $parser,
+ private DependencyResolver $dependencyResolver,
+ private bool $reportUnmatchedIgnoredErrors,
)
{
- $this->scopeFactory = $scopeFactory;
- $this->nodeScopeResolver = $nodeScopeResolver;
- $this->parser = $parser;
- $this->dependencyResolver = $dependencyResolver;
- $this->reportUnmatchedIgnoredErrors = $reportUnmatchedIgnoredErrors;
}
/**
diff --git a/src/Analyser/FileAnalyserResult.php b/src/Analyser/FileAnalyserResult.php
index 024a953026..9669866ef8 100644
--- a/src/Analyser/FileAnalyserResult.php
+++ b/src/Analyser/FileAnalyserResult.php
@@ -7,25 +7,13 @@
class FileAnalyserResult
{
- /** @var Error[] */
- private array $errors;
-
- /** @var array */
- private array $dependencies;
-
- /** @var array */
- private array $exportedNodes;
-
/**
* @param Error[] $errors
* @param array $dependencies
* @param array $exportedNodes
*/
- public function __construct(array $errors, array $dependencies, array $exportedNodes)
+ public function __construct(private array $errors, private array $dependencies, private array $exportedNodes)
{
- $this->errors = $errors;
- $this->dependencies = $dependencies;
- $this->exportedNodes = $exportedNodes;
}
/**
diff --git a/src/Analyser/IgnoredErrorHelper.php b/src/Analyser/IgnoredErrorHelper.php
index 2a31df4e71..7a80bb02db 100644
--- a/src/Analyser/IgnoredErrorHelper.php
+++ b/src/Analyser/IgnoredErrorHelper.php
@@ -19,29 +19,16 @@
class IgnoredErrorHelper
{
- private IgnoredRegexValidator $ignoredRegexValidator;
-
- private FileHelper $fileHelper;
-
- /** @var (string|mixed[])[] */
- private array $ignoreErrors;
-
- private bool $reportUnmatchedIgnoredErrors;
-
/**
* @param (string|mixed[])[] $ignoreErrors
*/
public function __construct(
- IgnoredRegexValidator $ignoredRegexValidator,
- FileHelper $fileHelper,
- array $ignoreErrors,
- bool $reportUnmatchedIgnoredErrors,
+ private IgnoredRegexValidator $ignoredRegexValidator,
+ private FileHelper $fileHelper,
+ private array $ignoreErrors,
+ private bool $reportUnmatchedIgnoredErrors,
)
{
- $this->ignoredRegexValidator = $ignoredRegexValidator;
- $this->fileHelper = $fileHelper;
- $this->ignoreErrors = $ignoreErrors;
- $this->reportUnmatchedIgnoredErrors = $reportUnmatchedIgnoredErrors;
}
public function initialize(): IgnoredErrorHelperResult
diff --git a/src/Analyser/IgnoredErrorHelperResult.php b/src/Analyser/IgnoredErrorHelperResult.php
index f2d2a9170f..e0dc5de4f6 100644
--- a/src/Analyser/IgnoredErrorHelperResult.php
+++ b/src/Analyser/IgnoredErrorHelperResult.php
@@ -17,22 +17,6 @@
class IgnoredErrorHelperResult
{
- private FileHelper $fileHelper;
-
- /** @var string[] */
- private array $errors;
-
- /** @var array> */
- private array $otherIgnoreErrors;
-
- /** @var array>> */
- private array $ignoreErrorsByFile;
-
- /** @var (string|mixed[])[] */
- private array $ignoreErrors;
-
- private bool $reportUnmatchedIgnoredErrors;
-
/**
* @param string[] $errors
* @param array> $otherIgnoreErrors
@@ -40,20 +24,14 @@ class IgnoredErrorHelperResult
* @param (string|mixed[])[] $ignoreErrors
*/
public function __construct(
- FileHelper $fileHelper,
- array $errors,
- array $otherIgnoreErrors,
- array $ignoreErrorsByFile,
- array $ignoreErrors,
- bool $reportUnmatchedIgnoredErrors,
+ private FileHelper $fileHelper,
+ private array $errors,
+ private array $otherIgnoreErrors,
+ private array $ignoreErrorsByFile,
+ private array $ignoreErrors,
+ private bool $reportUnmatchedIgnoredErrors,
)
{
- $this->fileHelper = $fileHelper;
- $this->errors = $errors;
- $this->otherIgnoreErrors = $otherIgnoreErrors;
- $this->ignoreErrorsByFile = $ignoreErrorsByFile;
- $this->ignoreErrors = $ignoreErrors;
- $this->reportUnmatchedIgnoredErrors = $reportUnmatchedIgnoredErrors;
}
/**
diff --git a/src/Analyser/LazyScopeFactory.php b/src/Analyser/LazyScopeFactory.php
index a0211da6ba..3ed6b777c0 100644
--- a/src/Analyser/LazyScopeFactory.php
+++ b/src/Analyser/LazyScopeFactory.php
@@ -19,29 +19,22 @@
class LazyScopeFactory implements ScopeFactory
{
- private string $scopeClass;
-
- private Container $container;
-
/** @var string[] */
private array $dynamicConstantNames;
private bool $treatPhpDocTypesAsCertain;
public function __construct(
- string $scopeClass,
- Container $container,
+ private string $scopeClass,
+ private Container $container,
)
{
- $this->scopeClass = $scopeClass;
- $this->container = $container;
$this->dynamicConstantNames = $container->getParameter('dynamicConstantNames');
$this->treatPhpDocTypesAsCertain = $container->getParameter('treatPhpDocTypesAsCertain');
}
/**
* @param array $constantTypes
- * @param FunctionReflection|MethodReflection|null $function
* @param VariableTypeHolder[] $variablesTypes
* @param VariableTypeHolder[] $moreSpecificTypes
* @param array $conditionalExpressions
@@ -54,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 33cf4540b4..3fd97cbcf3 100644
--- a/src/Analyser/MutatingScope.php
+++ b/src/Analyser/MutatingScope.php
@@ -143,77 +143,14 @@ class MutatingScope implements Scope
Node\Expr\AssignOp\Div::class => '/',
];
- private ScopeFactory $scopeFactory;
-
- private ReflectionProvider $reflectionProvider;
-
- private DynamicReturnTypeExtensionRegistry $dynamicReturnTypeExtensionRegistry;
-
- private OperatorTypeSpecifyingExtensionRegistry $operatorTypeSpecifyingExtensionRegistry;
-
- private Standard $printer;
-
- private TypeSpecifier $typeSpecifier;
-
- private PropertyReflectionFinder $propertyReflectionFinder;
-
- private Parser $parser;
-
- private NodeScopeResolver $nodeScopeResolver;
-
- private ScopeContext $context;
-
- private PhpVersion $phpVersion;
-
/** @var Type[] */
private array $resolvedTypes = [];
- private bool $declareStrictTypes;
-
- /** @var array */
- private array $constantTypes;
-
- private FunctionReflection|MethodReflection|null $function = null;
-
private ?string $namespace;
- /** @var VariableTypeHolder[] */
- private array $variableTypes;
-
- /** @var VariableTypeHolder[] */
- private array $moreSpecificTypes;
-
- /** @var array */
- private array $conditionalExpressions;
-
- private ?string $inClosureBindScopeClass;
-
- private ?ParametersAcceptor $anonymousFunctionReflection;
-
- private bool $inFirstLevelStatement;
-
- /** @var array */
- private array $currentlyAssignedExpressions;
-
- /** @var array */
- private array $inFunctionCallsStack;
-
- /** @var array */
- private array $nativeExpressionTypes;
-
- /** @var string[] */
- private array $dynamicConstantNames;
-
- private bool $treatPhpDocTypesAsCertain;
-
- private bool $afterExtractCall;
-
- private ?Scope $parentScope;
-
/**
* @param array $constantTypes
- * @param FunctionReflection|MethodReflection|null $function
- * @param VariableTypeHolder[] $variablesTypes
+ * @param VariableTypeHolder[] $variableTypes
* @param VariableTypeHolder[] $moreSpecificTypes
* @param array $conditionalExpressions
* @param array $currentlyAssignedExpressions
@@ -222,68 +159,41 @@ class MutatingScope implements Scope
* @param string[] $dynamicConstantNames
*/
public function __construct(
- ScopeFactory $scopeFactory,
- ReflectionProvider $reflectionProvider,
- DynamicReturnTypeExtensionRegistry $dynamicReturnTypeExtensionRegistry,
- OperatorTypeSpecifyingExtensionRegistry $operatorTypeSpecifyingExtensionRegistry,
- Standard $printer,
- TypeSpecifier $typeSpecifier,
- PropertyReflectionFinder $propertyReflectionFinder,
- Parser $parser,
- NodeScopeResolver $nodeScopeResolver,
- ScopeContext $context,
- PhpVersion $phpVersion,
- bool $declareStrictTypes = false,
- array $constantTypes = [],
- $function = null,
+ private ScopeFactory $scopeFactory,
+ private ReflectionProvider $reflectionProvider,
+ private DynamicReturnTypeExtensionRegistry $dynamicReturnTypeExtensionRegistry,
+ private OperatorTypeSpecifyingExtensionRegistry $operatorTypeSpecifyingExtensionRegistry,
+ private Standard $printer,
+ private TypeSpecifier $typeSpecifier,
+ private PropertyReflectionFinder $propertyReflectionFinder,
+ private Parser $parser,
+ private NodeScopeResolver $nodeScopeResolver,
+ private ScopeContext $context,
+ private PhpVersion $phpVersion,
+ private bool $declareStrictTypes = false,
+ private array $constantTypes = [],
+ private FunctionReflection|MethodReflection|null $function = null,
?string $namespace = null,
- array $variablesTypes = [],
- array $moreSpecificTypes = [],
- array $conditionalExpressions = [],
- ?string $inClosureBindScopeClass = null,
- ?ParametersAcceptor $anonymousFunctionReflection = null,
- bool $inFirstLevelStatement = true,
- array $currentlyAssignedExpressions = [],
- array $nativeExpressionTypes = [],
- array $inFunctionCallsStack = [],
- array $dynamicConstantNames = [],
- bool $treatPhpDocTypesAsCertain = true,
- bool $afterExtractCall = false,
- ?Scope $parentScope = null,
+ private array $variableTypes = [],
+ private array $moreSpecificTypes = [],
+ private array $conditionalExpressions = [],
+ private ?string $inClosureBindScopeClass = null,
+ private ?ParametersAcceptor $anonymousFunctionReflection = null,
+ private bool $inFirstLevelStatement = true,
+ private array $currentlyAssignedExpressions = [],
+ private array $nativeExpressionTypes = [],
+ private array $inFunctionCallsStack = [],
+ private array $dynamicConstantNames = [],
+ private bool $treatPhpDocTypesAsCertain = true,
+ private bool $afterExtractCall = false,
+ private ?Scope $parentScope = null,
)
{
if ($namespace === '') {
$namespace = null;
}
- $this->scopeFactory = $scopeFactory;
- $this->reflectionProvider = $reflectionProvider;
- $this->dynamicReturnTypeExtensionRegistry = $dynamicReturnTypeExtensionRegistry;
- $this->operatorTypeSpecifyingExtensionRegistry = $operatorTypeSpecifyingExtensionRegistry;
- $this->printer = $printer;
- $this->typeSpecifier = $typeSpecifier;
- $this->propertyReflectionFinder = $propertyReflectionFinder;
- $this->parser = $parser;
- $this->nodeScopeResolver = $nodeScopeResolver;
- $this->context = $context;
- $this->phpVersion = $phpVersion;
- $this->declareStrictTypes = $declareStrictTypes;
- $this->constantTypes = $constantTypes;
- $this->function = $function;
$this->namespace = $namespace;
- $this->variableTypes = $variablesTypes;
- $this->moreSpecificTypes = $moreSpecificTypes;
- $this->conditionalExpressions = $conditionalExpressions;
- $this->inClosureBindScopeClass = $inClosureBindScopeClass;
- $this->anonymousFunctionReflection = $anonymousFunctionReflection;
- $this->inFirstLevelStatement = $inFirstLevelStatement;
- $this->currentlyAssignedExpressions = $currentlyAssignedExpressions;
- $this->nativeExpressionTypes = $nativeExpressionTypes;
- $this->inFunctionCallsStack = $inFunctionCallsStack;
- $this->dynamicConstantNames = $dynamicConstantNames;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
- $this->afterExtractCall = $afterExtractCall;
- $this->parentScope = $parentScope;
}
/** @api */
diff --git a/src/Analyser/NameScope.php b/src/Analyser/NameScope.php
index ff28717aeb..32c71c0f48 100644
--- a/src/Analyser/NameScope.php
+++ b/src/Analyser/NameScope.php
@@ -20,36 +20,20 @@
class NameScope
{
- private ?string $namespace;
-
/** @var array alias(string) => fullName(string) */
private array $uses;
- private ?string $className;
-
- private ?string $functionName;
-
private TemplateTypeMap $templateTypeMap;
- /** @var array */
- private array $typeAliasesMap;
-
- private bool $bypassTypeAliases;
-
/**
* @api
* @param array $uses alias(string) => fullName(string)
* @param array $typeAliasesMap
*/
- public function __construct(?string $namespace, array $uses, ?string $className = null, ?string $functionName = null, ?TemplateTypeMap $templateTypeMap = null, array $typeAliasesMap = [], bool $bypassTypeAliases = false)
+ public function __construct(private ?string $namespace, array $uses, private ?string $className = null, private ?string $functionName = null, ?TemplateTypeMap $templateTypeMap = null, private array $typeAliasesMap = [], private bool $bypassTypeAliases = false)
{
- $this->namespace = $namespace;
$this->uses = $uses;
- $this->className = $className;
- $this->functionName = $functionName;
$this->templateTypeMap = $templateTypeMap ?? TemplateTypeMap::createEmpty();
- $this->typeAliasesMap = $typeAliasesMap;
- $this->bypassTypeAliases = $bypassTypeAliases;
}
public function getNamespace(): ?string
diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php
index e237189fe5..3340dafcba 100644
--- a/src/Analyser/NodeScopeResolver.php
+++ b/src/Analyser/NodeScopeResolver.php
@@ -154,40 +154,6 @@ class NodeScopeResolver
private const LOOP_SCOPE_ITERATIONS = 3;
private const GENERALIZE_AFTER_ITERATION = 1;
- private ReflectionProvider $reflectionProvider;
-
- private Reflector $reflector;
-
- private ClassReflectionExtensionRegistryProvider $classReflectionExtensionRegistryProvider;
-
- private Parser $parser;
-
- private FileTypeMapper $fileTypeMapper;
-
- private StubPhpDocProvider $stubPhpDocProvider;
-
- private PhpVersion $phpVersion;
-
- private PhpDocInheritanceResolver $phpDocInheritanceResolver;
-
- private FileHelper $fileHelper;
-
- private TypeSpecifier $typeSpecifier;
-
- private DynamicThrowTypeExtensionProvider $dynamicThrowTypeExtensionProvider;
-
- private bool $polluteScopeWithLoopInitialAssignments;
-
- private bool $polluteScopeWithAlwaysIterableForeach;
-
- /** @var string[][] className(string) => methods(string[]) */
- private array $earlyTerminatingMethodCalls;
-
- /** @var array */
- private array $earlyTerminatingFunctionCalls;
-
- private bool $implicitThrows;
-
/** @var bool[] filePath(string) => bool(true) */
private array $analysedFiles = [];
@@ -196,40 +162,24 @@ class NodeScopeResolver
* @param array $earlyTerminatingFunctionCalls
*/
public function __construct(
- ReflectionProvider $reflectionProvider,
- Reflector $reflector,
- ClassReflectionExtensionRegistryProvider $classReflectionExtensionRegistryProvider,
- Parser $parser,
- FileTypeMapper $fileTypeMapper,
- StubPhpDocProvider $stubPhpDocProvider,
- PhpVersion $phpVersion,
- PhpDocInheritanceResolver $phpDocInheritanceResolver,
- FileHelper $fileHelper,
- TypeSpecifier $typeSpecifier,
- DynamicThrowTypeExtensionProvider $dynamicThrowTypeExtensionProvider,
- bool $polluteScopeWithLoopInitialAssignments,
- bool $polluteScopeWithAlwaysIterableForeach,
- array $earlyTerminatingMethodCalls,
- array $earlyTerminatingFunctionCalls,
- bool $implicitThrows,
+ private ReflectionProvider $reflectionProvider,
+ private Reflector $reflector,
+ private ClassReflectionExtensionRegistryProvider $classReflectionExtensionRegistryProvider,
+ private Parser $parser,
+ private FileTypeMapper $fileTypeMapper,
+ private StubPhpDocProvider $stubPhpDocProvider,
+ private PhpVersion $phpVersion,
+ private PhpDocInheritanceResolver $phpDocInheritanceResolver,
+ private FileHelper $fileHelper,
+ private TypeSpecifier $typeSpecifier,
+ private DynamicThrowTypeExtensionProvider $dynamicThrowTypeExtensionProvider,
+ private bool $polluteScopeWithLoopInitialAssignments,
+ private bool $polluteScopeWithAlwaysIterableForeach,
+ private array $earlyTerminatingMethodCalls,
+ private array $earlyTerminatingFunctionCalls,
+ private bool $implicitThrows,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->reflector = $reflector;
- $this->classReflectionExtensionRegistryProvider = $classReflectionExtensionRegistryProvider;
- $this->parser = $parser;
- $this->fileTypeMapper = $fileTypeMapper;
- $this->stubPhpDocProvider = $stubPhpDocProvider;
- $this->phpVersion = $phpVersion;
- $this->phpDocInheritanceResolver = $phpDocInheritanceResolver;
- $this->fileHelper = $fileHelper;
- $this->typeSpecifier = $typeSpecifier;
- $this->dynamicThrowTypeExtensionProvider = $dynamicThrowTypeExtensionProvider;
- $this->polluteScopeWithLoopInitialAssignments = $polluteScopeWithLoopInitialAssignments;
- $this->polluteScopeWithAlwaysIterableForeach = $polluteScopeWithAlwaysIterableForeach;
- $this->earlyTerminatingMethodCalls = $earlyTerminatingMethodCalls;
- $this->earlyTerminatingFunctionCalls = $earlyTerminatingFunctionCalls;
- $this->implicitThrows = $implicitThrows;
}
/**
diff --git a/src/Analyser/ResultCache/ResultCache.php b/src/Analyser/ResultCache/ResultCache.php
index 2e536248c0..c4f5452802 100644
--- a/src/Analyser/ResultCache/ResultCache.php
+++ b/src/Analyser/ResultCache/ResultCache.php
@@ -8,25 +8,6 @@
class ResultCache
{
- private bool $fullAnalysis;
-
- /** @var string[] */
- private array $filesToAnalyse;
-
- private int $lastFullAnalysisTime;
-
- /** @var mixed[] */
- private array $meta;
-
- /** @var array> */
- private array $errors;
-
- /** @var array> */
- private array $dependencies;
-
- /** @var array> */
- private array $exportedNodes;
-
/**
* @param string[] $filesToAnalyse
* @param mixed[] $meta
@@ -35,22 +16,15 @@ class ResultCache
* @param array> $exportedNodes
*/
public function __construct(
- array $filesToAnalyse,
- bool $fullAnalysis,
- int $lastFullAnalysisTime,
- array $meta,
- array $errors,
- array $dependencies,
- array $exportedNodes,
+ private array $filesToAnalyse,
+ private bool $fullAnalysis,
+ private int $lastFullAnalysisTime,
+ private array $meta,
+ private array $errors,
+ private array $dependencies,
+ private array $exportedNodes,
)
{
- $this->filesToAnalyse = $filesToAnalyse;
- $this->fullAnalysis = $fullAnalysis;
- $this->lastFullAnalysisTime = $lastFullAnalysisTime;
- $this->meta = $meta;
- $this->errors = $errors;
- $this->dependencies = $dependencies;
- $this->exportedNodes = $exportedNodes;
}
/**
diff --git a/src/Analyser/ResultCache/ResultCacheClearer.php b/src/Analyser/ResultCache/ResultCacheClearer.php
index 9e4436486b..d511a3fa92 100644
--- a/src/Analyser/ResultCache/ResultCacheClearer.php
+++ b/src/Analyser/ResultCache/ResultCacheClearer.php
@@ -10,14 +10,8 @@
class ResultCacheClearer
{
- private string $cacheFilePath;
-
- private string $tempResultCachePath;
-
- public function __construct(string $cacheFilePath, string $tempResultCachePath)
+ public function __construct(private string $cacheFilePath, private string $tempResultCachePath)
{
- $this->cacheFilePath = $cacheFilePath;
- $this->tempResultCachePath = $tempResultCachePath;
}
public function clear(): string
diff --git a/src/Analyser/ResultCache/ResultCacheManager.php b/src/Analyser/ResultCache/ResultCacheManager.php
index f974f5dc5f..50ebcf3251 100644
--- a/src/Analyser/ResultCache/ResultCacheManager.php
+++ b/src/Analyser/ResultCache/ResultCacheManager.php
@@ -45,49 +45,12 @@ class ResultCacheManager
private const CACHE_VERSION = 'v9-project-extensions';
- private ExportedNodeFetcher $exportedNodeFetcher;
-
- private FileFinder $scanFileFinder;
-
- private ReflectionProvider $reflectionProvider;
-
- private string $cacheFilePath;
-
- private string $tempResultCachePath;
-
- /** @var string[] */
- private array $analysedPaths;
-
- /** @var string[] */
- private array $composerAutoloaderProjectPaths;
-
- /** @var string[] */
- private array $stubFiles;
-
- private string $usedLevel;
-
- private ?string $cliAutoloadFile;
-
- /** @var string[] */
- private array $bootstrapFiles;
-
- /** @var string[] */
- private array $scanFiles;
-
- /** @var string[] */
- private array $scanDirectories;
-
/** @var array */
private array $fileHashes = [];
- /** @var array */
- private array $fileReplacements = [];
-
/** @var array */
private array $alreadyProcessed = [];
- private bool $checkDependenciesOfProjectExtensionFiles;
-
/**
* @param string[] $analysedPaths
* @param string[] $composerAutoloaderProjectPaths
@@ -98,38 +61,23 @@ class ResultCacheManager
* @param array $fileReplacements
*/
public function __construct(
- ExportedNodeFetcher $exportedNodeFetcher,
- FileFinder $scanFileFinder,
- ReflectionProvider $reflectionProvider,
- string $cacheFilePath,
- string $tempResultCachePath,
- array $analysedPaths,
- array $composerAutoloaderProjectPaths,
- array $stubFiles,
- string $usedLevel,
- ?string $cliAutoloadFile,
- array $bootstrapFiles,
- array $scanFiles,
- array $scanDirectories,
- array $fileReplacements,
- bool $checkDependenciesOfProjectExtensionFiles,
+ private ExportedNodeFetcher $exportedNodeFetcher,
+ private FileFinder $scanFileFinder,
+ private ReflectionProvider $reflectionProvider,
+ private string $cacheFilePath,
+ private string $tempResultCachePath,
+ private array $analysedPaths,
+ private array $composerAutoloaderProjectPaths,
+ private array $stubFiles,
+ private string $usedLevel,
+ private ?string $cliAutoloadFile,
+ private array $bootstrapFiles,
+ private array $scanFiles,
+ private array $scanDirectories,
+ private array $fileReplacements,
+ private bool $checkDependenciesOfProjectExtensionFiles,
)
{
- $this->exportedNodeFetcher = $exportedNodeFetcher;
- $this->scanFileFinder = $scanFileFinder;
- $this->reflectionProvider = $reflectionProvider;
- $this->cacheFilePath = $cacheFilePath;
- $this->tempResultCachePath = $tempResultCachePath;
- $this->analysedPaths = $analysedPaths;
- $this->composerAutoloaderProjectPaths = $composerAutoloaderProjectPaths;
- $this->stubFiles = $stubFiles;
- $this->usedLevel = $usedLevel;
- $this->cliAutoloadFile = $cliAutoloadFile;
- $this->bootstrapFiles = $bootstrapFiles;
- $this->scanFiles = $scanFiles;
- $this->scanDirectories = $scanDirectories;
- $this->fileReplacements = $fileReplacements;
- $this->checkDependenciesOfProjectExtensionFiles = $checkDependenciesOfProjectExtensionFiles;
}
/**
diff --git a/src/Analyser/ResultCache/ResultCacheProcessResult.php b/src/Analyser/ResultCache/ResultCacheProcessResult.php
index b3230ca968..27326f33a0 100644
--- a/src/Analyser/ResultCache/ResultCacheProcessResult.php
+++ b/src/Analyser/ResultCache/ResultCacheProcessResult.php
@@ -7,14 +7,8 @@
class ResultCacheProcessResult
{
- private AnalyserResult $analyserResult;
-
- private bool $saved;
-
- public function __construct(AnalyserResult $analyserResult, bool $saved)
+ public function __construct(private AnalyserResult $analyserResult, private bool $saved)
{
- $this->analyserResult = $analyserResult;
- $this->saved = $saved;
}
public function getAnalyserResult(): AnalyserResult
diff --git a/src/Analyser/ScopeContext.php b/src/Analyser/ScopeContext.php
index 872a8655cf..4118909860 100644
--- a/src/Analyser/ScopeContext.php
+++ b/src/Analyser/ScopeContext.php
@@ -8,21 +8,12 @@
class ScopeContext
{
- private string $file;
-
- private ?ClassReflection $classReflection;
-
- private ?ClassReflection $traitReflection;
-
private function __construct(
- string $file,
- ?ClassReflection $classReflection,
- ?ClassReflection $traitReflection,
+ private string $file,
+ private ?ClassReflection $classReflection,
+ private ?ClassReflection $traitReflection,
)
{
- $this->file = $file;
- $this->classReflection = $classReflection;
- $this->traitReflection = $traitReflection;
}
/** @api */
diff --git a/src/Analyser/ScopeFactory.php b/src/Analyser/ScopeFactory.php
index 15294d0501..1d7db30f3e 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/Analyser/SpecifiedTypes.php b/src/Analyser/SpecifiedTypes.php
index 44099a41f7..92963fb826 100644
--- a/src/Analyser/SpecifiedTypes.php
+++ b/src/Analyser/SpecifiedTypes.php
@@ -9,17 +9,6 @@
class SpecifiedTypes
{
- /** @var array */
- private array $sureTypes;
-
- /** @var array */
- private array $sureNotTypes;
-
- private bool $overwrite;
-
- /** @var array */
- private array $newConditionalExpressionHolders;
-
/**
* @api
* @param array $sureTypes
@@ -27,16 +16,12 @@ class SpecifiedTypes
* @param array $newConditionalExpressionHolders
*/
public function __construct(
- array $sureTypes = [],
- array $sureNotTypes = [],
- bool $overwrite = false,
- array $newConditionalExpressionHolders = [],
+ private array $sureTypes = [],
+ private array $sureNotTypes = [],
+ private bool $overwrite = false,
+ private array $newConditionalExpressionHolders = [],
)
{
- $this->sureTypes = $sureTypes;
- $this->sureNotTypes = $sureNotTypes;
- $this->overwrite = $overwrite;
- $this->newConditionalExpressionHolders = $newConditionalExpressionHolders;
}
/**
diff --git a/src/Analyser/StatementExitPoint.php b/src/Analyser/StatementExitPoint.php
index f5f6874438..bb372c1786 100644
--- a/src/Analyser/StatementExitPoint.php
+++ b/src/Analyser/StatementExitPoint.php
@@ -7,14 +7,8 @@
class StatementExitPoint
{
- private Stmt $statement;
-
- private MutatingScope $scope;
-
- public function __construct(Stmt $statement, MutatingScope $scope)
+ public function __construct(private Stmt $statement, private MutatingScope $scope)
{
- $this->statement = $statement;
- $this->scope = $scope;
}
public function getStatement(): Stmt
diff --git a/src/Analyser/StatementResult.php b/src/Analyser/StatementResult.php
index 299b35dea5..729e7a5ec0 100644
--- a/src/Analyser/StatementResult.php
+++ b/src/Analyser/StatementResult.php
@@ -8,35 +8,18 @@
class StatementResult
{
- private MutatingScope $scope;
-
- private bool $hasYield;
-
- private bool $isAlwaysTerminating;
-
- /** @var StatementExitPoint[] */
- private array $exitPoints;
-
- /** @var ThrowPoint[] */
- private array $throwPoints;
-
/**
* @param StatementExitPoint[] $exitPoints
* @param ThrowPoint[] $throwPoints
*/
public function __construct(
- MutatingScope $scope,
- bool $hasYield,
- bool $isAlwaysTerminating,
- array $exitPoints,
- array $throwPoints,
+ private MutatingScope $scope,
+ private bool $hasYield,
+ private bool $isAlwaysTerminating,
+ private array $exitPoints,
+ private array $throwPoints,
)
{
- $this->scope = $scope;
- $this->hasYield = $hasYield;
- $this->isAlwaysTerminating = $isAlwaysTerminating;
- $this->exitPoints = $exitPoints;
- $this->throwPoints = $throwPoints;
}
public function getScope(): MutatingScope
diff --git a/src/Analyser/ThrowPoint.php b/src/Analyser/ThrowPoint.php
index f113cf2aa6..c25c5dc05d 100644
--- a/src/Analyser/ThrowPoint.php
+++ b/src/Analyser/ThrowPoint.php
@@ -11,33 +11,17 @@
class ThrowPoint
{
- private MutatingScope $scope;
-
- private Type $type;
-
- /** @var Node\Expr|Node\Stmt */
- private Node $node;
-
- private bool $explicit;
-
- private bool $canContainAnyThrowable;
-
/**
* @param Node\Expr|Node\Stmt $node
*/
private function __construct(
- MutatingScope $scope,
- Type $type,
- Node $node,
- bool $explicit,
- bool $canContainAnyThrowable,
+ private MutatingScope $scope,
+ private Type $type,
+ private Node $node,
+ private bool $explicit,
+ private bool $canContainAnyThrowable,
)
{
- $this->scope = $scope;
- $this->type = $type;
- $this->node = $node;
- $this->explicit = $explicit;
- $this->canContainAnyThrowable = $canContainAnyThrowable;
}
/**
diff --git a/src/Analyser/TypeSpecifier.php b/src/Analyser/TypeSpecifier.php
index f34ec45245..d33380b40b 100644
--- a/src/Analyser/TypeSpecifier.php
+++ b/src/Analyser/TypeSpecifier.php
@@ -67,19 +67,6 @@
class TypeSpecifier
{
- private Standard $printer;
-
- private ReflectionProvider $reflectionProvider;
-
- /** @var FunctionTypeSpecifyingExtension[] */
- private array $functionTypeSpecifyingExtensions;
-
- /** @var MethodTypeSpecifyingExtension[] */
- private array $methodTypeSpecifyingExtensions;
-
- /** @var StaticMethodTypeSpecifyingExtension[] */
- private array $staticMethodTypeSpecifyingExtensions;
-
/** @var MethodTypeSpecifyingExtension[][]|null */
private ?array $methodTypeSpecifyingExtensionsByClass = null;
@@ -92,16 +79,13 @@ class TypeSpecifier
* @param StaticMethodTypeSpecifyingExtension[] $staticMethodTypeSpecifyingExtensions
*/
public function __construct(
- Standard $printer,
- ReflectionProvider $reflectionProvider,
- array $functionTypeSpecifyingExtensions,
- array $methodTypeSpecifyingExtensions,
- array $staticMethodTypeSpecifyingExtensions,
+ private Standard $printer,
+ private ReflectionProvider $reflectionProvider,
+ private array $functionTypeSpecifyingExtensions,
+ private array $methodTypeSpecifyingExtensions,
+ private array $staticMethodTypeSpecifyingExtensions,
)
{
- $this->printer = $printer;
- $this->reflectionProvider = $reflectionProvider;
-
foreach (array_merge($functionTypeSpecifyingExtensions, $methodTypeSpecifyingExtensions, $staticMethodTypeSpecifyingExtensions) as $extension) {
if (!($extension instanceof TypeSpecifierAwareExtension)) {
continue;
@@ -109,10 +93,6 @@ public function __construct(
$extension->setTypeSpecifier($this);
}
-
- $this->functionTypeSpecifyingExtensions = $functionTypeSpecifyingExtensions;
- $this->methodTypeSpecifyingExtensions = $methodTypeSpecifyingExtensions;
- $this->staticMethodTypeSpecifyingExtensions = $staticMethodTypeSpecifyingExtensions;
}
/** @api */
diff --git a/src/Analyser/TypeSpecifierContext.php b/src/Analyser/TypeSpecifierContext.php
index 86ea333901..a14aba7112 100644
--- a/src/Analyser/TypeSpecifierContext.php
+++ b/src/Analyser/TypeSpecifierContext.php
@@ -16,14 +16,11 @@ class TypeSpecifierContext
public const CONTEXT_FALSEY = self::CONTEXT_FALSE | self::CONTEXT_FALSEY_BUT_NOT_FALSE;
public const CONTEXT_BITMASK = 0b1111;
- private ?int $value;
-
/** @var self[] */
private static array $registry;
- private function __construct(?int $value)
+ private function __construct(private ?int $value)
{
- $this->value = $value;
}
private static function create(?int $value): self
diff --git a/src/Analyser/TypeSpecifierFactory.php b/src/Analyser/TypeSpecifierFactory.php
index da54e9b6d2..17d638f457 100644
--- a/src/Analyser/TypeSpecifierFactory.php
+++ b/src/Analyser/TypeSpecifierFactory.php
@@ -15,11 +15,8 @@ class TypeSpecifierFactory
public const METHOD_TYPE_SPECIFYING_EXTENSION_TAG = 'phpstan.typeSpecifier.methodTypeSpecifyingExtension';
public const STATIC_METHOD_TYPE_SPECIFYING_EXTENSION_TAG = 'phpstan.typeSpecifier.staticMethodTypeSpecifyingExtension';
- private Container $container;
-
- public function __construct(Container $container)
+ public function __construct(private Container $container)
{
- $this->container = $container;
}
public function create(): TypeSpecifier
diff --git a/src/Analyser/UndefinedVariableException.php b/src/Analyser/UndefinedVariableException.php
index 8c6ace83ea..6719de349c 100644
--- a/src/Analyser/UndefinedVariableException.php
+++ b/src/Analyser/UndefinedVariableException.php
@@ -8,15 +8,9 @@
class UndefinedVariableException extends AnalysedCodeException
{
- private Scope $scope;
-
- private string $variableName;
-
- public function __construct(Scope $scope, string $variableName)
+ public function __construct(private Scope $scope, private string $variableName)
{
parent::__construct(sprintf('Undefined variable: $%s', $variableName));
- $this->scope = $scope;
- $this->variableName = $variableName;
}
public function getScope(): Scope
diff --git a/src/Analyser/VariableTypeHolder.php b/src/Analyser/VariableTypeHolder.php
index aac9e6ba39..70273de965 100644
--- a/src/Analyser/VariableTypeHolder.php
+++ b/src/Analyser/VariableTypeHolder.php
@@ -9,14 +9,8 @@
class VariableTypeHolder
{
- private Type $type;
-
- private TrinaryLogic $certainty;
-
- public function __construct(Type $type, TrinaryLogic $certainty)
+ public function __construct(private Type $type, private TrinaryLogic $certainty)
{
- $this->type = $type;
- $this->certainty = $certainty;
}
public static function createYes(Type $type): self
diff --git a/src/Broker/AnonymousClassNameHelper.php b/src/Broker/AnonymousClassNameHelper.php
index 56b1f923c7..b0e9bdfb40 100644
--- a/src/Broker/AnonymousClassNameHelper.php
+++ b/src/Broker/AnonymousClassNameHelper.php
@@ -12,17 +12,11 @@
class AnonymousClassNameHelper
{
- private FileHelper $fileHelper;
-
- private RelativePathHelper $relativePathHelper;
-
public function __construct(
- FileHelper $fileHelper,
- RelativePathHelper $relativePathHelper,
+ private FileHelper $fileHelper,
+ private RelativePathHelper $relativePathHelper,
)
{
- $this->fileHelper = $fileHelper;
- $this->relativePathHelper = $relativePathHelper;
}
public function getAnonymousClassName(
diff --git a/src/Broker/Broker.php b/src/Broker/Broker.php
index c31a40137c..871078e13d 100644
--- a/src/Broker/Broker.php
+++ b/src/Broker/Broker.php
@@ -14,23 +14,16 @@
class Broker implements ReflectionProvider
{
- private ReflectionProvider $reflectionProvider;
-
- /** @var string[] */
- private array $universalObjectCratesClasses;
-
private static ?Broker $instance = null;
/**
* @param string[] $universalObjectCratesClasses
*/
public function __construct(
- ReflectionProvider $reflectionProvider,
- array $universalObjectCratesClasses,
+ private ReflectionProvider $reflectionProvider,
+ private array $universalObjectCratesClasses,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->universalObjectCratesClasses = $universalObjectCratesClasses;
}
public static function registerInstance(Broker $broker): void
diff --git a/src/Broker/BrokerFactory.php b/src/Broker/BrokerFactory.php
index e31c6f89bd..182b0ca3ca 100644
--- a/src/Broker/BrokerFactory.php
+++ b/src/Broker/BrokerFactory.php
@@ -15,11 +15,8 @@ class BrokerFactory
public const DYNAMIC_FUNCTION_RETURN_TYPE_EXTENSION_TAG = 'phpstan.broker.dynamicFunctionReturnTypeExtension';
public const OPERATOR_TYPE_SPECIFYING_EXTENSION_TAG = 'phpstan.broker.operatorTypeSpecifyingExtension';
- private Container $container;
-
- public function __construct(Container $container)
+ public function __construct(private Container $container)
{
- $this->container = $container;
}
public function create(): Broker
diff --git a/src/Broker/ConstantNotFoundException.php b/src/Broker/ConstantNotFoundException.php
index c2d8cbd91d..2c490e3653 100644
--- a/src/Broker/ConstantNotFoundException.php
+++ b/src/Broker/ConstantNotFoundException.php
@@ -8,12 +8,9 @@
class ConstantNotFoundException extends AnalysedCodeException
{
- private string $constantName;
-
- public function __construct(string $constantName)
+ public function __construct(private string $constantName)
{
parent::__construct(sprintf('Constant %s not found.', $constantName));
- $this->constantName = $constantName;
}
public function getConstantName(): string
diff --git a/src/Broker/FunctionNotFoundException.php b/src/Broker/FunctionNotFoundException.php
index 4387b9ac36..de2728001f 100644
--- a/src/Broker/FunctionNotFoundException.php
+++ b/src/Broker/FunctionNotFoundException.php
@@ -8,12 +8,9 @@
class FunctionNotFoundException extends AnalysedCodeException
{
- private string $functionName;
-
- public function __construct(string $functionName)
+ public function __construct(private string $functionName)
{
parent::__construct(sprintf('Function %s not found while trying to analyse it - discovering symbols is probably not configured properly.', $functionName));
- $this->functionName = $functionName;
}
public function getFunctionName(): string
diff --git a/src/Cache/Cache.php b/src/Cache/Cache.php
index 18e4de8291..0180ab6610 100644
--- a/src/Cache/Cache.php
+++ b/src/Cache/Cache.php
@@ -5,11 +5,8 @@
class Cache
{
- private CacheStorage $storage;
-
- public function __construct(CacheStorage $storage)
+ public function __construct(private CacheStorage $storage)
{
- $this->storage = $storage;
}
/**
diff --git a/src/Cache/CacheItem.php b/src/Cache/CacheItem.php
index 4dab463e62..61d9946c90 100644
--- a/src/Cache/CacheItem.php
+++ b/src/Cache/CacheItem.php
@@ -5,18 +5,11 @@
class CacheItem
{
- private string $variableKey;
-
- /** @var mixed */
- private $data;
-
/**
* @param mixed $data
*/
- public function __construct(string $variableKey, $data)
+ public function __construct(private string $variableKey, private $data)
{
- $this->variableKey = $variableKey;
- $this->data = $data;
}
public function isVariableKeyValid(string $variableKey): bool
diff --git a/src/Cache/FileCacheStorage.php b/src/Cache/FileCacheStorage.php
index b59ddbb27a..fbf0bb359e 100644
--- a/src/Cache/FileCacheStorage.php
+++ b/src/Cache/FileCacheStorage.php
@@ -22,11 +22,8 @@
class FileCacheStorage implements CacheStorage
{
- private string $directory;
-
- public function __construct(string $directory)
+ public function __construct(private string $directory)
{
- $this->directory = $directory;
}
private function makeDir(string $directory): void
diff --git a/src/Command/AnalyseApplication.php b/src/Command/AnalyseApplication.php
index 09736bea5c..37c97e9f6d 100644
--- a/src/Command/AnalyseApplication.php
+++ b/src/Command/AnalyseApplication.php
@@ -24,33 +24,15 @@
class AnalyseApplication
{
- private AnalyserRunner $analyserRunner;
-
- private StubValidator $stubValidator;
-
- private ResultCacheManagerFactory $resultCacheManagerFactory;
-
- private IgnoredErrorHelper $ignoredErrorHelper;
-
- private string $memoryLimitFile;
-
- private int $internalErrorsCountLimit;
-
public function __construct(
- AnalyserRunner $analyserRunner,
- StubValidator $stubValidator,
- ResultCacheManagerFactory $resultCacheManagerFactory,
- IgnoredErrorHelper $ignoredErrorHelper,
- string $memoryLimitFile,
- int $internalErrorsCountLimit,
+ private AnalyserRunner $analyserRunner,
+ private StubValidator $stubValidator,
+ private ResultCacheManagerFactory $resultCacheManagerFactory,
+ private IgnoredErrorHelper $ignoredErrorHelper,
+ private string $memoryLimitFile,
+ private int $internalErrorsCountLimit,
)
{
- $this->analyserRunner = $analyserRunner;
- $this->stubValidator = $stubValidator;
- $this->resultCacheManagerFactory = $resultCacheManagerFactory;
- $this->ignoredErrorHelper = $ignoredErrorHelper;
- $this->memoryLimitFile = $memoryLimitFile;
- $this->internalErrorsCountLimit = $internalErrorsCountLimit;
}
/**
diff --git a/src/Command/AnalyseCommand.php b/src/Command/AnalyseCommand.php
index 0fe4f00ad2..f299696fd1 100644
--- a/src/Command/AnalyseCommand.php
+++ b/src/Command/AnalyseCommand.php
@@ -52,18 +52,14 @@ class AnalyseCommand extends Command
public const DEFAULT_LEVEL = CommandHelper::DEFAULT_LEVEL;
- /** @var string[] */
- private array $composerAutoloaderProjectPaths;
-
/**
* @param string[] $composerAutoloaderProjectPaths
*/
public function __construct(
- array $composerAutoloaderProjectPaths,
+ private array $composerAutoloaderProjectPaths,
)
{
parent::__construct();
- $this->composerAutoloaderProjectPaths = $composerAutoloaderProjectPaths;
}
protected function configure(): void
diff --git a/src/Command/AnalyserRunner.php b/src/Command/AnalyserRunner.php
index 02743a88ec..9a2d3f1281 100644
--- a/src/Command/AnalyserRunner.php
+++ b/src/Command/AnalyserRunner.php
@@ -17,25 +17,13 @@
class AnalyserRunner
{
- private Scheduler $scheduler;
-
- private Analyser $analyser;
-
- private ParallelAnalyser $parallelAnalyser;
-
- private CpuCoreCounter $cpuCoreCounter;
-
public function __construct(
- Scheduler $scheduler,
- Analyser $analyser,
- ParallelAnalyser $parallelAnalyser,
- CpuCoreCounter $cpuCoreCounter,
+ private Scheduler $scheduler,
+ private Analyser $analyser,
+ private ParallelAnalyser $parallelAnalyser,
+ private CpuCoreCounter $cpuCoreCounter,
)
{
- $this->scheduler = $scheduler;
- $this->analyser = $analyser;
- $this->parallelAnalyser = $parallelAnalyser;
- $this->cpuCoreCounter = $cpuCoreCounter;
}
/**
diff --git a/src/Command/AnalysisResult.php b/src/Command/AnalysisResult.php
index 4b1d54f965..92cb217e21 100644
--- a/src/Command/AnalysisResult.php
+++ b/src/Command/AnalysisResult.php
@@ -13,21 +13,6 @@ class AnalysisResult
/** @var Error[] sorted by their file name, line number and message */
private array $fileSpecificErrors;
- /** @var string[] */
- private array $notFileSpecificErrors;
-
- /** @var string[] */
- private array $internalErrors;
-
- /** @var string[] */
- private array $warnings;
-
- private bool $defaultLevelUsed;
-
- private ?string $projectConfigFile;
-
- private bool $savedResultCache;
-
/**
* @param Error[] $fileSpecificErrors
* @param string[] $notFileSpecificErrors
@@ -36,12 +21,12 @@ class AnalysisResult
*/
public function __construct(
array $fileSpecificErrors,
- array $notFileSpecificErrors,
- array $internalErrors,
- array $warnings,
- bool $defaultLevelUsed,
- ?string $projectConfigFile,
- bool $savedResultCache,
+ private array $notFileSpecificErrors,
+ private array $internalErrors,
+ private array $warnings,
+ private bool $defaultLevelUsed,
+ private ?string $projectConfigFile,
+ private bool $savedResultCache,
)
{
usort(
@@ -58,12 +43,6 @@ public function __construct(
);
$this->fileSpecificErrors = $fileSpecificErrors;
- $this->notFileSpecificErrors = $notFileSpecificErrors;
- $this->internalErrors = $internalErrors;
- $this->warnings = $warnings;
- $this->defaultLevelUsed = $defaultLevelUsed;
- $this->projectConfigFile = $projectConfigFile;
- $this->savedResultCache = $savedResultCache;
}
public function hasErrors(): bool
diff --git a/src/Command/ClearResultCacheCommand.php b/src/Command/ClearResultCacheCommand.php
index 25c76dd545..6b385e2819 100644
--- a/src/Command/ClearResultCacheCommand.php
+++ b/src/Command/ClearResultCacheCommand.php
@@ -15,18 +15,14 @@ class ClearResultCacheCommand extends Command
private const NAME = 'clear-result-cache';
- /** @var string[] */
- private array $composerAutoloaderProjectPaths;
-
/**
* @param string[] $composerAutoloaderProjectPaths
*/
public function __construct(
- array $composerAutoloaderProjectPaths,
+ private array $composerAutoloaderProjectPaths,
)
{
parent::__construct();
- $this->composerAutoloaderProjectPaths = $composerAutoloaderProjectPaths;
}
protected function configure(): void
diff --git a/src/Command/ErrorFormatter/BaselineNeonErrorFormatter.php b/src/Command/ErrorFormatter/BaselineNeonErrorFormatter.php
index 7b1e0fde77..244f978551 100644
--- a/src/Command/ErrorFormatter/BaselineNeonErrorFormatter.php
+++ b/src/Command/ErrorFormatter/BaselineNeonErrorFormatter.php
@@ -14,11 +14,8 @@
class BaselineNeonErrorFormatter implements ErrorFormatter
{
- private RelativePathHelper $relativePathHelper;
-
- public function __construct(RelativePathHelper $relativePathHelper)
+ public function __construct(private RelativePathHelper $relativePathHelper)
{
- $this->relativePathHelper = $relativePathHelper;
}
public function formatErrors(
diff --git a/src/Command/ErrorFormatter/CheckstyleErrorFormatter.php b/src/Command/ErrorFormatter/CheckstyleErrorFormatter.php
index 299592cf44..33eb65bb37 100644
--- a/src/Command/ErrorFormatter/CheckstyleErrorFormatter.php
+++ b/src/Command/ErrorFormatter/CheckstyleErrorFormatter.php
@@ -15,11 +15,8 @@
class CheckstyleErrorFormatter implements ErrorFormatter
{
- private RelativePathHelper $relativePathHelper;
-
- public function __construct(RelativePathHelper $relativePathHelper)
+ public function __construct(private RelativePathHelper $relativePathHelper)
{
- $this->relativePathHelper = $relativePathHelper;
}
public function formatErrors(
diff --git a/src/Command/ErrorFormatter/GithubErrorFormatter.php b/src/Command/ErrorFormatter/GithubErrorFormatter.php
index a4070eb8a3..33ee0f3b8e 100644
--- a/src/Command/ErrorFormatter/GithubErrorFormatter.php
+++ b/src/Command/ErrorFormatter/GithubErrorFormatter.php
@@ -17,17 +17,11 @@
class GithubErrorFormatter implements ErrorFormatter
{
- private RelativePathHelper $relativePathHelper;
-
- private ErrorFormatter $errorFormatter;
-
public function __construct(
- RelativePathHelper $relativePathHelper,
- ErrorFormatter $errorFormatter,
+ private RelativePathHelper $relativePathHelper,
+ private ErrorFormatter $errorFormatter,
)
{
- $this->relativePathHelper = $relativePathHelper;
- $this->errorFormatter = $errorFormatter;
}
public function formatErrors(AnalysisResult $analysisResult, Output $output): int
diff --git a/src/Command/ErrorFormatter/GitlabErrorFormatter.php b/src/Command/ErrorFormatter/GitlabErrorFormatter.php
index d8267d6661..6aa4b61bef 100644
--- a/src/Command/ErrorFormatter/GitlabErrorFormatter.php
+++ b/src/Command/ErrorFormatter/GitlabErrorFormatter.php
@@ -15,11 +15,8 @@
class GitlabErrorFormatter implements ErrorFormatter
{
- private RelativePathHelper $relativePathHelper;
-
- public function __construct(RelativePathHelper $relativePathHelper)
+ public function __construct(private RelativePathHelper $relativePathHelper)
{
- $this->relativePathHelper = $relativePathHelper;
}
public function formatErrors(AnalysisResult $analysisResult, Output $output): int
diff --git a/src/Command/ErrorFormatter/JsonErrorFormatter.php b/src/Command/ErrorFormatter/JsonErrorFormatter.php
index 9974197b2d..4c075f0ac7 100644
--- a/src/Command/ErrorFormatter/JsonErrorFormatter.php
+++ b/src/Command/ErrorFormatter/JsonErrorFormatter.php
@@ -11,11 +11,8 @@
class JsonErrorFormatter implements ErrorFormatter
{
- private bool $pretty;
-
- public function __construct(bool $pretty)
+ public function __construct(private bool $pretty)
{
- $this->pretty = $pretty;
}
public function formatErrors(AnalysisResult $analysisResult, Output $output): int
diff --git a/src/Command/ErrorFormatter/JunitErrorFormatter.php b/src/Command/ErrorFormatter/JunitErrorFormatter.php
index 344d318728..072f10483f 100644
--- a/src/Command/ErrorFormatter/JunitErrorFormatter.php
+++ b/src/Command/ErrorFormatter/JunitErrorFormatter.php
@@ -13,11 +13,8 @@
class JunitErrorFormatter implements ErrorFormatter
{
- private RelativePathHelper $relativePathHelper;
-
- public function __construct(RelativePathHelper $relativePathHelper)
+ public function __construct(private RelativePathHelper $relativePathHelper)
{
- $this->relativePathHelper = $relativePathHelper;
}
public function formatErrors(
diff --git a/src/Command/ErrorFormatter/TableErrorFormatter.php b/src/Command/ErrorFormatter/TableErrorFormatter.php
index 3e0114e507..4352aed7a6 100644
--- a/src/Command/ErrorFormatter/TableErrorFormatter.php
+++ b/src/Command/ErrorFormatter/TableErrorFormatter.php
@@ -16,21 +16,12 @@
class TableErrorFormatter implements ErrorFormatter
{
- private RelativePathHelper $relativePathHelper;
-
- private bool $showTipsOfTheDay;
-
- private ?string $editorUrl;
-
public function __construct(
- RelativePathHelper $relativePathHelper,
- bool $showTipsOfTheDay,
- ?string $editorUrl,
+ private RelativePathHelper $relativePathHelper,
+ private bool $showTipsOfTheDay,
+ private ?string $editorUrl,
)
{
- $this->relativePathHelper = $relativePathHelper;
- $this->showTipsOfTheDay = $showTipsOfTheDay;
- $this->editorUrl = $editorUrl;
}
/** @api */
diff --git a/src/Command/ErrorFormatter/TeamcityErrorFormatter.php b/src/Command/ErrorFormatter/TeamcityErrorFormatter.php
index 16547b4d63..a6e6e2cf32 100644
--- a/src/Command/ErrorFormatter/TeamcityErrorFormatter.php
+++ b/src/Command/ErrorFormatter/TeamcityErrorFormatter.php
@@ -18,11 +18,8 @@
class TeamcityErrorFormatter implements ErrorFormatter
{
- private RelativePathHelper $relativePathHelper;
-
- public function __construct(RelativePathHelper $relativePathHelper)
+ public function __construct(private RelativePathHelper $relativePathHelper)
{
- $this->relativePathHelper = $relativePathHelper;
}
public function formatErrors(AnalysisResult $analysisResult, Output $output): int
diff --git a/src/Command/FixerApplication.php b/src/Command/FixerApplication.php
index 1f5be657cd..9d01812a39 100644
--- a/src/Command/FixerApplication.php
+++ b/src/Command/FixerApplication.php
@@ -74,58 +74,27 @@
class FixerApplication
{
- private FileMonitor $fileMonitor;
-
- private ResultCacheManagerFactory $resultCacheManagerFactory;
-
- private ResultCacheClearer $resultCacheClearer;
-
- private IgnoredErrorHelper $ignoredErrorHelper;
-
- private CpuCoreCounter $cpuCoreCounter;
-
- private Scheduler $scheduler;
-
- /** @var string[] */
- private array $analysedPaths;
-
/** @var (ExtendedPromiseInterface&CancellablePromiseInterface)|null */
private $processInProgress;
- private string $currentWorkingDirectory;
-
- private string $fixerTmpDir;
-
- private int $maximumNumberOfProcesses;
-
private ?string $fixerSuggestionId = null;
/**
* @param string[] $analysedPaths
*/
public function __construct(
- FileMonitor $fileMonitor,
- ResultCacheManagerFactory $resultCacheManagerFactory,
- ResultCacheClearer $resultCacheClearer,
- IgnoredErrorHelper $ignoredErrorHelper,
- CpuCoreCounter $cpuCoreCounter,
- Scheduler $scheduler,
- array $analysedPaths,
- string $currentWorkingDirectory,
- string $fixerTmpDir,
- int $maximumNumberOfProcesses,
+ private FileMonitor $fileMonitor,
+ private ResultCacheManagerFactory $resultCacheManagerFactory,
+ private ResultCacheClearer $resultCacheClearer,
+ private IgnoredErrorHelper $ignoredErrorHelper,
+ private CpuCoreCounter $cpuCoreCounter,
+ private Scheduler $scheduler,
+ private array $analysedPaths,
+ private string $currentWorkingDirectory,
+ private string $fixerTmpDir,
+ private int $maximumNumberOfProcesses,
)
{
- $this->fileMonitor = $fileMonitor;
- $this->resultCacheManagerFactory = $resultCacheManagerFactory;
- $this->resultCacheClearer = $resultCacheClearer;
- $this->ignoredErrorHelper = $ignoredErrorHelper;
- $this->cpuCoreCounter = $cpuCoreCounter;
- $this->scheduler = $scheduler;
- $this->analysedPaths = $analysedPaths;
- $this->currentWorkingDirectory = $currentWorkingDirectory;
- $this->fixerTmpDir = $fixerTmpDir;
- $this->maximumNumberOfProcesses = $maximumNumberOfProcesses;
}
/**
diff --git a/src/Command/FixerWorkerCommand.php b/src/Command/FixerWorkerCommand.php
index cbcdeaa996..983a2a20af 100644
--- a/src/Command/FixerWorkerCommand.php
+++ b/src/Command/FixerWorkerCommand.php
@@ -23,18 +23,14 @@ class FixerWorkerCommand extends Command
private const NAME = 'fixer:worker';
- /** @var string[] */
- private array $composerAutoloaderProjectPaths;
-
/**
* @param string[] $composerAutoloaderProjectPaths
*/
public function __construct(
- array $composerAutoloaderProjectPaths,
+ private array $composerAutoloaderProjectPaths,
)
{
parent::__construct();
- $this->composerAutoloaderProjectPaths = $composerAutoloaderProjectPaths;
}
protected function configure(): void
diff --git a/src/Command/IgnoredRegexValidator.php b/src/Command/IgnoredRegexValidator.php
index f2a691d327..59efbf03b5 100644
--- a/src/Command/IgnoredRegexValidator.php
+++ b/src/Command/IgnoredRegexValidator.php
@@ -19,17 +19,11 @@
class IgnoredRegexValidator
{
- private Parser $parser;
-
- private TypeStringResolver $typeStringResolver;
-
public function __construct(
- Parser $parser,
- TypeStringResolver $typeStringResolver,
+ private Parser $parser,
+ private TypeStringResolver $typeStringResolver,
)
{
- $this->parser = $parser;
- $this->typeStringResolver = $typeStringResolver;
}
public function validate(string $regex): IgnoredRegexValidatorResult
diff --git a/src/Command/IgnoredRegexValidatorResult.php b/src/Command/IgnoredRegexValidatorResult.php
index ac2aac92ce..fcda6a015b 100644
--- a/src/Command/IgnoredRegexValidatorResult.php
+++ b/src/Command/IgnoredRegexValidatorResult.php
@@ -5,33 +5,17 @@
class IgnoredRegexValidatorResult
{
- /** @var array */
- private array $ignoredTypes;
-
- private bool $anchorsInTheMiddle;
-
- private bool $allErrorsIgnored;
-
- private ?string $wrongSequence;
-
- private ?string $escapedWrongSequence;
-
/**
* @param array $ignoredTypes
*/
public function __construct(
- array $ignoredTypes,
- bool $anchorsInTheMiddle,
- bool $allErrorsIgnored,
- ?string $wrongSequence = null,
- ?string $escapedWrongSequence = null,
+ private array $ignoredTypes,
+ private bool $anchorsInTheMiddle,
+ private bool $allErrorsIgnored,
+ private ?string $wrongSequence = null,
+ private ?string $escapedWrongSequence = null,
)
{
- $this->ignoredTypes = $ignoredTypes;
- $this->anchorsInTheMiddle = $anchorsInTheMiddle;
- $this->allErrorsIgnored = $allErrorsIgnored;
- $this->wrongSequence = $wrongSequence;
- $this->escapedWrongSequence = $escapedWrongSequence;
}
/**
diff --git a/src/Command/InceptionResult.php b/src/Command/InceptionResult.php
index 9dd434ff92..35ad667222 100644
--- a/src/Command/InceptionResult.php
+++ b/src/Command/InceptionResult.php
@@ -14,48 +14,23 @@ class InceptionResult
/** @var callable(): (array{string[], bool}) */
private $filesCallback;
- private Output $stdOutput;
-
- private Output $errorOutput;
-
- private Container $container;
-
- private bool $isDefaultLevelUsed;
-
- private string $memoryLimitFile;
-
- private ?string $projectConfigFile;
-
- /** @var mixed[]|null */
- private ?array $projectConfigArray;
-
- private ?string $generateBaselineFile;
-
/**
* @param callable(): (array{string[], bool}) $filesCallback
- * @param mixed[] $projectConfigArray
+ * @param mixed[]|null $projectConfigArray
*/
public function __construct(
callable $filesCallback,
- Output $stdOutput,
- Output $errorOutput,
- Container $container,
- bool $isDefaultLevelUsed,
- string $memoryLimitFile,
- ?string $projectConfigFile,
- ?array $projectConfigArray,
- ?string $generateBaselineFile,
+ private Output $stdOutput,
+ private Output $errorOutput,
+ private Container $container,
+ private bool $isDefaultLevelUsed,
+ private string $memoryLimitFile,
+ private ?string $projectConfigFile,
+ private ?array $projectConfigArray,
+ private ?string $generateBaselineFile,
)
{
$this->filesCallback = $filesCallback;
- $this->stdOutput = $stdOutput;
- $this->errorOutput = $errorOutput;
- $this->container = $container;
- $this->isDefaultLevelUsed = $isDefaultLevelUsed;
- $this->memoryLimitFile = $memoryLimitFile;
- $this->projectConfigFile = $projectConfigFile;
- $this->projectConfigArray = $projectConfigArray;
- $this->generateBaselineFile = $generateBaselineFile;
}
/**
diff --git a/src/Command/Symfony/SymfonyOutput.php b/src/Command/Symfony/SymfonyOutput.php
index 507348965e..5e1a46273a 100644
--- a/src/Command/Symfony/SymfonyOutput.php
+++ b/src/Command/Symfony/SymfonyOutput.php
@@ -12,17 +12,11 @@
class SymfonyOutput implements Output
{
- private OutputInterface $symfonyOutput;
-
- private OutputStyle $style;
-
public function __construct(
- OutputInterface $symfonyOutput,
- OutputStyle $style,
+ private OutputInterface $symfonyOutput,
+ private OutputStyle $style,
)
{
- $this->symfonyOutput = $symfonyOutput;
- $this->style = $style;
}
public function writeFormatted(string $message): void
diff --git a/src/Command/Symfony/SymfonyStyle.php b/src/Command/Symfony/SymfonyStyle.php
index 46368f0c42..99ed87ec33 100644
--- a/src/Command/Symfony/SymfonyStyle.php
+++ b/src/Command/Symfony/SymfonyStyle.php
@@ -11,11 +11,8 @@
class SymfonyStyle implements OutputStyle
{
- private StyleInterface $symfonyStyle;
-
- public function __construct(StyleInterface $symfonyStyle)
+ public function __construct(private StyleInterface $symfonyStyle)
{
- $this->symfonyStyle = $symfonyStyle;
}
public function getSymfonyStyle(): StyleInterface
diff --git a/src/Command/WorkerCommand.php b/src/Command/WorkerCommand.php
index b9b04fe2da..711359314d 100644
--- a/src/Command/WorkerCommand.php
+++ b/src/Command/WorkerCommand.php
@@ -36,20 +36,16 @@ class WorkerCommand extends Command
private const NAME = 'worker';
- /** @var string[] */
- private array $composerAutoloaderProjectPaths;
-
private int $errorCount = 0;
/**
* @param string[] $composerAutoloaderProjectPaths
*/
public function __construct(
- array $composerAutoloaderProjectPaths,
+ private array $composerAutoloaderProjectPaths,
)
{
parent::__construct();
- $this->composerAutoloaderProjectPaths = $composerAutoloaderProjectPaths;
}
protected function configure(): void
diff --git a/src/Dependency/DependencyResolver.php b/src/Dependency/DependencyResolver.php
index af43e14ded..8c650dd8b3 100644
--- a/src/Dependency/DependencyResolver.php
+++ b/src/Dependency/DependencyResolver.php
@@ -28,21 +28,12 @@
class DependencyResolver
{
- private FileHelper $fileHelper;
-
- private ReflectionProvider $reflectionProvider;
-
- private ExportedNodeResolver $exportedNodeResolver;
-
public function __construct(
- FileHelper $fileHelper,
- ReflectionProvider $reflectionProvider,
- ExportedNodeResolver $exportedNodeResolver,
+ private FileHelper $fileHelper,
+ private ReflectionProvider $reflectionProvider,
+ private ExportedNodeResolver $exportedNodeResolver,
)
{
- $this->fileHelper = $fileHelper;
- $this->reflectionProvider = $reflectionProvider;
- $this->exportedNodeResolver = $exportedNodeResolver;
}
public function resolveDependencies(Node $node, Scope $scope): NodeDependencies
diff --git a/src/Dependency/ExportedNode/ExportedClassConstantNode.php b/src/Dependency/ExportedNode/ExportedClassConstantNode.php
index e91d25c546..c24510b3cc 100644
--- a/src/Dependency/ExportedNode/ExportedClassConstantNode.php
+++ b/src/Dependency/ExportedNode/ExportedClassConstantNode.php
@@ -9,14 +9,8 @@
class ExportedClassConstantNode implements ExportedNode, JsonSerializable
{
- private string $name;
-
- private string $value;
-
- public function __construct(string $name, string $value)
+ public function __construct(private string $name, private string $value)
{
- $this->name = $name;
- $this->value = $value;
}
public function equals(ExportedNode $node): bool
diff --git a/src/Dependency/ExportedNode/ExportedClassConstantsNode.php b/src/Dependency/ExportedNode/ExportedClassConstantsNode.php
index 15641d5f04..04bace7282 100644
--- a/src/Dependency/ExportedNode/ExportedClassConstantsNode.php
+++ b/src/Dependency/ExportedNode/ExportedClassConstantsNode.php
@@ -12,27 +12,11 @@
class ExportedClassConstantsNode implements ExportedNode, JsonSerializable
{
- /** @var ExportedClassConstantNode[] */
- private array $constants;
-
- private bool $public;
-
- private bool $private;
-
- private bool $final;
-
- private ?ExportedPhpDocNode $phpDoc;
-
/**
* @param ExportedClassConstantNode[] $constants
*/
- public function __construct(array $constants, bool $public, bool $private, bool $final, ?ExportedPhpDocNode $phpDoc)
+ public function __construct(private array $constants, private bool $public, private bool $private, private bool $final, private ?ExportedPhpDocNode $phpDoc)
{
- $this->constants = $constants;
- $this->public = $public;
- $this->private = $private;
- $this->final = $final;
- $this->phpDoc = $phpDoc;
}
public function equals(ExportedNode $node): bool
diff --git a/src/Dependency/ExportedNode/ExportedClassNode.php b/src/Dependency/ExportedNode/ExportedClassNode.php
index fd7b03a630..c46001f515 100644
--- a/src/Dependency/ExportedNode/ExportedClassNode.php
+++ b/src/Dependency/ExportedNode/ExportedClassNode.php
@@ -12,28 +12,6 @@
class ExportedClassNode implements ExportedNode, JsonSerializable
{
- private string $name;
-
- private ?ExportedPhpDocNode $phpDoc;
-
- private bool $abstract;
-
- private bool $final;
-
- private ?string $extends;
-
- /** @var string[] */
- private array $implements;
-
- /** @var string[] */
- private array $usedTraits;
-
- /** @var ExportedTraitUseAdaptation[] */
- private array $traitUseAdaptations;
-
- /** @var ExportedNode[] */
- private array $statements;
-
/**
* @param string[] $implements
* @param string[] $usedTraits
@@ -41,26 +19,17 @@ class ExportedClassNode implements ExportedNode, JsonSerializable
* @param ExportedNode[] $statements
*/
public function __construct(
- string $name,
- ?ExportedPhpDocNode $phpDoc,
- bool $abstract,
- bool $final,
- ?string $extends,
- array $implements,
- array $usedTraits,
- array $traitUseAdaptations,
- array $statements,
+ private string $name,
+ private ?ExportedPhpDocNode $phpDoc,
+ private bool $abstract,
+ private bool $final,
+ private ?string $extends,
+ private array $implements,
+ private array $usedTraits,
+ private array $traitUseAdaptations,
+ private array $statements,
)
{
- $this->name = $name;
- $this->phpDoc = $phpDoc;
- $this->abstract = $abstract;
- $this->final = $final;
- $this->extends = $extends;
- $this->implements = $implements;
- $this->usedTraits = $usedTraits;
- $this->traitUseAdaptations = $traitUseAdaptations;
- $this->statements = $statements;
}
public function equals(ExportedNode $node): bool
diff --git a/src/Dependency/ExportedNode/ExportedEnumCaseNode.php b/src/Dependency/ExportedNode/ExportedEnumCaseNode.php
index e83ebe931a..da304b5893 100644
--- a/src/Dependency/ExportedNode/ExportedEnumCaseNode.php
+++ b/src/Dependency/ExportedNode/ExportedEnumCaseNode.php
@@ -9,17 +9,8 @@
class ExportedEnumCaseNode implements ExportedNode, JsonSerializable
{
- private string $name;
-
- private ?string $value;
-
- private ?ExportedPhpDocNode $phpDoc;
-
- public function __construct(string $name, ?string $value, ?ExportedPhpDocNode $phpDoc)
+ public function __construct(private string $name, private ?string $value, private ?ExportedPhpDocNode $phpDoc)
{
- $this->name = $name;
- $this->value = $value;
- $this->phpDoc = $phpDoc;
}
public function equals(ExportedNode $node): bool
diff --git a/src/Dependency/ExportedNode/ExportedEnumNode.php b/src/Dependency/ExportedNode/ExportedEnumNode.php
index da46fdfd40..831a823658 100644
--- a/src/Dependency/ExportedNode/ExportedEnumNode.php
+++ b/src/Dependency/ExportedNode/ExportedEnumNode.php
@@ -11,29 +11,12 @@
class ExportedEnumNode implements ExportedNode, JsonSerializable
{
- private string $name;
-
- private ?string $scalarType;
-
- private ?ExportedPhpDocNode $phpDoc;
-
- /** @var string[] */
- private array $implements;
-
- /** @var ExportedNode[] */
- private array $statements;
-
/**
* @param string[] $implements
* @param ExportedNode[] $statements
*/
- public function __construct(string $name, ?string $scalarType, ?ExportedPhpDocNode $phpDoc, array $implements, array $statements)
+ public function __construct(private string $name, private ?string $scalarType, private ?ExportedPhpDocNode $phpDoc, private array $implements, private array $statements)
{
- $this->name = $name;
- $this->scalarType = $scalarType;
- $this->phpDoc = $phpDoc;
- $this->implements = $implements;
- $this->statements = $statements;
}
public function equals(ExportedNode $node): bool
diff --git a/src/Dependency/ExportedNode/ExportedFunctionNode.php b/src/Dependency/ExportedNode/ExportedFunctionNode.php
index 93fe9ee311..58f2704c79 100644
--- a/src/Dependency/ExportedNode/ExportedFunctionNode.php
+++ b/src/Dependency/ExportedNode/ExportedFunctionNode.php
@@ -12,33 +12,17 @@
class ExportedFunctionNode implements ExportedNode, JsonSerializable
{
- private string $name;
-
- private ?ExportedPhpDocNode $phpDoc;
-
- private bool $byRef;
-
- private ?string $returnType;
-
- /** @var ExportedParameterNode[] */
- private array $parameters;
-
/**
* @param ExportedParameterNode[] $parameters
*/
public function __construct(
- string $name,
- ?ExportedPhpDocNode $phpDoc,
- bool $byRef,
- ?string $returnType,
- array $parameters,
+ private string $name,
+ private ?ExportedPhpDocNode $phpDoc,
+ private bool $byRef,
+ private ?string $returnType,
+ private array $parameters,
)
{
- $this->name = $name;
- $this->phpDoc = $phpDoc;
- $this->byRef = $byRef;
- $this->returnType = $returnType;
- $this->parameters = $parameters;
}
public function equals(ExportedNode $node): bool
diff --git a/src/Dependency/ExportedNode/ExportedInterfaceNode.php b/src/Dependency/ExportedNode/ExportedInterfaceNode.php
index 032680a0da..285db67f87 100644
--- a/src/Dependency/ExportedNode/ExportedInterfaceNode.php
+++ b/src/Dependency/ExportedNode/ExportedInterfaceNode.php
@@ -11,26 +11,12 @@
class ExportedInterfaceNode implements ExportedNode, JsonSerializable
{
- private string $name;
-
- private ?ExportedPhpDocNode $phpDoc;
-
- /** @var string[] */
- private array $extends;
-
- /** @var ExportedNode[] */
- private array $statements;
-
/**
* @param string[] $extends
* @param ExportedNode[] $statements
*/
- public function __construct(string $name, ?ExportedPhpDocNode $phpDoc, array $extends, array $statements)
+ public function __construct(private string $name, private ?ExportedPhpDocNode $phpDoc, private array $extends, private array $statements)
{
- $this->name = $name;
- $this->phpDoc = $phpDoc;
- $this->extends = $extends;
- $this->statements = $statements;
}
public function equals(ExportedNode $node): bool
diff --git a/src/Dependency/ExportedNode/ExportedMethodNode.php b/src/Dependency/ExportedNode/ExportedMethodNode.php
index 990f97aba8..7cb3376fab 100644
--- a/src/Dependency/ExportedNode/ExportedMethodNode.php
+++ b/src/Dependency/ExportedNode/ExportedMethodNode.php
@@ -12,53 +12,22 @@
class ExportedMethodNode implements ExportedNode, JsonSerializable
{
- private string $name;
-
- private ?ExportedPhpDocNode $phpDoc;
-
- private bool $byRef;
-
- private bool $public;
-
- private bool $private;
-
- private bool $abstract;
-
- private bool $final;
-
- private bool $static;
-
- private ?string $returnType;
-
- /** @var ExportedParameterNode[] */
- private array $parameters;
-
/**
* @param ExportedParameterNode[] $parameters
*/
public function __construct(
- string $name,
- ?ExportedPhpDocNode $phpDoc,
- bool $byRef,
- bool $public,
- bool $private,
- bool $abstract,
- bool $final,
- bool $static,
- ?string $returnType,
- array $parameters,
+ private string $name,
+ private ?ExportedPhpDocNode $phpDoc,
+ private bool $byRef,
+ private bool $public,
+ private bool $private,
+ private bool $abstract,
+ private bool $final,
+ private bool $static,
+ private ?string $returnType,
+ private array $parameters,
)
{
- $this->name = $name;
- $this->phpDoc = $phpDoc;
- $this->byRef = $byRef;
- $this->public = $public;
- $this->private = $private;
- $this->abstract = $abstract;
- $this->final = $final;
- $this->static = $static;
- $this->returnType = $returnType;
- $this->parameters = $parameters;
}
public function equals(ExportedNode $node): bool
diff --git a/src/Dependency/ExportedNode/ExportedParameterNode.php b/src/Dependency/ExportedNode/ExportedParameterNode.php
index 844a7c0d20..ad36f20c42 100644
--- a/src/Dependency/ExportedNode/ExportedParameterNode.php
+++ b/src/Dependency/ExportedNode/ExportedParameterNode.php
@@ -9,29 +9,14 @@
class ExportedParameterNode implements ExportedNode, JsonSerializable
{
- private string $name;
-
- private ?string $type;
-
- private bool $byRef;
-
- private bool $variadic;
-
- private bool $hasDefault;
-
public function __construct(
- string $name,
- ?string $type,
- bool $byRef,
- bool $variadic,
- bool $hasDefault,
+ private string $name,
+ private ?string $type,
+ private bool $byRef,
+ private bool $variadic,
+ private bool $hasDefault,
)
{
- $this->name = $name;
- $this->type = $type;
- $this->byRef = $byRef;
- $this->variadic = $variadic;
- $this->hasDefault = $hasDefault;
}
public function equals(ExportedNode $node): bool
diff --git a/src/Dependency/ExportedNode/ExportedPhpDocNode.php b/src/Dependency/ExportedNode/ExportedPhpDocNode.php
index 4b7af4f48d..fbb3d3bd0d 100644
--- a/src/Dependency/ExportedNode/ExportedPhpDocNode.php
+++ b/src/Dependency/ExportedNode/ExportedPhpDocNode.php
@@ -9,20 +9,14 @@
class ExportedPhpDocNode implements ExportedNode, JsonSerializable
{
- private string $phpDocString;
-
- private ?string $namespace;
-
/** @var array alias(string) => fullName(string) */
private array $uses;
/**
* @param array $uses
*/
- public function __construct(string $phpDocString, ?string $namespace, array $uses)
+ public function __construct(private string $phpDocString, private ?string $namespace, array $uses)
{
- $this->phpDocString = $phpDocString;
- $this->namespace = $namespace;
$this->uses = $uses;
}
diff --git a/src/Dependency/ExportedNode/ExportedPropertiesNode.php b/src/Dependency/ExportedNode/ExportedPropertiesNode.php
index 698aec1c3a..2b61556824 100644
--- a/src/Dependency/ExportedNode/ExportedPropertiesNode.php
+++ b/src/Dependency/ExportedNode/ExportedPropertiesNode.php
@@ -10,41 +10,19 @@
class ExportedPropertiesNode implements JsonSerializable, ExportedNode
{
- /** @var string[] */
- private array $names;
-
- private ?ExportedPhpDocNode $phpDoc;
-
- private ?string $type;
-
- private bool $public;
-
- private bool $private;
-
- private bool $static;
-
- private bool $readonly;
-
/**
* @param string[] $names
*/
public function __construct(
- array $names,
- ?ExportedPhpDocNode $phpDoc,
- ?string $type,
- bool $public,
- bool $private,
- bool $static,
- bool $readonly,
+ private array $names,
+ private ?ExportedPhpDocNode $phpDoc,
+ private ?string $type,
+ private bool $public,
+ private bool $private,
+ private bool $static,
+ private bool $readonly,
)
{
- $this->names = $names;
- $this->phpDoc = $phpDoc;
- $this->type = $type;
- $this->public = $public;
- $this->private = $private;
- $this->static = $static;
- $this->readonly = $readonly;
}
public function equals(ExportedNode $node): bool
diff --git a/src/Dependency/ExportedNode/ExportedTraitNode.php b/src/Dependency/ExportedNode/ExportedTraitNode.php
index ae021e013b..7874fca68c 100644
--- a/src/Dependency/ExportedNode/ExportedTraitNode.php
+++ b/src/Dependency/ExportedNode/ExportedTraitNode.php
@@ -9,11 +9,8 @@
class ExportedTraitNode implements ExportedNode, JsonSerializable
{
- private string $traitName;
-
- public function __construct(string $traitName)
+ public function __construct(private string $traitName)
{
- $this->traitName = $traitName;
}
public function equals(ExportedNode $node): bool
diff --git a/src/Dependency/ExportedNode/ExportedTraitUseAdaptation.php b/src/Dependency/ExportedNode/ExportedTraitUseAdaptation.php
index e9ee440afd..57f3491010 100644
--- a/src/Dependency/ExportedNode/ExportedTraitUseAdaptation.php
+++ b/src/Dependency/ExportedNode/ExportedTraitUseAdaptation.php
@@ -9,33 +9,17 @@
class ExportedTraitUseAdaptation implements ExportedNode, JsonSerializable
{
- private ?string $traitName;
-
- private string $method;
-
- private ?int $newModifier;
-
- private ?string $newName;
-
- /** @var string[]|null */
- private ?array $insteadOfs;
-
/**
* @param string[]|null $insteadOfs
*/
private function __construct(
- ?string $traitName,
- string $method,
- ?int $newModifier,
- ?string $newName,
- ?array $insteadOfs,
+ private ?string $traitName,
+ private string $method,
+ private ?int $newModifier,
+ private ?string $newName,
+ private ?array $insteadOfs,
)
{
- $this->traitName = $traitName;
- $this->method = $method;
- $this->newModifier = $newModifier;
- $this->newName = $newName;
- $this->insteadOfs = $insteadOfs;
}
public static function createAlias(
diff --git a/src/Dependency/ExportedNodeFetcher.php b/src/Dependency/ExportedNodeFetcher.php
index 354669c19d..95d82d5057 100644
--- a/src/Dependency/ExportedNodeFetcher.php
+++ b/src/Dependency/ExportedNodeFetcher.php
@@ -10,17 +10,11 @@
class ExportedNodeFetcher
{
- private Parser $parser;
-
- private ExportedNodeVisitor $visitor;
-
public function __construct(
- Parser $parser,
- ExportedNodeVisitor $visitor,
+ private Parser $parser,
+ private ExportedNodeVisitor $visitor,
)
{
- $this->parser = $parser;
- $this->visitor = $visitor;
}
/**
diff --git a/src/Dependency/ExportedNodeResolver.php b/src/Dependency/ExportedNodeResolver.php
index 623fa1c4b2..0a2dc26633 100644
--- a/src/Dependency/ExportedNodeResolver.php
+++ b/src/Dependency/ExportedNodeResolver.php
@@ -30,14 +30,8 @@
class ExportedNodeResolver
{
- private FileTypeMapper $fileTypeMapper;
-
- private Standard $printer;
-
- public function __construct(FileTypeMapper $fileTypeMapper, Standard $printer)
+ public function __construct(private FileTypeMapper $fileTypeMapper, private Standard $printer)
{
- $this->fileTypeMapper = $fileTypeMapper;
- $this->printer = $printer;
}
public function resolve(string $fileName, Node $node): ?ExportedNode
diff --git a/src/Dependency/ExportedNodeVisitor.php b/src/Dependency/ExportedNodeVisitor.php
index 3e0705b5f1..61579fba4d 100644
--- a/src/Dependency/ExportedNodeVisitor.php
+++ b/src/Dependency/ExportedNodeVisitor.php
@@ -10,8 +10,6 @@
class ExportedNodeVisitor extends NodeVisitorAbstract
{
- private ExportedNodeResolver $exportedNodeResolver;
-
private ?string $fileName = null;
/** @var ExportedNode[] */
@@ -21,9 +19,8 @@ class ExportedNodeVisitor extends NodeVisitorAbstract
* ExportedNodeVisitor constructor.
*
*/
- public function __construct(ExportedNodeResolver $exportedNodeResolver)
+ public function __construct(private ExportedNodeResolver $exportedNodeResolver)
{
- $this->exportedNodeResolver = $exportedNodeResolver;
}
public function reset(string $fileName): void
diff --git a/src/Dependency/NodeDependencies.php b/src/Dependency/NodeDependencies.php
index 6178f41abc..2b35652747 100644
--- a/src/Dependency/NodeDependencies.php
+++ b/src/Dependency/NodeDependencies.php
@@ -10,25 +10,15 @@
class NodeDependencies
{
- private FileHelper $fileHelper;
-
- /** @var array */
- private array $reflections;
-
- private ?ExportedNode $exportedNode;
-
/**
* @param array $reflections
*/
public function __construct(
- FileHelper $fileHelper,
- array $reflections,
- ?ExportedNode $exportedNode,
+ private FileHelper $fileHelper,
+ private array $reflections,
+ private ?ExportedNode $exportedNode,
)
{
- $this->fileHelper = $fileHelper;
- $this->reflections = $reflections;
- $this->exportedNode = $exportedNode;
}
/**
diff --git a/src/DependencyInjection/Configurator.php b/src/DependencyInjection/Configurator.php
index b5f0da9b50..1d3ba2b654 100644
--- a/src/DependencyInjection/Configurator.php
+++ b/src/DependencyInjection/Configurator.php
@@ -11,12 +11,8 @@
class Configurator extends \Nette\Bootstrap\Configurator
{
- private LoaderFactory $loaderFactory;
-
- public function __construct(LoaderFactory $loaderFactory)
+ public function __construct(private LoaderFactory $loaderFactory)
{
- $this->loaderFactory = $loaderFactory;
-
parent::__construct();
}
diff --git a/src/DependencyInjection/ContainerFactory.php b/src/DependencyInjection/ContainerFactory.php
index b4965801cf..9a3d2829e8 100644
--- a/src/DependencyInjection/ContainerFactory.php
+++ b/src/DependencyInjection/ContainerFactory.php
@@ -29,8 +29,6 @@
class ContainerFactory
{
- private string $currentWorkingDirectory;
-
private FileHelper $fileHelper;
private string $rootDirectory;
@@ -38,9 +36,8 @@ class ContainerFactory
private string $configDirectory;
/** @api */
- public function __construct(string $currentWorkingDirectory)
+ public function __construct(private string $currentWorkingDirectory)
{
- $this->currentWorkingDirectory = $currentWorkingDirectory;
$this->fileHelper = new FileHelper($currentWorkingDirectory);
$rootDir = __DIR__ . '/../..';
diff --git a/src/DependencyInjection/DerivativeContainerFactory.php b/src/DependencyInjection/DerivativeContainerFactory.php
index 3054cb5e9e..c859340da9 100644
--- a/src/DependencyInjection/DerivativeContainerFactory.php
+++ b/src/DependencyInjection/DerivativeContainerFactory.php
@@ -7,32 +7,6 @@
class DerivativeContainerFactory
{
- private string $currentWorkingDirectory;
-
- private string $tempDirectory;
-
- /** @var string[] */
- private array $additionalConfigFiles;
-
- /** @var string[] */
- private array $analysedPaths;
-
- /** @var string[] */
- private array $composerAutoloaderProjectPaths;
-
- /** @var string[] */
- private array $analysedPathsFromConfig;
-
- private string $usedLevel;
-
- private ?string $generateBaselineFile;
-
- private ?string $cliAutoloadFile;
-
- private ?string $singleReflectionFile;
-
- private ?string $singleReflectionInsteadOfFile;
-
/**
* @param string[] $additionalConfigFiles
* @param string[] $analysedPaths
@@ -40,30 +14,19 @@ class DerivativeContainerFactory
* @param string[] $analysedPathsFromConfig
*/
public function __construct(
- string $currentWorkingDirectory,
- string $tempDirectory,
- array $additionalConfigFiles,
- array $analysedPaths,
- array $composerAutoloaderProjectPaths,
- array $analysedPathsFromConfig,
- string $usedLevel,
- ?string $generateBaselineFile,
- ?string $cliAutoloadFile,
- ?string $singleReflectionFile,
- ?string $singleReflectionInsteadOfFile,
+ private string $currentWorkingDirectory,
+ private string $tempDirectory,
+ private array $additionalConfigFiles,
+ private array $analysedPaths,
+ private array $composerAutoloaderProjectPaths,
+ private array $analysedPathsFromConfig,
+ private string $usedLevel,
+ private ?string $generateBaselineFile,
+ private ?string $cliAutoloadFile,
+ private ?string $singleReflectionFile,
+ private ?string $singleReflectionInsteadOfFile,
)
{
- $this->currentWorkingDirectory = $currentWorkingDirectory;
- $this->tempDirectory = $tempDirectory;
- $this->additionalConfigFiles = $additionalConfigFiles;
- $this->analysedPaths = $analysedPaths;
- $this->composerAutoloaderProjectPaths = $composerAutoloaderProjectPaths;
- $this->analysedPathsFromConfig = $analysedPathsFromConfig;
- $this->usedLevel = $usedLevel;
- $this->generateBaselineFile = $generateBaselineFile;
- $this->cliAutoloadFile = $cliAutoloadFile;
- $this->singleReflectionFile = $singleReflectionFile;
- $this->singleReflectionInsteadOfFile = $singleReflectionInsteadOfFile;
}
/**
diff --git a/src/DependencyInjection/LoaderFactory.php b/src/DependencyInjection/LoaderFactory.php
index f82805dd0e..d12900f5f1 100644
--- a/src/DependencyInjection/LoaderFactory.php
+++ b/src/DependencyInjection/LoaderFactory.php
@@ -8,25 +8,13 @@
class LoaderFactory
{
- private FileHelper $fileHelper;
-
- private string $rootDir;
-
- private string $currentWorkingDirectory;
-
- private ?string $generateBaselineFile;
-
public function __construct(
- FileHelper $fileHelper,
- string $rootDir,
- string $currentWorkingDirectory,
- ?string $generateBaselineFile,
+ private FileHelper $fileHelper,
+ private string $rootDir,
+ private string $currentWorkingDirectory,
+ private ?string $generateBaselineFile,
)
{
- $this->fileHelper = $fileHelper;
- $this->rootDir = $rootDir;
- $this->currentWorkingDirectory = $currentWorkingDirectory;
- $this->generateBaselineFile = $generateBaselineFile;
}
public function createLoader(): Loader
diff --git a/src/DependencyInjection/MemoizingContainer.php b/src/DependencyInjection/MemoizingContainer.php
index 4e9e223ec8..07e92fbac5 100644
--- a/src/DependencyInjection/MemoizingContainer.php
+++ b/src/DependencyInjection/MemoizingContainer.php
@@ -7,14 +7,11 @@
class MemoizingContainer implements Container
{
- private Container $originalContainer;
-
/** @var array */
private array $servicesByType = [];
- public function __construct(Container $originalContainer)
+ public function __construct(private Container $originalContainer)
{
- $this->originalContainer = $originalContainer;
}
public function hasService(string $serviceName): bool
diff --git a/src/DependencyInjection/NeonLoader.php b/src/DependencyInjection/NeonLoader.php
index aa9eba3404..4f797d1af7 100644
--- a/src/DependencyInjection/NeonLoader.php
+++ b/src/DependencyInjection/NeonLoader.php
@@ -8,17 +8,11 @@
class NeonLoader extends Loader
{
- private FileHelper $fileHelper;
-
- private ?string $generateBaselineFile;
-
public function __construct(
- FileHelper $fileHelper,
- ?string $generateBaselineFile,
+ private FileHelper $fileHelper,
+ private ?string $generateBaselineFile,
)
{
- $this->fileHelper = $fileHelper;
- $this->generateBaselineFile = $generateBaselineFile;
}
/**
diff --git a/src/DependencyInjection/Nette/NetteContainer.php b/src/DependencyInjection/Nette/NetteContainer.php
index 455227fd77..9d9466c8d7 100644
--- a/src/DependencyInjection/Nette/NetteContainer.php
+++ b/src/DependencyInjection/Nette/NetteContainer.php
@@ -14,11 +14,8 @@
class NetteContainer implements Container
{
- private \Nette\DI\Container $container;
-
- public function __construct(\Nette\DI\Container $container)
+ public function __construct(private \Nette\DI\Container $container)
{
- $this->container = $container;
}
public function hasService(string $serviceName): bool
diff --git a/src/DependencyInjection/Reflection/DirectClassReflectionExtensionRegistryProvider.php b/src/DependencyInjection/Reflection/DirectClassReflectionExtensionRegistryProvider.php
index 05219d77cf..fa557b070a 100644
--- a/src/DependencyInjection/Reflection/DirectClassReflectionExtensionRegistryProvider.php
+++ b/src/DependencyInjection/Reflection/DirectClassReflectionExtensionRegistryProvider.php
@@ -13,12 +13,6 @@
class DirectClassReflectionExtensionRegistryProvider implements ClassReflectionExtensionRegistryProvider
{
- /** @var PropertiesClassReflectionExtension[] */
- private array $propertiesClassReflectionExtensions;
-
- /** @var MethodsClassReflectionExtension[] */
- private array $methodsClassReflectionExtensions;
-
private Broker $broker;
/**
@@ -26,12 +20,10 @@ class DirectClassReflectionExtensionRegistryProvider implements ClassReflectionE
* @param MethodsClassReflectionExtension[] $methodsClassReflectionExtensions
*/
public function __construct(
- array $propertiesClassReflectionExtensions,
- array $methodsClassReflectionExtensions,
+ private array $propertiesClassReflectionExtensions,
+ private array $methodsClassReflectionExtensions,
)
{
- $this->propertiesClassReflectionExtensions = $propertiesClassReflectionExtensions;
- $this->methodsClassReflectionExtensions = $methodsClassReflectionExtensions;
}
public function setBroker(Broker $broker): void
diff --git a/src/DependencyInjection/Reflection/LazyClassReflectionExtensionRegistryProvider.php b/src/DependencyInjection/Reflection/LazyClassReflectionExtensionRegistryProvider.php
index 3065e7a156..259600a280 100644
--- a/src/DependencyInjection/Reflection/LazyClassReflectionExtensionRegistryProvider.php
+++ b/src/DependencyInjection/Reflection/LazyClassReflectionExtensionRegistryProvider.php
@@ -14,13 +14,10 @@
class LazyClassReflectionExtensionRegistryProvider implements ClassReflectionExtensionRegistryProvider
{
- private Container $container;
-
private ?ClassReflectionExtensionRegistry $registry = null;
- public function __construct(Container $container)
+ public function __construct(private Container $container)
{
- $this->container = $container;
}
public function getRegistry(): ClassReflectionExtensionRegistry
diff --git a/src/DependencyInjection/Type/LazyDynamicReturnTypeExtensionRegistryProvider.php b/src/DependencyInjection/Type/LazyDynamicReturnTypeExtensionRegistryProvider.php
index 6cc3006ca4..f992ad9ddf 100644
--- a/src/DependencyInjection/Type/LazyDynamicReturnTypeExtensionRegistryProvider.php
+++ b/src/DependencyInjection/Type/LazyDynamicReturnTypeExtensionRegistryProvider.php
@@ -11,13 +11,10 @@
class LazyDynamicReturnTypeExtensionRegistryProvider implements DynamicReturnTypeExtensionRegistryProvider
{
- private Container $container;
-
private ?DynamicReturnTypeExtensionRegistry $registry = null;
- public function __construct(Container $container)
+ public function __construct(private Container $container)
{
- $this->container = $container;
}
public function getRegistry(): DynamicReturnTypeExtensionRegistry
diff --git a/src/DependencyInjection/Type/LazyDynamicThrowTypeExtensionProvider.php b/src/DependencyInjection/Type/LazyDynamicThrowTypeExtensionProvider.php
index ef7885034c..4696fb8b21 100644
--- a/src/DependencyInjection/Type/LazyDynamicThrowTypeExtensionProvider.php
+++ b/src/DependencyInjection/Type/LazyDynamicThrowTypeExtensionProvider.php
@@ -11,11 +11,8 @@ class LazyDynamicThrowTypeExtensionProvider implements DynamicThrowTypeExtension
public const METHOD_TAG = 'phpstan.dynamicMethodThrowTypeExtension';
public const STATIC_METHOD_TAG = 'phpstan.dynamicStaticMethodThrowTypeExtension';
- private Container $container;
-
- public function __construct(Container $container)
+ public function __construct(private Container $container)
{
- $this->container = $container;
}
public function getDynamicFunctionThrowTypeExtensions(): array
diff --git a/src/DependencyInjection/Type/LazyOperatorTypeSpecifyingExtensionRegistryProvider.php b/src/DependencyInjection/Type/LazyOperatorTypeSpecifyingExtensionRegistryProvider.php
index 82fc4fd3ce..22e356fe70 100644
--- a/src/DependencyInjection/Type/LazyOperatorTypeSpecifyingExtensionRegistryProvider.php
+++ b/src/DependencyInjection/Type/LazyOperatorTypeSpecifyingExtensionRegistryProvider.php
@@ -10,13 +10,10 @@
class LazyOperatorTypeSpecifyingExtensionRegistryProvider implements OperatorTypeSpecifyingExtensionRegistryProvider
{
- private Container $container;
-
private ?OperatorTypeSpecifyingExtensionRegistry $registry = null;
- public function __construct(Container $container)
+ public function __construct(private Container $container)
{
- $this->container = $container;
}
public function getRegistry(): OperatorTypeSpecifyingExtensionRegistry
diff --git a/src/File/FileExcluderFactory.php b/src/File/FileExcluderFactory.php
index b8d23ed281..26976a3dfb 100644
--- a/src/File/FileExcluderFactory.php
+++ b/src/File/FileExcluderFactory.php
@@ -10,27 +10,16 @@
class FileExcluderFactory
{
- private FileExcluderRawFactory $fileExcluderRawFactory;
-
- /** @var string[] */
- private array $obsoleteExcludesAnalyse;
-
- /** @var array{analyse?: array, analyseAndScan?: array}|null */
- private ?array $excludePaths;
-
/**
* @param string[] $obsoleteExcludesAnalyse
* @param array{analyse?: array, analyseAndScan?: array}|null $excludePaths
*/
public function __construct(
- FileExcluderRawFactory $fileExcluderRawFactory,
- array $obsoleteExcludesAnalyse,
- ?array $excludePaths,
+ private FileExcluderRawFactory $fileExcluderRawFactory,
+ private array $obsoleteExcludesAnalyse,
+ private ?array $excludePaths,
)
{
- $this->fileExcluderRawFactory = $fileExcluderRawFactory;
- $this->obsoleteExcludesAnalyse = $obsoleteExcludesAnalyse;
- $this->excludePaths = $excludePaths;
}
public function createAnalyseFileExcluder(): FileExcluder
diff --git a/src/File/FileFinder.php b/src/File/FileFinder.php
index 4efdb24a36..d549d9c2cc 100644
--- a/src/File/FileFinder.php
+++ b/src/File/FileFinder.php
@@ -12,25 +12,15 @@
class FileFinder
{
- private FileExcluder $fileExcluder;
-
- private FileHelper $fileHelper;
-
- /** @var string[] */
- private array $fileExtensions;
-
/**
* @param string[] $fileExtensions
*/
public function __construct(
- FileExcluder $fileExcluder,
- FileHelper $fileHelper,
- array $fileExtensions,
+ private FileExcluder $fileExcluder,
+ private FileHelper $fileHelper,
+ private array $fileExtensions,
)
{
- $this->fileExcluder = $fileExcluder;
- $this->fileHelper = $fileHelper;
- $this->fileExtensions = $fileExtensions;
}
/**
diff --git a/src/File/FileFinderResult.php b/src/File/FileFinderResult.php
index 6279ef66f2..d88bcbb84c 100644
--- a/src/File/FileFinderResult.php
+++ b/src/File/FileFinderResult.php
@@ -5,18 +5,11 @@
class FileFinderResult
{
- /** @var string[] */
- private array $files;
-
- private bool $onlyFiles;
-
/**
* @param string[] $files
*/
- public function __construct(array $files, bool $onlyFiles)
+ public function __construct(private array $files, private bool $onlyFiles)
{
- $this->files = $files;
- $this->onlyFiles = $onlyFiles;
}
/**
diff --git a/src/File/FileMonitor.php b/src/File/FileMonitor.php
index 76a6d7d79d..52d91b0729 100644
--- a/src/File/FileMonitor.php
+++ b/src/File/FileMonitor.php
@@ -11,17 +11,14 @@
class FileMonitor
{
- private FileFinder $fileFinder;
-
/** @var array|null */
private ?array $fileHashes = null;
/** @var array|null */
private ?array $paths = null;
- public function __construct(FileFinder $fileFinder)
+ public function __construct(private FileFinder $fileFinder)
{
- $this->fileFinder = $fileFinder;
}
/**
diff --git a/src/File/FileMonitorResult.php b/src/File/FileMonitorResult.php
index 9b71625792..9da77e0bcc 100644
--- a/src/File/FileMonitorResult.php
+++ b/src/File/FileMonitorResult.php
@@ -7,33 +7,18 @@
class FileMonitorResult
{
- /** @var string[] */
- private array $newFiles;
-
- /** @var string[] */
- private array $changedFiles;
-
- /** @var string[] */
- private array $deletedFiles;
-
- private int $totalFilesCount;
-
/**
* @param string[] $newFiles
* @param string[] $changedFiles
* @param string[] $deletedFiles
*/
public function __construct(
- array $newFiles,
- array $changedFiles,
- array $deletedFiles,
- int $totalFilesCount,
+ private array $newFiles,
+ private array $changedFiles,
+ private array $deletedFiles,
+ private int $totalFilesCount,
)
{
- $this->newFiles = $newFiles;
- $this->changedFiles = $changedFiles;
- $this->deletedFiles = $deletedFiles;
- $this->totalFilesCount = $totalFilesCount;
}
public function hasAnyChanges(): bool
diff --git a/src/File/FuzzyRelativePathHelper.php b/src/File/FuzzyRelativePathHelper.php
index 36a8f18596..47452d60a3 100644
--- a/src/File/FuzzyRelativePathHelper.php
+++ b/src/File/FuzzyRelativePathHelper.php
@@ -17,8 +17,6 @@
class FuzzyRelativePathHelper implements RelativePathHelper
{
- private RelativePathHelper $fallbackRelativePathHelper;
-
private string $directorySeparator;
private ?string $pathToTrim = null;
@@ -28,13 +26,12 @@ class FuzzyRelativePathHelper implements RelativePathHelper
* @param non-empty-string|null $directorySeparator
*/
public function __construct(
- RelativePathHelper $fallbackRelativePathHelper,
+ private RelativePathHelper $fallbackRelativePathHelper,
string $currentWorkingDirectory,
array $analysedPaths,
?string $directorySeparator = null,
)
{
- $this->fallbackRelativePathHelper = $fallbackRelativePathHelper;
if ($directorySeparator === null) {
$directorySeparator = DIRECTORY_SEPARATOR;
}
diff --git a/src/File/ParentDirectoryRelativePathHelper.php b/src/File/ParentDirectoryRelativePathHelper.php
index 1c10f3384f..218d4597fc 100644
--- a/src/File/ParentDirectoryRelativePathHelper.php
+++ b/src/File/ParentDirectoryRelativePathHelper.php
@@ -17,11 +17,8 @@
class ParentDirectoryRelativePathHelper implements RelativePathHelper
{
- private string $parentDirectory;
-
- public function __construct(string $parentDirectory)
+ public function __construct(private string $parentDirectory)
{
- $this->parentDirectory = $parentDirectory;
}
public function getRelativePath(string $filename): string
diff --git a/src/File/PathNotFoundException.php b/src/File/PathNotFoundException.php
index 39433b9087..fb8f4dd191 100644
--- a/src/File/PathNotFoundException.php
+++ b/src/File/PathNotFoundException.php
@@ -8,12 +8,9 @@
class PathNotFoundException extends Exception
{
- private string $path;
-
- public function __construct(string $path)
+ public function __construct(private string $path)
{
parent::__construct(sprintf('Path %s does not exist', $path));
- $this->path = $path;
}
public function getPath(): string
diff --git a/src/File/SimpleRelativePathHelper.php b/src/File/SimpleRelativePathHelper.php
index eed49dbed2..14181895ca 100644
--- a/src/File/SimpleRelativePathHelper.php
+++ b/src/File/SimpleRelativePathHelper.php
@@ -10,11 +10,8 @@
class SimpleRelativePathHelper implements RelativePathHelper
{
- private string $currentWorkingDirectory;
-
- public function __construct(string $currentWorkingDirectory)
+ public function __construct(private string $currentWorkingDirectory)
{
- $this->currentWorkingDirectory = $currentWorkingDirectory;
}
public function getRelativePath(string $filename): string
diff --git a/src/Internal/ScopeIsInClassTypeSpecifyingExtension.php b/src/Internal/ScopeIsInClassTypeSpecifyingExtension.php
index 87ac3ada5c..3e63618ff6 100644
--- a/src/Internal/ScopeIsInClassTypeSpecifyingExtension.php
+++ b/src/Internal/ScopeIsInClassTypeSpecifyingExtension.php
@@ -18,23 +18,14 @@
class ScopeIsInClassTypeSpecifyingExtension implements MethodTypeSpecifyingExtension, TypeSpecifierAwareExtension
{
- private string $isInMethodName;
-
- private string $removeNullMethodName;
-
- private ReflectionProvider $reflectionProvider;
-
private TypeSpecifier $typeSpecifier;
public function __construct(
- string $isInMethodName,
- string $removeNullMethodName,
- ReflectionProvider $reflectionProvider,
+ private string $isInMethodName,
+ private string $removeNullMethodName,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->isInMethodName = $isInMethodName;
- $this->removeNullMethodName = $removeNullMethodName;
- $this->reflectionProvider = $reflectionProvider;
}
public function setTypeSpecifier(TypeSpecifier $typeSpecifier): void
diff --git a/src/Node/BooleanAndNode.php b/src/Node/BooleanAndNode.php
index dc325f8325..c4b750de00 100644
--- a/src/Node/BooleanAndNode.php
+++ b/src/Node/BooleanAndNode.php
@@ -11,18 +11,9 @@
class BooleanAndNode extends NodeAbstract implements VirtualNode
{
- private BooleanAnd|LogicalAnd $originalNode;
-
- private Scope $rightScope;
-
- /**
- * @param BooleanAnd|LogicalAnd $originalNode
- */
- public function __construct($originalNode, Scope $rightScope)
+ public function __construct(private BooleanAnd|LogicalAnd $originalNode, private Scope $rightScope)
{
parent::__construct($originalNode->getAttributes());
- $this->originalNode = $originalNode;
- $this->rightScope = $rightScope;
}
/**
diff --git a/src/Node/BooleanOrNode.php b/src/Node/BooleanOrNode.php
index 28a8f24311..fb0e04134a 100644
--- a/src/Node/BooleanOrNode.php
+++ b/src/Node/BooleanOrNode.php
@@ -11,18 +11,9 @@
class BooleanOrNode extends NodeAbstract implements VirtualNode
{
- private BooleanOr|LogicalOr $originalNode;
-
- private Scope $rightScope;
-
- /**
- * @param BooleanOr|LogicalOr $originalNode
- */
- public function __construct($originalNode, Scope $rightScope)
+ public function __construct(private BooleanOr|LogicalOr $originalNode, private Scope $rightScope)
{
parent::__construct($originalNode->getAttributes());
- $this->originalNode = $originalNode;
- $this->rightScope = $rightScope;
}
/**
diff --git a/src/Node/BreaklessWhileLoopNode.php b/src/Node/BreaklessWhileLoopNode.php
index 9ba48fdf8b..8a824778bc 100644
--- a/src/Node/BreaklessWhileLoopNode.php
+++ b/src/Node/BreaklessWhileLoopNode.php
@@ -10,19 +10,12 @@
class BreaklessWhileLoopNode extends NodeAbstract implements VirtualNode
{
- private While_ $originalNode;
-
- /** @var StatementExitPoint[] */
- private array $exitPoints;
-
/**
* @param StatementExitPoint[] $exitPoints
*/
- public function __construct(While_ $originalNode, array $exitPoints)
+ public function __construct(private While_ $originalNode, private array $exitPoints)
{
parent::__construct($originalNode->getAttributes());
- $this->originalNode = $originalNode;
- $this->exitPoints = $exitPoints;
}
public function getOriginalNode(): While_
diff --git a/src/Node/CatchWithUnthrownExceptionNode.php b/src/Node/CatchWithUnthrownExceptionNode.php
index 6c367e32d4..007fa83218 100644
--- a/src/Node/CatchWithUnthrownExceptionNode.php
+++ b/src/Node/CatchWithUnthrownExceptionNode.php
@@ -10,18 +10,9 @@
class CatchWithUnthrownExceptionNode extends NodeAbstract implements VirtualNode
{
- private Catch_ $originalNode;
-
- private Type $caughtType;
-
- private Type $originalCaughtType;
-
- public function __construct(Catch_ $originalNode, Type $caughtType, Type $originalCaughtType)
+ public function __construct(private Catch_ $originalNode, private Type $caughtType, private Type $originalCaughtType)
{
parent::__construct($originalNode->getAttributes());
- $this->originalNode = $originalNode;
- $this->caughtType = $caughtType;
- $this->originalCaughtType = $originalCaughtType;
}
public function getOriginalNode(): Catch_
diff --git a/src/Node/ClassConstantsNode.php b/src/Node/ClassConstantsNode.php
index 3ebb9f87e8..4b725b6bcd 100644
--- a/src/Node/ClassConstantsNode.php
+++ b/src/Node/ClassConstantsNode.php
@@ -11,24 +11,13 @@
class ClassConstantsNode extends NodeAbstract implements VirtualNode
{
- private ClassLike $class;
-
- /** @var ClassConst[] */
- private array $constants;
-
- /** @var ClassConstantFetch[] */
- private array $fetches;
-
/**
* @param ClassConst[] $constants
* @param ClassConstantFetch[] $fetches
*/
- public function __construct(ClassLike $class, array $constants, array $fetches)
+ public function __construct(private ClassLike $class, private array $constants, private array $fetches)
{
parent::__construct($class->getAttributes());
- $this->class = $class;
- $this->constants = $constants;
- $this->fetches = $fetches;
}
public function getClass(): ClassLike
diff --git a/src/Node/ClassMethodsNode.php b/src/Node/ClassMethodsNode.php
index e10fdb72d8..545441e9b4 100644
--- a/src/Node/ClassMethodsNode.php
+++ b/src/Node/ClassMethodsNode.php
@@ -11,24 +11,13 @@
class ClassMethodsNode extends NodeAbstract implements VirtualNode
{
- private ClassLike $class;
-
- /** @var ClassMethod[] */
- private array $methods;
-
- /** @var array */
- private array $methodCalls;
-
/**
* @param ClassMethod[] $methods
* @param array $methodCalls
*/
- public function __construct(ClassLike $class, array $methods, array $methodCalls)
+ public function __construct(private ClassLike $class, private array $methods, private array $methodCalls)
{
parent::__construct($class->getAttributes());
- $this->class = $class;
- $this->methods = $methods;
- $this->methodCalls = $methodCalls;
}
public function getClass(): ClassLike
diff --git a/src/Node/ClassPropertiesNode.php b/src/Node/ClassPropertiesNode.php
index 00ec8603d5..29b85694f6 100644
--- a/src/Node/ClassPropertiesNode.php
+++ b/src/Node/ClassPropertiesNode.php
@@ -28,29 +28,14 @@
class ClassPropertiesNode extends NodeAbstract implements VirtualNode
{
- private ClassLike $class;
-
- /** @var ClassPropertyNode[] */
- private array $properties;
-
- /** @var array */
- private array $propertyUsages;
-
- /** @var array */
- private array $methodCalls;
-
/**
* @param ClassPropertyNode[] $properties
* @param array $propertyUsages
* @param array $methodCalls
*/
- public function __construct(ClassLike $class, array $properties, array $propertyUsages, array $methodCalls)
+ public function __construct(private ClassLike $class, private array $properties, private array $propertyUsages, private array $methodCalls)
{
parent::__construct($class->getAttributes());
- $this->class = $class;
- $this->properties = $properties;
- $this->propertyUsages = $propertyUsages;
- $this->methodCalls = $methodCalls;
}
public function getClass(): ClassLike
diff --git a/src/Node/ClassPropertyNode.php b/src/Node/ClassPropertyNode.php
index c4b5a81a7e..b45d2fd931 100644
--- a/src/Node/ClassPropertyNode.php
+++ b/src/Node/ClassPropertyNode.php
@@ -13,38 +13,17 @@
class ClassPropertyNode extends NodeAbstract implements VirtualNode
{
- private string $name;
-
- private int $flags;
-
- private Identifier|Name|Node\ComplexType|null $type = null;
-
- private ?Expr $default;
-
- private ?string $phpDoc;
-
- private bool $isPromoted;
-
- /**
- * @param Identifier|Name|Node\ComplexType|null $type
- */
public function __construct(
- string $name,
- int $flags,
- $type,
- ?Expr $default,
- ?string $phpDoc,
- bool $isPromoted,
+ private string $name,
+ private int $flags,
+ private Identifier|Name|Node\ComplexType|null $type,
+ private ?Expr $default,
+ private ?string $phpDoc,
+ private bool $isPromoted,
Node $originalNode,
)
{
parent::__construct($originalNode->getAttributes());
- $this->name = $name;
- $this->flags = $flags;
- $this->type = $type;
- $this->default = $default;
- $this->isPromoted = $isPromoted;
- $this->phpDoc = $phpDoc;
}
public function getName(): string
diff --git a/src/Node/ClassStatementsGatherer.php b/src/Node/ClassStatementsGatherer.php
index e9823d19d3..ba3ff8a06e 100644
--- a/src/Node/ClassStatementsGatherer.php
+++ b/src/Node/ClassStatementsGatherer.php
@@ -22,8 +22,6 @@
class ClassStatementsGatherer
{
- private ClassReflection $classReflection;
-
/** @var callable(Node $node, Scope $scope): void */
private $nodeCallback;
@@ -49,11 +47,10 @@ class ClassStatementsGatherer
* @param callable(Node $node, Scope $scope): void $nodeCallback
*/
public function __construct(
- ClassReflection $classReflection,
+ private ClassReflection $classReflection,
callable $nodeCallback,
)
{
- $this->classReflection = $classReflection;
$this->nodeCallback = $nodeCallback;
}
diff --git a/src/Node/ClosureReturnStatementsNode.php b/src/Node/ClosureReturnStatementsNode.php
index 2c97aef7b5..04c229b438 100644
--- a/src/Node/ClosureReturnStatementsNode.php
+++ b/src/Node/ClosureReturnStatementsNode.php
@@ -15,30 +15,19 @@ class ClosureReturnStatementsNode extends NodeAbstract implements ReturnStatemen
private Node\Expr\Closure $closureExpr;
- /** @var ReturnStatement[] */
- private array $returnStatements;
-
- /** @var array */
- private array $yieldStatements;
-
- private StatementResult $statementResult;
-
/**
* @param ReturnStatement[] $returnStatements
* @param array $yieldStatements
*/
public function __construct(
Closure $closureExpr,
- array $returnStatements,
- array $yieldStatements,
- StatementResult $statementResult,
+ private array $returnStatements,
+ private array $yieldStatements,
+ private StatementResult $statementResult,
)
{
parent::__construct($closureExpr->getAttributes());
$this->closureExpr = $closureExpr;
- $this->returnStatements = $returnStatements;
- $this->yieldStatements = $yieldStatements;
- $this->statementResult = $statementResult;
}
public function getClosureExpr(): Closure
diff --git a/src/Node/Constant/ClassConstantFetch.php b/src/Node/Constant/ClassConstantFetch.php
index 0e51150823..30129007d0 100644
--- a/src/Node/Constant/ClassConstantFetch.php
+++ b/src/Node/Constant/ClassConstantFetch.php
@@ -9,14 +9,8 @@
class ClassConstantFetch
{
- private ClassConstFetch $node;
-
- private Scope $scope;
-
- public function __construct(ClassConstFetch $node, Scope $scope)
+ public function __construct(private ClassConstFetch $node, private Scope $scope)
{
- $this->node = $node;
- $this->scope = $scope;
}
public function getNode(): ClassConstFetch
diff --git a/src/Node/DoWhileLoopConditionNode.php b/src/Node/DoWhileLoopConditionNode.php
index 6fdc87cfb0..c6cbc86572 100644
--- a/src/Node/DoWhileLoopConditionNode.php
+++ b/src/Node/DoWhileLoopConditionNode.php
@@ -9,19 +9,12 @@
class DoWhileLoopConditionNode extends NodeAbstract implements VirtualNode
{
- private Expr $cond;
-
- /** @var StatementExitPoint[] */
- private array $exitPoints;
-
/**
* @param StatementExitPoint[] $exitPoints
*/
- public function __construct(Expr $cond, array $exitPoints)
+ public function __construct(private Expr $cond, private array $exitPoints)
{
parent::__construct($cond->getAttributes());
- $this->cond = $cond;
- $this->exitPoints = $exitPoints;
}
public function getCond(): Expr
diff --git a/src/Node/ExecutionEndNode.php b/src/Node/ExecutionEndNode.php
index aba68ae4e8..225036a5ba 100644
--- a/src/Node/ExecutionEndNode.php
+++ b/src/Node/ExecutionEndNode.php
@@ -10,22 +10,13 @@
class ExecutionEndNode extends NodeAbstract implements VirtualNode
{
- private Node $node;
-
- private StatementResult $statementResult;
-
- private bool $hasNativeReturnTypehint;
-
public function __construct(
- Node $node,
- StatementResult $statementResult,
- bool $hasNativeReturnTypehint,
+ private Node $node,
+ private StatementResult $statementResult,
+ private bool $hasNativeReturnTypehint,
)
{
parent::__construct($node->getAttributes());
- $this->node = $node;
- $this->statementResult = $statementResult;
- $this->hasNativeReturnTypehint = $hasNativeReturnTypehint;
}
public function getNode(): Node
diff --git a/src/Node/FileNode.php b/src/Node/FileNode.php
index 97f7ec3d1d..13a6596ced 100644
--- a/src/Node/FileNode.php
+++ b/src/Node/FileNode.php
@@ -9,17 +9,13 @@
class FileNode extends NodeAbstract implements VirtualNode
{
- /** @var Node[] */
- private array $nodes;
-
/**
* @param Node[] $nodes
*/
- public function __construct(array $nodes)
+ public function __construct(private array $nodes)
{
$firstNode = $nodes[0] ?? null;
parent::__construct($firstNode !== null ? $firstNode->getAttributes() : []);
- $this->nodes = $nodes;
}
/**
diff --git a/src/Node/FinallyExitPointsNode.php b/src/Node/FinallyExitPointsNode.php
index 7cdafb1487..a87bdc516c 100644
--- a/src/Node/FinallyExitPointsNode.php
+++ b/src/Node/FinallyExitPointsNode.php
@@ -9,21 +9,13 @@
class FinallyExitPointsNode extends NodeAbstract implements VirtualNode
{
- /** @var StatementExitPoint[] */
- private array $finallyExitPoints;
-
- /** @var StatementExitPoint[] */
- private array $tryCatchExitPoints;
-
/**
* @param StatementExitPoint[] $finallyExitPoints
* @param StatementExitPoint[] $tryCatchExitPoints
*/
- public function __construct(array $finallyExitPoints, array $tryCatchExitPoints)
+ public function __construct(private array $finallyExitPoints, private array $tryCatchExitPoints)
{
parent::__construct([]);
- $this->finallyExitPoints = $finallyExitPoints;
- $this->tryCatchExitPoints = $tryCatchExitPoints;
}
/**
diff --git a/src/Node/FunctionCallableNode.php b/src/Node/FunctionCallableNode.php
index d25b07dbe5..4b2c5589d9 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/FunctionReturnStatementsNode.php b/src/Node/FunctionReturnStatementsNode.php
index 598e855cc2..459da89468 100644
--- a/src/Node/FunctionReturnStatementsNode.php
+++ b/src/Node/FunctionReturnStatementsNode.php
@@ -10,32 +10,18 @@
class FunctionReturnStatementsNode extends NodeAbstract implements ReturnStatementsNode
{
- private Function_ $function;
-
- /** @var ReturnStatement[] */
- private array $returnStatements;
-
- private StatementResult $statementResult;
-
- /** @var ExecutionEndNode[] */
- private array $executionEnds;
-
/**
* @param ReturnStatement[] $returnStatements
* @param ExecutionEndNode[] $executionEnds
*/
public function __construct(
- Function_ $function,
- array $returnStatements,
- StatementResult $statementResult,
- array $executionEnds,
+ private Function_ $function,
+ private array $returnStatements,
+ private StatementResult $statementResult,
+ private array $executionEnds,
)
{
parent::__construct($function->getAttributes());
- $this->function = $function;
- $this->returnStatements = $returnStatements;
- $this->statementResult = $statementResult;
- $this->executionEnds = $executionEnds;
}
/**
diff --git a/src/Node/InClassMethodNode.php b/src/Node/InClassMethodNode.php
index 3f8fff0001..e6c331c208 100644
--- a/src/Node/InClassMethodNode.php
+++ b/src/Node/InClassMethodNode.php
@@ -8,12 +8,9 @@
class InClassMethodNode extends Node\Stmt implements VirtualNode
{
- private Node\Stmt\ClassMethod $originalNode;
-
- public function __construct(Node\Stmt\ClassMethod $originalNode)
+ public function __construct(private Node\Stmt\ClassMethod $originalNode)
{
parent::__construct($originalNode->getAttributes());
- $this->originalNode = $originalNode;
}
public function getOriginalNode(): Node\Stmt\ClassMethod
diff --git a/src/Node/InClassNode.php b/src/Node/InClassNode.php
index 38dd294d5c..23310aaec0 100644
--- a/src/Node/InClassNode.php
+++ b/src/Node/InClassNode.php
@@ -10,15 +10,9 @@
class InClassNode extends Node\Stmt implements VirtualNode
{
- private ClassLike $originalNode;
-
- private ClassReflection $classReflection;
-
- public function __construct(ClassLike $originalNode, ClassReflection $classReflection)
+ public function __construct(private ClassLike $originalNode, private ClassReflection $classReflection)
{
parent::__construct($originalNode->getAttributes());
- $this->originalNode = $originalNode;
- $this->classReflection = $classReflection;
}
public function getOriginalNode(): ClassLike
diff --git a/src/Node/InFunctionNode.php b/src/Node/InFunctionNode.php
index 48b920be5b..fc4649c0bb 100644
--- a/src/Node/InFunctionNode.php
+++ b/src/Node/InFunctionNode.php
@@ -8,12 +8,9 @@
class InFunctionNode extends Node\Stmt implements VirtualNode
{
- private Node\Stmt\Function_ $originalNode;
-
- public function __construct(Node\Stmt\Function_ $originalNode)
+ public function __construct(private Node\Stmt\Function_ $originalNode)
{
parent::__construct($originalNode->getAttributes());
- $this->originalNode = $originalNode;
}
public function getOriginalNode(): Node\Stmt\Function_
diff --git a/src/Node/InstantiationCallableNode.php b/src/Node/InstantiationCallableNode.php
index 5823c26565..acf9a44bf9 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/LiteralArrayItem.php b/src/Node/LiteralArrayItem.php
index 3321ca4977..48dd0e3705 100644
--- a/src/Node/LiteralArrayItem.php
+++ b/src/Node/LiteralArrayItem.php
@@ -9,14 +9,8 @@
class LiteralArrayItem
{
- private Scope $scope;
-
- private ?ArrayItem $arrayItem;
-
- public function __construct(Scope $scope, ?ArrayItem $arrayItem)
+ public function __construct(private Scope $scope, private ?ArrayItem $arrayItem)
{
- $this->scope = $scope;
- $this->arrayItem = $arrayItem;
}
public function getScope(): Scope
diff --git a/src/Node/LiteralArrayNode.php b/src/Node/LiteralArrayNode.php
index 6b7b0805fa..bcbd3f0a93 100644
--- a/src/Node/LiteralArrayNode.php
+++ b/src/Node/LiteralArrayNode.php
@@ -9,16 +9,12 @@
class LiteralArrayNode extends NodeAbstract implements VirtualNode
{
- /** @var LiteralArrayItem[] */
- private array $itemNodes;
-
/**
* @param LiteralArrayItem[] $itemNodes
*/
- public function __construct(Array_ $originalNode, array $itemNodes)
+ public function __construct(Array_ $originalNode, private array $itemNodes)
{
parent::__construct($originalNode->getAttributes());
- $this->itemNodes = $itemNodes;
}
/**
diff --git a/src/Node/MatchExpressionArm.php b/src/Node/MatchExpressionArm.php
index 7b86002848..53832b1bcb 100644
--- a/src/Node/MatchExpressionArm.php
+++ b/src/Node/MatchExpressionArm.php
@@ -6,18 +6,11 @@
class MatchExpressionArm
{
- /** @var MatchExpressionArmCondition[] */
- private array $conditions;
-
- private int $line;
-
/**
* @param MatchExpressionArmCondition[] $conditions
*/
- public function __construct(array $conditions, int $line)
+ public function __construct(private array $conditions, private int $line)
{
- $this->conditions = $conditions;
- $this->line = $line;
}
/**
diff --git a/src/Node/MatchExpressionArmCondition.php b/src/Node/MatchExpressionArmCondition.php
index a5f9ec421b..2928175be7 100644
--- a/src/Node/MatchExpressionArmCondition.php
+++ b/src/Node/MatchExpressionArmCondition.php
@@ -9,17 +9,8 @@
class MatchExpressionArmCondition
{
- private Expr $condition;
-
- private Scope $scope;
-
- private int $line;
-
- public function __construct(Expr $condition, Scope $scope, int $line)
+ public function __construct(private Expr $condition, private Scope $scope, private int $line)
{
- $this->condition = $condition;
- $this->scope = $scope;
- $this->line = $line;
}
public function getCondition(): Expr
diff --git a/src/Node/MatchExpressionNode.php b/src/Node/MatchExpressionNode.php
index 3eff49f13d..00ec3bcf8c 100644
--- a/src/Node/MatchExpressionNode.php
+++ b/src/Node/MatchExpressionNode.php
@@ -10,27 +10,17 @@
class MatchExpressionNode extends NodeAbstract implements VirtualNode
{
- private Expr $condition;
-
- /** @var MatchExpressionArm[] */
- private array $arms;
-
- private Scope $endScope;
-
/**
* @param MatchExpressionArm[] $arms
*/
public function __construct(
- Expr $condition,
- array $arms,
+ private Expr $condition,
+ private array $arms,
Expr\Match_ $originalNode,
- Scope $endScope,
+ private Scope $endScope,
)
{
parent::__construct($originalNode->getAttributes());
- $this->condition = $condition;
- $this->arms = $arms;
- $this->endScope = $endScope;
}
public function getCondition(): Expr
diff --git a/src/Node/Method/MethodCall.php b/src/Node/Method/MethodCall.php
index 9e29f2ff74..19c77316fb 100644
--- a/src/Node/Method/MethodCall.php
+++ b/src/Node/Method/MethodCall.php
@@ -11,17 +11,11 @@
class MethodCall
{
- private Node\Expr\MethodCall|StaticCall|Array_ $node;
-
- private Scope $scope;
-
- /**
- * @param Node\Expr\MethodCall|StaticCall|Array_ $node
- */
- public function __construct($node, Scope $scope)
+ public function __construct(
+ private Node\Expr\MethodCall|StaticCall|Array_ $node,
+ private Scope $scope,
+ )
{
- $this->node = $node;
- $this->scope = $scope;
}
/**
diff --git a/src/Node/MethodCallableNode.php b/src/Node/MethodCallableNode.php
index 5d479f5666..aff7b5cefc 100644
--- a/src/Node/MethodCallableNode.php
+++ b/src/Node/MethodCallableNode.php
@@ -9,21 +9,13 @@
class MethodCallableNode extends Expr implements VirtualNode
{
- private Expr $var;
-
- private Identifier|Expr $name;
-
- private Expr\MethodCall $originalNode;
-
- /**
- * @param Expr|Identifier $name
- */
- public function __construct(Expr $var, $name, Expr\MethodCall $originalNode)
+ public function __construct(
+ private Expr $var,
+ private Identifier|Expr $name,
+ private Expr\MethodCall $originalNode,
+ )
{
parent::__construct($originalNode->getAttributes());
- $this->var = $var;
- $this->name = $name;
- $this->originalNode = $originalNode;
}
public function getVar(): Expr
diff --git a/src/Node/MethodReturnStatementsNode.php b/src/Node/MethodReturnStatementsNode.php
index c4c5a84dc8..ca0e3abb82 100644
--- a/src/Node/MethodReturnStatementsNode.php
+++ b/src/Node/MethodReturnStatementsNode.php
@@ -12,30 +12,19 @@ class MethodReturnStatementsNode extends NodeAbstract implements ReturnStatement
private ClassMethod $classMethod;
- /** @var ReturnStatement[] */
- private array $returnStatements;
-
- private StatementResult $statementResult;
-
- /** @var ExecutionEndNode[] */
- private array $executionEnds;
-
/**
* @param ReturnStatement[] $returnStatements
* @param ExecutionEndNode[] $executionEnds
*/
public function __construct(
ClassMethod $method,
- array $returnStatements,
- StatementResult $statementResult,
- array $executionEnds,
+ private array $returnStatements,
+ private StatementResult $statementResult,
+ private array $executionEnds,
)
{
parent::__construct($method->getAttributes());
$this->classMethod = $method;
- $this->returnStatements = $returnStatements;
- $this->statementResult = $statementResult;
- $this->executionEnds = $executionEnds;
}
/**
diff --git a/src/Node/Property/PropertyRead.php b/src/Node/Property/PropertyRead.php
index 55dd948ae2..27bc3ba5c4 100644
--- a/src/Node/Property/PropertyRead.php
+++ b/src/Node/Property/PropertyRead.php
@@ -10,19 +10,11 @@
class PropertyRead
{
- private PropertyFetch|StaticPropertyFetch $fetch;
-
- private Scope $scope;
-
- /**
- * PropertyWrite constructor.
- *
- * @param PropertyFetch|StaticPropertyFetch $fetch
- */
- public function __construct($fetch, Scope $scope)
+ public function __construct(
+ private PropertyFetch|StaticPropertyFetch $fetch,
+ private Scope $scope,
+ )
{
- $this->fetch = $fetch;
- $this->scope = $scope;
}
/**
diff --git a/src/Node/Property/PropertyWrite.php b/src/Node/Property/PropertyWrite.php
index 1278558b4c..00970b832d 100644
--- a/src/Node/Property/PropertyWrite.php
+++ b/src/Node/Property/PropertyWrite.php
@@ -10,19 +10,8 @@
class PropertyWrite
{
- private PropertyFetch|StaticPropertyFetch $fetch;
-
- private Scope $scope;
-
- /**
- * PropertyWrite constructor.
- *
- * @param PropertyFetch|StaticPropertyFetch $fetch
- */
- public function __construct($fetch, Scope $scope)
+ public function __construct(private PropertyFetch|StaticPropertyFetch $fetch, private Scope $scope)
{
- $this->fetch = $fetch;
- $this->scope = $scope;
}
/**
diff --git a/src/Node/ReturnStatement.php b/src/Node/ReturnStatement.php
index fe323c088a..99767fba7b 100644
--- a/src/Node/ReturnStatement.php
+++ b/src/Node/ReturnStatement.php
@@ -10,13 +10,10 @@
class ReturnStatement
{
- private Scope $scope;
-
private Node\Stmt\Return_ $returnNode;
- public function __construct(Scope $scope, Return_ $returnNode)
+ public function __construct(private Scope $scope, Return_ $returnNode)
{
- $this->scope = $scope;
$this->returnNode = $returnNode;
}
diff --git a/src/Node/StaticMethodCallableNode.php b/src/Node/StaticMethodCallableNode.php
index 3c88e9a734..a4c6e675ef 100644
--- a/src/Node/StaticMethodCallableNode.php
+++ b/src/Node/StaticMethodCallableNode.php
@@ -10,22 +10,13 @@
class StaticMethodCallableNode extends Expr implements VirtualNode
{
- private Name|Expr $class;
-
- private Identifier|Expr $name;
-
- private Expr\StaticCall $originalNode;
-
- /**
- * @param Name|Expr $class
- * @param Identifier|Expr $name
- */
- public function __construct($class, $name, 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;
- $this->originalNode = $originalNode;
}
/**
diff --git a/src/Node/UnreachableStatementNode.php b/src/Node/UnreachableStatementNode.php
index 90e8258606..fb05c30a50 100644
--- a/src/Node/UnreachableStatementNode.php
+++ b/src/Node/UnreachableStatementNode.php
@@ -8,12 +8,9 @@
class UnreachableStatementNode extends Stmt implements VirtualNode
{
- private Stmt $originalStatement;
-
- public function __construct(Stmt $originalStatement)
+ public function __construct(private Stmt $originalStatement)
{
parent::__construct($originalStatement->getAttributes());
- $this->originalStatement = $originalStatement;
}
public function getOriginalStatement(): Stmt
diff --git a/src/Parallel/ParallelAnalyser.php b/src/Parallel/ParallelAnalyser.php
index 322ac70f58..3cae4c553b 100644
--- a/src/Parallel/ParallelAnalyser.php
+++ b/src/Parallel/ParallelAnalyser.php
@@ -32,23 +32,17 @@ class ParallelAnalyser
private const DEFAULT_TIMEOUT = 600.0;
- private int $internalErrorsCountLimit;
-
private float $processTimeout;
private ProcessPool $processPool;
- private int $decoderBufferSize;
-
public function __construct(
- int $internalErrorsCountLimit,
+ private int $internalErrorsCountLimit,
float $processTimeout,
- int $decoderBufferSize,
+ private int $decoderBufferSize,
)
{
- $this->internalErrorsCountLimit = $internalErrorsCountLimit;
$this->processTimeout = max($processTimeout, self::DEFAULT_TIMEOUT);
- $this->decoderBufferSize = $decoderBufferSize;
}
/**
diff --git a/src/Parallel/Process.php b/src/Parallel/Process.php
index 30de7e112a..0cb84ee154 100644
--- a/src/Parallel/Process.php
+++ b/src/Parallel/Process.php
@@ -19,14 +19,8 @@
class Process
{
- private string $command;
-
public \React\ChildProcess\Process $process;
- private LoopInterface $loop;
-
- private float $timeoutSeconds;
-
private WritableStreamInterface $in;
/** @var resource */
@@ -44,14 +38,11 @@ class Process
private ?TimerInterface $timer = null;
public function __construct(
- string $command,
- LoopInterface $loop,
- float $timeoutSeconds,
+ private string $command,
+ private LoopInterface $loop,
+ private float $timeoutSeconds,
)
{
- $this->command = $command;
- $this->loop = $loop;
- $this->timeoutSeconds = $timeoutSeconds;
}
/**
diff --git a/src/Parallel/ProcessPool.php b/src/Parallel/ProcessPool.php
index afd04adfff..bebb8f8293 100644
--- a/src/Parallel/ProcessPool.php
+++ b/src/Parallel/ProcessPool.php
@@ -12,14 +12,11 @@
class ProcessPool
{
- private TcpServer $server;
-
/** @var array */
private array $processes = [];
- public function __construct(TcpServer $server)
+ public function __construct(private TcpServer $server)
{
- $this->server = $server;
}
public function getProcess(string $identifier): Process
diff --git a/src/Parallel/Schedule.php b/src/Parallel/Schedule.php
index bf109e67c9..42935bd6c5 100644
--- a/src/Parallel/Schedule.php
+++ b/src/Parallel/Schedule.php
@@ -5,18 +5,11 @@
class Schedule
{
- private int $numberOfProcesses;
-
- /** @var array> */
- private array $jobs;
-
/**
* @param array> $jobs
*/
- public function __construct(int $numberOfProcesses, array $jobs)
+ public function __construct(private int $numberOfProcesses, private array $jobs)
{
- $this->numberOfProcesses = $numberOfProcesses;
- $this->jobs = $jobs;
}
public function getNumberOfProcesses(): int
diff --git a/src/Parallel/Scheduler.php b/src/Parallel/Scheduler.php
index ca1adcb9bf..a9cf735313 100644
--- a/src/Parallel/Scheduler.php
+++ b/src/Parallel/Scheduler.php
@@ -11,21 +11,12 @@
class Scheduler
{
- private int $jobSize;
-
- private int $maximumNumberOfProcesses;
-
- private int $minimumNumberOfJobsPerProcess;
-
public function __construct(
- int $jobSize,
- int $maximumNumberOfProcesses,
- int $minimumNumberOfJobsPerProcess,
+ private int $jobSize,
+ private int $maximumNumberOfProcesses,
+ private int $minimumNumberOfJobsPerProcess,
)
{
- $this->jobSize = $jobSize;
- $this->maximumNumberOfProcesses = $maximumNumberOfProcesses;
- $this->minimumNumberOfJobsPerProcess = $minimumNumberOfJobsPerProcess;
}
/**
diff --git a/src/Parser/CachedParser.php b/src/Parser/CachedParser.php
index a5bbdf0b85..225375678c 100644
--- a/src/Parser/CachedParser.php
+++ b/src/Parser/CachedParser.php
@@ -9,25 +9,19 @@
class CachedParser implements Parser
{
- private Parser $originalParser;
-
/** @var array*/
private array $cachedNodesByString = [];
private int $cachedNodesByStringCount = 0;
- private int $cachedNodesByStringCountMax;
-
/** @var array */
private array $parsedByString = [];
public function __construct(
- Parser $originalParser,
- int $cachedNodesByStringCountMax,
+ private Parser $originalParser,
+ private int $cachedNodesByStringCountMax,
)
{
- $this->originalParser = $originalParser;
- $this->cachedNodesByStringCountMax = $cachedNodesByStringCountMax;
}
/**
diff --git a/src/Parser/CleaningParser.php b/src/Parser/CleaningParser.php
index 844fdd71b1..65d5a27ef7 100644
--- a/src/Parser/CleaningParser.php
+++ b/src/Parser/CleaningParser.php
@@ -8,13 +8,10 @@
class CleaningParser implements Parser
{
- private Parser $wrappedParser;
-
private NodeTraverser $traverser;
- public function __construct(Parser $wrappedParser)
+ public function __construct(private Parser $wrappedParser)
{
- $this->wrappedParser = $wrappedParser;
$this->traverser = new NodeTraverser();
$this->traverser->addVisitor(new CleaningVisitor());
}
diff --git a/src/Parser/LexerFactory.php b/src/Parser/LexerFactory.php
index 381e78b180..a2d52481f5 100644
--- a/src/Parser/LexerFactory.php
+++ b/src/Parser/LexerFactory.php
@@ -9,11 +9,8 @@
class LexerFactory
{
- private PhpVersion $phpVersion;
-
- public function __construct(PhpVersion $phpVersion)
+ public function __construct(private PhpVersion $phpVersion)
{
- $this->phpVersion = $phpVersion;
}
public function create(): Lexer
diff --git a/src/Parser/NodeList.php b/src/Parser/NodeList.php
index 18b52a456e..13e69eef13 100644
--- a/src/Parser/NodeList.php
+++ b/src/Parser/NodeList.php
@@ -7,14 +7,8 @@
class NodeList
{
- private Node $node;
-
- private ?self $next;
-
- public function __construct(Node $node, ?self $next = null)
+ public function __construct(private Node $node, private ?self $next = null)
{
- $this->node = $node;
- $this->next = $next;
}
public function append(Node $node): self
diff --git a/src/Parser/ParserErrorsException.php b/src/Parser/ParserErrorsException.php
index fa1c50e520..240be67455 100644
--- a/src/Parser/ParserErrorsException.php
+++ b/src/Parser/ParserErrorsException.php
@@ -10,22 +10,15 @@
class ParserErrorsException extends Exception
{
- /** @var Error[] */
- private array $errors;
-
- private ?string $parsedFile;
-
/**
* @param Error[] $errors
*/
public function __construct(
- array $errors,
- ?string $parsedFile,
+ private array $errors,
+ private ?string $parsedFile,
)
{
parent::__construct(implode(', ', array_map(static fn (Error $error): string => $error->getMessage(), $errors)));
- $this->errors = $errors;
- $this->parsedFile = $parsedFile;
}
/**
diff --git a/src/Parser/PathRoutingParser.php b/src/Parser/PathRoutingParser.php
index 704b055b41..9420459618 100644
--- a/src/Parser/PathRoutingParser.php
+++ b/src/Parser/PathRoutingParser.php
@@ -9,28 +9,16 @@
class PathRoutingParser implements Parser
{
- private FileHelper $fileHelper;
-
- private Parser $currentPhpVersionRichParser;
-
- private Parser $currentPhpVersionSimpleParser;
-
- private Parser $php8Parser;
-
/** @var bool[] filePath(string) => bool(true) */
private array $analysedFiles = [];
public function __construct(
- FileHelper $fileHelper,
- Parser $currentPhpVersionRichParser,
- Parser $currentPhpVersionSimpleParser,
- Parser $php8Parser,
+ private FileHelper $fileHelper,
+ private Parser $currentPhpVersionRichParser,
+ private Parser $currentPhpVersionSimpleParser,
+ private Parser $php8Parser,
)
{
- $this->fileHelper = $fileHelper;
- $this->currentPhpVersionRichParser = $currentPhpVersionRichParser;
- $this->currentPhpVersionSimpleParser = $currentPhpVersionSimpleParser;
- $this->php8Parser = $php8Parser;
}
/**
diff --git a/src/Parser/PhpParserDecorator.php b/src/Parser/PhpParserDecorator.php
index 134bab14f2..d50ddee17b 100644
--- a/src/Parser/PhpParserDecorator.php
+++ b/src/Parser/PhpParserDecorator.php
@@ -11,11 +11,8 @@
class PhpParserDecorator implements Parser
{
- private \PHPStan\Parser\Parser $wrappedParser;
-
- public function __construct(\PHPStan\Parser\Parser $wrappedParser)
+ public function __construct(private \PHPStan\Parser\Parser $wrappedParser)
{
- $this->wrappedParser = $wrappedParser;
}
/**
diff --git a/src/Parser/RichParser.php b/src/Parser/RichParser.php
index d865c053a0..51ae991940 100644
--- a/src/Parser/RichParser.php
+++ b/src/Parser/RichParser.php
@@ -20,29 +20,14 @@
class RichParser implements Parser
{
- private \PhpParser\Parser $parser;
-
- private Lexer $lexer;
-
- private NameResolver $nameResolver;
-
- private NodeConnectingVisitor $nodeConnectingVisitor;
-
- private StatementOrderVisitor $statementOrderVisitor;
-
public function __construct(
- \PhpParser\Parser $parser,
- Lexer $lexer,
- NameResolver $nameResolver,
- NodeConnectingVisitor $nodeConnectingVisitor,
- StatementOrderVisitor $statementOrderVisitor,
+ private \PhpParser\Parser $parser,
+ private Lexer $lexer,
+ private NameResolver $nameResolver,
+ private NodeConnectingVisitor $nodeConnectingVisitor,
+ private StatementOrderVisitor $statementOrderVisitor,
)
{
- $this->parser = $parser;
- $this->lexer = $lexer;
- $this->nameResolver = $nameResolver;
- $this->nodeConnectingVisitor = $nodeConnectingVisitor;
- $this->statementOrderVisitor = $statementOrderVisitor;
}
/**
diff --git a/src/Parser/SimpleParser.php b/src/Parser/SimpleParser.php
index e27eba3cef..efcf47d786 100644
--- a/src/Parser/SimpleParser.php
+++ b/src/Parser/SimpleParser.php
@@ -12,17 +12,11 @@
class SimpleParser implements Parser
{
- private \PhpParser\Parser $parser;
-
- private NameResolver $nameResolver;
-
public function __construct(
- \PhpParser\Parser $parser,
- NameResolver $nameResolver,
+ private \PhpParser\Parser $parser,
+ private NameResolver $nameResolver,
)
{
- $this->parser = $parser;
- $this->nameResolver = $nameResolver;
}
/**
diff --git a/src/Php/PhpVersion.php b/src/Php/PhpVersion.php
index ea427dedbe..a1fc40fe26 100644
--- a/src/Php/PhpVersion.php
+++ b/src/Php/PhpVersion.php
@@ -8,11 +8,8 @@
class PhpVersion
{
- private int $versionId;
-
- public function __construct(int $versionId)
+ public function __construct(private int $versionId)
{
- $this->versionId = $versionId;
}
public function getVersionId(): int
diff --git a/src/Php/PhpVersionFactory.php b/src/Php/PhpVersionFactory.php
index 72fcc7539b..fcf77a16ec 100644
--- a/src/Php/PhpVersionFactory.php
+++ b/src/Php/PhpVersionFactory.php
@@ -10,17 +10,11 @@
class PhpVersionFactory
{
- private ?int $versionId;
-
- private ?string $composerPhpVersion;
-
public function __construct(
- ?int $versionId,
- ?string $composerPhpVersion,
+ private ?int $versionId,
+ private ?string $composerPhpVersion,
)
{
- $this->versionId = $versionId;
- $this->composerPhpVersion = $composerPhpVersion;
}
public function create(): PhpVersion
diff --git a/src/Php/PhpVersionFactoryFactory.php b/src/Php/PhpVersionFactoryFactory.php
index bae5d78f11..870d1ff276 100644
--- a/src/Php/PhpVersionFactoryFactory.php
+++ b/src/Php/PhpVersionFactoryFactory.php
@@ -14,21 +14,14 @@
class PhpVersionFactoryFactory
{
- private ?int $versionId;
-
- /** @var string[] */
- private array $composerAutoloaderProjectPaths;
-
/**
* @param string[] $composerAutoloaderProjectPaths
*/
public function __construct(
- ?int $versionId,
- array $composerAutoloaderProjectPaths,
+ private ?int $versionId,
+ private array $composerAutoloaderProjectPaths,
)
{
- $this->versionId = $versionId;
- $this->composerAutoloaderProjectPaths = $composerAutoloaderProjectPaths;
}
public function create(): PhpVersionFactory
diff --git a/src/PhpDoc/LazyTypeNodeResolverExtensionRegistryProvider.php b/src/PhpDoc/LazyTypeNodeResolverExtensionRegistryProvider.php
index e1c6349eba..1adc2e5aef 100644
--- a/src/PhpDoc/LazyTypeNodeResolverExtensionRegistryProvider.php
+++ b/src/PhpDoc/LazyTypeNodeResolverExtensionRegistryProvider.php
@@ -7,13 +7,10 @@
class LazyTypeNodeResolverExtensionRegistryProvider implements TypeNodeResolverExtensionRegistryProvider
{
- private Container $container;
-
private ?TypeNodeResolverExtensionRegistry $registry = null;
- public function __construct(Container $container)
+ public function __construct(private Container $container)
{
- $this->container = $container;
}
public function getRegistry(): TypeNodeResolverExtensionRegistry
diff --git a/src/PhpDoc/PhpDocBlock.php b/src/PhpDoc/PhpDocBlock.php
index 04315ae415..d82dfda65c 100644
--- a/src/PhpDoc/PhpDocBlock.php
+++ b/src/PhpDoc/PhpDocBlock.php
@@ -17,43 +17,20 @@
class PhpDocBlock
{
- private string $docComment;
-
- private string $file;
-
- private ClassReflection $classReflection;
-
- private ?string $trait;
-
- private bool $explicit;
-
- /** @var array */
- private array $parameterNameMapping;
-
- /** @var array */
- private array $parents;
-
/**
* @param array $parameterNameMapping
* @param array $parents
*/
private function __construct(
- string $docComment,
- string $file,
- ClassReflection $classReflection,
- ?string $trait,
- bool $explicit,
- array $parameterNameMapping,
- array $parents,
+ private string $docComment,
+ private string $file,
+ private ClassReflection $classReflection,
+ private ?string $trait,
+ private bool $explicit,
+ private array $parameterNameMapping,
+ private array $parents,
)
{
- $this->docComment = $docComment;
- $this->file = $file;
- $this->classReflection = $classReflection;
- $this->trait = $trait;
- $this->explicit = $explicit;
- $this->parameterNameMapping = $parameterNameMapping;
- $this->parents = $parents;
}
public function getDocComment(): string
diff --git a/src/PhpDoc/PhpDocInheritanceResolver.php b/src/PhpDoc/PhpDocInheritanceResolver.php
index c94c47ec1a..3d0b571146 100644
--- a/src/PhpDoc/PhpDocInheritanceResolver.php
+++ b/src/PhpDoc/PhpDocInheritanceResolver.php
@@ -11,17 +11,11 @@
class PhpDocInheritanceResolver
{
- private FileTypeMapper $fileTypeMapper;
-
- private StubPhpDocProvider $stubPhpDocProvider;
-
public function __construct(
- FileTypeMapper $fileTypeMapper,
- StubPhpDocProvider $stubPhpDocProvider,
+ private FileTypeMapper $fileTypeMapper,
+ private StubPhpDocProvider $stubPhpDocProvider,
)
{
- $this->fileTypeMapper = $fileTypeMapper;
- $this->stubPhpDocProvider = $stubPhpDocProvider;
}
public function resolvePhpDocForProperty(
diff --git a/src/PhpDoc/PhpDocNodeResolver.php b/src/PhpDoc/PhpDocNodeResolver.php
index bf046f93f5..845b9d3149 100644
--- a/src/PhpDoc/PhpDocNodeResolver.php
+++ b/src/PhpDoc/PhpDocNodeResolver.php
@@ -38,21 +38,12 @@
class PhpDocNodeResolver
{
- private TypeNodeResolver $typeNodeResolver;
-
- private ConstExprNodeResolver $constExprNodeResolver;
-
- private UnresolvableTypeHelper $unresolvableTypeHelper;
-
public function __construct(
- TypeNodeResolver $typeNodeResolver,
- ConstExprNodeResolver $constExprNodeResolver,
- UnresolvableTypeHelper $unresolvableTypeHelper,
+ private TypeNodeResolver $typeNodeResolver,
+ private ConstExprNodeResolver $constExprNodeResolver,
+ private UnresolvableTypeHelper $unresolvableTypeHelper,
)
{
- $this->typeNodeResolver = $typeNodeResolver;
- $this->constExprNodeResolver = $constExprNodeResolver;
- $this->unresolvableTypeHelper = $unresolvableTypeHelper;
}
/**
diff --git a/src/PhpDoc/PhpDocStringResolver.php b/src/PhpDoc/PhpDocStringResolver.php
index b503e5cd13..73b968826d 100644
--- a/src/PhpDoc/PhpDocStringResolver.php
+++ b/src/PhpDoc/PhpDocStringResolver.php
@@ -10,14 +10,8 @@
class PhpDocStringResolver
{
- private Lexer $phpDocLexer;
-
- private PhpDocParser $phpDocParser;
-
- public function __construct(Lexer $phpDocLexer, PhpDocParser $phpDocParser)
+ public function __construct(private Lexer $phpDocLexer, private PhpDocParser $phpDocParser)
{
- $this->phpDocLexer = $phpDocLexer;
- $this->phpDocParser = $phpDocParser;
}
public function resolve(string $phpDocString): PhpDocNode
diff --git a/src/PhpDoc/StubPhpDocProvider.php b/src/PhpDoc/StubPhpDocProvider.php
index 229a526a15..ed69183de1 100644
--- a/src/PhpDoc/StubPhpDocProvider.php
+++ b/src/PhpDoc/StubPhpDocProvider.php
@@ -18,15 +18,6 @@
class StubPhpDocProvider
{
- private Parser $parser;
-
- private FileTypeMapper $fileTypeMapper;
-
- private Container $container;
-
- /** @var string[] */
- private array $stubFiles;
-
/** @var array */
private array $classMap = [];
@@ -71,16 +62,12 @@ class StubPhpDocProvider
* @param string[] $stubFiles
*/
public function __construct(
- Parser $parser,
- FileTypeMapper $fileTypeMapper,
- Container $container,
- array $stubFiles,
+ private Parser $parser,
+ private FileTypeMapper $fileTypeMapper,
+ private Container $container,
+ private array $stubFiles,
)
{
- $this->parser = $parser;
- $this->fileTypeMapper = $fileTypeMapper;
- $this->container = $container;
- $this->stubFiles = $stubFiles;
}
public function findClassPhpDoc(string $className): ?ResolvedPhpDocBlock
diff --git a/src/PhpDoc/StubSourceLocatorFactory.php b/src/PhpDoc/StubSourceLocatorFactory.php
index e1f132c92f..f4253c14cc 100644
--- a/src/PhpDoc/StubSourceLocatorFactory.php
+++ b/src/PhpDoc/StubSourceLocatorFactory.php
@@ -14,29 +14,16 @@
class StubSourceLocatorFactory
{
- private Parser $php8Parser;
-
- private PhpStormStubsSourceStubber $phpStormStubsSourceStubber;
-
- private OptimizedSingleFileSourceLocatorRepository $optimizedSingleFileSourceLocatorRepository;
-
- /** @var string[] */
- private array $stubFiles;
-
/**
* @param string[] $stubFiles
*/
public function __construct(
- Parser $php8Parser,
- PhpStormStubsSourceStubber $phpStormStubsSourceStubber,
- OptimizedSingleFileSourceLocatorRepository $optimizedSingleFileSourceLocatorRepository,
- array $stubFiles,
+ private Parser $php8Parser,
+ private PhpStormStubsSourceStubber $phpStormStubsSourceStubber,
+ private OptimizedSingleFileSourceLocatorRepository $optimizedSingleFileSourceLocatorRepository,
+ private array $stubFiles,
)
{
- $this->php8Parser = $php8Parser;
- $this->phpStormStubsSourceStubber = $phpStormStubsSourceStubber;
- $this->optimizedSingleFileSourceLocatorRepository = $optimizedSingleFileSourceLocatorRepository;
- $this->stubFiles = $stubFiles;
}
public function create(): SourceLocator
diff --git a/src/PhpDoc/StubValidator.php b/src/PhpDoc/StubValidator.php
index 5e9ca0a032..acb00651eb 100644
--- a/src/PhpDoc/StubValidator.php
+++ b/src/PhpDoc/StubValidator.php
@@ -59,13 +59,10 @@
class StubValidator
{
- private DerivativeContainerFactory $derivativeContainerFactory;
-
public function __construct(
- DerivativeContainerFactory $derivativeContainerFactory,
+ private DerivativeContainerFactory $derivativeContainerFactory,
)
{
- $this->derivativeContainerFactory = $derivativeContainerFactory;
}
/**
diff --git a/src/PhpDoc/Tag/DeprecatedTag.php b/src/PhpDoc/Tag/DeprecatedTag.php
index 1e6309658f..ea798c2aab 100644
--- a/src/PhpDoc/Tag/DeprecatedTag.php
+++ b/src/PhpDoc/Tag/DeprecatedTag.php
@@ -6,11 +6,8 @@
class DeprecatedTag
{
- private ?string $message;
-
- public function __construct(?string $message)
+ public function __construct(private ?string $message)
{
- $this->message = $message;
}
public function getMessage(): ?string
diff --git a/src/PhpDoc/Tag/ExtendsTag.php b/src/PhpDoc/Tag/ExtendsTag.php
index b494abb20f..74ed32b7a2 100644
--- a/src/PhpDoc/Tag/ExtendsTag.php
+++ b/src/PhpDoc/Tag/ExtendsTag.php
@@ -8,11 +8,8 @@
class ExtendsTag
{
- private Type $type;
-
- public function __construct(Type $type)
+ public function __construct(private Type $type)
{
- $this->type = $type;
}
public function getType(): Type
diff --git a/src/PhpDoc/Tag/ImplementsTag.php b/src/PhpDoc/Tag/ImplementsTag.php
index 9065973cb9..cc9376b47a 100644
--- a/src/PhpDoc/Tag/ImplementsTag.php
+++ b/src/PhpDoc/Tag/ImplementsTag.php
@@ -8,11 +8,8 @@
class ImplementsTag
{
- private Type $type;
-
- public function __construct(Type $type)
+ public function __construct(private Type $type)
{
- $this->type = $type;
}
public function getType(): Type
diff --git a/src/PhpDoc/Tag/MethodTag.php b/src/PhpDoc/Tag/MethodTag.php
index 2c3254aca2..e640418ea8 100644
--- a/src/PhpDoc/Tag/MethodTag.php
+++ b/src/PhpDoc/Tag/MethodTag.php
@@ -8,25 +8,15 @@
class MethodTag
{
- private Type $returnType;
-
- private bool $isStatic;
-
- /** @var array */
- private array $parameters;
-
/**
* @param array $parameters
*/
public function __construct(
- Type $returnType,
- bool $isStatic,
- array $parameters,
+ private Type $returnType,
+ private bool $isStatic,
+ private array $parameters,
)
{
- $this->returnType = $returnType;
- $this->isStatic = $isStatic;
- $this->parameters = $parameters;
}
public function getReturnType(): Type
diff --git a/src/PhpDoc/Tag/MethodTagParameter.php b/src/PhpDoc/Tag/MethodTagParameter.php
index 7414d555f5..1326c4cbc9 100644
--- a/src/PhpDoc/Tag/MethodTagParameter.php
+++ b/src/PhpDoc/Tag/MethodTagParameter.php
@@ -9,29 +9,14 @@
class MethodTagParameter
{
- private Type $type;
-
- private PassedByReference $passedByReference;
-
- private bool $isOptional;
-
- private bool $isVariadic;
-
- private ?Type $defaultValue;
-
public function __construct(
- Type $type,
- PassedByReference $passedByReference,
- bool $isOptional,
- bool $isVariadic,
- ?Type $defaultValue,
+ private Type $type,
+ private PassedByReference $passedByReference,
+ private bool $isOptional,
+ private bool $isVariadic,
+ private ?Type $defaultValue,
)
{
- $this->type = $type;
- $this->passedByReference = $passedByReference;
- $this->isOptional = $isOptional;
- $this->isVariadic = $isVariadic;
- $this->defaultValue = $defaultValue;
}
public function getType(): Type
diff --git a/src/PhpDoc/Tag/MixinTag.php b/src/PhpDoc/Tag/MixinTag.php
index b07860f3b7..2a97b73264 100644
--- a/src/PhpDoc/Tag/MixinTag.php
+++ b/src/PhpDoc/Tag/MixinTag.php
@@ -8,11 +8,8 @@
class MixinTag
{
- private Type $type;
-
- public function __construct(Type $type)
+ public function __construct(private Type $type)
{
- $this->type = $type;
}
public function getType(): Type
diff --git a/src/PhpDoc/Tag/ParamTag.php b/src/PhpDoc/Tag/ParamTag.php
index 282e0e7039..651064cec1 100644
--- a/src/PhpDoc/Tag/ParamTag.php
+++ b/src/PhpDoc/Tag/ParamTag.php
@@ -8,14 +8,8 @@
class ParamTag implements TypedTag
{
- private Type $type;
-
- private bool $isVariadic;
-
- public function __construct(Type $type, bool $isVariadic)
+ public function __construct(private Type $type, private bool $isVariadic)
{
- $this->type = $type;
- $this->isVariadic = $isVariadic;
}
public function getType(): Type
diff --git a/src/PhpDoc/Tag/PropertyTag.php b/src/PhpDoc/Tag/PropertyTag.php
index 7b71aab2ee..b204ce4bb3 100644
--- a/src/PhpDoc/Tag/PropertyTag.php
+++ b/src/PhpDoc/Tag/PropertyTag.php
@@ -8,21 +8,12 @@
class PropertyTag
{
- private Type $type;
-
- private bool $readable;
-
- private bool $writable;
-
public function __construct(
- Type $type,
- bool $readable,
- bool $writable,
+ private Type $type,
+ private bool $readable,
+ private bool $writable,
)
{
- $this->type = $type;
- $this->readable = $readable;
- $this->writable = $writable;
}
public function getType(): Type
diff --git a/src/PhpDoc/Tag/ReturnTag.php b/src/PhpDoc/Tag/ReturnTag.php
index 108fde6445..683b0cb259 100644
--- a/src/PhpDoc/Tag/ReturnTag.php
+++ b/src/PhpDoc/Tag/ReturnTag.php
@@ -8,14 +8,8 @@
class ReturnTag implements TypedTag
{
- private Type $type;
-
- private bool $isExplicit;
-
- public function __construct(Type $type, bool $isExplicit)
+ public function __construct(private Type $type, private bool $isExplicit)
{
- $this->type = $type;
- $this->isExplicit = $isExplicit;
}
public function getType(): Type
diff --git a/src/PhpDoc/Tag/TemplateTag.php b/src/PhpDoc/Tag/TemplateTag.php
index cc370cbaff..4a2180c052 100644
--- a/src/PhpDoc/Tag/TemplateTag.php
+++ b/src/PhpDoc/Tag/TemplateTag.php
@@ -9,17 +9,8 @@
class TemplateTag
{
- private string $name;
-
- private Type $bound;
-
- private TemplateTypeVariance $variance;
-
- public function __construct(string $name, Type $bound, TemplateTypeVariance $variance)
+ public function __construct(private string $name, private Type $bound, private TemplateTypeVariance $variance)
{
- $this->name = $name;
- $this->bound = $bound;
- $this->variance = $variance;
}
public function getName(): string
diff --git a/src/PhpDoc/Tag/ThrowsTag.php b/src/PhpDoc/Tag/ThrowsTag.php
index 8d6d0cb2c8..15c1ac94d9 100644
--- a/src/PhpDoc/Tag/ThrowsTag.php
+++ b/src/PhpDoc/Tag/ThrowsTag.php
@@ -8,11 +8,8 @@
class ThrowsTag
{
- private Type $type;
-
- public function __construct(Type $type)
+ public function __construct(private Type $type)
{
- $this->type = $type;
}
public function getType(): Type
diff --git a/src/PhpDoc/Tag/TypeAliasImportTag.php b/src/PhpDoc/Tag/TypeAliasImportTag.php
index 8edd46080f..ab074d6775 100644
--- a/src/PhpDoc/Tag/TypeAliasImportTag.php
+++ b/src/PhpDoc/Tag/TypeAliasImportTag.php
@@ -6,17 +6,8 @@
final class TypeAliasImportTag
{
- private string $importedAlias;
-
- private string $importedFrom;
-
- private ?string $importedAs;
-
- public function __construct(string $importedAlias, string $importedFrom, ?string $importedAs)
+ public function __construct(private string $importedAlias, private string $importedFrom, private ?string $importedAs)
{
- $this->importedAlias = $importedAlias;
- $this->importedFrom = $importedFrom;
- $this->importedAs = $importedAs;
}
public function getImportedAlias(): string
diff --git a/src/PhpDoc/Tag/TypeAliasTag.php b/src/PhpDoc/Tag/TypeAliasTag.php
index 62caeef88e..35b613417a 100644
--- a/src/PhpDoc/Tag/TypeAliasTag.php
+++ b/src/PhpDoc/Tag/TypeAliasTag.php
@@ -10,21 +10,12 @@
class TypeAliasTag
{
- private string $aliasName;
-
- private TypeNode $typeNode;
-
- private NameScope $nameScope;
-
public function __construct(
- string $aliasName,
- TypeNode $typeNode,
- NameScope $nameScope,
+ private string $aliasName,
+ private TypeNode $typeNode,
+ private NameScope $nameScope,
)
{
- $this->aliasName = $aliasName;
- $this->typeNode = $typeNode;
- $this->nameScope = $nameScope;
}
public function getAliasName(): string
diff --git a/src/PhpDoc/Tag/UsesTag.php b/src/PhpDoc/Tag/UsesTag.php
index 21f186dac7..453eb5b250 100644
--- a/src/PhpDoc/Tag/UsesTag.php
+++ b/src/PhpDoc/Tag/UsesTag.php
@@ -8,11 +8,8 @@
class UsesTag
{
- private Type $type;
-
- public function __construct(Type $type)
+ public function __construct(private Type $type)
{
- $this->type = $type;
}
public function getType(): Type
diff --git a/src/PhpDoc/Tag/VarTag.php b/src/PhpDoc/Tag/VarTag.php
index a6b146b172..672cb81d43 100644
--- a/src/PhpDoc/Tag/VarTag.php
+++ b/src/PhpDoc/Tag/VarTag.php
@@ -8,11 +8,8 @@
class VarTag implements TypedTag
{
- private Type $type;
-
- public function __construct(Type $type)
+ public function __construct(private Type $type)
{
- $this->type = $type;
}
public function getType(): Type
diff --git a/src/PhpDoc/TypeNodeResolver.php b/src/PhpDoc/TypeNodeResolver.php
index c5b291e62f..4501609639 100644
--- a/src/PhpDoc/TypeNodeResolver.php
+++ b/src/PhpDoc/TypeNodeResolver.php
@@ -87,17 +87,11 @@
class TypeNodeResolver
{
- private TypeNodeResolverExtensionRegistryProvider $extensionRegistryProvider;
-
- private Container $container;
-
public function __construct(
- TypeNodeResolverExtensionRegistryProvider $extensionRegistryProvider,
- Container $container,
+ private TypeNodeResolverExtensionRegistryProvider $extensionRegistryProvider,
+ private Container $container,
)
{
- $this->extensionRegistryProvider = $extensionRegistryProvider;
- $this->container = $container;
}
/** @api */
diff --git a/src/PhpDoc/TypeNodeResolverExtensionRegistry.php b/src/PhpDoc/TypeNodeResolverExtensionRegistry.php
index 2a2dd44148..0c43e99a6f 100644
--- a/src/PhpDoc/TypeNodeResolverExtensionRegistry.php
+++ b/src/PhpDoc/TypeNodeResolverExtensionRegistry.php
@@ -5,15 +5,12 @@
class TypeNodeResolverExtensionRegistry
{
- /** @var TypeNodeResolverExtension[] */
- private array $extensions;
-
/**
* @param TypeNodeResolverExtension[] $extensions
*/
public function __construct(
TypeNodeResolver $typeNodeResolver,
- array $extensions,
+ private array $extensions,
)
{
foreach ($extensions as $extension) {
@@ -23,7 +20,6 @@ public function __construct(
$extension->setTypeNodeResolver($typeNodeResolver);
}
- $this->extensions = $extensions;
}
/**
diff --git a/src/PhpDoc/TypeStringResolver.php b/src/PhpDoc/TypeStringResolver.php
index bbc426249d..3933e1d25b 100644
--- a/src/PhpDoc/TypeStringResolver.php
+++ b/src/PhpDoc/TypeStringResolver.php
@@ -11,17 +11,8 @@
class TypeStringResolver
{
- private Lexer $typeLexer;
-
- private TypeParser $typeParser;
-
- private TypeNodeResolver $typeNodeResolver;
-
- public function __construct(Lexer $typeLexer, TypeParser $typeParser, TypeNodeResolver $typeNodeResolver)
+ public function __construct(private Lexer $typeLexer, private TypeParser $typeParser, private TypeNodeResolver $typeNodeResolver)
{
- $this->typeLexer = $typeLexer;
- $this->typeParser = $typeParser;
- $this->typeNodeResolver = $typeNodeResolver;
}
/** @api */
diff --git a/src/Process/ProcessPromise.php b/src/Process/ProcessPromise.php
index 22fbc3b4b2..26b7fb256a 100644
--- a/src/Process/ProcessPromise.php
+++ b/src/Process/ProcessPromise.php
@@ -17,23 +17,14 @@
class ProcessPromise implements Runnable
{
- private LoopInterface $loop;
-
- private string $name;
-
- private string $command;
-
private Deferred $deferred;
private ?Process $process = null;
private bool $canceled = false;
- public function __construct(LoopInterface $loop, string $name, string $command)
+ public function __construct(private LoopInterface $loop, private string $name, private string $command)
{
- $this->loop = $loop;
- $this->name = $name;
- $this->command = $command;
$this->deferred = new Deferred();
}
diff --git a/src/Process/Runnable/RunnableQueue.php b/src/Process/Runnable/RunnableQueue.php
index 294ff012fb..50cccba972 100644
--- a/src/Process/Runnable/RunnableQueue.php
+++ b/src/Process/Runnable/RunnableQueue.php
@@ -14,21 +14,14 @@
class RunnableQueue
{
- private RunnableQueueLogger $logger;
-
- private int $maxSize;
-
/** @var array */
private array $queue = [];
/** @var SplObjectStorage */
private SplObjectStorage $running;
- public function __construct(RunnableQueueLogger $logger, int $maxSize)
+ public function __construct(private RunnableQueueLogger $logger, private int $maxSize)
{
- $this->logger = $logger;
- $this->maxSize = $maxSize;
-
/** @var SplObjectStorage $running */
$running = new SplObjectStorage();
$this->running = $running;
diff --git a/src/Reflection/Annotations/AnnotationMethodReflection.php b/src/Reflection/Annotations/AnnotationMethodReflection.php
index 6868a1a841..d33665d4b8 100644
--- a/src/Reflection/Annotations/AnnotationMethodReflection.php
+++ b/src/Reflection/Annotations/AnnotationMethodReflection.php
@@ -14,19 +14,6 @@
class AnnotationMethodReflection implements MethodReflection
{
- private string $name;
-
- private ClassReflection $declaringClass;
-
- private Type $returnType;
-
- private bool $isStatic;
-
- /** @var AnnotationsMethodParameterReflection[] */
- private array $parameters;
-
- private bool $isVariadic;
-
/** @var FunctionVariant[]|null */
private ?array $variants = null;
@@ -34,20 +21,14 @@ class AnnotationMethodReflection implements MethodReflection
* @param AnnotationsMethodParameterReflection[] $parameters
*/
public function __construct(
- string $name,
- ClassReflection $declaringClass,
- Type $returnType,
- array $parameters,
- bool $isStatic,
- bool $isVariadic,
+ private string $name,
+ private ClassReflection $declaringClass,
+ private Type $returnType,
+ private array $parameters,
+ private bool $isStatic,
+ private bool $isVariadic,
)
{
- $this->name = $name;
- $this->declaringClass = $declaringClass;
- $this->returnType = $returnType;
- $this->parameters = $parameters;
- $this->isStatic = $isStatic;
- $this->isVariadic = $isVariadic;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Annotations/AnnotationPropertyReflection.php b/src/Reflection/Annotations/AnnotationPropertyReflection.php
index bf069bbff0..3613e87707 100644
--- a/src/Reflection/Annotations/AnnotationPropertyReflection.php
+++ b/src/Reflection/Annotations/AnnotationPropertyReflection.php
@@ -10,25 +10,13 @@
class AnnotationPropertyReflection implements PropertyReflection
{
- private ClassReflection $declaringClass;
-
- private Type $type;
-
- private bool $readable;
-
- private bool $writable;
-
public function __construct(
- ClassReflection $declaringClass,
- Type $type,
- bool $readable = true,
- bool $writable = true,
+ private ClassReflection $declaringClass,
+ private Type $type,
+ private bool $readable = true,
+ private bool $writable = true,
)
{
- $this->declaringClass = $declaringClass;
- $this->type = $type;
- $this->readable = $readable;
- $this->writable = $writable;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Annotations/AnnotationsMethodParameterReflection.php b/src/Reflection/Annotations/AnnotationsMethodParameterReflection.php
index 1fd3242d41..8b51b325cf 100644
--- a/src/Reflection/Annotations/AnnotationsMethodParameterReflection.php
+++ b/src/Reflection/Annotations/AnnotationsMethodParameterReflection.php
@@ -9,26 +9,8 @@
class AnnotationsMethodParameterReflection implements ParameterReflection
{
- private string $name;
-
- private Type $type;
-
- private PassedByReference $passedByReference;
-
- private bool $isOptional;
-
- private bool $isVariadic;
-
- private ?Type $defaultValue;
-
- public function __construct(string $name, Type $type, PassedByReference $passedByReference, bool $isOptional, bool $isVariadic, ?Type $defaultValue)
+ public function __construct(private string $name, private Type $type, private PassedByReference $passedByReference, private bool $isOptional, private bool $isVariadic, private ?Type $defaultValue)
{
- $this->name = $name;
- $this->type = $type;
- $this->passedByReference = $passedByReference;
- $this->isOptional = $isOptional;
- $this->isVariadic = $isVariadic;
- $this->defaultValue = $defaultValue;
}
public function getName(): string
diff --git a/src/Reflection/BetterReflection/BetterReflectionProvider.php b/src/Reflection/BetterReflection/BetterReflectionProvider.php
index f2f72d4960..7a3a5abd3b 100644
--- a/src/Reflection/BetterReflection/BetterReflectionProvider.php
+++ b/src/Reflection/BetterReflection/BetterReflectionProvider.php
@@ -54,34 +54,6 @@
class BetterReflectionProvider implements ReflectionProvider
{
- private ReflectionProvider\ReflectionProviderProvider $reflectionProviderProvider;
-
- private ClassReflectionExtensionRegistryProvider $classReflectionExtensionRegistryProvider;
-
- private Reflector $reflector;
-
- private FileTypeMapper $fileTypeMapper;
-
- private PhpDocInheritanceResolver $phpDocInheritanceResolver;
-
- private PhpVersion $phpVersion;
-
- private NativeFunctionReflectionProvider $nativeFunctionReflectionProvider;
-
- private StubPhpDocProvider $stubPhpDocProvider;
-
- private FunctionReflectionFactory $functionReflectionFactory;
-
- private RelativePathHelper $relativePathHelper;
-
- private AnonymousClassNameHelper $anonymousClassNameHelper;
-
- private Standard $printer;
-
- private FileHelper $fileHelper;
-
- private PhpStormStubsSourceStubber $phpstormStubsSourceStubber;
-
/** @var FunctionReflection[] */
private array $functionReflections = [];
@@ -95,36 +67,22 @@ class BetterReflectionProvider implements ReflectionProvider
private array $cachedConstants = [];
public function __construct(
- ReflectionProvider\ReflectionProviderProvider $reflectionProviderProvider,
- ClassReflectionExtensionRegistryProvider $classReflectionExtensionRegistryProvider,
- Reflector $reflector,
- FileTypeMapper $fileTypeMapper,
- PhpDocInheritanceResolver $phpDocInheritanceResolver,
- PhpVersion $phpVersion,
- NativeFunctionReflectionProvider $nativeFunctionReflectionProvider,
- StubPhpDocProvider $stubPhpDocProvider,
- FunctionReflectionFactory $functionReflectionFactory,
- RelativePathHelper $relativePathHelper,
- AnonymousClassNameHelper $anonymousClassNameHelper,
- Standard $printer,
- FileHelper $fileHelper,
- PhpStormStubsSourceStubber $phpstormStubsSourceStubber,
+ private ReflectionProvider\ReflectionProviderProvider $reflectionProviderProvider,
+ private ClassReflectionExtensionRegistryProvider $classReflectionExtensionRegistryProvider,
+ private Reflector $reflector,
+ private FileTypeMapper $fileTypeMapper,
+ private PhpDocInheritanceResolver $phpDocInheritanceResolver,
+ private PhpVersion $phpVersion,
+ private NativeFunctionReflectionProvider $nativeFunctionReflectionProvider,
+ private StubPhpDocProvider $stubPhpDocProvider,
+ private FunctionReflectionFactory $functionReflectionFactory,
+ private RelativePathHelper $relativePathHelper,
+ private AnonymousClassNameHelper $anonymousClassNameHelper,
+ private Standard $printer,
+ private FileHelper $fileHelper,
+ private PhpStormStubsSourceStubber $phpstormStubsSourceStubber,
)
{
- $this->reflectionProviderProvider = $reflectionProviderProvider;
- $this->classReflectionExtensionRegistryProvider = $classReflectionExtensionRegistryProvider;
- $this->reflector = $reflector;
- $this->fileTypeMapper = $fileTypeMapper;
- $this->phpDocInheritanceResolver = $phpDocInheritanceResolver;
- $this->phpVersion = $phpVersion;
- $this->nativeFunctionReflectionProvider = $nativeFunctionReflectionProvider;
- $this->stubPhpDocProvider = $stubPhpDocProvider;
- $this->functionReflectionFactory = $functionReflectionFactory;
- $this->relativePathHelper = $relativePathHelper;
- $this->anonymousClassNameHelper = $anonymousClassNameHelper;
- $this->printer = $printer;
- $this->fileHelper = $fileHelper;
- $this->phpstormStubsSourceStubber = $phpstormStubsSourceStubber;
}
public function hasClass(string $className): bool
diff --git a/src/Reflection/BetterReflection/Reflector/MemoizingReflector.php b/src/Reflection/BetterReflection/Reflector/MemoizingReflector.php
index 5e259f7bef..486ad45c20 100644
--- a/src/Reflection/BetterReflection/Reflector/MemoizingReflector.php
+++ b/src/Reflection/BetterReflection/Reflector/MemoizingReflector.php
@@ -15,8 +15,6 @@
final class MemoizingReflector implements Reflector
{
- private Reflector $reflector;
-
/** @var array */
private array $classReflections = [];
@@ -26,9 +24,8 @@ final class MemoizingReflector implements Reflector
/** @var array */
private array $functionReflections = [];
- public function __construct(Reflector $reflector)
+ public function __construct(private Reflector $reflector)
{
- $this->reflector = $reflector;
}
public function reflectClass(string $className): ReflectionClass
diff --git a/src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php
index 057a3a72a0..aedb8f39f0 100644
--- a/src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php
+++ b/src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php
@@ -46,10 +46,6 @@
class AutoloadSourceLocator implements SourceLocator
{
- private FileNodesFetcher $fileNodesFetcher;
-
- private bool $disableRuntimeReflectionProvider;
-
/** @var array>> */
private array $classNodes = [];
@@ -65,10 +61,8 @@ class AutoloadSourceLocator implements SourceLocator
/** @var array */
private array $fetchedNodesByFile = [];
- public function __construct(FileNodesFetcher $fileNodesFetcher, bool $disableRuntimeReflectionProvider)
+ public function __construct(private FileNodesFetcher $fileNodesFetcher, private bool $disableRuntimeReflectionProvider)
{
- $this->fileNodesFetcher = $fileNodesFetcher;
- $this->disableRuntimeReflectionProvider = $disableRuntimeReflectionProvider;
}
public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection
diff --git a/src/Reflection/BetterReflection/SourceLocator/ClassBlacklistSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/ClassBlacklistSourceLocator.php
index 0f66a6d33a..08972e2a6b 100644
--- a/src/Reflection/BetterReflection/SourceLocator/ClassBlacklistSourceLocator.php
+++ b/src/Reflection/BetterReflection/SourceLocator/ClassBlacklistSourceLocator.php
@@ -12,21 +12,14 @@
class ClassBlacklistSourceLocator implements SourceLocator
{
- private SourceLocator $sourceLocator;
-
- /** @var string[] */
- private array $patterns;
-
/**
* @param string[] $patterns
*/
public function __construct(
- SourceLocator $sourceLocator,
- array $patterns,
+ private SourceLocator $sourceLocator,
+ private array $patterns,
)
{
- $this->sourceLocator = $sourceLocator;
- $this->patterns = $patterns;
}
public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection
diff --git a/src/Reflection/BetterReflection/SourceLocator/ClassWhitelistSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/ClassWhitelistSourceLocator.php
index 1bfcf5a191..3dd35fe193 100644
--- a/src/Reflection/BetterReflection/SourceLocator/ClassWhitelistSourceLocator.php
+++ b/src/Reflection/BetterReflection/SourceLocator/ClassWhitelistSourceLocator.php
@@ -12,21 +12,14 @@
class ClassWhitelistSourceLocator implements SourceLocator
{
- private SourceLocator $sourceLocator;
-
- /** @var string[] */
- private array $patterns;
-
/**
* @param string[] $patterns
*/
public function __construct(
- SourceLocator $sourceLocator,
- array $patterns,
+ private SourceLocator $sourceLocator,
+ private array $patterns,
)
{
- $this->sourceLocator = $sourceLocator;
- $this->patterns = $patterns;
}
public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection
diff --git a/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php b/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php
index 5b634b87e2..93172ebe37 100644
--- a/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php
+++ b/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php
@@ -23,21 +23,12 @@
class ComposerJsonAndInstalledJsonSourceLocatorMaker
{
- private OptimizedDirectorySourceLocatorRepository $optimizedDirectorySourceLocatorRepository;
-
- private OptimizedPsrAutoloaderLocatorFactory $optimizedPsrAutoloaderLocatorFactory;
-
- private OptimizedDirectorySourceLocatorFactory $optimizedDirectorySourceLocatorFactory;
-
public function __construct(
- OptimizedDirectorySourceLocatorRepository $optimizedDirectorySourceLocatorRepository,
- OptimizedPsrAutoloaderLocatorFactory $optimizedPsrAutoloaderLocatorFactory,
- OptimizedDirectorySourceLocatorFactory $optimizedDirectorySourceLocatorFactory,
+ private OptimizedDirectorySourceLocatorRepository $optimizedDirectorySourceLocatorRepository,
+ private OptimizedPsrAutoloaderLocatorFactory $optimizedPsrAutoloaderLocatorFactory,
+ private OptimizedDirectorySourceLocatorFactory $optimizedDirectorySourceLocatorFactory,
)
{
- $this->optimizedDirectorySourceLocatorRepository = $optimizedDirectorySourceLocatorRepository;
- $this->optimizedPsrAutoloaderLocatorFactory = $optimizedPsrAutoloaderLocatorFactory;
- $this->optimizedDirectorySourceLocatorFactory = $optimizedDirectorySourceLocatorFactory;
}
public function create(string $projectInstallationPath): ?SourceLocator
diff --git a/src/Reflection/BetterReflection/SourceLocator/FetchedNode.php b/src/Reflection/BetterReflection/SourceLocator/FetchedNode.php
index b59be684a9..5af9211c14 100644
--- a/src/Reflection/BetterReflection/SourceLocator/FetchedNode.php
+++ b/src/Reflection/BetterReflection/SourceLocator/FetchedNode.php
@@ -11,29 +11,16 @@
class FetchedNode
{
- /** @var T */
- private Node $node;
-
- private ?Node\Stmt\Namespace_ $namespace;
-
- private string $fileName;
-
- private LocatedSource $locatedSource;
-
/**
* @param T $node
*/
public function __construct(
- Node $node,
- ?Node\Stmt\Namespace_ $namespace,
- string $fileName,
- LocatedSource $locatedSource,
+ private Node $node,
+ private ?Node\Stmt\Namespace_ $namespace,
+ private string $fileName,
+ private LocatedSource $locatedSource,
)
{
- $this->node = $node;
- $this->namespace = $namespace;
- $this->fileName = $fileName;
- $this->locatedSource = $locatedSource;
}
/**
diff --git a/src/Reflection/BetterReflection/SourceLocator/FetchedNodesResult.php b/src/Reflection/BetterReflection/SourceLocator/FetchedNodesResult.php
index 358701c09c..af65371f20 100644
--- a/src/Reflection/BetterReflection/SourceLocator/FetchedNodesResult.php
+++ b/src/Reflection/BetterReflection/SourceLocator/FetchedNodesResult.php
@@ -7,29 +7,17 @@
class FetchedNodesResult
{
- /** @var array>> */
- private array $classNodes;
-
- /** @var array> */
- private array $functionNodes;
-
- /** @var array> */
- private array $constantNodes;
-
/**
* @param array>> $classNodes
* @param array> $functionNodes
* @param array> $constantNodes
*/
public function __construct(
- array $classNodes,
- array $functionNodes,
- array $constantNodes,
+ private array $classNodes,
+ private array $functionNodes,
+ private array $constantNodes,
)
{
- $this->classNodes = $classNodes;
- $this->functionNodes = $functionNodes;
- $this->constantNodes = $constantNodes;
}
/**
diff --git a/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php b/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php
index ea40a6a006..bd7f0c77dd 100644
--- a/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php
+++ b/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php
@@ -11,17 +11,11 @@
class FileNodesFetcher
{
- private CachingVisitor $cachingVisitor;
-
- private Parser $parser;
-
public function __construct(
- CachingVisitor $cachingVisitor,
- Parser $parser,
+ private CachingVisitor $cachingVisitor,
+ private Parser $parser,
)
{
- $this->cachingVisitor = $cachingVisitor;
- $this->parser = $parser;
}
public function fetchNodes(string $fileName): FetchedNodesResult
diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php
index 2c38573e2e..72c7e08e8a 100644
--- a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php
+++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php
@@ -22,15 +22,8 @@
class OptimizedDirectorySourceLocator implements SourceLocator
{
- private FileNodesFetcher $fileNodesFetcher;
-
- private PhpVersion $phpVersion;
-
private PhpFileCleaner $cleaner;
- /** @var string[] */
- private array $files;
-
private string $extraTypes;
/** @var array|null */
@@ -49,15 +42,11 @@ class OptimizedDirectorySourceLocator implements SourceLocator
* @param string[] $files
*/
public function __construct(
- FileNodesFetcher $fileNodesFetcher,
- PhpVersion $phpVersion,
- array $files,
+ private FileNodesFetcher $fileNodesFetcher,
+ private PhpVersion $phpVersion,
+ private array $files,
)
{
- $this->fileNodesFetcher = $fileNodesFetcher;
- $this->phpVersion = $phpVersion;
- $this->files = $files;
-
$extraTypes = '';
$extraTypesArray = [];
if ($this->phpVersion->supportsEnums()) {
diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorFactory.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorFactory.php
index befd45b529..ec6d1e60db 100644
--- a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorFactory.php
+++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorFactory.php
@@ -8,17 +8,8 @@
class OptimizedDirectorySourceLocatorFactory
{
- private FileNodesFetcher $fileNodesFetcher;
-
- private FileFinder $fileFinder;
-
- private PhpVersion $phpVersion;
-
- public function __construct(FileNodesFetcher $fileNodesFetcher, FileFinder $fileFinder, PhpVersion $phpVersion)
+ public function __construct(private FileNodesFetcher $fileNodesFetcher, private FileFinder $fileFinder, private PhpVersion $phpVersion)
{
- $this->fileNodesFetcher = $fileNodesFetcher;
- $this->fileFinder = $fileFinder;
- $this->phpVersion = $phpVersion;
}
public function createByDirectory(string $directory): OptimizedDirectorySourceLocator
diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorRepository.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorRepository.php
index 3b0b7bd047..89c4ec0bcc 100644
--- a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorRepository.php
+++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorRepository.php
@@ -7,14 +7,11 @@
class OptimizedDirectorySourceLocatorRepository
{
- private OptimizedDirectorySourceLocatorFactory $factory;
-
/** @var array */
private array $locators = [];
- public function __construct(OptimizedDirectorySourceLocatorFactory $factory)
+ public function __construct(private OptimizedDirectorySourceLocatorFactory $factory)
{
- $this->factory = $factory;
}
public function getOrCreate(string $directory): OptimizedDirectorySourceLocator
diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocator.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocator.php
index d1b326c200..36bd379882 100644
--- a/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocator.php
+++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocator.php
@@ -13,17 +13,11 @@
class OptimizedPsrAutoloaderLocator implements SourceLocator
{
- private PsrAutoloaderMapping $mapping;
-
- private OptimizedSingleFileSourceLocatorRepository $optimizedSingleFileSourceLocatorRepository;
-
public function __construct(
- PsrAutoloaderMapping $mapping,
- OptimizedSingleFileSourceLocatorRepository $optimizedSingleFileSourceLocatorRepository,
+ private PsrAutoloaderMapping $mapping,
+ private OptimizedSingleFileSourceLocatorRepository $optimizedSingleFileSourceLocatorRepository,
)
{
- $this->mapping = $mapping;
- $this->optimizedSingleFileSourceLocatorRepository = $optimizedSingleFileSourceLocatorRepository;
}
public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection
diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php
index b362f7b352..92e6c154c3 100644
--- a/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php
+++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php
@@ -20,19 +20,13 @@
class OptimizedSingleFileSourceLocator implements SourceLocator
{
- private FileNodesFetcher $fileNodesFetcher;
-
- private string $fileName;
-
private ?FetchedNodesResult $fetchedNodesResult = null;
public function __construct(
- FileNodesFetcher $fileNodesFetcher,
- string $fileName,
+ private FileNodesFetcher $fileNodesFetcher,
+ private string $fileName,
)
{
- $this->fileNodesFetcher = $fileNodesFetcher;
- $this->fileName = $fileName;
}
public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection
diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorRepository.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorRepository.php
index 50d201eb49..59e26df126 100644
--- a/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorRepository.php
+++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorRepository.php
@@ -7,14 +7,11 @@
class OptimizedSingleFileSourceLocatorRepository
{
- private OptimizedSingleFileSourceLocatorFactory $factory;
-
/** @var array */
private array $locators = [];
- public function __construct(OptimizedSingleFileSourceLocatorFactory $factory)
+ public function __construct(private OptimizedSingleFileSourceLocatorFactory $factory)
{
- $this->factory = $factory;
}
public function getOrCreate(string $fileName): OptimizedSingleFileSourceLocator
diff --git a/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php
index 06a6a4289c..0731d733b0 100644
--- a/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php
+++ b/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php
@@ -12,17 +12,11 @@
class PhpVersionBlacklistSourceLocator implements SourceLocator
{
- private SourceLocator $sourceLocator;
-
- private PhpStormStubsSourceStubber $phpStormStubsSourceStubber;
-
public function __construct(
- SourceLocator $sourceLocator,
- PhpStormStubsSourceStubber $phpStormStubsSourceStubber,
+ private SourceLocator $sourceLocator,
+ private PhpStormStubsSourceStubber $phpStormStubsSourceStubber,
)
{
- $this->sourceLocator = $sourceLocator;
- $this->phpStormStubsSourceStubber = $phpStormStubsSourceStubber;
}
public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection
diff --git a/src/Reflection/BetterReflection/SourceLocator/SkipClassAliasSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/SkipClassAliasSourceLocator.php
index d463623f59..fc8e931ffe 100644
--- a/src/Reflection/BetterReflection/SourceLocator/SkipClassAliasSourceLocator.php
+++ b/src/Reflection/BetterReflection/SourceLocator/SkipClassAliasSourceLocator.php
@@ -13,11 +13,8 @@
class SkipClassAliasSourceLocator implements SourceLocator
{
- private SourceLocator $sourceLocator;
-
- public function __construct(SourceLocator $sourceLocator)
+ public function __construct(private SourceLocator $sourceLocator)
{
- $this->sourceLocator = $sourceLocator;
}
public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection
diff --git a/src/Reflection/BetterReflection/SourceStubber/PhpStormStubsSourceStubberFactory.php b/src/Reflection/BetterReflection/SourceStubber/PhpStormStubsSourceStubberFactory.php
index c1f87554b2..273dc62e3b 100644
--- a/src/Reflection/BetterReflection/SourceStubber/PhpStormStubsSourceStubberFactory.php
+++ b/src/Reflection/BetterReflection/SourceStubber/PhpStormStubsSourceStubberFactory.php
@@ -9,14 +9,8 @@
class PhpStormStubsSourceStubberFactory
{
- private Parser $phpParser;
-
- private PhpVersion $phpVersion;
-
- public function __construct(Parser $phpParser, PhpVersion $phpVersion)
+ public function __construct(private Parser $phpParser, private PhpVersion $phpVersion)
{
- $this->phpParser = $phpParser;
- $this->phpVersion = $phpVersion;
}
public function create(): PhpStormStubsSourceStubber
diff --git a/src/Reflection/ClassConstantReflection.php b/src/Reflection/ClassConstantReflection.php
index 59208de7e8..6334ec6864 100644
--- a/src/Reflection/ClassConstantReflection.php
+++ b/src/Reflection/ClassConstantReflection.php
@@ -14,39 +14,18 @@
class ClassConstantReflection implements ConstantReflection
{
- private ClassReflection $declaringClass;
-
- private ReflectionClassConstant $reflection;
-
- private ?Type $phpDocType;
-
- private PhpVersion $phpVersion;
-
- private ?string $deprecatedDescription;
-
- private bool $isDeprecated;
-
- private bool $isInternal;
-
private ?Type $valueType = null;
public function __construct(
- ClassReflection $declaringClass,
- ReflectionClassConstant $reflection,
- ?Type $phpDocType,
- PhpVersion $phpVersion,
- ?string $deprecatedDescription,
- bool $isDeprecated,
- bool $isInternal,
+ private ClassReflection $declaringClass,
+ private ReflectionClassConstant $reflection,
+ private ?Type $phpDocType,
+ private PhpVersion $phpVersion,
+ private ?string $deprecatedDescription,
+ private bool $isDeprecated,
+ private bool $isInternal,
)
{
- $this->declaringClass = $declaringClass;
- $this->reflection = $reflection;
- $this->phpDocType = $phpDocType;
- $this->phpVersion = $phpVersion;
- $this->deprecatedDescription = $deprecatedDescription;
- $this->isDeprecated = $isDeprecated;
- $this->isInternal = $isInternal;
}
public function getName(): string
diff --git a/src/Reflection/ClassReflection.php b/src/Reflection/ClassReflection.php
index 06aa91283e..90f9dba904 100644
--- a/src/Reflection/ClassReflection.php
+++ b/src/Reflection/ClassReflection.php
@@ -57,28 +57,6 @@
class ClassReflection
{
- private ReflectionProvider $reflectionProvider;
-
- private FileTypeMapper $fileTypeMapper;
-
- private StubPhpDocProvider $stubPhpDocProvider;
-
- private PhpDocInheritanceResolver $phpDocInheritanceResolver;
-
- private PhpVersion $phpVersion;
-
- /** @var PropertiesClassReflectionExtension[] */
- private array $propertiesClassReflectionExtensions;
-
- /** @var MethodsClassReflectionExtension[] */
- private array $methodsClassReflectionExtensions;
-
- private string $displayName;
-
- private ReflectionClass $reflection;
-
- private ?string $anonymousFilename;
-
/** @var MethodReflection[] */
private array $methods = [];
@@ -103,12 +81,6 @@ class ClassReflection
private ?TemplateTypeMap $templateTypeMap = null;
- private ?TemplateTypeMap $resolvedTemplateTypeMap;
-
- private ?ResolvedPhpDocBlock $stubPhpDocBlock;
-
- private ?string $extraCacheKey;
-
/** @var array|null */
private ?array $ancestors = null;
@@ -137,34 +109,21 @@ class ClassReflection
* @param MethodsClassReflectionExtension[] $methodsClassReflectionExtensions
*/
public function __construct(
- ReflectionProvider $reflectionProvider,
- FileTypeMapper $fileTypeMapper,
- StubPhpDocProvider $stubPhpDocProvider,
- PhpDocInheritanceResolver $phpDocInheritanceResolver,
- PhpVersion $phpVersion,
- array $propertiesClassReflectionExtensions,
- array $methodsClassReflectionExtensions,
- string $displayName,
- ReflectionClass $reflection,
- ?string $anonymousFilename,
- ?TemplateTypeMap $resolvedTemplateTypeMap,
- ?ResolvedPhpDocBlock $stubPhpDocBlock,
- ?string $extraCacheKey = null,
+ private ReflectionProvider $reflectionProvider,
+ private FileTypeMapper $fileTypeMapper,
+ private StubPhpDocProvider $stubPhpDocProvider,
+ private PhpDocInheritanceResolver $phpDocInheritanceResolver,
+ private PhpVersion $phpVersion,
+ private array $propertiesClassReflectionExtensions,
+ private array $methodsClassReflectionExtensions,
+ private string $displayName,
+ private ReflectionClass $reflection,
+ private ?string $anonymousFilename,
+ private ?TemplateTypeMap $resolvedTemplateTypeMap,
+ private ?ResolvedPhpDocBlock $stubPhpDocBlock,
+ private ?string $extraCacheKey = null,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->fileTypeMapper = $fileTypeMapper;
- $this->stubPhpDocProvider = $stubPhpDocProvider;
- $this->phpDocInheritanceResolver = $phpDocInheritanceResolver;
- $this->phpVersion = $phpVersion;
- $this->propertiesClassReflectionExtensions = $propertiesClassReflectionExtensions;
- $this->methodsClassReflectionExtensions = $methodsClassReflectionExtensions;
- $this->displayName = $displayName;
- $this->reflection = $reflection;
- $this->anonymousFilename = $anonymousFilename;
- $this->resolvedTemplateTypeMap = $resolvedTemplateTypeMap;
- $this->stubPhpDocBlock = $stubPhpDocBlock;
- $this->extraCacheKey = $extraCacheKey;
}
public function getNativeReflection(): ReflectionClass
diff --git a/src/Reflection/ClassReflectionExtensionRegistry.php b/src/Reflection/ClassReflectionExtensionRegistry.php
index a2dff94885..e18880e0be 100644
--- a/src/Reflection/ClassReflectionExtensionRegistry.php
+++ b/src/Reflection/ClassReflectionExtensionRegistry.php
@@ -8,20 +8,14 @@
class ClassReflectionExtensionRegistry
{
- /** @var PropertiesClassReflectionExtension[] */
- private array $propertiesClassReflectionExtensions;
-
- /** @var MethodsClassReflectionExtension[] */
- private array $methodsClassReflectionExtensions;
-
/**
* @param PropertiesClassReflectionExtension[] $propertiesClassReflectionExtensions
* @param MethodsClassReflectionExtension[] $methodsClassReflectionExtensions
*/
public function __construct(
Broker $broker,
- array $propertiesClassReflectionExtensions,
- array $methodsClassReflectionExtensions,
+ private array $propertiesClassReflectionExtensions,
+ private array $methodsClassReflectionExtensions,
)
{
foreach (array_merge($propertiesClassReflectionExtensions, $methodsClassReflectionExtensions) as $extension) {
@@ -31,8 +25,6 @@ public function __construct(
$extension->setBroker($broker);
}
- $this->propertiesClassReflectionExtensions = $propertiesClassReflectionExtensions;
- $this->methodsClassReflectionExtensions = $methodsClassReflectionExtensions;
}
/**
diff --git a/src/Reflection/Constant/RuntimeConstantReflection.php b/src/Reflection/Constant/RuntimeConstantReflection.php
index 7a33de0963..341ae68cc4 100644
--- a/src/Reflection/Constant/RuntimeConstantReflection.php
+++ b/src/Reflection/Constant/RuntimeConstantReflection.php
@@ -9,21 +9,12 @@
class RuntimeConstantReflection implements GlobalConstantReflection
{
- private string $name;
-
- private Type $valueType;
-
- private ?string $fileName;
-
public function __construct(
- string $name,
- Type $valueType,
- ?string $fileName,
+ private string $name,
+ private Type $valueType,
+ private ?string $fileName,
)
{
- $this->name = $name;
- $this->valueType = $valueType;
- $this->fileName = $fileName;
}
public function getName(): string
diff --git a/src/Reflection/Dummy/ChangedTypeMethodReflection.php b/src/Reflection/Dummy/ChangedTypeMethodReflection.php
index aeee95692f..4ccba18790 100644
--- a/src/Reflection/Dummy/ChangedTypeMethodReflection.php
+++ b/src/Reflection/Dummy/ChangedTypeMethodReflection.php
@@ -12,21 +12,11 @@
class ChangedTypeMethodReflection implements MethodReflection
{
- private ClassReflection $declaringClass;
-
- private MethodReflection $reflection;
-
- /** @var ParametersAcceptor[] */
- private array $variants;
-
/**
* @param ParametersAcceptor[] $variants
*/
- public function __construct(ClassReflection $declaringClass, MethodReflection $reflection, array $variants)
+ public function __construct(private ClassReflection $declaringClass, private MethodReflection $reflection, private array $variants)
{
- $this->declaringClass = $declaringClass;
- $this->reflection = $reflection;
- $this->variants = $variants;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Dummy/ChangedTypePropertyReflection.php b/src/Reflection/Dummy/ChangedTypePropertyReflection.php
index e8217e91f4..018d8593fa 100644
--- a/src/Reflection/Dummy/ChangedTypePropertyReflection.php
+++ b/src/Reflection/Dummy/ChangedTypePropertyReflection.php
@@ -11,20 +11,8 @@
class ChangedTypePropertyReflection implements WrapperPropertyReflection
{
- private ClassReflection $declaringClass;
-
- private PropertyReflection $reflection;
-
- private Type $readableType;
-
- private Type $writableType;
-
- public function __construct(ClassReflection $declaringClass, PropertyReflection $reflection, Type $readableType, Type $writableType)
+ public function __construct(private ClassReflection $declaringClass, private PropertyReflection $reflection, private Type $readableType, private Type $writableType)
{
- $this->declaringClass = $declaringClass;
- $this->reflection = $reflection;
- $this->readableType = $readableType;
- $this->writableType = $writableType;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Dummy/DummyConstantReflection.php b/src/Reflection/Dummy/DummyConstantReflection.php
index 56f9dfa77e..2b908355e5 100644
--- a/src/Reflection/Dummy/DummyConstantReflection.php
+++ b/src/Reflection/Dummy/DummyConstantReflection.php
@@ -13,11 +13,8 @@
class DummyConstantReflection implements ConstantReflection
{
- private string $name;
-
- public function __construct(string $name)
+ public function __construct(private string $name)
{
- $this->name = $name;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Dummy/DummyConstructorReflection.php b/src/Reflection/Dummy/DummyConstructorReflection.php
index a2bcd13817..1bcd01f6af 100644
--- a/src/Reflection/Dummy/DummyConstructorReflection.php
+++ b/src/Reflection/Dummy/DummyConstructorReflection.php
@@ -14,11 +14,8 @@
class DummyConstructorReflection implements MethodReflection
{
- private ClassReflection $declaringClass;
-
- public function __construct(ClassReflection $declaringClass)
+ public function __construct(private ClassReflection $declaringClass)
{
- $this->declaringClass = $declaringClass;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Dummy/DummyMethodReflection.php b/src/Reflection/Dummy/DummyMethodReflection.php
index 1e75634ede..77b06eb5ae 100644
--- a/src/Reflection/Dummy/DummyMethodReflection.php
+++ b/src/Reflection/Dummy/DummyMethodReflection.php
@@ -15,11 +15,8 @@
class DummyMethodReflection implements MethodReflection
{
- private string $name;
-
- public function __construct(string $name)
+ public function __construct(private string $name)
{
- $this->name = $name;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/EnumCaseReflection.php b/src/Reflection/EnumCaseReflection.php
index bdce535ed4..b538f44b3f 100644
--- a/src/Reflection/EnumCaseReflection.php
+++ b/src/Reflection/EnumCaseReflection.php
@@ -8,17 +8,8 @@
class EnumCaseReflection
{
- private ClassReflection $declaringEnum;
-
- private string $name;
-
- private ?Type $backingValueType;
-
- public function __construct(ClassReflection $declaringEnum, string $name, ?Type $backingValueType)
+ public function __construct(private ClassReflection $declaringEnum, private string $name, private ?Type $backingValueType)
{
- $this->declaringEnum = $declaringEnum;
- $this->name = $name;
- $this->backingValueType = $backingValueType;
}
public function getDeclaringEnum(): ClassReflection
diff --git a/src/Reflection/FunctionVariant.php b/src/Reflection/FunctionVariant.php
index 1d6e49c408..9936ae9244 100644
--- a/src/Reflection/FunctionVariant.php
+++ b/src/Reflection/FunctionVariant.php
@@ -9,34 +9,18 @@
class FunctionVariant implements ParametersAcceptor
{
- private TemplateTypeMap $templateTypeMap;
-
- private ?TemplateTypeMap $resolvedTemplateTypeMap;
-
- /** @var array */
- private array $parameters;
-
- private bool $isVariadic;
-
- private Type $returnType;
-
/**
* @api
* @param array $parameters
*/
public function __construct(
- TemplateTypeMap $templateTypeMap,
- ?TemplateTypeMap $resolvedTemplateTypeMap,
- array $parameters,
- bool $isVariadic,
- Type $returnType,
+ private TemplateTypeMap $templateTypeMap,
+ private ?TemplateTypeMap $resolvedTemplateTypeMap,
+ private array $parameters,
+ private bool $isVariadic,
+ private Type $returnType,
)
{
- $this->templateTypeMap = $templateTypeMap;
- $this->resolvedTemplateTypeMap = $resolvedTemplateTypeMap;
- $this->parameters = $parameters;
- $this->isVariadic = $isVariadic;
- $this->returnType = $returnType;
}
public function getTemplateTypeMap(): TemplateTypeMap
diff --git a/src/Reflection/FunctionVariantWithPhpDocs.php b/src/Reflection/FunctionVariantWithPhpDocs.php
index ffcb098f6f..aae15cb864 100644
--- a/src/Reflection/FunctionVariantWithPhpDocs.php
+++ b/src/Reflection/FunctionVariantWithPhpDocs.php
@@ -9,10 +9,6 @@
class FunctionVariantWithPhpDocs extends FunctionVariant implements ParametersAcceptorWithPhpDocs
{
- private Type $phpDocReturnType;
-
- private Type $nativeReturnType;
-
/**
* @api
* @param array $parameters
@@ -23,8 +19,8 @@ public function __construct(
array $parameters,
bool $isVariadic,
Type $returnType,
- Type $phpDocReturnType,
- Type $nativeReturnType,
+ private Type $phpDocReturnType,
+ private Type $nativeReturnType,
)
{
parent::__construct(
@@ -34,8 +30,6 @@ public function __construct(
$isVariadic,
$returnType,
);
- $this->phpDocReturnType = $phpDocReturnType;
- $this->nativeReturnType = $nativeReturnType;
}
/**
diff --git a/src/Reflection/InaccessibleMethod.php b/src/Reflection/InaccessibleMethod.php
index 43edf06f96..f089c132ad 100644
--- a/src/Reflection/InaccessibleMethod.php
+++ b/src/Reflection/InaccessibleMethod.php
@@ -9,11 +9,8 @@
class InaccessibleMethod implements ParametersAcceptor
{
- private MethodReflection $methodReflection;
-
- public function __construct(MethodReflection $methodReflection)
+ public function __construct(private MethodReflection $methodReflection)
{
- $this->methodReflection = $methodReflection;
}
public function getMethod(): MethodReflection
diff --git a/src/Reflection/MethodPrototypeReflection.php b/src/Reflection/MethodPrototypeReflection.php
index 3a28be7449..648f161df0 100644
--- a/src/Reflection/MethodPrototypeReflection.php
+++ b/src/Reflection/MethodPrototypeReflection.php
@@ -7,49 +7,21 @@
class MethodPrototypeReflection implements ClassMemberReflection
{
- private ClassReflection $declaringClass;
-
- private string $name;
-
- private bool $isStatic;
-
- private bool $isPrivate;
-
- private bool $isPublic;
-
- private bool $isAbstract;
-
- private bool $isFinal;
-
- /** @var ParametersAcceptor[] */
- private array $variants;
-
- private ?Type $tentativeReturnType;
-
/**
* @param ParametersAcceptor[] $variants
*/
public function __construct(
- string $name,
- ClassReflection $declaringClass,
- bool $isStatic,
- bool $isPrivate,
- bool $isPublic,
- bool $isAbstract,
- bool $isFinal,
- array $variants,
- ?Type $tentativeReturnType,
+ private string $name,
+ private ClassReflection $declaringClass,
+ private bool $isStatic,
+ private bool $isPrivate,
+ private bool $isPublic,
+ private bool $isAbstract,
+ private bool $isFinal,
+ private array $variants,
+ private ?Type $tentativeReturnType,
)
{
- $this->name = $name;
- $this->declaringClass = $declaringClass;
- $this->isStatic = $isStatic;
- $this->isPrivate = $isPrivate;
- $this->isPublic = $isPublic;
- $this->isAbstract = $isAbstract;
- $this->isFinal = $isFinal;
- $this->variants = $variants;
- $this->tentativeReturnType = $tentativeReturnType;
}
public function getName(): string
diff --git a/src/Reflection/Mixin/MixinMethodReflection.php b/src/Reflection/Mixin/MixinMethodReflection.php
index 544e6fc5f7..745a8cae15 100644
--- a/src/Reflection/Mixin/MixinMethodReflection.php
+++ b/src/Reflection/Mixin/MixinMethodReflection.php
@@ -11,14 +11,8 @@
class MixinMethodReflection implements MethodReflection
{
- private MethodReflection $reflection;
-
- private bool $static;
-
- public function __construct(MethodReflection $reflection, bool $static)
+ public function __construct(private MethodReflection $reflection, private bool $static)
{
- $this->reflection = $reflection;
- $this->static = $static;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Mixin/MixinMethodsClassReflectionExtension.php b/src/Reflection/Mixin/MixinMethodsClassReflectionExtension.php
index e2dac5a160..be29968120 100644
--- a/src/Reflection/Mixin/MixinMethodsClassReflectionExtension.php
+++ b/src/Reflection/Mixin/MixinMethodsClassReflectionExtension.php
@@ -15,18 +15,14 @@
class MixinMethodsClassReflectionExtension implements MethodsClassReflectionExtension
{
- /** @var string[] */
- private array $mixinExcludeClasses;
-
/** @var array> */
private array $inProcess = [];
/**
* @param string[] $mixinExcludeClasses
*/
- public function __construct(array $mixinExcludeClasses)
+ public function __construct(private array $mixinExcludeClasses)
{
- $this->mixinExcludeClasses = $mixinExcludeClasses;
}
public function hasMethod(ClassReflection $classReflection, string $methodName): bool
diff --git a/src/Reflection/Mixin/MixinPropertiesClassReflectionExtension.php b/src/Reflection/Mixin/MixinPropertiesClassReflectionExtension.php
index 86b9242745..7e60150737 100644
--- a/src/Reflection/Mixin/MixinPropertiesClassReflectionExtension.php
+++ b/src/Reflection/Mixin/MixinPropertiesClassReflectionExtension.php
@@ -15,18 +15,14 @@
class MixinPropertiesClassReflectionExtension implements PropertiesClassReflectionExtension
{
- /** @var string[] */
- private array $mixinExcludeClasses;
-
/** @var array> */
private array $inProcess = [];
/**
* @param string[] $mixinExcludeClasses
*/
- public function __construct(array $mixinExcludeClasses)
+ public function __construct(private array $mixinExcludeClasses)
{
- $this->mixinExcludeClasses = $mixinExcludeClasses;
}
public function hasProperty(ClassReflection $classReflection, string $propertyName): bool
diff --git a/src/Reflection/Native/NativeFunctionReflection.php b/src/Reflection/Native/NativeFunctionReflection.php
index 90176f5907..2142675d94 100644
--- a/src/Reflection/Native/NativeFunctionReflection.php
+++ b/src/Reflection/Native/NativeFunctionReflection.php
@@ -11,33 +11,17 @@
class NativeFunctionReflection implements FunctionReflection
{
- private string $name;
-
- /** @var ParametersAcceptor[] */
- private array $variants;
-
- private ?Type $throwType;
-
- private TrinaryLogic $hasSideEffects;
-
- private bool $isDeprecated;
-
/**
* @param ParametersAcceptor[] $variants
*/
public function __construct(
- string $name,
- array $variants,
- ?Type $throwType,
- TrinaryLogic $hasSideEffects,
- bool $isDeprecated,
+ private string $name,
+ private array $variants,
+ private ?Type $throwType,
+ private TrinaryLogic $hasSideEffects,
+ private bool $isDeprecated,
)
{
- $this->name = $name;
- $this->variants = $variants;
- $this->throwType = $throwType;
- $this->hasSideEffects = $hasSideEffects;
- $this->isDeprecated = $isDeprecated;
}
public function getName(): string
diff --git a/src/Reflection/Native/NativeMethodReflection.php b/src/Reflection/Native/NativeMethodReflection.php
index a46b4d483c..5748707bb1 100644
--- a/src/Reflection/Native/NativeMethodReflection.php
+++ b/src/Reflection/Native/NativeMethodReflection.php
@@ -19,37 +19,18 @@
class NativeMethodReflection implements MethodReflection
{
- private ReflectionProvider $reflectionProvider;
-
- private ClassReflection $declaringClass;
-
- private BuiltinMethodReflection $reflection;
-
- /** @var ParametersAcceptorWithPhpDocs[] */
- private array $variants;
-
- private TrinaryLogic $hasSideEffects;
-
- private ?Type $throwType;
-
/**
* @param ParametersAcceptorWithPhpDocs[] $variants
*/
public function __construct(
- ReflectionProvider $reflectionProvider,
- ClassReflection $declaringClass,
- BuiltinMethodReflection $reflection,
- array $variants,
- TrinaryLogic $hasSideEffects,
- ?Type $throwType,
+ private ReflectionProvider $reflectionProvider,
+ private ClassReflection $declaringClass,
+ private BuiltinMethodReflection $reflection,
+ private array $variants,
+ private TrinaryLogic $hasSideEffects,
+ private ?Type $throwType,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->declaringClass = $declaringClass;
- $this->reflection = $reflection;
- $this->variants = $variants;
- $this->hasSideEffects = $hasSideEffects;
- $this->throwType = $throwType;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Native/NativeParameterReflection.php b/src/Reflection/Native/NativeParameterReflection.php
index a8e631a4d2..219f48069d 100644
--- a/src/Reflection/Native/NativeParameterReflection.php
+++ b/src/Reflection/Native/NativeParameterReflection.php
@@ -9,33 +9,15 @@
class NativeParameterReflection implements ParameterReflection
{
- private string $name;
-
- private bool $optional;
-
- private Type $type;
-
- private PassedByReference $passedByReference;
-
- private bool $variadic;
-
- private ?Type $defaultValue;
-
public function __construct(
- string $name,
- bool $optional,
- Type $type,
- PassedByReference $passedByReference,
- bool $variadic,
- ?Type $defaultValue,
+ private string $name,
+ private bool $optional,
+ private Type $type,
+ private PassedByReference $passedByReference,
+ private bool $variadic,
+ private ?Type $defaultValue,
)
{
- $this->name = $name;
- $this->optional = $optional;
- $this->type = $type;
- $this->passedByReference = $passedByReference;
- $this->variadic = $variadic;
- $this->defaultValue = $defaultValue;
}
public function getName(): string
diff --git a/src/Reflection/Native/NativeParameterWithPhpDocsReflection.php b/src/Reflection/Native/NativeParameterWithPhpDocsReflection.php
index d9b4c2ba28..b5c01f9b90 100644
--- a/src/Reflection/Native/NativeParameterWithPhpDocsReflection.php
+++ b/src/Reflection/Native/NativeParameterWithPhpDocsReflection.php
@@ -9,41 +9,17 @@
class NativeParameterWithPhpDocsReflection implements ParameterReflectionWithPhpDocs
{
- private string $name;
-
- private bool $optional;
-
- private Type $type;
-
- private Type $phpDocType;
-
- private Type $nativeType;
-
- private PassedByReference $passedByReference;
-
- private bool $variadic;
-
- private ?Type $defaultValue;
-
public function __construct(
- string $name,
- bool $optional,
- Type $type,
- Type $phpDocType,
- Type $nativeType,
- PassedByReference $passedByReference,
- bool $variadic,
- ?Type $defaultValue,
+ private string $name,
+ private bool $optional,
+ private Type $type,
+ private Type $phpDocType,
+ private Type $nativeType,
+ private PassedByReference $passedByReference,
+ private bool $variadic,
+ private ?Type $defaultValue,
)
{
- $this->name = $name;
- $this->optional = $optional;
- $this->type = $type;
- $this->phpDocType = $phpDocType;
- $this->nativeType = $nativeType;
- $this->passedByReference = $passedByReference;
- $this->variadic = $variadic;
- $this->defaultValue = $defaultValue;
}
public function getName(): string
diff --git a/src/Reflection/PassedByReference.php b/src/Reflection/PassedByReference.php
index 78b7cc1f59..d4741bc1b6 100644
--- a/src/Reflection/PassedByReference.php
+++ b/src/Reflection/PassedByReference.php
@@ -15,11 +15,8 @@ class PassedByReference
/** @var self[] */
private static array $registry = [];
- private int $value;
-
- private function __construct(int $value)
+ private function __construct(private int $value)
{
- $this->value = $value;
}
private static function create(int $value): self
diff --git a/src/Reflection/Php/ClosureCallMethodReflection.php b/src/Reflection/Php/ClosureCallMethodReflection.php
index 4a93481a61..ac25944bdd 100644
--- a/src/Reflection/Php/ClosureCallMethodReflection.php
+++ b/src/Reflection/Php/ClosureCallMethodReflection.php
@@ -18,17 +18,11 @@
final class ClosureCallMethodReflection implements MethodReflection
{
- private MethodReflection $nativeMethodReflection;
-
- private ClosureType $closureType;
-
public function __construct(
- MethodReflection $nativeMethodReflection,
- ClosureType $closureType,
+ private MethodReflection $nativeMethodReflection,
+ private ClosureType $closureType,
)
{
- $this->nativeMethodReflection = $nativeMethodReflection;
- $this->closureType = $closureType;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Php/ClosureCallUnresolvedMethodPrototypeReflection.php b/src/Reflection/Php/ClosureCallUnresolvedMethodPrototypeReflection.php
index 3ec871b59e..a67891dd95 100644
--- a/src/Reflection/Php/ClosureCallUnresolvedMethodPrototypeReflection.php
+++ b/src/Reflection/Php/ClosureCallUnresolvedMethodPrototypeReflection.php
@@ -10,14 +10,8 @@
class ClosureCallUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection
{
- private UnresolvedMethodPrototypeReflection $prototype;
-
- private ClosureType $closure;
-
- public function __construct(UnresolvedMethodPrototypeReflection $prototype, ClosureType $closure)
+ public function __construct(private UnresolvedMethodPrototypeReflection $prototype, private ClosureType $closure)
{
- $this->prototype = $prototype;
- $this->closure = $closure;
}
public function doNotResolveTemplateTypeMapToBounds(): UnresolvedMethodPrototypeReflection
diff --git a/src/Reflection/Php/DummyParameter.php b/src/Reflection/Php/DummyParameter.php
index 3c46d7526d..5d73990a42 100644
--- a/src/Reflection/Php/DummyParameter.php
+++ b/src/Reflection/Php/DummyParameter.php
@@ -9,26 +9,11 @@
class DummyParameter implements ParameterReflection
{
- private string $name;
-
- private Type $type;
-
- private bool $optional;
-
private PassedByReference $passedByReference;
- private bool $variadic;
-
- private ?Type $defaultValue;
-
- public function __construct(string $name, Type $type, bool $optional, ?PassedByReference $passedByReference, bool $variadic, ?Type $defaultValue)
+ public function __construct(private string $name, private Type $type, private bool $optional, ?PassedByReference $passedByReference, private bool $variadic, private ?Type $defaultValue)
{
- $this->name = $name;
- $this->type = $type;
- $this->optional = $optional;
$this->passedByReference = $passedByReference ?? PassedByReference::createNo();
- $this->variadic = $variadic;
- $this->defaultValue = $defaultValue;
}
public function getName(): string
diff --git a/src/Reflection/Php/EnumCasesMethodReflection.php b/src/Reflection/Php/EnumCasesMethodReflection.php
index defbf44368..d5f86b45c8 100644
--- a/src/Reflection/Php/EnumCasesMethodReflection.php
+++ b/src/Reflection/Php/EnumCasesMethodReflection.php
@@ -15,14 +15,8 @@
class EnumCasesMethodReflection implements MethodReflection
{
- private ClassReflection $declaringClass;
-
- private Type $returnType;
-
- public function __construct(ClassReflection $declaringClass, Type $returnType)
+ public function __construct(private ClassReflection $declaringClass, private Type $returnType)
{
- $this->declaringClass = $declaringClass;
- $this->returnType = $returnType;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Php/EnumPropertyReflection.php b/src/Reflection/Php/EnumPropertyReflection.php
index 8c0f40df6b..e3f7927dec 100644
--- a/src/Reflection/Php/EnumPropertyReflection.php
+++ b/src/Reflection/Php/EnumPropertyReflection.php
@@ -10,14 +10,8 @@
class EnumPropertyReflection implements PropertyReflection
{
- private ClassReflection $declaringClass;
-
- private Type $type;
-
- public function __construct(ClassReflection $declaringClass, Type $type)
+ public function __construct(private ClassReflection $declaringClass, private Type $type)
{
- $this->declaringClass = $declaringClass;
- $this->type = $type;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Php/FakeBuiltinMethodReflection.php b/src/Reflection/Php/FakeBuiltinMethodReflection.php
index d20fa2a836..c190c3f6e3 100644
--- a/src/Reflection/Php/FakeBuiltinMethodReflection.php
+++ b/src/Reflection/Php/FakeBuiltinMethodReflection.php
@@ -12,17 +12,11 @@
class FakeBuiltinMethodReflection implements BuiltinMethodReflection
{
- private string $methodName;
-
- private ReflectionClass $declaringClass;
-
public function __construct(
- string $methodName,
- ReflectionClass $declaringClass,
+ private string $methodName,
+ private ReflectionClass $declaringClass,
)
{
- $this->methodName = $methodName;
- $this->declaringClass = $declaringClass;
}
public function getName(): string
diff --git a/src/Reflection/Php/NativeBuiltinMethodReflection.php b/src/Reflection/Php/NativeBuiltinMethodReflection.php
index 0e5b1019d7..b9286a490b 100644
--- a/src/Reflection/Php/NativeBuiltinMethodReflection.php
+++ b/src/Reflection/Php/NativeBuiltinMethodReflection.php
@@ -12,11 +12,8 @@
class NativeBuiltinMethodReflection implements BuiltinMethodReflection
{
- private ReflectionMethod $reflection;
-
- public function __construct(ReflectionMethod $reflection)
+ public function __construct(private ReflectionMethod $reflection)
{
- $this->reflection = $reflection;
}
public function getName(): string
diff --git a/src/Reflection/Php/PhpClassReflectionExtension.php b/src/Reflection/Php/PhpClassReflectionExtension.php
index 8e4d2a1739..d09c3276d0 100644
--- a/src/Reflection/Php/PhpClassReflectionExtension.php
+++ b/src/Reflection/Php/PhpClassReflectionExtension.php
@@ -70,33 +70,6 @@ class PhpClassReflectionExtension
implements PropertiesClassReflectionExtension, MethodsClassReflectionExtension
{
- private ScopeFactory $scopeFactory;
-
- private NodeScopeResolver $nodeScopeResolver;
-
- private PhpMethodReflectionFactory $methodReflectionFactory;
-
- private PhpDocInheritanceResolver $phpDocInheritanceResolver;
-
- private AnnotationsMethodsClassReflectionExtension $annotationsMethodsClassReflectionExtension;
-
- private AnnotationsPropertiesClassReflectionExtension $annotationsPropertiesClassReflectionExtension;
-
- private SignatureMapProvider $signatureMapProvider;
-
- private Parser $parser;
-
- private StubPhpDocProvider $stubPhpDocProvider;
-
- private bool $inferPrivatePropertyTypeFromConstructor;
-
- private ReflectionProvider\ReflectionProviderProvider $reflectionProviderProvider;
-
- private FileTypeMapper $fileTypeMapper;
-
- /** @var string[] */
- private array $universalObjectCratesClasses;
-
/** @var PropertyReflection[][] */
private array $propertiesIncludingAnnotations = [];
@@ -119,34 +92,21 @@ class PhpClassReflectionExtension
* @param string[] $universalObjectCratesClasses
*/
public function __construct(
- ScopeFactory $scopeFactory,
- NodeScopeResolver $nodeScopeResolver,
- PhpMethodReflectionFactory $methodReflectionFactory,
- PhpDocInheritanceResolver $phpDocInheritanceResolver,
- AnnotationsMethodsClassReflectionExtension $annotationsMethodsClassReflectionExtension,
- AnnotationsPropertiesClassReflectionExtension $annotationsPropertiesClassReflectionExtension,
- SignatureMapProvider $signatureMapProvider,
- Parser $parser,
- StubPhpDocProvider $stubPhpDocProvider,
- ReflectionProvider\ReflectionProviderProvider $reflectionProviderProvider,
- FileTypeMapper $fileTypeMapper,
- bool $inferPrivatePropertyTypeFromConstructor,
- array $universalObjectCratesClasses,
+ private ScopeFactory $scopeFactory,
+ private NodeScopeResolver $nodeScopeResolver,
+ private PhpMethodReflectionFactory $methodReflectionFactory,
+ private PhpDocInheritanceResolver $phpDocInheritanceResolver,
+ private AnnotationsMethodsClassReflectionExtension $annotationsMethodsClassReflectionExtension,
+ private AnnotationsPropertiesClassReflectionExtension $annotationsPropertiesClassReflectionExtension,
+ private SignatureMapProvider $signatureMapProvider,
+ private Parser $parser,
+ private StubPhpDocProvider $stubPhpDocProvider,
+ private ReflectionProvider\ReflectionProviderProvider $reflectionProviderProvider,
+ private FileTypeMapper $fileTypeMapper,
+ private bool $inferPrivatePropertyTypeFromConstructor,
+ private array $universalObjectCratesClasses,
)
{
- $this->scopeFactory = $scopeFactory;
- $this->nodeScopeResolver = $nodeScopeResolver;
- $this->methodReflectionFactory = $methodReflectionFactory;
- $this->phpDocInheritanceResolver = $phpDocInheritanceResolver;
- $this->annotationsMethodsClassReflectionExtension = $annotationsMethodsClassReflectionExtension;
- $this->annotationsPropertiesClassReflectionExtension = $annotationsPropertiesClassReflectionExtension;
- $this->signatureMapProvider = $signatureMapProvider;
- $this->parser = $parser;
- $this->stubPhpDocProvider = $stubPhpDocProvider;
- $this->reflectionProviderProvider = $reflectionProviderProvider;
- $this->fileTypeMapper = $fileTypeMapper;
- $this->inferPrivatePropertyTypeFromConstructor = $inferPrivatePropertyTypeFromConstructor;
- $this->universalObjectCratesClasses = $universalObjectCratesClasses;
}
public function hasProperty(ClassReflection $classReflection, string $propertyName): bool
diff --git a/src/Reflection/Php/PhpFunctionFromParserNodeReflection.php b/src/Reflection/Php/PhpFunctionFromParserNodeReflection.php
index 91bb4cd6d5..cb4ec0b402 100644
--- a/src/Reflection/Php/PhpFunctionFromParserNodeReflection.php
+++ b/src/Reflection/Php/PhpFunctionFromParserNodeReflection.php
@@ -29,35 +29,6 @@ class PhpFunctionFromParserNodeReflection implements FunctionReflection
/** @var Function_|ClassMethod */
private Node\FunctionLike $functionLike;
- private string $fileName;
-
- private TemplateTypeMap $templateTypeMap;
-
- /** @var Type[] */
- private array $realParameterTypes;
-
- /** @var Type[] */
- private array $phpDocParameterTypes;
-
- /** @var Type[] */
- private array $realParameterDefaultValues;
-
- private Type $realReturnType;
-
- private ?Type $phpDocReturnType;
-
- private ?Type $throwType;
-
- private ?string $deprecatedDescription;
-
- private bool $isDeprecated;
-
- private bool $isInternal;
-
- private bool $isFinal;
-
- private ?bool $isPure;
-
/** @var FunctionVariantWithPhpDocs[]|null */
private ?array $variants = null;
@@ -69,35 +40,22 @@ class PhpFunctionFromParserNodeReflection implements FunctionReflection
*/
public function __construct(
FunctionLike $functionLike,
- string $fileName,
- TemplateTypeMap $templateTypeMap,
- array $realParameterTypes,
- array $phpDocParameterTypes,
- array $realParameterDefaultValues,
- Type $realReturnType,
- ?Type $phpDocReturnType,
- ?Type $throwType,
- ?string $deprecatedDescription,
- bool $isDeprecated,
- bool $isInternal,
- bool $isFinal,
- ?bool $isPure,
+ private string $fileName,
+ private TemplateTypeMap $templateTypeMap,
+ private array $realParameterTypes,
+ private array $phpDocParameterTypes,
+ private array $realParameterDefaultValues,
+ private Type $realReturnType,
+ private ?Type $phpDocReturnType,
+ private ?Type $throwType,
+ private ?string $deprecatedDescription,
+ private bool $isDeprecated,
+ private bool $isInternal,
+ private bool $isFinal,
+ private ?bool $isPure,
)
{
$this->functionLike = $functionLike;
- $this->fileName = $fileName;
- $this->templateTypeMap = $templateTypeMap;
- $this->realParameterTypes = $realParameterTypes;
- $this->phpDocParameterTypes = $phpDocParameterTypes;
- $this->realParameterDefaultValues = $realParameterDefaultValues;
- $this->realReturnType = $realReturnType;
- $this->phpDocReturnType = $phpDocReturnType;
- $this->throwType = $throwType;
- $this->deprecatedDescription = $deprecatedDescription;
- $this->isDeprecated = $isDeprecated;
- $this->isInternal = $isInternal;
- $this->isFinal = $isFinal;
- $this->isPure = $isPure;
}
protected function getFunctionLike(): FunctionLike
diff --git a/src/Reflection/Php/PhpFunctionReflection.php b/src/Reflection/Php/PhpFunctionReflection.php
index b3e8c0419e..fc53462093 100644
--- a/src/Reflection/Php/PhpFunctionReflection.php
+++ b/src/Reflection/Php/PhpFunctionReflection.php
@@ -32,35 +32,6 @@
class PhpFunctionReflection implements FunctionReflection
{
- private ReflectionFunction $reflection;
-
- private Parser $parser;
-
- private FunctionCallStatementFinder $functionCallStatementFinder;
-
- private Cache $cache;
-
- private TemplateTypeMap $templateTypeMap;
-
- /** @var Type[] */
- private array $phpDocParameterTypes;
-
- private ?Type $phpDocReturnType;
-
- private ?Type $phpDocThrowType;
-
- private ?string $deprecatedDescription;
-
- private bool $isDeprecated;
-
- private bool $isInternal;
-
- private bool $isFinal;
-
- private ?string $filename;
-
- private ?bool $isPure;
-
/** @var FunctionVariantWithPhpDocs[]|null */
private ?array $variants = null;
@@ -68,36 +39,22 @@ class PhpFunctionReflection implements FunctionReflection
* @param Type[] $phpDocParameterTypes
*/
public function __construct(
- ReflectionFunction $reflection,
- Parser $parser,
- FunctionCallStatementFinder $functionCallStatementFinder,
- Cache $cache,
- TemplateTypeMap $templateTypeMap,
- array $phpDocParameterTypes,
- ?Type $phpDocReturnType,
- ?Type $phpDocThrowType,
- ?string $deprecatedDescription,
- bool $isDeprecated,
- bool $isInternal,
- bool $isFinal,
- ?string $filename,
- ?bool $isPure,
+ private ReflectionFunction $reflection,
+ private Parser $parser,
+ private FunctionCallStatementFinder $functionCallStatementFinder,
+ private Cache $cache,
+ private TemplateTypeMap $templateTypeMap,
+ private array $phpDocParameterTypes,
+ private ?Type $phpDocReturnType,
+ private ?Type $phpDocThrowType,
+ private ?string $deprecatedDescription,
+ private bool $isDeprecated,
+ private bool $isInternal,
+ private bool $isFinal,
+ private ?string $filename,
+ private ?bool $isPure,
)
{
- $this->reflection = $reflection;
- $this->parser = $parser;
- $this->functionCallStatementFinder = $functionCallStatementFinder;
- $this->cache = $cache;
- $this->templateTypeMap = $templateTypeMap;
- $this->phpDocParameterTypes = $phpDocParameterTypes;
- $this->phpDocReturnType = $phpDocReturnType;
- $this->phpDocThrowType = $phpDocThrowType;
- $this->isDeprecated = $isDeprecated;
- $this->deprecatedDescription = $deprecatedDescription;
- $this->isInternal = $isInternal;
- $this->isFinal = $isFinal;
- $this->filename = $filename;
- $this->isPure = $isPure;
}
public function getName(): string
diff --git a/src/Reflection/Php/PhpMethodFromParserNodeReflection.php b/src/Reflection/Php/PhpMethodFromParserNodeReflection.php
index 7c61e8df0f..26fa3a7833 100644
--- a/src/Reflection/Php/PhpMethodFromParserNodeReflection.php
+++ b/src/Reflection/Php/PhpMethodFromParserNodeReflection.php
@@ -22,15 +22,13 @@
class PhpMethodFromParserNodeReflection extends PhpFunctionFromParserNodeReflection implements MethodReflection
{
- private ClassReflection $declaringClass;
-
/**
* @param Type[] $realParameterTypes
* @param Type[] $phpDocParameterTypes
* @param Type[] $realParameterDefaultValues
*/
public function __construct(
- ClassReflection $declaringClass,
+ private ClassReflection $declaringClass,
ClassMethod $classMethod,
string $fileName,
TemplateTypeMap $templateTypeMap,
@@ -86,7 +84,6 @@ public function __construct(
$isFinal || $classMethod->isFinal(),
$isPure,
);
- $this->declaringClass = $declaringClass;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Php/PhpMethodReflection.php b/src/Reflection/Php/PhpMethodReflection.php
index d9c0d50485..563793f82b 100644
--- a/src/Reflection/Php/PhpMethodReflection.php
+++ b/src/Reflection/Php/PhpMethodReflection.php
@@ -46,29 +46,6 @@
class PhpMethodReflection implements MethodReflection
{
- private ClassReflection $declaringClass;
-
- private ?ClassReflection $declaringTrait;
-
- private BuiltinMethodReflection $reflection;
-
- private ReflectionProvider $reflectionProvider;
-
- private Parser $parser;
-
- private FunctionCallStatementFinder $functionCallStatementFinder;
-
- private Cache $cache;
-
- private TemplateTypeMap $templateTypeMap;
-
- /** @var Type[] */
- private array $phpDocParameterTypes;
-
- private ?Type $phpDocReturnType;
-
- private ?Type $phpDocThrowType;
-
/** @var PhpParameterReflection[]|null */
private ?array $parameters = null;
@@ -76,16 +53,6 @@ class PhpMethodReflection implements MethodReflection
private ?Type $nativeReturnType = null;
- private ?string $deprecatedDescription;
-
- private bool $isDeprecated;
-
- private bool $isInternal;
-
- private bool $isFinal;
-
- private ?bool $isPure;
-
/** @var FunctionVariantWithPhpDocs[]|null */
private ?array $variants = null;
@@ -93,40 +60,24 @@ class PhpMethodReflection implements MethodReflection
* @param Type[] $phpDocParameterTypes
*/
public function __construct(
- ClassReflection $declaringClass,
- ?ClassReflection $declaringTrait,
- BuiltinMethodReflection $reflection,
- ReflectionProvider $reflectionProvider,
- Parser $parser,
- FunctionCallStatementFinder $functionCallStatementFinder,
- Cache $cache,
- TemplateTypeMap $templateTypeMap,
- array $phpDocParameterTypes,
- ?Type $phpDocReturnType,
- ?Type $phpDocThrowType,
- ?string $deprecatedDescription,
- bool $isDeprecated,
- bool $isInternal,
- bool $isFinal,
- ?bool $isPure,
+ private ClassReflection $declaringClass,
+ private ?ClassReflection $declaringTrait,
+ private BuiltinMethodReflection $reflection,
+ private ReflectionProvider $reflectionProvider,
+ private Parser $parser,
+ private FunctionCallStatementFinder $functionCallStatementFinder,
+ private Cache $cache,
+ private TemplateTypeMap $templateTypeMap,
+ private array $phpDocParameterTypes,
+ private ?Type $phpDocReturnType,
+ private ?Type $phpDocThrowType,
+ private ?string $deprecatedDescription,
+ private bool $isDeprecated,
+ private bool $isInternal,
+ private bool $isFinal,
+ private ?bool $isPure,
)
{
- $this->declaringClass = $declaringClass;
- $this->declaringTrait = $declaringTrait;
- $this->reflection = $reflection;
- $this->reflectionProvider = $reflectionProvider;
- $this->parser = $parser;
- $this->functionCallStatementFinder = $functionCallStatementFinder;
- $this->cache = $cache;
- $this->templateTypeMap = $templateTypeMap;
- $this->phpDocParameterTypes = $phpDocParameterTypes;
- $this->phpDocReturnType = $phpDocReturnType;
- $this->phpDocThrowType = $phpDocThrowType;
- $this->deprecatedDescription = $deprecatedDescription;
- $this->isDeprecated = $isDeprecated;
- $this->isInternal = $isInternal;
- $this->isFinal = $isFinal;
- $this->isPure = $isPure;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Php/PhpParameterFromParserNodeReflection.php b/src/Reflection/Php/PhpParameterFromParserNodeReflection.php
index 1e7ee5e327..0625921242 100644
--- a/src/Reflection/Php/PhpParameterFromParserNodeReflection.php
+++ b/src/Reflection/Php/PhpParameterFromParserNodeReflection.php
@@ -13,39 +13,18 @@
class PhpParameterFromParserNodeReflection implements ParameterReflectionWithPhpDocs
{
- private string $name;
-
- private bool $optional;
-
- private Type $realType;
-
- private ?Type $phpDocType;
-
- private PassedByReference $passedByReference;
-
- private ?Type $defaultValue;
-
- private bool $variadic;
-
private ?Type $type = null;
public function __construct(
- string $name,
- bool $optional,
- Type $realType,
- ?Type $phpDocType,
- PassedByReference $passedByReference,
- ?Type $defaultValue,
- bool $variadic,
+ private string $name,
+ private bool $optional,
+ private Type $realType,
+ private ?Type $phpDocType,
+ private PassedByReference $passedByReference,
+ private ?Type $defaultValue,
+ private bool $variadic,
)
{
- $this->name = $name;
- $this->optional = $optional;
- $this->realType = $realType;
- $this->phpDocType = $phpDocType;
- $this->passedByReference = $passedByReference;
- $this->defaultValue = $defaultValue;
- $this->variadic = $variadic;
}
public function getName(): string
diff --git a/src/Reflection/Php/PhpParameterReflection.php b/src/Reflection/Php/PhpParameterReflection.php
index 9f1f6b4388..63be44cf3c 100644
--- a/src/Reflection/Php/PhpParameterReflection.php
+++ b/src/Reflection/Php/PhpParameterReflection.php
@@ -15,25 +15,16 @@
class PhpParameterReflection implements ParameterReflectionWithPhpDocs
{
- private ReflectionParameter $reflection;
-
- private ?Type $phpDocType;
-
private ?Type $type = null;
private ?Type $nativeType = null;
- private ?string $declaringClassName;
-
public function __construct(
- ReflectionParameter $reflection,
- ?Type $phpDocType,
- ?string $declaringClassName,
+ private ReflectionParameter $reflection,
+ private ?Type $phpDocType,
+ private ?string $declaringClassName,
)
{
- $this->reflection = $reflection;
- $this->phpDocType = $phpDocType;
- $this->declaringClassName = $declaringClassName;
}
public function isOptional(): bool
diff --git a/src/Reflection/Php/PhpPropertyReflection.php b/src/Reflection/Php/PhpPropertyReflection.php
index 878b9caeea..3e0fab20c1 100644
--- a/src/Reflection/Php/PhpPropertyReflection.php
+++ b/src/Reflection/Php/PhpPropertyReflection.php
@@ -16,45 +16,21 @@
class PhpPropertyReflection implements PropertyReflection
{
- private ClassReflection $declaringClass;
-
- private ?ClassReflection $declaringTrait;
-
- private ?ReflectionType $nativeType;
-
private ?Type $finalNativeType = null;
- private ?Type $phpDocType;
-
private ?Type $type = null;
- private ReflectionProperty $reflection;
-
- private ?string $deprecatedDescription;
-
- private bool $isDeprecated;
-
- private bool $isInternal;
-
public function __construct(
- ClassReflection $declaringClass,
- ?ClassReflection $declaringTrait,
- ?ReflectionType $nativeType,
- ?Type $phpDocType,
- ReflectionProperty $reflection,
- ?string $deprecatedDescription,
- bool $isDeprecated,
- bool $isInternal,
+ private ClassReflection $declaringClass,
+ private ?ClassReflection $declaringTrait,
+ private ?ReflectionType $nativeType,
+ private ?Type $phpDocType,
+ private ReflectionProperty $reflection,
+ private ?string $deprecatedDescription,
+ private bool $isDeprecated,
+ private bool $isInternal,
)
{
- $this->declaringClass = $declaringClass;
- $this->declaringTrait = $declaringTrait;
- $this->nativeType = $nativeType;
- $this->phpDocType = $phpDocType;
- $this->reflection = $reflection;
- $this->deprecatedDescription = $deprecatedDescription;
- $this->isDeprecated = $isDeprecated;
- $this->isInternal = $isInternal;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Php/SimpleXMLElementProperty.php b/src/Reflection/Php/SimpleXMLElementProperty.php
index d3dfb900d1..9668d523be 100644
--- a/src/Reflection/Php/SimpleXMLElementProperty.php
+++ b/src/Reflection/Php/SimpleXMLElementProperty.php
@@ -15,17 +15,11 @@
class SimpleXMLElementProperty implements PropertyReflection
{
- private ClassReflection $declaringClass;
-
- private Type $type;
-
public function __construct(
- ClassReflection $declaringClass,
- Type $type,
+ private ClassReflection $declaringClass,
+ private Type $type,
)
{
- $this->declaringClass = $declaringClass;
- $this->type = $type;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Php/Soap/SoapClientMethodReflection.php b/src/Reflection/Php/Soap/SoapClientMethodReflection.php
index 724fc2da6b..15a814b20a 100644
--- a/src/Reflection/Php/Soap/SoapClientMethodReflection.php
+++ b/src/Reflection/Php/Soap/SoapClientMethodReflection.php
@@ -15,14 +15,8 @@
class SoapClientMethodReflection implements MethodReflection
{
- private ClassReflection $declaringClass;
-
- private string $name;
-
- public function __construct(ClassReflection $declaringClass, string $name)
+ public function __construct(private ClassReflection $declaringClass, private string $name)
{
- $this->declaringClass = $declaringClass;
- $this->name = $name;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Php/UniversalObjectCrateProperty.php b/src/Reflection/Php/UniversalObjectCrateProperty.php
index fb9ab49af2..3d766f5fee 100644
--- a/src/Reflection/Php/UniversalObjectCrateProperty.php
+++ b/src/Reflection/Php/UniversalObjectCrateProperty.php
@@ -10,21 +10,12 @@
class UniversalObjectCrateProperty implements PropertyReflection
{
- private ClassReflection $declaringClass;
-
- private Type $readableType;
-
- private Type $writableType;
-
public function __construct(
- ClassReflection $declaringClass,
- Type $readableType,
- Type $writableType,
+ private ClassReflection $declaringClass,
+ private Type $readableType,
+ private Type $writableType,
)
{
- $this->declaringClass = $declaringClass;
- $this->readableType = $readableType;
- $this->writableType = $writableType;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Php/UniversalObjectCratesClassReflectionExtension.php b/src/Reflection/Php/UniversalObjectCratesClassReflectionExtension.php
index 3428c6299d..6260882e02 100644
--- a/src/Reflection/Php/UniversalObjectCratesClassReflectionExtension.php
+++ b/src/Reflection/Php/UniversalObjectCratesClassReflectionExtension.php
@@ -13,18 +13,11 @@ class UniversalObjectCratesClassReflectionExtension
implements PropertiesClassReflectionExtension
{
- /** @var string[] */
- private array $classes;
-
- private ReflectionProvider $reflectionProvider;
-
/**
* @param string[] $classes
*/
- public function __construct(ReflectionProvider $reflectionProvider, array $classes)
+ public function __construct(private ReflectionProvider $reflectionProvider, private array $classes)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->classes = $classes;
}
public function hasProperty(ClassReflection $classReflection, string $propertyName): bool
diff --git a/src/Reflection/ReflectionProvider/ChainReflectionProvider.php b/src/Reflection/ReflectionProvider/ChainReflectionProvider.php
index 00a501a683..f8b1183c68 100644
--- a/src/Reflection/ReflectionProvider/ChainReflectionProvider.php
+++ b/src/Reflection/ReflectionProvider/ChainReflectionProvider.php
@@ -16,17 +16,13 @@
class ChainReflectionProvider implements ReflectionProvider
{
- /** @var ReflectionProvider[] */
- private array $providers;
-
/**
* @param ReflectionProvider[] $providers
*/
public function __construct(
- array $providers,
+ private array $providers,
)
{
- $this->providers = $providers;
}
public function hasClass(string $className): bool
diff --git a/src/Reflection/ReflectionProvider/ClassBlacklistReflectionProvider.php b/src/Reflection/ReflectionProvider/ClassBlacklistReflectionProvider.php
index 84a735e686..734b9f5636 100644
--- a/src/Reflection/ReflectionProvider/ClassBlacklistReflectionProvider.php
+++ b/src/Reflection/ReflectionProvider/ClassBlacklistReflectionProvider.php
@@ -18,29 +18,16 @@
class ClassBlacklistReflectionProvider implements ReflectionProvider
{
- private ReflectionProvider $reflectionProvider;
-
- private PhpStormStubsSourceStubber $phpStormStubsSourceStubber;
-
- /** @var string[] */
- private array $patterns;
-
- private ?string $singleReflectionInsteadOfFile;
-
/**
* @param string[] $patterns
*/
public function __construct(
- ReflectionProvider $reflectionProvider,
- PhpStormStubsSourceStubber $phpStormStubsSourceStubber,
- array $patterns,
- ?string $singleReflectionInsteadOfFile,
+ private ReflectionProvider $reflectionProvider,
+ private PhpStormStubsSourceStubber $phpStormStubsSourceStubber,
+ private array $patterns,
+ private ?string $singleReflectionInsteadOfFile,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->phpStormStubsSourceStubber = $phpStormStubsSourceStubber;
- $this->patterns = $patterns;
- $this->singleReflectionInsteadOfFile = $singleReflectionInsteadOfFile;
}
public function hasClass(string $className): bool
diff --git a/src/Reflection/ReflectionProvider/DirectReflectionProviderProvider.php b/src/Reflection/ReflectionProvider/DirectReflectionProviderProvider.php
index 96b4dd2fe0..e1c7e31e1f 100644
--- a/src/Reflection/ReflectionProvider/DirectReflectionProviderProvider.php
+++ b/src/Reflection/ReflectionProvider/DirectReflectionProviderProvider.php
@@ -7,11 +7,8 @@
class DirectReflectionProviderProvider implements ReflectionProviderProvider
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function getReflectionProvider(): ReflectionProvider
diff --git a/src/Reflection/ReflectionProvider/LazyReflectionProviderProvider.php b/src/Reflection/ReflectionProvider/LazyReflectionProviderProvider.php
index b8c623995c..9e4b1957a0 100644
--- a/src/Reflection/ReflectionProvider/LazyReflectionProviderProvider.php
+++ b/src/Reflection/ReflectionProvider/LazyReflectionProviderProvider.php
@@ -8,11 +8,8 @@
class LazyReflectionProviderProvider implements ReflectionProviderProvider
{
- private Container $container;
-
- public function __construct(Container $container)
+ public function __construct(private Container $container)
{
- $this->container = $container;
}
public function getReflectionProvider(): ReflectionProvider
diff --git a/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php b/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php
index b42196a9f3..1cb6f44eb9 100644
--- a/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php
+++ b/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php
@@ -13,8 +13,6 @@
class MemoizingReflectionProvider implements ReflectionProvider
{
- private ReflectionProvider $provider;
-
/** @var array */
private array $hasClasses = [];
@@ -24,9 +22,8 @@ class MemoizingReflectionProvider implements ReflectionProvider
/** @var array */
private array $classNames = [];
- public function __construct(ReflectionProvider $provider)
+ public function __construct(private ReflectionProvider $provider)
{
- $this->provider = $provider;
}
public function hasClass(string $className): bool
diff --git a/src/Reflection/ReflectionProvider/ReflectionProviderFactory.php b/src/Reflection/ReflectionProvider/ReflectionProviderFactory.php
index 1ae7b0ced8..9f54ac31b3 100644
--- a/src/Reflection/ReflectionProvider/ReflectionProviderFactory.php
+++ b/src/Reflection/ReflectionProvider/ReflectionProviderFactory.php
@@ -8,21 +8,12 @@
class ReflectionProviderFactory
{
- private ReflectionProvider $runtimeReflectionProvider;
-
- private ReflectionProvider $staticReflectionProvider;
-
- private bool $disableRuntimeReflectionProvider;
-
public function __construct(
- ReflectionProvider $runtimeReflectionProvider,
- ReflectionProvider $staticReflectionProvider,
- bool $disableRuntimeReflectionProvider,
+ private ReflectionProvider $runtimeReflectionProvider,
+ private ReflectionProvider $staticReflectionProvider,
+ private bool $disableRuntimeReflectionProvider,
)
{
- $this->runtimeReflectionProvider = $runtimeReflectionProvider;
- $this->staticReflectionProvider = $staticReflectionProvider;
- $this->disableRuntimeReflectionProvider = $disableRuntimeReflectionProvider;
}
public function create(): ReflectionProvider
diff --git a/src/Reflection/ResolvedFunctionVariant.php b/src/Reflection/ResolvedFunctionVariant.php
index 3611168e5f..bfdb215c07 100644
--- a/src/Reflection/ResolvedFunctionVariant.php
+++ b/src/Reflection/ResolvedFunctionVariant.php
@@ -11,22 +11,16 @@
class ResolvedFunctionVariant implements ParametersAcceptor
{
- private ParametersAcceptor $parametersAcceptor;
-
- private TemplateTypeMap $resolvedTemplateTypeMap;
-
/** @var ParameterReflection[]|null */
private ?array $parameters = null;
private ?Type $returnType = null;
public function __construct(
- ParametersAcceptor $parametersAcceptor,
- TemplateTypeMap $resolvedTemplateTypeMap,
+ private ParametersAcceptor $parametersAcceptor,
+ private TemplateTypeMap $resolvedTemplateTypeMap,
)
{
- $this->parametersAcceptor = $parametersAcceptor;
- $this->resolvedTemplateTypeMap = $resolvedTemplateTypeMap;
}
public function getOriginalParametersAcceptor(): ParametersAcceptor
diff --git a/src/Reflection/ResolvedMethodReflection.php b/src/Reflection/ResolvedMethodReflection.php
index a3ff2691fe..eeab6cab92 100644
--- a/src/Reflection/ResolvedMethodReflection.php
+++ b/src/Reflection/ResolvedMethodReflection.php
@@ -10,17 +10,11 @@
class ResolvedMethodReflection implements MethodReflection
{
- private MethodReflection $reflection;
-
- private TemplateTypeMap $resolvedTemplateTypeMap;
-
/** @var ParametersAcceptor[]|null */
private ?array $variants = null;
- public function __construct(MethodReflection $reflection, TemplateTypeMap $resolvedTemplateTypeMap)
+ public function __construct(private MethodReflection $reflection, private TemplateTypeMap $resolvedTemplateTypeMap)
{
- $this->reflection = $reflection;
- $this->resolvedTemplateTypeMap = $resolvedTemplateTypeMap;
}
public function getName(): string
diff --git a/src/Reflection/ResolvedPropertyReflection.php b/src/Reflection/ResolvedPropertyReflection.php
index 73af7001d5..0596d61d6b 100644
--- a/src/Reflection/ResolvedPropertyReflection.php
+++ b/src/Reflection/ResolvedPropertyReflection.php
@@ -11,18 +11,12 @@
class ResolvedPropertyReflection implements WrapperPropertyReflection
{
- private PropertyReflection $reflection;
-
- private TemplateTypeMap $templateTypeMap;
-
private ?Type $readableType = null;
private ?Type $writableType = null;
- public function __construct(PropertyReflection $reflection, TemplateTypeMap $templateTypeMap)
+ public function __construct(private PropertyReflection $reflection, private TemplateTypeMap $templateTypeMap)
{
- $this->reflection = $reflection;
- $this->templateTypeMap = $templateTypeMap;
}
public function getOriginalReflection(): PropertyReflection
diff --git a/src/Reflection/Runtime/RuntimeReflectionProvider.php b/src/Reflection/Runtime/RuntimeReflectionProvider.php
index 7b94d870cb..7ec7d9d16b 100644
--- a/src/Reflection/Runtime/RuntimeReflectionProvider.php
+++ b/src/Reflection/Runtime/RuntimeReflectionProvider.php
@@ -52,27 +52,9 @@
class RuntimeReflectionProvider implements ReflectionProvider
{
- private ReflectionProvider\ReflectionProviderProvider $reflectionProviderProvider;
-
- private ClassReflectionExtensionRegistryProvider $classReflectionExtensionRegistryProvider;
-
/** @var ClassReflection[] */
private array $classReflections = [];
- private FunctionReflectionFactory $functionReflectionFactory;
-
- private FileTypeMapper $fileTypeMapper;
-
- private PhpVersion $phpVersion;
-
- private NativeFunctionReflectionProvider $nativeFunctionReflectionProvider;
-
- private StubPhpDocProvider $stubPhpDocProvider;
-
- private PhpDocInheritanceResolver $phpDocInheritanceResolver;
-
- private PhpStormStubsSourceStubber $phpStormStubsSourceStubber;
-
/** @var FunctionReflection[] */
private array $functionReflections = [];
@@ -89,26 +71,17 @@ class RuntimeReflectionProvider implements ReflectionProvider
private array $cachedConstants = [];
public function __construct(
- ReflectionProvider\ReflectionProviderProvider $reflectionProviderProvider,
- ClassReflectionExtensionRegistryProvider $classReflectionExtensionRegistryProvider,
- FunctionReflectionFactory $functionReflectionFactory,
- FileTypeMapper $fileTypeMapper,
- PhpDocInheritanceResolver $phpDocInheritanceResolver,
- PhpVersion $phpVersion,
- NativeFunctionReflectionProvider $nativeFunctionReflectionProvider,
- StubPhpDocProvider $stubPhpDocProvider,
- PhpStormStubsSourceStubber $phpStormStubsSourceStubber,
+ private ReflectionProvider\ReflectionProviderProvider $reflectionProviderProvider,
+ private ClassReflectionExtensionRegistryProvider $classReflectionExtensionRegistryProvider,
+ private FunctionReflectionFactory $functionReflectionFactory,
+ private FileTypeMapper $fileTypeMapper,
+ private PhpDocInheritanceResolver $phpDocInheritanceResolver,
+ private PhpVersion $phpVersion,
+ private NativeFunctionReflectionProvider $nativeFunctionReflectionProvider,
+ private StubPhpDocProvider $stubPhpDocProvider,
+ private PhpStormStubsSourceStubber $phpStormStubsSourceStubber,
)
{
- $this->reflectionProviderProvider = $reflectionProviderProvider;
- $this->classReflectionExtensionRegistryProvider = $classReflectionExtensionRegistryProvider;
- $this->functionReflectionFactory = $functionReflectionFactory;
- $this->fileTypeMapper = $fileTypeMapper;
- $this->phpDocInheritanceResolver = $phpDocInheritanceResolver;
- $this->phpVersion = $phpVersion;
- $this->nativeFunctionReflectionProvider = $nativeFunctionReflectionProvider;
- $this->stubPhpDocProvider = $stubPhpDocProvider;
- $this->phpStormStubsSourceStubber = $phpStormStubsSourceStubber;
}
public function getClass(string $className): ClassReflection
diff --git a/src/Reflection/SignatureMap/FunctionSignature.php b/src/Reflection/SignatureMap/FunctionSignature.php
index 6f134db914..8473684acc 100644
--- a/src/Reflection/SignatureMap/FunctionSignature.php
+++ b/src/Reflection/SignatureMap/FunctionSignature.php
@@ -7,29 +7,16 @@
class FunctionSignature
{
- /** @var ParameterSignature[] */
- private array $parameters;
-
- private Type $returnType;
-
- private Type $nativeReturnType;
-
- private bool $variadic;
-
/**
* @param array $parameters
*/
public function __construct(
- array $parameters,
- Type $returnType,
- Type $nativeReturnType,
- bool $variadic,
+ private array $parameters,
+ private Type $returnType,
+ private Type $nativeReturnType,
+ private bool $variadic,
)
{
- $this->parameters = $parameters;
- $this->returnType = $returnType;
- $this->nativeReturnType = $nativeReturnType;
- $this->variadic = $variadic;
}
/**
diff --git a/src/Reflection/SignatureMap/FunctionSignatureMapProvider.php b/src/Reflection/SignatureMap/FunctionSignatureMapProvider.php
index d0565f05b6..6afcff805f 100644
--- a/src/Reflection/SignatureMap/FunctionSignatureMapProvider.php
+++ b/src/Reflection/SignatureMap/FunctionSignatureMapProvider.php
@@ -18,20 +18,14 @@
class FunctionSignatureMapProvider implements SignatureMapProvider
{
- private SignatureMapParser $parser;
-
- private PhpVersion $phpVersion;
-
/** @var mixed[]|null */
private ?array $signatureMap = null;
/** @var array|null */
private ?array $functionMetadata = null;
- public function __construct(SignatureMapParser $parser, PhpVersion $phpVersion)
+ public function __construct(private SignatureMapParser $parser, private PhpVersion $phpVersion)
{
- $this->parser = $parser;
- $this->phpVersion = $phpVersion;
}
public function hasMethodSignature(string $className, string $methodName, int $variant = 0): bool
diff --git a/src/Reflection/SignatureMap/NativeFunctionReflectionProvider.php b/src/Reflection/SignatureMap/NativeFunctionReflectionProvider.php
index 031d10f0ab..fbd1794848 100644
--- a/src/Reflection/SignatureMap/NativeFunctionReflectionProvider.php
+++ b/src/Reflection/SignatureMap/NativeFunctionReflectionProvider.php
@@ -32,20 +32,8 @@ class NativeFunctionReflectionProvider
/** @var NativeFunctionReflection[] */
private static array $functionMap = [];
- private SignatureMapProvider $signatureMapProvider;
-
- private Reflector $reflector;
-
- private FileTypeMapper $fileTypeMapper;
-
- private StubPhpDocProvider $stubPhpDocProvider;
-
- public function __construct(SignatureMapProvider $signatureMapProvider, Reflector $reflector, FileTypeMapper $fileTypeMapper, StubPhpDocProvider $stubPhpDocProvider)
+ public function __construct(private SignatureMapProvider $signatureMapProvider, private Reflector $reflector, private FileTypeMapper $fileTypeMapper, private StubPhpDocProvider $stubPhpDocProvider)
{
- $this->signatureMapProvider = $signatureMapProvider;
- $this->reflector = $reflector;
- $this->fileTypeMapper = $fileTypeMapper;
- $this->stubPhpDocProvider = $stubPhpDocProvider;
}
public function findFunctionReflection(string $functionName): ?NativeFunctionReflection
diff --git a/src/Reflection/SignatureMap/ParameterSignature.php b/src/Reflection/SignatureMap/ParameterSignature.php
index cf3ee74932..45b8f5f294 100644
--- a/src/Reflection/SignatureMap/ParameterSignature.php
+++ b/src/Reflection/SignatureMap/ParameterSignature.php
@@ -8,33 +8,15 @@
class ParameterSignature
{
- private string $name;
-
- private bool $optional;
-
- private Type $type;
-
- private Type $nativeType;
-
- private PassedByReference $passedByReference;
-
- private bool $variadic;
-
public function __construct(
- string $name,
- bool $optional,
- Type $type,
- Type $nativeType,
- PassedByReference $passedByReference,
- bool $variadic,
+ private string $name,
+ private bool $optional,
+ private Type $type,
+ private Type $nativeType,
+ private PassedByReference $passedByReference,
+ private bool $variadic,
)
{
- $this->name = $name;
- $this->optional = $optional;
- $this->type = $type;
- $this->nativeType = $nativeType;
- $this->passedByReference = $passedByReference;
- $this->variadic = $variadic;
}
public function getName(): string
diff --git a/src/Reflection/SignatureMap/Php8SignatureMapProvider.php b/src/Reflection/SignatureMap/Php8SignatureMapProvider.php
index 6adf646fe7..9e2fd564d0 100644
--- a/src/Reflection/SignatureMap/Php8SignatureMapProvider.php
+++ b/src/Reflection/SignatureMap/Php8SignatureMapProvider.php
@@ -29,24 +29,15 @@ class Php8SignatureMapProvider implements SignatureMapProvider
private const DIRECTORY = __DIR__ . '/../../../vendor/phpstan/php-8-stubs';
- private FunctionSignatureMapProvider $functionSignatureMapProvider;
-
- private FileNodesFetcher $fileNodesFetcher;
-
- private FileTypeMapper $fileTypeMapper;
-
/** @var array> */
private array $methodNodes = [];
public function __construct(
- FunctionSignatureMapProvider $functionSignatureMapProvider,
- FileNodesFetcher $fileNodesFetcher,
- FileTypeMapper $fileTypeMapper,
+ private FunctionSignatureMapProvider $functionSignatureMapProvider,
+ private FileNodesFetcher $fileNodesFetcher,
+ private FileTypeMapper $fileTypeMapper,
)
{
- $this->functionSignatureMapProvider = $functionSignatureMapProvider;
- $this->fileNodesFetcher = $fileNodesFetcher;
- $this->fileTypeMapper = $fileTypeMapper;
}
public function hasMethodSignature(string $className, string $methodName, int $variant = 0): bool
diff --git a/src/Reflection/SignatureMap/SignatureMapProviderFactory.php b/src/Reflection/SignatureMap/SignatureMapProviderFactory.php
index 06d42a79dd..2e318eefeb 100644
--- a/src/Reflection/SignatureMap/SignatureMapProviderFactory.php
+++ b/src/Reflection/SignatureMap/SignatureMapProviderFactory.php
@@ -7,21 +7,12 @@
class SignatureMapProviderFactory
{
- private PhpVersion $phpVersion;
-
- private FunctionSignatureMapProvider $functionSignatureMapProvider;
-
- private Php8SignatureMapProvider $php8SignatureMapProvider;
-
public function __construct(
- PhpVersion $phpVersion,
- FunctionSignatureMapProvider $functionSignatureMapProvider,
- Php8SignatureMapProvider $php8SignatureMapProvider,
+ private PhpVersion $phpVersion,
+ private FunctionSignatureMapProvider $functionSignatureMapProvider,
+ private Php8SignatureMapProvider $php8SignatureMapProvider,
)
{
- $this->phpVersion = $phpVersion;
- $this->functionSignatureMapProvider = $functionSignatureMapProvider;
- $this->php8SignatureMapProvider = $php8SignatureMapProvider;
}
public function create(): SignatureMapProvider
diff --git a/src/Reflection/Type/CallbackUnresolvedMethodPrototypeReflection.php b/src/Reflection/Type/CallbackUnresolvedMethodPrototypeReflection.php
index c5eefd647e..51e964c685 100644
--- a/src/Reflection/Type/CallbackUnresolvedMethodPrototypeReflection.php
+++ b/src/Reflection/Type/CallbackUnresolvedMethodPrototypeReflection.php
@@ -16,12 +16,6 @@
class CallbackUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection
{
- private MethodReflection $methodReflection;
-
- private ClassReflection $resolvedDeclaringClass;
-
- private bool $resolveTemplateTypeMapToBounds;
-
/** @var callable(Type): Type */
private $transformStaticTypeCallback;
@@ -33,15 +27,12 @@ class CallbackUnresolvedMethodPrototypeReflection implements UnresolvedMethodPro
* @param callable(Type): Type $transformStaticTypeCallback
*/
public function __construct(
- MethodReflection $methodReflection,
- ClassReflection $resolvedDeclaringClass,
- bool $resolveTemplateTypeMapToBounds,
+ private MethodReflection $methodReflection,
+ private ClassReflection $resolvedDeclaringClass,
+ private bool $resolveTemplateTypeMapToBounds,
callable $transformStaticTypeCallback,
)
{
- $this->methodReflection = $methodReflection;
- $this->resolvedDeclaringClass = $resolvedDeclaringClass;
- $this->resolveTemplateTypeMapToBounds = $resolveTemplateTypeMapToBounds;
$this->transformStaticTypeCallback = $transformStaticTypeCallback;
}
diff --git a/src/Reflection/Type/CallbackUnresolvedPropertyPrototypeReflection.php b/src/Reflection/Type/CallbackUnresolvedPropertyPrototypeReflection.php
index a70b385e77..ab53a24f99 100644
--- a/src/Reflection/Type/CallbackUnresolvedPropertyPrototypeReflection.php
+++ b/src/Reflection/Type/CallbackUnresolvedPropertyPrototypeReflection.php
@@ -11,12 +11,6 @@
class CallbackUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection
{
- private PropertyReflection $propertyReflection;
-
- private ClassReflection $resolvedDeclaringClass;
-
- private bool $resolveTemplateTypeMapToBounds;
-
/** @var callable(Type): Type */
private $transformStaticTypeCallback;
@@ -28,15 +22,12 @@ class CallbackUnresolvedPropertyPrototypeReflection implements UnresolvedPropert
* @param callable(Type): Type $transformStaticTypeCallback
*/
public function __construct(
- PropertyReflection $propertyReflection,
- ClassReflection $resolvedDeclaringClass,
- bool $resolveTemplateTypeMapToBounds,
+ private PropertyReflection $propertyReflection,
+ private ClassReflection $resolvedDeclaringClass,
+ private bool $resolveTemplateTypeMapToBounds,
callable $transformStaticTypeCallback,
)
{
- $this->propertyReflection = $propertyReflection;
- $this->resolvedDeclaringClass = $resolvedDeclaringClass;
- $this->resolveTemplateTypeMapToBounds = $resolveTemplateTypeMapToBounds;
$this->transformStaticTypeCallback = $transformStaticTypeCallback;
}
diff --git a/src/Reflection/Type/CalledOnTypeUnresolvedMethodPrototypeReflection.php b/src/Reflection/Type/CalledOnTypeUnresolvedMethodPrototypeReflection.php
index 89dfabe289..dfd47cbef2 100644
--- a/src/Reflection/Type/CalledOnTypeUnresolvedMethodPrototypeReflection.php
+++ b/src/Reflection/Type/CalledOnTypeUnresolvedMethodPrototypeReflection.php
@@ -18,29 +18,17 @@
class CalledOnTypeUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection
{
- private MethodReflection $methodReflection;
-
- private ClassReflection $resolvedDeclaringClass;
-
- private bool $resolveTemplateTypeMapToBounds;
-
- private Type $calledOnType;
-
private ?MethodReflection $transformedMethod = null;
private ?self $cachedDoNotResolveTemplateTypeMapToBounds = null;
public function __construct(
- MethodReflection $methodReflection,
- ClassReflection $resolvedDeclaringClass,
- bool $resolveTemplateTypeMapToBounds,
- Type $calledOnType,
+ private MethodReflection $methodReflection,
+ private ClassReflection $resolvedDeclaringClass,
+ private bool $resolveTemplateTypeMapToBounds,
+ private Type $calledOnType,
)
{
- $this->methodReflection = $methodReflection;
- $this->resolvedDeclaringClass = $resolvedDeclaringClass;
- $this->resolveTemplateTypeMapToBounds = $resolveTemplateTypeMapToBounds;
- $this->calledOnType = $calledOnType;
}
public function doNotResolveTemplateTypeMapToBounds(): UnresolvedMethodPrototypeReflection
diff --git a/src/Reflection/Type/CalledOnTypeUnresolvedPropertyPrototypeReflection.php b/src/Reflection/Type/CalledOnTypeUnresolvedPropertyPrototypeReflection.php
index dcb355aa11..13e7f5b875 100644
--- a/src/Reflection/Type/CalledOnTypeUnresolvedPropertyPrototypeReflection.php
+++ b/src/Reflection/Type/CalledOnTypeUnresolvedPropertyPrototypeReflection.php
@@ -13,29 +13,17 @@
class CalledOnTypeUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection
{
- private PropertyReflection $propertyReflection;
-
- private ClassReflection $resolvedDeclaringClass;
-
- private bool $resolveTemplateTypeMapToBounds;
-
- private Type $fetchedOnType;
-
private ?PropertyReflection $transformedProperty = null;
private ?self $cachedDoNotResolveTemplateTypeMapToBounds = null;
public function __construct(
- PropertyReflection $propertyReflection,
- ClassReflection $resolvedDeclaringClass,
- bool $resolveTemplateTypeMapToBounds,
- Type $fetchedOnType,
+ private PropertyReflection $propertyReflection,
+ private ClassReflection $resolvedDeclaringClass,
+ private bool $resolveTemplateTypeMapToBounds,
+ private Type $fetchedOnType,
)
{
- $this->propertyReflection = $propertyReflection;
- $this->resolvedDeclaringClass = $resolvedDeclaringClass;
- $this->resolveTemplateTypeMapToBounds = $resolveTemplateTypeMapToBounds;
- $this->fetchedOnType = $fetchedOnType;
}
public function doNotResolveTemplateTypeMapToBounds(): UnresolvedPropertyPrototypeReflection
diff --git a/src/Reflection/Type/IntersectionTypeMethodReflection.php b/src/Reflection/Type/IntersectionTypeMethodReflection.php
index 6b3e63e8a1..8c547ca3d0 100644
--- a/src/Reflection/Type/IntersectionTypeMethodReflection.php
+++ b/src/Reflection/Type/IntersectionTypeMethodReflection.php
@@ -17,18 +17,11 @@
class IntersectionTypeMethodReflection implements MethodReflection
{
- private string $methodName;
-
- /** @var MethodReflection[] */
- private array $methods;
-
/**
* @param MethodReflection[] $methods
*/
- public function __construct(string $methodName, array $methods)
+ public function __construct(private string $methodName, private array $methods)
{
- $this->methodName = $methodName;
- $this->methods = $methods;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Type/IntersectionTypePropertyReflection.php b/src/Reflection/Type/IntersectionTypePropertyReflection.php
index a4e3dc4f49..68db339d3c 100644
--- a/src/Reflection/Type/IntersectionTypePropertyReflection.php
+++ b/src/Reflection/Type/IntersectionTypePropertyReflection.php
@@ -14,15 +14,11 @@
class IntersectionTypePropertyReflection implements PropertyReflection
{
- /** @var PropertyReflection[] */
- private array $properties;
-
/**
* @param PropertyReflection[] $properties
*/
- public function __construct(array $properties)
+ public function __construct(private array $properties)
{
- $this->properties = $properties;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Type/IntersectionTypeUnresolvedMethodPrototypeReflection.php b/src/Reflection/Type/IntersectionTypeUnresolvedMethodPrototypeReflection.php
index a39ea4c676..be6d2d944f 100644
--- a/src/Reflection/Type/IntersectionTypeUnresolvedMethodPrototypeReflection.php
+++ b/src/Reflection/Type/IntersectionTypeUnresolvedMethodPrototypeReflection.php
@@ -9,11 +9,6 @@
class IntersectionTypeUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection
{
- private string $methodName;
-
- /** @var UnresolvedMethodPrototypeReflection[] */
- private array $methodPrototypes;
-
private ?MethodReflection $transformedMethod = null;
private ?self $cachedDoNotResolveTemplateTypeMapToBounds = null;
@@ -22,12 +17,10 @@ class IntersectionTypeUnresolvedMethodPrototypeReflection implements UnresolvedM
* @param UnresolvedMethodPrototypeReflection[] $methodPrototypes
*/
public function __construct(
- string $methodName,
- array $methodPrototypes,
+ private string $methodName,
+ private array $methodPrototypes,
)
{
- $this->methodName = $methodName;
- $this->methodPrototypes = $methodPrototypes;
}
public function doNotResolveTemplateTypeMapToBounds(): UnresolvedMethodPrototypeReflection
diff --git a/src/Reflection/Type/IntersectionTypeUnresolvedPropertyPrototypeReflection.php b/src/Reflection/Type/IntersectionTypeUnresolvedPropertyPrototypeReflection.php
index fb9a014760..fdfea4ebf9 100644
--- a/src/Reflection/Type/IntersectionTypeUnresolvedPropertyPrototypeReflection.php
+++ b/src/Reflection/Type/IntersectionTypeUnresolvedPropertyPrototypeReflection.php
@@ -9,11 +9,6 @@
class IntersectionTypeUnresolvedPropertyPrototypeReflection implements UnresolvedPropertyPrototypeReflection
{
- private string $propertyName;
-
- /** @var UnresolvedPropertyPrototypeReflection[] */
- private array $propertyPrototypes;
-
private ?PropertyReflection $transformedProperty = null;
private ?self $cachedDoNotResolveTemplateTypeMapToBounds = null;
@@ -22,12 +17,10 @@ class IntersectionTypeUnresolvedPropertyPrototypeReflection implements Unresolve
* @param UnresolvedPropertyPrototypeReflection[] $propertyPrototypes
*/
public function __construct(
- string $propertyName,
- array $propertyPrototypes,
+ private string $propertyName,
+ private array $propertyPrototypes,
)
{
- $this->propertyName = $propertyName;
- $this->propertyPrototypes = $propertyPrototypes;
}
public function doNotResolveTemplateTypeMapToBounds(): UnresolvedPropertyPrototypeReflection
diff --git a/src/Reflection/Type/UnionTypeMethodReflection.php b/src/Reflection/Type/UnionTypeMethodReflection.php
index 999d0c0b20..cde9bb3f69 100644
--- a/src/Reflection/Type/UnionTypeMethodReflection.php
+++ b/src/Reflection/Type/UnionTypeMethodReflection.php
@@ -17,18 +17,11 @@
class UnionTypeMethodReflection implements MethodReflection
{
- private string $methodName;
-
- /** @var MethodReflection[] */
- private array $methods;
-
/**
* @param MethodReflection[] $methods
*/
- public function __construct(string $methodName, array $methods)
+ public function __construct(private string $methodName, private array $methods)
{
- $this->methodName = $methodName;
- $this->methods = $methods;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Type/UnionTypePropertyReflection.php b/src/Reflection/Type/UnionTypePropertyReflection.php
index 7bcd9ff7e0..d14cfa7b7a 100644
--- a/src/Reflection/Type/UnionTypePropertyReflection.php
+++ b/src/Reflection/Type/UnionTypePropertyReflection.php
@@ -14,15 +14,11 @@
class UnionTypePropertyReflection implements PropertyReflection
{
- /** @var PropertyReflection[] */
- private array $properties;
-
/**
* @param PropertyReflection[] $properties
*/
- public function __construct(array $properties)
+ public function __construct(private array $properties)
{
- $this->properties = $properties;
}
public function getDeclaringClass(): ClassReflection
diff --git a/src/Reflection/Type/UnionTypeUnresolvedMethodPrototypeReflection.php b/src/Reflection/Type/UnionTypeUnresolvedMethodPrototypeReflection.php
index dcc641dc67..4d8cf48a19 100644
--- a/src/Reflection/Type/UnionTypeUnresolvedMethodPrototypeReflection.php
+++ b/src/Reflection/Type/UnionTypeUnresolvedMethodPrototypeReflection.php
@@ -9,11 +9,6 @@
class UnionTypeUnresolvedMethodPrototypeReflection implements UnresolvedMethodPrototypeReflection
{
- private string $methodName;
-
- /** @var UnresolvedMethodPrototypeReflection[] */
- private array $methodPrototypes;
-
private ?MethodReflection $transformedMethod = null;
private ?self $cachedDoNotResolveTemplateTypeMapToBounds = null;
@@ -22,12 +17,10 @@ class UnionTypeUnresolvedMethodPrototypeReflection implements UnresolvedMethodPr
* @param UnresolvedMethodPrototypeReflection[] $methodPrototypes
*/
public function __construct(
- string $methodName,
- array $methodPrototypes,
+ private string $methodName,
+ private array $methodPrototypes,
)
{
- $this->methodName = $methodName;
- $this->methodPrototypes = $methodPrototypes;
}
public function doNotResolveTemplateTypeMapToBounds(): UnresolvedMethodPrototypeReflection
diff --git a/src/Reflection/Type/UnionTypeUnresolvedPropertyPrototypeReflection.php b/src/Reflection/Type/UnionTypeUnresolvedPropertyPrototypeReflection.php
index aa5a7e198e..746992aadc 100644
--- a/src/Reflection/Type/UnionTypeUnresolvedPropertyPrototypeReflection.php
+++ b/src/Reflection/Type/UnionTypeUnresolvedPropertyPrototypeReflection.php
@@ -11,9 +11,6 @@ class UnionTypeUnresolvedPropertyPrototypeReflection implements UnresolvedProper
private string $propertyName;
- /** @var UnresolvedPropertyPrototypeReflection[] */
- private array $propertyPrototypes;
-
private ?PropertyReflection $transformedProperty = null;
private ?self $cachedDoNotResolveTemplateTypeMapToBounds = null;
@@ -23,11 +20,10 @@ class UnionTypeUnresolvedPropertyPrototypeReflection implements UnresolvedProper
*/
public function __construct(
string $methodName,
- array $propertyPrototypes,
+ private array $propertyPrototypes,
)
{
$this->propertyName = $methodName;
- $this->propertyPrototypes = $propertyPrototypes;
}
public function doNotResolveTemplateTypeMapToBounds(): UnresolvedPropertyPrototypeReflection
diff --git a/src/Rules/Api/ApiClassExtendsRule.php b/src/Rules/Api/ApiClassExtendsRule.php
index 2e7c8198ca..dd90c44f5c 100644
--- a/src/Rules/Api/ApiClassExtendsRule.php
+++ b/src/Rules/Api/ApiClassExtendsRule.php
@@ -18,17 +18,11 @@
class ApiClassExtendsRule implements Rule
{
- private ApiRuleHelper $apiRuleHelper;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- ApiRuleHelper $apiRuleHelper,
- ReflectionProvider $reflectionProvider,
+ private ApiRuleHelper $apiRuleHelper,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->apiRuleHelper = $apiRuleHelper;
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Api/ApiClassImplementsRule.php b/src/Rules/Api/ApiClassImplementsRule.php
index e4dd7733c1..2054fa1cd4 100644
--- a/src/Rules/Api/ApiClassImplementsRule.php
+++ b/src/Rules/Api/ApiClassImplementsRule.php
@@ -20,17 +20,11 @@
class ApiClassImplementsRule implements Rule
{
- private ApiRuleHelper $apiRuleHelper;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- ApiRuleHelper $apiRuleHelper,
- ReflectionProvider $reflectionProvider,
+ private ApiRuleHelper $apiRuleHelper,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->apiRuleHelper = $apiRuleHelper;
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Api/ApiInstantiationRule.php b/src/Rules/Api/ApiInstantiationRule.php
index 56ab5b0fb4..f98f17af0d 100644
--- a/src/Rules/Api/ApiInstantiationRule.php
+++ b/src/Rules/Api/ApiInstantiationRule.php
@@ -16,17 +16,11 @@
class ApiInstantiationRule implements Rule
{
- private ApiRuleHelper $apiRuleHelper;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- ApiRuleHelper $apiRuleHelper,
- ReflectionProvider $reflectionProvider,
+ private ApiRuleHelper $apiRuleHelper,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->apiRuleHelper = $apiRuleHelper;
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Api/ApiInterfaceExtendsRule.php b/src/Rules/Api/ApiInterfaceExtendsRule.php
index d0fa8420e8..94667cad97 100644
--- a/src/Rules/Api/ApiInterfaceExtendsRule.php
+++ b/src/Rules/Api/ApiInterfaceExtendsRule.php
@@ -20,17 +20,11 @@
class ApiInterfaceExtendsRule implements Rule
{
- private ApiRuleHelper $apiRuleHelper;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- ApiRuleHelper $apiRuleHelper,
- ReflectionProvider $reflectionProvider,
+ private ApiRuleHelper $apiRuleHelper,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->apiRuleHelper = $apiRuleHelper;
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Api/ApiMethodCallRule.php b/src/Rules/Api/ApiMethodCallRule.php
index ab011b90f6..0b61144103 100644
--- a/src/Rules/Api/ApiMethodCallRule.php
+++ b/src/Rules/Api/ApiMethodCallRule.php
@@ -17,11 +17,8 @@
class ApiMethodCallRule implements Rule
{
- private ApiRuleHelper $apiRuleHelper;
-
- public function __construct(ApiRuleHelper $apiRuleHelper)
+ public function __construct(private ApiRuleHelper $apiRuleHelper)
{
- $this->apiRuleHelper = $apiRuleHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Api/ApiStaticCallRule.php b/src/Rules/Api/ApiStaticCallRule.php
index f1e0e97780..b4ee6f08ca 100644
--- a/src/Rules/Api/ApiStaticCallRule.php
+++ b/src/Rules/Api/ApiStaticCallRule.php
@@ -18,17 +18,11 @@
class ApiStaticCallRule implements Rule
{
- private ApiRuleHelper $apiRuleHelper;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- ApiRuleHelper $apiRuleHelper,
- ReflectionProvider $reflectionProvider,
+ private ApiRuleHelper $apiRuleHelper,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->apiRuleHelper = $apiRuleHelper;
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Api/ApiTraitUseRule.php b/src/Rules/Api/ApiTraitUseRule.php
index 808e51f4f2..bd2a7ae10c 100644
--- a/src/Rules/Api/ApiTraitUseRule.php
+++ b/src/Rules/Api/ApiTraitUseRule.php
@@ -15,17 +15,11 @@
class ApiTraitUseRule implements Rule
{
- private ApiRuleHelper $apiRuleHelper;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- ApiRuleHelper $apiRuleHelper,
- ReflectionProvider $reflectionProvider,
+ private ApiRuleHelper $apiRuleHelper,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->apiRuleHelper = $apiRuleHelper;
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Api/PhpStanNamespaceIn3rdPartyPackageRule.php b/src/Rules/Api/PhpStanNamespaceIn3rdPartyPackageRule.php
index 3f70f93bd7..892bbc1660 100644
--- a/src/Rules/Api/PhpStanNamespaceIn3rdPartyPackageRule.php
+++ b/src/Rules/Api/PhpStanNamespaceIn3rdPartyPackageRule.php
@@ -21,11 +21,8 @@
class PhpStanNamespaceIn3rdPartyPackageRule implements Rule
{
- private ApiRuleHelper $apiRuleHelper;
-
- public function __construct(ApiRuleHelper $apiRuleHelper)
+ public function __construct(private ApiRuleHelper $apiRuleHelper)
{
- $this->apiRuleHelper = $apiRuleHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Arrays/AppendedArrayItemTypeRule.php b/src/Rules/Arrays/AppendedArrayItemTypeRule.php
index 72e4ae77d4..2e674c49ea 100644
--- a/src/Rules/Arrays/AppendedArrayItemTypeRule.php
+++ b/src/Rules/Arrays/AppendedArrayItemTypeRule.php
@@ -22,17 +22,11 @@
class AppendedArrayItemTypeRule implements Rule
{
- private PropertyReflectionFinder $propertyReflectionFinder;
-
- private RuleLevelHelper $ruleLevelHelper;
-
public function __construct(
- PropertyReflectionFinder $propertyReflectionFinder,
- RuleLevelHelper $ruleLevelHelper,
+ private PropertyReflectionFinder $propertyReflectionFinder,
+ private RuleLevelHelper $ruleLevelHelper,
)
{
- $this->propertyReflectionFinder = $propertyReflectionFinder;
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Arrays/AppendedArrayKeyTypeRule.php b/src/Rules/Arrays/AppendedArrayKeyTypeRule.php
index 3e01d515c1..f625240fa9 100644
--- a/src/Rules/Arrays/AppendedArrayKeyTypeRule.php
+++ b/src/Rules/Arrays/AppendedArrayKeyTypeRule.php
@@ -21,17 +21,11 @@
class AppendedArrayKeyTypeRule implements Rule
{
- private PropertyReflectionFinder $propertyReflectionFinder;
-
- private bool $checkUnionTypes;
-
public function __construct(
- PropertyReflectionFinder $propertyReflectionFinder,
- bool $checkUnionTypes,
+ private PropertyReflectionFinder $propertyReflectionFinder,
+ private bool $checkUnionTypes,
)
{
- $this->propertyReflectionFinder = $propertyReflectionFinder;
- $this->checkUnionTypes = $checkUnionTypes;
}
public function getNodeType(): string
diff --git a/src/Rules/Arrays/ArrayDestructuringRule.php b/src/Rules/Arrays/ArrayDestructuringRule.php
index de3384df04..37f63d4d7c 100644
--- a/src/Rules/Arrays/ArrayDestructuringRule.php
+++ b/src/Rules/Arrays/ArrayDestructuringRule.php
@@ -27,17 +27,11 @@
class ArrayDestructuringRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- private NonexistentOffsetInArrayDimFetchCheck $nonexistentOffsetInArrayDimFetchCheck;
-
public function __construct(
- RuleLevelHelper $ruleLevelHelper,
- NonexistentOffsetInArrayDimFetchCheck $nonexistentOffsetInArrayDimFetchCheck,
+ private RuleLevelHelper $ruleLevelHelper,
+ private NonexistentOffsetInArrayDimFetchCheck $nonexistentOffsetInArrayDimFetchCheck,
)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->nonexistentOffsetInArrayDimFetchCheck = $nonexistentOffsetInArrayDimFetchCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Arrays/DuplicateKeysInLiteralArraysRule.php b/src/Rules/Arrays/DuplicateKeysInLiteralArraysRule.php
index 376e8de1b6..f3a856d3d2 100644
--- a/src/Rules/Arrays/DuplicateKeysInLiteralArraysRule.php
+++ b/src/Rules/Arrays/DuplicateKeysInLiteralArraysRule.php
@@ -21,13 +21,10 @@
class DuplicateKeysInLiteralArraysRule implements Rule
{
- private Standard $printer;
-
public function __construct(
- Standard $printer,
+ private Standard $printer,
)
{
- $this->printer = $printer;
}
public function getNodeType(): string
diff --git a/src/Rules/Arrays/InvalidKeyInArrayDimFetchRule.php b/src/Rules/Arrays/InvalidKeyInArrayDimFetchRule.php
index 7a7983a5d9..7e0d752e99 100644
--- a/src/Rules/Arrays/InvalidKeyInArrayDimFetchRule.php
+++ b/src/Rules/Arrays/InvalidKeyInArrayDimFetchRule.php
@@ -18,11 +18,8 @@
class InvalidKeyInArrayDimFetchRule implements Rule
{
- private bool $reportMaybes;
-
- public function __construct(bool $reportMaybes)
+ public function __construct(private bool $reportMaybes)
{
- $this->reportMaybes = $reportMaybes;
}
public function getNodeType(): string
diff --git a/src/Rules/Arrays/InvalidKeyInArrayItemRule.php b/src/Rules/Arrays/InvalidKeyInArrayItemRule.php
index d46f40490e..b692bbe15a 100644
--- a/src/Rules/Arrays/InvalidKeyInArrayItemRule.php
+++ b/src/Rules/Arrays/InvalidKeyInArrayItemRule.php
@@ -16,11 +16,8 @@
class InvalidKeyInArrayItemRule implements Rule
{
- private bool $reportMaybes;
-
- public function __construct(bool $reportMaybes)
+ public function __construct(private bool $reportMaybes)
{
- $this->reportMaybes = $reportMaybes;
}
public function getNodeType(): string
diff --git a/src/Rules/Arrays/IterableInForeachRule.php b/src/Rules/Arrays/IterableInForeachRule.php
index e8cf4ae5d0..f9e25225cc 100644
--- a/src/Rules/Arrays/IterableInForeachRule.php
+++ b/src/Rules/Arrays/IterableInForeachRule.php
@@ -18,11 +18,8 @@
class IterableInForeachRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- public function __construct(RuleLevelHelper $ruleLevelHelper)
+ public function __construct(private RuleLevelHelper $ruleLevelHelper)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php b/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php
index 6ccebc355c..ae4847e61e 100644
--- a/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php
+++ b/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchCheck.php
@@ -20,14 +20,8 @@
class NonexistentOffsetInArrayDimFetchCheck
{
- private RuleLevelHelper $ruleLevelHelper;
-
- private bool $reportMaybes;
-
- public function __construct(RuleLevelHelper $ruleLevelHelper, bool $reportMaybes)
+ public function __construct(private RuleLevelHelper $ruleLevelHelper, private bool $reportMaybes)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->reportMaybes = $reportMaybes;
}
/**
diff --git a/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchRule.php b/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchRule.php
index 6586885f2e..7a8a66490c 100644
--- a/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchRule.php
+++ b/src/Rules/Arrays/NonexistentOffsetInArrayDimFetchRule.php
@@ -20,21 +20,12 @@
class NonexistentOffsetInArrayDimFetchRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- private NonexistentOffsetInArrayDimFetchCheck $nonexistentOffsetInArrayDimFetchCheck;
-
- private bool $reportMaybes;
-
public function __construct(
- RuleLevelHelper $ruleLevelHelper,
- NonexistentOffsetInArrayDimFetchCheck $nonexistentOffsetInArrayDimFetchCheck,
- bool $reportMaybes,
+ private RuleLevelHelper $ruleLevelHelper,
+ private NonexistentOffsetInArrayDimFetchCheck $nonexistentOffsetInArrayDimFetchCheck,
+ private bool $reportMaybes,
)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->nonexistentOffsetInArrayDimFetchCheck = $nonexistentOffsetInArrayDimFetchCheck;
- $this->reportMaybes = $reportMaybes;
}
public function getNodeType(): string
diff --git a/src/Rules/Arrays/OffsetAccessAssignOpRule.php b/src/Rules/Arrays/OffsetAccessAssignOpRule.php
index 6576118342..46e3e1fb4e 100644
--- a/src/Rules/Arrays/OffsetAccessAssignOpRule.php
+++ b/src/Rules/Arrays/OffsetAccessAssignOpRule.php
@@ -20,11 +20,8 @@
class OffsetAccessAssignOpRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- public function __construct(RuleLevelHelper $ruleLevelHelper)
+ public function __construct(private RuleLevelHelper $ruleLevelHelper)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Arrays/OffsetAccessAssignmentRule.php b/src/Rules/Arrays/OffsetAccessAssignmentRule.php
index 099927c7aa..ec4ca4dc9c 100644
--- a/src/Rules/Arrays/OffsetAccessAssignmentRule.php
+++ b/src/Rules/Arrays/OffsetAccessAssignmentRule.php
@@ -20,11 +20,8 @@
class OffsetAccessAssignmentRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- public function __construct(RuleLevelHelper $ruleLevelHelper)
+ public function __construct(private RuleLevelHelper $ruleLevelHelper)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Arrays/OffsetAccessValueAssignmentRule.php b/src/Rules/Arrays/OffsetAccessValueAssignmentRule.php
index 3abdd777bf..47d58c87fa 100644
--- a/src/Rules/Arrays/OffsetAccessValueAssignmentRule.php
+++ b/src/Rules/Arrays/OffsetAccessValueAssignmentRule.php
@@ -22,11 +22,8 @@
class OffsetAccessValueAssignmentRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- public function __construct(RuleLevelHelper $ruleLevelHelper)
+ public function __construct(private RuleLevelHelper $ruleLevelHelper)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Arrays/UnpackIterableInArrayRule.php b/src/Rules/Arrays/UnpackIterableInArrayRule.php
index d1b3afdaca..08ba2b7e84 100644
--- a/src/Rules/Arrays/UnpackIterableInArrayRule.php
+++ b/src/Rules/Arrays/UnpackIterableInArrayRule.php
@@ -19,13 +19,10 @@
class UnpackIterableInArrayRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
public function __construct(
- RuleLevelHelper $ruleLevelHelper,
+ private RuleLevelHelper $ruleLevelHelper,
)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/AttributesCheck.php b/src/Rules/AttributesCheck.php
index 4081ec01d7..1349fe5c35 100644
--- a/src/Rules/AttributesCheck.php
+++ b/src/Rules/AttributesCheck.php
@@ -17,21 +17,12 @@
class AttributesCheck
{
- private ReflectionProvider $reflectionProvider;
-
- private FunctionCallParametersCheck $functionCallParametersCheck;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- FunctionCallParametersCheck $functionCallParametersCheck,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private ReflectionProvider $reflectionProvider,
+ private FunctionCallParametersCheck $functionCallParametersCheck,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->functionCallParametersCheck = $functionCallParametersCheck;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
}
/**
diff --git a/src/Rules/Cast/EchoRule.php b/src/Rules/Cast/EchoRule.php
index ca043fe03f..705dc48ebd 100644
--- a/src/Rules/Cast/EchoRule.php
+++ b/src/Rules/Cast/EchoRule.php
@@ -18,11 +18,8 @@
class EchoRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- public function __construct(RuleLevelHelper $ruleLevelHelper)
+ public function __construct(private RuleLevelHelper $ruleLevelHelper)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Cast/InvalidCastRule.php b/src/Rules/Cast/InvalidCastRule.php
index 059081f1bf..4179390523 100644
--- a/src/Rules/Cast/InvalidCastRule.php
+++ b/src/Rules/Cast/InvalidCastRule.php
@@ -22,17 +22,11 @@
class InvalidCastRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private RuleLevelHelper $ruleLevelHelper;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- RuleLevelHelper $ruleLevelHelper,
+ private ReflectionProvider $reflectionProvider,
+ private RuleLevelHelper $ruleLevelHelper,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Cast/InvalidPartOfEncapsedStringRule.php b/src/Rules/Cast/InvalidPartOfEncapsedStringRule.php
index 2b6231ad8f..293adeac5a 100644
--- a/src/Rules/Cast/InvalidPartOfEncapsedStringRule.php
+++ b/src/Rules/Cast/InvalidPartOfEncapsedStringRule.php
@@ -19,17 +19,11 @@
class InvalidPartOfEncapsedStringRule implements Rule
{
- private Standard $printer;
-
- private RuleLevelHelper $ruleLevelHelper;
-
public function __construct(
- Standard $printer,
- RuleLevelHelper $ruleLevelHelper,
+ private Standard $printer,
+ private RuleLevelHelper $ruleLevelHelper,
)
{
- $this->printer = $printer;
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Cast/PrintRule.php b/src/Rules/Cast/PrintRule.php
index 0a522d175e..e511f76ebf 100644
--- a/src/Rules/Cast/PrintRule.php
+++ b/src/Rules/Cast/PrintRule.php
@@ -18,11 +18,8 @@
class PrintRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- public function __construct(RuleLevelHelper $ruleLevelHelper)
+ public function __construct(private RuleLevelHelper $ruleLevelHelper)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Cast/UnsetCastRule.php b/src/Rules/Cast/UnsetCastRule.php
index c50aca654a..6260d9805b 100644
--- a/src/Rules/Cast/UnsetCastRule.php
+++ b/src/Rules/Cast/UnsetCastRule.php
@@ -14,11 +14,8 @@
class UnsetCastRule implements Rule
{
- private PhpVersion $phpVersion;
-
- public function __construct(PhpVersion $phpVersion)
+ public function __construct(private PhpVersion $phpVersion)
{
- $this->phpVersion = $phpVersion;
}
public function getNodeType(): string
diff --git a/src/Rules/ClassCaseSensitivityCheck.php b/src/Rules/ClassCaseSensitivityCheck.php
index 9ba16449bc..cb3f572609 100644
--- a/src/Rules/ClassCaseSensitivityCheck.php
+++ b/src/Rules/ClassCaseSensitivityCheck.php
@@ -10,14 +10,8 @@
class ClassCaseSensitivityCheck
{
- private ReflectionProvider $reflectionProvider;
-
- private bool $checkInternalClassCaseSensitivity;
-
- public function __construct(ReflectionProvider $reflectionProvider, bool $checkInternalClassCaseSensitivity)
+ public function __construct(private ReflectionProvider $reflectionProvider, private bool $checkInternalClassCaseSensitivity)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->checkInternalClassCaseSensitivity = $checkInternalClassCaseSensitivity;
}
/**
diff --git a/src/Rules/ClassNameNodePair.php b/src/Rules/ClassNameNodePair.php
index a92f539071..355fa61e01 100644
--- a/src/Rules/ClassNameNodePair.php
+++ b/src/Rules/ClassNameNodePair.php
@@ -7,14 +7,8 @@
class ClassNameNodePair
{
- private string $className;
-
- private Node $node;
-
- public function __construct(string $className, Node $node)
+ public function __construct(private string $className, private Node $node)
{
- $this->className = $className;
- $this->node = $node;
}
public function getClassName(): string
diff --git a/src/Rules/Classes/ClassAttributesRule.php b/src/Rules/Classes/ClassAttributesRule.php
index 517ba1ff23..21d6bda749 100644
--- a/src/Rules/Classes/ClassAttributesRule.php
+++ b/src/Rules/Classes/ClassAttributesRule.php
@@ -14,11 +14,8 @@
class ClassAttributesRule implements Rule
{
- private AttributesCheck $attributesCheck;
-
- public function __construct(AttributesCheck $attributesCheck)
+ public function __construct(private AttributesCheck $attributesCheck)
{
- $this->attributesCheck = $attributesCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/ClassConstantAttributesRule.php b/src/Rules/Classes/ClassConstantAttributesRule.php
index a18f82af55..d8256191a0 100644
--- a/src/Rules/Classes/ClassConstantAttributesRule.php
+++ b/src/Rules/Classes/ClassConstantAttributesRule.php
@@ -14,11 +14,8 @@
class ClassConstantAttributesRule implements Rule
{
- private AttributesCheck $attributesCheck;
-
- public function __construct(AttributesCheck $attributesCheck)
+ public function __construct(private AttributesCheck $attributesCheck)
{
- $this->attributesCheck = $attributesCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/ClassConstantRule.php b/src/Rules/Classes/ClassConstantRule.php
index b2beafab6a..98aba984e9 100644
--- a/src/Rules/Classes/ClassConstantRule.php
+++ b/src/Rules/Classes/ClassConstantRule.php
@@ -31,25 +31,13 @@
class ClassConstantRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private RuleLevelHelper $ruleLevelHelper;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private PhpVersion $phpVersion;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- RuleLevelHelper $ruleLevelHelper,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- PhpVersion $phpVersion,
+ private ReflectionProvider $reflectionProvider,
+ private RuleLevelHelper $ruleLevelHelper,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private PhpVersion $phpVersion,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->phpVersion = $phpVersion;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/ExistingClassInClassExtendsRule.php b/src/Rules/Classes/ExistingClassInClassExtendsRule.php
index 334edba03f..513c7efcd5 100644
--- a/src/Rules/Classes/ExistingClassInClassExtendsRule.php
+++ b/src/Rules/Classes/ExistingClassInClassExtendsRule.php
@@ -17,17 +17,11 @@
class ExistingClassInClassExtendsRule implements Rule
{
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/ExistingClassInInstanceOfRule.php b/src/Rules/Classes/ExistingClassInInstanceOfRule.php
index 69b1b2676e..775eadf450 100644
--- a/src/Rules/Classes/ExistingClassInInstanceOfRule.php
+++ b/src/Rules/Classes/ExistingClassInInstanceOfRule.php
@@ -20,21 +20,12 @@
class ExistingClassInInstanceOfRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private bool $checkClassCaseSensitivity;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- bool $checkClassCaseSensitivity,
+ private ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private bool $checkClassCaseSensitivity,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->checkClassCaseSensitivity = $checkClassCaseSensitivity;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/ExistingClassInTraitUseRule.php b/src/Rules/Classes/ExistingClassInTraitUseRule.php
index 1645a33a55..43e84d80aa 100644
--- a/src/Rules/Classes/ExistingClassInTraitUseRule.php
+++ b/src/Rules/Classes/ExistingClassInTraitUseRule.php
@@ -19,17 +19,11 @@
class ExistingClassInTraitUseRule implements Rule
{
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/ExistingClassesInClassImplementsRule.php b/src/Rules/Classes/ExistingClassesInClassImplementsRule.php
index 023ad3e7b5..fde6d21979 100644
--- a/src/Rules/Classes/ExistingClassesInClassImplementsRule.php
+++ b/src/Rules/Classes/ExistingClassesInClassImplementsRule.php
@@ -18,17 +18,11 @@
class ExistingClassesInClassImplementsRule implements Rule
{
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/ExistingClassesInEnumImplementsRule.php b/src/Rules/Classes/ExistingClassesInEnumImplementsRule.php
index a1a3e8d32d..81f6168eba 100644
--- a/src/Rules/Classes/ExistingClassesInEnumImplementsRule.php
+++ b/src/Rules/Classes/ExistingClassesInEnumImplementsRule.php
@@ -18,17 +18,11 @@
class ExistingClassesInEnumImplementsRule implements Rule
{
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/ExistingClassesInInterfaceExtendsRule.php b/src/Rules/Classes/ExistingClassesInInterfaceExtendsRule.php
index 5a59087464..f267550104 100644
--- a/src/Rules/Classes/ExistingClassesInInterfaceExtendsRule.php
+++ b/src/Rules/Classes/ExistingClassesInInterfaceExtendsRule.php
@@ -18,17 +18,11 @@
class ExistingClassesInInterfaceExtendsRule implements Rule
{
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/ImpossibleInstanceOfRule.php b/src/Rules/Classes/ImpossibleInstanceOfRule.php
index f88cfe380a..d047d4b2f5 100644
--- a/src/Rules/Classes/ImpossibleInstanceOfRule.php
+++ b/src/Rules/Classes/ImpossibleInstanceOfRule.php
@@ -20,17 +20,11 @@
class ImpossibleInstanceOfRule implements Rule
{
- private bool $checkAlwaysTrueInstanceof;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- bool $checkAlwaysTrueInstanceof,
- bool $treatPhpDocTypesAsCertain,
+ private bool $checkAlwaysTrueInstanceof,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->checkAlwaysTrueInstanceof = $checkAlwaysTrueInstanceof;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/InstantiationRule.php b/src/Rules/Classes/InstantiationRule.php
index 39c2f5fa3c..2200f7772d 100644
--- a/src/Rules/Classes/InstantiationRule.php
+++ b/src/Rules/Classes/InstantiationRule.php
@@ -31,21 +31,12 @@
class InstantiationRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private FunctionCallParametersCheck $check;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- FunctionCallParametersCheck $check,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private ReflectionProvider $reflectionProvider,
+ private FunctionCallParametersCheck $check,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->check = $check;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/InvalidPromotedPropertiesRule.php b/src/Rules/Classes/InvalidPromotedPropertiesRule.php
index ae2a0f801e..b81e387b60 100644
--- a/src/Rules/Classes/InvalidPromotedPropertiesRule.php
+++ b/src/Rules/Classes/InvalidPromotedPropertiesRule.php
@@ -17,11 +17,8 @@
class InvalidPromotedPropertiesRule implements Rule
{
- private PhpVersion $phpVersion;
-
- public function __construct(PhpVersion $phpVersion)
+ public function __construct(private PhpVersion $phpVersion)
{
- $this->phpVersion = $phpVersion;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/LocalTypeAliasesRule.php b/src/Rules/Classes/LocalTypeAliasesRule.php
index a8f8a6e11a..cdc76cdb61 100644
--- a/src/Rules/Classes/LocalTypeAliasesRule.php
+++ b/src/Rules/Classes/LocalTypeAliasesRule.php
@@ -27,25 +27,15 @@
class LocalTypeAliasesRule implements Rule
{
- /** @var array */
- private array $globalTypeAliases;
-
- private ReflectionProvider $reflectionProvider;
-
- private TypeNodeResolver $typeNodeResolver;
-
/**
* @param array $globalTypeAliases
*/
public function __construct(
- array $globalTypeAliases,
- ReflectionProvider $reflectionProvider,
- TypeNodeResolver $typeNodeResolver,
+ private array $globalTypeAliases,
+ private ReflectionProvider $reflectionProvider,
+ private TypeNodeResolver $typeNodeResolver,
)
{
- $this->globalTypeAliases = $globalTypeAliases;
- $this->reflectionProvider = $reflectionProvider;
- $this->typeNodeResolver = $typeNodeResolver;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/MixinRule.php b/src/Rules/Classes/MixinRule.php
index 2b82140e02..93d0f4bfc4 100644
--- a/src/Rules/Classes/MixinRule.php
+++ b/src/Rules/Classes/MixinRule.php
@@ -24,33 +24,15 @@
class MixinRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private GenericObjectTypeCheck $genericObjectTypeCheck;
-
- private MissingTypehintCheck $missingTypehintCheck;
-
- private UnresolvableTypeHelper $unresolvableTypeHelper;
-
- private bool $checkClassCaseSensitivity;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- GenericObjectTypeCheck $genericObjectTypeCheck,
- MissingTypehintCheck $missingTypehintCheck,
- UnresolvableTypeHelper $unresolvableTypeHelper,
- bool $checkClassCaseSensitivity,
+ private ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private GenericObjectTypeCheck $genericObjectTypeCheck,
+ private MissingTypehintCheck $missingTypehintCheck,
+ private UnresolvableTypeHelper $unresolvableTypeHelper,
+ private bool $checkClassCaseSensitivity,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->genericObjectTypeCheck = $genericObjectTypeCheck;
- $this->missingTypehintCheck = $missingTypehintCheck;
- $this->unresolvableTypeHelper = $unresolvableTypeHelper;
- $this->checkClassCaseSensitivity = $checkClassCaseSensitivity;
}
public function getNodeType(): string
diff --git a/src/Rules/Classes/UnusedConstructorParametersRule.php b/src/Rules/Classes/UnusedConstructorParametersRule.php
index cbb45ba15d..a6383e9f23 100644
--- a/src/Rules/Classes/UnusedConstructorParametersRule.php
+++ b/src/Rules/Classes/UnusedConstructorParametersRule.php
@@ -26,11 +26,8 @@
class UnusedConstructorParametersRule implements Rule
{
- private UnusedFunctionParametersCheck $check;
-
- public function __construct(UnusedFunctionParametersCheck $check)
+ public function __construct(private UnusedFunctionParametersCheck $check)
{
- $this->check = $check;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/BooleanAndConstantConditionRule.php b/src/Rules/Comparison/BooleanAndConstantConditionRule.php
index 2016aacfe3..1339155d9e 100644
--- a/src/Rules/Comparison/BooleanAndConstantConditionRule.php
+++ b/src/Rules/Comparison/BooleanAndConstantConditionRule.php
@@ -17,17 +17,11 @@
class BooleanAndConstantConditionRule implements Rule
{
- private ConstantConditionRuleHelper $helper;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ConstantConditionRuleHelper $helper,
- bool $treatPhpDocTypesAsCertain,
+ private ConstantConditionRuleHelper $helper,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->helper = $helper;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/BooleanNotConstantConditionRule.php b/src/Rules/Comparison/BooleanNotConstantConditionRule.php
index 690ed15422..9a8ca4ae24 100644
--- a/src/Rules/Comparison/BooleanNotConstantConditionRule.php
+++ b/src/Rules/Comparison/BooleanNotConstantConditionRule.php
@@ -15,17 +15,11 @@
class BooleanNotConstantConditionRule implements Rule
{
- private ConstantConditionRuleHelper $helper;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ConstantConditionRuleHelper $helper,
- bool $treatPhpDocTypesAsCertain,
+ private ConstantConditionRuleHelper $helper,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->helper = $helper;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/BooleanOrConstantConditionRule.php b/src/Rules/Comparison/BooleanOrConstantConditionRule.php
index 710e7066a2..4606b16ef2 100644
--- a/src/Rules/Comparison/BooleanOrConstantConditionRule.php
+++ b/src/Rules/Comparison/BooleanOrConstantConditionRule.php
@@ -17,17 +17,11 @@
class BooleanOrConstantConditionRule implements Rule
{
- private ConstantConditionRuleHelper $helper;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ConstantConditionRuleHelper $helper,
- bool $treatPhpDocTypesAsCertain,
+ private ConstantConditionRuleHelper $helper,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->helper = $helper;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/ConstantConditionRuleHelper.php b/src/Rules/Comparison/ConstantConditionRuleHelper.php
index a01928d355..32e75cd669 100644
--- a/src/Rules/Comparison/ConstantConditionRuleHelper.php
+++ b/src/Rules/Comparison/ConstantConditionRuleHelper.php
@@ -11,17 +11,11 @@
class ConstantConditionRuleHelper
{
- private ImpossibleCheckTypeHelper $impossibleCheckTypeHelper;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ImpossibleCheckTypeHelper $impossibleCheckTypeHelper,
- bool $treatPhpDocTypesAsCertain,
+ private ImpossibleCheckTypeHelper $impossibleCheckTypeHelper,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->impossibleCheckTypeHelper = $impossibleCheckTypeHelper;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function shouldReportAlwaysTrueByDefault(Expr $expr): bool
diff --git a/src/Rules/Comparison/DoWhileLoopConstantConditionRule.php b/src/Rules/Comparison/DoWhileLoopConstantConditionRule.php
index fdfd0a7dbb..9683f4c608 100644
--- a/src/Rules/Comparison/DoWhileLoopConstantConditionRule.php
+++ b/src/Rules/Comparison/DoWhileLoopConstantConditionRule.php
@@ -19,17 +19,11 @@
class DoWhileLoopConstantConditionRule implements Rule
{
- private ConstantConditionRuleHelper $helper;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ConstantConditionRuleHelper $helper,
- bool $treatPhpDocTypesAsCertain,
+ private ConstantConditionRuleHelper $helper,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->helper = $helper;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/ElseIfConstantConditionRule.php b/src/Rules/Comparison/ElseIfConstantConditionRule.php
index 0514fd170e..31df891540 100644
--- a/src/Rules/Comparison/ElseIfConstantConditionRule.php
+++ b/src/Rules/Comparison/ElseIfConstantConditionRule.php
@@ -15,17 +15,11 @@
class ElseIfConstantConditionRule implements Rule
{
- private ConstantConditionRuleHelper $helper;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ConstantConditionRuleHelper $helper,
- bool $treatPhpDocTypesAsCertain,
+ private ConstantConditionRuleHelper $helper,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->helper = $helper;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/IfConstantConditionRule.php b/src/Rules/Comparison/IfConstantConditionRule.php
index 1806f86e80..0de33d796b 100644
--- a/src/Rules/Comparison/IfConstantConditionRule.php
+++ b/src/Rules/Comparison/IfConstantConditionRule.php
@@ -15,17 +15,11 @@
class IfConstantConditionRule implements Rule
{
- private ConstantConditionRuleHelper $helper;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ConstantConditionRuleHelper $helper,
- bool $treatPhpDocTypesAsCertain,
+ private ConstantConditionRuleHelper $helper,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->helper = $helper;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/ImpossibleCheckTypeFunctionCallRule.php b/src/Rules/Comparison/ImpossibleCheckTypeFunctionCallRule.php
index 21dc8a2c78..e60656e751 100644
--- a/src/Rules/Comparison/ImpossibleCheckTypeFunctionCallRule.php
+++ b/src/Rules/Comparison/ImpossibleCheckTypeFunctionCallRule.php
@@ -15,21 +15,12 @@
class ImpossibleCheckTypeFunctionCallRule implements Rule
{
- private ImpossibleCheckTypeHelper $impossibleCheckTypeHelper;
-
- private bool $checkAlwaysTrueCheckTypeFunctionCall;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ImpossibleCheckTypeHelper $impossibleCheckTypeHelper,
- bool $checkAlwaysTrueCheckTypeFunctionCall,
- bool $treatPhpDocTypesAsCertain,
+ private ImpossibleCheckTypeHelper $impossibleCheckTypeHelper,
+ private bool $checkAlwaysTrueCheckTypeFunctionCall,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->impossibleCheckTypeHelper = $impossibleCheckTypeHelper;
- $this->checkAlwaysTrueCheckTypeFunctionCall = $checkAlwaysTrueCheckTypeFunctionCall;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/ImpossibleCheckTypeHelper.php b/src/Rules/Comparison/ImpossibleCheckTypeHelper.php
index 4c66277100..15e69dc664 100644
--- a/src/Rules/Comparison/ImpossibleCheckTypeHelper.php
+++ b/src/Rules/Comparison/ImpossibleCheckTypeHelper.php
@@ -36,29 +36,16 @@
class ImpossibleCheckTypeHelper
{
- private ReflectionProvider $reflectionProvider;
-
- private TypeSpecifier $typeSpecifier;
-
- /** @var string[] */
- private array $universalObjectCratesClasses;
-
- private bool $treatPhpDocTypesAsCertain;
-
/**
* @param string[] $universalObjectCratesClasses
*/
public function __construct(
- ReflectionProvider $reflectionProvider,
- TypeSpecifier $typeSpecifier,
- array $universalObjectCratesClasses,
- bool $treatPhpDocTypesAsCertain,
+ private ReflectionProvider $reflectionProvider,
+ private TypeSpecifier $typeSpecifier,
+ private array $universalObjectCratesClasses,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->typeSpecifier = $typeSpecifier;
- $this->universalObjectCratesClasses = $universalObjectCratesClasses;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function findSpecifiedType(
diff --git a/src/Rules/Comparison/ImpossibleCheckTypeMethodCallRule.php b/src/Rules/Comparison/ImpossibleCheckTypeMethodCallRule.php
index f9e52dc79c..6208b0eddf 100644
--- a/src/Rules/Comparison/ImpossibleCheckTypeMethodCallRule.php
+++ b/src/Rules/Comparison/ImpossibleCheckTypeMethodCallRule.php
@@ -17,21 +17,12 @@
class ImpossibleCheckTypeMethodCallRule implements Rule
{
- private ImpossibleCheckTypeHelper $impossibleCheckTypeHelper;
-
- private bool $checkAlwaysTrueCheckTypeFunctionCall;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ImpossibleCheckTypeHelper $impossibleCheckTypeHelper,
- bool $checkAlwaysTrueCheckTypeFunctionCall,
- bool $treatPhpDocTypesAsCertain,
+ private ImpossibleCheckTypeHelper $impossibleCheckTypeHelper,
+ private bool $checkAlwaysTrueCheckTypeFunctionCall,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->impossibleCheckTypeHelper = $impossibleCheckTypeHelper;
- $this->checkAlwaysTrueCheckTypeFunctionCall = $checkAlwaysTrueCheckTypeFunctionCall;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/ImpossibleCheckTypeStaticMethodCallRule.php b/src/Rules/Comparison/ImpossibleCheckTypeStaticMethodCallRule.php
index 1957f990cc..af7bd57afa 100644
--- a/src/Rules/Comparison/ImpossibleCheckTypeStaticMethodCallRule.php
+++ b/src/Rules/Comparison/ImpossibleCheckTypeStaticMethodCallRule.php
@@ -17,21 +17,12 @@
class ImpossibleCheckTypeStaticMethodCallRule implements Rule
{
- private ImpossibleCheckTypeHelper $impossibleCheckTypeHelper;
-
- private bool $checkAlwaysTrueCheckTypeFunctionCall;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ImpossibleCheckTypeHelper $impossibleCheckTypeHelper,
- bool $checkAlwaysTrueCheckTypeFunctionCall,
- bool $treatPhpDocTypesAsCertain,
+ private ImpossibleCheckTypeHelper $impossibleCheckTypeHelper,
+ private bool $checkAlwaysTrueCheckTypeFunctionCall,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->impossibleCheckTypeHelper = $impossibleCheckTypeHelper;
- $this->checkAlwaysTrueCheckTypeFunctionCall = $checkAlwaysTrueCheckTypeFunctionCall;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/MatchExpressionRule.php b/src/Rules/Comparison/MatchExpressionRule.php
index 15e6f15f21..6e89dde2b4 100644
--- a/src/Rules/Comparison/MatchExpressionRule.php
+++ b/src/Rules/Comparison/MatchExpressionRule.php
@@ -20,11 +20,8 @@
class MatchExpressionRule implements Rule
{
- private bool $checkAlwaysTrueStrictComparison;
-
- public function __construct(bool $checkAlwaysTrueStrictComparison)
+ public function __construct(private bool $checkAlwaysTrueStrictComparison)
{
- $this->checkAlwaysTrueStrictComparison = $checkAlwaysTrueStrictComparison;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/StrictComparisonOfDifferentTypesRule.php b/src/Rules/Comparison/StrictComparisonOfDifferentTypesRule.php
index 2131adde02..18200745a0 100644
--- a/src/Rules/Comparison/StrictComparisonOfDifferentTypesRule.php
+++ b/src/Rules/Comparison/StrictComparisonOfDifferentTypesRule.php
@@ -16,11 +16,8 @@
class StrictComparisonOfDifferentTypesRule implements Rule
{
- private bool $checkAlwaysTrueStrictComparison;
-
- public function __construct(bool $checkAlwaysTrueStrictComparison)
+ public function __construct(private bool $checkAlwaysTrueStrictComparison)
{
- $this->checkAlwaysTrueStrictComparison = $checkAlwaysTrueStrictComparison;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/TernaryOperatorConstantConditionRule.php b/src/Rules/Comparison/TernaryOperatorConstantConditionRule.php
index 9202f040ce..e608d7bfbd 100644
--- a/src/Rules/Comparison/TernaryOperatorConstantConditionRule.php
+++ b/src/Rules/Comparison/TernaryOperatorConstantConditionRule.php
@@ -15,17 +15,11 @@
class TernaryOperatorConstantConditionRule implements Rule
{
- private ConstantConditionRuleHelper $helper;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ConstantConditionRuleHelper $helper,
- bool $treatPhpDocTypesAsCertain,
+ private ConstantConditionRuleHelper $helper,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->helper = $helper;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/UnreachableIfBranchesRule.php b/src/Rules/Comparison/UnreachableIfBranchesRule.php
index 2912f8b7ed..ce9eb2328f 100644
--- a/src/Rules/Comparison/UnreachableIfBranchesRule.php
+++ b/src/Rules/Comparison/UnreachableIfBranchesRule.php
@@ -14,17 +14,11 @@
class UnreachableIfBranchesRule implements Rule
{
- private ConstantConditionRuleHelper $helper;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ConstantConditionRuleHelper $helper,
- bool $treatPhpDocTypesAsCertain,
+ private ConstantConditionRuleHelper $helper,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->helper = $helper;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/UnreachableTernaryElseBranchRule.php b/src/Rules/Comparison/UnreachableTernaryElseBranchRule.php
index 52daf996dc..551f0e63e9 100644
--- a/src/Rules/Comparison/UnreachableTernaryElseBranchRule.php
+++ b/src/Rules/Comparison/UnreachableTernaryElseBranchRule.php
@@ -14,17 +14,11 @@
class UnreachableTernaryElseBranchRule implements Rule
{
- private ConstantConditionRuleHelper $helper;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ConstantConditionRuleHelper $helper,
- bool $treatPhpDocTypesAsCertain,
+ private ConstantConditionRuleHelper $helper,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->helper = $helper;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/WhileLoopAlwaysFalseConditionRule.php b/src/Rules/Comparison/WhileLoopAlwaysFalseConditionRule.php
index 0efd6d5bc5..0c485c7329 100644
--- a/src/Rules/Comparison/WhileLoopAlwaysFalseConditionRule.php
+++ b/src/Rules/Comparison/WhileLoopAlwaysFalseConditionRule.php
@@ -15,17 +15,11 @@
class WhileLoopAlwaysFalseConditionRule implements Rule
{
- private ConstantConditionRuleHelper $helper;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ConstantConditionRuleHelper $helper,
- bool $treatPhpDocTypesAsCertain,
+ private ConstantConditionRuleHelper $helper,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->helper = $helper;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Comparison/WhileLoopAlwaysTrueConditionRule.php b/src/Rules/Comparison/WhileLoopAlwaysTrueConditionRule.php
index 13b3e17804..3723019229 100644
--- a/src/Rules/Comparison/WhileLoopAlwaysTrueConditionRule.php
+++ b/src/Rules/Comparison/WhileLoopAlwaysTrueConditionRule.php
@@ -18,17 +18,11 @@
class WhileLoopAlwaysTrueConditionRule implements Rule
{
- private ConstantConditionRuleHelper $helper;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- ConstantConditionRuleHelper $helper,
- bool $treatPhpDocTypesAsCertain,
+ private ConstantConditionRuleHelper $helper,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->helper = $helper;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
public function getNodeType(): string
diff --git a/src/Rules/Constants/FinalConstantRule.php b/src/Rules/Constants/FinalConstantRule.php
index ffbcc7d491..23fa67ab65 100644
--- a/src/Rules/Constants/FinalConstantRule.php
+++ b/src/Rules/Constants/FinalConstantRule.php
@@ -13,11 +13,8 @@
class FinalConstantRule implements Rule
{
- private PhpVersion $phpVersion;
-
- public function __construct(PhpVersion $phpVersion)
+ public function __construct(private PhpVersion $phpVersion)
{
- $this->phpVersion = $phpVersion;
}
public function getNodeType(): string
diff --git a/src/Rules/Constants/LazyAlwaysUsedClassConstantsExtensionProvider.php b/src/Rules/Constants/LazyAlwaysUsedClassConstantsExtensionProvider.php
index 80a5424321..895fb96360 100644
--- a/src/Rules/Constants/LazyAlwaysUsedClassConstantsExtensionProvider.php
+++ b/src/Rules/Constants/LazyAlwaysUsedClassConstantsExtensionProvider.php
@@ -7,14 +7,11 @@
class LazyAlwaysUsedClassConstantsExtensionProvider implements AlwaysUsedClassConstantsExtensionProvider
{
- private Container $container;
-
/** @var AlwaysUsedClassConstantsExtension[]|null */
private ?array $extensions = null;
- public function __construct(Container $container)
+ public function __construct(private Container $container)
{
- $this->container = $container;
}
public function getExtensions(): array
diff --git a/src/Rules/Constants/MissingClassConstantTypehintRule.php b/src/Rules/Constants/MissingClassConstantTypehintRule.php
index b184573b58..25f536e43b 100644
--- a/src/Rules/Constants/MissingClassConstantTypehintRule.php
+++ b/src/Rules/Constants/MissingClassConstantTypehintRule.php
@@ -21,11 +21,8 @@
final class MissingClassConstantTypehintRule implements Rule
{
- private MissingTypehintCheck $missingTypehintCheck;
-
- public function __construct(MissingTypehintCheck $missingTypehintCheck)
+ public function __construct(private MissingTypehintCheck $missingTypehintCheck)
{
- $this->missingTypehintCheck = $missingTypehintCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Constants/OverridingConstantRule.php b/src/Rules/Constants/OverridingConstantRule.php
index 4a089886ee..ca60d2c9b8 100644
--- a/src/Rules/Constants/OverridingConstantRule.php
+++ b/src/Rules/Constants/OverridingConstantRule.php
@@ -21,13 +21,10 @@
class OverridingConstantRule implements Rule
{
- private bool $checkPhpDocMethodSignatures;
-
public function __construct(
- bool $checkPhpDocMethodSignatures,
+ private bool $checkPhpDocMethodSignatures,
)
{
- $this->checkPhpDocMethodSignatures = $checkPhpDocMethodSignatures;
}
public function getNodeType(): string
diff --git a/src/Rules/DeadCode/NoopRule.php b/src/Rules/DeadCode/NoopRule.php
index 6f7e215643..a910a3276b 100644
--- a/src/Rules/DeadCode/NoopRule.php
+++ b/src/Rules/DeadCode/NoopRule.php
@@ -15,11 +15,8 @@
class NoopRule implements Rule
{
- private Standard $printer;
-
- public function __construct(Standard $printer)
+ public function __construct(private Standard $printer)
{
- $this->printer = $printer;
}
public function getNodeType(): string
diff --git a/src/Rules/DeadCode/UnusedPrivateConstantRule.php b/src/Rules/DeadCode/UnusedPrivateConstantRule.php
index d4a6310cb4..0a57d49bee 100644
--- a/src/Rules/DeadCode/UnusedPrivateConstantRule.php
+++ b/src/Rules/DeadCode/UnusedPrivateConstantRule.php
@@ -17,11 +17,8 @@
class UnusedPrivateConstantRule implements Rule
{
- private AlwaysUsedClassConstantsExtensionProvider $extensionProvider;
-
- public function __construct(AlwaysUsedClassConstantsExtensionProvider $extensionProvider)
+ public function __construct(private AlwaysUsedClassConstantsExtensionProvider $extensionProvider)
{
- $this->extensionProvider = $extensionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/DeadCode/UnusedPrivatePropertyRule.php b/src/Rules/DeadCode/UnusedPrivatePropertyRule.php
index c3202a778f..add56a0339 100644
--- a/src/Rules/DeadCode/UnusedPrivatePropertyRule.php
+++ b/src/Rules/DeadCode/UnusedPrivatePropertyRule.php
@@ -26,31 +26,17 @@
class UnusedPrivatePropertyRule implements Rule
{
- private ReadWritePropertiesExtensionProvider $extensionProvider;
-
- /** @var string[] */
- private array $alwaysWrittenTags;
-
- /** @var string[] */
- private array $alwaysReadTags;
-
- private bool $checkUninitializedProperties;
-
/**
* @param string[] $alwaysWrittenTags
* @param string[] $alwaysReadTags
*/
public function __construct(
- ReadWritePropertiesExtensionProvider $extensionProvider,
- array $alwaysWrittenTags,
- array $alwaysReadTags,
- bool $checkUninitializedProperties,
+ private ReadWritePropertiesExtensionProvider $extensionProvider,
+ private array $alwaysWrittenTags,
+ private array $alwaysReadTags,
+ private bool $checkUninitializedProperties,
)
{
- $this->extensionProvider = $extensionProvider;
- $this->alwaysWrittenTags = $alwaysWrittenTags;
- $this->alwaysReadTags = $alwaysReadTags;
- $this->checkUninitializedProperties = $checkUninitializedProperties;
}
public function getNodeType(): string
diff --git a/src/Rules/Debug/DumpTypeRule.php b/src/Rules/Debug/DumpTypeRule.php
index 417e6b5294..ceeeefa0e5 100644
--- a/src/Rules/Debug/DumpTypeRule.php
+++ b/src/Rules/Debug/DumpTypeRule.php
@@ -18,11 +18,8 @@
class DumpTypeRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Debug/FileAssertRule.php b/src/Rules/Debug/FileAssertRule.php
index 41af9ebc98..d8ebdbfa4a 100644
--- a/src/Rules/Debug/FileAssertRule.php
+++ b/src/Rules/Debug/FileAssertRule.php
@@ -22,11 +22,8 @@
class FileAssertRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/EnumCases/EnumCaseAttributesRule.php b/src/Rules/EnumCases/EnumCaseAttributesRule.php
index 3bcb5bc726..8d584b72f6 100644
--- a/src/Rules/EnumCases/EnumCaseAttributesRule.php
+++ b/src/Rules/EnumCases/EnumCaseAttributesRule.php
@@ -14,11 +14,8 @@
class EnumCaseAttributesRule implements Rule
{
- private AttributesCheck $attributesCheck;
-
- public function __construct(AttributesCheck $attributesCheck)
+ public function __construct(private AttributesCheck $attributesCheck)
{
- $this->attributesCheck = $attributesCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Exceptions/CaughtExceptionExistenceRule.php b/src/Rules/Exceptions/CaughtExceptionExistenceRule.php
index 91106d25dd..bbd4b6be44 100644
--- a/src/Rules/Exceptions/CaughtExceptionExistenceRule.php
+++ b/src/Rules/Exceptions/CaughtExceptionExistenceRule.php
@@ -20,21 +20,12 @@
class CaughtExceptionExistenceRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private bool $checkClassCaseSensitivity;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- bool $checkClassCaseSensitivity,
+ private ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private bool $checkClassCaseSensitivity,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->checkClassCaseSensitivity = $checkClassCaseSensitivity;
}
public function getNodeType(): string
diff --git a/src/Rules/Exceptions/DefaultExceptionTypeResolver.php b/src/Rules/Exceptions/DefaultExceptionTypeResolver.php
index 6cf35adaf3..8da4705142 100644
--- a/src/Rules/Exceptions/DefaultExceptionTypeResolver.php
+++ b/src/Rules/Exceptions/DefaultExceptionTypeResolver.php
@@ -10,20 +10,6 @@
class DefaultExceptionTypeResolver implements ExceptionTypeResolver
{
- private ReflectionProvider $reflectionProvider;
-
- /** @var string[] */
- private array $uncheckedExceptionRegexes;
-
- /** @var string[] */
- private array $uncheckedExceptionClasses;
-
- /** @var string[] */
- private array $checkedExceptionRegexes;
-
- /** @var string[] */
- private array $checkedExceptionClasses;
-
/**
* @param string[] $uncheckedExceptionRegexes
* @param string[] $uncheckedExceptionClasses
@@ -31,18 +17,13 @@ class DefaultExceptionTypeResolver implements ExceptionTypeResolver
* @param string[] $checkedExceptionClasses
*/
public function __construct(
- ReflectionProvider $reflectionProvider,
- array $uncheckedExceptionRegexes,
- array $uncheckedExceptionClasses,
- array $checkedExceptionRegexes,
- array $checkedExceptionClasses,
+ private ReflectionProvider $reflectionProvider,
+ private array $uncheckedExceptionRegexes,
+ private array $uncheckedExceptionClasses,
+ private array $checkedExceptionRegexes,
+ private array $checkedExceptionClasses,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->uncheckedExceptionRegexes = $uncheckedExceptionRegexes;
- $this->uncheckedExceptionClasses = $uncheckedExceptionClasses;
- $this->checkedExceptionRegexes = $checkedExceptionRegexes;
- $this->checkedExceptionClasses = $checkedExceptionClasses;
}
public function isCheckedException(string $className, Scope $scope): bool
diff --git a/src/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRule.php b/src/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRule.php
index 3770dd7c55..c41710b918 100644
--- a/src/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRule.php
+++ b/src/Rules/Exceptions/MissingCheckedExceptionInFunctionThrowsRule.php
@@ -17,11 +17,8 @@
class MissingCheckedExceptionInFunctionThrowsRule implements Rule
{
- private MissingCheckedExceptionInThrowsCheck $check;
-
- public function __construct(MissingCheckedExceptionInThrowsCheck $check)
+ public function __construct(private MissingCheckedExceptionInThrowsCheck $check)
{
- $this->check = $check;
}
public function getNodeType(): string
diff --git a/src/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRule.php b/src/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRule.php
index 20f9eab4b6..be58255d26 100644
--- a/src/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRule.php
+++ b/src/Rules/Exceptions/MissingCheckedExceptionInMethodThrowsRule.php
@@ -17,11 +17,8 @@
class MissingCheckedExceptionInMethodThrowsRule implements Rule
{
- private MissingCheckedExceptionInThrowsCheck $check;
-
- public function __construct(MissingCheckedExceptionInThrowsCheck $check)
+ public function __construct(private MissingCheckedExceptionInThrowsCheck $check)
{
- $this->check = $check;
}
public function getNodeType(): string
diff --git a/src/Rules/Exceptions/MissingCheckedExceptionInThrowsCheck.php b/src/Rules/Exceptions/MissingCheckedExceptionInThrowsCheck.php
index 3453c8f1c8..f3dfd9d0fb 100644
--- a/src/Rules/Exceptions/MissingCheckedExceptionInThrowsCheck.php
+++ b/src/Rules/Exceptions/MissingCheckedExceptionInThrowsCheck.php
@@ -17,11 +17,8 @@
class MissingCheckedExceptionInThrowsCheck
{
- private ExceptionTypeResolver $exceptionTypeResolver;
-
- public function __construct(ExceptionTypeResolver $exceptionTypeResolver)
+ public function __construct(private ExceptionTypeResolver $exceptionTypeResolver)
{
- $this->exceptionTypeResolver = $exceptionTypeResolver;
}
/**
diff --git a/src/Rules/Exceptions/ThrowExpressionRule.php b/src/Rules/Exceptions/ThrowExpressionRule.php
index fd8999066c..3cd3d68b5a 100644
--- a/src/Rules/Exceptions/ThrowExpressionRule.php
+++ b/src/Rules/Exceptions/ThrowExpressionRule.php
@@ -14,11 +14,8 @@
class ThrowExpressionRule implements Rule
{
- private PhpVersion $phpVersion;
-
- public function __construct(PhpVersion $phpVersion)
+ public function __construct(private PhpVersion $phpVersion)
{
- $this->phpVersion = $phpVersion;
}
public function getNodeType(): string
diff --git a/src/Rules/Exceptions/ThrowsVoidFunctionWithExplicitThrowPointRule.php b/src/Rules/Exceptions/ThrowsVoidFunctionWithExplicitThrowPointRule.php
index d39cba2e53..d0eed19fb9 100644
--- a/src/Rules/Exceptions/ThrowsVoidFunctionWithExplicitThrowPointRule.php
+++ b/src/Rules/Exceptions/ThrowsVoidFunctionWithExplicitThrowPointRule.php
@@ -21,17 +21,11 @@
class ThrowsVoidFunctionWithExplicitThrowPointRule implements Rule
{
- private ExceptionTypeResolver $exceptionTypeResolver;
-
- private bool $missingCheckedExceptionInThrows;
-
public function __construct(
- ExceptionTypeResolver $exceptionTypeResolver,
- bool $missingCheckedExceptionInThrows,
+ private ExceptionTypeResolver $exceptionTypeResolver,
+ private bool $missingCheckedExceptionInThrows,
)
{
- $this->exceptionTypeResolver = $exceptionTypeResolver;
- $this->missingCheckedExceptionInThrows = $missingCheckedExceptionInThrows;
}
public function getNodeType(): string
diff --git a/src/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRule.php b/src/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRule.php
index 15ec2d2b42..91c97d157b 100644
--- a/src/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRule.php
+++ b/src/Rules/Exceptions/ThrowsVoidMethodWithExplicitThrowPointRule.php
@@ -21,17 +21,11 @@
class ThrowsVoidMethodWithExplicitThrowPointRule implements Rule
{
- private ExceptionTypeResolver $exceptionTypeResolver;
-
- private bool $missingCheckedExceptionInThrows;
-
public function __construct(
- ExceptionTypeResolver $exceptionTypeResolver,
- bool $missingCheckedExceptionInThrows,
+ private ExceptionTypeResolver $exceptionTypeResolver,
+ private bool $missingCheckedExceptionInThrows,
)
{
- $this->exceptionTypeResolver = $exceptionTypeResolver;
- $this->missingCheckedExceptionInThrows = $missingCheckedExceptionInThrows;
}
public function getNodeType(): string
diff --git a/src/Rules/Exceptions/TooWideFunctionThrowTypeRule.php b/src/Rules/Exceptions/TooWideFunctionThrowTypeRule.php
index c452d29b8c..fff550cd41 100644
--- a/src/Rules/Exceptions/TooWideFunctionThrowTypeRule.php
+++ b/src/Rules/Exceptions/TooWideFunctionThrowTypeRule.php
@@ -17,11 +17,8 @@
class TooWideFunctionThrowTypeRule implements Rule
{
- private TooWideThrowTypeCheck $check;
-
- public function __construct(TooWideThrowTypeCheck $check)
+ public function __construct(private TooWideThrowTypeCheck $check)
{
- $this->check = $check;
}
public function getNodeType(): string
diff --git a/src/Rules/Exceptions/TooWideMethodThrowTypeRule.php b/src/Rules/Exceptions/TooWideMethodThrowTypeRule.php
index 3539890869..3a26b6843e 100644
--- a/src/Rules/Exceptions/TooWideMethodThrowTypeRule.php
+++ b/src/Rules/Exceptions/TooWideMethodThrowTypeRule.php
@@ -18,14 +18,8 @@
class TooWideMethodThrowTypeRule implements Rule
{
- private FileTypeMapper $fileTypeMapper;
-
- private TooWideThrowTypeCheck $check;
-
- public function __construct(FileTypeMapper $fileTypeMapper, TooWideThrowTypeCheck $check)
+ public function __construct(private FileTypeMapper $fileTypeMapper, private TooWideThrowTypeCheck $check)
{
- $this->fileTypeMapper = $fileTypeMapper;
- $this->check = $check;
}
public function getNodeType(): string
diff --git a/src/Rules/FoundTypeResult.php b/src/Rules/FoundTypeResult.php
index 75eaab35d4..919fe2adfd 100644
--- a/src/Rules/FoundTypeResult.php
+++ b/src/Rules/FoundTypeResult.php
@@ -8,31 +8,17 @@
class FoundTypeResult
{
- private Type $type;
-
- /** @var string[] */
- private array $referencedClasses;
-
- /** @var RuleError[] */
- private array $unknownClassErrors;
-
- private ?string $tip;
-
/**
* @param string[] $referencedClasses
* @param RuleError[] $unknownClassErrors
*/
public function __construct(
- Type $type,
- array $referencedClasses,
- array $unknownClassErrors,
- ?string $tip,
+ private Type $type,
+ private array $referencedClasses,
+ private array $unknownClassErrors,
+ private ?string $tip,
)
{
- $this->type = $type;
- $this->referencedClasses = $referencedClasses;
- $this->unknownClassErrors = $unknownClassErrors;
- $this->tip = $tip;
}
public function getType(): Type
diff --git a/src/Rules/FunctionCallParametersCheck.php b/src/Rules/FunctionCallParametersCheck.php
index 99f2d6c70f..939300fde3 100644
--- a/src/Rules/FunctionCallParametersCheck.php
+++ b/src/Rules/FunctionCallParametersCheck.php
@@ -28,41 +28,17 @@
class FunctionCallParametersCheck
{
- private RuleLevelHelper $ruleLevelHelper;
-
- private NullsafeCheck $nullsafeCheck;
-
- private PhpVersion $phpVersion;
-
- private UnresolvableTypeHelper $unresolvableTypeHelper;
-
- private bool $checkArgumentTypes;
-
- private bool $checkArgumentsPassedByReference;
-
- private bool $checkExtraArguments;
-
- private bool $checkMissingTypehints;
-
public function __construct(
- RuleLevelHelper $ruleLevelHelper,
- NullsafeCheck $nullsafeCheck,
- PhpVersion $phpVersion,
- UnresolvableTypeHelper $unresolvableTypeHelper,
- bool $checkArgumentTypes,
- bool $checkArgumentsPassedByReference,
- bool $checkExtraArguments,
- bool $checkMissingTypehints,
+ private RuleLevelHelper $ruleLevelHelper,
+ private NullsafeCheck $nullsafeCheck,
+ private PhpVersion $phpVersion,
+ private UnresolvableTypeHelper $unresolvableTypeHelper,
+ private bool $checkArgumentTypes,
+ private bool $checkArgumentsPassedByReference,
+ private bool $checkExtraArguments,
+ private bool $checkMissingTypehints,
)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->nullsafeCheck = $nullsafeCheck;
- $this->phpVersion = $phpVersion;
- $this->unresolvableTypeHelper = $unresolvableTypeHelper;
- $this->checkArgumentTypes = $checkArgumentTypes;
- $this->checkArgumentsPassedByReference = $checkArgumentsPassedByReference;
- $this->checkExtraArguments = $checkExtraArguments;
- $this->checkMissingTypehints = $checkMissingTypehints;
}
/**
diff --git a/src/Rules/FunctionDefinitionCheck.php b/src/Rules/FunctionDefinitionCheck.php
index 23872968c6..d311e8f353 100644
--- a/src/Rules/FunctionDefinitionCheck.php
+++ b/src/Rules/FunctionDefinitionCheck.php
@@ -39,33 +39,15 @@
class FunctionDefinitionCheck
{
- private ReflectionProvider $reflectionProvider;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private UnresolvableTypeHelper $unresolvableTypeHelper;
-
- private PhpVersion $phpVersion;
-
- private bool $checkClassCaseSensitivity;
-
- private bool $checkThisOnly;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- UnresolvableTypeHelper $unresolvableTypeHelper,
- PhpVersion $phpVersion,
- bool $checkClassCaseSensitivity,
- bool $checkThisOnly,
+ private ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private UnresolvableTypeHelper $unresolvableTypeHelper,
+ private PhpVersion $phpVersion,
+ private bool $checkClassCaseSensitivity,
+ private bool $checkThisOnly,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->unresolvableTypeHelper = $unresolvableTypeHelper;
- $this->phpVersion = $phpVersion;
- $this->checkClassCaseSensitivity = $checkClassCaseSensitivity;
- $this->checkThisOnly = $checkThisOnly;
}
/**
diff --git a/src/Rules/FunctionReturnTypeCheck.php b/src/Rules/FunctionReturnTypeCheck.php
index 8903d0c341..20995fbc97 100644
--- a/src/Rules/FunctionReturnTypeCheck.php
+++ b/src/Rules/FunctionReturnTypeCheck.php
@@ -17,11 +17,8 @@
class FunctionReturnTypeCheck
{
- private RuleLevelHelper $ruleLevelHelper;
-
- public function __construct(RuleLevelHelper $ruleLevelHelper)
+ public function __construct(private RuleLevelHelper $ruleLevelHelper)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
/**
diff --git a/src/Rules/Functions/ArrowFunctionAttributesRule.php b/src/Rules/Functions/ArrowFunctionAttributesRule.php
index 15c664cb4f..1b4e1ddf03 100644
--- a/src/Rules/Functions/ArrowFunctionAttributesRule.php
+++ b/src/Rules/Functions/ArrowFunctionAttributesRule.php
@@ -14,11 +14,8 @@
class ArrowFunctionAttributesRule implements Rule
{
- private AttributesCheck $attributesCheck;
-
- public function __construct(AttributesCheck $attributesCheck)
+ public function __construct(private AttributesCheck $attributesCheck)
{
- $this->attributesCheck = $attributesCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/ArrowFunctionReturnNullsafeByRefRule.php b/src/Rules/Functions/ArrowFunctionReturnNullsafeByRefRule.php
index 0dac5917a3..3606f67a71 100644
--- a/src/Rules/Functions/ArrowFunctionReturnNullsafeByRefRule.php
+++ b/src/Rules/Functions/ArrowFunctionReturnNullsafeByRefRule.php
@@ -14,11 +14,8 @@
class ArrowFunctionReturnNullsafeByRefRule implements Rule
{
- private NullsafeCheck $nullsafeCheck;
-
- public function __construct(NullsafeCheck $nullsafeCheck)
+ public function __construct(private NullsafeCheck $nullsafeCheck)
{
- $this->nullsafeCheck = $nullsafeCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/ArrowFunctionReturnTypeRule.php b/src/Rules/Functions/ArrowFunctionReturnTypeRule.php
index 1b578d68ba..86bd340d54 100644
--- a/src/Rules/Functions/ArrowFunctionReturnTypeRule.php
+++ b/src/Rules/Functions/ArrowFunctionReturnTypeRule.php
@@ -19,11 +19,8 @@
class ArrowFunctionReturnTypeRule implements Rule
{
- private FunctionReturnTypeCheck $returnTypeCheck;
-
- public function __construct(FunctionReturnTypeCheck $returnTypeCheck)
+ public function __construct(private FunctionReturnTypeCheck $returnTypeCheck)
{
- $this->returnTypeCheck = $returnTypeCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/CallCallablesRule.php b/src/Rules/Functions/CallCallablesRule.php
index 1b44a8a0db..0873fdc892 100644
--- a/src/Rules/Functions/CallCallablesRule.php
+++ b/src/Rules/Functions/CallCallablesRule.php
@@ -27,21 +27,12 @@
class CallCallablesRule implements Rule
{
- private FunctionCallParametersCheck $check;
-
- private RuleLevelHelper $ruleLevelHelper;
-
- private bool $reportMaybes;
-
public function __construct(
- FunctionCallParametersCheck $check,
- RuleLevelHelper $ruleLevelHelper,
- bool $reportMaybes,
+ private FunctionCallParametersCheck $check,
+ private RuleLevelHelper $ruleLevelHelper,
+ private bool $reportMaybes,
)
{
- $this->check = $check;
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->reportMaybes = $reportMaybes;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/CallToFunctionParametersRule.php b/src/Rules/Functions/CallToFunctionParametersRule.php
index 198bc52824..71dd7e06e2 100644
--- a/src/Rules/Functions/CallToFunctionParametersRule.php
+++ b/src/Rules/Functions/CallToFunctionParametersRule.php
@@ -17,14 +17,8 @@
class CallToFunctionParametersRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private FunctionCallParametersCheck $check;
-
- public function __construct(ReflectionProvider $reflectionProvider, FunctionCallParametersCheck $check)
+ public function __construct(private ReflectionProvider $reflectionProvider, private FunctionCallParametersCheck $check)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->check = $check;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRule.php b/src/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRule.php
index 0f45d8b7e7..32b0fb7d77 100644
--- a/src/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRule.php
+++ b/src/Rules/Functions/CallToFunctionStatementWithoutSideEffectsRule.php
@@ -18,11 +18,8 @@
class CallToFunctionStatementWithoutSideEffectsRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/CallToNonExistentFunctionRule.php b/src/Rules/Functions/CallToNonExistentFunctionRule.php
index e8ab225f9e..7fc4443838 100644
--- a/src/Rules/Functions/CallToNonExistentFunctionRule.php
+++ b/src/Rules/Functions/CallToNonExistentFunctionRule.php
@@ -17,17 +17,11 @@
class CallToNonExistentFunctionRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private bool $checkFunctionNameCase;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- bool $checkFunctionNameCase,
+ private ReflectionProvider $reflectionProvider,
+ private bool $checkFunctionNameCase,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->checkFunctionNameCase = $checkFunctionNameCase;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/ClosureAttributesRule.php b/src/Rules/Functions/ClosureAttributesRule.php
index 2344ad51a0..170d9ad05e 100644
--- a/src/Rules/Functions/ClosureAttributesRule.php
+++ b/src/Rules/Functions/ClosureAttributesRule.php
@@ -14,11 +14,8 @@
class ClosureAttributesRule implements Rule
{
- private AttributesCheck $attributesCheck;
-
- public function __construct(AttributesCheck $attributesCheck)
+ public function __construct(private AttributesCheck $attributesCheck)
{
- $this->attributesCheck = $attributesCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/ClosureReturnTypeRule.php b/src/Rules/Functions/ClosureReturnTypeRule.php
index 5f6c46d136..22603a10c7 100644
--- a/src/Rules/Functions/ClosureReturnTypeRule.php
+++ b/src/Rules/Functions/ClosureReturnTypeRule.php
@@ -17,11 +17,8 @@
class ClosureReturnTypeRule implements Rule
{
- private FunctionReturnTypeCheck $returnTypeCheck;
-
- public function __construct(FunctionReturnTypeCheck $returnTypeCheck)
+ public function __construct(private FunctionReturnTypeCheck $returnTypeCheck)
{
- $this->returnTypeCheck = $returnTypeCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/DefineParametersRule.php b/src/Rules/Functions/DefineParametersRule.php
index c5f87e3867..ec5a2590b3 100644
--- a/src/Rules/Functions/DefineParametersRule.php
+++ b/src/Rules/Functions/DefineParametersRule.php
@@ -17,11 +17,8 @@
class DefineParametersRule implements Rule
{
- private PhpVersion $phpVersion;
-
- public function __construct(PhpVersion $phpVersion)
+ public function __construct(private PhpVersion $phpVersion)
{
- $this->phpVersion = $phpVersion;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRule.php b/src/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRule.php
index 676b5d8f17..ecaf404573 100644
--- a/src/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRule.php
+++ b/src/Rules/Functions/ExistingClassesInArrowFunctionTypehintsRule.php
@@ -13,11 +13,8 @@
class ExistingClassesInArrowFunctionTypehintsRule implements Rule
{
- private FunctionDefinitionCheck $check;
-
- public function __construct(FunctionDefinitionCheck $check)
+ public function __construct(private FunctionDefinitionCheck $check)
{
- $this->check = $check;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/ExistingClassesInClosureTypehintsRule.php b/src/Rules/Functions/ExistingClassesInClosureTypehintsRule.php
index 0b10b429fd..2c6dbd3ad0 100644
--- a/src/Rules/Functions/ExistingClassesInClosureTypehintsRule.php
+++ b/src/Rules/Functions/ExistingClassesInClosureTypehintsRule.php
@@ -14,11 +14,8 @@
class ExistingClassesInClosureTypehintsRule implements Rule
{
- private FunctionDefinitionCheck $check;
-
- public function __construct(FunctionDefinitionCheck $check)
+ public function __construct(private FunctionDefinitionCheck $check)
{
- $this->check = $check;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/ExistingClassesInTypehintsRule.php b/src/Rules/Functions/ExistingClassesInTypehintsRule.php
index 153c15ba60..4314e6f69d 100644
--- a/src/Rules/Functions/ExistingClassesInTypehintsRule.php
+++ b/src/Rules/Functions/ExistingClassesInTypehintsRule.php
@@ -17,11 +17,8 @@
class ExistingClassesInTypehintsRule implements Rule
{
- private FunctionDefinitionCheck $check;
-
- public function __construct(FunctionDefinitionCheck $check)
+ public function __construct(private FunctionDefinitionCheck $check)
{
- $this->check = $check;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/FunctionAttributesRule.php b/src/Rules/Functions/FunctionAttributesRule.php
index aab8840024..2ccf122ac2 100644
--- a/src/Rules/Functions/FunctionAttributesRule.php
+++ b/src/Rules/Functions/FunctionAttributesRule.php
@@ -14,11 +14,8 @@
class FunctionAttributesRule implements Rule
{
- private AttributesCheck $attributesCheck;
-
- public function __construct(AttributesCheck $attributesCheck)
+ public function __construct(private AttributesCheck $attributesCheck)
{
- $this->attributesCheck = $attributesCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/FunctionCallableRule.php b/src/Rules/Functions/FunctionCallableRule.php
index 265f3cdff2..5905fc6dec 100644
--- a/src/Rules/Functions/FunctionCallableRule.php
+++ b/src/Rules/Functions/FunctionCallableRule.php
@@ -23,23 +23,8 @@
class FunctionCallableRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private RuleLevelHelper $ruleLevelHelper;
-
- private PhpVersion $phpVersion;
-
- private bool $checkFunctionNameCase;
-
- private bool $reportMaybes;
-
- public function __construct(ReflectionProvider $reflectionProvider, RuleLevelHelper $ruleLevelHelper, PhpVersion $phpVersion, bool $checkFunctionNameCase, bool $reportMaybes)
+ public function __construct(private ReflectionProvider $reflectionProvider, private RuleLevelHelper $ruleLevelHelper, private PhpVersion $phpVersion, private bool $checkFunctionNameCase, private bool $reportMaybes)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->phpVersion = $phpVersion;
- $this->checkFunctionNameCase = $checkFunctionNameCase;
- $this->reportMaybes = $reportMaybes;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/ImplodeFunctionRule.php b/src/Rules/Functions/ImplodeFunctionRule.php
index b7a0b260d5..3d75e6d789 100644
--- a/src/Rules/Functions/ImplodeFunctionRule.php
+++ b/src/Rules/Functions/ImplodeFunctionRule.php
@@ -22,17 +22,11 @@
class ImplodeFunctionRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- RuleLevelHelper $ruleLevelHelper,
+ private ReflectionProvider $reflectionProvider,
+ private RuleLevelHelper $ruleLevelHelper,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/MissingFunctionParameterTypehintRule.php b/src/Rules/Functions/MissingFunctionParameterTypehintRule.php
index c9001fa66f..0a02fbaca7 100644
--- a/src/Rules/Functions/MissingFunctionParameterTypehintRule.php
+++ b/src/Rules/Functions/MissingFunctionParameterTypehintRule.php
@@ -24,13 +24,10 @@
final class MissingFunctionParameterTypehintRule implements Rule
{
- private MissingTypehintCheck $missingTypehintCheck;
-
public function __construct(
- MissingTypehintCheck $missingTypehintCheck,
+ private MissingTypehintCheck $missingTypehintCheck,
)
{
- $this->missingTypehintCheck = $missingTypehintCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/MissingFunctionReturnTypehintRule.php b/src/Rules/Functions/MissingFunctionReturnTypehintRule.php
index d9619d62f6..7166ebad1a 100644
--- a/src/Rules/Functions/MissingFunctionReturnTypehintRule.php
+++ b/src/Rules/Functions/MissingFunctionReturnTypehintRule.php
@@ -21,13 +21,10 @@
final class MissingFunctionReturnTypehintRule implements Rule
{
- private MissingTypehintCheck $missingTypehintCheck;
-
public function __construct(
- MissingTypehintCheck $missingTypehintCheck,
+ private MissingTypehintCheck $missingTypehintCheck,
)
{
- $this->missingTypehintCheck = $missingTypehintCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/ParamAttributesRule.php b/src/Rules/Functions/ParamAttributesRule.php
index 675898bc59..aeadb1cfb6 100644
--- a/src/Rules/Functions/ParamAttributesRule.php
+++ b/src/Rules/Functions/ParamAttributesRule.php
@@ -15,11 +15,8 @@
class ParamAttributesRule implements Rule
{
- private AttributesCheck $attributesCheck;
-
- public function __construct(AttributesCheck $attributesCheck)
+ public function __construct(private AttributesCheck $attributesCheck)
{
- $this->attributesCheck = $attributesCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/PrintfParametersRule.php b/src/Rules/Functions/PrintfParametersRule.php
index 1bc73c5305..b6f0552b65 100644
--- a/src/Rules/Functions/PrintfParametersRule.php
+++ b/src/Rules/Functions/PrintfParametersRule.php
@@ -25,11 +25,8 @@
class PrintfParametersRule implements Rule
{
- private PhpVersion $phpVersion;
-
- public function __construct(PhpVersion $phpVersion)
+ public function __construct(private PhpVersion $phpVersion)
{
- $this->phpVersion = $phpVersion;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/RandomIntParametersRule.php b/src/Rules/Functions/RandomIntParametersRule.php
index 23aa0f4916..4d68569d7c 100644
--- a/src/Rules/Functions/RandomIntParametersRule.php
+++ b/src/Rules/Functions/RandomIntParametersRule.php
@@ -19,14 +19,8 @@
class RandomIntParametersRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private bool $reportMaybes;
-
- public function __construct(ReflectionProvider $reflectionProvider, bool $reportMaybes)
+ public function __construct(private ReflectionProvider $reflectionProvider, private bool $reportMaybes)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->reportMaybes = $reportMaybes;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/ReturnNullsafeByRefRule.php b/src/Rules/Functions/ReturnNullsafeByRefRule.php
index a232103ca1..d842cf4584 100644
--- a/src/Rules/Functions/ReturnNullsafeByRefRule.php
+++ b/src/Rules/Functions/ReturnNullsafeByRefRule.php
@@ -15,11 +15,8 @@
class ReturnNullsafeByRefRule implements Rule
{
- private NullsafeCheck $nullsafeCheck;
-
- public function __construct(NullsafeCheck $nullsafeCheck)
+ public function __construct(private NullsafeCheck $nullsafeCheck)
{
- $this->nullsafeCheck = $nullsafeCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/ReturnTypeRule.php b/src/Rules/Functions/ReturnTypeRule.php
index d190fc0285..ab9897713b 100644
--- a/src/Rules/Functions/ReturnTypeRule.php
+++ b/src/Rules/Functions/ReturnTypeRule.php
@@ -18,13 +18,10 @@
class ReturnTypeRule implements Rule
{
- private FunctionReturnTypeCheck $returnTypeCheck;
-
public function __construct(
- FunctionReturnTypeCheck $returnTypeCheck,
+ private FunctionReturnTypeCheck $returnTypeCheck,
)
{
- $this->returnTypeCheck = $returnTypeCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Functions/UnusedClosureUsesRule.php b/src/Rules/Functions/UnusedClosureUsesRule.php
index c3c5544323..79b7268c9b 100644
--- a/src/Rules/Functions/UnusedClosureUsesRule.php
+++ b/src/Rules/Functions/UnusedClosureUsesRule.php
@@ -17,11 +17,8 @@
class UnusedClosureUsesRule implements Rule
{
- private UnusedFunctionParametersCheck $check;
-
- public function __construct(UnusedFunctionParametersCheck $check)
+ public function __construct(private UnusedFunctionParametersCheck $check)
{
- $this->check = $check;
}
public function getNodeType(): string
diff --git a/src/Rules/Generators/YieldFromTypeRule.php b/src/Rules/Generators/YieldFromTypeRule.php
index 83a0b9c67b..8926b3f270 100644
--- a/src/Rules/Generators/YieldFromTypeRule.php
+++ b/src/Rules/Generators/YieldFromTypeRule.php
@@ -23,17 +23,11 @@
class YieldFromTypeRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- private bool $reportMaybes;
-
public function __construct(
- RuleLevelHelper $ruleLevelHelper,
- bool $reportMaybes,
+ private RuleLevelHelper $ruleLevelHelper,
+ private bool $reportMaybes,
)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->reportMaybes = $reportMaybes;
}
public function getNodeType(): string
diff --git a/src/Rules/Generators/YieldInGeneratorRule.php b/src/Rules/Generators/YieldInGeneratorRule.php
index 9a35701349..230853ca38 100644
--- a/src/Rules/Generators/YieldInGeneratorRule.php
+++ b/src/Rules/Generators/YieldInGeneratorRule.php
@@ -18,11 +18,8 @@
class YieldInGeneratorRule implements Rule
{
- private bool $reportMaybes;
-
- public function __construct(bool $reportMaybes)
+ public function __construct(private bool $reportMaybes)
{
- $this->reportMaybes = $reportMaybes;
}
public function getNodeType(): string
diff --git a/src/Rules/Generators/YieldTypeRule.php b/src/Rules/Generators/YieldTypeRule.php
index 4d34147073..c5678f8a66 100644
--- a/src/Rules/Generators/YieldTypeRule.php
+++ b/src/Rules/Generators/YieldTypeRule.php
@@ -21,13 +21,10 @@
class YieldTypeRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
public function __construct(
- RuleLevelHelper $ruleLevelHelper,
+ private RuleLevelHelper $ruleLevelHelper,
)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Generics/ClassAncestorsRule.php b/src/Rules/Generics/ClassAncestorsRule.php
index d64347ed27..4c77d8899a 100644
--- a/src/Rules/Generics/ClassAncestorsRule.php
+++ b/src/Rules/Generics/ClassAncestorsRule.php
@@ -20,17 +20,11 @@
class ClassAncestorsRule implements Rule
{
- private GenericAncestorsCheck $genericAncestorsCheck;
-
- private CrossCheckInterfacesHelper $crossCheckInterfacesHelper;
-
public function __construct(
- GenericAncestorsCheck $genericAncestorsCheck,
- CrossCheckInterfacesHelper $crossCheckInterfacesHelper,
+ private GenericAncestorsCheck $genericAncestorsCheck,
+ private CrossCheckInterfacesHelper $crossCheckInterfacesHelper,
)
{
- $this->genericAncestorsCheck = $genericAncestorsCheck;
- $this->crossCheckInterfacesHelper = $crossCheckInterfacesHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Generics/ClassTemplateTypeRule.php b/src/Rules/Generics/ClassTemplateTypeRule.php
index 02f4726ecc..5e24afd305 100644
--- a/src/Rules/Generics/ClassTemplateTypeRule.php
+++ b/src/Rules/Generics/ClassTemplateTypeRule.php
@@ -16,13 +16,10 @@
class ClassTemplateTypeRule implements Rule
{
- private TemplateTypeCheck $templateTypeCheck;
-
public function __construct(
- TemplateTypeCheck $templateTypeCheck,
+ private TemplateTypeCheck $templateTypeCheck,
)
{
- $this->templateTypeCheck = $templateTypeCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Generics/EnumAncestorsRule.php b/src/Rules/Generics/EnumAncestorsRule.php
index 20473e97b8..63219efb22 100644
--- a/src/Rules/Generics/EnumAncestorsRule.php
+++ b/src/Rules/Generics/EnumAncestorsRule.php
@@ -20,17 +20,11 @@
class EnumAncestorsRule implements Rule
{
- private GenericAncestorsCheck $genericAncestorsCheck;
-
- private CrossCheckInterfacesHelper $crossCheckInterfacesHelper;
-
public function __construct(
- GenericAncestorsCheck $genericAncestorsCheck,
- CrossCheckInterfacesHelper $crossCheckInterfacesHelper,
+ private GenericAncestorsCheck $genericAncestorsCheck,
+ private CrossCheckInterfacesHelper $crossCheckInterfacesHelper,
)
{
- $this->genericAncestorsCheck = $genericAncestorsCheck;
- $this->crossCheckInterfacesHelper = $crossCheckInterfacesHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Generics/FunctionSignatureVarianceRule.php b/src/Rules/Generics/FunctionSignatureVarianceRule.php
index b5070ef342..9b75ab2f57 100644
--- a/src/Rules/Generics/FunctionSignatureVarianceRule.php
+++ b/src/Rules/Generics/FunctionSignatureVarianceRule.php
@@ -16,11 +16,8 @@
class FunctionSignatureVarianceRule implements Rule
{
- private VarianceCheck $varianceCheck;
-
- public function __construct(VarianceCheck $varianceCheck)
+ public function __construct(private VarianceCheck $varianceCheck)
{
- $this->varianceCheck = $varianceCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Generics/FunctionTemplateTypeRule.php b/src/Rules/Generics/FunctionTemplateTypeRule.php
index 1a694abdee..5353d0a9cf 100644
--- a/src/Rules/Generics/FunctionTemplateTypeRule.php
+++ b/src/Rules/Generics/FunctionTemplateTypeRule.php
@@ -17,17 +17,11 @@
class FunctionTemplateTypeRule implements Rule
{
- private FileTypeMapper $fileTypeMapper;
-
- private TemplateTypeCheck $templateTypeCheck;
-
public function __construct(
- FileTypeMapper $fileTypeMapper,
- TemplateTypeCheck $templateTypeCheck,
+ private FileTypeMapper $fileTypeMapper,
+ private TemplateTypeCheck $templateTypeCheck,
)
{
- $this->fileTypeMapper = $fileTypeMapper;
- $this->templateTypeCheck = $templateTypeCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Generics/GenericAncestorsCheck.php b/src/Rules/Generics/GenericAncestorsCheck.php
index 535e5ffcfe..4210bf7e29 100644
--- a/src/Rules/Generics/GenericAncestorsCheck.php
+++ b/src/Rules/Generics/GenericAncestorsCheck.php
@@ -24,33 +24,17 @@
class GenericAncestorsCheck
{
- private ReflectionProvider $reflectionProvider;
-
- private GenericObjectTypeCheck $genericObjectTypeCheck;
-
- private VarianceCheck $varianceCheck;
-
- private bool $checkGenericClassInNonGenericObjectType;
-
- /** @var string[] */
- private array $skipCheckGenericClasses;
-
/**
* @param string[] $skipCheckGenericClasses
*/
public function __construct(
- ReflectionProvider $reflectionProvider,
- GenericObjectTypeCheck $genericObjectTypeCheck,
- VarianceCheck $varianceCheck,
- bool $checkGenericClassInNonGenericObjectType,
- array $skipCheckGenericClasses,
+ private ReflectionProvider $reflectionProvider,
+ private GenericObjectTypeCheck $genericObjectTypeCheck,
+ private VarianceCheck $varianceCheck,
+ private bool $checkGenericClassInNonGenericObjectType,
+ private array $skipCheckGenericClasses,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->genericObjectTypeCheck = $genericObjectTypeCheck;
- $this->varianceCheck = $varianceCheck;
- $this->checkGenericClassInNonGenericObjectType = $checkGenericClassInNonGenericObjectType;
- $this->skipCheckGenericClasses = $skipCheckGenericClasses;
}
/**
diff --git a/src/Rules/Generics/InterfaceAncestorsRule.php b/src/Rules/Generics/InterfaceAncestorsRule.php
index a8ec30f607..bb207f5ae6 100644
--- a/src/Rules/Generics/InterfaceAncestorsRule.php
+++ b/src/Rules/Generics/InterfaceAncestorsRule.php
@@ -20,17 +20,11 @@
class InterfaceAncestorsRule implements Rule
{
- private GenericAncestorsCheck $genericAncestorsCheck;
-
- private CrossCheckInterfacesHelper $crossCheckInterfacesHelper;
-
public function __construct(
- GenericAncestorsCheck $genericAncestorsCheck,
- CrossCheckInterfacesHelper $crossCheckInterfacesHelper,
+ private GenericAncestorsCheck $genericAncestorsCheck,
+ private CrossCheckInterfacesHelper $crossCheckInterfacesHelper,
)
{
- $this->genericAncestorsCheck = $genericAncestorsCheck;
- $this->crossCheckInterfacesHelper = $crossCheckInterfacesHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Generics/InterfaceTemplateTypeRule.php b/src/Rules/Generics/InterfaceTemplateTypeRule.php
index 359f851214..dd9198e96b 100644
--- a/src/Rules/Generics/InterfaceTemplateTypeRule.php
+++ b/src/Rules/Generics/InterfaceTemplateTypeRule.php
@@ -16,13 +16,10 @@
class InterfaceTemplateTypeRule implements Rule
{
- private TemplateTypeCheck $templateTypeCheck;
-
public function __construct(
- TemplateTypeCheck $templateTypeCheck,
+ private TemplateTypeCheck $templateTypeCheck,
)
{
- $this->templateTypeCheck = $templateTypeCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Generics/MethodSignatureVarianceRule.php b/src/Rules/Generics/MethodSignatureVarianceRule.php
index 334b4ecc61..b2207734d9 100644
--- a/src/Rules/Generics/MethodSignatureVarianceRule.php
+++ b/src/Rules/Generics/MethodSignatureVarianceRule.php
@@ -17,11 +17,8 @@
class MethodSignatureVarianceRule implements Rule
{
- private VarianceCheck $varianceCheck;
-
- public function __construct(VarianceCheck $varianceCheck)
+ public function __construct(private VarianceCheck $varianceCheck)
{
- $this->varianceCheck = $varianceCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Generics/MethodTemplateTypeRule.php b/src/Rules/Generics/MethodTemplateTypeRule.php
index 1f231ce510..7f51d9e0d5 100644
--- a/src/Rules/Generics/MethodTemplateTypeRule.php
+++ b/src/Rules/Generics/MethodTemplateTypeRule.php
@@ -20,17 +20,11 @@
class MethodTemplateTypeRule implements Rule
{
- private FileTypeMapper $fileTypeMapper;
-
- private TemplateTypeCheck $templateTypeCheck;
-
public function __construct(
- FileTypeMapper $fileTypeMapper,
- TemplateTypeCheck $templateTypeCheck,
+ private FileTypeMapper $fileTypeMapper,
+ private TemplateTypeCheck $templateTypeCheck,
)
{
- $this->fileTypeMapper = $fileTypeMapper;
- $this->templateTypeCheck = $templateTypeCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Generics/TemplateTypeCheck.php b/src/Rules/Generics/TemplateTypeCheck.php
index 623ce560f7..838b4a95e1 100644
--- a/src/Rules/Generics/TemplateTypeCheck.php
+++ b/src/Rules/Generics/TemplateTypeCheck.php
@@ -35,29 +35,14 @@
class TemplateTypeCheck
{
- private ReflectionProvider $reflectionProvider;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private GenericObjectTypeCheck $genericObjectTypeCheck;
-
- private TypeAliasResolver $typeAliasResolver;
-
- private bool $checkClassCaseSensitivity;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- GenericObjectTypeCheck $genericObjectTypeCheck,
- TypeAliasResolver $typeAliasResolver,
- bool $checkClassCaseSensitivity,
+ private ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private GenericObjectTypeCheck $genericObjectTypeCheck,
+ private TypeAliasResolver $typeAliasResolver,
+ private bool $checkClassCaseSensitivity,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->genericObjectTypeCheck = $genericObjectTypeCheck;
- $this->typeAliasResolver = $typeAliasResolver;
- $this->checkClassCaseSensitivity = $checkClassCaseSensitivity;
}
/**
diff --git a/src/Rules/Generics/TraitTemplateTypeRule.php b/src/Rules/Generics/TraitTemplateTypeRule.php
index db455f80e6..5294ae9eaa 100644
--- a/src/Rules/Generics/TraitTemplateTypeRule.php
+++ b/src/Rules/Generics/TraitTemplateTypeRule.php
@@ -17,17 +17,11 @@
class TraitTemplateTypeRule implements Rule
{
- private FileTypeMapper $fileTypeMapper;
-
- private TemplateTypeCheck $templateTypeCheck;
-
public function __construct(
- FileTypeMapper $fileTypeMapper,
- TemplateTypeCheck $templateTypeCheck,
+ private FileTypeMapper $fileTypeMapper,
+ private TemplateTypeCheck $templateTypeCheck,
)
{
- $this->fileTypeMapper = $fileTypeMapper;
- $this->templateTypeCheck = $templateTypeCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Generics/UsedTraitsRule.php b/src/Rules/Generics/UsedTraitsRule.php
index 39cf7bb2d7..fa8ec17a47 100644
--- a/src/Rules/Generics/UsedTraitsRule.php
+++ b/src/Rules/Generics/UsedTraitsRule.php
@@ -20,17 +20,11 @@
class UsedTraitsRule implements Rule
{
- private FileTypeMapper $fileTypeMapper;
-
- private GenericAncestorsCheck $genericAncestorsCheck;
-
public function __construct(
- FileTypeMapper $fileTypeMapper,
- GenericAncestorsCheck $genericAncestorsCheck,
+ private FileTypeMapper $fileTypeMapper,
+ private GenericAncestorsCheck $genericAncestorsCheck,
)
{
- $this->fileTypeMapper = $fileTypeMapper;
- $this->genericAncestorsCheck = $genericAncestorsCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/IssetCheck.php b/src/Rules/IssetCheck.php
index f8738c18af..13edd168c2 100644
--- a/src/Rules/IssetCheck.php
+++ b/src/Rules/IssetCheck.php
@@ -16,25 +16,13 @@
class IssetCheck
{
- private PropertyDescriptor $propertyDescriptor;
-
- private PropertyReflectionFinder $propertyReflectionFinder;
-
- private bool $checkAdvancedIsset;
-
- private bool $treatPhpDocTypesAsCertain;
-
public function __construct(
- PropertyDescriptor $propertyDescriptor,
- PropertyReflectionFinder $propertyReflectionFinder,
- bool $checkAdvancedIsset,
- bool $treatPhpDocTypesAsCertain,
+ private PropertyDescriptor $propertyDescriptor,
+ private PropertyReflectionFinder $propertyReflectionFinder,
+ private bool $checkAdvancedIsset,
+ private bool $treatPhpDocTypesAsCertain,
)
{
- $this->propertyDescriptor = $propertyDescriptor;
- $this->propertyReflectionFinder = $propertyReflectionFinder;
- $this->checkAdvancedIsset = $checkAdvancedIsset;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
}
/**
diff --git a/src/Rules/Methods/CallMethodsRule.php b/src/Rules/Methods/CallMethodsRule.php
index eb55d437a0..38b3769cd4 100644
--- a/src/Rules/Methods/CallMethodsRule.php
+++ b/src/Rules/Methods/CallMethodsRule.php
@@ -17,17 +17,11 @@
class CallMethodsRule implements Rule
{
- private MethodCallCheck $methodCallCheck;
-
- private FunctionCallParametersCheck $parametersCheck;
-
public function __construct(
- MethodCallCheck $methodCallCheck,
- FunctionCallParametersCheck $parametersCheck,
+ private MethodCallCheck $methodCallCheck,
+ private FunctionCallParametersCheck $parametersCheck,
)
{
- $this->methodCallCheck = $methodCallCheck;
- $this->parametersCheck = $parametersCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/CallStaticMethodsRule.php b/src/Rules/Methods/CallStaticMethodsRule.php
index 77716f91f3..c53822e7a2 100644
--- a/src/Rules/Methods/CallStaticMethodsRule.php
+++ b/src/Rules/Methods/CallStaticMethodsRule.php
@@ -18,17 +18,11 @@
class CallStaticMethodsRule implements Rule
{
- private StaticMethodCallCheck $methodCallCheck;
-
- private FunctionCallParametersCheck $parametersCheck;
-
public function __construct(
- StaticMethodCallCheck $methodCallCheck,
- FunctionCallParametersCheck $parametersCheck,
+ private StaticMethodCallCheck $methodCallCheck,
+ private FunctionCallParametersCheck $parametersCheck,
)
{
- $this->methodCallCheck = $methodCallCheck;
- $this->parametersCheck = $parametersCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/CallToConstructorStatementWithoutSideEffectsRule.php b/src/Rules/Methods/CallToConstructorStatementWithoutSideEffectsRule.php
index 59c27c74c1..713f3996af 100644
--- a/src/Rules/Methods/CallToConstructorStatementWithoutSideEffectsRule.php
+++ b/src/Rules/Methods/CallToConstructorStatementWithoutSideEffectsRule.php
@@ -17,11 +17,8 @@
class CallToConstructorStatementWithoutSideEffectsRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/CallToMethodStatementWithoutSideEffectsRule.php b/src/Rules/Methods/CallToMethodStatementWithoutSideEffectsRule.php
index 77e07f6b1c..93b9202984 100644
--- a/src/Rules/Methods/CallToMethodStatementWithoutSideEffectsRule.php
+++ b/src/Rules/Methods/CallToMethodStatementWithoutSideEffectsRule.php
@@ -20,11 +20,8 @@
class CallToMethodStatementWithoutSideEffectsRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- public function __construct(RuleLevelHelper $ruleLevelHelper)
+ public function __construct(private RuleLevelHelper $ruleLevelHelper)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRule.php b/src/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRule.php
index d9670879d6..593846a1d2 100644
--- a/src/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRule.php
+++ b/src/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRule.php
@@ -23,17 +23,11 @@
class CallToStaticMethodStatementWithoutSideEffectsRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- private ReflectionProvider $reflectionProvider;
-
public function __construct(
- RuleLevelHelper $ruleLevelHelper,
- ReflectionProvider $reflectionProvider,
+ private RuleLevelHelper $ruleLevelHelper,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/ExistingClassesInTypehintsRule.php b/src/Rules/Methods/ExistingClassesInTypehintsRule.php
index edee9ea2c8..0f3ee88ed5 100644
--- a/src/Rules/Methods/ExistingClassesInTypehintsRule.php
+++ b/src/Rules/Methods/ExistingClassesInTypehintsRule.php
@@ -18,11 +18,8 @@
class ExistingClassesInTypehintsRule implements Rule
{
- private FunctionDefinitionCheck $check;
-
- public function __construct(FunctionDefinitionCheck $check)
+ public function __construct(private FunctionDefinitionCheck $check)
{
- $this->check = $check;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/MethodAttributesRule.php b/src/Rules/Methods/MethodAttributesRule.php
index 6c7d383773..ae220df96e 100644
--- a/src/Rules/Methods/MethodAttributesRule.php
+++ b/src/Rules/Methods/MethodAttributesRule.php
@@ -14,11 +14,8 @@
class MethodAttributesRule implements Rule
{
- private AttributesCheck $attributesCheck;
-
- public function __construct(AttributesCheck $attributesCheck)
+ public function __construct(private AttributesCheck $attributesCheck)
{
- $this->attributesCheck = $attributesCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/MethodCallCheck.php b/src/Rules/Methods/MethodCallCheck.php
index f94f3f46cc..bd46e50708 100644
--- a/src/Rules/Methods/MethodCallCheck.php
+++ b/src/Rules/Methods/MethodCallCheck.php
@@ -21,25 +21,13 @@
class MethodCallCheck
{
- private ReflectionProvider $reflectionProvider;
-
- private RuleLevelHelper $ruleLevelHelper;
-
- private bool $checkFunctionNameCase;
-
- private bool $reportMagicMethods;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- RuleLevelHelper $ruleLevelHelper,
- bool $checkFunctionNameCase,
- bool $reportMagicMethods,
+ private ReflectionProvider $reflectionProvider,
+ private RuleLevelHelper $ruleLevelHelper,
+ private bool $checkFunctionNameCase,
+ private bool $reportMagicMethods,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->checkFunctionNameCase = $checkFunctionNameCase;
- $this->reportMagicMethods = $reportMagicMethods;
}
/**
diff --git a/src/Rules/Methods/MethodCallableRule.php b/src/Rules/Methods/MethodCallableRule.php
index 0f38d13f13..8cd5c3f14b 100644
--- a/src/Rules/Methods/MethodCallableRule.php
+++ b/src/Rules/Methods/MethodCallableRule.php
@@ -17,14 +17,8 @@
class MethodCallableRule implements Rule
{
- private MethodCallCheck $methodCallCheck;
-
- private PhpVersion $phpVersion;
-
- public function __construct(MethodCallCheck $methodCallCheck, PhpVersion $phpVersion)
+ public function __construct(private MethodCallCheck $methodCallCheck, private PhpVersion $phpVersion)
{
- $this->methodCallCheck = $methodCallCheck;
- $this->phpVersion = $phpVersion;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/MethodSignatureRule.php b/src/Rules/Methods/MethodSignatureRule.php
index fd9c3c72bf..a02e974f4c 100644
--- a/src/Rules/Methods/MethodSignatureRule.php
+++ b/src/Rules/Methods/MethodSignatureRule.php
@@ -33,17 +33,11 @@
class MethodSignatureRule implements Rule
{
- private bool $reportMaybes;
-
- private bool $reportStatic;
-
public function __construct(
- bool $reportMaybes,
- bool $reportStatic,
+ private bool $reportMaybes,
+ private bool $reportStatic,
)
{
- $this->reportMaybes = $reportMaybes;
- $this->reportStatic = $reportStatic;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/MissingMethodParameterTypehintRule.php b/src/Rules/Methods/MissingMethodParameterTypehintRule.php
index 3c176a0998..b94ccdb832 100644
--- a/src/Rules/Methods/MissingMethodParameterTypehintRule.php
+++ b/src/Rules/Methods/MissingMethodParameterTypehintRule.php
@@ -23,11 +23,8 @@
final class MissingMethodParameterTypehintRule implements Rule
{
- private MissingTypehintCheck $missingTypehintCheck;
-
- public function __construct(MissingTypehintCheck $missingTypehintCheck)
+ public function __construct(private MissingTypehintCheck $missingTypehintCheck)
{
- $this->missingTypehintCheck = $missingTypehintCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/MissingMethodReturnTypehintRule.php b/src/Rules/Methods/MissingMethodReturnTypehintRule.php
index 9cc247856d..7b891b9f62 100644
--- a/src/Rules/Methods/MissingMethodReturnTypehintRule.php
+++ b/src/Rules/Methods/MissingMethodReturnTypehintRule.php
@@ -21,11 +21,8 @@
final class MissingMethodReturnTypehintRule implements Rule
{
- private MissingTypehintCheck $missingTypehintCheck;
-
- public function __construct(MissingTypehintCheck $missingTypehintCheck)
+ public function __construct(private MissingTypehintCheck $missingTypehintCheck)
{
- $this->missingTypehintCheck = $missingTypehintCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/OverridingMethodRule.php b/src/Rules/Methods/OverridingMethodRule.php
index 8edda5a124..3d38e95a22 100644
--- a/src/Rules/Methods/OverridingMethodRule.php
+++ b/src/Rules/Methods/OverridingMethodRule.php
@@ -35,21 +35,12 @@
class OverridingMethodRule implements Rule
{
- private PhpVersion $phpVersion;
-
- private MethodSignatureRule $methodSignatureRule;
-
- private bool $checkPhpDocMethodSignatures;
-
public function __construct(
- PhpVersion $phpVersion,
- MethodSignatureRule $methodSignatureRule,
- bool $checkPhpDocMethodSignatures,
+ private PhpVersion $phpVersion,
+ private MethodSignatureRule $methodSignatureRule,
+ private bool $checkPhpDocMethodSignatures,
)
{
- $this->phpVersion = $phpVersion;
- $this->methodSignatureRule = $methodSignatureRule;
- $this->checkPhpDocMethodSignatures = $checkPhpDocMethodSignatures;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/ReturnTypeRule.php b/src/Rules/Methods/ReturnTypeRule.php
index 0474c0e23d..e1fae76875 100644
--- a/src/Rules/Methods/ReturnTypeRule.php
+++ b/src/Rules/Methods/ReturnTypeRule.php
@@ -17,11 +17,8 @@
class ReturnTypeRule implements Rule
{
- private FunctionReturnTypeCheck $returnTypeCheck;
-
- public function __construct(FunctionReturnTypeCheck $returnTypeCheck)
+ public function __construct(private FunctionReturnTypeCheck $returnTypeCheck)
{
- $this->returnTypeCheck = $returnTypeCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Methods/StaticMethodCallCheck.php b/src/Rules/Methods/StaticMethodCallCheck.php
index 1bdd31bdaf..e4d4ae017e 100644
--- a/src/Rules/Methods/StaticMethodCallCheck.php
+++ b/src/Rules/Methods/StaticMethodCallCheck.php
@@ -35,29 +35,14 @@
class StaticMethodCallCheck
{
- private ReflectionProvider $reflectionProvider;
-
- private RuleLevelHelper $ruleLevelHelper;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private bool $checkFunctionNameCase;
-
- private bool $reportMagicMethods;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- RuleLevelHelper $ruleLevelHelper,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- bool $checkFunctionNameCase,
- bool $reportMagicMethods,
+ private ReflectionProvider $reflectionProvider,
+ private RuleLevelHelper $ruleLevelHelper,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private bool $checkFunctionNameCase,
+ private bool $reportMagicMethods,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->checkFunctionNameCase = $checkFunctionNameCase;
- $this->reportMagicMethods = $reportMagicMethods;
}
/**
* @param Name|Expr $class
diff --git a/src/Rules/Methods/StaticMethodCallableRule.php b/src/Rules/Methods/StaticMethodCallableRule.php
index 11c12f2440..72ddeda460 100644
--- a/src/Rules/Methods/StaticMethodCallableRule.php
+++ b/src/Rules/Methods/StaticMethodCallableRule.php
@@ -17,14 +17,8 @@
class StaticMethodCallableRule implements Rule
{
- private StaticMethodCallCheck $methodCallCheck;
-
- private PhpVersion $phpVersion;
-
- public function __construct(StaticMethodCallCheck $methodCallCheck, PhpVersion $phpVersion)
+ public function __construct(private StaticMethodCallCheck $methodCallCheck, private PhpVersion $phpVersion)
{
- $this->methodCallCheck = $methodCallCheck;
- $this->phpVersion = $phpVersion;
}
public function getNodeType(): string
diff --git a/src/Rules/Missing/MissingReturnRule.php b/src/Rules/Missing/MissingReturnRule.php
index 46e6b37d70..e7109da073 100644
--- a/src/Rules/Missing/MissingReturnRule.php
+++ b/src/Rules/Missing/MissingReturnRule.php
@@ -27,17 +27,11 @@
class MissingReturnRule implements Rule
{
- private bool $checkExplicitMixedMissingReturn;
-
- private bool $checkPhpDocMissingReturn;
-
public function __construct(
- bool $checkExplicitMixedMissingReturn,
- bool $checkPhpDocMissingReturn,
+ private bool $checkExplicitMixedMissingReturn,
+ private bool $checkPhpDocMissingReturn,
)
{
- $this->checkExplicitMixedMissingReturn = $checkExplicitMixedMissingReturn;
- $this->checkPhpDocMissingReturn = $checkPhpDocMissingReturn;
}
public function getNodeType(): string
diff --git a/src/Rules/MissingTypehintCheck.php b/src/Rules/MissingTypehintCheck.php
index d116cf50e3..b360872811 100644
--- a/src/Rules/MissingTypehintCheck.php
+++ b/src/Rules/MissingTypehintCheck.php
@@ -38,33 +38,17 @@ class MissingTypehintCheck
Generator::class,
];
- private ReflectionProvider $reflectionProvider;
-
- private bool $checkMissingIterableValueType;
-
- private bool $checkGenericClassInNonGenericObjectType;
-
- private bool $checkMissingCallableSignature;
-
- /** @var string[] */
- private array $skipCheckGenericClasses;
-
/**
* @param string[] $skipCheckGenericClasses
*/
public function __construct(
- ReflectionProvider $reflectionProvider,
- bool $checkMissingIterableValueType,
- bool $checkGenericClassInNonGenericObjectType,
- bool $checkMissingCallableSignature,
- array $skipCheckGenericClasses,
+ private ReflectionProvider $reflectionProvider,
+ private bool $checkMissingIterableValueType,
+ private bool $checkGenericClassInNonGenericObjectType,
+ private bool $checkMissingCallableSignature,
+ private array $skipCheckGenericClasses,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->checkMissingIterableValueType = $checkMissingIterableValueType;
- $this->checkGenericClassInNonGenericObjectType = $checkGenericClassInNonGenericObjectType;
- $this->checkMissingCallableSignature = $checkMissingCallableSignature;
- $this->skipCheckGenericClasses = $skipCheckGenericClasses;
}
/**
diff --git a/src/Rules/Namespaces/ExistingNamesInGroupUseRule.php b/src/Rules/Namespaces/ExistingNamesInGroupUseRule.php
index 3f1f15c475..c4cd4231cf 100644
--- a/src/Rules/Namespaces/ExistingNamesInGroupUseRule.php
+++ b/src/Rules/Namespaces/ExistingNamesInGroupUseRule.php
@@ -22,21 +22,12 @@
class ExistingNamesInGroupUseRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private bool $checkFunctionNameCase;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- bool $checkFunctionNameCase,
+ private ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private bool $checkFunctionNameCase,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->checkFunctionNameCase = $checkFunctionNameCase;
}
public function getNodeType(): string
diff --git a/src/Rules/Namespaces/ExistingNamesInUseRule.php b/src/Rules/Namespaces/ExistingNamesInUseRule.php
index 3d0c9ba9c3..3bb023ad25 100644
--- a/src/Rules/Namespaces/ExistingNamesInUseRule.php
+++ b/src/Rules/Namespaces/ExistingNamesInUseRule.php
@@ -21,21 +21,12 @@
class ExistingNamesInUseRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private bool $checkFunctionNameCase;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- bool $checkFunctionNameCase,
+ private ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private bool $checkFunctionNameCase,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->checkFunctionNameCase = $checkFunctionNameCase;
}
public function getNodeType(): string
diff --git a/src/Rules/Operators/InvalidAssignVarRule.php b/src/Rules/Operators/InvalidAssignVarRule.php
index 2c700f4e81..7495c81e27 100644
--- a/src/Rules/Operators/InvalidAssignVarRule.php
+++ b/src/Rules/Operators/InvalidAssignVarRule.php
@@ -18,11 +18,8 @@
class InvalidAssignVarRule implements Rule
{
- private NullsafeCheck $nullsafeCheck;
-
- public function __construct(NullsafeCheck $nullsafeCheck)
+ public function __construct(private NullsafeCheck $nullsafeCheck)
{
- $this->nullsafeCheck = $nullsafeCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Operators/InvalidBinaryOperationRule.php b/src/Rules/Operators/InvalidBinaryOperationRule.php
index e607855f8f..f9faf4a8f0 100644
--- a/src/Rules/Operators/InvalidBinaryOperationRule.php
+++ b/src/Rules/Operators/InvalidBinaryOperationRule.php
@@ -23,17 +23,11 @@
class InvalidBinaryOperationRule implements Rule
{
- private Standard $printer;
-
- private RuleLevelHelper $ruleLevelHelper;
-
public function __construct(
- Standard $printer,
- RuleLevelHelper $ruleLevelHelper,
+ private Standard $printer,
+ private RuleLevelHelper $ruleLevelHelper,
)
{
- $this->printer = $printer;
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Operators/InvalidComparisonOperationRule.php b/src/Rules/Operators/InvalidComparisonOperationRule.php
index d36d1559de..24110f32dd 100644
--- a/src/Rules/Operators/InvalidComparisonOperationRule.php
+++ b/src/Rules/Operators/InvalidComparisonOperationRule.php
@@ -25,11 +25,8 @@
class InvalidComparisonOperationRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- public function __construct(RuleLevelHelper $ruleLevelHelper)
+ public function __construct(private RuleLevelHelper $ruleLevelHelper)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Operators/InvalidIncDecOperationRule.php b/src/Rules/Operators/InvalidIncDecOperationRule.php
index ed4eae4704..1bd9d46d0e 100644
--- a/src/Rules/Operators/InvalidIncDecOperationRule.php
+++ b/src/Rules/Operators/InvalidIncDecOperationRule.php
@@ -16,11 +16,8 @@
class InvalidIncDecOperationRule implements Rule
{
- private bool $checkThisOnly;
-
- public function __construct(bool $checkThisOnly)
+ public function __construct(private bool $checkThisOnly)
{
- $this->checkThisOnly = $checkThisOnly;
}
public function getNodeType(): string
diff --git a/src/Rules/PhpDoc/IncompatibleClassConstantPhpDocTypeRule.php b/src/Rules/PhpDoc/IncompatibleClassConstantPhpDocTypeRule.php
index 5558882ec4..ace957a7ba 100644
--- a/src/Rules/PhpDoc/IncompatibleClassConstantPhpDocTypeRule.php
+++ b/src/Rules/PhpDoc/IncompatibleClassConstantPhpDocTypeRule.php
@@ -23,17 +23,11 @@
class IncompatibleClassConstantPhpDocTypeRule implements Rule
{
- private GenericObjectTypeCheck $genericObjectTypeCheck;
-
- private UnresolvableTypeHelper $unresolvableTypeHelper;
-
public function __construct(
- GenericObjectTypeCheck $genericObjectTypeCheck,
- UnresolvableTypeHelper $unresolvableTypeHelper,
+ private GenericObjectTypeCheck $genericObjectTypeCheck,
+ private UnresolvableTypeHelper $unresolvableTypeHelper,
)
{
- $this->genericObjectTypeCheck = $genericObjectTypeCheck;
- $this->unresolvableTypeHelper = $unresolvableTypeHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/PhpDoc/IncompatiblePhpDocTypeRule.php b/src/Rules/PhpDoc/IncompatiblePhpDocTypeRule.php
index 4f3954c79a..8c8a870b65 100644
--- a/src/Rules/PhpDoc/IncompatiblePhpDocTypeRule.php
+++ b/src/Rules/PhpDoc/IncompatiblePhpDocTypeRule.php
@@ -26,21 +26,12 @@
class IncompatiblePhpDocTypeRule implements Rule
{
- private FileTypeMapper $fileTypeMapper;
-
- private GenericObjectTypeCheck $genericObjectTypeCheck;
-
- private UnresolvableTypeHelper $unresolvableTypeHelper;
-
public function __construct(
- FileTypeMapper $fileTypeMapper,
- GenericObjectTypeCheck $genericObjectTypeCheck,
- UnresolvableTypeHelper $unresolvableTypeHelper,
+ private FileTypeMapper $fileTypeMapper,
+ private GenericObjectTypeCheck $genericObjectTypeCheck,
+ private UnresolvableTypeHelper $unresolvableTypeHelper,
)
{
- $this->fileTypeMapper = $fileTypeMapper;
- $this->genericObjectTypeCheck = $genericObjectTypeCheck;
- $this->unresolvableTypeHelper = $unresolvableTypeHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/PhpDoc/IncompatiblePropertyPhpDocTypeRule.php b/src/Rules/PhpDoc/IncompatiblePropertyPhpDocTypeRule.php
index 8e3664f8a8..bc053796de 100644
--- a/src/Rules/PhpDoc/IncompatiblePropertyPhpDocTypeRule.php
+++ b/src/Rules/PhpDoc/IncompatiblePropertyPhpDocTypeRule.php
@@ -21,17 +21,11 @@
class IncompatiblePropertyPhpDocTypeRule implements Rule
{
- private GenericObjectTypeCheck $genericObjectTypeCheck;
-
- private UnresolvableTypeHelper $unresolvableTypeHelper;
-
public function __construct(
- GenericObjectTypeCheck $genericObjectTypeCheck,
- UnresolvableTypeHelper $unresolvableTypeHelper,
+ private GenericObjectTypeCheck $genericObjectTypeCheck,
+ private UnresolvableTypeHelper $unresolvableTypeHelper,
)
{
- $this->genericObjectTypeCheck = $genericObjectTypeCheck;
- $this->unresolvableTypeHelper = $unresolvableTypeHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/PhpDoc/InvalidPHPStanDocTagRule.php b/src/Rules/PhpDoc/InvalidPHPStanDocTagRule.php
index ec3ed69343..2b3d22b15c 100644
--- a/src/Rules/PhpDoc/InvalidPHPStanDocTagRule.php
+++ b/src/Rules/PhpDoc/InvalidPHPStanDocTagRule.php
@@ -42,14 +42,8 @@ class InvalidPHPStanDocTagRule implements Rule
'@phpstan-property-write',
];
- private Lexer $phpDocLexer;
-
- private PhpDocParser $phpDocParser;
-
- public function __construct(Lexer $phpDocLexer, PhpDocParser $phpDocParser)
+ public function __construct(private Lexer $phpDocLexer, private PhpDocParser $phpDocParser)
{
- $this->phpDocLexer = $phpDocLexer;
- $this->phpDocParser = $phpDocParser;
}
public function getNodeType(): string
diff --git a/src/Rules/PhpDoc/InvalidPhpDocTagValueRule.php b/src/Rules/PhpDoc/InvalidPhpDocTagValueRule.php
index caf5e3307d..bcf90bec7e 100644
--- a/src/Rules/PhpDoc/InvalidPhpDocTagValueRule.php
+++ b/src/Rules/PhpDoc/InvalidPhpDocTagValueRule.php
@@ -19,14 +19,8 @@
class InvalidPhpDocTagValueRule implements Rule
{
- private Lexer $phpDocLexer;
-
- private PhpDocParser $phpDocParser;
-
- public function __construct(Lexer $phpDocLexer, PhpDocParser $phpDocParser)
+ public function __construct(private Lexer $phpDocLexer, private PhpDocParser $phpDocParser)
{
- $this->phpDocLexer = $phpDocLexer;
- $this->phpDocParser = $phpDocParser;
}
public function getNodeType(): string
diff --git a/src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php b/src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php
index 1228d80f20..ea97fa34ef 100644
--- a/src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php
+++ b/src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php
@@ -26,41 +26,17 @@
class InvalidPhpDocVarTagTypeRule implements Rule
{
- private FileTypeMapper $fileTypeMapper;
-
- private ReflectionProvider $reflectionProvider;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private GenericObjectTypeCheck $genericObjectTypeCheck;
-
- private MissingTypehintCheck $missingTypehintCheck;
-
- private UnresolvableTypeHelper $unresolvableTypeHelper;
-
- private bool $checkClassCaseSensitivity;
-
- private bool $checkMissingVarTagTypehint;
-
public function __construct(
- FileTypeMapper $fileTypeMapper,
- ReflectionProvider $reflectionProvider,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- GenericObjectTypeCheck $genericObjectTypeCheck,
- MissingTypehintCheck $missingTypehintCheck,
- UnresolvableTypeHelper $unresolvableTypeHelper,
- bool $checkClassCaseSensitivity,
- bool $checkMissingVarTagTypehint,
+ private FileTypeMapper $fileTypeMapper,
+ private ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private GenericObjectTypeCheck $genericObjectTypeCheck,
+ private MissingTypehintCheck $missingTypehintCheck,
+ private UnresolvableTypeHelper $unresolvableTypeHelper,
+ private bool $checkClassCaseSensitivity,
+ private bool $checkMissingVarTagTypehint,
)
{
- $this->fileTypeMapper = $fileTypeMapper;
- $this->reflectionProvider = $reflectionProvider;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->genericObjectTypeCheck = $genericObjectTypeCheck;
- $this->missingTypehintCheck = $missingTypehintCheck;
- $this->unresolvableTypeHelper = $unresolvableTypeHelper;
- $this->checkClassCaseSensitivity = $checkClassCaseSensitivity;
- $this->checkMissingVarTagTypehint = $checkMissingVarTagTypehint;
}
public function getNodeType(): string
diff --git a/src/Rules/PhpDoc/InvalidThrowsPhpDocValueRule.php b/src/Rules/PhpDoc/InvalidThrowsPhpDocValueRule.php
index 7e9e3911e5..f3d40be686 100644
--- a/src/Rules/PhpDoc/InvalidThrowsPhpDocValueRule.php
+++ b/src/Rules/PhpDoc/InvalidThrowsPhpDocValueRule.php
@@ -19,11 +19,8 @@
class InvalidThrowsPhpDocValueRule implements Rule
{
- private FileTypeMapper $fileTypeMapper;
-
- public function __construct(FileTypeMapper $fileTypeMapper)
+ public function __construct(private FileTypeMapper $fileTypeMapper)
{
- $this->fileTypeMapper = $fileTypeMapper;
}
public function getNodeType(): string
diff --git a/src/Rules/PhpDoc/WrongVariableNameInVarTagRule.php b/src/Rules/PhpDoc/WrongVariableNameInVarTagRule.php
index 0433848672..c1f3dac121 100644
--- a/src/Rules/PhpDoc/WrongVariableNameInVarTagRule.php
+++ b/src/Rules/PhpDoc/WrongVariableNameInVarTagRule.php
@@ -32,13 +32,10 @@
class WrongVariableNameInVarTagRule implements Rule
{
- private FileTypeMapper $fileTypeMapper;
-
public function __construct(
- FileTypeMapper $fileTypeMapper,
+ private FileTypeMapper $fileTypeMapper,
)
{
- $this->fileTypeMapper = $fileTypeMapper;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/AccessPropertiesInAssignRule.php b/src/Rules/Properties/AccessPropertiesInAssignRule.php
index 2375351741..00a4054377 100644
--- a/src/Rules/Properties/AccessPropertiesInAssignRule.php
+++ b/src/Rules/Properties/AccessPropertiesInAssignRule.php
@@ -12,11 +12,8 @@
class AccessPropertiesInAssignRule implements Rule
{
- private AccessPropertiesRule $accessPropertiesRule;
-
- public function __construct(AccessPropertiesRule $accessPropertiesRule)
+ public function __construct(private AccessPropertiesRule $accessPropertiesRule)
{
- $this->accessPropertiesRule = $accessPropertiesRule;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/AccessPropertiesRule.php b/src/Rules/Properties/AccessPropertiesRule.php
index ad9764a6ca..5b3d81776a 100644
--- a/src/Rules/Properties/AccessPropertiesRule.php
+++ b/src/Rules/Properties/AccessPropertiesRule.php
@@ -29,21 +29,12 @@
class AccessPropertiesRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private RuleLevelHelper $ruleLevelHelper;
-
- private bool $reportMagicProperties;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- RuleLevelHelper $ruleLevelHelper,
- bool $reportMagicProperties,
+ private ReflectionProvider $reflectionProvider,
+ private RuleLevelHelper $ruleLevelHelper,
+ private bool $reportMagicProperties,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->reportMagicProperties = $reportMagicProperties;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/AccessStaticPropertiesInAssignRule.php b/src/Rules/Properties/AccessStaticPropertiesInAssignRule.php
index 6784b966e6..bac967d31c 100644
--- a/src/Rules/Properties/AccessStaticPropertiesInAssignRule.php
+++ b/src/Rules/Properties/AccessStaticPropertiesInAssignRule.php
@@ -12,11 +12,8 @@
class AccessStaticPropertiesInAssignRule implements Rule
{
- private AccessStaticPropertiesRule $accessStaticPropertiesRule;
-
- public function __construct(AccessStaticPropertiesRule $accessStaticPropertiesRule)
+ public function __construct(private AccessStaticPropertiesRule $accessStaticPropertiesRule)
{
- $this->accessStaticPropertiesRule = $accessStaticPropertiesRule;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/AccessStaticPropertiesRule.php b/src/Rules/Properties/AccessStaticPropertiesRule.php
index b8b9ad04c5..81da5c51ee 100644
--- a/src/Rules/Properties/AccessStaticPropertiesRule.php
+++ b/src/Rules/Properties/AccessStaticPropertiesRule.php
@@ -36,21 +36,12 @@
class AccessStaticPropertiesRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private RuleLevelHelper $ruleLevelHelper;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- RuleLevelHelper $ruleLevelHelper,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private ReflectionProvider $reflectionProvider,
+ private RuleLevelHelper $ruleLevelHelper,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/DefaultValueTypesAssignedToPropertiesRule.php b/src/Rules/Properties/DefaultValueTypesAssignedToPropertiesRule.php
index c85ffbcc1f..b27e01de6b 100644
--- a/src/Rules/Properties/DefaultValueTypesAssignedToPropertiesRule.php
+++ b/src/Rules/Properties/DefaultValueTypesAssignedToPropertiesRule.php
@@ -19,11 +19,8 @@
class DefaultValueTypesAssignedToPropertiesRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- public function __construct(RuleLevelHelper $ruleLevelHelper)
+ public function __construct(private RuleLevelHelper $ruleLevelHelper)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/ExistingClassesInPropertiesRule.php b/src/Rules/Properties/ExistingClassesInPropertiesRule.php
index 7a4dedb24e..1f4780b33b 100644
--- a/src/Rules/Properties/ExistingClassesInPropertiesRule.php
+++ b/src/Rules/Properties/ExistingClassesInPropertiesRule.php
@@ -23,33 +23,15 @@
class ExistingClassesInPropertiesRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- private ClassCaseSensitivityCheck $classCaseSensitivityCheck;
-
- private UnresolvableTypeHelper $unresolvableTypeHelper;
-
- private PhpVersion $phpVersion;
-
- private bool $checkClassCaseSensitivity;
-
- private bool $checkThisOnly;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- ClassCaseSensitivityCheck $classCaseSensitivityCheck,
- UnresolvableTypeHelper $unresolvableTypeHelper,
- PhpVersion $phpVersion,
- bool $checkClassCaseSensitivity,
- bool $checkThisOnly,
+ private ReflectionProvider $reflectionProvider,
+ private ClassCaseSensitivityCheck $classCaseSensitivityCheck,
+ private UnresolvableTypeHelper $unresolvableTypeHelper,
+ private PhpVersion $phpVersion,
+ private bool $checkClassCaseSensitivity,
+ private bool $checkThisOnly,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->classCaseSensitivityCheck = $classCaseSensitivityCheck;
- $this->unresolvableTypeHelper = $unresolvableTypeHelper;
- $this->phpVersion = $phpVersion;
- $this->checkClassCaseSensitivity = $checkClassCaseSensitivity;
- $this->checkThisOnly = $checkThisOnly;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/FoundPropertyReflection.php b/src/Rules/Properties/FoundPropertyReflection.php
index 54b681f54e..e89b09e1ea 100644
--- a/src/Rules/Properties/FoundPropertyReflection.php
+++ b/src/Rules/Properties/FoundPropertyReflection.php
@@ -13,29 +13,14 @@
class FoundPropertyReflection implements PropertyReflection
{
- private PropertyReflection $originalPropertyReflection;
-
- private Scope $scope;
-
- private string $propertyName;
-
- private Type $readableType;
-
- private Type $writableType;
-
public function __construct(
- PropertyReflection $originalPropertyReflection,
- Scope $scope,
- string $propertyName,
- Type $readableType,
- Type $writableType,
+ private PropertyReflection $originalPropertyReflection,
+ private Scope $scope,
+ private string $propertyName,
+ private Type $readableType,
+ private Type $writableType,
)
{
- $this->originalPropertyReflection = $originalPropertyReflection;
- $this->scope = $scope;
- $this->propertyName = $propertyName;
- $this->readableType = $readableType;
- $this->writableType = $writableType;
}
public function getScope(): Scope
diff --git a/src/Rules/Properties/LazyReadWritePropertiesExtensionProvider.php b/src/Rules/Properties/LazyReadWritePropertiesExtensionProvider.php
index eed89ae937..3f61fd0fb8 100644
--- a/src/Rules/Properties/LazyReadWritePropertiesExtensionProvider.php
+++ b/src/Rules/Properties/LazyReadWritePropertiesExtensionProvider.php
@@ -7,14 +7,11 @@
class LazyReadWritePropertiesExtensionProvider implements ReadWritePropertiesExtensionProvider
{
- private Container $container;
-
/** @var ReadWritePropertiesExtension[]|null */
private ?array $extensions = null;
- public function __construct(Container $container)
+ public function __construct(private Container $container)
{
- $this->container = $container;
}
public function getExtensions(): array
diff --git a/src/Rules/Properties/MissingPropertyTypehintRule.php b/src/Rules/Properties/MissingPropertyTypehintRule.php
index b278c18e85..6831c3ca37 100644
--- a/src/Rules/Properties/MissingPropertyTypehintRule.php
+++ b/src/Rules/Properties/MissingPropertyTypehintRule.php
@@ -20,11 +20,8 @@
final class MissingPropertyTypehintRule implements Rule
{
- private MissingTypehintCheck $missingTypehintCheck;
-
- public function __construct(MissingTypehintCheck $missingTypehintCheck)
+ public function __construct(private MissingTypehintCheck $missingTypehintCheck)
{
- $this->missingTypehintCheck = $missingTypehintCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/OverridingPropertyRule.php b/src/Rules/Properties/OverridingPropertyRule.php
index 559551328d..e8749b62f0 100644
--- a/src/Rules/Properties/OverridingPropertyRule.php
+++ b/src/Rules/Properties/OverridingPropertyRule.php
@@ -22,17 +22,11 @@
class OverridingPropertyRule implements Rule
{
- private bool $checkPhpDocMethodSignatures;
-
- private bool $reportMaybes;
-
public function __construct(
- bool $checkPhpDocMethodSignatures,
- bool $reportMaybes,
+ private bool $checkPhpDocMethodSignatures,
+ private bool $reportMaybes,
)
{
- $this->checkPhpDocMethodSignatures = $checkPhpDocMethodSignatures;
- $this->reportMaybes = $reportMaybes;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/PropertyAttributesRule.php b/src/Rules/Properties/PropertyAttributesRule.php
index bd6d4e5f8a..b0d9cf2812 100644
--- a/src/Rules/Properties/PropertyAttributesRule.php
+++ b/src/Rules/Properties/PropertyAttributesRule.php
@@ -14,11 +14,8 @@
class PropertyAttributesRule implements Rule
{
- private AttributesCheck $attributesCheck;
-
- public function __construct(AttributesCheck $attributesCheck)
+ public function __construct(private AttributesCheck $attributesCheck)
{
- $this->attributesCheck = $attributesCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/ReadOnlyPropertyRule.php b/src/Rules/Properties/ReadOnlyPropertyRule.php
index 16162f53bb..5c80d413ea 100644
--- a/src/Rules/Properties/ReadOnlyPropertyRule.php
+++ b/src/Rules/Properties/ReadOnlyPropertyRule.php
@@ -15,11 +15,8 @@
class ReadOnlyPropertyRule implements Rule
{
- private PhpVersion $phpVersion;
-
- public function __construct(PhpVersion $phpVersion)
+ public function __construct(private PhpVersion $phpVersion)
{
- $this->phpVersion = $phpVersion;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/ReadingWriteOnlyPropertiesRule.php b/src/Rules/Properties/ReadingWriteOnlyPropertiesRule.php
index de655f7f93..315be25535 100644
--- a/src/Rules/Properties/ReadingWriteOnlyPropertiesRule.php
+++ b/src/Rules/Properties/ReadingWriteOnlyPropertiesRule.php
@@ -15,25 +15,13 @@
class ReadingWriteOnlyPropertiesRule implements Rule
{
- private PropertyDescriptor $propertyDescriptor;
-
- private PropertyReflectionFinder $propertyReflectionFinder;
-
- private RuleLevelHelper $ruleLevelHelper;
-
- private bool $checkThisOnly;
-
public function __construct(
- PropertyDescriptor $propertyDescriptor,
- PropertyReflectionFinder $propertyReflectionFinder,
- RuleLevelHelper $ruleLevelHelper,
- bool $checkThisOnly,
+ private PropertyDescriptor $propertyDescriptor,
+ private PropertyReflectionFinder $propertyReflectionFinder,
+ private RuleLevelHelper $ruleLevelHelper,
+ private bool $checkThisOnly,
)
{
- $this->propertyDescriptor = $propertyDescriptor;
- $this->propertyReflectionFinder = $propertyReflectionFinder;
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->checkThisOnly = $checkThisOnly;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/TypesAssignedToPropertiesRule.php b/src/Rules/Properties/TypesAssignedToPropertiesRule.php
index 95fbb352a9..74f3a60f56 100644
--- a/src/Rules/Properties/TypesAssignedToPropertiesRule.php
+++ b/src/Rules/Properties/TypesAssignedToPropertiesRule.php
@@ -18,21 +18,12 @@
class TypesAssignedToPropertiesRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- private PropertyDescriptor $propertyDescriptor;
-
- private PropertyReflectionFinder $propertyReflectionFinder;
-
public function __construct(
- RuleLevelHelper $ruleLevelHelper,
- PropertyDescriptor $propertyDescriptor,
- PropertyReflectionFinder $propertyReflectionFinder,
+ private RuleLevelHelper $ruleLevelHelper,
+ private PropertyDescriptor $propertyDescriptor,
+ private PropertyReflectionFinder $propertyReflectionFinder,
)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->propertyDescriptor = $propertyDescriptor;
- $this->propertyReflectionFinder = $propertyReflectionFinder;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/UninitializedPropertyRule.php b/src/Rules/Properties/UninitializedPropertyRule.php
index 8b7de025e4..6d5c3d4dcf 100644
--- a/src/Rules/Properties/UninitializedPropertyRule.php
+++ b/src/Rules/Properties/UninitializedPropertyRule.php
@@ -20,11 +20,6 @@
class UninitializedPropertyRule implements Rule
{
- private ReadWritePropertiesExtensionProvider $extensionProvider;
-
- /** @var string[] */
- private array $additionalConstructors;
-
/** @var array */
private array $additionalConstructorsCache = [];
@@ -32,12 +27,10 @@ class UninitializedPropertyRule implements Rule
* @param string[] $additionalConstructors
*/
public function __construct(
- ReadWritePropertiesExtensionProvider $extensionProvider,
- array $additionalConstructors,
+ private ReadWritePropertiesExtensionProvider $extensionProvider,
+ private array $additionalConstructors,
)
{
- $this->extensionProvider = $extensionProvider;
- $this->additionalConstructors = $additionalConstructors;
}
public function getNodeType(): string
diff --git a/src/Rules/Properties/WritingToReadOnlyPropertiesRule.php b/src/Rules/Properties/WritingToReadOnlyPropertiesRule.php
index fdfb5bd913..f25cd413c7 100644
--- a/src/Rules/Properties/WritingToReadOnlyPropertiesRule.php
+++ b/src/Rules/Properties/WritingToReadOnlyPropertiesRule.php
@@ -15,25 +15,13 @@
class WritingToReadOnlyPropertiesRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- private PropertyDescriptor $propertyDescriptor;
-
- private PropertyReflectionFinder $propertyReflectionFinder;
-
- private bool $checkThisOnly;
-
public function __construct(
- RuleLevelHelper $ruleLevelHelper,
- PropertyDescriptor $propertyDescriptor,
- PropertyReflectionFinder $propertyReflectionFinder,
- bool $checkThisOnly,
+ private RuleLevelHelper $ruleLevelHelper,
+ private PropertyDescriptor $propertyDescriptor,
+ private PropertyReflectionFinder $propertyReflectionFinder,
+ private bool $checkThisOnly,
)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
- $this->propertyDescriptor = $propertyDescriptor;
- $this->propertyReflectionFinder = $propertyReflectionFinder;
- $this->checkThisOnly = $checkThisOnly;
}
public function getNodeType(): string
diff --git a/src/Rules/RegistryFactory.php b/src/Rules/RegistryFactory.php
index b19b8fc630..ebf00801d1 100644
--- a/src/Rules/RegistryFactory.php
+++ b/src/Rules/RegistryFactory.php
@@ -9,11 +9,8 @@ class RegistryFactory
public const RULE_TAG = 'phpstan.rules.rule';
- private Container $container;
-
- public function __construct(Container $container)
+ public function __construct(private Container $container)
{
- $this->container = $container;
}
public function create(): Registry
diff --git a/src/Rules/RuleLevelHelper.php b/src/Rules/RuleLevelHelper.php
index 47005742e6..bc1b80ebe4 100644
--- a/src/Rules/RuleLevelHelper.php
+++ b/src/Rules/RuleLevelHelper.php
@@ -28,29 +28,14 @@
class RuleLevelHelper
{
- private ReflectionProvider $reflectionProvider;
-
- private bool $checkNullables;
-
- private bool $checkThisOnly;
-
- private bool $checkUnionTypes;
-
- private bool $checkExplicitMixed;
-
public function __construct(
- ReflectionProvider $reflectionProvider,
- bool $checkNullables,
- bool $checkThisOnly,
- bool $checkUnionTypes,
- bool $checkExplicitMixed,
+ private ReflectionProvider $reflectionProvider,
+ private bool $checkNullables,
+ private bool $checkThisOnly,
+ private bool $checkUnionTypes,
+ private bool $checkExplicitMixed,
)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->checkNullables = $checkNullables;
- $this->checkThisOnly = $checkThisOnly;
- $this->checkUnionTypes = $checkUnionTypes;
- $this->checkExplicitMixed = $checkExplicitMixed;
}
/** @api */
diff --git a/src/Rules/TooWideTypehints/TooWideMethodReturnTypehintRule.php b/src/Rules/TooWideTypehints/TooWideMethodReturnTypehintRule.php
index b89f1ccff6..259487e3bf 100644
--- a/src/Rules/TooWideTypehints/TooWideMethodReturnTypehintRule.php
+++ b/src/Rules/TooWideTypehints/TooWideMethodReturnTypehintRule.php
@@ -24,11 +24,8 @@
class TooWideMethodReturnTypehintRule implements Rule
{
- private bool $checkProtectedAndPublicMethods;
-
- public function __construct(bool $checkProtectedAndPublicMethods)
+ public function __construct(private bool $checkProtectedAndPublicMethods)
{
- $this->checkProtectedAndPublicMethods = $checkProtectedAndPublicMethods;
}
public function getNodeType(): string
diff --git a/src/Rules/UnusedFunctionParametersCheck.php b/src/Rules/UnusedFunctionParametersCheck.php
index 9837f65a3d..890fc5d3f6 100644
--- a/src/Rules/UnusedFunctionParametersCheck.php
+++ b/src/Rules/UnusedFunctionParametersCheck.php
@@ -16,11 +16,8 @@
class UnusedFunctionParametersCheck
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
/**
diff --git a/src/Rules/Variables/CompactVariablesRule.php b/src/Rules/Variables/CompactVariablesRule.php
index 99c0644f38..454082e900 100644
--- a/src/Rules/Variables/CompactVariablesRule.php
+++ b/src/Rules/Variables/CompactVariablesRule.php
@@ -19,11 +19,8 @@
final class CompactVariablesRule implements Rule
{
- private bool $checkMaybeUndefinedVariables;
-
- public function __construct(bool $checkMaybeUndefinedVariables)
+ public function __construct(private bool $checkMaybeUndefinedVariables)
{
- $this->checkMaybeUndefinedVariables = $checkMaybeUndefinedVariables;
}
public function getNodeType(): string
diff --git a/src/Rules/Variables/DefinedVariableRule.php b/src/Rules/Variables/DefinedVariableRule.php
index 7377f79dbc..9a69183eaa 100644
--- a/src/Rules/Variables/DefinedVariableRule.php
+++ b/src/Rules/Variables/DefinedVariableRule.php
@@ -17,17 +17,11 @@
class DefinedVariableRule implements Rule
{
- private bool $cliArgumentsVariablesRegistered;
-
- private bool $checkMaybeUndefinedVariables;
-
public function __construct(
- bool $cliArgumentsVariablesRegistered,
- bool $checkMaybeUndefinedVariables,
+ private bool $cliArgumentsVariablesRegistered,
+ private bool $checkMaybeUndefinedVariables,
)
{
- $this->cliArgumentsVariablesRegistered = $cliArgumentsVariablesRegistered;
- $this->checkMaybeUndefinedVariables = $checkMaybeUndefinedVariables;
}
public function getNodeType(): string
diff --git a/src/Rules/Variables/EmptyRule.php b/src/Rules/Variables/EmptyRule.php
index 58c0693d14..9a48592cb9 100644
--- a/src/Rules/Variables/EmptyRule.php
+++ b/src/Rules/Variables/EmptyRule.php
@@ -16,11 +16,8 @@
class EmptyRule implements Rule
{
- private IssetCheck $issetCheck;
-
- public function __construct(IssetCheck $issetCheck)
+ public function __construct(private IssetCheck $issetCheck)
{
- $this->issetCheck = $issetCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Variables/IssetRule.php b/src/Rules/Variables/IssetRule.php
index 9e2b9df8f7..55cd5dc05f 100644
--- a/src/Rules/Variables/IssetRule.php
+++ b/src/Rules/Variables/IssetRule.php
@@ -15,11 +15,8 @@
class IssetRule implements Rule
{
- private IssetCheck $issetCheck;
-
- public function __construct(IssetCheck $issetCheck)
+ public function __construct(private IssetCheck $issetCheck)
{
- $this->issetCheck = $issetCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Variables/NullCoalesceRule.php b/src/Rules/Variables/NullCoalesceRule.php
index ae97c00c87..8666ab4f7e 100644
--- a/src/Rules/Variables/NullCoalesceRule.php
+++ b/src/Rules/Variables/NullCoalesceRule.php
@@ -15,11 +15,8 @@
class NullCoalesceRule implements Rule
{
- private IssetCheck $issetCheck;
-
- public function __construct(IssetCheck $issetCheck)
+ public function __construct(private IssetCheck $issetCheck)
{
- $this->issetCheck = $issetCheck;
}
public function getNodeType(): string
diff --git a/src/Rules/Variables/ThrowTypeRule.php b/src/Rules/Variables/ThrowTypeRule.php
index 23124a0c73..deb7a22856 100644
--- a/src/Rules/Variables/ThrowTypeRule.php
+++ b/src/Rules/Variables/ThrowTypeRule.php
@@ -20,13 +20,10 @@
class ThrowTypeRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
public function __construct(
- RuleLevelHelper $ruleLevelHelper,
+ private RuleLevelHelper $ruleLevelHelper,
)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Rules/Variables/VariableCloningRule.php b/src/Rules/Variables/VariableCloningRule.php
index 4a284949c1..81bfbcb253 100644
--- a/src/Rules/Variables/VariableCloningRule.php
+++ b/src/Rules/Variables/VariableCloningRule.php
@@ -21,11 +21,8 @@
class VariableCloningRule implements Rule
{
- private RuleLevelHelper $ruleLevelHelper;
-
- public function __construct(RuleLevelHelper $ruleLevelHelper)
+ public function __construct(private RuleLevelHelper $ruleLevelHelper)
{
- $this->ruleLevelHelper = $ruleLevelHelper;
}
public function getNodeType(): string
diff --git a/src/Testing/TestCaseSourceLocatorFactory.php b/src/Testing/TestCaseSourceLocatorFactory.php
index d9c9894243..16b94cae23 100644
--- a/src/Testing/TestCaseSourceLocatorFactory.php
+++ b/src/Testing/TestCaseSourceLocatorFactory.php
@@ -22,33 +22,15 @@
class TestCaseSourceLocatorFactory
{
- private ComposerJsonAndInstalledJsonSourceLocatorMaker $composerJsonAndInstalledJsonSourceLocatorMaker;
-
- private AutoloadSourceLocator $autoloadSourceLocator;
-
- private Parser $phpParser;
-
- private Parser $php8Parser;
-
- private PhpStormStubsSourceStubber $phpstormStubsSourceStubber;
-
- private ReflectionSourceStubber $reflectionSourceStubber;
-
public function __construct(
- ComposerJsonAndInstalledJsonSourceLocatorMaker $composerJsonAndInstalledJsonSourceLocatorMaker,
- AutoloadSourceLocator $autoloadSourceLocator,
- Parser $phpParser,
- Parser $php8Parser,
- PhpStormStubsSourceStubber $phpstormStubsSourceStubber,
- ReflectionSourceStubber $reflectionSourceStubber,
+ private ComposerJsonAndInstalledJsonSourceLocatorMaker $composerJsonAndInstalledJsonSourceLocatorMaker,
+ private AutoloadSourceLocator $autoloadSourceLocator,
+ private Parser $phpParser,
+ private Parser $php8Parser,
+ private PhpStormStubsSourceStubber $phpstormStubsSourceStubber,
+ private ReflectionSourceStubber $reflectionSourceStubber,
)
{
- $this->composerJsonAndInstalledJsonSourceLocatorMaker = $composerJsonAndInstalledJsonSourceLocatorMaker;
- $this->autoloadSourceLocator = $autoloadSourceLocator;
- $this->phpParser = $phpParser;
- $this->php8Parser = $php8Parser;
- $this->phpstormStubsSourceStubber = $phpstormStubsSourceStubber;
- $this->reflectionSourceStubber = $reflectionSourceStubber;
}
public function create(): SourceLocator
diff --git a/src/TrinaryLogic.php b/src/TrinaryLogic.php
index a88e79aabb..92e98d9381 100644
--- a/src/TrinaryLogic.php
+++ b/src/TrinaryLogic.php
@@ -19,14 +19,11 @@ class TrinaryLogic
private const MAYBE = 0;
private const NO = -1;
- private int $value;
-
/** @var self[] */
private static array $registry = [];
- private function __construct(int $value)
+ private function __construct(private int $value)
{
- $this->value = $value;
}
public static function createYes(): self
diff --git a/src/Type/Accessory/HasMethodType.php b/src/Type/Accessory/HasMethodType.php
index e4230b1744..b1af1797b4 100644
--- a/src/Type/Accessory/HasMethodType.php
+++ b/src/Type/Accessory/HasMethodType.php
@@ -27,12 +27,9 @@ class HasMethodType implements AccessoryType, CompoundType
use NonGenericTypeTrait;
use UndecidedComparisonCompoundTypeTrait;
- private string $methodName;
-
/** @api */
- public function __construct(string $methodName)
+ public function __construct(private string $methodName)
{
- $this->methodName = $methodName;
}
public function getReferencedClasses(): array
diff --git a/src/Type/Accessory/HasOffsetType.php b/src/Type/Accessory/HasOffsetType.php
index bb319d4079..4c6006ee8f 100644
--- a/src/Type/Accessory/HasOffsetType.php
+++ b/src/Type/Accessory/HasOffsetType.php
@@ -29,12 +29,9 @@ class HasOffsetType implements CompoundType, AccessoryType
use NonGenericTypeTrait;
use UndecidedComparisonCompoundTypeTrait;
- private Type $offsetType;
-
/** @api */
- public function __construct(Type $offsetType)
+ public function __construct(private Type $offsetType)
{
- $this->offsetType = $offsetType;
}
public function getOffsetType(): Type
diff --git a/src/Type/Accessory/HasPropertyType.php b/src/Type/Accessory/HasPropertyType.php
index 81d509ddde..38791dd728 100644
--- a/src/Type/Accessory/HasPropertyType.php
+++ b/src/Type/Accessory/HasPropertyType.php
@@ -22,12 +22,9 @@ class HasPropertyType implements AccessoryType, CompoundType
use NonGenericTypeTrait;
use UndecidedComparisonCompoundTypeTrait;
- private string $propertyName;
-
/** @api */
- public function __construct(string $propertyName)
+ public function __construct(private string $propertyName)
{
- $this->propertyName = $propertyName;
}
/**
diff --git a/src/Type/ArrayType.php b/src/Type/ArrayType.php
index 796dbaed17..087e74dc1c 100644
--- a/src/Type/ArrayType.php
+++ b/src/Type/ArrayType.php
@@ -38,16 +38,13 @@ class ArrayType implements Type
private Type $keyType;
- private Type $itemType;
-
/** @api */
- public function __construct(Type $keyType, Type $itemType)
+ public function __construct(Type $keyType, private Type $itemType)
{
if ($keyType->describe(VerbosityLevel::value()) === '(int|string)') {
$keyType = new MixedType();
}
$this->keyType = $keyType;
- $this->itemType = $itemType;
}
public function getKeyType(): Type
diff --git a/src/Type/CallableType.php b/src/Type/CallableType.php
index 3f0d3b2781..98a9ba3ef5 100644
--- a/src/Type/CallableType.php
+++ b/src/Type/CallableType.php
@@ -38,8 +38,6 @@ class CallableType implements CompoundType, ParametersAcceptor
private Type $returnType;
- private bool $variadic;
-
private bool $isCommonCallable;
/**
@@ -49,12 +47,11 @@ class CallableType implements CompoundType, ParametersAcceptor
public function __construct(
?array $parameters = null,
?Type $returnType = null,
- bool $variadic = true,
+ private bool $variadic = true,
)
{
$this->parameters = $parameters ?? [];
$this->returnType = $returnType ?? new MixedType();
- $this->variadic = $variadic;
$this->isCommonCallable = $parameters === null && $returnType === null;
}
diff --git a/src/Type/ClosureType.php b/src/Type/ClosureType.php
index e42c261928..5c9ebacb01 100644
--- a/src/Type/ClosureType.php
+++ b/src/Type/ClosureType.php
@@ -38,13 +38,6 @@ class ClosureType implements TypeWithClassName, ParametersAcceptor
private ObjectType $objectType;
- /** @var array */
- private array $parameters;
-
- private Type $returnType;
-
- private bool $variadic;
-
private TemplateTypeMap $templateTypeMap;
private TemplateTypeMap $resolvedTemplateTypeMap;
@@ -54,17 +47,14 @@ class ClosureType implements TypeWithClassName, ParametersAcceptor
* @param array $parameters
*/
public function __construct(
- array $parameters,
- Type $returnType,
- bool $variadic,
+ private array $parameters,
+ private Type $returnType,
+ private bool $variadic,
?TemplateTypeMap $templateTypeMap = null,
?TemplateTypeMap $resolvedTemplateTypeMap = null,
)
{
$this->objectType = new ObjectType(Closure::class);
- $this->parameters = $parameters;
- $this->returnType = $returnType;
- $this->variadic = $variadic;
$this->templateTypeMap = $templateTypeMap ?? TemplateTypeMap::createEmpty();
$this->resolvedTemplateTypeMap = $resolvedTemplateTypeMap ?? TemplateTypeMap::createEmpty();
}
diff --git a/src/Type/Constant/ConstantArrayType.php b/src/Type/Constant/ConstantArrayType.php
index 474131394e..51aaea08c5 100644
--- a/src/Type/Constant/ConstantArrayType.php
+++ b/src/Type/Constant/ConstantArrayType.php
@@ -57,17 +57,6 @@ class ConstantArrayType extends ArrayType implements ConstantType
private const DESCRIBE_LIMIT = 8;
- /** @var array */
- private array $keyTypes;
-
- /** @var array */
- private array $valueTypes;
-
- private int $nextAutoIndex;
-
- /** @var int[] */
- private array $optionalKeys;
-
/** @var self[]|null */
private ?array $allArrays = null;
@@ -78,10 +67,10 @@ class ConstantArrayType extends ArrayType implements ConstantType
* @param int[] $optionalKeys
*/
public function __construct(
- array $keyTypes,
- array $valueTypes,
- int $nextAutoIndex = 0,
- array $optionalKeys = [],
+ private array $keyTypes,
+ private array $valueTypes,
+ private int $nextAutoIndex = 0,
+ private array $optionalKeys = [],
)
{
assert(count($keyTypes) === count($valueTypes));
@@ -90,11 +79,6 @@ public function __construct(
count($keyTypes) > 0 ? TypeCombinator::union(...$keyTypes) : new NeverType(),
count($valueTypes) > 0 ? TypeCombinator::union(...$valueTypes) : new NeverType(),
);
-
- $this->keyTypes = $keyTypes;
- $this->valueTypes = $valueTypes;
- $this->nextAutoIndex = $nextAutoIndex;
- $this->optionalKeys = $optionalKeys;
}
public function isEmpty(): bool
diff --git a/src/Type/Constant/ConstantArrayTypeAndMethod.php b/src/Type/Constant/ConstantArrayTypeAndMethod.php
index a1a497bb5f..e5bd1caf7b 100644
--- a/src/Type/Constant/ConstantArrayTypeAndMethod.php
+++ b/src/Type/Constant/ConstantArrayTypeAndMethod.php
@@ -10,21 +10,12 @@
class ConstantArrayTypeAndMethod
{
- private ?Type $type;
-
- private ?string $method;
-
- private TrinaryLogic $certainty;
-
private function __construct(
- ?Type $type,
- ?string $method,
- TrinaryLogic $certainty,
+ private ?Type $type,
+ private ?string $method,
+ private TrinaryLogic $certainty,
)
{
- $this->type = $type;
- $this->method = $method;
- $this->certainty = $certainty;
}
public static function createConcrete(
diff --git a/src/Type/Constant/ConstantArrayTypeBuilder.php b/src/Type/Constant/ConstantArrayTypeBuilder.php
index 74e604f4a2..997a31acf5 100644
--- a/src/Type/Constant/ConstantArrayTypeBuilder.php
+++ b/src/Type/Constant/ConstantArrayTypeBuilder.php
@@ -20,35 +20,20 @@ class ConstantArrayTypeBuilder
public const ARRAY_COUNT_LIMIT = 256;
- /** @var array */
- private array $keyTypes;
-
- /** @var array */
- private array $valueTypes;
-
- /** @var array */
- private array $optionalKeys;
-
- private int $nextAutoIndex;
-
private bool $degradeToGeneralArray = false;
/**
- * @param array $keyTypes
+ * @param array $keyTypes
* @param array $valueTypes
* @param array $optionalKeys
*/
private function __construct(
- array $keyTypes,
- array $valueTypes,
- int $nextAutoIndex,
- array $optionalKeys,
+ private array $keyTypes,
+ private array $valueTypes,
+ private int $nextAutoIndex,
+ private array $optionalKeys,
)
{
- $this->keyTypes = $keyTypes;
- $this->valueTypes = $valueTypes;
- $this->nextAutoIndex = $nextAutoIndex;
- $this->optionalKeys = $optionalKeys;
}
public static function createEmpty(): self
diff --git a/src/Type/Constant/ConstantBooleanType.php b/src/Type/Constant/ConstantBooleanType.php
index af32d1418e..0317f30667 100644
--- a/src/Type/Constant/ConstantBooleanType.php
+++ b/src/Type/Constant/ConstantBooleanType.php
@@ -17,13 +17,10 @@ class ConstantBooleanType extends BooleanType implements ConstantScalarType
use ConstantScalarTypeTrait;
- private bool $value;
-
/** @api */
- public function __construct(bool $value)
+ public function __construct(private bool $value)
{
parent::__construct();
- $this->value = $value;
}
public function getValue(): bool
diff --git a/src/Type/Constant/ConstantFloatType.php b/src/Type/Constant/ConstantFloatType.php
index 1b0a8b13c8..2953a60d0a 100644
--- a/src/Type/Constant/ConstantFloatType.php
+++ b/src/Type/Constant/ConstantFloatType.php
@@ -20,13 +20,10 @@ class ConstantFloatType extends FloatType implements ConstantScalarType
use ConstantScalarToBooleanTrait;
use ConstantNumericComparisonTypeTrait;
- private float $value;
-
/** @api */
- public function __construct(float $value)
+ public function __construct(private float $value)
{
parent::__construct();
- $this->value = $value;
}
public function getValue(): float
diff --git a/src/Type/Constant/ConstantIntegerType.php b/src/Type/Constant/ConstantIntegerType.php
index ccea3c5532..9fb760b96e 100644
--- a/src/Type/Constant/ConstantIntegerType.php
+++ b/src/Type/Constant/ConstantIntegerType.php
@@ -21,13 +21,10 @@ class ConstantIntegerType extends IntegerType implements ConstantScalarType
use ConstantScalarToBooleanTrait;
use ConstantNumericComparisonTypeTrait;
- private int $value;
-
/** @api */
- public function __construct(int $value)
+ public function __construct(private int $value)
{
parent::__construct();
- $this->value = $value;
}
public function getValue(): int
diff --git a/src/Type/Constant/ConstantStringType.php b/src/Type/Constant/ConstantStringType.php
index 3bbf2327b9..8a9742dba4 100644
--- a/src/Type/Constant/ConstantStringType.php
+++ b/src/Type/Constant/ConstantStringType.php
@@ -47,16 +47,10 @@ class ConstantStringType extends StringType implements ConstantScalarType
use ConstantScalarTypeTrait;
use ConstantScalarToBooleanTrait;
- private string $value;
-
- private bool $isClassString;
-
/** @api */
- public function __construct(string $value, bool $isClassString = false)
+ public function __construct(private string $value, private bool $isClassString = false)
{
parent::__construct();
- $this->value = $value;
- $this->isClassString = $isClassString;
}
public function getValue(): string
diff --git a/src/Type/DynamicReturnTypeExtensionRegistry.php b/src/Type/DynamicReturnTypeExtensionRegistry.php
index 10f4f0b272..b747ba4a71 100644
--- a/src/Type/DynamicReturnTypeExtensionRegistry.php
+++ b/src/Type/DynamicReturnTypeExtensionRegistry.php
@@ -10,17 +10,6 @@
class DynamicReturnTypeExtensionRegistry
{
- private ReflectionProvider $reflectionProvider;
-
- /** @var DynamicMethodReturnTypeExtension[] */
- private array $dynamicMethodReturnTypeExtensions;
-
- /** @var DynamicStaticMethodReturnTypeExtension[] */
- private array $dynamicStaticMethodReturnTypeExtensions;
-
- /** @var DynamicFunctionReturnTypeExtension[] */
- private array $dynamicFunctionReturnTypeExtensions;
-
/** @var DynamicMethodReturnTypeExtension[][]|null */
private ?array $dynamicMethodReturnTypeExtensionsByClass = null;
@@ -34,10 +23,10 @@ class DynamicReturnTypeExtensionRegistry
*/
public function __construct(
Broker $broker,
- ReflectionProvider $reflectionProvider,
- array $dynamicMethodReturnTypeExtensions,
- array $dynamicStaticMethodReturnTypeExtensions,
- array $dynamicFunctionReturnTypeExtensions,
+ private ReflectionProvider $reflectionProvider,
+ private array $dynamicMethodReturnTypeExtensions,
+ private array $dynamicStaticMethodReturnTypeExtensions,
+ private array $dynamicFunctionReturnTypeExtensions,
)
{
foreach (array_merge($dynamicMethodReturnTypeExtensions, $dynamicStaticMethodReturnTypeExtensions, $dynamicFunctionReturnTypeExtensions) as $extension) {
@@ -47,11 +36,6 @@ public function __construct(
$extension->setBroker($broker);
}
-
- $this->reflectionProvider = $reflectionProvider;
- $this->dynamicMethodReturnTypeExtensions = $dynamicMethodReturnTypeExtensions;
- $this->dynamicStaticMethodReturnTypeExtensions = $dynamicStaticMethodReturnTypeExtensions;
- $this->dynamicFunctionReturnTypeExtensions = $dynamicFunctionReturnTypeExtensions;
}
/**
diff --git a/src/Type/Enum/EnumCaseObjectType.php b/src/Type/Enum/EnumCaseObjectType.php
index 51900f46c8..0785184ae1 100644
--- a/src/Type/Enum/EnumCaseObjectType.php
+++ b/src/Type/Enum/EnumCaseObjectType.php
@@ -19,16 +19,13 @@
class EnumCaseObjectType extends ObjectType
{
- private string $enumCaseName;
-
public function __construct(
string $className,
- string $enumCaseName,
+ private string $enumCaseName,
?ClassReflection $classReflection = null,
)
{
parent::__construct($className, null, $classReflection);
- $this->enumCaseName = $enumCaseName;
}
public function getEnumCaseName(): string
diff --git a/src/Type/FileTypeMapper.php b/src/Type/FileTypeMapper.php
index 8001b04757..5cf91dad8c 100644
--- a/src/Type/FileTypeMapper.php
+++ b/src/Type/FileTypeMapper.php
@@ -49,18 +49,6 @@ class FileTypeMapper
private const SKIP_NODE = 1;
private const POP_TYPE_MAP_STACK = 2;
- private ReflectionProviderProvider $reflectionProviderProvider;
-
- private Parser $phpParser;
-
- private PhpDocStringResolver $phpDocStringResolver;
-
- private PhpDocNodeResolver $phpDocNodeResolver;
-
- private Cache $cache;
-
- private AnonymousClassNameHelper $anonymousClassNameHelper;
-
/** @var NameScope[][] */
private array $memoryCache = [];
@@ -78,20 +66,14 @@ class FileTypeMapper
private array $alreadyProcessedDependentFiles = [];
public function __construct(
- ReflectionProviderProvider $reflectionProviderProvider,
- Parser $phpParser,
- PhpDocStringResolver $phpDocStringResolver,
- PhpDocNodeResolver $phpDocNodeResolver,
- Cache $cache,
- AnonymousClassNameHelper $anonymousClassNameHelper,
+ private ReflectionProviderProvider $reflectionProviderProvider,
+ private Parser $phpParser,
+ private PhpDocStringResolver $phpDocStringResolver,
+ private PhpDocNodeResolver $phpDocNodeResolver,
+ private Cache $cache,
+ private AnonymousClassNameHelper $anonymousClassNameHelper,
)
{
- $this->reflectionProviderProvider = $reflectionProviderProvider;
- $this->phpParser = $phpParser;
- $this->phpDocStringResolver = $phpDocStringResolver;
- $this->phpDocNodeResolver = $phpDocNodeResolver;
- $this->cache = $cache;
- $this->anonymousClassNameHelper = $anonymousClassNameHelper;
}
/** @api */
diff --git a/src/Type/GeneralizePrecision.php b/src/Type/GeneralizePrecision.php
index 8c1395084a..1783057082 100644
--- a/src/Type/GeneralizePrecision.php
+++ b/src/Type/GeneralizePrecision.php
@@ -11,11 +11,8 @@ class GeneralizePrecision
/** @var self[] */
private static array $registry;
- private int $value;
-
- private function __construct(int $value)
+ private function __construct(private int $value)
{
- $this->value = $value;
}
private static function create(int $value): self
diff --git a/src/Type/Generic/GenericClassStringType.php b/src/Type/Generic/GenericClassStringType.php
index 72423edfe9..0568f9c22c 100644
--- a/src/Type/Generic/GenericClassStringType.php
+++ b/src/Type/Generic/GenericClassStringType.php
@@ -22,13 +22,10 @@
class GenericClassStringType extends ClassStringType
{
- private Type $type;
-
/** @api */
- public function __construct(Type $type)
+ public function __construct(private Type $type)
{
parent::__construct();
- $this->type = $type;
}
public function getReferencedClasses(): array
diff --git a/src/Type/Generic/GenericObjectType.php b/src/Type/Generic/GenericObjectType.php
index ef62c37ee8..c7672be92a 100644
--- a/src/Type/Generic/GenericObjectType.php
+++ b/src/Type/Generic/GenericObjectType.php
@@ -28,25 +28,18 @@
class GenericObjectType extends ObjectType
{
- /** @var array */
- private array $types;
-
- private ?ClassReflection $classReflection;
-
/**
* @api
* @param array $types
*/
public function __construct(
string $mainType,
- array $types,
+ private array $types,
?Type $subtractedType = null,
- ?ClassReflection $classReflection = null,
+ private ?ClassReflection $classReflection = null,
)
{
parent::__construct($mainType, $subtractedType, $classReflection);
- $this->types = $types;
- $this->classReflection = $classReflection;
}
public function describe(VerbosityLevel $level): string
diff --git a/src/Type/Generic/TemplateTypeMap.php b/src/Type/Generic/TemplateTypeMap.php
index 77463b63af..b298c9c8c2 100644
--- a/src/Type/Generic/TemplateTypeMap.php
+++ b/src/Type/Generic/TemplateTypeMap.php
@@ -16,21 +16,13 @@ class TemplateTypeMap
private static ?TemplateTypeMap $empty = null;
- /** @var array */
- private array $types;
-
- /** @var array */
- private array $lowerBoundTypes;
-
/**
* @api
* @param array $types
* @param array $lowerBoundTypes
*/
- public function __construct(array $types, array $lowerBoundTypes = [])
+ public function __construct(private array $types, private array $lowerBoundTypes = [])
{
- $this->types = $types;
- $this->lowerBoundTypes = $lowerBoundTypes;
}
public function convertToLowerBoundTypes(): self
diff --git a/src/Type/Generic/TemplateTypeReference.php b/src/Type/Generic/TemplateTypeReference.php
index a88e5c3ce1..260abd3d93 100644
--- a/src/Type/Generic/TemplateTypeReference.php
+++ b/src/Type/Generic/TemplateTypeReference.php
@@ -5,14 +5,8 @@
class TemplateTypeReference
{
- private TemplateType $type;
-
- private TemplateTypeVariance $positionVariance;
-
- public function __construct(TemplateType $type, TemplateTypeVariance $positionVariance)
+ public function __construct(private TemplateType $type, private TemplateTypeVariance $positionVariance)
{
- $this->type = $type;
- $this->positionVariance = $positionVariance;
}
public function getType(): TemplateType
diff --git a/src/Type/Generic/TemplateTypeScope.php b/src/Type/Generic/TemplateTypeScope.php
index f267b9521b..f9a7625720 100644
--- a/src/Type/Generic/TemplateTypeScope.php
+++ b/src/Type/Generic/TemplateTypeScope.php
@@ -7,10 +7,6 @@
class TemplateTypeScope
{
- private ?string $className;
-
- private ?string $functionName;
-
public static function createWithFunction(string $functionName): self
{
return new self(null, $functionName);
@@ -26,10 +22,8 @@ public static function createWithClass(string $className): self
return new self($className, null);
}
- private function __construct(?string $className, ?string $functionName)
+ private function __construct(private ?string $className, private ?string $functionName)
{
- $this->className = $className;
- $this->functionName = $functionName;
}
/** @api */
diff --git a/src/Type/Generic/TemplateTypeVariance.php b/src/Type/Generic/TemplateTypeVariance.php
index 6b6e1b541c..5976cdf866 100644
--- a/src/Type/Generic/TemplateTypeVariance.php
+++ b/src/Type/Generic/TemplateTypeVariance.php
@@ -20,11 +20,8 @@ class TemplateTypeVariance
/** @var self[] */
private static array $registry;
- private int $value;
-
- private function __construct(int $value)
+ private function __construct(private int $value)
{
- $this->value = $value;
}
private static function create(int $value): self
diff --git a/src/Type/IntegerRangeType.php b/src/Type/IntegerRangeType.php
index de8e0620f0..cc1e2035fd 100644
--- a/src/Type/IntegerRangeType.php
+++ b/src/Type/IntegerRangeType.php
@@ -20,19 +20,12 @@
class IntegerRangeType extends IntegerType implements CompoundType
{
- private ?int $min;
-
- private ?int $max;
-
- public function __construct(?int $min, ?int $max)
+ public function __construct(private ?int $min, private ?int $max)
{
// this constructor can be made private when PHP 7.2 is the minimum
parent::__construct();
assert($min === null || $max === null || $min <= $max);
assert($min !== null || $max !== null);
-
- $this->min = $min;
- $this->max = $max;
}
public static function fromInterval(?int $min, ?int $max, int $shift = 0): Type
diff --git a/src/Type/IterableType.php b/src/Type/IterableType.php
index 5257976e0d..421eec91eb 100644
--- a/src/Type/IterableType.php
+++ b/src/Type/IterableType.php
@@ -27,18 +27,12 @@ class IterableType implements CompoundType
use UndecidedBooleanTypeTrait;
use UndecidedComparisonCompoundTypeTrait;
- private Type $keyType;
-
- private Type $itemType;
-
/** @api */
public function __construct(
- Type $keyType,
- Type $itemType,
+ private Type $keyType,
+ private Type $itemType,
)
{
- $this->keyType = $keyType;
- $this->itemType = $itemType;
}
public function getKeyType(): Type
diff --git a/src/Type/MixedType.php b/src/Type/MixedType.php
index 5e9bd7cca4..e0e7d09d8b 100644
--- a/src/Type/MixedType.php
+++ b/src/Type/MixedType.php
@@ -30,13 +30,11 @@ class MixedType implements CompoundType, SubtractableType
use NonGenericTypeTrait;
use UndecidedComparisonCompoundTypeTrait;
- private bool $isExplicitMixed;
-
private ?Type $subtractedType;
/** @api */
public function __construct(
- bool $isExplicitMixed = false,
+ private bool $isExplicitMixed = false,
?Type $subtractedType = null,
)
{
@@ -44,7 +42,6 @@ public function __construct(
$subtractedType = null;
}
- $this->isExplicitMixed = $isExplicitMixed;
$this->subtractedType = $subtractedType;
}
diff --git a/src/Type/NeverType.php b/src/Type/NeverType.php
index 2a207a5558..7631e7ad59 100644
--- a/src/Type/NeverType.php
+++ b/src/Type/NeverType.php
@@ -24,12 +24,9 @@ class NeverType implements CompoundType
use NonGenericTypeTrait;
use UndecidedComparisonCompoundTypeTrait;
- private bool $isExplicit;
-
/** @api */
- public function __construct(bool $isExplicit = false)
+ public function __construct(private bool $isExplicit = false)
{
- $this->isExplicit = $isExplicit;
}
public function isExplicit(): bool
diff --git a/src/Type/ObjectType.php b/src/Type/ObjectType.php
index 491c1a7c7b..d81f55af93 100644
--- a/src/Type/ObjectType.php
+++ b/src/Type/ObjectType.php
@@ -50,12 +50,8 @@ class ObjectType implements TypeWithClassName, SubtractableType
private const EXTRA_OFFSET_CLASSES = ['SimpleXMLElement', 'DOMNodeList', 'Threaded'];
- private string $className;
-
private ?Type $subtractedType;
- private ?ClassReflection $classReflection;
-
/** @var array> */
private static array $superTypes = [];
@@ -78,18 +74,16 @@ class ObjectType implements TypeWithClassName, SubtractableType
/** @api */
public function __construct(
- string $className,
+ private string $className,
?Type $subtractedType = null,
- ?ClassReflection $classReflection = null,
+ private ?ClassReflection $classReflection = null,
)
{
if ($subtractedType instanceof NeverType) {
$subtractedType = null;
}
- $this->className = $className;
$this->subtractedType = $subtractedType;
- $this->classReflection = $classReflection;
}
public static function resetCaches(): void
diff --git a/src/Type/OperatorTypeSpecifyingExtensionRegistry.php b/src/Type/OperatorTypeSpecifyingExtensionRegistry.php
index 48cccc26cb..9061500cf2 100644
--- a/src/Type/OperatorTypeSpecifyingExtensionRegistry.php
+++ b/src/Type/OperatorTypeSpecifyingExtensionRegistry.php
@@ -10,15 +10,12 @@
class OperatorTypeSpecifyingExtensionRegistry
{
- /** @var OperatorTypeSpecifyingExtension[] */
- private array $extensions;
-
/**
* @param OperatorTypeSpecifyingExtension[] $extensions
*/
public function __construct(
Broker $broker,
- array $extensions,
+ private array $extensions,
)
{
foreach ($extensions as $extension) {
@@ -28,7 +25,6 @@ public function __construct(
$extension->setBroker($broker);
}
- $this->extensions = $extensions;
}
/**
diff --git a/src/Type/Php/ArrayCombineFunctionReturnTypeExtension.php b/src/Type/Php/ArrayCombineFunctionReturnTypeExtension.php
index 5a806d6fd8..7b50fe74a2 100644
--- a/src/Type/Php/ArrayCombineFunctionReturnTypeExtension.php
+++ b/src/Type/Php/ArrayCombineFunctionReturnTypeExtension.php
@@ -24,11 +24,8 @@
class ArrayCombineFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension
{
- private PhpVersion $phpVersion;
-
- public function __construct(PhpVersion $phpVersion)
+ public function __construct(private PhpVersion $phpVersion)
{
- $this->phpVersion = $phpVersion;
}
public function isFunctionSupported(FunctionReflection $functionReflection): bool
diff --git a/src/Type/Php/ArrayFillFunctionReturnTypeExtension.php b/src/Type/Php/ArrayFillFunctionReturnTypeExtension.php
index 8ef5cf3cb2..9456a3e92e 100644
--- a/src/Type/Php/ArrayFillFunctionReturnTypeExtension.php
+++ b/src/Type/Php/ArrayFillFunctionReturnTypeExtension.php
@@ -26,11 +26,8 @@ class ArrayFillFunctionReturnTypeExtension implements DynamicFunctionReturnTypeE
private const MAX_SIZE_USE_CONSTANT_ARRAY = 100;
- private PhpVersion $phpVersion;
-
- public function __construct(PhpVersion $phpVersion)
+ public function __construct(private PhpVersion $phpVersion)
{
- $this->phpVersion = $phpVersion;
}
public function isFunctionSupported(FunctionReflection $functionReflection): bool
diff --git a/src/Type/Php/CompactFunctionReturnTypeExtension.php b/src/Type/Php/CompactFunctionReturnTypeExtension.php
index ac5daa83f7..e17ddfb6a5 100644
--- a/src/Type/Php/CompactFunctionReturnTypeExtension.php
+++ b/src/Type/Php/CompactFunctionReturnTypeExtension.php
@@ -17,11 +17,8 @@
class CompactFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension
{
- private bool $checkMaybeUndefinedVariables;
-
- public function __construct(bool $checkMaybeUndefinedVariables)
+ public function __construct(private bool $checkMaybeUndefinedVariables)
{
- $this->checkMaybeUndefinedVariables = $checkMaybeUndefinedVariables;
}
public function isFunctionSupported(FunctionReflection $functionReflection): bool
diff --git a/src/Type/Php/ExplodeFunctionDynamicReturnTypeExtension.php b/src/Type/Php/ExplodeFunctionDynamicReturnTypeExtension.php
index cc50de2d8e..8440f8f2dd 100644
--- a/src/Type/Php/ExplodeFunctionDynamicReturnTypeExtension.php
+++ b/src/Type/Php/ExplodeFunctionDynamicReturnTypeExtension.php
@@ -25,11 +25,8 @@
class ExplodeFunctionDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension
{
- private PhpVersion $phpVersion;
-
- public function __construct(PhpVersion $phpVersion)
+ public function __construct(private PhpVersion $phpVersion)
{
- $this->phpVersion = $phpVersion;
}
public function isFunctionSupported(FunctionReflection $functionReflection): bool
diff --git a/src/Type/Php/FilterVarDynamicReturnTypeExtension.php b/src/Type/Php/FilterVarDynamicReturnTypeExtension.php
index 8d0a3bb699..6340124fef 100644
--- a/src/Type/Php/FilterVarDynamicReturnTypeExtension.php
+++ b/src/Type/Php/FilterVarDynamicReturnTypeExtension.php
@@ -36,17 +36,13 @@ class FilterVarDynamicReturnTypeExtension implements DynamicFunctionReturnTypeEx
*/
private const VALIDATION_FILTER_BITMASK = 0x100;
- private ReflectionProvider $reflectionProvider;
-
private ConstantStringType $flagsString;
/** @var array|null */
private ?array $filterTypeMap = null;
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
-
$this->flagsString = new ConstantStringType('flags');
}
diff --git a/src/Type/Php/GetParentClassDynamicFunctionReturnTypeExtension.php b/src/Type/Php/GetParentClassDynamicFunctionReturnTypeExtension.php
index 990c05dde6..2ba8086d47 100644
--- a/src/Type/Php/GetParentClassDynamicFunctionReturnTypeExtension.php
+++ b/src/Type/Php/GetParentClassDynamicFunctionReturnTypeExtension.php
@@ -22,11 +22,8 @@
class GetParentClassDynamicFunctionReturnTypeExtension implements DynamicFunctionReturnTypeExtension
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function isFunctionSupported(
diff --git a/src/Type/Php/IsCallableFunctionTypeSpecifyingExtension.php b/src/Type/Php/IsCallableFunctionTypeSpecifyingExtension.php
index 4c3b4f6eee..fc832c4737 100644
--- a/src/Type/Php/IsCallableFunctionTypeSpecifyingExtension.php
+++ b/src/Type/Php/IsCallableFunctionTypeSpecifyingExtension.php
@@ -22,13 +22,10 @@
class IsCallableFunctionTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension
{
- private MethodExistsTypeSpecifyingExtension $methodExistsExtension;
-
private TypeSpecifier $typeSpecifier;
- public function __construct(MethodExistsTypeSpecifyingExtension $methodExistsExtension)
+ public function __construct(private MethodExistsTypeSpecifyingExtension $methodExistsExtension)
{
- $this->methodExistsExtension = $methodExistsExtension;
}
public function isFunctionSupported(FunctionReflection $functionReflection, FuncCall $node, TypeSpecifierContext $context): bool
diff --git a/src/Type/Php/JsonThrowOnErrorDynamicReturnTypeExtension.php b/src/Type/Php/JsonThrowOnErrorDynamicReturnTypeExtension.php
index be497ceab7..15de31eda3 100644
--- a/src/Type/Php/JsonThrowOnErrorDynamicReturnTypeExtension.php
+++ b/src/Type/Php/JsonThrowOnErrorDynamicReturnTypeExtension.php
@@ -27,11 +27,8 @@ class JsonThrowOnErrorDynamicReturnTypeExtension implements DynamicFunctionRetur
'json_decode' => 3,
];
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function isFunctionSupported(
diff --git a/src/Type/Php/JsonThrowTypeExtension.php b/src/Type/Php/JsonThrowTypeExtension.php
index 00e9202bc9..21c4cc6920 100644
--- a/src/Type/Php/JsonThrowTypeExtension.php
+++ b/src/Type/Php/JsonThrowTypeExtension.php
@@ -25,11 +25,8 @@ class JsonThrowTypeExtension implements DynamicFunctionThrowTypeExtension
'json_decode' => 3,
];
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function isFunctionSupported(
diff --git a/src/Type/Php/MbSubstituteCharacterDynamicReturnTypeExtension.php b/src/Type/Php/MbSubstituteCharacterDynamicReturnTypeExtension.php
index 8486191761..a379b602a9 100644
--- a/src/Type/Php/MbSubstituteCharacterDynamicReturnTypeExtension.php
+++ b/src/Type/Php/MbSubstituteCharacterDynamicReturnTypeExtension.php
@@ -24,11 +24,8 @@
class MbSubstituteCharacterDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension
{
- private PhpVersion $phpVersion;
-
- public function __construct(PhpVersion $phpVersion)
+ public function __construct(private PhpVersion $phpVersion)
{
- $this->phpVersion = $phpVersion;
}
public function isFunctionSupported(FunctionReflection $functionReflection): bool
diff --git a/src/Type/Php/PregSplitDynamicReturnTypeExtension.php b/src/Type/Php/PregSplitDynamicReturnTypeExtension.php
index d6514fc9c2..53f9ba6e66 100644
--- a/src/Type/Php/PregSplitDynamicReturnTypeExtension.php
+++ b/src/Type/Php/PregSplitDynamicReturnTypeExtension.php
@@ -28,11 +28,8 @@
class PregSplitDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
diff --git a/src/Type/Php/PropertyExistsTypeSpecifyingExtension.php b/src/Type/Php/PropertyExistsTypeSpecifyingExtension.php
index 9d36c7027d..dbee387fc5 100644
--- a/src/Type/Php/PropertyExistsTypeSpecifyingExtension.php
+++ b/src/Type/Php/PropertyExistsTypeSpecifyingExtension.php
@@ -22,13 +22,10 @@
class PropertyExistsTypeSpecifyingExtension implements FunctionTypeSpecifyingExtension, TypeSpecifierAwareExtension
{
- private PropertyReflectionFinder $propertyReflectionFinder;
-
private TypeSpecifier $typeSpecifier;
- public function __construct(PropertyReflectionFinder $propertyReflectionFinder)
+ public function __construct(private PropertyReflectionFinder $propertyReflectionFinder)
{
- $this->propertyReflectionFinder = $propertyReflectionFinder;
}
public function setTypeSpecifier(TypeSpecifier $typeSpecifier): void
diff --git a/src/Type/Php/ReflectionClassConstructorThrowTypeExtension.php b/src/Type/Php/ReflectionClassConstructorThrowTypeExtension.php
index ce794866f7..3efa672a99 100644
--- a/src/Type/Php/ReflectionClassConstructorThrowTypeExtension.php
+++ b/src/Type/Php/ReflectionClassConstructorThrowTypeExtension.php
@@ -19,11 +19,8 @@
class ReflectionClassConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function isStaticMethodSupported(MethodReflection $methodReflection): bool
diff --git a/src/Type/Php/ReflectionFunctionConstructorThrowTypeExtension.php b/src/Type/Php/ReflectionFunctionConstructorThrowTypeExtension.php
index 29e81e70e6..7dd3ba3e22 100644
--- a/src/Type/Php/ReflectionFunctionConstructorThrowTypeExtension.php
+++ b/src/Type/Php/ReflectionFunctionConstructorThrowTypeExtension.php
@@ -18,11 +18,8 @@
class ReflectionFunctionConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function isStaticMethodSupported(MethodReflection $methodReflection): bool
diff --git a/src/Type/Php/ReflectionGetAttributesMethodReturnTypeExtension.php b/src/Type/Php/ReflectionGetAttributesMethodReturnTypeExtension.php
index 8c1e326432..6b4a470920 100644
--- a/src/Type/Php/ReflectionGetAttributesMethodReturnTypeExtension.php
+++ b/src/Type/Php/ReflectionGetAttributesMethodReturnTypeExtension.php
@@ -20,15 +20,11 @@
class ReflectionGetAttributesMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension
{
- /** @var class-string */
- private string $className;
-
/**
* @param class-string $className One of reflection classes: https://www.php.net/manual/en/book.reflection.php
*/
- public function __construct(string $className)
+ public function __construct(private string $className)
{
- $this->className = $className;
}
public function getClass(): string
diff --git a/src/Type/Php/ReflectionMethodConstructorThrowTypeExtension.php b/src/Type/Php/ReflectionMethodConstructorThrowTypeExtension.php
index 44031c1beb..18890c4236 100644
--- a/src/Type/Php/ReflectionMethodConstructorThrowTypeExtension.php
+++ b/src/Type/Php/ReflectionMethodConstructorThrowTypeExtension.php
@@ -19,11 +19,8 @@
class ReflectionMethodConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function isStaticMethodSupported(MethodReflection $methodReflection): bool
diff --git a/src/Type/Php/ReflectionPropertyConstructorThrowTypeExtension.php b/src/Type/Php/ReflectionPropertyConstructorThrowTypeExtension.php
index 07b0c3b351..eed7c7d115 100644
--- a/src/Type/Php/ReflectionPropertyConstructorThrowTypeExtension.php
+++ b/src/Type/Php/ReflectionPropertyConstructorThrowTypeExtension.php
@@ -17,11 +17,8 @@
class ReflectionPropertyConstructorThrowTypeExtension implements DynamicStaticMethodThrowTypeExtension
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function isStaticMethodSupported(MethodReflection $methodReflection): bool
diff --git a/src/Type/Php/TypeSpecifyingFunctionsDynamicReturnTypeExtension.php b/src/Type/Php/TypeSpecifyingFunctionsDynamicReturnTypeExtension.php
index b1dd436f9d..08eaf84e5b 100644
--- a/src/Type/Php/TypeSpecifyingFunctionsDynamicReturnTypeExtension.php
+++ b/src/Type/Php/TypeSpecifyingFunctionsDynamicReturnTypeExtension.php
@@ -19,25 +19,15 @@
class TypeSpecifyingFunctionsDynamicReturnTypeExtension implements DynamicFunctionReturnTypeExtension, TypeSpecifierAwareExtension
{
- private bool $treatPhpDocTypesAsCertain;
-
- private ReflectionProvider $reflectionProvider;
-
private TypeSpecifier $typeSpecifier;
private ?ImpossibleCheckTypeHelper $helper = null;
- /** @var string[] */
- private array $universalObjectCratesClasses;
-
/**
* @param string[] $universalObjectCratesClasses
*/
- public function __construct(ReflectionProvider $reflectionProvider, bool $treatPhpDocTypesAsCertain, array $universalObjectCratesClasses)
+ public function __construct(private ReflectionProvider $reflectionProvider, private bool $treatPhpDocTypesAsCertain, private array $universalObjectCratesClasses)
{
- $this->reflectionProvider = $reflectionProvider;
- $this->treatPhpDocTypesAsCertain = $treatPhpDocTypesAsCertain;
- $this->universalObjectCratesClasses = $universalObjectCratesClasses;
}
public function setTypeSpecifier(TypeSpecifier $typeSpecifier): void
diff --git a/src/Type/StaticType.php b/src/Type/StaticType.php
index 6187bbc544..f94cb14f77 100644
--- a/src/Type/StaticType.php
+++ b/src/Type/StaticType.php
@@ -32,8 +32,6 @@ class StaticType implements TypeWithClassName, SubtractableType
use NonGenericTypeTrait;
use UndecidedComparisonTypeTrait;
- private ClassReflection $classReflection;
-
private ?Type $subtractedType;
private ?ObjectType $staticObjectType = null;
@@ -44,7 +42,7 @@ class StaticType implements TypeWithClassName, SubtractableType
* @api
*/
public function __construct(
- ClassReflection $classReflection,
+ private ClassReflection $classReflection,
?Type $subtractedType = null,
)
{
@@ -52,7 +50,6 @@ public function __construct(
$subtractedType = null;
}
- $this->classReflection = $classReflection;
$this->subtractedType = $subtractedType;
$this->baseClass = $classReflection->getName();
}
diff --git a/src/Type/TypeAlias.php b/src/Type/TypeAlias.php
index 75e879d1b3..10d6c09922 100644
--- a/src/Type/TypeAlias.php
+++ b/src/Type/TypeAlias.php
@@ -10,19 +10,13 @@
class TypeAlias
{
- private TypeNode $typeNode;
-
- private NameScope $nameScope;
-
private ?Type $resolvedType = null;
public function __construct(
- TypeNode $typeNode,
- NameScope $nameScope,
+ private TypeNode $typeNode,
+ private NameScope $nameScope,
)
{
- $this->typeNode = $typeNode;
- $this->nameScope = $nameScope;
}
public static function invalid(): self
diff --git a/src/Type/TypeAliasResolver.php b/src/Type/TypeAliasResolver.php
index 6fb3a5a21f..8b51d13674 100644
--- a/src/Type/TypeAliasResolver.php
+++ b/src/Type/TypeAliasResolver.php
@@ -13,15 +13,6 @@
class TypeAliasResolver
{
- /** @var array */
- private array $globalTypeAliases;
-
- private TypeStringResolver $typeStringResolver;
-
- private TypeNodeResolver $typeNodeResolver;
-
- private ReflectionProvider $reflectionProvider;
-
/** @var array */
private array $resolvedGlobalTypeAliases = [];
@@ -38,16 +29,12 @@ class TypeAliasResolver
* @param array $globalTypeAliases
*/
public function __construct(
- array $globalTypeAliases,
- TypeStringResolver $typeStringResolver,
- TypeNodeResolver $typeNodeResolver,
- ReflectionProvider $reflectionProvider,
+ private array $globalTypeAliases,
+ private TypeStringResolver $typeStringResolver,
+ private TypeNodeResolver $typeNodeResolver,
+ private ReflectionProvider $reflectionProvider,
)
{
- $this->globalTypeAliases = $globalTypeAliases;
- $this->typeStringResolver = $typeStringResolver;
- $this->typeNodeResolver = $typeNodeResolver;
- $this->reflectionProvider = $reflectionProvider;
}
public function hasTypeAlias(string $aliasName, ?string $classNameScope): bool
diff --git a/src/Type/VerbosityLevel.php b/src/Type/VerbosityLevel.php
index 6006d9d7f9..2c7fc721be 100644
--- a/src/Type/VerbosityLevel.php
+++ b/src/Type/VerbosityLevel.php
@@ -21,11 +21,8 @@ class VerbosityLevel
/** @var self[] */
private static array $registry;
- private int $value;
-
- private function __construct(int $value)
+ private function __construct(private int $value)
{
- $this->value = $value;
}
private static function create(int $value): self
diff --git a/tests/PHPStan/Analyser/AnonymousClassNameRule.php b/tests/PHPStan/Analyser/AnonymousClassNameRule.php
index 3f89952ffb..0bba0df265 100644
--- a/tests/PHPStan/Analyser/AnonymousClassNameRule.php
+++ b/tests/PHPStan/Analyser/AnonymousClassNameRule.php
@@ -11,11 +11,8 @@
class AnonymousClassNameRule implements Rule
{
- private ReflectionProvider $reflectionProvider;
-
- public function __construct(ReflectionProvider $reflectionProvider)
+ public function __construct(private ReflectionProvider $reflectionProvider)
{
- $this->reflectionProvider = $reflectionProvider;
}
public function getNodeType(): string
diff --git a/tests/PHPStan/Process/Runnable/RunnableStub.php b/tests/PHPStan/Process/Runnable/RunnableStub.php
index 5363ad024c..08a3701c90 100644
--- a/tests/PHPStan/Process/Runnable/RunnableStub.php
+++ b/tests/PHPStan/Process/Runnable/RunnableStub.php
@@ -9,13 +9,10 @@
class RunnableStub implements Runnable
{
- private string $name;
-
private Deferred $deferred;
- public function __construct(string $name)
+ public function __construct(private string $name)
{
- $this->name = $name;
$this->deferred = new Deferred();
}
diff --git a/tests/PHPStan/Rules/Constants/DirectAlwaysUsedClassConstantsExtensionProvider.php b/tests/PHPStan/Rules/Constants/DirectAlwaysUsedClassConstantsExtensionProvider.php
index b6bfcc8510..861c72d7ab 100644
--- a/tests/PHPStan/Rules/Constants/DirectAlwaysUsedClassConstantsExtensionProvider.php
+++ b/tests/PHPStan/Rules/Constants/DirectAlwaysUsedClassConstantsExtensionProvider.php
@@ -5,15 +5,11 @@
class DirectAlwaysUsedClassConstantsExtensionProvider implements AlwaysUsedClassConstantsExtensionProvider
{
- /** @var AlwaysUsedClassConstantsExtension[] */
- private array $extensions;
-
/**
* @param AlwaysUsedClassConstantsExtension[] $extensions
*/
- public function __construct(array $extensions)
+ public function __construct(private array $extensions)
{
- $this->extensions = $extensions;
}
/**
diff --git a/tests/PHPStan/Rules/Properties/DirectReadWritePropertiesExtensionProvider.php b/tests/PHPStan/Rules/Properties/DirectReadWritePropertiesExtensionProvider.php
index 3a77a94492..6ce75189d7 100644
--- a/tests/PHPStan/Rules/Properties/DirectReadWritePropertiesExtensionProvider.php
+++ b/tests/PHPStan/Rules/Properties/DirectReadWritePropertiesExtensionProvider.php
@@ -5,15 +5,11 @@
class DirectReadWritePropertiesExtensionProvider implements ReadWritePropertiesExtensionProvider
{
- /** @var ReadWritePropertiesExtension[] */
- private array $extensions;
-
/**
* @param ReadWritePropertiesExtension[] $extensions
*/
- public function __construct(array $extensions)
+ public function __construct(private array $extensions)
{
- $this->extensions = $extensions;
}
/**
diff --git a/tests/PHPStan/Tests/AssertionClassMethodTypeSpecifyingExtension.php b/tests/PHPStan/Tests/AssertionClassMethodTypeSpecifyingExtension.php
index 3e4f6e1c1e..4f8adec652 100644
--- a/tests/PHPStan/Tests/AssertionClassMethodTypeSpecifyingExtension.php
+++ b/tests/PHPStan/Tests/AssertionClassMethodTypeSpecifyingExtension.php
@@ -13,11 +13,8 @@
class AssertionClassMethodTypeSpecifyingExtension implements MethodTypeSpecifyingExtension
{
- private ?bool $nullContext = null;
-
- public function __construct(?bool $nullContext)
+ public function __construct(private ?bool $nullContext = null)
{
- $this->nullContext = $nullContext;
}
public function getClass(): string
diff --git a/tests/PHPStan/Tests/AssertionClassStaticMethodTypeSpecifyingExtension.php b/tests/PHPStan/Tests/AssertionClassStaticMethodTypeSpecifyingExtension.php
index febf3e2a82..8a1a20f8c5 100644
--- a/tests/PHPStan/Tests/AssertionClassStaticMethodTypeSpecifyingExtension.php
+++ b/tests/PHPStan/Tests/AssertionClassStaticMethodTypeSpecifyingExtension.php
@@ -13,11 +13,8 @@
class AssertionClassStaticMethodTypeSpecifyingExtension implements StaticMethodTypeSpecifyingExtension
{
- private ?bool $nullContext = null;
-
- public function __construct(?bool $nullContext)
+ public function __construct(private ?bool $nullContext = null)
{
- $this->nullContext = $nullContext;
}
public function getClass(): string