From df5c8bc2b47673838bef345bfb57daa68727cfdb Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Wed, 18 Dec 2024 11:57:21 +0100 Subject: [PATCH] src/ --- src/AbstractFixer.php | 5 +- src/AbstractFunctionReferenceFixer.php | 5 +- src/Cache/FileCacheManager.php | 5 +- src/Config.php | 5 +- src/Console/Command/DescribeCommand.php | 4 +- src/Console/ConfigurationResolver.php | 77 ++++--------------- src/Console/Output/ErrorOutput.php | 5 +- src/Console/Output/Progress/DotsOutput.php | 5 +- src/Console/SelfUpdate/NewVersionChecker.php | 2 +- src/DocBlock/Annotation.php | 23 ++---- src/FileReader.php | 5 +- src/Fixer/Basic/BracesFixer.php | 10 +-- .../Comment/SingleLineCommentStyleFixer.php | 10 +-- src/Fixer/ConfigurableFixerTrait.php | 7 +- src/Fixer/ControlStructure/YodaStyleFixer.php | 6 +- .../LambdaNotUsedImportFixer.php | 15 +--- .../FunctionToConstantFixer.php | 2 +- src/Fixer/ListNotation/ListSyntaxFixer.php | 5 +- src/Fixer/PhpUnit/PhpUnitMockFixer.php | 5 +- src/Fixer/PhpUnit/PhpUnitNamespacedFixer.php | 7 +- .../PhpUnitNoExpectationAnnotationFixer.php | 5 +- .../Phpdoc/AlignMultilineCommentFixer.php | 2 +- src/Fixer/Phpdoc/PhpdocAlignFixer.php | 2 +- src/Fixer/Whitespace/IndentationTypeFixer.php | 5 +- src/FixerConfiguration/FixerOption.php | 14 +--- src/FixerConfiguration/FixerOptionBuilder.php | 16 ++-- src/Linter/ProcessLinter.php | 4 +- src/RuleSet/RuleSets.php | 2 +- src/Runner/LintingFileIterator.php | 5 +- src/Runner/Runner.php | 2 +- src/ToolInfo.php | 7 +- 31 files changed, 68 insertions(+), 204 deletions(-) diff --git a/src/AbstractFixer.php b/src/AbstractFixer.php index fd193f410a9..878ac3d6281 100644 --- a/src/AbstractFixer.php +++ b/src/AbstractFixer.php @@ -27,10 +27,7 @@ */ abstract class AbstractFixer implements FixerInterface { - /** - * @var WhitespacesFixerConfig - */ - protected $whitespacesConfig; + protected WhitespacesFixerConfig $whitespacesConfig; public function __construct() { diff --git a/src/AbstractFunctionReferenceFixer.php b/src/AbstractFunctionReferenceFixer.php index dfddeb51672..b919b217ef5 100644 --- a/src/AbstractFunctionReferenceFixer.php +++ b/src/AbstractFunctionReferenceFixer.php @@ -24,10 +24,7 @@ */ abstract class AbstractFunctionReferenceFixer extends AbstractFixer { - /** - * @var null|FunctionsAnalyzer - */ - private $functionsAnalyzer; + private ?FunctionsAnalyzer $functionsAnalyzer = null; public function isCandidate(Tokens $tokens): bool { diff --git a/src/Cache/FileCacheManager.php b/src/Cache/FileCacheManager.php index d81e91c166e..57b9f3b6f10 100644 --- a/src/Cache/FileCacheManager.php +++ b/src/Cache/FileCacheManager.php @@ -48,10 +48,7 @@ final class FileCacheManager implements CacheManagerInterface private bool $signatureWasUpdated = false; - /** - * @var CacheInterface - */ - private $cache; + private CacheInterface $cache; public function __construct( FileHandlerInterface $handler, diff --git a/src/Config.php b/src/Config.php index 2999a5b2d74..ac59e1438ef 100644 --- a/src/Config.php +++ b/src/Config.php @@ -60,10 +60,7 @@ class Config implements ConfigInterface, ParallelAwareConfigInterface private ParallelConfig $parallelConfig; - /** - * @var null|string - */ - private $phpExecutable; + private ?string $phpExecutable = null; /** * @TODO: 4.0 - update to @PER diff --git a/src/Console/Command/DescribeCommand.php b/src/Console/Command/DescribeCommand.php index 752779e8670..f3ae65690a6 100644 --- a/src/Console/Command/DescribeCommand.php +++ b/src/Console/Command/DescribeCommand.php @@ -61,14 +61,14 @@ final class DescribeCommand extends Command /** * @var ?list */ - private $setNames; + private ?array $setNames = null; private FixerFactory $fixerFactory; /** * @var null|array */ - private $fixers; + private ?array $fixers = null; public function __construct(?FixerFactory $fixerFactory = null) { diff --git a/src/Console/ConfigurationResolver.php b/src/Console/ConfigurationResolver.php index 05c976a8603..496948afbfb 100644 --- a/src/Console/ConfigurationResolver.php +++ b/src/Console/ConfigurationResolver.php @@ -62,49 +62,28 @@ final class ConfigurationResolver public const PATH_MODE_OVERRIDE = 'override'; public const PATH_MODE_INTERSECTION = 'intersection'; - /** - * @var null|bool - */ - private $allowRisky; + private ?bool $allowRisky = null; - /** - * @var null|ConfigInterface - */ - private $config; + private ?ConfigInterface $config = null; - /** - * @var null|string - */ - private $configFile; + private ?string $configFile = null; private string $cwd; private ConfigInterface $defaultConfig; - /** - * @var null|ReporterInterface - */ - private $reporter; + private ?ReporterInterface $reporter = null; - /** - * @var null|bool - */ - private $isStdIn; + private ?bool $isStdIn = null; - /** - * @var null|bool - */ - private $isDryRun; + private ?bool $isDryRun = null; /** * @var null|list */ - private $fixers; + private ?array $fixers = null; - /** - * @var null|bool - */ - private $configFinderIsOverridden; + private ?bool $configFinderIsOverridden = null; private ToolInfoInterface $toolInfo; @@ -128,25 +107,13 @@ final class ConfigurationResolver 'verbosity' => null, ]; - /** - * @var null|string - */ - private $cacheFile; + private ?string $cacheFile = null; - /** - * @var null|CacheManagerInterface - */ - private $cacheManager; + private ?CacheManagerInterface $cacheManager = null; - /** - * @var null|DifferInterface - */ - private $differ; + private ?DifferInterface $differ = null; - /** - * @var null|Directory - */ - private $directory; + private ?Directory $directory = null; /** * @var null|iterable<\SplFileInfo> @@ -155,10 +122,7 @@ final class ConfigurationResolver private ?string $format = null; - /** - * @var null|Linter - */ - private $linter; + private ?Linter $linter = null; /** * @var null|list @@ -170,20 +134,11 @@ final class ConfigurationResolver */ private $progress; - /** - * @var null|RuleSet - */ - private $ruleSet; + private ?RuleSet $ruleSet = null; - /** - * @var null|bool - */ - private $usingCache; + private ?bool $usingCache = null; - /** - * @var null|FixerFactory - */ - private $fixerFactory; + private ?FixerFactory $fixerFactory = null; /** * @param array $options diff --git a/src/Console/Output/ErrorOutput.php b/src/Console/Output/ErrorOutput.php index 2c54e1376b6..a27d477e6b4 100644 --- a/src/Console/Output/ErrorOutput.php +++ b/src/Console/Output/ErrorOutput.php @@ -28,10 +28,7 @@ final class ErrorOutput { private OutputInterface $output; - /** - * @var bool - */ - private $isDecorated; + private bool $isDecorated; public function __construct(OutputInterface $output) { diff --git a/src/Console/Output/Progress/DotsOutput.php b/src/Console/Output/Progress/DotsOutput.php index 221f65afe5e..e2821146c13 100644 --- a/src/Console/Output/Progress/DotsOutput.php +++ b/src/Console/Output/Progress/DotsOutput.php @@ -44,10 +44,7 @@ final class DotsOutput implements ProgressOutputInterface private int $processedFiles = 0; - /** - * @var int - */ - private $symbolsPerLine; + private int $symbolsPerLine; public function __construct(OutputContext $context) { diff --git a/src/Console/SelfUpdate/NewVersionChecker.php b/src/Console/SelfUpdate/NewVersionChecker.php index fc28677cfe2..67ed6e66021 100644 --- a/src/Console/SelfUpdate/NewVersionChecker.php +++ b/src/Console/SelfUpdate/NewVersionChecker.php @@ -30,7 +30,7 @@ final class NewVersionChecker implements NewVersionCheckerInterface /** * @var null|list */ - private $availableVersions; + private ?array $availableVersions = null; public function __construct(GithubClientInterface $githubClient) { diff --git a/src/DocBlock/Annotation.php b/src/DocBlock/Annotation.php index 3e967d57933..c3af8adf344 100644 --- a/src/DocBlock/Annotation.php +++ b/src/DocBlock/Annotation.php @@ -52,43 +52,32 @@ final class Annotation /** * The position of the first line of the annotation in the docblock. - * - * @var int */ - private $start; + private int $start; /** * The position of the last line of the annotation in the docblock. - * - * @var int */ - private $end; + private int $end; /** * The associated tag. - * - * @var null|Tag */ - private $tag; + private ?Tag $tag = null; /** * Lazy loaded, cached types content. - * - * @var null|string */ - private $typesContent; + private ?string $typesContent = null; /** * The cached types. * * @var null|list */ - private $types; + private ?array $types = null; - /** - * @var null|NamespaceAnalysis - */ - private $namespace; + private ?NamespaceAnalysis $namespace = null; /** * @var list diff --git a/src/FileReader.php b/src/FileReader.php index ec36e3a6b20..30eeabef953 100644 --- a/src/FileReader.php +++ b/src/FileReader.php @@ -25,10 +25,7 @@ */ final class FileReader { - /** - * @var null|string - */ - private $stdinContent; + private ?string $stdinContent = null; public static function createSingleton(): self { diff --git a/src/Fixer/Basic/BracesFixer.php b/src/Fixer/Basic/BracesFixer.php index cc1b14dc0ec..5057ae16efd 100644 --- a/src/Fixer/Basic/BracesFixer.php +++ b/src/Fixer/Basic/BracesFixer.php @@ -71,15 +71,9 @@ final class BracesFixer extends AbstractProxyFixer implements ConfigurableFixerI */ public const LINE_SAME = 'same'; - /** - * @var null|BracesPositionFixer - */ - private $bracesPositionFixer; + private ?BracesPositionFixer $bracesPositionFixer = null; - /** - * @var null|ControlStructureContinuationPositionFixer - */ - private $controlStructureContinuationPositionFixer; + private ?ControlStructureContinuationPositionFixer $controlStructureContinuationPositionFixer = null; public function getDefinition(): FixerDefinitionInterface { diff --git a/src/Fixer/Comment/SingleLineCommentStyleFixer.php b/src/Fixer/Comment/SingleLineCommentStyleFixer.php index 2fc38dcb476..e4261fc919f 100644 --- a/src/Fixer/Comment/SingleLineCommentStyleFixer.php +++ b/src/Fixer/Comment/SingleLineCommentStyleFixer.php @@ -45,15 +45,9 @@ final class SingleLineCommentStyleFixer extends AbstractFixer implements Configu /** @use ConfigurableFixerTrait<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration> */ use ConfigurableFixerTrait; - /** - * @var bool - */ - private $asteriskEnabled; + private bool $asteriskEnabled; - /** - * @var bool - */ - private $hashEnabled; + private bool $hashEnabled; public function getDefinition(): FixerDefinitionInterface { diff --git a/src/Fixer/ConfigurableFixerTrait.php b/src/Fixer/ConfigurableFixerTrait.php index 366dfd4af47..b01209946fa 100644 --- a/src/Fixer/ConfigurableFixerTrait.php +++ b/src/Fixer/ConfigurableFixerTrait.php @@ -38,12 +38,9 @@ trait ConfigurableFixerTrait /** * @var null|TFixerComputedConfig */ - protected $configuration; + protected ?array $configuration = null; - /** - * @var null|FixerConfigurationResolverInterface - */ - private $configurationDefinition; + private ?FixerConfigurationResolverInterface $configurationDefinition = null; /** * @param TFixerInputConfig $configuration diff --git a/src/Fixer/ControlStructure/YodaStyleFixer.php b/src/Fixer/ControlStructure/YodaStyleFixer.php index 6046f8f1de1..2bf136ca0fc 100644 --- a/src/Fixer/ControlStructure/YodaStyleFixer.php +++ b/src/Fixer/ControlStructure/YodaStyleFixer.php @@ -55,17 +55,17 @@ final class YodaStyleFixer extends AbstractFixer implements ConfigurableFixerInt /** * @var array */ - private $candidatesMap; + private array $candidatesMap; /** * @var array */ - private $candidateTypesConfiguration; + private array $candidateTypesConfiguration; /** * @var list */ - private $candidateTypes; + private array $candidateTypes; public function getDefinition(): FixerDefinitionInterface { diff --git a/src/Fixer/FunctionNotation/LambdaNotUsedImportFixer.php b/src/Fixer/FunctionNotation/LambdaNotUsedImportFixer.php index e026637c562..80fa74fd484 100644 --- a/src/Fixer/FunctionNotation/LambdaNotUsedImportFixer.php +++ b/src/Fixer/FunctionNotation/LambdaNotUsedImportFixer.php @@ -26,20 +26,11 @@ final class LambdaNotUsedImportFixer extends AbstractFixer { - /** - * @var ArgumentsAnalyzer - */ - private $argumentsAnalyzer; + private ArgumentsAnalyzer $argumentsAnalyzer; - /** - * @var FunctionsAnalyzer - */ - private $functionAnalyzer; + private FunctionsAnalyzer $functionAnalyzer; - /** - * @var TokensAnalyzer - */ - private $tokensAnalyzer; + private TokensAnalyzer $tokensAnalyzer; public function getDefinition(): FixerDefinitionInterface { diff --git a/src/Fixer/LanguageConstruct/FunctionToConstantFixer.php b/src/Fixer/LanguageConstruct/FunctionToConstantFixer.php index 6cfa9f99cd7..157a013e35f 100644 --- a/src/Fixer/LanguageConstruct/FunctionToConstantFixer.php +++ b/src/Fixer/LanguageConstruct/FunctionToConstantFixer.php @@ -47,7 +47,7 @@ final class FunctionToConstantFixer extends AbstractFixer implements Configurabl /** * @var null|array> */ - private static $availableFunctions; + private static ?array $availableFunctions = null; /** * @var array> diff --git a/src/Fixer/ListNotation/ListSyntaxFixer.php b/src/Fixer/ListNotation/ListSyntaxFixer.php index 82bec9173ad..f7b7dbffa2f 100644 --- a/src/Fixer/ListNotation/ListSyntaxFixer.php +++ b/src/Fixer/ListNotation/ListSyntaxFixer.php @@ -43,10 +43,7 @@ final class ListSyntaxFixer extends AbstractFixer implements ConfigurableFixerIn /** @use ConfigurableFixerTrait<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration> */ use ConfigurableFixerTrait; - /** - * @var null|int - */ - private $candidateTokenKind; + private ?int $candidateTokenKind = null; public function getDefinition(): FixerDefinitionInterface { diff --git a/src/Fixer/PhpUnit/PhpUnitMockFixer.php b/src/Fixer/PhpUnit/PhpUnitMockFixer.php index 5e541926197..6afbf7c4b9e 100644 --- a/src/Fixer/PhpUnit/PhpUnitMockFixer.php +++ b/src/Fixer/PhpUnit/PhpUnitMockFixer.php @@ -44,10 +44,7 @@ final class PhpUnitMockFixer extends AbstractPhpUnitFixer implements Configurabl /** @use ConfigurableFixerTrait<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration> */ use ConfigurableFixerTrait; - /** - * @var bool - */ - private $fixCreatePartialMock; + private bool $fixCreatePartialMock; public function getDefinition(): FixerDefinitionInterface { diff --git a/src/Fixer/PhpUnit/PhpUnitNamespacedFixer.php b/src/Fixer/PhpUnit/PhpUnitNamespacedFixer.php index 0a582b09fc0..9d39640bfbc 100644 --- a/src/Fixer/PhpUnit/PhpUnitNamespacedFixer.php +++ b/src/Fixer/PhpUnit/PhpUnitNamespacedFixer.php @@ -45,10 +45,7 @@ final class PhpUnitNamespacedFixer extends AbstractFixer implements Configurable /** @use ConfigurableFixerTrait<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration> */ use ConfigurableFixerTrait; - /** - * @var string - */ - private $originalClassRegEx; + private string $originalClassRegEx; /** * Class Mappings. @@ -60,7 +57,7 @@ final class PhpUnitNamespacedFixer extends AbstractFixer implements Configurable * * @var array Class Mappings */ - private $classMap; + private array $classMap; public function getDefinition(): FixerDefinitionInterface { diff --git a/src/Fixer/PhpUnit/PhpUnitNoExpectationAnnotationFixer.php b/src/Fixer/PhpUnit/PhpUnitNoExpectationAnnotationFixer.php index f50a7c5eef8..8e0113688ee 100644 --- a/src/Fixer/PhpUnit/PhpUnitNoExpectationAnnotationFixer.php +++ b/src/Fixer/PhpUnit/PhpUnitNoExpectationAnnotationFixer.php @@ -51,10 +51,7 @@ final class PhpUnitNoExpectationAnnotationFixer extends AbstractPhpUnitFixer imp /** @use ConfigurableFixerTrait<_AutogeneratedInputConfiguration, _AutogeneratedComputedConfiguration> */ use ConfigurableFixerTrait; - /** - * @var bool - */ - private $fixMessageRegExp; + private bool $fixMessageRegExp; public function getDefinition(): FixerDefinitionInterface { diff --git a/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php b/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php index ff32cd2fe09..6a92e2e3b0a 100644 --- a/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php +++ b/src/Fixer/Phpdoc/AlignMultilineCommentFixer.php @@ -49,7 +49,7 @@ final class AlignMultilineCommentFixer extends AbstractFixer implements Configur /** * @var null|list */ - private $tokenKinds; + private ?array $tokenKinds = null; public function getDefinition(): FixerDefinitionInterface { diff --git a/src/Fixer/Phpdoc/PhpdocAlignFixer.php b/src/Fixer/Phpdoc/PhpdocAlignFixer.php index 8b04bcf7bbd..f248e959a77 100644 --- a/src/Fixer/Phpdoc/PhpdocAlignFixer.php +++ b/src/Fixer/Phpdoc/PhpdocAlignFixer.php @@ -120,7 +120,7 @@ final class PhpdocAlignFixer extends AbstractFixer implements ConfigurableFixerI * * @var array|int */ - private $spacing = 1; + private array|int $spacing = 1; public function getDefinition(): FixerDefinitionInterface { diff --git a/src/Fixer/Whitespace/IndentationTypeFixer.php b/src/Fixer/Whitespace/IndentationTypeFixer.php index d88c74ba0d2..4d332cc13a2 100644 --- a/src/Fixer/Whitespace/IndentationTypeFixer.php +++ b/src/Fixer/Whitespace/IndentationTypeFixer.php @@ -30,10 +30,7 @@ */ final class IndentationTypeFixer extends AbstractFixer implements WhitespacesAwareFixerInterface { - /** - * @var string - */ - private $indent; + private string $indent; public function getDefinition(): FixerDefinitionInterface { diff --git a/src/FixerConfiguration/FixerOption.php b/src/FixerConfiguration/FixerOption.php index 2866bdc1b83..9fc1ec2af38 100644 --- a/src/FixerConfiguration/FixerOption.php +++ b/src/FixerConfiguration/FixerOption.php @@ -22,25 +22,19 @@ final class FixerOption implements FixerOptionInterface private bool $isRequired; - /** - * @var mixed - */ - private $default; + private mixed $default = null; /** * @var null|list */ - private $allowedTypes; + private ?array $allowedTypes = null; /** * @var null|list */ - private $allowedValues; + private ?array $allowedValues = null; - /** - * @var null|\Closure - */ - private $normalizer; + private ?\Closure $normalizer = null; /** * @param mixed $default diff --git a/src/FixerConfiguration/FixerOptionBuilder.php b/src/FixerConfiguration/FixerOptionBuilder.php index 30ba3ed3fb6..8f8bb7405e8 100644 --- a/src/FixerConfiguration/FixerOptionBuilder.php +++ b/src/FixerConfiguration/FixerOptionBuilder.php @@ -23,29 +23,23 @@ final class FixerOptionBuilder /** * @var null|mixed */ - private $default; + private mixed $default = null; private bool $isRequired = true; /** * @var null|list */ - private $allowedTypes; + private ?array $allowedTypes = null; /** * @var null|list */ - private $allowedValues; + private ?array $allowedValues = null; - /** - * @var null|\Closure - */ - private $normalizer; + private ?\Closure $normalizer = null; - /** - * @var null|string - */ - private $deprecationMessage; + private ?string $deprecationMessage = null; public function __construct(string $name, string $description) { diff --git a/src/Linter/ProcessLinter.php b/src/Linter/ProcessLinter.php index 67fbd9391a4..74d276a60e0 100644 --- a/src/Linter/ProcessLinter.php +++ b/src/Linter/ProcessLinter.php @@ -35,10 +35,8 @@ final class ProcessLinter implements LinterInterface /** * Temporary file for code linting. - * - * @var null|string */ - private $temporaryFile; + private ?string $temporaryFile = null; /** * @param null|string $executable PHP executable, null for autodetection diff --git a/src/RuleSet/RuleSets.php b/src/RuleSet/RuleSets.php index 3f3aebe9bfd..e66ced9904a 100644 --- a/src/RuleSet/RuleSets.php +++ b/src/RuleSet/RuleSets.php @@ -26,7 +26,7 @@ final class RuleSets /** * @var null|array */ - private static $setDefinitions; + private static ?array $setDefinitions = null; /** * @return array diff --git a/src/Runner/LintingFileIterator.php b/src/Runner/LintingFileIterator.php index 9b93ed1d6f1..19bd6771034 100644 --- a/src/Runner/LintingFileIterator.php +++ b/src/Runner/LintingFileIterator.php @@ -26,10 +26,7 @@ */ final class LintingFileIterator extends \IteratorIterator implements LintingResultAwareFileIteratorInterface { - /** - * @var null|LintingResultInterface - */ - private $currentResult; + private ?LintingResultInterface $currentResult = null; private LinterInterface $linter; diff --git a/src/Runner/Runner.php b/src/Runner/Runner.php index 732bf72b4c4..9b022572b3c 100644 --- a/src/Runner/Runner.php +++ b/src/Runner/Runner.php @@ -82,7 +82,7 @@ final class Runner /** * @var null|\Traversable */ - private $fileIterator; + private ?\Traversable $fileIterator = null; private int $fileCount; diff --git a/src/ToolInfo.php b/src/ToolInfo.php index 1ad33ce0544..885069f7916 100644 --- a/src/ToolInfo.php +++ b/src/ToolInfo.php @@ -32,12 +32,9 @@ final class ToolInfo implements ToolInfoInterface /** * @var null|array{name: string, version: string, dist: array{reference?: string}} */ - private $composerInstallationDetails; + private ?array $composerInstallationDetails = null; - /** - * @var null|bool - */ - private $isInstalledByComposer; + private ?bool $isInstalledByComposer = null; public function getComposerInstallationDetails(): array {