From dc32e6efe4d29e21ffccb80d44a6b117a569f87e Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 18 Jan 2026 16:56:39 +0100 Subject: [PATCH 1/3] [PHP 8.3] Remove docblock if useless in AddTypeToConstRector to avoid duplicated leftovers" --- .../remove_docblock_as_useless.php.inc | 24 +++++++++++++++++++ .../ClassConst/AddTypeToConstRector.php | 14 ++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 rules-tests/Php83/Rector/ClassConst/AddTypeToConstRector/Fixture/remove_docblock_as_useless.php.inc diff --git a/rules-tests/Php83/Rector/ClassConst/AddTypeToConstRector/Fixture/remove_docblock_as_useless.php.inc b/rules-tests/Php83/Rector/ClassConst/AddTypeToConstRector/Fixture/remove_docblock_as_useless.php.inc new file mode 100644 index 00000000000..a67e6aa03a5 --- /dev/null +++ b/rules-tests/Php83/Rector/ClassConst/AddTypeToConstRector/Fixture/remove_docblock_as_useless.php.inc @@ -0,0 +1,24 @@ + +----- + diff --git a/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php b/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php index dd1f5799d70..6d3f848899e 100644 --- a/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php +++ b/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php @@ -21,12 +21,16 @@ use PhpParser\Node\Stmt\ClassConst; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ReflectionProvider; +use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; +use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\Configuration\Parameter\FeatureFlags; +use Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover; use Rector\PHPStanStaticTypeMapper\Enum\TypeKind; use Rector\Rector\AbstractRector; use Rector\StaticTypeMapper\StaticTypeMapper; use Rector\ValueObject\PhpVersionFeature; use Rector\VersionBonding\Contract\MinPhpVersionInterface; +use Symplify\CodingStandard\DocBlock\UselessDocBlockCleaner; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -37,7 +41,9 @@ final class AddTypeToConstRector extends AbstractRector implements MinPhpVersion { public function __construct( private readonly ReflectionProvider $reflectionProvider, - private readonly StaticTypeMapper $staticTypeMapper + private readonly StaticTypeMapper $staticTypeMapper, + private readonly VarTagRemover $varTagRemover, + private readonly PhpDocInfoFactory $phpDocInfoFactory, ) { } @@ -130,6 +136,12 @@ public function refactor(Node $node): ?Class_ $classConst->type = $valueType; $hasChanged = true; + + $classConstPhpDocInfo = $this->phpDocInfoFactory->createFromNode($classConst); + + if ($classConstPhpDocInfo instanceof PhpDocInfo) { + $this->varTagRemover->removeVarTagIfUseless($classConstPhpDocInfo, $classConst); + } } if (! $hasChanged) { From f4a994bd696dd3dc2e7cdc2329dc87f13e763564 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 18 Jan 2026 16:59:23 +0100 Subject: [PATCH 2/3] fixup! [PHP 8.3] Remove docblock if useless in AddTypeToConstRector to avoid duplicated leftovers" --- rules/Php83/Rector/ClassConst/AddTypeToConstRector.php | 1 - 1 file changed, 1 deletion(-) diff --git a/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php b/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php index 6d3f848899e..d6157bcdbd7 100644 --- a/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php +++ b/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php @@ -30,7 +30,6 @@ use Rector\StaticTypeMapper\StaticTypeMapper; use Rector\ValueObject\PhpVersionFeature; use Rector\VersionBonding\Contract\MinPhpVersionInterface; -use Symplify\CodingStandard\DocBlock\UselessDocBlockCleaner; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; From ecdf63b33f52475bd9da9d175cd012f27c634dd5 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 18 Jan 2026 17:02:30 +0100 Subject: [PATCH 3/3] [PHP 8.3] Make use of typed constants --- build/build-preload.php | 14 +- rector.php | 6 +- .../NodeAnalyzer/ArgumentAddingScope.php | 9 +- .../ReplaceArgumentDefaultValue.php | 5 +- rules/Assert/Enum/AssertClassName.php | 10 +- .../Carbon/NodeFactory/CarbonCallFactory.php | 6 +- .../FuncCall/DateFuncCallToCarbonRector.php | 2 +- .../NodeAnalyzer/LocalPropertyAnalyzer.php | 5 +- .../ThrowWithPreviousExceptionRector.php | 5 +- .../Rector/Concat/JoinStringConcatRector.php | 8 +- .../ForRepeatedCountToOwnVariableRector.php | 5 +- .../Rector/FuncCall/SetTypeToCastRector.php | 2 +- .../FuncCall/SimplifyRegexPatternRector.php | 2 +- .../FuncCall/SimplifyStrposLowerRector.php | 3 +- .../SimplifyUselessVariableRector.php | 3 +- .../If_/SimplifyIfElseToTernaryRector.php | 5 +- .../AbsolutizeRequireAndIncludePathRector.php | 3 +- .../ReservedClassNameImportSkipVoter.php | 2 +- .../NodeAnalyzer/UseImportNameMatcher.php | 4 +- .../CatchExceptionNameMatchingTypeRector.php | 3 +- .../EncapsedStringsToSprintfRector.php | 5 +- ...VersionCompareFuncCallToConstantRector.php | 2 +- .../String_/SimplifyQuoteEscapeRector.php | 6 +- ...assKeywordForClassNameResolutionRector.php | 3 +- .../ValueObject/ObjectMagicMethods.php | 2 +- .../Guard/StandaloneTypeRemovalGuard.php | 2 +- .../Rector/Cast/RecastingRemovalRector.php | 2 +- .../RemoveNonExistingVarAnnotationRector.php | 2 +- .../SideEffect/SideEffectNodeDetector.php | 2 +- .../InflectorSingularResolver.php | 13 +- .../Guard/BreakingVariableRenameGuard.php | 3 +- rules/Naming/Naming/PropertyNaming.php | 15 +- ...iableToMatchMethodCallReturnTypeRector.php | 6 +- ...iableToMatchMethodCallReturnTypeRector.php | 2 +- rules/Naming/RectorNamingInflector.php | 3 +- .../ReplaceHttpServerVarsByServerRector.php | 2 +- .../StringClassNameToClassConstantRector.php | 3 +- rules/Php55/RegexMatcher.php | 8 +- rules/Php70/Enum/BattleshipCompareOrder.php | 10 +- rules/Php70/EregToPcreTransformer.php | 15 +- .../Rector/FuncCall/CallUserMethodRector.php | 2 +- .../Rector/FuncCall/EregToPregMatchRector.php | 2 +- .../Rector/FuncCall/MultiDirnameRector.php | 5 +- .../Rector/FuncCall/RandomFunctionRector.php | 2 +- .../ExceptionHandlerTypehintRector.php | 3 +- .../NodeFactory/AnonymousFunctionFactory.php | 3 +- ...laceEachAssignmentWithKeyCurrentRector.php | 5 +- .../SensitiveConstantNameRector.php | 2 +- .../FuncCall/ArrayKeyFirstLastRector.php | 12 +- .../Rector/FuncCall/RegexDashEscapeRector.php | 9 +- .../Php73/Rector/FuncCall/SetCookieRector.php | 2 +- .../FuncCall/StringifyStrNeedlesRector.php | 2 +- .../String_/SensitiveHereNowDocRector.php | 5 +- .../AddLiteralSeparatorToNumberRector.php | 3 +- rules/Php80/Enum/MatchKind.php | 20 +- .../StrncmpMatchAndRefactor.php | 5 +- .../Rector/Class_/AttributeValueResolver.php | 3 +- ...ertyAssignToConstructorPromotionRector.php | 9 +- .../Class_/StringableForToStringRector.php | 5 +- .../NotIdentical/MbStrContainsRector.php | 2 +- .../Rector/NotIdentical/StrContainsRector.php | 2 +- rules/Php81/Enum/AttributeName.php | 8 +- .../Enum/NameNullToStrictNullFunctionMap.php | 2 +- rules/Php81/NodeFactory/EnumFactory.php | 6 +- .../Class_/SpatieEnumClassToEnumRector.php | 5 +- .../MyCLabsMethodCallToEnumConstRector.php | 2 +- .../SpatieEnumMethodCallToEnumConstRector.php | 7 +- ...MyCLabsConstructorCallToEnumFromRector.php | 4 +- .../AddSensitiveParameterAttributeRector.php | 2 +- .../Rector/BooleanAnd/JsonValidateRector.php | 2 +- ...rideAttributeToOverriddenMethodsRector.php | 8 +- .../ArrayDimFetch/ArrayFirstLastRector.php | 10 +- .../Privatization/Guard/LaravelModelGuard.php | 6 +- .../Guard/ParentClassMagicCallGuard.php | 2 +- .../TypeManipulator/TypeNormalizer.php | 5 +- rules/Transform/Enum/MagicPropertyHandler.php | 8 +- .../Enum/NativeFuncCallPositions.php | 2 +- .../NodeTypeAnalyzer/DetailedTypeAnalyzer.php | 3 +- ...ddMethodCallBasedStrictParamTypeRector.php | 5 +- ...amTypeBasedOnPHPUnitDataProviderRector.php | 5 +- .../AddParamTypeFromPropertyTypeRector.php | 5 +- .../AddParamTypeSplFixedArrayRector.php | 2 +- .../TypedPropertyFromAssignsRector.php | 3 +- .../IncreaseDeclareStrictTypesRector.php | 2 +- .../ValueObject/DataProviderNodes.php | 3 +- .../Enum/NetteClassName.php | 5 +- .../Enum/TestClassName.php | 5 +- .../ConstantArrayTypeGeneralizer.php | 2 +- scripts/no-php-file-in-fixtures.php | 2 +- src/Application/ApplicationFileProcessor.php | 5 +- src/Application/VersionResolver.php | 11 +- .../Attributes/AttributeMirrorer.php | 2 +- .../PhpDocInfo/PhpDocInfo.php | 2 +- .../PhpDocManipulator/PhpDocTypeChanger.php | 4 +- .../PhpDocParser/BetterPhpDocParser.php | 6 +- .../DoctrineAnnotationDecorator.php | 14 +- .../Printer/DocBlockInliner.php | 6 +- .../Printer/PhpDocInfoPrinter.php | 13 +- .../DoctrineAnnotation/SilentKeyMap.php | 2 +- .../ValueObject/NodeTypes.php | 4 +- .../ValueObject/PhpDocAttributeKey.php | 23 +- src/Caching/Enum/CacheKey.php | 10 +- .../Output/ConsoleOutputFormatter.php | 8 +- .../Output/GitHubOutputFormatter.php | 4 +- .../Output/GitlabOutputFormatter.php | 12 +- .../Output/JUnitOutputFormatter.php | 16 +- .../Output/JsonOutputFormatter.php | 5 +- .../ValueObject/RectorWithLineChange.php | 10 +- src/Config/Level/CodeQualityLevel.php | 4 +- src/Config/Level/CodingStyleLevel.php | 4 +- src/Config/Level/DeadCodeLevel.php | 2 +- .../Level/TypeDeclarationDocblocksLevel.php | 2 +- src/Config/Level/TypeDeclarationLevel.php | 2 +- src/Configuration/Option.php | 166 ++--- src/Configuration/PhpLevelSetResolver.php | 2 +- src/Configuration/RectorConfigBuilder.php | 5 +- src/Console/Command/WorkerCommand.php | 5 +- src/Console/ConsoleApplication.php | 5 +- src/Console/ExitCode.php | 15 +- .../Formatter/ColorConsoleDiffFormatter.php | 12 +- src/CustomRules/SimpleNodeDumper.php | 2 +- .../LazyContainerFactory.php | 26 +- src/Enum/ClassName.php | 40 +- src/Enum/Config/Defaults.php | 5 +- src/Enum/LaravelClassName.php | 6 +- src/Enum/ObjectReference.php | 15 +- src/FileSystem/FilePathHelper.php | 11 +- src/FileSystem/InitFilePathsResolver.php | 3 +- src/Git/RepositoryHelper.php | 3 +- src/NodeAnalyzer/CallAnalyzer.php | 2 +- src/NodeAnalyzer/DoctrineEntityAnalyzer.php | 2 +- src/NodeAnalyzer/ParamAnalyzer.php | 7 +- src/NodeAnalyzer/PropertyFetchAnalyzer.php | 5 +- src/NodeAnalyzer/ScopeAnalyzer.php | 2 +- src/NodeAnalyzer/TerminatedNodeAnalyzer.php | 6 +- src/NodeManipulator/PropertyManipulator.php | 2 +- src/NodeNameResolver/NodeNameResolver.php | 2 +- .../Regex/RegexPatternDetector.php | 4 +- .../ValueObject/ControlStructure.php | 2 +- .../PHPStanServicesFactory.php | 5 +- src/NodeTypeResolver/Node/AttributeKey.php | 230 ++---- src/NodeTypeResolver/NodeTypeResolver.php | 5 +- .../NodeTypeResolver/CastTypeResolver.php | 2 +- .../Scope/PHPStanNodeScopeResolver.php | 5 +- src/PHPStanStaticTypeMapper/Enum/TypeKind.php | 20 +- .../TypeMapper/ArrayTypeMapper.php | 5 +- .../TypeMapper/StrictMixedTypeMapper.php | 5 +- .../TypeMapper/VoidTypeMapper.php | 5 +- .../Application/ParallelFileProcessor.php | 9 +- .../Command/WorkerCommandLineFactory.php | 5 +- src/Parallel/ValueObject/Bridge.php | 40 +- src/Parallel/ValueObject/BridgeItem.php | 61 +- src/Php/PhpVersionProvider.php | 3 +- .../AttributeArrayNameInliner.php | 2 +- ...notationToDeprecatedAttributeConverter.php | 6 +- src/PhpAttribute/Enum/DocTagNodeState.php | 5 +- .../PhpDocParser/PhpDocNodeTraverser.php | 12 +- .../ValueObject/PhpDocAttributeKey.php | 10 +- src/PhpDocParser/ValueObject/AttributeKey.php | 26 +- src/PhpParser/Enum/NodeGroup.php | 4 +- src/PhpParser/Node/AssignAndBinaryMap.php | 4 +- src/PhpParser/Node/NodeFactory.php | 5 +- src/PhpParser/NodeTransformer.php | 3 +- src/PhpParser/Parser/InlineCodeParser.php | 21 +- .../Printer/BetterStandardPrinter.php | 3 +- src/Rector/AbstractRector.php | 5 +- src/Set/Enum/SetGroup.php | 33 +- src/Set/ValueObject/ComposerTriggeredSet.php | 3 +- src/Set/ValueObject/LevelSetList.php | 103 +-- src/Set/ValueObject/SetList.php | 154 +--- .../Mapper/ScalarStringToTypeMapper.php | 2 +- src/Util/MemoryLimiter.php | 3 +- src/Util/NewLineSplitter.php | 3 +- src/Util/NodePrinter.php | 6 +- src/Validation/RectorAssert.php | 19 +- src/ValueObject/MethodName.php | 66 +- src/ValueObject/PhpVersion.php | 117 +--- src/ValueObject/PhpVersionFeature.php | 661 ++++-------------- src/ValueObject/PolyfillPackage.php | 15 +- src/ValueObject/Reporting/FileDiff.php | 10 +- src/ValueObject/Visibility.php | 47 +- .../Command/WorkerCommandLineFactoryTest.php | 15 +- .../PhpDocNodeTraverserTest.php | 5 +- utils/Compiler/Unprefixer.php | 3 +- .../MoveAbstractRectorToChildrenRector.php | 2 +- 185 files changed, 754 insertions(+), 1977 deletions(-) diff --git a/build/build-preload.php b/build/build-preload.php index de87adabbbc..c7c62f96787 100755 --- a/build/build-preload.php +++ b/build/build-preload.php @@ -43,10 +43,7 @@ final class PreloadBuilder { - /** - * @var string - */ - private const PRELOAD_FILE_TEMPLATE = <<<'CODE_SAMPLE' + private const string PRELOAD_FILE_TEMPLATE = <<<'CODE_SAMPLE' withRootFiles() ->withImportNames(removeUnusedImports: true) - ->withRules([RemoveRefactorDuplicatedNodeInstanceCheckRector::class, AddSeeTestAnnotationRector::class]) + ->withRules([ + RemoveRefactorDuplicatedNodeInstanceCheckRector::class, AddSeeTestAnnotationRector::class, + AddTypeToConstRector::class, + ]) ->withSkip([ StringClassNameToClassConstantRector::class, // tests diff --git a/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php b/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php index c51cfff7c7c..a24edef7aa5 100644 --- a/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php +++ b/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php @@ -16,21 +16,18 @@ { /** * @api - * @var string */ - public const SCOPE_PARENT_CALL = 'parent_call'; + public const string SCOPE_PARENT_CALL = 'parent_call'; /** * @api - * @var string */ - public const SCOPE_METHOD_CALL = 'method_call'; + public const string SCOPE_METHOD_CALL = 'method_call'; /** * @api - * @var string */ - public const SCOPE_CLASS_METHOD = 'class_method'; + public const string SCOPE_CLASS_METHOD = 'class_method'; public function __construct( private NodeNameResolver $nodeNameResolver diff --git a/rules/Arguments/ValueObject/ReplaceArgumentDefaultValue.php b/rules/Arguments/ValueObject/ReplaceArgumentDefaultValue.php index 5a93351851d..233669c03e7 100644 --- a/rules/Arguments/ValueObject/ReplaceArgumentDefaultValue.php +++ b/rules/Arguments/ValueObject/ReplaceArgumentDefaultValue.php @@ -10,10 +10,7 @@ final readonly class ReplaceArgumentDefaultValue implements ReplaceArgumentDefaultValueInterface { - /** - * @var string - */ - public const ANY_VALUE_BEFORE = '*ANY_VALUE_BEFORE*'; + public const string ANY_VALUE_BEFORE = '*ANY_VALUE_BEFORE*'; /** * @param int<0, max> $position diff --git a/rules/Assert/Enum/AssertClassName.php b/rules/Assert/Enum/AssertClassName.php index 47160416bdf..5efd9b28779 100644 --- a/rules/Assert/Enum/AssertClassName.php +++ b/rules/Assert/Enum/AssertClassName.php @@ -6,13 +6,7 @@ final class AssertClassName { - /** - * @var string - */ - public const WEBMOZART = 'Webmozart\Assert\Assert'; + public const string WEBMOZART = 'Webmozart\Assert\Assert'; - /** - * @var string - */ - public const BEBERLEI = 'Assert\Assertion'; + public const string BEBERLEI = 'Assert\Assertion'; } diff --git a/rules/Carbon/NodeFactory/CarbonCallFactory.php b/rules/Carbon/NodeFactory/CarbonCallFactory.php index 3b6145bad2b..3d0180a2ee2 100644 --- a/rules/Carbon/NodeFactory/CarbonCallFactory.php +++ b/rules/Carbon/NodeFactory/CarbonCallFactory.php @@ -16,16 +16,14 @@ final class CarbonCallFactory { /** - * @var string * @see https://regex101.com/r/LLMrFw/1 */ - private const PLUS_MINUS_COUNT_REGEX = '#(?\+|-)(\\s+)?(?\\d+)(\s+)?(?seconds|second|sec|minutes|minute|min|hours|hour|days|day|weeks|week|months|month|years|year)#'; + private const string PLUS_MINUS_COUNT_REGEX = '#(?\+|-)(\\s+)?(?\\d+)(\s+)?(?seconds|second|sec|minutes|minute|min|hours|hour|days|day|weeks|week|months|month|years|year)#'; /** - * @var string * @see https://regex101.com/r/IhxHTO/1 */ - private const STATIC_DATE_REGEX = '#now|yesterday|today|tomorrow#'; + private const string STATIC_DATE_REGEX = '#now|yesterday|today|tomorrow#'; public function createFromDateTimeString( FullyQualified $carbonFullyQualified, diff --git a/rules/Carbon/Rector/FuncCall/DateFuncCallToCarbonRector.php b/rules/Carbon/Rector/FuncCall/DateFuncCallToCarbonRector.php index 479bb6ea713..e0d311b8604 100644 --- a/rules/Carbon/Rector/FuncCall/DateFuncCallToCarbonRector.php +++ b/rules/Carbon/Rector/FuncCall/DateFuncCallToCarbonRector.php @@ -24,7 +24,7 @@ */ final class DateFuncCallToCarbonRector extends AbstractRector { - private const TIME_UNITS = [ + private const array TIME_UNITS = [ ['weeks', 604800], ['days', 86400], ['hours', 3600], diff --git a/rules/CodeQuality/NodeAnalyzer/LocalPropertyAnalyzer.php b/rules/CodeQuality/NodeAnalyzer/LocalPropertyAnalyzer.php index 5da0da35e68..07332188075 100644 --- a/rules/CodeQuality/NodeAnalyzer/LocalPropertyAnalyzer.php +++ b/rules/CodeQuality/NodeAnalyzer/LocalPropertyAnalyzer.php @@ -28,10 +28,7 @@ final readonly class LocalPropertyAnalyzer { - /** - * @var string - */ - private const LARAVEL_COLLECTION_CLASS = 'Illuminate\Support\Collection'; + private const string LARAVEL_COLLECTION_CLASS = 'Illuminate\Support\Collection'; public function __construct( private SimpleCallableNodeTraverser $simpleCallableNodeTraverser, diff --git a/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php b/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php index 90109dc2b8b..b534616713f 100644 --- a/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php +++ b/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php @@ -29,10 +29,7 @@ */ final class ThrowWithPreviousExceptionRector extends AbstractRector { - /** - * @var int - */ - private const DEFAULT_EXCEPTION_ARGUMENT_POSITION = 2; + private const int DEFAULT_EXCEPTION_ARGUMENT_POSITION = 2; public function __construct( private readonly ReflectionProvider $reflectionProvider diff --git a/rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php b/rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php index 8c8d7177c87..60103f05bba 100644 --- a/rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php +++ b/rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php @@ -18,17 +18,13 @@ */ final class JoinStringConcatRector extends AbstractRector { - /** - * @var int - */ - private const LINE_BREAK_POINT = 100; + private const int LINE_BREAK_POINT = 100; /** - * @var string * @see https://regex101.com/r/VaXM1t/1 * @see https://stackoverflow.com/questions/4147646/determine-if-utf-8-text-is-all-ascii */ - private const ASCII_REGEX = '#[^\x00-\x7F]#'; + private const string ASCII_REGEX = '#[^\x00-\x7F]#'; public function getRuleDefinition(): RuleDefinition { diff --git a/rules/CodeQuality/Rector/For_/ForRepeatedCountToOwnVariableRector.php b/rules/CodeQuality/Rector/For_/ForRepeatedCountToOwnVariableRector.php index 3d205ab88a3..0b751bcd5c9 100644 --- a/rules/CodeQuality/Rector/For_/ForRepeatedCountToOwnVariableRector.php +++ b/rules/CodeQuality/Rector/For_/ForRepeatedCountToOwnVariableRector.php @@ -24,10 +24,7 @@ */ final class ForRepeatedCountToOwnVariableRector extends AbstractRector { - /** - * @var string - */ - private const COUNTER_NAME = 'counter'; + private const string COUNTER_NAME = 'counter'; public function getRuleDefinition(): RuleDefinition { diff --git a/rules/CodeQuality/Rector/FuncCall/SetTypeToCastRector.php b/rules/CodeQuality/Rector/FuncCall/SetTypeToCastRector.php index ffe3dfcac71..9bb2e01fd80 100644 --- a/rules/CodeQuality/Rector/FuncCall/SetTypeToCastRector.php +++ b/rules/CodeQuality/Rector/FuncCall/SetTypeToCastRector.php @@ -28,7 +28,7 @@ final class SetTypeToCastRector extends AbstractRector /** * @var array> */ - private const TYPE_TO_CAST = [ + private const array TYPE_TO_CAST = [ 'array' => Array_::class, 'bool' => Bool_::class, 'boolean' => Bool_::class, diff --git a/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php b/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php index e245aefc7d7..4c29d7a9853 100644 --- a/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php +++ b/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php @@ -23,7 +23,7 @@ final class SimplifyRegexPatternRector extends AbstractRector * * @var array */ - private const COMPLEX_PATTERN_TO_SIMPLE = [ + private const array COMPLEX_PATTERN_TO_SIMPLE = [ '[0-9]' => "\d", '[a-zA-Z0-9_]' => "\w", '[A-Za-z0-9_]' => "\w", diff --git a/rules/CodeQuality/Rector/FuncCall/SimplifyStrposLowerRector.php b/rules/CodeQuality/Rector/FuncCall/SimplifyStrposLowerRector.php index 8df0f8e277f..62bb4f07eac 100644 --- a/rules/CodeQuality/Rector/FuncCall/SimplifyStrposLowerRector.php +++ b/rules/CodeQuality/Rector/FuncCall/SimplifyStrposLowerRector.php @@ -19,10 +19,9 @@ final class SimplifyStrposLowerRector extends AbstractRector { /** - * @var string * @see https://regex101.com/r/Jokjt8/1 */ - private const UPPERCASE_REGEX = '#[A-Z]#'; + private const string UPPERCASE_REGEX = '#[A-Z]#'; public function getRuleDefinition(): RuleDefinition { diff --git a/rules/CodeQuality/Rector/FunctionLike/SimplifyUselessVariableRector.php b/rules/CodeQuality/Rector/FunctionLike/SimplifyUselessVariableRector.php index 263d194d155..ee5d6b8c685 100644 --- a/rules/CodeQuality/Rector/FunctionLike/SimplifyUselessVariableRector.php +++ b/rules/CodeQuality/Rector/FunctionLike/SimplifyUselessVariableRector.php @@ -32,9 +32,8 @@ final class SimplifyUselessVariableRector extends AbstractRector implements Conf { /** * @api - * @var string */ - public const ONLY_DIRECT_ASSIGN = 'only_direct_assign'; + public const string ONLY_DIRECT_ASSIGN = 'only_direct_assign'; private bool $onlyDirectAssign = false; diff --git a/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php b/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php index 449af2cdc22..34713e3e9e6 100644 --- a/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php +++ b/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php @@ -25,10 +25,7 @@ */ final class SimplifyIfElseToTernaryRector extends AbstractRector { - /** - * @var int - */ - private const LINE_LENGTH_LIMIT = 120; + private const int LINE_LENGTH_LIMIT = 120; public function __construct( private readonly BetterStandardPrinter $betterStandardPrinter, diff --git a/rules/CodeQuality/Rector/Include_/AbsolutizeRequireAndIncludePathRector.php b/rules/CodeQuality/Rector/Include_/AbsolutizeRequireAndIncludePathRector.php index 93a9ae843ec..d34a8294716 100644 --- a/rules/CodeQuality/Rector/Include_/AbsolutizeRequireAndIncludePathRector.php +++ b/rules/CodeQuality/Rector/Include_/AbsolutizeRequireAndIncludePathRector.php @@ -22,10 +22,9 @@ final class AbsolutizeRequireAndIncludePathRector extends AbstractRector { /** - * @var string * @see https://regex101.com/r/N8oLqv/1 */ - private const WINDOWS_DRIVE_REGEX = '#^[a-zA-z]\:[\/\\\]#'; + private const string WINDOWS_DRIVE_REGEX = '#^[a-zA-z]\:[\/\\\]#'; public function __construct( private readonly ValueResolver $valueResolver diff --git a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/ReservedClassNameImportSkipVoter.php b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/ReservedClassNameImportSkipVoter.php index 34363397893..7e618f832fe 100644 --- a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/ReservedClassNameImportSkipVoter.php +++ b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/ReservedClassNameImportSkipVoter.php @@ -14,7 +14,7 @@ /** * @var string[] */ - private const RESERVED_CLASS_NAMES = [ + private const array RESERVED_CLASS_NAMES = [ 'bool', 'false', 'float', diff --git a/rules/CodingStyle/NodeAnalyzer/UseImportNameMatcher.php b/rules/CodingStyle/NodeAnalyzer/UseImportNameMatcher.php index b002461f60d..f1a53de2cc7 100644 --- a/rules/CodingStyle/NodeAnalyzer/UseImportNameMatcher.php +++ b/rules/CodingStyle/NodeAnalyzer/UseImportNameMatcher.php @@ -19,12 +19,10 @@ final readonly class UseImportNameMatcher { /** - * @var string - * * @see https://regex101.com/r/ZxFSlc/1 for last name, eg: Entity and UniqueEntity * @see https://regex101.com/r/OLO0Un/1 for inside namespace, eg: ORM for ORM\Id or ORM\Column */ - private const SHORT_NAME_REGEX = '#^%s(\\\\[\w]+)?$#i'; + private const string SHORT_NAME_REGEX = '#^%s(\\\\[\w]+)?$#i'; public function __construct( private BetterNodeFinder $betterNodeFinder, diff --git a/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php b/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php index 3048f8cba55..6502f7b67a8 100644 --- a/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php +++ b/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php @@ -32,10 +32,9 @@ final class CatchExceptionNameMatchingTypeRector extends AbstractRector { /** - * @var string * @see https://regex101.com/r/xmfMAX/1 */ - private const STARTS_WITH_ABBREVIATION_REGEX = '#^([A-Za-z]+?)([A-Z]{1}[a-z]{1})([A-Za-z]*)#'; + private const string STARTS_WITH_ABBREVIATION_REGEX = '#^([A-Za-z]+?)([A-Z]{1}[a-z]{1})([A-Za-z]*)#'; public function __construct( private readonly PropertyNaming $propertyNaming, diff --git a/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php b/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php index 656d159e88a..dd176f40d0c 100644 --- a/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php +++ b/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php @@ -30,14 +30,13 @@ final class EncapsedStringsToSprintfRector extends AbstractRector implements Con { /** * @api - * @var string */ - public const ALWAYS = 'always'; + public const string ALWAYS = 'always'; /** * @var array>> */ - private const FORMAT_SPECIFIERS = [ + private const array FORMAT_SPECIFIERS = [ '%s' => ['PHPStan\Type\StringType'], '%d' => [ 'PHPStan\Type\Constant\ConstantIntegerType', diff --git a/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php b/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php index 5a8edef1911..4e2afeff160 100644 --- a/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php +++ b/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php @@ -31,7 +31,7 @@ final class VersionCompareFuncCallToConstantRector extends AbstractRector /** * @var array> */ - private const OPERATOR_TO_COMPARISON = [ + private const array OPERATOR_TO_COMPARISON = [ '=' => Identical::class, '==' => Identical::class, 'eq' => Identical::class, diff --git a/rules/CodingStyle/Rector/String_/SimplifyQuoteEscapeRector.php b/rules/CodingStyle/Rector/String_/SimplifyQuoteEscapeRector.php index 86e1cadbda1..db117848c10 100644 --- a/rules/CodingStyle/Rector/String_/SimplifyQuoteEscapeRector.php +++ b/rules/CodingStyle/Rector/String_/SimplifyQuoteEscapeRector.php @@ -18,17 +18,15 @@ final class SimplifyQuoteEscapeRector extends AbstractRector { /** - * @var string * @see https://regex101.com/r/qEkCe9/2 */ - private const ESCAPED_CHAR_REGEX = '#\\\\|\$|\\n|\\t#sim'; + private const string ESCAPED_CHAR_REGEX = '#\\\\|\$|\\n|\\t#sim'; /** - * @var string * @see https://alvinalexander.com/php/how-to-remove-non-printable-characters-in-string-regex/ * @see https://regex101.com/r/lGUhRb/1 */ - private const HAS_NON_PRINTABLE_CHARS = '#[\x00-\x1F\x80-\xFF]#'; + private const string HAS_NON_PRINTABLE_CHARS = '#[\x00-\x1F\x80-\xFF]#'; private bool $hasChanged = false; diff --git a/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php b/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php index 9c2c0fd928b..a26405b154e 100644 --- a/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php +++ b/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php @@ -21,10 +21,9 @@ final class UseClassKeywordForClassNameResolutionRector extends AbstractRector { /** - * @var string * @see https://regex101.com/r/Vv41Qr/1/ */ - private const CLASS_BEFORE_STATIC_ACCESS_REGEX = '#(?[\\\\a-zA-Z0-9_\\x80-\\xff]*)::#'; + private const string CLASS_BEFORE_STATIC_ACCESS_REGEX = '#(?[\\\\a-zA-Z0-9_\\x80-\\xff]*)::#'; public function __construct( private readonly ReflectionProvider $reflectionProvider diff --git a/rules/CodingStyle/ValueObject/ObjectMagicMethods.php b/rules/CodingStyle/ValueObject/ObjectMagicMethods.php index c12d3686028..b4b9a9cfa48 100644 --- a/rules/CodingStyle/ValueObject/ObjectMagicMethods.php +++ b/rules/CodingStyle/ValueObject/ObjectMagicMethods.php @@ -11,7 +11,7 @@ final class ObjectMagicMethods /** * @var string[] */ - public const METHOD_NAMES = [ + public const array METHOD_NAMES = [ '__call', '__callStatic', MethodName::CLONE, diff --git a/rules/DeadCode/PhpDoc/Guard/StandaloneTypeRemovalGuard.php b/rules/DeadCode/PhpDoc/Guard/StandaloneTypeRemovalGuard.php index 396e68ce81d..3d73c1fec7f 100644 --- a/rules/DeadCode/PhpDoc/Guard/StandaloneTypeRemovalGuard.php +++ b/rules/DeadCode/PhpDoc/Guard/StandaloneTypeRemovalGuard.php @@ -14,7 +14,7 @@ final class StandaloneTypeRemovalGuard /** * @var string[] */ - private const ALLOWED_TYPES = ['false', 'true']; + private const array ALLOWED_TYPES = ['false', 'true']; public function isLegal(TypeNode $typeNode, Node $node): bool { diff --git a/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php b/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php index 627d513b057..1d8f6184cc5 100644 --- a/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php +++ b/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php @@ -41,7 +41,7 @@ final class RecastingRemovalRector extends AbstractRector /** * @var array, class-string> */ - private const CAST_CLASS_TO_NODE_TYPE = [ + private const array CAST_CLASS_TO_NODE_TYPE = [ String_::class => StringType::class, Bool_::class => BooleanType::class, Array_::class => ArrayType::class, diff --git a/rules/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector.php b/rules/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector.php index ab5d807e861..bee534d6154 100644 --- a/rules/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector.php +++ b/rules/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector.php @@ -41,7 +41,7 @@ final class RemoveNonExistingVarAnnotationRector extends AbstractRector /** * @var array> */ - private const NODE_TYPES = [ + private const array NODE_TYPES = [ Foreach_::class, Static_::class, Echo_::class, diff --git a/rules/DeadCode/SideEffect/SideEffectNodeDetector.php b/rules/DeadCode/SideEffect/SideEffectNodeDetector.php index 40529e5ec00..6e7b83276d6 100644 --- a/rules/DeadCode/SideEffect/SideEffectNodeDetector.php +++ b/rules/DeadCode/SideEffect/SideEffectNodeDetector.php @@ -27,7 +27,7 @@ /** * @var array> */ - private const CALL_EXPR_SIDE_EFFECT_NODE_TYPES = [ + private const array CALL_EXPR_SIDE_EFFECT_NODE_TYPES = [ MethodCall::class, New_::class, NullsafeMethodCall::class, diff --git a/rules/Naming/ExpectedNameResolver/InflectorSingularResolver.php b/rules/Naming/ExpectedNameResolver/InflectorSingularResolver.php index 9ff74709afe..639e3ec1a6f 100644 --- a/rules/Naming/ExpectedNameResolver/InflectorSingularResolver.php +++ b/rules/Naming/ExpectedNameResolver/InflectorSingularResolver.php @@ -16,26 +16,21 @@ /** * @var array */ - private const SINGULARIZE_MAP = [ + private const array SINGULARIZE_MAP = [ 'news' => 'new', ]; /** - * @var string * @see https://regex101.com/r/lbQaGC/3 */ - private const CAMELCASE_REGEX = '#(?([a-z\d]+|[A-Z\d]{1,}[a-z\d]+|_))#'; + private const string CAMELCASE_REGEX = '#(?([a-z\d]+|[A-Z\d]{1,}[a-z\d]+|_))#'; /** - * @var string * @see https://regex101.com/r/2aGdkZ/2 */ - private const BY_MIDDLE_REGEX = '#(?By[A-Z][a-zA-Z]+)#'; + private const string BY_MIDDLE_REGEX = '#(?By[A-Z][a-zA-Z]+)#'; - /** - * @var string - */ - private const CAMELCASE = 'camelcase'; + private const string CAMELCASE = 'camelcase'; public function __construct( private Inflector $inflector diff --git a/rules/Naming/Guard/BreakingVariableRenameGuard.php b/rules/Naming/Guard/BreakingVariableRenameGuard.php index 4030085a807..a266c9f3975 100644 --- a/rules/Naming/Guard/BreakingVariableRenameGuard.php +++ b/rules/Naming/Guard/BreakingVariableRenameGuard.php @@ -31,10 +31,9 @@ final readonly class BreakingVariableRenameGuard { /** - * @var string * @see https://regex101.com/r/1pKLgf/1 */ - public const AT_NAMING_REGEX = '#[\w+]At$#'; + public const string AT_NAMING_REGEX = '#[\w+]At$#'; public function __construct( private BetterNodeFinder $betterNodeFinder, diff --git a/rules/Naming/Naming/PropertyNaming.php b/rules/Naming/Naming/PropertyNaming.php index 4dff3f8d39a..27a72688f91 100644 --- a/rules/Naming/Naming/PropertyNaming.php +++ b/rules/Naming/Naming/PropertyNaming.php @@ -28,31 +28,26 @@ /** * @var string[] */ - private const EXCLUDED_CLASSES = ['#Closure#', '#^Spl#', '#FileInfo#', '#^std#', '#Iterator#', '#SimpleXML#']; + private const array EXCLUDED_CLASSES = ['#Closure#', '#^Spl#', '#FileInfo#', '#^std#', '#Iterator#', '#SimpleXML#']; /** * @var array */ - private const CONTEXT_AWARE_NAMES_BY_TYPE = [ + private const array CONTEXT_AWARE_NAMES_BY_TYPE = [ 'Twig\Environment' => 'twigEnvironment', ]; - /** - * @var string - */ - private const INTERFACE = 'Interface'; + private const string INTERFACE = 'Interface'; /** - * @var string * @see https://regex101.com/r/U78rUF/1 */ - private const I_PREFIX_REGEX = '#^I[A-Z]#'; + private const string I_PREFIX_REGEX = '#^I[A-Z]#'; /** * @see https://regex101.com/r/hnU5pm/2/ - * @var string */ - private const GET_PREFIX_REGEX = '#^get(?[A-Z].+)#'; + private const string GET_PREFIX_REGEX = '#^get(?[A-Z].+)#'; public function __construct( private RectorNamingInflector $rectorNamingInflector, diff --git a/rules/Naming/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector.php b/rules/Naming/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector.php index c3fe0241608..6e8fd77b4c6 100644 --- a/rules/Naming/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector.php +++ b/rules/Naming/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector.php @@ -31,16 +31,14 @@ final class RenameVariableToMatchMethodCallReturnTypeRector extends AbstractRector { /** - * @var string * @see https://regex101.com/r/JG5w9j/1 */ - private const OR_BETWEEN_WORDS_REGEX = '#[a-z]Or[A-Z]#'; + private const string OR_BETWEEN_WORDS_REGEX = '#[a-z]Or[A-Z]#'; /** - * @var string * @see https://regex101.com/r/TV8YXZ/1 */ - private const VALID_VARIABLE_NAME_REGEX = '#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#'; + private const string VALID_VARIABLE_NAME_REGEX = '#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#'; public function __construct( private readonly BreakingVariableRenameGuard $breakingVariableRenameGuard, diff --git a/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php b/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php index 9cfb46718ad..4f28ac5619e 100644 --- a/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php +++ b/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php @@ -29,7 +29,7 @@ final class RenameForeachValueVariableToMatchMethodCallReturnTypeRector extends /** * @var string[] */ - private const UNREADABLE_GENERIC_NAMES = ['traversable', 'iterable', 'generator', 'rewindableGenerator']; + private const array UNREADABLE_GENERIC_NAMES = ['traversable', 'iterable', 'generator', 'rewindableGenerator']; public function __construct( private readonly BreakingVariableRenameGuard $breakingVariableRenameGuard, diff --git a/rules/Naming/RectorNamingInflector.php b/rules/Naming/RectorNamingInflector.php index c40f40423d2..8ea3d2b17db 100644 --- a/rules/Naming/RectorNamingInflector.php +++ b/rules/Naming/RectorNamingInflector.php @@ -10,10 +10,9 @@ final readonly class RectorNamingInflector { /** - * @var string * @see https://regex101.com/r/VqVvke/3 */ - private const DATA_INFO_SUFFIX_REGEX = '#^(?.+)(?Data|Info)$#'; + private const string DATA_INFO_SUFFIX_REGEX = '#^(?.+)(?Data|Info)$#'; public function __construct( private Inflector $inflector diff --git a/rules/Php53/Rector/Variable/ReplaceHttpServerVarsByServerRector.php b/rules/Php53/Rector/Variable/ReplaceHttpServerVarsByServerRector.php index 0e3e8b7120e..5e3eee9798a 100644 --- a/rules/Php53/Rector/Variable/ReplaceHttpServerVarsByServerRector.php +++ b/rules/Php53/Rector/Variable/ReplaceHttpServerVarsByServerRector.php @@ -20,7 +20,7 @@ final class ReplaceHttpServerVarsByServerRector extends AbstractRector implement /** * @var array */ - private const VARIABLE_RENAME_MAP = [ + private const array VARIABLE_RENAME_MAP = [ 'HTTP_SERVER_VARS' => '_SERVER', 'HTTP_GET_VARS' => '_GET', 'HTTP_POST_VARS' => '_POST', diff --git a/rules/Php55/Rector/String_/StringClassNameToClassConstantRector.php b/rules/Php55/Rector/String_/StringClassNameToClassConstantRector.php index e0fc179fcc2..267e07d6dcf 100644 --- a/rules/Php55/Rector/String_/StringClassNameToClassConstantRector.php +++ b/rules/Php55/Rector/String_/StringClassNameToClassConstantRector.php @@ -25,9 +25,8 @@ final class StringClassNameToClassConstantRector extends AbstractRector implemen { /** * @deprecated since 2.2.12. Default behavior now. - * @var string */ - public const SHOULD_KEEP_PRE_SLASH = 'should_keep_pre_slash'; + public const string SHOULD_KEEP_PRE_SLASH = 'should_keep_pre_slash'; /** * @var string[] diff --git a/rules/Php55/RegexMatcher.php b/rules/Php55/RegexMatcher.php index 83a1f6e29cd..b53cceda040 100644 --- a/rules/Php55/RegexMatcher.php +++ b/rules/Php55/RegexMatcher.php @@ -12,22 +12,20 @@ final readonly class RegexMatcher { /** - * @var string * @see https://regex101.com/r/Ok4wuE/1 */ - private const LAST_E_REGEX = '#(\w+)?e(\w+)?$#'; + private const string LAST_E_REGEX = '#(\w+)?e(\w+)?$#'; /** - * @var string * @see https://regex101.com/r/2NWVwT/1 */ - private const LETTER_SUFFIX_REGEX = '#(?\w+)$#'; + private const string LETTER_SUFFIX_REGEX = '#(?\w+)$#'; /** * @var string[] * @see https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php */ - private const ALL_MODIFIERS_VALUES = ['i', 'm', 's', 'x', 'e', 'A', 'D', 'S', 'U', 'X', 'J', 'u']; + private const array ALL_MODIFIERS_VALUES = ['i', 'm', 's', 'x', 'e', 'A', 'D', 'S', 'U', 'X', 'J', 'u']; public function resolvePatternExpressionWithoutEIfFound(Expr $expr): Concat|String_|null { diff --git a/rules/Php70/Enum/BattleshipCompareOrder.php b/rules/Php70/Enum/BattleshipCompareOrder.php index 6a7d92ac9f3..46e31cd8fc7 100644 --- a/rules/Php70/Enum/BattleshipCompareOrder.php +++ b/rules/Php70/Enum/BattleshipCompareOrder.php @@ -6,13 +6,7 @@ final class BattleshipCompareOrder { - /** - * @var string - */ - public const ASC = 'asc'; + public const string ASC = 'asc'; - /** - * @var string - */ - public const DESC = 'desc'; + public const string DESC = 'desc'; } diff --git a/rules/Php70/EregToPcreTransformer.php b/rules/Php70/EregToPcreTransformer.php index 4c1c68aadad..4a27bbedfa1 100644 --- a/rules/Php70/EregToPcreTransformer.php +++ b/rules/Php70/EregToPcreTransformer.php @@ -17,7 +17,7 @@ final class EregToPcreTransformer /** * @var array */ - private const CHARACTER_CLASS_MAP = [ + private const array CHARACTER_CLASS_MAP = [ ':alnum:' => '[:alnum:]', ':alpha:' => '[:alpha:]', ':blank:' => '[:blank:]', @@ -34,23 +34,16 @@ final class EregToPcreTransformer ]; /** - * @var string * @see https://regex101.com/r/htpXFg/1 */ - private const BOUND_REGEX = '/^(?<' . self::MINIMAL_NUMBER_PART . '>\d|[1-9]\d|1\d\d| + private const string BOUND_REGEX = '/^(?<' . self::MINIMAL_NUMBER_PART . '>\d|[1-9]\d|1\d\d| 2[0-4]\d|25[0-5]) (?,(?<' . self::MAXIMAL_NUMBER_PART . '>\d|[1-9]\d|1\d\d| 2[0-4]\d|25[0-5])?)?$/x'; - /** - * @var string - */ - private const MINIMAL_NUMBER_PART = 'minimal_number'; + private const string MINIMAL_NUMBER_PART = 'minimal_number'; - /** - * @var string - */ - private const MAXIMAL_NUMBER_PART = 'maximal_number'; + private const string MAXIMAL_NUMBER_PART = 'maximal_number'; /** * @var array diff --git a/rules/Php70/Rector/FuncCall/CallUserMethodRector.php b/rules/Php70/Rector/FuncCall/CallUserMethodRector.php index 3cd9809bb2c..606414df951 100644 --- a/rules/Php70/Rector/FuncCall/CallUserMethodRector.php +++ b/rules/Php70/Rector/FuncCall/CallUserMethodRector.php @@ -22,7 +22,7 @@ final class CallUserMethodRector extends AbstractRector implements MinPhpVersion /** * @var array */ - private const OLD_TO_NEW_FUNCTIONS = [ + private const array OLD_TO_NEW_FUNCTIONS = [ 'call_user_method' => 'call_user_func', 'call_user_method_array' => 'call_user_func_array', ]; diff --git a/rules/Php70/Rector/FuncCall/EregToPregMatchRector.php b/rules/Php70/Rector/FuncCall/EregToPregMatchRector.php index 9dd3a0d2853..e66507b4bf3 100644 --- a/rules/Php70/Rector/FuncCall/EregToPregMatchRector.php +++ b/rules/Php70/Rector/FuncCall/EregToPregMatchRector.php @@ -32,7 +32,7 @@ final class EregToPregMatchRector extends AbstractRector implements MinPhpVersio /** * @var array */ - private const OLD_NAMES_TO_NEW_ONES = [ + private const array OLD_NAMES_TO_NEW_ONES = [ 'ereg' => 'preg_match', 'eregi' => 'preg_match', 'ereg_replace' => 'preg_replace', diff --git a/rules/Php70/Rector/FuncCall/MultiDirnameRector.php b/rules/Php70/Rector/FuncCall/MultiDirnameRector.php index 49a2f37a9b1..c9e5705e676 100644 --- a/rules/Php70/Rector/FuncCall/MultiDirnameRector.php +++ b/rules/Php70/Rector/FuncCall/MultiDirnameRector.php @@ -19,10 +19,7 @@ */ final class MultiDirnameRector extends AbstractRector implements MinPhpVersionInterface { - /** - * @var string - */ - private const DIRNAME = 'dirname'; + private const string DIRNAME = 'dirname'; private int $nestingLevel = 0; diff --git a/rules/Php70/Rector/FuncCall/RandomFunctionRector.php b/rules/Php70/Rector/FuncCall/RandomFunctionRector.php index 6d6542a6899..4d7d5800153 100644 --- a/rules/Php70/Rector/FuncCall/RandomFunctionRector.php +++ b/rules/Php70/Rector/FuncCall/RandomFunctionRector.php @@ -24,7 +24,7 @@ final class RandomFunctionRector extends AbstractRector implements MinPhpVersion /** * @var array */ - private const OLD_TO_NEW_FUNCTION_NAMES = [ + private const array OLD_TO_NEW_FUNCTION_NAMES = [ 'getrandmax' => 'mt_getrandmax', 'srand' => 'mt_srand', 'rand' => 'random_int', diff --git a/rules/Php70/Rector/FunctionLike/ExceptionHandlerTypehintRector.php b/rules/Php70/Rector/FunctionLike/ExceptionHandlerTypehintRector.php index 95bce1deb6f..0e1aef8950d 100644 --- a/rules/Php70/Rector/FunctionLike/ExceptionHandlerTypehintRector.php +++ b/rules/Php70/Rector/FunctionLike/ExceptionHandlerTypehintRector.php @@ -22,10 +22,9 @@ final class ExceptionHandlerTypehintRector extends AbstractRector implements MinPhpVersionInterface { /** - * @var string * @see https://regex101.com/r/VBFXCR/1 */ - private const HANDLE_INSENSITIVE_REGEX = '#handle#i'; + private const string HANDLE_INSENSITIVE_REGEX = '#handle#i'; public function getRuleDefinition(): RuleDefinition { diff --git a/rules/Php72/NodeFactory/AnonymousFunctionFactory.php b/rules/Php72/NodeFactory/AnonymousFunctionFactory.php index 3b790afe09e..be6c9ba511b 100644 --- a/rules/Php72/NodeFactory/AnonymousFunctionFactory.php +++ b/rules/Php72/NodeFactory/AnonymousFunctionFactory.php @@ -33,10 +33,9 @@ final readonly class AnonymousFunctionFactory { /** - * @var string * @see https://regex101.com/r/jkLLlM/2 */ - private const DIM_FETCH_REGEX = '#(\\$|\\\\|\\x0)(?\d+)#'; + private const string DIM_FETCH_REGEX = '#(\\$|\\\\|\\x0)(?\d+)#'; public function __construct( private NodeNameResolver $nodeNameResolver, diff --git a/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php b/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php index 5078e8caebd..938d8633698 100644 --- a/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php +++ b/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php @@ -25,10 +25,7 @@ */ final class ReplaceEachAssignmentWithKeyCurrentRector extends AbstractRector implements MinPhpVersionInterface { - /** - * @var string - */ - private const KEY = 'key'; + private const string KEY = 'key'; public function provideMinPhpVersion(): int { diff --git a/rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php b/rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php index 57f661331c3..eb7f86a01aa 100644 --- a/rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php +++ b/rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php @@ -24,7 +24,7 @@ final class SensitiveConstantNameRector extends AbstractRector implements MinPhp * @see http://php.net/manual/en/reserved.constants.php * @var string[] */ - private const PHP_RESERVED_CONSTANTS = [ + private const array PHP_RESERVED_CONSTANTS = [ 'PHP_VERSION', 'PHP_MAJOR_VERSION', 'PHP_MINOR_VERSION', diff --git a/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php b/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php index eda752d8e91..efdda21a873 100644 --- a/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php +++ b/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php @@ -28,20 +28,14 @@ */ final class ArrayKeyFirstLastRector extends AbstractRector implements MinPhpVersionInterface, RelatedPolyfillInterface { - /** - * @var string - */ - private const ARRAY_KEY_FIRST = 'array_key_first'; + private const string ARRAY_KEY_FIRST = 'array_key_first'; - /** - * @var string - */ - private const ARRAY_KEY_LAST = 'array_key_last'; + private const string ARRAY_KEY_LAST = 'array_key_last'; /** * @var array */ - private const PREVIOUS_TO_NEW_FUNCTIONS = [ + private const array PREVIOUS_TO_NEW_FUNCTIONS = [ 'reset' => self::ARRAY_KEY_FIRST, 'end' => self::ARRAY_KEY_LAST, ]; diff --git a/rules/Php73/Rector/FuncCall/RegexDashEscapeRector.php b/rules/Php73/Rector/FuncCall/RegexDashEscapeRector.php index 0c12bebf731..f7b4b477664 100644 --- a/rules/Php73/Rector/FuncCall/RegexDashEscapeRector.php +++ b/rules/Php73/Rector/FuncCall/RegexDashEscapeRector.php @@ -21,24 +21,21 @@ final class RegexDashEscapeRector extends AbstractRector implements MinPhpVersionInterface { /** - * @var string * @see https://regex101.com/r/iQbGgZ/1 * * Use {2} as detected only 2 after $this->regexPatternArgumentManipulator->matchCallArgumentWithRegexPattern() call */ - private const THREE_BACKSLASH_FOR_ESCAPE_NEXT_REGEX = '#(?<=[^\\\\])\\\\{2}(?=[^\\\\])#'; + private const string THREE_BACKSLASH_FOR_ESCAPE_NEXT_REGEX = '#(?<=[^\\\\])\\\\{2}(?=[^\\\\])#'; /** - * @var string * @see https://regex101.com/r/YgVJFp/1 */ - private const LEFT_HAND_UNESCAPED_DASH_REGEX = '#(\[.*?\\\\(w|s|d))-(?!\])#i'; + private const string LEFT_HAND_UNESCAPED_DASH_REGEX = '#(\[.*?\\\\(w|s|d))-(?!\])#i'; /** - * @var string * @see https://regex101.com/r/TBVme9/9 */ - private const RIGHT_HAND_UNESCAPED_DASH_REGEX = '#(? */ - private const KNOWN_OPTIONS = [ + private const array KNOWN_OPTIONS = [ 2 => 'expires', 3 => 'path', 4 => 'domain', diff --git a/rules/Php73/Rector/FuncCall/StringifyStrNeedlesRector.php b/rules/Php73/Rector/FuncCall/StringifyStrNeedlesRector.php index ecffdd814e8..aa145b36db7 100644 --- a/rules/Php73/Rector/FuncCall/StringifyStrNeedlesRector.php +++ b/rules/Php73/Rector/FuncCall/StringifyStrNeedlesRector.php @@ -23,7 +23,7 @@ final class StringifyStrNeedlesRector extends AbstractRector implements MinPhpVe /** * @var string[] */ - private const NEEDLE_STRING_SENSITIVE_FUNCTIONS = [ + private const array NEEDLE_STRING_SENSITIVE_FUNCTIONS = [ 'strpos', 'strrpos', 'stripos', diff --git a/rules/Php73/Rector/String_/SensitiveHereNowDocRector.php b/rules/Php73/Rector/String_/SensitiveHereNowDocRector.php index ab30e1336ec..b5c59dd5814 100644 --- a/rules/Php73/Rector/String_/SensitiveHereNowDocRector.php +++ b/rules/Php73/Rector/String_/SensitiveHereNowDocRector.php @@ -18,10 +18,7 @@ */ final class SensitiveHereNowDocRector extends AbstractRector implements MinPhpVersionInterface { - /** - * @var string - */ - private const WRAP_SUFFIX = '_WRAP'; + private const string WRAP_SUFFIX = '_WRAP'; public function provideMinPhpVersion(): int { diff --git a/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php b/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php index 35838340981..48261170523 100644 --- a/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php +++ b/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php @@ -26,9 +26,8 @@ final class AddLiteralSeparatorToNumberRector extends AbstractRector implements { /** * @api - * @var string */ - public const LIMIT_VALUE = 'limit_value'; + public const string LIMIT_VALUE = 'limit_value'; /** * @param array $configuration diff --git a/rules/Php80/Enum/MatchKind.php b/rules/Php80/Enum/MatchKind.php index 97b5f12aab2..19a522b78f6 100644 --- a/rules/Php80/Enum/MatchKind.php +++ b/rules/Php80/Enum/MatchKind.php @@ -6,23 +6,11 @@ final class MatchKind { - /** - * @var string - */ - public const NORMAL = 'normal'; + public const string NORMAL = 'normal'; - /** - * @var string - */ - public const ASSIGN = 'assign'; + public const string ASSIGN = 'assign'; - /** - * @var string - */ - public const RETURN = 'return'; + public const string RETURN = 'return'; - /** - * @var string - */ - public const THROW = 'throw'; + public const string THROW = 'throw'; } diff --git a/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrncmpMatchAndRefactor.php b/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrncmpMatchAndRefactor.php index e428e184771..52ccdefc4af 100644 --- a/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrncmpMatchAndRefactor.php +++ b/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrncmpMatchAndRefactor.php @@ -21,10 +21,7 @@ final readonly class StrncmpMatchAndRefactor implements StrStartWithMatchAndRefactorInterface { - /** - * @var string - */ - private const FUNCTION_NAME = 'strncmp'; + private const string FUNCTION_NAME = 'strncmp'; public function __construct( private NodeNameResolver $nodeNameResolver, diff --git a/rules/Php80/Rector/Class_/AttributeValueResolver.php b/rules/Php80/Rector/Class_/AttributeValueResolver.php index 077d1b45e9b..7d9d46cc5ef 100644 --- a/rules/Php80/Rector/Class_/AttributeValueResolver.php +++ b/rules/Php80/Rector/Class_/AttributeValueResolver.php @@ -14,10 +14,9 @@ final class AttributeValueResolver { /** - * @var string * @see https://regex101.com/r/CL9ktz/4 */ - private const END_SLASH_REGEX = '#\\\\$#'; + private const string END_SLASH_REGEX = '#\\\\$#'; public function resolve( AnnotationToAttribute $annotationToAttribute, diff --git a/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php b/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php index 8870f2cb4b2..bbea7ac7198 100644 --- a/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php +++ b/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php @@ -47,21 +47,18 @@ final class ClassPropertyAssignToConstructorPromotionRector extends AbstractRect { /** * @api - * @var string */ - public const INLINE_PUBLIC = 'inline_public'; + public const string INLINE_PUBLIC = 'inline_public'; /** * @api - * @var string */ - public const RENAME_PROPERTY = 'rename_property'; + public const string RENAME_PROPERTY = 'rename_property'; /** * @api - * @var string */ - public const ALLOW_MODEL_BASED_CLASSES = 'allow_model_based_classes'; + public const string ALLOW_MODEL_BASED_CLASSES = 'allow_model_based_classes'; /** * Default to false, which only apply changes: diff --git a/rules/Php80/Rector/Class_/StringableForToStringRector.php b/rules/Php80/Rector/Class_/StringableForToStringRector.php index 0835b228806..ea8c4618d19 100644 --- a/rules/Php80/Rector/Class_/StringableForToStringRector.php +++ b/rules/Php80/Rector/Class_/StringableForToStringRector.php @@ -32,10 +32,7 @@ */ final class StringableForToStringRector extends AbstractRector implements MinPhpVersionInterface { - /** - * @var string - */ - private const STRINGABLE = 'Stringable'; + private const string STRINGABLE = 'Stringable'; private bool $hasChanged = false; diff --git a/rules/Php80/Rector/NotIdentical/MbStrContainsRector.php b/rules/Php80/Rector/NotIdentical/MbStrContainsRector.php index ac0ba3cb985..31084285b5d 100644 --- a/rules/Php80/Rector/NotIdentical/MbStrContainsRector.php +++ b/rules/Php80/Rector/NotIdentical/MbStrContainsRector.php @@ -32,7 +32,7 @@ final class MbStrContainsRector extends AbstractRector implements MinPhpVersionI /** * @var string[] */ - private const OLD_STR_NAMES = ['mb_strpos', 'mb_strstr']; + private const array OLD_STR_NAMES = ['mb_strpos', 'mb_strstr']; public function __construct( private readonly StrFalseComparisonResolver $strFalseComparisonResolver diff --git a/rules/Php80/Rector/NotIdentical/StrContainsRector.php b/rules/Php80/Rector/NotIdentical/StrContainsRector.php index e226fb15d7e..11d2bb7b708 100644 --- a/rules/Php80/Rector/NotIdentical/StrContainsRector.php +++ b/rules/Php80/Rector/NotIdentical/StrContainsRector.php @@ -32,7 +32,7 @@ final class StrContainsRector extends AbstractRector implements MinPhpVersionInt /** * @var string[] */ - private const OLD_STR_NAMES = ['strpos', 'strstr']; + private const array OLD_STR_NAMES = ['strpos', 'strstr']; public function __construct( private readonly StrFalseComparisonResolver $strFalseComparisonResolver diff --git a/rules/Php81/Enum/AttributeName.php b/rules/Php81/Enum/AttributeName.php index b53e1972650..9d46ad7b7c6 100644 --- a/rules/Php81/Enum/AttributeName.php +++ b/rules/Php81/Enum/AttributeName.php @@ -9,12 +9,8 @@ final class AttributeName /** * Available since PHP 8.1 * @see https://php.watch/versions/8.1/ReturnTypeWillChange - * @var string */ - public const RETURN_TYPE_WILL_CHANGE = 'ReturnTypeWillChange'; + public const string RETURN_TYPE_WILL_CHANGE = 'ReturnTypeWillChange'; - /** - * @var string - */ - public const ALLOW_DYNAMIC_PROPERTIES = 'AllowDynamicProperties'; + public const string ALLOW_DYNAMIC_PROPERTIES = 'AllowDynamicProperties'; } diff --git a/rules/Php81/Enum/NameNullToStrictNullFunctionMap.php b/rules/Php81/Enum/NameNullToStrictNullFunctionMap.php index 72479e004a3..0a199d8c366 100644 --- a/rules/Php81/Enum/NameNullToStrictNullFunctionMap.php +++ b/rules/Php81/Enum/NameNullToStrictNullFunctionMap.php @@ -9,7 +9,7 @@ final class NameNullToStrictNullFunctionMap /** * @var array */ - public const FUNCTION_TO_PARAM_NAMES = [ + public const array FUNCTION_TO_PARAM_NAMES = [ 'preg_split' => ['subject'], 'preg_match' => ['subject'], 'preg_match_all' => ['subject'], diff --git a/rules/Php81/NodeFactory/EnumFactory.php b/rules/Php81/NodeFactory/EnumFactory.php index 85f104b0952..6a45a35d207 100644 --- a/rules/Php81/NodeFactory/EnumFactory.php +++ b/rules/Php81/NodeFactory/EnumFactory.php @@ -27,19 +27,17 @@ final readonly class EnumFactory { /** - * @var string * @see https://stackoverflow.com/a/2560017 * @see https://regex101.com/r/2xEQVj/1 for changing iso9001 to iso_9001 * @see https://regex101.com/r/Ykm6ub/1 for changing XMLParser to XML_Parser * @see https://regex101.com/r/Zv4JhD/1 for changing needsReview to needs_Review */ - private const PASCAL_CASE_TO_UNDERSCORE_REGEX = '/(?<=[A-Z])(?=[A-Z][a-z])|(?<=[^A-Z])(?=[A-Z])|(?<=[A-Za-z])(?=[^A-Za-z])/'; + private const string PASCAL_CASE_TO_UNDERSCORE_REGEX = '/(?<=[A-Z])(?=[A-Z][a-z])|(?<=[^A-Z])(?=[A-Z])|(?<=[A-Za-z])(?=[^A-Za-z])/'; /** - * @var string * @see https://regex101.com/r/FneU33/1 */ - private const MULTI_UNDERSCORES_REGEX = '#_{2,}#'; + private const string MULTI_UNDERSCORES_REGEX = '#_{2,}#'; public function __construct( private NodeNameResolver $nodeNameResolver, diff --git a/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php b/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php index 921a628a9c1..2290c89f825 100644 --- a/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php +++ b/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php @@ -21,10 +21,7 @@ */ final class SpatieEnumClassToEnumRector extends AbstractRector implements MinPhpVersionInterface, ConfigurableRectorInterface { - /** - * @var string - */ - public const TO_UPPER_SNAKE_CASE = 'toUpperSnakeCase'; + public const string TO_UPPER_SNAKE_CASE = 'toUpperSnakeCase'; private bool $toUpperSnakeCase = false; diff --git a/rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php b/rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php index 40d7320af27..c09ab986c2f 100644 --- a/rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php +++ b/rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php @@ -29,7 +29,7 @@ final class MyCLabsMethodCallToEnumConstRector extends AbstractRector implements /** * @var string[] */ - private const ENUM_METHODS = ['from', 'values', 'keys', 'isValid', 'search', 'toArray', 'assertValidValue']; + private const array ENUM_METHODS = ['from', 'values', 'keys', 'isValid', 'search', 'toArray', 'assertValidValue']; public function __construct( private readonly ReflectionProvider $reflectionProvider, diff --git a/rules/Php81/Rector/MethodCall/SpatieEnumMethodCallToEnumConstRector.php b/rules/Php81/Rector/MethodCall/SpatieEnumMethodCallToEnumConstRector.php index 722f4da3628..852255272f4 100644 --- a/rules/Php81/Rector/MethodCall/SpatieEnumMethodCallToEnumConstRector.php +++ b/rules/Php81/Rector/MethodCall/SpatieEnumMethodCallToEnumConstRector.php @@ -21,15 +21,12 @@ */ final class SpatieEnumMethodCallToEnumConstRector extends AbstractRector implements MinPhpVersionInterface { - /** - * @var string - */ - private const SPATIE_FQN = 'Spatie\Enum\Enum'; + private const string SPATIE_FQN = 'Spatie\Enum\Enum'; /** * @var string[] */ - private const ENUM_METHODS = ['from', 'values', 'keys', 'isValid', 'search', 'toArray', 'assertValidValue']; + private const array ENUM_METHODS = ['from', 'values', 'keys', 'isValid', 'search', 'toArray', 'assertValidValue']; public function getRuleDefinition(): RuleDefinition { diff --git a/rules/Php81/Rector/New_/MyCLabsConstructorCallToEnumFromRector.php b/rules/Php81/Rector/New_/MyCLabsConstructorCallToEnumFromRector.php index 833a08b6410..21954686454 100644 --- a/rules/Php81/Rector/New_/MyCLabsConstructorCallToEnumFromRector.php +++ b/rules/Php81/Rector/New_/MyCLabsConstructorCallToEnumFromRector.php @@ -24,9 +24,9 @@ */ final class MyCLabsConstructorCallToEnumFromRector extends AbstractRector implements MinPhpVersionInterface { - private const MY_C_LABS_CLASS = 'MyCLabs\Enum\Enum'; + private const string MY_C_LABS_CLASS = 'MyCLabs\Enum\Enum'; - private const DEFAULT_ENUM_CONSTRUCTOR = 'from'; + private const string DEFAULT_ENUM_CONSTRUCTOR = 'from'; public function __construct( private readonly ReflectionProvider $reflectionProvider, diff --git a/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php b/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php index e3e0c681933..7578c57cc3a 100644 --- a/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php +++ b/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php @@ -23,7 +23,7 @@ */ final class AddSensitiveParameterAttributeRector extends AbstractRector implements ConfigurableRectorInterface, MinPhpVersionInterface { - public const SENSITIVE_PARAMETERS = 'sensitive_parameters'; + public const string SENSITIVE_PARAMETERS = 'sensitive_parameters'; /** * @var string[] diff --git a/rules/Php83/Rector/BooleanAnd/JsonValidateRector.php b/rules/Php83/Rector/BooleanAnd/JsonValidateRector.php index e8de9004d72..efecc86c5fa 100644 --- a/rules/Php83/Rector/BooleanAnd/JsonValidateRector.php +++ b/rules/Php83/Rector/BooleanAnd/JsonValidateRector.php @@ -28,7 +28,7 @@ */ final class JsonValidateRector extends AbstractRector implements MinPhpVersionInterface, RelatedPolyfillInterface { - private const JSON_MAX_DEPTH = 0x7FFFFFFF; + private const int JSON_MAX_DEPTH = 0x7FFFFFFF; public function __construct( private readonly BinaryOpManipulator $binaryOpManipulator, diff --git a/rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php b/rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php index 6855933ca0c..74775a64a75 100644 --- a/rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php +++ b/rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php @@ -39,14 +39,10 @@ final class AddOverrideAttributeToOverriddenMethodsRector extends AbstractRector { /** * @api - * @var string */ - public const ALLOW_OVERRIDE_EMPTY_METHOD = 'allow_override_empty_method'; + public const string ALLOW_OVERRIDE_EMPTY_METHOD = 'allow_override_empty_method'; - /** - * @var string - */ - private const OVERRIDE_CLASS = 'Override'; + private const string OVERRIDE_CLASS = 'Override'; private bool $allowOverrideEmptyMethod = false; diff --git a/rules/Php85/Rector/ArrayDimFetch/ArrayFirstLastRector.php b/rules/Php85/Rector/ArrayDimFetch/ArrayFirstLastRector.php index 0a9e21f563c..68b55641995 100644 --- a/rules/Php85/Rector/ArrayDimFetch/ArrayFirstLastRector.php +++ b/rules/Php85/Rector/ArrayDimFetch/ArrayFirstLastRector.php @@ -21,15 +21,9 @@ */ final class ArrayFirstLastRector extends AbstractRector implements MinPhpVersionInterface { - /** - * @var string - */ - private const ARRAY_KEY_FIRST = 'array_key_first'; + private const string ARRAY_KEY_FIRST = 'array_key_first'; - /** - * @var string - */ - private const ARRAY_KEY_LAST = 'array_key_last'; + private const string ARRAY_KEY_LAST = 'array_key_last'; public function getRuleDefinition(): RuleDefinition { diff --git a/rules/Privatization/Guard/LaravelModelGuard.php b/rules/Privatization/Guard/LaravelModelGuard.php index bd0ec7eef56..330c0722b79 100644 --- a/rules/Privatization/Guard/LaravelModelGuard.php +++ b/rules/Privatization/Guard/LaravelModelGuard.php @@ -20,16 +20,14 @@ final readonly class LaravelModelGuard { /** - * @var string * @see https://regex101.com/r/Dx0WN5/2 */ - private const LARAVEL_MODEL_ATTRIBUTE_REGEX = '#^[gs]et.+Attribute$#'; + private const string LARAVEL_MODEL_ATTRIBUTE_REGEX = '#^[gs]et.+Attribute$#'; /** - * @var string * @see https://regex101.com/r/hxOGeN/2 */ - private const LARAVEL_MODEL_SCOPE_REGEX = '#^scope.+$#'; + private const string LARAVEL_MODEL_SCOPE_REGEX = '#^scope.+$#'; public function __construct( private PhpAttributeAnalyzer $phpAttributeAnalyzer, diff --git a/rules/Privatization/Guard/ParentClassMagicCallGuard.php b/rules/Privatization/Guard/ParentClassMagicCallGuard.php index 083b11504e8..0245c0e6557 100644 --- a/rules/Privatization/Guard/ParentClassMagicCallGuard.php +++ b/rules/Privatization/Guard/ParentClassMagicCallGuard.php @@ -20,7 +20,7 @@ final class ParentClassMagicCallGuard * To speed up analysis * @var string[] */ - private const KNOWN_DYNAMIC_CALL_CLASSES = [Standard::class, PrettyPrinterAbstract::class]; + private const array KNOWN_DYNAMIC_CALL_CLASSES = [Standard::class, PrettyPrinterAbstract::class]; /** * @var array diff --git a/rules/Privatization/TypeManipulator/TypeNormalizer.php b/rules/Privatization/TypeManipulator/TypeNormalizer.php index 06a05f53294..11ce83a5cc5 100644 --- a/rules/Privatization/TypeManipulator/TypeNormalizer.php +++ b/rules/Privatization/TypeManipulator/TypeNormalizer.php @@ -31,10 +31,7 @@ final readonly class TypeNormalizer { - /** - * @var int - */ - private const MAX_PRINTED_UNION_DOC_LENGTH = 77; + private const int MAX_PRINTED_UNION_DOC_LENGTH = 77; public function __construct( private TypeFactory $typeFactory, diff --git a/rules/Transform/Enum/MagicPropertyHandler.php b/rules/Transform/Enum/MagicPropertyHandler.php index 06732be5d0e..031c848d065 100644 --- a/rules/Transform/Enum/MagicPropertyHandler.php +++ b/rules/Transform/Enum/MagicPropertyHandler.php @@ -6,11 +6,11 @@ final class MagicPropertyHandler { - public const GET = 'get'; + public const string GET = 'get'; - public const SET = 'set'; + public const string SET = 'set'; - public const ISSET_ = 'exists'; + public const string ISSET_ = 'exists'; - public const UNSET = 'unset'; + public const string UNSET = 'unset'; } diff --git a/rules/TypeDeclaration/Enum/NativeFuncCallPositions.php b/rules/TypeDeclaration/Enum/NativeFuncCallPositions.php index fe17bd9c1b4..1e21d1fb32d 100644 --- a/rules/TypeDeclaration/Enum/NativeFuncCallPositions.php +++ b/rules/TypeDeclaration/Enum/NativeFuncCallPositions.php @@ -9,7 +9,7 @@ final class NativeFuncCallPositions /** * @var array> */ - public const ARRAY_AND_CALLBACK_POSITIONS = [ + public const array ARRAY_AND_CALLBACK_POSITIONS = [ 'array_walk' => [ 'array' => 0, 'callback' => 1, diff --git a/rules/TypeDeclaration/NodeTypeAnalyzer/DetailedTypeAnalyzer.php b/rules/TypeDeclaration/NodeTypeAnalyzer/DetailedTypeAnalyzer.php index b90b93c3654..d44fa1ce1bc 100644 --- a/rules/TypeDeclaration/NodeTypeAnalyzer/DetailedTypeAnalyzer.php +++ b/rules/TypeDeclaration/NodeTypeAnalyzer/DetailedTypeAnalyzer.php @@ -13,9 +13,8 @@ final class DetailedTypeAnalyzer { /** * Use this constant to avoid overly detailed long-dragging union types across whole universe - * @var int */ - private const MAX_NUMBER_OF_TYPES = 3; + private const int MAX_NUMBER_OF_TYPES = 3; public function isTooDetailed(Type $type): bool { diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddMethodCallBasedStrictParamTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddMethodCallBasedStrictParamTypeRector.php index 9844bf4c371..c7c3fa92aaf 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddMethodCallBasedStrictParamTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddMethodCallBasedStrictParamTypeRector.php @@ -20,10 +20,7 @@ */ final class AddMethodCallBasedStrictParamTypeRector extends AbstractRector { - /** - * @var int - */ - private const MAX_UNION_TYPES = 3; + private const int MAX_UNION_TYPES = 3; public function __construct( private readonly CallTypesResolver $callTypesResolver, diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeBasedOnPHPUnitDataProviderRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeBasedOnPHPUnitDataProviderRector.php index 95d8d2534cf..6c0d198254b 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeBasedOnPHPUnitDataProviderRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeBasedOnPHPUnitDataProviderRector.php @@ -23,10 +23,7 @@ */ final class AddParamTypeBasedOnPHPUnitDataProviderRector extends AbstractRector { - /** - * @var string - */ - private const ERROR_MESSAGE = 'Adds param type declaration based on PHPUnit provider return type declaration'; + private const string ERROR_MESSAGE = 'Adds param type declaration based on PHPUnit provider return type declaration'; public function __construct( private readonly TestsNodeAnalyzer $testsNodeAnalyzer, diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeFromPropertyTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeFromPropertyTypeRector.php index 82eecff300e..ae587099264 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeFromPropertyTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeFromPropertyTypeRector.php @@ -29,10 +29,7 @@ */ final class AddParamTypeFromPropertyTypeRector extends AbstractRector implements MinPhpVersionInterface { - /** - * @var string - */ - private const ERROR_MESSAGE = 'Add param type declaration based on property type'; + private const string ERROR_MESSAGE = 'Add param type declaration based on property type'; public function __construct( private readonly PropertyFetchAnalyzer $propertyFetchAnalyzer, diff --git a/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeSplFixedArrayRector.php b/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeSplFixedArrayRector.php index 823533a1ec1..310c1e4bae3 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeSplFixedArrayRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeSplFixedArrayRector.php @@ -26,7 +26,7 @@ final class AddParamTypeSplFixedArrayRector extends AbstractRector /** * @var array */ - private const SPL_FIXED_ARRAY_TO_SINGLE = [ + private const array SPL_FIXED_ARRAY_TO_SINGLE = [ 'PhpCsFixer\Tokenizer\Tokens' => 'PhpCsFixer\Tokenizer\Token', 'PhpCsFixer\Doctrine\Annotation\Tokens' => 'PhpCsFixer\Doctrine\Annotation\Token', ]; diff --git a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php index 7d670e0c6a1..bbfe3fbf536 100644 --- a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php +++ b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php @@ -41,9 +41,8 @@ final class TypedPropertyFromAssignsRector extends AbstractRector implements Min { /** * @api - * @var string */ - public const INLINE_PUBLIC = 'inline_public'; + public const string INLINE_PUBLIC = 'inline_public'; /** * Default to false, which only apply changes: diff --git a/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php b/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php index 95fa9b18b95..ff5a37f5401 100644 --- a/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php +++ b/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php @@ -18,7 +18,7 @@ */ final class IncreaseDeclareStrictTypesRector extends AbstractRector implements ConfigurableRectorInterface, DeprecatedInterface { - public const LIMIT = 'limit'; + public const string LIMIT = 'limit'; public function getRuleDefinition(): RuleDefinition { diff --git a/rules/TypeDeclaration/ValueObject/DataProviderNodes.php b/rules/TypeDeclaration/ValueObject/DataProviderNodes.php index a3f59ea58d5..bb1ed23a9f1 100644 --- a/rules/TypeDeclaration/ValueObject/DataProviderNodes.php +++ b/rules/TypeDeclaration/ValueObject/DataProviderNodes.php @@ -17,9 +17,8 @@ { /** * @see https://regex101.com/r/hW09Vt/1 - * @var string */ - private const METHOD_NAME_REGEX = '#^(?\w+)(\(\))?#'; + private const string METHOD_NAME_REGEX = '#^(?\w+)(\(\))?#'; /** * @param Attribute[] $attributes diff --git a/rules/TypeDeclarationDocblocks/Enum/NetteClassName.php b/rules/TypeDeclarationDocblocks/Enum/NetteClassName.php index 93fe01c0101..3d64f4862b2 100644 --- a/rules/TypeDeclarationDocblocks/Enum/NetteClassName.php +++ b/rules/TypeDeclarationDocblocks/Enum/NetteClassName.php @@ -6,8 +6,5 @@ final class NetteClassName { - /** - * @var string - */ - public const JSON = 'Nette\Utils\Json'; + public const string JSON = 'Nette\Utils\Json'; } diff --git a/rules/TypeDeclarationDocblocks/Enum/TestClassName.php b/rules/TypeDeclarationDocblocks/Enum/TestClassName.php index 46d52440678..8229420985e 100644 --- a/rules/TypeDeclarationDocblocks/Enum/TestClassName.php +++ b/rules/TypeDeclarationDocblocks/Enum/TestClassName.php @@ -6,8 +6,5 @@ final class TestClassName { - /** - * @var string - */ - public const DATA_PROVIDER = 'PHPUnit\Framework\Attributes\DataProvider'; + public const string DATA_PROVIDER = 'PHPUnit\Framework\Attributes\DataProvider'; } diff --git a/rules/TypeDeclarationDocblocks/TypeResolver/ConstantArrayTypeGeneralizer.php b/rules/TypeDeclarationDocblocks/TypeResolver/ConstantArrayTypeGeneralizer.php index 00b5a938987..3ca83ab2218 100644 --- a/rules/TypeDeclarationDocblocks/TypeResolver/ConstantArrayTypeGeneralizer.php +++ b/rules/TypeDeclarationDocblocks/TypeResolver/ConstantArrayTypeGeneralizer.php @@ -22,7 +22,7 @@ final class ConstantArrayTypeGeneralizer * Using 10-level array @return docblocks makes code very hard to read, * lets limit it to reasonable level */ - private const MAX_NESTING = 3; + private const int MAX_NESTING = 3; private int $currentNesting = 0; diff --git a/scripts/no-php-file-in-fixtures.php b/scripts/no-php-file-in-fixtures.php index d356a310d4e..d363b557ff7 100644 --- a/scripts/no-php-file-in-fixtures.php +++ b/scripts/no-php-file-in-fixtures.php @@ -17,7 +17,7 @@ /** * @var string[] */ - private const EXCLUDED_FILES = [ + private const array EXCLUDED_FILES = [ // on-purpose as same namespace text 'rules-tests/Renaming/Rector/Name/RenameClassRector/FixtureAutoImportNames/SomeShort.php', ]; diff --git a/src/Application/ApplicationFileProcessor.php b/src/Application/ApplicationFileProcessor.php index d2caa1ae89e..932593d032f 100644 --- a/src/Application/ApplicationFileProcessor.php +++ b/src/Application/ApplicationFileProcessor.php @@ -31,10 +31,7 @@ final class ApplicationFileProcessor { - /** - * @var string - */ - private const ARGV = 'argv'; + private const string ARGV = 'argv'; /** * @var SystemError[] diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index d3daf3a63e9..dffbe0bb260 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,20 +19,15 @@ final class VersionResolver { /** * @api - * @var string */ - public const PACKAGE_VERSION = '@package_version@'; + public const string PACKAGE_VERSION = '@package_version@'; /** * @api - * @var string */ - public const RELEASE_DATE = '@release_date@'; + public const string RELEASE_DATE = '@release_date@'; - /** - * @var int - */ - private const SUCCESS_CODE = 0; + private const int SUCCESS_CODE = 0; public static function resolvePackageVersion(): string { diff --git a/src/BetterPhpDocParser/Attributes/AttributeMirrorer.php b/src/BetterPhpDocParser/Attributes/AttributeMirrorer.php index 0fd22287bde..60323cdb868 100644 --- a/src/BetterPhpDocParser/Attributes/AttributeMirrorer.php +++ b/src/BetterPhpDocParser/Attributes/AttributeMirrorer.php @@ -12,7 +12,7 @@ final class AttributeMirrorer /** * @var string[] */ - private const ATTRIBUTES_TO_MIRROR = [ + private const array ATTRIBUTES_TO_MIRROR = [ PhpDocAttributeKey::PARENT, PhpDocAttributeKey::START_AND_END, PhpDocAttributeKey::ORIG_NODE, diff --git a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php index 6bf45874b6a..750845c3473 100644 --- a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php +++ b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php @@ -44,7 +44,7 @@ final class PhpDocInfo /** * @var array, string> */ - private const TAGS_TYPES_TO_NAMES = [ + private const array TAGS_TYPES_TO_NAMES = [ ReturnTagValueNode::class => '@return', ParamTagValueNode::class => '@param', VarTagValueNode::class => '@var', diff --git a/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTypeChanger.php b/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTypeChanger.php index f5ec4ac1410..f268cdeb472 100644 --- a/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTypeChanger.php +++ b/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTypeChanger.php @@ -37,7 +37,7 @@ /** * @var array> */ - private const ALLOWED_TYPES = [ + private const array ALLOWED_TYPES = [ GenericTypeNode::class, SpacingAwareArrayTypeNode::class, SpacingAwareCallableTypeNode::class, @@ -47,7 +47,7 @@ /** * @var string[] */ - private const ALLOWED_IDENTIFIER_TYPENODE_TYPES = ['class-string']; + private const array ALLOWED_IDENTIFIER_TYPENODE_TYPES = ['class-string']; public function __construct( private StaticTypeMapper $staticTypeMapper, diff --git a/src/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php b/src/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php index 9674baf0802..45026f3fd41 100644 --- a/src/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php +++ b/src/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php @@ -33,16 +33,14 @@ final class BetterPhpDocParser extends PhpDocParser { /** - * @var string * @see https://regex101.com/r/JDzr0c/1 */ - private const NEW_LINE_REGEX = "#(?\r\n|\n)#"; + private const string NEW_LINE_REGEX = "#(?\r\n|\n)#"; /** - * @var string * @see https://regex101.com/r/JOKSmr/5 */ - private const MULTI_NEW_LINES_REGEX = '#(?\r\n|\n){2,}#'; + private const string MULTI_NEW_LINES_REGEX = '#(?\r\n|\n){2,}#'; /** * @param PhpDocNodeDecoratorInterface[] $phpDocNodeDecorators diff --git a/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php b/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php index 16cb445d954..505c86f9165 100644 --- a/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php +++ b/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php @@ -35,33 +35,29 @@ { /** * @see https://regex101.com/r/bGp2V0/2 - * @var string */ - public const LONG_ANNOTATION_REGEX = '#@\\\\(?.*?)(?\(.*?\)|,|\r?\n|$)#'; + public const string LONG_ANNOTATION_REGEX = '#@\\\\(?.*?)(?\(.*?\)|,|\r?\n|$)#'; /** * Special short annotations, that are resolved as FQN by Doctrine annotation parser * @var string[] */ - private const ALLOWED_SHORT_ANNOTATIONS = ['Target']; + private const array ALLOWED_SHORT_ANNOTATIONS = ['Target']; /** * @see https://regex101.com/r/xWaLOz/1 - * @var string */ - private const NESTED_ANNOTATION_END_REGEX = '#(\s+)?\}\)(\s+)?#'; + private const string NESTED_ANNOTATION_END_REGEX = '#(\s+)?\}\)(\s+)?#'; /** * @see https://regex101.com/r/8rWY4r/1 - * @var string */ - private const NEWLINE_ANNOTATION_FQCN_REGEX = '#\r?\n@\\\\#'; + private const string NEWLINE_ANNOTATION_FQCN_REGEX = '#\r?\n@\\\\#'; /** - * @var string * @see https://regex101.com/r/3zXEh7/1 */ - private const STAR_COMMENT_REGEX = '#^\s*\*#ms'; + private const string STAR_COMMENT_REGEX = '#^\s*\*#ms'; public function __construct( private ClassAnnotationMatcher $classAnnotationMatcher, diff --git a/src/BetterPhpDocParser/Printer/DocBlockInliner.php b/src/BetterPhpDocParser/Printer/DocBlockInliner.php index 8d19822d0ab..9d456690c56 100644 --- a/src/BetterPhpDocParser/Printer/DocBlockInliner.php +++ b/src/BetterPhpDocParser/Printer/DocBlockInliner.php @@ -9,16 +9,14 @@ final class DocBlockInliner { /** - * @var string * @see https://regex101.com/r/Mjb0qi/3 */ - private const NEWLINE_CLOSING_DOC_REGEX = "#(?:\r\n|\n) \*\/$#"; + private const string NEWLINE_CLOSING_DOC_REGEX = "#(?:\r\n|\n) \*\/$#"; /** - * @var string * @see https://regex101.com/r/U5OUV4/4 */ - private const NEWLINE_MIDDLE_DOC_REGEX = "#(?:\r\n|\n) \* #"; + private const string NEWLINE_MIDDLE_DOC_REGEX = "#(?:\r\n|\n) \* #"; public function inline(string $docContent): string { diff --git a/src/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php b/src/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php index be691ed4f28..3ad49312553 100644 --- a/src/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php +++ b/src/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php @@ -30,32 +30,29 @@ final class PhpDocInfoPrinter { /** - * @var string * @see https://regex101.com/r/Ab0Vey/1 */ - private const CLOSING_DOCBLOCK_REGEX = '#\*\/(\s+)?$#'; + private const string CLOSING_DOCBLOCK_REGEX = '#\*\/(\s+)?$#'; /** - * @var string * @see https://regex101.com/r/5fJyws/1 */ - private const CALLABLE_REGEX = '#callable(\s+)\(#'; + private const string CALLABLE_REGEX = '#callable(\s+)\(#'; /** * @var string[] */ - private const DOCBLOCK_STARTS = ['//', '/**', '/*', '#']; + private const array DOCBLOCK_STARTS = ['//', '/**', '/*', '#']; /** * @var string Uses a hardcoded unix-newline since most codes use it (even on windows) - otherwise we would need to normalize newlines */ - private const NEWLINE_WITH_ASTERISK = "\n" . ' *'; + private const string NEWLINE_WITH_ASTERISK = "\n" . ' *'; /** - * @var string * @see https://regex101.com/r/ME5Fcn/1 */ - private const NEW_LINE_WITH_SPACE_REGEX = "# (?\r\n|\n)#"; + private const string NEW_LINE_WITH_SPACE_REGEX = "# (?\r\n|\n)#"; private int $tokenCount = 0; diff --git a/src/BetterPhpDocParser/ValueObject/DoctrineAnnotation/SilentKeyMap.php b/src/BetterPhpDocParser/ValueObject/DoctrineAnnotation/SilentKeyMap.php index 7709e836626..364a122078b 100644 --- a/src/BetterPhpDocParser/ValueObject/DoctrineAnnotation/SilentKeyMap.php +++ b/src/BetterPhpDocParser/ValueObject/DoctrineAnnotation/SilentKeyMap.php @@ -9,7 +9,7 @@ final class SilentKeyMap /** * @var array */ - public const CLASS_NAMES_TO_SILENT_KEYS = [ + public const array CLASS_NAMES_TO_SILENT_KEYS = [ 'Symfony\Component\Routing\Annotation\Route' => 'path', ]; } diff --git a/src/BetterPhpDocParser/ValueObject/NodeTypes.php b/src/BetterPhpDocParser/ValueObject/NodeTypes.php index 262dcbd6655..be56587e82c 100644 --- a/src/BetterPhpDocParser/ValueObject/NodeTypes.php +++ b/src/BetterPhpDocParser/ValueObject/NodeTypes.php @@ -18,7 +18,7 @@ final class NodeTypes /** * @var array> */ - public const TYPE_AWARE_NODES = [ + public const array TYPE_AWARE_NODES = [ VarTagValueNode::class, ParamTagValueNode::class, ReturnTagValueNode::class, @@ -30,7 +30,7 @@ final class NodeTypes /** * @var string[] */ - public const TYPE_AWARE_DOCTRINE_ANNOTATION_CLASSES = [ + public const array TYPE_AWARE_DOCTRINE_ANNOTATION_CLASSES = [ ClassName::JMS_TYPE, 'Doctrine\ORM\Mapping\OneToMany', 'Symfony\Component\Validator\Constraints\Choice', diff --git a/src/BetterPhpDocParser/ValueObject/PhpDocAttributeKey.php b/src/BetterPhpDocParser/ValueObject/PhpDocAttributeKey.php index 42aee9fe0e1..3311c8273a0 100644 --- a/src/BetterPhpDocParser/ValueObject/PhpDocAttributeKey.php +++ b/src/BetterPhpDocParser/ValueObject/PhpDocAttributeKey.php @@ -8,29 +8,16 @@ final class PhpDocAttributeKey { - /** - * @var string - */ - public const START_AND_END = 'start_and_end'; + public const string START_AND_END = 'start_and_end'; /** * Fully qualified name of identifier type class - * @var string */ - public const RESOLVED_CLASS = 'resolved_class'; + public const string RESOLVED_CLASS = 'resolved_class'; - /** - * @var string - */ - public const PARENT = NativePhpDocAttributeKey::PARENT; + public const string PARENT = NativePhpDocAttributeKey::PARENT; - /** - * @var string - */ - public const LAST_PHP_DOC_TOKEN_POSITION = 'last_token_position'; + public const string LAST_PHP_DOC_TOKEN_POSITION = 'last_token_position'; - /** - * @var string - */ - public const ORIG_NODE = NativePhpDocAttributeKey::ORIG_NODE; + public const string ORIG_NODE = NativePhpDocAttributeKey::ORIG_NODE; } diff --git a/src/Caching/Enum/CacheKey.php b/src/Caching/Enum/CacheKey.php index 66512c05905..eaffc1c6c09 100644 --- a/src/Caching/Enum/CacheKey.php +++ b/src/Caching/Enum/CacheKey.php @@ -9,13 +9,7 @@ */ final class CacheKey { - /** - * @var string - */ - public const CONFIGURATION_HASH_KEY = 'configuration_hash'; + public const string CONFIGURATION_HASH_KEY = 'configuration_hash'; - /** - * @var string - */ - public const FILE_HASH_KEY = 'file_hash'; + public const string FILE_HASH_KEY = 'file_hash'; } diff --git a/src/ChangesReporting/Output/ConsoleOutputFormatter.php b/src/ChangesReporting/Output/ConsoleOutputFormatter.php index 4efe600dacf..44c4b351b67 100644 --- a/src/ChangesReporting/Output/ConsoleOutputFormatter.php +++ b/src/ChangesReporting/Output/ConsoleOutputFormatter.php @@ -17,16 +17,12 @@ final readonly class ConsoleOutputFormatter implements OutputFormatterInterface { - /** - * @var string - */ - public const NAME = 'console'; + public const string NAME = 'console'; /** - * @var string * @see https://regex101.com/r/q8I66g/1 */ - private const ON_LINE_REGEX = '# on line #'; + private const string ON_LINE_REGEX = '# on line #'; public function __construct( private SymfonyStyle $symfonyStyle, diff --git a/src/ChangesReporting/Output/GitHubOutputFormatter.php b/src/ChangesReporting/Output/GitHubOutputFormatter.php index 0c78cc11252..f0d3bb8359a 100644 --- a/src/ChangesReporting/Output/GitHubOutputFormatter.php +++ b/src/ChangesReporting/Output/GitHubOutputFormatter.php @@ -23,9 +23,9 @@ */ final readonly class GitHubOutputFormatter implements OutputFormatterInterface { - private const NAME = 'github'; + private const string NAME = 'github'; - private const GROUP_NAME = 'Rector report'; + private const string GROUP_NAME = 'Rector report'; public function getName(): string { diff --git a/src/ChangesReporting/Output/GitlabOutputFormatter.php b/src/ChangesReporting/Output/GitlabOutputFormatter.php index 7911570bd3b..b0e8530153b 100644 --- a/src/ChangesReporting/Output/GitlabOutputFormatter.php +++ b/src/ChangesReporting/Output/GitlabOutputFormatter.php @@ -17,17 +17,17 @@ final readonly class GitlabOutputFormatter implements OutputFormatterInterface { - private const NAME = 'gitlab'; + private const string NAME = 'gitlab'; - private const ERROR_TYPE_ISSUE = 'issue'; + private const string ERROR_TYPE_ISSUE = 'issue'; - private const ERROR_CATEGORY_BUG_RISK = 'Bug Risk'; + private const string ERROR_CATEGORY_BUG_RISK = 'Bug Risk'; - private const ERROR_CATEGORY_STYLE = 'Style'; + private const string ERROR_CATEGORY_STYLE = 'Style'; - private const ERROR_SEVERITY_BLOCKER = 'blocker'; + private const string ERROR_SEVERITY_BLOCKER = 'blocker'; - private const ERROR_SEVERITY_MINOR = 'minor'; + private const string ERROR_SEVERITY_MINOR = 'minor'; public function __construct( private Filehasher $filehasher, diff --git a/src/ChangesReporting/Output/JUnitOutputFormatter.php b/src/ChangesReporting/Output/JUnitOutputFormatter.php index 1b881c2a3bc..7ef6cd12477 100644 --- a/src/ChangesReporting/Output/JUnitOutputFormatter.php +++ b/src/ChangesReporting/Output/JUnitOutputFormatter.php @@ -18,21 +18,21 @@ final readonly class JUnitOutputFormatter implements OutputFormatterInterface { - private const NAME = 'junit'; + private const string NAME = 'junit'; - private const XML_ATTRIBUTE_FILE = 'file'; + private const string XML_ATTRIBUTE_FILE = 'file'; - private const XML_ATTRIBUTE_NAME = 'name'; + private const string XML_ATTRIBUTE_NAME = 'name'; - private const XML_ATTRIBUTE_TYPE = 'type'; + private const string XML_ATTRIBUTE_TYPE = 'type'; - private const XML_ELEMENT_TESTSUITES = 'testsuites'; + private const string XML_ELEMENT_TESTSUITES = 'testsuites'; - private const XML_ELEMENT_TESTSUITE = 'testsuite'; + private const string XML_ELEMENT_TESTSUITE = 'testsuite'; - private const XML_ELEMENT_TESTCASE = 'testcase'; + private const string XML_ELEMENT_TESTCASE = 'testcase'; - private const XML_ELEMENT_ERROR = 'error'; + private const string XML_ELEMENT_ERROR = 'error'; public function __construct( private SymfonyStyle $symfonyStyle, diff --git a/src/ChangesReporting/Output/JsonOutputFormatter.php b/src/ChangesReporting/Output/JsonOutputFormatter.php index 65062a4bb8e..521208a7ba2 100644 --- a/src/ChangesReporting/Output/JsonOutputFormatter.php +++ b/src/ChangesReporting/Output/JsonOutputFormatter.php @@ -13,10 +13,7 @@ final readonly class JsonOutputFormatter implements OutputFormatterInterface { - /** - * @var string - */ - public const NAME = 'json'; + public const string NAME = 'json'; public function getName(): string { diff --git a/src/ChangesReporting/ValueObject/RectorWithLineChange.php b/src/ChangesReporting/ValueObject/RectorWithLineChange.php index f5c0a71b6bf..6db365bd4ef 100644 --- a/src/ChangesReporting/ValueObject/RectorWithLineChange.php +++ b/src/ChangesReporting/ValueObject/RectorWithLineChange.php @@ -11,15 +11,9 @@ final readonly class RectorWithLineChange implements SerializableInterface { - /** - * @var string - */ - private const KEY_RECTOR_CLASS = 'rector_class'; + private const string KEY_RECTOR_CLASS = 'rector_class'; - /** - * @var string - */ - private const KEY_LINE = 'line'; + private const string KEY_LINE = 'line'; /** * @param class-string $rectorClass diff --git a/src/Config/Level/CodeQualityLevel.php b/src/Config/Level/CodeQualityLevel.php index b2aa1c8a9e6..d895def1c81 100644 --- a/src/Config/Level/CodeQualityLevel.php +++ b/src/Config/Level/CodeQualityLevel.php @@ -104,7 +104,7 @@ final class CodeQualityLevel * * @var array> */ - public const RULES = [ + public const array RULES = [ CombinedAssignRector::class, SimplifyEmptyArrayCheckRector::class, ReplaceMultipleBooleanNotRector::class, @@ -188,7 +188,7 @@ final class CodeQualityLevel /** * @var array, mixed[]> */ - public const RULES_WITH_CONFIGURATION = [ + public const array RULES_WITH_CONFIGURATION = [ RenameFunctionRector::class => [ 'split' => 'explode', 'join' => 'implode', diff --git a/src/Config/Level/CodingStyleLevel.php b/src/Config/Level/CodingStyleLevel.php index 6512edeaa36..718feff2505 100644 --- a/src/Config/Level/CodingStyleLevel.php +++ b/src/Config/Level/CodingStyleLevel.php @@ -53,7 +53,7 @@ final class CodingStyleLevel * * @var array> */ - public const RULES = [ + public const array RULES = [ SeparateMultiUseImportsRector::class, NewlineBetweenClassLikeStmtsRector::class, NewlineAfterStatementRector::class, @@ -86,7 +86,7 @@ final class CodingStyleLevel /** * @var array, mixed[]> */ - public const RULES_WITH_CONFIGURATION = [ + public const array RULES_WITH_CONFIGURATION = [ FuncCallToConstFetchRector::class => [ 'php_sapi_name' => 'PHP_SAPI', 'pi' => 'M_PI', diff --git a/src/Config/Level/DeadCodeLevel.php b/src/Config/Level/DeadCodeLevel.php index e59264dae1a..2beee307b47 100644 --- a/src/Config/Level/DeadCodeLevel.php +++ b/src/Config/Level/DeadCodeLevel.php @@ -84,7 +84,7 @@ final class DeadCodeLevel * * @var array> */ - public const RULES = [ + public const array RULES = [ // easy picks RemoveUnusedForeachKeyRector::class, RemoveDuplicatedArrayKeyRector::class, diff --git a/src/Config/Level/TypeDeclarationDocblocksLevel.php b/src/Config/Level/TypeDeclarationDocblocksLevel.php index d95a2f3b0ff..42155b30aaf 100644 --- a/src/Config/Level/TypeDeclarationDocblocksLevel.php +++ b/src/Config/Level/TypeDeclarationDocblocksLevel.php @@ -30,7 +30,7 @@ final class TypeDeclarationDocblocksLevel /** * @var array> */ - public const RULES = [ + public const array RULES = [ // start with rules based on native code // property var DocblockVarArrayFromPropertyDefaultsRector::class, diff --git a/src/Config/Level/TypeDeclarationLevel.php b/src/Config/Level/TypeDeclarationLevel.php index 96fab757ee9..630af35b4a2 100644 --- a/src/Config/Level/TypeDeclarationLevel.php +++ b/src/Config/Level/TypeDeclarationLevel.php @@ -77,7 +77,7 @@ final class TypeDeclarationLevel * * @var array> */ - public const RULES = [ + public const array RULES = [ // php 7.1, start with closure first, as safest AddClosureVoidReturnTypeWhereNoReturnRector::class, AddFunctionVoidReturnTypeWhereNoReturnRector::class, diff --git a/src/Configuration/Option.php b/src/Configuration/Option.php index 30f2d3d794c..c815eeaa88e 100644 --- a/src/Configuration/Option.php +++ b/src/Configuration/Option.php @@ -9,135 +9,109 @@ final class Option { - /** - * @var string - */ - public const SOURCE = 'source'; + public const string SOURCE = 'source'; - /** - * @var string - */ - public const AUTOLOAD_FILE = 'autoload-file'; + public const string AUTOLOAD_FILE = 'autoload-file'; /** * @internal Use @see \Rector\Config\RectorConfig::bootstrapFiles() instead * @var string */ - public const BOOTSTRAP_FILES = 'bootstrap_files'; + public const string BOOTSTRAP_FILES = 'bootstrap_files'; - /** - * @var string - */ - public const DRY_RUN = 'dry-run'; + public const string DRY_RUN = 'dry-run'; - /** - * @var string - */ - public const DRY_RUN_SHORT = 'n'; + public const string DRY_RUN_SHORT = 'n'; - /** - * @var string - */ - public const OUTPUT_FORMAT = 'output-format'; + public const string OUTPUT_FORMAT = 'output-format'; - /** - * @var string - */ - public const NO_PROGRESS_BAR = 'no-progress-bar'; + public const string NO_PROGRESS_BAR = 'no-progress-bar'; /** * @internal Use @see \Rector\Config\RectorConfig::phpVersion() instead * @var string */ - public const PHP_VERSION_FEATURES = 'php_version_features'; + public const string PHP_VERSION_FEATURES = 'php_version_features'; /** * @internal Use @see \Rector\Config\RectorConfig::importNames() instead * @var string */ - public const AUTO_IMPORT_NAMES = 'auto_import_names'; + public const string AUTO_IMPORT_NAMES = 'auto_import_names'; /** * @internal Use @see \Rector\Config\RectorConfig::polyfillPackages() instead * @var string */ - public const POLYFILL_PACKAGES = 'polyfill_packages'; + public const string POLYFILL_PACKAGES = 'polyfill_packages'; /** * @internal Use @see \Rector\Config\RectorConfig::importNames() instead * @var string */ - public const AUTO_IMPORT_DOC_BLOCK_NAMES = 'auto_import_doc_block_names'; + public const string AUTO_IMPORT_DOC_BLOCK_NAMES = 'auto_import_doc_block_names'; /** * @internal Use @see \Rector\Config\RectorConfig::importShortClasses() instead * @var string */ - public const IMPORT_SHORT_CLASSES = 'import_short_classes'; + public const string IMPORT_SHORT_CLASSES = 'import_short_classes'; /** * @internal Use @see \Rector\Config\RectorConfig::symfonyContainerXml() instead * @var string */ - public const SYMFONY_CONTAINER_XML_PATH_PARAMETER = 'symfony_container_xml_path'; + public const string SYMFONY_CONTAINER_XML_PATH_PARAMETER = 'symfony_container_xml_path'; /** * @internal Use @see \Rector\Config\RectorConfig::symfonyContainerPhp() * @var string */ - public const SYMFONY_CONTAINER_PHP_PATH_PARAMETER = 'symfony_container_php_path'; + public const string SYMFONY_CONTAINER_PHP_PATH_PARAMETER = 'symfony_container_php_path'; /** * @internal Use @see \Rector\Config\RectorConfig::newLineOnFluentCall() * @var string */ - public const NEW_LINE_ON_FLUENT_CALL = 'new_line_on_fluent_call'; + public const string NEW_LINE_ON_FLUENT_CALL = 'new_line_on_fluent_call'; - /** - * @var string - */ - public const CLEAR_CACHE = 'clear-cache'; + public const string CLEAR_CACHE = 'clear-cache'; - /** - * @var string - */ - public const ONLY = 'only'; + public const string ONLY = 'only'; /** * @internal Use @see \Rector\Config\RectorConfig::parallel() instead * @var string */ - public const PARALLEL = 'parallel'; + public const string PARALLEL = 'parallel'; /** * @internal Use @see \Rector\Config\RectorConfig::paths() instead * @var string */ - public const PATHS = 'paths'; + public const string PATHS = 'paths'; /** * @internal Use @see \Rector\Config\RectorConfig::autoloadPaths() instead * @var string */ - public const AUTOLOAD_PATHS = 'autoload_paths'; + public const string AUTOLOAD_PATHS = 'autoload_paths'; /** * @internal Use @see \Rector\Config\RectorConfig::skip() instead * @var string */ - public const SKIP = 'skip'; + public const string SKIP = 'skip'; /** * @internal Use RectorConfig::fileExtensions() instead - * @var string */ - public const FILE_EXTENSIONS = 'file_extensions'; + public const string FILE_EXTENSIONS = 'file_extensions'; /** * @internal Use RectorConfig::cacheDirectory() instead - * @var string */ - public const CACHE_DIR = 'cache_dir'; + public const string CACHE_DIR = 'cache_dir'; /** * Cache backend. Most of the time we cache in files, but in ephemeral environment (e.g. CI), a faster `MemoryCacheStorage` can be useful. @@ -146,176 +120,144 @@ final class Option * @var class-string * @internal */ - public const CACHE_CLASS = FileCacheStorage::class; + public const string CACHE_CLASS = FileCacheStorage::class; - /** - * @var string - */ - public const DEBUG = 'debug'; + public const string DEBUG = 'debug'; - /** - * @var string - */ - public const XDEBUG = 'xdebug'; + public const string XDEBUG = 'xdebug'; - /** - * @var string - */ - public const CONFIG = 'config'; + public const string CONFIG = 'config'; /** * @internal Use @see \Rector\Config\RectorConfig::phpstanConfig() instead * @var string */ - public const PHPSTAN_FOR_RECTOR_PATHS = 'phpstan_for_rector_paths'; + public const string PHPSTAN_FOR_RECTOR_PATHS = 'phpstan_for_rector_paths'; - /** - * @var string - */ - public const NO_DIFFS = 'no-diffs'; + public const string NO_DIFFS = 'no-diffs'; - /** - * @var string - */ - public const AUTOLOAD_FILE_SHORT = 'a'; + public const string AUTOLOAD_FILE_SHORT = 'a'; - /** - * @var string - */ - public const PARALLEL_IDENTIFIER = 'identifier'; + public const string PARALLEL_IDENTIFIER = 'identifier'; - /** - * @var string - */ - public const PARALLEL_PORT = 'port'; + public const string PARALLEL_PORT = 'port'; /** * @internal Use @see \Rector\Config\RectorConfig::parallel() instead with pass int $jobSize parameter * @var string */ - public const PARALLEL_JOB_SIZE = 'parallel-job-size'; + public const string PARALLEL_JOB_SIZE = 'parallel-job-size'; /** * @internal Use @see \Rector\Config\RectorConfig::parallel() instead with pass int $maxNumberOfProcess parameter * @var string */ - public const PARALLEL_MAX_NUMBER_OF_PROCESSES = 'parallel-max-number-of-processes'; + public const string PARALLEL_MAX_NUMBER_OF_PROCESSES = 'parallel-max-number-of-processes'; /** * @internal Use @see \Rector\Config\RectorConfig::parallel() instead with pass int $seconds parameter * @var string */ - public const PARALLEL_JOB_TIMEOUT_IN_SECONDS = 'parallel-job-timeout-in-seconds'; + public const string PARALLEL_JOB_TIMEOUT_IN_SECONDS = 'parallel-job-timeout-in-seconds'; - /** - * @var string - */ - public const MEMORY_LIMIT = 'memory-limit'; + public const string MEMORY_LIMIT = 'memory-limit'; /** * @internal Use @see \Rector\Config\RectorConfig::indent() method * @var string */ - public const INDENT_CHAR = 'indent-char'; + public const string INDENT_CHAR = 'indent-char'; /** * @internal Use @see \Rector\Config\RectorConfig::indent() method * @var string */ - public const INDENT_SIZE = 'indent-size'; + public const string INDENT_SIZE = 'indent-size'; /** * @internal Use @see \Rector\Config\RectorConfig::removeUnusedImports() method * @var string */ - public const REMOVE_UNUSED_IMPORTS = 'remove-unused-imports'; + public const string REMOVE_UNUSED_IMPORTS = 'remove-unused-imports'; /** * @internal Use @see \Rector\Config\RectorConfig::containerCacheDirectory() method * @var string */ - public const CONTAINER_CACHE_DIRECTORY = 'container-cache-directory'; + public const string CONTAINER_CACHE_DIRECTORY = 'container-cache-directory'; /** * @internal For cache invalidation in case of change - * @var string */ - public const REGISTERED_RECTOR_RULES = 'registered_rector_rules'; + public const string REGISTERED_RECTOR_RULES = 'registered_rector_rules'; /** * @internal For cache invalidation in case of change - * @var string */ - public const REGISTERED_RECTOR_SETS = 'registered_rector_sets'; + public const string REGISTERED_RECTOR_SETS = 'registered_rector_sets'; /** * @internal For verify RectorConfigBuilder instance recreated - * @var string */ - public const IS_RECTORCONFIG_BUILDER_RECREATED = 'is_rectorconfig_builder_recreated'; + public const string IS_RECTORCONFIG_BUILDER_RECREATED = 'is_rectorconfig_builder_recreated'; /** * @internal For verify skipped rules exists in registered rules - * @var string */ - public const SKIPPED_RECTOR_RULES = 'skipped_rector_rules'; + public const string SKIPPED_RECTOR_RULES = 'skipped_rector_rules'; /** * @internal For collect skipped start with short open tag files to be reported - * @var string */ - public const SKIPPED_START_WITH_SHORT_OPEN_TAG_FILES = 'skipped_start_with_short_open_tag_files'; + public const string SKIPPED_START_WITH_SHORT_OPEN_TAG_FILES = 'skipped_start_with_short_open_tag_files'; /** * @internal For reporting with absolute paths instead of relative paths (default behaviour) * @see \Rector\Config\RectorConfig::reportingRealPath() - * @var string */ - public const ABSOLUTE_FILE_PATH = 'absolute_file_path'; + public const string ABSOLUTE_FILE_PATH = 'absolute_file_path'; /** * @internal To add editor links to console output * @see \Rector\Config\RectorConfig::editorUrl() - * @var string */ - public const EDITOR_URL = 'editor_url'; + public const string EDITOR_URL = 'editor_url'; /** * @internal Use @see \Rector\Config\RectorConfig::treatClassesAsFinal() method * @var string */ - public const TREAT_CLASSES_AS_FINAL = 'treat_classes_as_final'; + public const string TREAT_CLASSES_AS_FINAL = 'treat_classes_as_final'; /** * @internal To report composer based loaded sets * @see \Rector\Configuration\RectorConfigBuilder::withComposerBased() - * @var string */ - public const COMPOSER_BASED_SETS = 'composer_based_sets'; + public const string COMPOSER_BASED_SETS = 'composer_based_sets'; /** * @internal To filter files by specific suffix */ - public const ONLY_SUFFIX = 'only-suffix'; + public const string ONLY_SUFFIX = 'only-suffix'; /** * @internal To report overflow levels in ->with*Level() methods */ - public const LEVEL_OVERFLOWS = 'level_overflows'; + public const string LEVEL_OVERFLOWS = 'level_overflows'; /** * @internal To avoid registering rules via ->withRules(), that are already loaded in sets, * and keep rector.php clean */ - public const ROOT_STANDALONE_REGISTERED_RULES = 'root_standalone_registered_rules'; + public const string ROOT_STANDALONE_REGISTERED_RULES = 'root_standalone_registered_rules'; /** * @internal The other half of ROOT_STANDALONE_REGISTERED_RULES to compare */ - public const SET_REGISTERED_RULES = 'set_registered_rules'; + public const string SET_REGISTERED_RULES = 'set_registered_rules'; /** * @internal to allow process file without extension if explicitly registered */ - public const FILES_WITHOUT_EXTENSION = 'files_without_extension'; + public const string FILES_WITHOUT_EXTENSION = 'files_without_extension'; } diff --git a/src/Configuration/PhpLevelSetResolver.php b/src/Configuration/PhpLevelSetResolver.php index 27c55fed2a0..d79e92c1452 100644 --- a/src/Configuration/PhpLevelSetResolver.php +++ b/src/Configuration/PhpLevelSetResolver.php @@ -18,7 +18,7 @@ final class PhpLevelSetResolver /** * @var array */ - private const VERSION_LOWER_BOUND_CONFIGS = [ + private const array VERSION_LOWER_BOUND_CONFIGS = [ PhpVersion::PHP_52 => SetList::PHP_52, PhpVersion::PHP_53 => SetList::PHP_53, PhpVersion::PHP_54 => SetList::PHP_54, diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index a3eca69a08c..6a5474b1f9b 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -50,10 +50,7 @@ */ final class RectorConfigBuilder { - /** - * @var int - */ - private const MAX_LEVEL_GAP = 10; + private const int MAX_LEVEL_GAP = 10; /** * @var string[] diff --git a/src/Console/Command/WorkerCommand.php b/src/Console/Command/WorkerCommand.php index 4ed1aac0ee9..24e4cfae9ae 100644 --- a/src/Console/Command/WorkerCommand.php +++ b/src/Console/Command/WorkerCommand.php @@ -37,10 +37,7 @@ */ final class WorkerCommand extends Command { - /** - * @var string - */ - private const RESULT = 'result'; + private const string RESULT = 'result'; public function __construct( private readonly AdditionalAutoloader $additionalAutoloader, diff --git a/src/Console/ConsoleApplication.php b/src/Console/ConsoleApplication.php index c142cd3a69d..74f023a5d34 100644 --- a/src/Console/ConsoleApplication.php +++ b/src/Console/ConsoleApplication.php @@ -19,10 +19,7 @@ final class ConsoleApplication extends Application { - /** - * @var string - */ - private const NAME = 'Rector'; + private const string NAME = 'Rector'; /** * @param Command[] $commands diff --git a/src/Console/ExitCode.php b/src/Console/ExitCode.php index fa15e5afe69..046efbd7711 100644 --- a/src/Console/ExitCode.php +++ b/src/Console/ExitCode.php @@ -11,18 +11,9 @@ */ final class ExitCode { - /** - * @var int - */ - public const SUCCESS = Command::SUCCESS; + public const int SUCCESS = Command::SUCCESS; - /** - * @var int - */ - public const FAILURE = Command::FAILURE; + public const int FAILURE = Command::FAILURE; - /** - * @var int - */ - public const CHANGED_CODE = 2; + public const int CHANGED_CODE = 2; } diff --git a/src/Console/Formatter/ColorConsoleDiffFormatter.php b/src/Console/Formatter/ColorConsoleDiffFormatter.php index dfc6c7cb4ab..42635b2e8ac 100644 --- a/src/Console/Formatter/ColorConsoleDiffFormatter.php +++ b/src/Console/Formatter/ColorConsoleDiffFormatter.php @@ -17,28 +17,24 @@ final readonly class ColorConsoleDiffFormatter { /** - * @var string * @see https://regex101.com/r/ovLMDF/1 */ - private const PLUS_START_REGEX = '#^(\+.*)#'; + private const string PLUS_START_REGEX = '#^(\+.*)#'; /** - * @var string * @see https://regex101.com/r/xwywpa/1 */ - private const MINUS_START_REGEX = '#^(\-.*)#'; + private const string MINUS_START_REGEX = '#^(\-.*)#'; /** - * @var string * @see https://regex101.com/r/CMlwa8/1 */ - private const AT_START_REGEX = '#^(@.*)#'; + private const string AT_START_REGEX = '#^(@.*)#'; /** - * @var string * @see https://regex101.com/r/8MXnfa/2 */ - private const AT_DIFF_LINE_REGEX = '#^\@@ \-\d+,\d+ \+\d+,\d+ @@\<\/fg=cyan\>$#'; + private const string AT_DIFF_LINE_REGEX = '#^\@@ \-\d+,\d+ \+\d+,\d+ @@\<\/fg=cyan\>$#'; private string $template; diff --git a/src/CustomRules/SimpleNodeDumper.php b/src/CustomRules/SimpleNodeDumper.php index 28878ad11b9..1cbe1b9773c 100644 --- a/src/CustomRules/SimpleNodeDumper.php +++ b/src/CustomRules/SimpleNodeDumper.php @@ -23,7 +23,7 @@ final class SimpleNodeDumper /** * @var array */ - private const INCLUDE_TYPE_MAP = [ + private const array INCLUDE_TYPE_MAP = [ Include_::TYPE_INCLUDE => 'TYPE_INCLUDE', Include_::TYPE_INCLUDE_ONCE => 'TYPE_INCLUDE_ONCE', Include_::TYPE_REQUIRE => 'TYPE_REQUIRE', diff --git a/src/DependencyInjection/LazyContainerFactory.php b/src/DependencyInjection/LazyContainerFactory.php index f0c7fb6c643..0b771550e68 100644 --- a/src/DependencyInjection/LazyContainerFactory.php +++ b/src/DependencyInjection/LazyContainerFactory.php @@ -201,7 +201,7 @@ final class LazyContainerFactory /** * @var array> */ - private const NODE_NAME_RESOLVER_CLASSES = [ + private const array NODE_NAME_RESOLVER_CLASSES = [ ClassConstFetchNameResolver::class, ClassConstNameResolver::class, ClassNameResolver::class, @@ -217,7 +217,7 @@ final class LazyContainerFactory /** * @var array> */ - private const BASE_PHP_DOC_NODE_VISITORS = [ + private const array BASE_PHP_DOC_NODE_VISITORS = [ ArrayTypePhpDocNodeVisitor::class, CallableTypePhpDocNodeVisitor::class, IntersectionTypeNodePhpDocNodeVisitor::class, @@ -228,7 +228,7 @@ final class LazyContainerFactory /** * @var array> */ - private const ANNOTATION_TO_ATTRIBUTE_MAPPER_CLASSES = [ + private const array ANNOTATION_TO_ATTRIBUTE_MAPPER_CLASSES = [ ArrayAnnotationToAttributeMapper::class, ArrayItemNodeAnnotationToAttributeMapper::class, ClassConstFetchAnnotationToAttributeMapper::class, @@ -242,7 +242,7 @@ final class LazyContainerFactory /** * @var array> */ - private const DECORATING_NODE_VISITOR_CLASSES = [ + private const array DECORATING_NODE_VISITOR_CLASSES = [ ArgNodeVisitor::class, ClosureWithVariadicParametersNodeVisitor::class, PhpVersionConditionNodeVisitor::class, @@ -263,7 +263,7 @@ final class LazyContainerFactory /** * @var array> */ - private const PHPDOC_TYPE_MAPPER_CLASSES = [ + private const array PHPDOC_TYPE_MAPPER_CLASSES = [ IdentifierPhpDocTypeMapper::class, IntersectionPhpDocTypeMapper::class, NullablePhpDocTypeMapper::class, @@ -273,7 +273,7 @@ final class LazyContainerFactory /** * @var array> */ - private const CLASS_NAME_IMPORT_SKIPPER_CLASSES = [ + private const array CLASS_NAME_IMPORT_SKIPPER_CLASSES = [ AliasClassNameImportSkipVoter::class, ClassLikeNameClassNameImportSkipVoter::class, FullyQualifiedNameClassNameImportSkipVoter::class, @@ -286,7 +286,7 @@ final class LazyContainerFactory /** * @var array> */ - private const TYPE_MAPPER_CLASSES = [ + private const array TYPE_MAPPER_CLASSES = [ AccessoryLiteralStringTypeMapper::class, AccessoryNonEmptyStringTypeMapper::class, AccessoryNonFalsyStringTypeMapper::class, @@ -330,7 +330,7 @@ final class LazyContainerFactory /** * @var array> */ - private const PHP_DOC_NODE_DECORATOR_CLASSES = [ + private const array PHP_DOC_NODE_DECORATOR_CLASSES = [ ConstExprClassNameDecorator::class, DoctrineAnnotationDecorator::class, ArrayItemClassNameDecorator::class, @@ -340,7 +340,7 @@ final class LazyContainerFactory /** * @var array */ - private const PUBLIC_PHPSTAN_SERVICE_TYPES = [ + private const array PUBLIC_PHPSTAN_SERVICE_TYPES = [ ScopeFactory::class, TypeNodeResolver::class, NodeScopeResolver::class, @@ -350,7 +350,7 @@ final class LazyContainerFactory /** * @var array> */ - private const OUTPUT_FORMATTER_CLASSES = [ + private const array OUTPUT_FORMATTER_CLASSES = [ ConsoleOutputFormatter::class, JsonOutputFormatter::class, GitlabOutputFormatter::class, @@ -361,7 +361,7 @@ final class LazyContainerFactory /** * @var array> */ - private const NODE_TYPE_RESOLVER_CLASSES = [ + private const array NODE_TYPE_RESOLVER_CLASSES = [ CastTypeResolver::class, StaticCallMethodCallTypeResolver::class, ClassAndInterfaceTypeResolver::class, @@ -379,7 +379,7 @@ final class LazyContainerFactory /** * @var array> */ - private const PHP_PARSER_NODE_MAPPER_CLASSES = [ + private const array PHP_PARSER_NODE_MAPPER_CLASSES = [ FullyQualifiedNodeMapper::class, IdentifierNodeMapper::class, IntersectionTypeNodeMapper::class, @@ -393,7 +393,7 @@ final class LazyContainerFactory /** * @var array> */ - private const CONVERTER_ATTRIBUTE_DECORATOR_CLASSES = [ + private const array CONVERTER_ATTRIBUTE_DECORATOR_CLASSES = [ SensioParamConverterAttributeDecorator::class, DoctrineConverterAttributeDecorator::class, ]; diff --git a/src/Enum/ClassName.php b/src/Enum/ClassName.php index 08ba0930df2..f3a71087f6f 100644 --- a/src/Enum/ClassName.php +++ b/src/Enum/ClassName.php @@ -6,33 +6,15 @@ final class ClassName { - /** - * @var string - */ - public const TEST_CASE_CLASS = 'PHPUnit\Framework\TestCase'; - - /** - * @var string - */ - public const MOCK_OBJECT = 'PHPUnit\Framework\MockObject\MockObject'; - - /** - * @var string - */ - public const DATE_TIME_INTERFACE = 'DateTimeInterface'; - - /** - * @var string - */ - public const JMS_TYPE = 'JMS\Serializer\Annotation\Type'; - - /** - * @var string - */ - public const DOCTRINE_ENTITY = 'Doctrine\ORM\Mapping\Entity'; - - /** - * @var string - */ - public const DATA_PROVIDER = 'PHPUnit\Framework\Attributes\DataProvider'; + public const string TEST_CASE_CLASS = 'PHPUnit\Framework\TestCase'; + + public const string MOCK_OBJECT = 'PHPUnit\Framework\MockObject\MockObject'; + + public const string DATE_TIME_INTERFACE = 'DateTimeInterface'; + + public const string JMS_TYPE = 'JMS\Serializer\Annotation\Type'; + + public const string DOCTRINE_ENTITY = 'Doctrine\ORM\Mapping\Entity'; + + public const string DATA_PROVIDER = 'PHPUnit\Framework\Attributes\DataProvider'; } diff --git a/src/Enum/Config/Defaults.php b/src/Enum/Config/Defaults.php index f2f26009edc..4478d35b0b1 100644 --- a/src/Enum/Config/Defaults.php +++ b/src/Enum/Config/Defaults.php @@ -6,8 +6,5 @@ final class Defaults { - /** - * @var int - */ - public const PARALLEL_MAX_NUMBER_OF_PROCESS = 32; + public const int PARALLEL_MAX_NUMBER_OF_PROCESS = 32; } diff --git a/src/Enum/LaravelClassName.php b/src/Enum/LaravelClassName.php index 70eedaaac4a..5331fa49a2f 100644 --- a/src/Enum/LaravelClassName.php +++ b/src/Enum/LaravelClassName.php @@ -6,9 +6,9 @@ final class LaravelClassName { - public const MODEL = 'Illuminate\Database\Eloquent\Model'; + public const string MODEL = 'Illuminate\Database\Eloquent\Model'; - public const CAST_ATTRIBUTE = 'Illuminate\Database\Eloquent\Casts\Attribute'; + public const string CAST_ATTRIBUTE = 'Illuminate\Database\Eloquent\Casts\Attribute'; - public const ATTRIBUTES_SCOPE = 'Illuminate\Database\Eloquent\Attributes\Scope'; + public const string ATTRIBUTES_SCOPE = 'Illuminate\Database\Eloquent\Attributes\Scope'; } diff --git a/src/Enum/ObjectReference.php b/src/Enum/ObjectReference.php index 241e12a7584..a6b97b0c98d 100644 --- a/src/Enum/ObjectReference.php +++ b/src/Enum/ObjectReference.php @@ -6,18 +6,9 @@ final class ObjectReference { - /** - * @var string - */ - public const SELF = 'self'; + public const string SELF = 'self'; - /** - * @var string - */ - public const PARENT = 'parent'; + public const string PARENT = 'parent'; - /** - * @var string - */ - public const STATIC = 'static'; + public const string STATIC = 'static'; } diff --git a/src/FileSystem/FilePathHelper.php b/src/FileSystem/FilePathHelper.php index a2e9125254a..83d1d72e0d7 100644 --- a/src/FileSystem/FilePathHelper.php +++ b/src/FileSystem/FilePathHelper.php @@ -16,20 +16,15 @@ { /** * @see https://regex101.com/r/d4F5Fm/1 - * @var string */ - private const SCHEME_PATH_REGEX = '#^([a-z]+)\\:\\/\\/(.+)#'; + private const string SCHEME_PATH_REGEX = '#^([a-z]+)\\:\\/\\/(.+)#'; /** * @see https://regex101.com/r/no28vw/1 - * @var string */ - private const TWO_AND_MORE_SLASHES_REGEX = '#/{2,}#'; + private const string TWO_AND_MORE_SLASHES_REGEX = '#/{2,}#'; - /** - * @var string - */ - private const SCHEME_UNDEFINED = 'undefined'; + private const string SCHEME_UNDEFINED = 'undefined'; public function __construct( private Filesystem $filesystem, diff --git a/src/FileSystem/InitFilePathsResolver.php b/src/FileSystem/InitFilePathsResolver.php index 3fa9eedb4b4..69d51f4ce72 100644 --- a/src/FileSystem/InitFilePathsResolver.php +++ b/src/FileSystem/InitFilePathsResolver.php @@ -13,10 +13,9 @@ final class InitFilePathsResolver { /** - * @var string * @see https://regex101.com/r/XkQ6Pe/1 */ - private const DO_NOT_INCLUDE_PATHS_REGEX = '#(vendor|var|stubs|temp|templates|tmp|e2e|bin|build|Migrations|data(?:base)?|storage|migrations|writable|node_modules)#'; + private const string DO_NOT_INCLUDE_PATHS_REGEX = '#(vendor|var|stubs|temp|templates|tmp|e2e|bin|build|Migrations|data(?:base)?|storage|migrations|writable|node_modules)#'; /** * @return string[] diff --git a/src/Git/RepositoryHelper.php b/src/Git/RepositoryHelper.php index 1a9bac72c6c..207ee28ad59 100644 --- a/src/Git/RepositoryHelper.php +++ b/src/Git/RepositoryHelper.php @@ -10,10 +10,9 @@ final class RepositoryHelper { /** - * @var string * @see https://regex101.com/r/etcmog/2 */ - private const GITHUB_REPOSITORY_REGEX = '#github\.com[:\/](?.*?)\.git#'; + private const string GITHUB_REPOSITORY_REGEX = '#github\.com[:\/](?.*?)\.git#'; public static function resolveGithubRepositoryName(string $currentDirectory): ?string { diff --git a/src/NodeAnalyzer/CallAnalyzer.php b/src/NodeAnalyzer/CallAnalyzer.php index 4c0af017bf8..641f6fee790 100644 --- a/src/NodeAnalyzer/CallAnalyzer.php +++ b/src/NodeAnalyzer/CallAnalyzer.php @@ -22,7 +22,7 @@ /** * @var array> */ - private const OBJECT_CALL_TYPES = [MethodCall::class, NullsafeMethodCall::class, StaticCall::class]; + private const array OBJECT_CALL_TYPES = [MethodCall::class, NullsafeMethodCall::class, StaticCall::class]; public function __construct( private ReflectionProvider $reflectionProvider diff --git a/src/NodeAnalyzer/DoctrineEntityAnalyzer.php b/src/NodeAnalyzer/DoctrineEntityAnalyzer.php index a7c52013804..5f3c18cd402 100644 --- a/src/NodeAnalyzer/DoctrineEntityAnalyzer.php +++ b/src/NodeAnalyzer/DoctrineEntityAnalyzer.php @@ -18,7 +18,7 @@ /** * @var string[] */ - private const DOCTRINE_MAPPING_CLASSES = [ + private const array DOCTRINE_MAPPING_CLASSES = [ 'Doctrine\ORM\Mapping\Entity', 'Doctrine\ORM\Mapping\Embeddable', 'Doctrine\ODM\MongoDB\Mapping\Annotations\Document', diff --git a/src/NodeAnalyzer/ParamAnalyzer.php b/src/NodeAnalyzer/ParamAnalyzer.php index de6e28418f4..779a125fd85 100644 --- a/src/NodeAnalyzer/ParamAnalyzer.php +++ b/src/NodeAnalyzer/ParamAnalyzer.php @@ -29,7 +29,12 @@ /** * @var string[] */ - private const VARIADIC_FUNCTION_NAMES = ['func_get_arg', 'func_get_args', 'func_num_args', 'get_defined_vars']; + private const array VARIADIC_FUNCTION_NAMES = [ + 'func_get_arg', + 'func_get_args', + 'func_num_args', + 'get_defined_vars', + ]; public function __construct( private NodeComparator $nodeComparator, diff --git a/src/NodeAnalyzer/PropertyFetchAnalyzer.php b/src/NodeAnalyzer/PropertyFetchAnalyzer.php index 16049b10428..9c612d652ed 100644 --- a/src/NodeAnalyzer/PropertyFetchAnalyzer.php +++ b/src/NodeAnalyzer/PropertyFetchAnalyzer.php @@ -33,10 +33,7 @@ final readonly class PropertyFetchAnalyzer { - /** - * @var string - */ - private const THIS = 'this'; + private const string THIS = 'this'; public function __construct( private NodeNameResolver $nodeNameResolver, diff --git a/src/NodeAnalyzer/ScopeAnalyzer.php b/src/NodeAnalyzer/ScopeAnalyzer.php index c039f5efa78..8bc7252f827 100644 --- a/src/NodeAnalyzer/ScopeAnalyzer.php +++ b/src/NodeAnalyzer/ScopeAnalyzer.php @@ -14,7 +14,7 @@ final class ScopeAnalyzer /** * @var array> */ - private const NON_REFRESHABLE_NODES = [Name::class, Identifier::class, ComplexType::class]; + private const array NON_REFRESHABLE_NODES = [Name::class, Identifier::class, ComplexType::class]; public function isRefreshable(Node $node): bool { diff --git a/src/NodeAnalyzer/TerminatedNodeAnalyzer.php b/src/NodeAnalyzer/TerminatedNodeAnalyzer.php index a37f829f3c1..444df395921 100644 --- a/src/NodeAnalyzer/TerminatedNodeAnalyzer.php +++ b/src/NodeAnalyzer/TerminatedNodeAnalyzer.php @@ -32,17 +32,17 @@ final class TerminatedNodeAnalyzer /** * @var array> */ - private const TERMINABLE_NODES = [Return_::class, Break_::class, Continue_::class]; + private const array TERMINABLE_NODES = [Return_::class, Break_::class, Continue_::class]; /** * @var array> */ - private const TERMINABLE_NODES_BY_ITS_STMTS = [TryCatch::class, If_::class, Switch_::class]; + private const array TERMINABLE_NODES_BY_ITS_STMTS = [TryCatch::class, If_::class, Switch_::class]; /** * @var array> */ - private const ALLOWED_CONTINUE_CURRENT_STMTS = [InlineHTML::class, Nop::class]; + private const array ALLOWED_CONTINUE_CURRENT_STMTS = [InlineHTML::class, Nop::class]; /** * @param StmtsAware $stmtsAware diff --git a/src/NodeManipulator/PropertyManipulator.php b/src/NodeManipulator/PropertyManipulator.php index defc0fa3209..0e2819a8356 100644 --- a/src/NodeManipulator/PropertyManipulator.php +++ b/src/NodeManipulator/PropertyManipulator.php @@ -41,7 +41,7 @@ /** * @var string[]|class-string[] */ - private const ALLOWED_NOT_READONLY_CLASS_ANNOTATIONS = [ + private const array ALLOWED_NOT_READONLY_CLASS_ANNOTATIONS = [ 'ApiPlatform\Core\Annotation\ApiResource', 'ApiPlatform\Metadata\ApiResource', 'Doctrine\ORM\Mapping\Entity', diff --git a/src/NodeNameResolver/NodeNameResolver.php b/src/NodeNameResolver/NodeNameResolver.php index 586ef978533..51d8c62ba52 100644 --- a/src/NodeNameResolver/NodeNameResolver.php +++ b/src/NodeNameResolver/NodeNameResolver.php @@ -34,7 +34,7 @@ final class NodeNameResolver /** * Used to check if a string might contain a regex or fnmatch pattern */ - private const REGEX_WILDCARD_CHARS = ['*', '#', '~', '/']; + private const array REGEX_WILDCARD_CHARS = ['*', '#', '~', '/']; /** * @var array diff --git a/src/NodeNameResolver/Regex/RegexPatternDetector.php b/src/NodeNameResolver/Regex/RegexPatternDetector.php index 075354ef858..4a9e87dd5a8 100644 --- a/src/NodeNameResolver/Regex/RegexPatternDetector.php +++ b/src/NodeNameResolver/Regex/RegexPatternDetector.php @@ -11,12 +11,12 @@ final class RegexPatternDetector * * This prevents miss matching like "aMethoda" */ - private const POSSIBLE_DELIMITERS = ['#', '~', '/']; + private const array POSSIBLE_DELIMITERS = ['#', '~', '/']; /** * @var array */ - private const START_AND_END_DELIMITERS = [ + private const array START_AND_END_DELIMITERS = [ '(' => ')', '{' => '}', '[' => ']', diff --git a/src/NodeNestingScope/ValueObject/ControlStructure.php b/src/NodeNestingScope/ValueObject/ControlStructure.php index 58a70621263..187a5103fd6 100644 --- a/src/NodeNestingScope/ValueObject/ControlStructure.php +++ b/src/NodeNestingScope/ValueObject/ControlStructure.php @@ -22,7 +22,7 @@ final class ControlStructure * These situations happens only if condition is met * @var array> */ - public const CONDITIONAL_NODE_SCOPE_TYPES = [ + public const array CONDITIONAL_NODE_SCOPE_TYPES = [ If_::class, While_::class, Do_::class, diff --git a/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php b/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php index 253bf742701..79396c755e6 100644 --- a/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php +++ b/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php @@ -29,10 +29,7 @@ */ final readonly class PHPStanServicesFactory { - /** - * @var string - */ - private const INVALID_BLEEDING_EDGE_PATH_MESSAGE = <<, NodeTypeResolverInterface> diff --git a/src/NodeTypeResolver/NodeTypeResolver/CastTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver/CastTypeResolver.php index d66eeaca621..aa0fbb2812c 100644 --- a/src/NodeTypeResolver/NodeTypeResolver/CastTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver/CastTypeResolver.php @@ -31,7 +31,7 @@ final class CastTypeResolver implements NodeTypeResolverInterface /** * @var array, class-string> */ - private const CAST_CLASS_TO_TYPE_MAP = [ + private const array CAST_CLASS_TO_TYPE_MAP = [ Bool_::class => BooleanType::class, String_::class => StringType::class, Int_::class => IntegerType::class, diff --git a/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php b/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php index 67bf6a55b93..0a36d5f8607 100644 --- a/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php +++ b/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php @@ -116,10 +116,7 @@ */ final readonly class PHPStanNodeScopeResolver { - /** - * @var string - */ - private const CONTEXT = 'context'; + private const string CONTEXT = 'context'; private NodeTraverser $nodeTraverser; diff --git a/src/PHPStanStaticTypeMapper/Enum/TypeKind.php b/src/PHPStanStaticTypeMapper/Enum/TypeKind.php index d821c8ac18e..49d6de14834 100644 --- a/src/PHPStanStaticTypeMapper/Enum/TypeKind.php +++ b/src/PHPStanStaticTypeMapper/Enum/TypeKind.php @@ -6,23 +6,11 @@ final class TypeKind { - /** - * @var string - */ - public const PROPERTY = 'property'; + public const string PROPERTY = 'property'; - /** - * @var string - */ - public const RETURN = 'return'; + public const string RETURN = 'return'; - /** - * @var string - */ - public const PARAM = 'param'; + public const string PARAM = 'param'; - /** - * @var string - */ - public const UNION = 'union'; + public const string UNION = 'union'; } diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapper.php index 4b1d91f49a3..43e6b4931b2 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapper.php @@ -32,10 +32,7 @@ */ final class ArrayTypeMapper implements TypeMapperInterface { - /** - * @var string - */ - public const HAS_GENERIC_TYPE_PARENT = 'has_generic_type_parent'; + public const string HAS_GENERIC_TYPE_PARENT = 'has_generic_type_parent'; private PHPStanStaticTypeMapper $phpStanStaticTypeMapper; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/StrictMixedTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/StrictMixedTypeMapper.php index e20a68e4ab7..71fc70c5bd5 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/StrictMixedTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/StrictMixedTypeMapper.php @@ -19,10 +19,7 @@ */ final readonly class StrictMixedTypeMapper implements TypeMapperInterface { - /** - * @var string - */ - private const MIXED = 'mixed'; + private const string MIXED = 'mixed'; public function __construct( private PhpVersionProvider $phpVersionProvider diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/VoidTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/VoidTypeMapper.php index 76080551dd6..649d40025b2 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/VoidTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/VoidTypeMapper.php @@ -19,10 +19,7 @@ */ final readonly class VoidTypeMapper implements TypeMapperInterface { - /** - * @var string - */ - private const VOID = 'void'; + private const string VOID = 'void'; public function __construct( private PhpVersionProvider $phpVersionProvider diff --git a/src/Parallel/Application/ParallelFileProcessor.php b/src/Parallel/Application/ParallelFileProcessor.php index 406f663dc04..a1c8d3e0696 100644 --- a/src/Parallel/Application/ParallelFileProcessor.php +++ b/src/Parallel/Application/ParallelFileProcessor.php @@ -37,18 +37,13 @@ */ final class ParallelFileProcessor { - /** - * @var int - */ - private const SYSTEM_ERROR_LIMIT = 50; + private const int SYSTEM_ERROR_LIMIT = 50; /** * The number of chunks a worker can process before getting killed. * In contrast the jobSize defines the maximum size of a chunk, a worker process at a time. - * - * @var int */ - private const MAX_CHUNKS_PER_WORKER = 8; + private const int MAX_CHUNKS_PER_WORKER = 8; private ProcessPool|null $processPool = null; diff --git a/src/Parallel/Command/WorkerCommandLineFactory.php b/src/Parallel/Command/WorkerCommandLineFactory.php index 72b2e484441..eb3ae448531 100644 --- a/src/Parallel/Command/WorkerCommandLineFactory.php +++ b/src/Parallel/Command/WorkerCommandLineFactory.php @@ -18,10 +18,7 @@ */ final readonly class WorkerCommandLineFactory { - /** - * @var string - */ - private const OPTION_DASHES = '--'; + private const string OPTION_DASHES = '--'; public function __construct( private CommandFromReflectionFactory $commandFromReflectionFactory, diff --git a/src/Parallel/ValueObject/Bridge.php b/src/Parallel/ValueObject/Bridge.php index b35cd93af83..0d581733025 100644 --- a/src/Parallel/ValueObject/Bridge.php +++ b/src/Parallel/ValueObject/Bridge.php @@ -9,33 +9,15 @@ */ final class Bridge { - /** - * @var string - */ - public const FILE_DIFFS = 'file_diffs'; - - /** - * @var string - */ - public const SYSTEM_ERRORS = 'system_errors'; - - /** - * @var string - */ - public const SYSTEM_ERRORS_COUNT = 'system_errors_count'; - - /** - * @var string - */ - public const FILES = 'files'; - - /** - * @var string - */ - public const FILES_COUNT = 'files_count'; - - /** - * @var string - */ - public const TOTAL_CHANGED = 'total_changed'; + public const string FILE_DIFFS = 'file_diffs'; + + public const string SYSTEM_ERRORS = 'system_errors'; + + public const string SYSTEM_ERRORS_COUNT = 'system_errors_count'; + + public const string FILES = 'files'; + + public const string FILES_COUNT = 'files_count'; + + public const string TOTAL_CHANGED = 'total_changed'; } diff --git a/src/Parallel/ValueObject/BridgeItem.php b/src/Parallel/ValueObject/BridgeItem.php index ae00491248e..e743242e190 100644 --- a/src/Parallel/ValueObject/BridgeItem.php +++ b/src/Parallel/ValueObject/BridgeItem.php @@ -10,48 +10,21 @@ */ final class BridgeItem { - /** - * @var string - */ - public const LINE = 'line'; - - /** - * @var string - */ - public const MESSAGE = 'message'; - - /** - * @var string - */ - public const RELATIVE_FILE_PATH = 'relative_file_path'; - - /** - * @var string - */ - public const ABSOLUTE_FILE_PATH = 'absolute_file_path'; - - /** - * @var string - */ - public const DIFF = 'diff'; - - /** - * @var string - */ - public const DIFF_CONSOLE_FORMATTED = 'diff_console_formatted'; - - /** - * @var string - */ - public const APPLIED_RECTORS = 'applied_rectors'; - - /** - * @var string - */ - public const RECTOR_CLASS = 'rector_class'; - - /** - * @var string - */ - public const RECTORS_WITH_LINE_CHANGES = 'rectors_with_line_changes'; + public const string LINE = 'line'; + + public const string MESSAGE = 'message'; + + public const string RELATIVE_FILE_PATH = 'relative_file_path'; + + public const string ABSOLUTE_FILE_PATH = 'absolute_file_path'; + + public const string DIFF = 'diff'; + + public const string DIFF_CONSOLE_FORMATTED = 'diff_console_formatted'; + + public const string APPLIED_RECTORS = 'applied_rectors'; + + public const string RECTOR_CLASS = 'rector_class'; + + public const string RECTORS_WITH_LINE_CHANGES = 'rectors_with_line_changes'; } diff --git a/src/Php/PhpVersionProvider.php b/src/Php/PhpVersionProvider.php index fd82ffaad6d..674c236bd83 100644 --- a/src/Php/PhpVersionProvider.php +++ b/src/Php/PhpVersionProvider.php @@ -19,10 +19,9 @@ final class PhpVersionProvider { /** - * @var string * @see https://regex101.com/r/qBMnbl/1 */ - private const VALID_PHP_VERSION_REGEX = '#^\d{5,6}$#'; + private const string VALID_PHP_VERSION_REGEX = '#^\d{5,6}$#'; private int|null $phpVersionFeatures = null; diff --git a/src/PhpAttribute/AttributeArrayNameInliner.php b/src/PhpAttribute/AttributeArrayNameInliner.php index e98f0ca736d..6ee6a72b284 100644 --- a/src/PhpAttribute/AttributeArrayNameInliner.php +++ b/src/PhpAttribute/AttributeArrayNameInliner.php @@ -18,7 +18,7 @@ final class AttributeArrayNameInliner /** * @var class-string */ - private const OPEN_API_PROPERTY_ATTRIBUTE = 'OpenApi\Attributes\Property'; + private const string OPEN_API_PROPERTY_ATTRIBUTE = 'OpenApi\Attributes\Property'; /** * @param Array_|list $array diff --git a/src/PhpAttribute/DeprecatedAnnotationToDeprecatedAttributeConverter.php b/src/PhpAttribute/DeprecatedAnnotationToDeprecatedAttributeConverter.php index 154fce0da30..7fbf2b22448 100644 --- a/src/PhpAttribute/DeprecatedAnnotationToDeprecatedAttributeConverter.php +++ b/src/PhpAttribute/DeprecatedAnnotationToDeprecatedAttributeConverter.php @@ -30,15 +30,13 @@ { /** * @see https://regex101.com/r/qNytVk/1 - * @var string */ - private const VERSION_MATCH_REGEX = '/^(?:(\d+\.\d+\.\d+)\s+)?(.*)$/'; + private const string VERSION_MATCH_REGEX = '/^(?:(\d+\.\d+\.\d+)\s+)?(.*)$/'; /** * @see https://regex101.com/r/SVDPOB/1 - * @var string */ - private const START_STAR_SPACED_REGEX = '#^ *\*#ms'; + private const string START_STAR_SPACED_REGEX = '#^ *\*#ms'; public function __construct( private PhpDocTagRemover $phpDocTagRemover, diff --git a/src/PhpAttribute/Enum/DocTagNodeState.php b/src/PhpAttribute/Enum/DocTagNodeState.php index 6afd10a3784..26fae37fcd0 100644 --- a/src/PhpAttribute/Enum/DocTagNodeState.php +++ b/src/PhpAttribute/Enum/DocTagNodeState.php @@ -6,8 +6,5 @@ final class DocTagNodeState { - /** - * @var string - */ - public const REMOVE_ARRAY = '__remove_array__'; + public const string REMOVE_ARRAY = '__remove_array__'; } diff --git a/src/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php b/src/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php index 9d1d3df5cc4..e668268c27b 100644 --- a/src/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php +++ b/src/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php @@ -27,9 +27,8 @@ final class PhpDocNodeTraverser * for the current node. * * @api - * @var int */ - public const DONT_TRAVERSE_CHILDREN = 1; + public const int DONT_TRAVERSE_CHILDREN = 1; /** * If NodeVisitor::enterNode() or NodeVisitor::leaveNode() returns STOP_TRAVERSAL, traversal is aborted. @@ -37,9 +36,8 @@ final class PhpDocNodeTraverser * The afterTraverse() method will still be invoked. * * @api - * @var int */ - public const STOP_TRAVERSAL = 2; + public const int STOP_TRAVERSAL = 2; /** * If NodeVisitor::leaveNode() returns NODE_REMOVE for a node that occurs in an array, it will be removed from the @@ -48,9 +46,8 @@ final class PhpDocNodeTraverser * For subsequent visitors leaveNode() will still be invoked for the removed node. * * @api - * @var int */ - public const NODE_REMOVE = 3; + public const int NODE_REMOVE = 3; /** * If NodeVisitor::enterNode() returns DONT_TRAVERSE_CURRENT_AND_CHILDREN, child nodes of the current node will not @@ -60,9 +57,8 @@ final class PhpDocNodeTraverser * enterNode() method invoked. * * @api - * @var int */ - public const DONT_TRAVERSE_CURRENT_AND_CHILDREN = 4; + public const int DONT_TRAVERSE_CURRENT_AND_CHILDREN = 4; /** * @var bool Whether traversal should be stopped diff --git a/src/PhpDocParser/PhpDocParser/ValueObject/PhpDocAttributeKey.php b/src/PhpDocParser/PhpDocParser/ValueObject/PhpDocAttributeKey.php index c5ac04342c3..4ab931c5325 100644 --- a/src/PhpDocParser/PhpDocParser/ValueObject/PhpDocAttributeKey.php +++ b/src/PhpDocParser/PhpDocParser/ValueObject/PhpDocAttributeKey.php @@ -6,13 +6,7 @@ final class PhpDocAttributeKey { - /** - * @var string - */ - public const PARENT = 'parent'; + public const string PARENT = 'parent'; - /** - * @var string - */ - public const ORIG_NODE = 'orig_node'; + public const string ORIG_NODE = 'orig_node'; } diff --git a/src/PhpDocParser/ValueObject/AttributeKey.php b/src/PhpDocParser/ValueObject/AttributeKey.php index ccb70da2d58..6525de98375 100644 --- a/src/PhpDocParser/ValueObject/AttributeKey.php +++ b/src/PhpDocParser/ValueObject/AttributeKey.php @@ -11,40 +11,26 @@ final class AttributeKey { /** * Used in php-parser, do not change - * - * @var string */ - public const KIND = 'kind'; + public const string KIND = 'kind'; /** * Used by php-parser, do not change - * - * @var string */ - public const COMMENTS = 'comments'; + public const string COMMENTS = 'comments'; /** * PHPStan @api Used in PHPStan for printed node content. Useful for printing error messages without need to reprint * it again. - * - * @var string */ - public const PHPSTAN_CACHE_PRINTER = 'phpstan_cache_printer'; + public const string PHPSTAN_CACHE_PRINTER = 'phpstan_cache_printer'; - /** - * @var string - */ - public const ASSIGNED_TO = 'assigned_to'; + public const string ASSIGNED_TO = 'assigned_to'; - /** - * @var string - */ - public const NULLSAFE_CHECKED = 'nullsafe_checked'; + public const string NULLSAFE_CHECKED = 'nullsafe_checked'; /** * PHPStan @api - * - * @var string */ - public const PARENT_STMT_TYPES = 'parentStmtTypes'; + public const string PARENT_STMT_TYPES = 'parentStmtTypes'; } diff --git a/src/PhpParser/Enum/NodeGroup.php b/src/PhpParser/Enum/NodeGroup.php index 0b109437487..fce2d1cec8f 100644 --- a/src/PhpParser/Enum/NodeGroup.php +++ b/src/PhpParser/Enum/NodeGroup.php @@ -39,7 +39,7 @@ final class NodeGroup * * @var array> */ - public const STMTS_AWARE = [ + public const array STMTS_AWARE = [ Block::class, Closure::class, Case_::class, @@ -63,7 +63,7 @@ final class NodeGroup /** * @var array> */ - public const STMTS_TO_HAVE_NEXT_NEWLINE = [ + public const array STMTS_TO_HAVE_NEXT_NEWLINE = [ ClassMethod::class, Function_::class, Property::class, diff --git a/src/PhpParser/Node/AssignAndBinaryMap.php b/src/PhpParser/Node/AssignAndBinaryMap.php index baebc2fb8dd..4da7e629619 100644 --- a/src/PhpParser/Node/AssignAndBinaryMap.php +++ b/src/PhpParser/Node/AssignAndBinaryMap.php @@ -49,7 +49,7 @@ final class AssignAndBinaryMap /** * @var array, class-string> */ - private const BINARY_OP_TO_INVERSE_CLASSES = [ + private const array BINARY_OP_TO_INVERSE_CLASSES = [ Identical::class => NotIdentical::class, NotIdentical::class => Identical::class, Equal::class => NotEqual::class, @@ -63,7 +63,7 @@ final class AssignAndBinaryMap /** * @var array, class-string> */ - private const ASSIGN_OP_TO_BINARY_OP_CLASSES = [ + private const array ASSIGN_OP_TO_BINARY_OP_CLASSES = [ AssignBitwiseOr::class => BitwiseOr::class, AssignBitwiseAnd::class => BitwiseAnd::class, AssignBitwiseXor::class => BitwiseXor::class, diff --git a/src/PhpParser/Node/NodeFactory.php b/src/PhpParser/Node/NodeFactory.php index 0c3f22e8cac..311ac81bac1 100644 --- a/src/PhpParser/Node/NodeFactory.php +++ b/src/PhpParser/Node/NodeFactory.php @@ -66,10 +66,7 @@ */ final readonly class NodeFactory { - /** - * @var string - */ - private const THIS = 'this'; + private const string THIS = 'this'; public function __construct( private BuilderFactory $builderFactory, diff --git a/src/PhpParser/NodeTransformer.php b/src/PhpParser/NodeTransformer.php index dfb535273e2..278b65c1b28 100644 --- a/src/PhpParser/NodeTransformer.php +++ b/src/PhpParser/NodeTransformer.php @@ -25,10 +25,9 @@ final class NodeTransformer { /** - * @var string * @see https://regex101.com/r/XFc3qA/1 */ - private const PERCENT_TEXT_REGEX = '#^%\w$#'; + private const string PERCENT_TEXT_REGEX = '#^%\w$#'; /** * @api used in phpunit symfony diff --git a/src/PhpParser/Parser/InlineCodeParser.php b/src/PhpParser/Parser/InlineCodeParser.php index 324da77feec..18bfe874ee3 100644 --- a/src/PhpParser/Parser/InlineCodeParser.php +++ b/src/PhpParser/Parser/InlineCodeParser.php @@ -18,46 +18,39 @@ final readonly class InlineCodeParser { /** - * @var string * @see https://regex101.com/r/dwe4OW/1 */ - private const PRESLASHED_DOLLAR_REGEX = '#\\\\\$#'; + private const string PRESLASHED_DOLLAR_REGEX = '#\\\\\$#'; /** - * @var string * @see https://regex101.com/r/tvwhWq/1 */ - private const CURLY_BRACKET_WRAPPER_REGEX = "#'{(\\\$.*?)}'#"; + private const string CURLY_BRACKET_WRAPPER_REGEX = "#'{(\\\$.*?)}'#"; /** - * @var string * @see https://regex101.com/r/TBlhoR/1 */ - private const OPEN_PHP_TAG_REGEX = '#^\<\?php\s+#'; + private const string OPEN_PHP_TAG_REGEX = '#^\<\?php\s+#'; /** - * @var string * @see https://regex101.com/r/TUWwKw/1/ */ - private const ENDING_SEMI_COLON_REGEX = '#;(\s+)?$#'; + private const string ENDING_SEMI_COLON_REGEX = '#;(\s+)?$#'; /** - * @var string * @see https://regex101.com/r/8fDjnR/1 */ - private const VARIABLE_IN_SINGLE_QUOTED_REGEX = '#\'(?\$.*)\'#U'; + private const string VARIABLE_IN_SINGLE_QUOTED_REGEX = '#\'(?\$.*)\'#U'; /** - * @var string * @see https://regex101.com/r/1lzQZv/1 */ - private const BACKREFERENCE_NO_QUOTE_REGEX = '#(?\\\\\d+)(?!")#'; + private const string BACKREFERENCE_NO_QUOTE_REGEX = '#(?\\\\\d+)(?!")#'; /** - * @var string * @see https://regex101.com/r/nSO3Eq/1 */ - private const BACKREFERENCE_NO_DOUBLE_QUOTE_START_REGEX = '#(?\$\d+)#'; + private const string BACKREFERENCE_NO_DOUBLE_QUOTE_START_REGEX = '#(?\$\d+)#'; public function __construct( private BetterStandardPrinter $betterStandardPrinter, diff --git a/src/PhpParser/Printer/BetterStandardPrinter.php b/src/PhpParser/Printer/BetterStandardPrinter.php index a3347d3553c..04849e5b3ed 100644 --- a/src/PhpParser/Printer/BetterStandardPrinter.php +++ b/src/PhpParser/Printer/BetterStandardPrinter.php @@ -48,9 +48,8 @@ final class BetterStandardPrinter extends Standard /** * Remove extra spaces before new Nop_ nodes * @see https://regex101.com/r/iSvroO/1 - * @var string */ - private const EXTRA_SPACE_BEFORE_NOP_REGEX = '#^[ \t]+$#m'; + private const string EXTRA_SPACE_BEFORE_NOP_REGEX = '#^[ \t]+$#m'; public function __construct( private readonly ExprAnalyzer $exprAnalyzer, diff --git a/src/Rector/AbstractRector.php b/src/Rector/AbstractRector.php index 6395e627b68..e7d0db63273 100644 --- a/src/Rector/AbstractRector.php +++ b/src/Rector/AbstractRector.php @@ -36,10 +36,7 @@ abstract class AbstractRector extends NodeVisitorAbstract implements RectorInterface { - /** - * @var string - */ - private const EMPTY_NODE_ARRAY_MESSAGE = <<refactor()" returns non-empty array for Nodes. A) Direct return null for no change: diff --git a/src/Set/Enum/SetGroup.php b/src/Set/Enum/SetGroup.php index 5a0f4bba5b4..a3ea3ecb1e6 100644 --- a/src/Set/Enum/SetGroup.php +++ b/src/Set/Enum/SetGroup.php @@ -9,54 +9,39 @@ */ final class SetGroup { - /** - * @var string - */ - public const CORE = 'core'; + public const string CORE = 'core'; - /** - * @var string - */ - public const PHP = 'php'; + public const string PHP = 'php'; /** * Version-based set provider - * @var string */ - public const TWIG = 'twig'; + public const string TWIG = 'twig'; /** * Version-based set provider - * @var string */ - public const PHPUNIT = 'phpunit'; + public const string PHPUNIT = 'phpunit'; /** * Version-based set provider - * @var string */ - public const DOCTRINE = 'doctrine'; + public const string DOCTRINE = 'doctrine'; /** * Version-based set provider - * @var string */ - public const SYMFONY = 'symfony'; + public const string SYMFONY = 'symfony'; /** * Version-based set provider - * @var string */ - public const NETTE_UTILS = 'nette-utils'; + public const string NETTE_UTILS = 'nette-utils'; /** * Version-based set provider - * @var string */ - public const LARAVEL = 'laravel'; + public const string LARAVEL = 'laravel'; - /** - * @var string - */ - public const ATTRIBUTES = 'attributes'; + public const string ATTRIBUTES = 'attributes'; } diff --git a/src/Set/ValueObject/ComposerTriggeredSet.php b/src/Set/ValueObject/ComposerTriggeredSet.php index 0298cac38c4..3964c7865be 100644 --- a/src/Set/ValueObject/ComposerTriggeredSet.php +++ b/src/Set/ValueObject/ComposerTriggeredSet.php @@ -15,10 +15,9 @@ final readonly class ComposerTriggeredSet implements SetInterface { /** - * @var string * @see https://regex101.com/r/ioYomu/1 */ - private const PACKAGE_REGEX = '#^[a-z0-9-]+\/([a-z0-9-_]+|\*)$#'; + private const string PACKAGE_REGEX = '#^[a-z0-9-]+\/([a-z0-9-_]+|\*)$#'; public function __construct( private string $groupName, diff --git a/src/Set/ValueObject/LevelSetList.php b/src/Set/ValueObject/LevelSetList.php index 1480caaf361..2286d668f8c 100644 --- a/src/Set/ValueObject/LevelSetList.php +++ b/src/Set/ValueObject/LevelSetList.php @@ -9,78 +9,33 @@ */ final class LevelSetList { - /** - * @var string - */ - public const UP_TO_PHP_85 = __DIR__ . '/../../../config/set/level/up-to-php85.php'; - - /** - * @var string - */ - public const UP_TO_PHP_84 = __DIR__ . '/../../../config/set/level/up-to-php84.php'; - - /** - * @var string - */ - public const UP_TO_PHP_83 = __DIR__ . '/../../../config/set/level/up-to-php83.php'; - - /** - * @var string - */ - public const UP_TO_PHP_82 = __DIR__ . '/../../../config/set/level/up-to-php82.php'; - - /** - * @var string - */ - public const UP_TO_PHP_81 = __DIR__ . '/../../../config/set/level/up-to-php81.php'; - - /** - * @var string - */ - public const UP_TO_PHP_80 = __DIR__ . '/../../../config/set/level/up-to-php80.php'; - - /** - * @var string - */ - public const UP_TO_PHP_74 = __DIR__ . '/../../../config/set/level/up-to-php74.php'; - - /** - * @var string - */ - public const UP_TO_PHP_73 = __DIR__ . '/../../../config/set/level/up-to-php73.php'; - - /** - * @var string - */ - public const UP_TO_PHP_72 = __DIR__ . '/../../../config/set/level/up-to-php72.php'; - - /** - * @var string - */ - public const UP_TO_PHP_71 = __DIR__ . '/../../../config/set/level/up-to-php71.php'; - - /** - * @var string - */ - public const UP_TO_PHP_70 = __DIR__ . '/../../../config/set/level/up-to-php70.php'; - - /** - * @var string - */ - public const UP_TO_PHP_56 = __DIR__ . '/../../../config/set/level/up-to-php56.php'; - - /** - * @var string - */ - public const UP_TO_PHP_55 = __DIR__ . '/../../../config/set/level/up-to-php55.php'; - - /** - * @var string - */ - public const UP_TO_PHP_54 = __DIR__ . '/../../../config/set/level/up-to-php54.php'; - - /** - * @var string - */ - public const UP_TO_PHP_53 = __DIR__ . '/../../../config/set/level/up-to-php53.php'; + public const string UP_TO_PHP_85 = __DIR__ . '/../../../config/set/level/up-to-php85.php'; + + public const string UP_TO_PHP_84 = __DIR__ . '/../../../config/set/level/up-to-php84.php'; + + public const string UP_TO_PHP_83 = __DIR__ . '/../../../config/set/level/up-to-php83.php'; + + public const string UP_TO_PHP_82 = __DIR__ . '/../../../config/set/level/up-to-php82.php'; + + public const string UP_TO_PHP_81 = __DIR__ . '/../../../config/set/level/up-to-php81.php'; + + public const string UP_TO_PHP_80 = __DIR__ . '/../../../config/set/level/up-to-php80.php'; + + public const string UP_TO_PHP_74 = __DIR__ . '/../../../config/set/level/up-to-php74.php'; + + public const string UP_TO_PHP_73 = __DIR__ . '/../../../config/set/level/up-to-php73.php'; + + public const string UP_TO_PHP_72 = __DIR__ . '/../../../config/set/level/up-to-php72.php'; + + public const string UP_TO_PHP_71 = __DIR__ . '/../../../config/set/level/up-to-php71.php'; + + public const string UP_TO_PHP_70 = __DIR__ . '/../../../config/set/level/up-to-php70.php'; + + public const string UP_TO_PHP_56 = __DIR__ . '/../../../config/set/level/up-to-php56.php'; + + public const string UP_TO_PHP_55 = __DIR__ . '/../../../config/set/level/up-to-php55.php'; + + public const string UP_TO_PHP_54 = __DIR__ . '/../../../config/set/level/up-to-php54.php'; + + public const string UP_TO_PHP_53 = __DIR__ . '/../../../config/set/level/up-to-php53.php'; } diff --git a/src/Set/ValueObject/SetList.php b/src/Set/ValueObject/SetList.php index 5dc2a7ce781..2fc8199cddb 100644 --- a/src/Set/ValueObject/SetList.php +++ b/src/Set/ValueObject/SetList.php @@ -11,167 +11,77 @@ final class SetList { /** * @internal - * @var string */ - public const PHP_POLYFILLS = __DIR__ . '/../../../config/set/php-polyfills.php'; + public const string PHP_POLYFILLS = __DIR__ . '/../../../config/set/php-polyfills.php'; - /** - * @var string - */ - public const CODE_QUALITY = __DIR__ . '/../../../config/set/code-quality.php'; + public const string CODE_QUALITY = __DIR__ . '/../../../config/set/code-quality.php'; - /** - * @var string - */ - public const CODING_STYLE = __DIR__ . '/../../../config/set/coding-style.php'; + public const string CODING_STYLE = __DIR__ . '/../../../config/set/coding-style.php'; - /** - * @var string - */ - public const DEAD_CODE = __DIR__ . '/../../../config/set/dead-code.php'; + public const string DEAD_CODE = __DIR__ . '/../../../config/set/dead-code.php'; /** * @deprecated As too strict and not practical. Use code quality and coding style sets instead. - * @var string */ - public const STRICT_BOOLEANS = __DIR__ . '/../../../config/set/strict-booleans.php'; + public const string STRICT_BOOLEANS = __DIR__ . '/../../../config/set/strict-booleans.php'; - /** - * @var string - */ - public const GMAGICK_TO_IMAGICK = __DIR__ . '/../../../config/set/gmagick-to-imagick.php'; + public const string GMAGICK_TO_IMAGICK = __DIR__ . '/../../../config/set/gmagick-to-imagick.php'; - /** - * @var string - */ - public const NAMING = __DIR__ . '/../../../config/set/naming.php'; + public const string NAMING = __DIR__ . '/../../../config/set/naming.php'; /** * Opinionated rules that match rector coding standard - * - * @var string */ - public const RECTOR_PRESET = __DIR__ . '/../../../config/set/rector-preset.php'; + public const string RECTOR_PRESET = __DIR__ . '/../../../config/set/rector-preset.php'; - /** - * @var string - */ - public const PHP_52 = __DIR__ . '/../../../config/set/php52.php'; + public const string PHP_52 = __DIR__ . '/../../../config/set/php52.php'; - /** - * @var string - */ - public const PHP_53 = __DIR__ . '/../../../config/set/php53.php'; + public const string PHP_53 = __DIR__ . '/../../../config/set/php53.php'; - /** - * @var string - */ - public const PHP_54 = __DIR__ . '/../../../config/set/php54.php'; + public const string PHP_54 = __DIR__ . '/../../../config/set/php54.php'; - /** - * @var string - */ - public const PHP_55 = __DIR__ . '/../../../config/set/php55.php'; + public const string PHP_55 = __DIR__ . '/../../../config/set/php55.php'; - /** - * @var string - */ - public const PHP_56 = __DIR__ . '/../../../config/set/php56.php'; + public const string PHP_56 = __DIR__ . '/../../../config/set/php56.php'; - /** - * @var string - */ - public const PHP_70 = __DIR__ . '/../../../config/set/php70.php'; + public const string PHP_70 = __DIR__ . '/../../../config/set/php70.php'; - /** - * @var string - */ - public const PHP_71 = __DIR__ . '/../../../config/set/php71.php'; + public const string PHP_71 = __DIR__ . '/../../../config/set/php71.php'; - /** - * @var string - */ - public const PHP_72 = __DIR__ . '/../../../config/set/php72.php'; + public const string PHP_72 = __DIR__ . '/../../../config/set/php72.php'; - /** - * @var string - */ - public const PHP_73 = __DIR__ . '/../../../config/set/php73.php'; + public const string PHP_73 = __DIR__ . '/../../../config/set/php73.php'; - /** - * @var string - */ - public const PHP_74 = __DIR__ . '/../../../config/set/php74.php'; + public const string PHP_74 = __DIR__ . '/../../../config/set/php74.php'; - /** - * @var string - */ - public const PHP_80 = __DIR__ . '/../../../config/set/php80.php'; + public const string PHP_80 = __DIR__ . '/../../../config/set/php80.php'; - /** - * @var string - */ - public const PHP_81 = __DIR__ . '/../../../config/set/php81.php'; + public const string PHP_81 = __DIR__ . '/../../../config/set/php81.php'; - /** - * @var string - */ - public const PHP_82 = __DIR__ . '/../../../config/set/php82.php'; + public const string PHP_82 = __DIR__ . '/../../../config/set/php82.php'; - /** - * @var string - */ - public const PHP_83 = __DIR__ . '/../../../config/set/php83.php'; + public const string PHP_83 = __DIR__ . '/../../../config/set/php83.php'; - /** - * @var string - */ - public const PHP_84 = __DIR__ . '/../../../config/set/php84.php'; + public const string PHP_84 = __DIR__ . '/../../../config/set/php84.php'; - /** - * @var string - */ - public const PHP_85 = __DIR__ . '/../../../config/set/php85.php'; + public const string PHP_85 = __DIR__ . '/../../../config/set/php85.php'; - /** - * @var string - */ - public const PRIVATIZATION = __DIR__ . '/../../../config/set/privatization.php'; + public const string PRIVATIZATION = __DIR__ . '/../../../config/set/privatization.php'; - /** - * @var string - */ - public const TYPE_DECLARATION = __DIR__ . '/../../../config/set/type-declaration.php'; + public const string TYPE_DECLARATION = __DIR__ . '/../../../config/set/type-declaration.php'; - /** - * @var string - */ - public const TYPE_DECLARATION_DOCBLOCKS = __DIR__ . '/../../../config/set/type-declaration-docblocks.php'; + public const string TYPE_DECLARATION_DOCBLOCKS = __DIR__ . '/../../../config/set/type-declaration-docblocks.php'; - /** - * @var string - */ - public const EARLY_RETURN = __DIR__ . '/../../../config/set/early-return.php'; + public const string EARLY_RETURN = __DIR__ . '/../../../config/set/early-return.php'; - /** - * @var string - */ - public const INSTANCEOF = __DIR__ . '/../../../config/set/instanceof.php'; + public const string INSTANCEOF = __DIR__ . '/../../../config/set/instanceof.php'; - /** - * @var string - */ - public const CARBON = __DIR__ . '/../../../config/set/datetime-to-carbon.php'; + public const string CARBON = __DIR__ . '/../../../config/set/datetime-to-carbon.php'; - /** - * @var string - */ - public const BEHAT_ANNOTATIONS_TO_ATTRIBUTES = __DIR__ . '/../../../config/set/behat-annotations-to-attributes.php'; + public const string BEHAT_ANNOTATIONS_TO_ATTRIBUTES = __DIR__ . '/../../../config/set/behat-annotations-to-attributes.php'; /** * @experimental Check generic types in runtime with assert. Generics for impatient people. - * - * @var string */ - public const ASSERT = __DIR__ . '/../../../config/set/assert.php'; + public const string ASSERT = __DIR__ . '/../../../config/set/assert.php'; } diff --git a/src/StaticTypeMapper/Mapper/ScalarStringToTypeMapper.php b/src/StaticTypeMapper/Mapper/ScalarStringToTypeMapper.php index 1d424c366b0..36d0e79d0e8 100644 --- a/src/StaticTypeMapper/Mapper/ScalarStringToTypeMapper.php +++ b/src/StaticTypeMapper/Mapper/ScalarStringToTypeMapper.php @@ -32,7 +32,7 @@ final class ScalarStringToTypeMapper /** * @var array, string[]> */ - private const SCALAR_NAME_BY_TYPE = [ + private const array SCALAR_NAME_BY_TYPE = [ StringType::class => ['string'], AccessoryNonEmptyStringType::class => ['non-empty-string'], NonEmptyArrayType::class => ['non-empty-array'], diff --git a/src/Util/MemoryLimiter.php b/src/Util/MemoryLimiter.php index 6c302192cf7..17f06b75fd5 100644 --- a/src/Util/MemoryLimiter.php +++ b/src/Util/MemoryLimiter.php @@ -14,10 +14,9 @@ final class MemoryLimiter { /** - * @var string * @see https://regex101.com/r/pmiGUM/1 */ - private const VALID_MEMORY_LIMIT_REGEX = '#^-?\d+[kMG]?$#i'; + private const string VALID_MEMORY_LIMIT_REGEX = '#^-?\d+[kMG]?$#i'; public function adjust(Configuration $configuration): void { diff --git a/src/Util/NewLineSplitter.php b/src/Util/NewLineSplitter.php index 3b3ef1856f6..af11ca9a66e 100644 --- a/src/Util/NewLineSplitter.php +++ b/src/Util/NewLineSplitter.php @@ -9,10 +9,9 @@ final class NewLineSplitter { /** - * @var string * @see https://regex101.com/r/qduj2O/4 */ - private const NEWLINES_REGEX = "#\r?\n#"; + private const string NEWLINES_REGEX = "#\r?\n#"; /** * @return string[] diff --git a/src/Util/NodePrinter.php b/src/Util/NodePrinter.php index 82b28e37bf3..e914692dcc4 100644 --- a/src/Util/NodePrinter.php +++ b/src/Util/NodePrinter.php @@ -12,16 +12,14 @@ final readonly class NodePrinter { /** - * @var string * @see https://regex101.com/r/Fe8n73/1 */ - private const CLASS_NAME_REGEX = '#(?PhpParser(.*?))\(#ms'; + private const string CLASS_NAME_REGEX = '#(?PhpParser(.*?))\(#ms'; /** - * @var string * @see https://regex101.com/r/uQFuvL/1 */ - private const PROPERTY_KEY_REGEX = '#(?[\w\d]+)\:#'; + private const string PROPERTY_KEY_REGEX = '#(?[\w\d]+)\:#'; public function __construct( private SymfonyStyle $symfonyStyle diff --git a/src/Validation/RectorAssert.php b/src/Validation/RectorAssert.php index d950ebe9537..3cd55b4f17b 100644 --- a/src/Validation/RectorAssert.php +++ b/src/Validation/RectorAssert.php @@ -15,42 +15,33 @@ final class RectorAssert /** * @see https://stackoverflow.com/a/12011255/1348344 * @see https://regex101.com/r/PYQaPF/1 - * @var string */ - private const CLASS_NAME_REGEX = '#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*$#'; + private const string CLASS_NAME_REGEX = '#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*$#'; /** * @see https://stackoverflow.com/a/60470526/1348344 * @see https://regex101.com/r/37aUWA/1 - * - * @var string */ - private const NAKED_NAMESPACE_REGEX = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\\\\]*[a-zA-Z0-9_\x7f-\xff]'; + private const string NAKED_NAMESPACE_REGEX = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\\\\]*[a-zA-Z0-9_\x7f-\xff]'; /** * @see https://www.php.net/manual/en/language.variables.basics.php * @see https://regex101.com/r/hFw17T/1 - * - * @var string */ - private const PROPERTY_NAME_REGEX = '#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#'; + private const string PROPERTY_NAME_REGEX = '#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#'; /** * @see https://regex101.com/r/uh5B0S/2 * @see https://www.php.net/manual/en/functions.user-defined.php * @see https://www.php.net/manual/en/language.constants.php - * - * @var string */ - private const METHOD_OR_CONSTANT_NAME_REGEX = '#^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$#'; + private const string METHOD_OR_CONSTANT_NAME_REGEX = '#^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$#'; /** * @see https://regex101.com/r/uh5B0S/1 * @see https://www.php.net/manual/en/functions.user-defined.php - * - * @var string */ - private const FUNCTION_NAME_REGEX = '#^(' . self::NAKED_NAMESPACE_REGEX . '\\\\)?([a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)$#'; + private const string FUNCTION_NAME_REGEX = '#^(' . self::NAKED_NAMESPACE_REGEX . '\\\\)?([a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*)$#'; public static function constantName(string $name): void { diff --git a/src/ValueObject/MethodName.php b/src/ValueObject/MethodName.php index 7bd3daf4faa..7119ab7b8c2 100644 --- a/src/ValueObject/MethodName.php +++ b/src/ValueObject/MethodName.php @@ -10,76 +10,38 @@ */ final class MethodName { - /** - * @var string - */ - public const __SET = '__set'; + public const string __SET = '__set'; - /** - * @var string - */ - public const __GET = '__get'; + public const string __GET = '__get'; - /** - * @var string - */ - public const CONSTRUCT = '__construct'; + public const string CONSTRUCT = '__construct'; - /** - * @var string - */ - public const DESTRUCT = '__destruct'; + public const string DESTRUCT = '__destruct'; - /** - * @var string - */ - public const CLONE = '__clone'; + public const string CLONE = '__clone'; /** * Mostly used in unit tests * @see https://phpunit.readthedocs.io/en/9.3/fixtures.html#more-setup-than-teardown - * @var string */ - public const SET_UP = 'setUp'; + public const string SET_UP = 'setUp'; - /** - * @var string - */ - public const SET_STATE = '__set_state'; + public const string SET_STATE = '__set_state'; /** * @see https://phpunit.readthedocs.io/en/9.3/fixtures.html#fixtures-sharing-fixture-examples-databasetest-php - * @var string */ - public const SET_UP_BEFORE_CLASS = 'setUpBeforeClass'; + public const string SET_UP_BEFORE_CLASS = 'setUpBeforeClass'; - /** - * @var string - */ - public const CALL = '__call'; + public const string CALL = '__call'; - /** - * @var string - */ - public const CALL_STATIC = '__callStatic'; + public const string CALL_STATIC = '__callStatic'; - /** - * @var string - */ - public const TO_STRING = '__toString'; + public const string TO_STRING = '__toString'; - /** - * @var string - */ - public const INVOKE = '__invoke'; + public const string INVOKE = '__invoke'; - /** - * @var string - */ - public const ISSET = '__isset'; + public const string ISSET = '__isset'; - /** - * @var string - */ - public const UNSET = '__unset'; + public const string UNSET = '__unset'; } diff --git a/src/ValueObject/PhpVersion.php b/src/ValueObject/PhpVersion.php index 6903e9aac76..629483b5b16 100644 --- a/src/ValueObject/PhpVersion.php +++ b/src/ValueObject/PhpVersion.php @@ -9,88 +9,37 @@ */ final class PhpVersion { - /** - * @var int - */ - public const PHP_52 = 50200; - - /** - * @var int - */ - public const PHP_53 = 50300; - - /** - * @var int - */ - public const PHP_54 = 50400; - - /** - * @var int - */ - public const PHP_55 = 50500; - - /** - * @var int - */ - public const PHP_56 = 50600; - - /** - * @var int - */ - public const PHP_70 = 70000; - - /** - * @var int - */ - public const PHP_71 = 70100; - - /** - * @var int - */ - public const PHP_72 = 70200; - - /** - * @var int - */ - public const PHP_73 = 70300; - - /** - * @var int - */ - public const PHP_74 = 70400; - - /** - * @var int - */ - public const PHP_80 = 80000; - - /** - * @var int - */ - public const PHP_81 = 80100; - - /** - * @var int - */ - public const PHP_82 = 80200; - - /** - * @var int - */ - public const PHP_83 = 80300; - - /** - * @var int - */ - public const PHP_84 = 80400; - - /** - * @var int - */ - public const PHP_85 = 80500; - - /** - * @var int - */ - public const PHP_10 = 100000; + public const int PHP_52 = 50200; + + public const int PHP_53 = 50300; + + public const int PHP_54 = 50400; + + public const int PHP_55 = 50500; + + public const int PHP_56 = 50600; + + public const int PHP_70 = 70000; + + public const int PHP_71 = 70100; + + public const int PHP_72 = 70200; + + public const int PHP_73 = 70300; + + public const int PHP_74 = 70400; + + public const int PHP_80 = 80000; + + public const int PHP_81 = 80100; + + public const int PHP_82 = 80200; + + public const int PHP_83 = 80300; + + public const int PHP_84 = 80400; + + public const int PHP_85 = 80500; + + public const int PHP_10 = 100000; } diff --git a/src/ValueObject/PhpVersionFeature.php b/src/ValueObject/PhpVersionFeature.php index cbda1f5cba6..1cfe19b9df6 100644 --- a/src/ValueObject/PhpVersionFeature.php +++ b/src/ValueObject/PhpVersionFeature.php @@ -9,841 +9,490 @@ */ final class PhpVersionFeature { - /** - * @var int - */ - public const PROPERTY_MODIFIER = PhpVersion::PHP_52; + public const int PROPERTY_MODIFIER = PhpVersion::PHP_52; - /** - * @var int - */ - public const CONTINUE_TO_BREAK = PhpVersion::PHP_52; + public const int CONTINUE_TO_BREAK = PhpVersion::PHP_52; - /** - * @var int - */ - public const NO_REFERENCE_IN_NEW = PhpVersion::PHP_53; + public const int NO_REFERENCE_IN_NEW = PhpVersion::PHP_53; - /** - * @var int - */ - public const SERVER_VAR = PhpVersion::PHP_53; + public const int SERVER_VAR = PhpVersion::PHP_53; - /** - * @var int - */ - public const DIR_CONSTANT = PhpVersion::PHP_53; + public const int DIR_CONSTANT = PhpVersion::PHP_53; - /** - * @var int - */ - public const ELVIS_OPERATOR = PhpVersion::PHP_53; + public const int ELVIS_OPERATOR = PhpVersion::PHP_53; - /** - * @var int - */ - public const ANONYMOUS_FUNCTION_PARAM_TYPE = PhpVersion::PHP_53; + public const int ANONYMOUS_FUNCTION_PARAM_TYPE = PhpVersion::PHP_53; - /** - * @var int - */ - public const NO_ZERO_BREAK = PhpVersion::PHP_54; + public const int NO_ZERO_BREAK = PhpVersion::PHP_54; - /** - * @var int - */ - public const NO_REFERENCE_IN_ARG = PhpVersion::PHP_54; + public const int NO_REFERENCE_IN_ARG = PhpVersion::PHP_54; - /** - * @var int - */ - public const SHORT_ARRAY = PhpVersion::PHP_54; + public const int SHORT_ARRAY = PhpVersion::PHP_54; - /** - * @var int - */ - public const DATE_TIME_INTERFACE = PhpVersion::PHP_55; + public const int DATE_TIME_INTERFACE = PhpVersion::PHP_55; /** * @see https://wiki.php.net/rfc/class_name_scalars - * @var int */ - public const CLASSNAME_CONSTANT = PhpVersion::PHP_55; + public const int CLASSNAME_CONSTANT = PhpVersion::PHP_55; - /** - * @var int - */ - public const PREG_REPLACE_CALLBACK_E_MODIFIER = PhpVersion::PHP_55; + public const int PREG_REPLACE_CALLBACK_E_MODIFIER = PhpVersion::PHP_55; - /** - * @var int - */ - public const EXP_OPERATOR = PhpVersion::PHP_56; + public const int EXP_OPERATOR = PhpVersion::PHP_56; - /** - * @var int - */ - public const REQUIRE_DEFAULT_VALUE = PhpVersion::PHP_56; + public const int REQUIRE_DEFAULT_VALUE = PhpVersion::PHP_56; - /** - * @var int - */ - public const SCALAR_TYPES = PhpVersion::PHP_70; + public const int SCALAR_TYPES = PhpVersion::PHP_70; - /** - * @var int - */ - public const HAS_RETURN_TYPE = PhpVersion::PHP_70; + public const int HAS_RETURN_TYPE = PhpVersion::PHP_70; - /** - * @var int - */ - public const NULL_COALESCE = PhpVersion::PHP_70; + public const int NULL_COALESCE = PhpVersion::PHP_70; - /** - * @var int - */ - public const LIST_SWAP_ORDER = PhpVersion::PHP_70; + public const int LIST_SWAP_ORDER = PhpVersion::PHP_70; - /** - * @var int - */ - public const SPACESHIP = PhpVersion::PHP_70; + public const int SPACESHIP = PhpVersion::PHP_70; - /** - * @var int - */ - public const DIRNAME_LEVELS = PhpVersion::PHP_70; + public const int DIRNAME_LEVELS = PhpVersion::PHP_70; - /** - * @var int - */ - public const CSPRNG_FUNCTIONS = PhpVersion::PHP_70; + public const int CSPRNG_FUNCTIONS = PhpVersion::PHP_70; - /** - * @var int - */ - public const THROWABLE_TYPE = PhpVersion::PHP_70; + public const int THROWABLE_TYPE = PhpVersion::PHP_70; - /** - * @var int - */ - public const NO_LIST_SPLIT_STRING = PhpVersion::PHP_70; + public const int NO_LIST_SPLIT_STRING = PhpVersion::PHP_70; - /** - * @var int - */ - public const NO_BREAK_OUTSIDE_LOOP = PhpVersion::PHP_70; + public const int NO_BREAK_OUTSIDE_LOOP = PhpVersion::PHP_70; - /** - * @var int - */ - public const NO_PHP4_CONSTRUCTOR = PhpVersion::PHP_70; + public const int NO_PHP4_CONSTRUCTOR = PhpVersion::PHP_70; - /** - * @var int - */ - public const NO_CALL_USER_METHOD = PhpVersion::PHP_70; + public const int NO_CALL_USER_METHOD = PhpVersion::PHP_70; - /** - * @var int - */ - public const NO_EREG_FUNCTION = PhpVersion::PHP_70; + public const int NO_EREG_FUNCTION = PhpVersion::PHP_70; - /** - * @var int - */ - public const VARIABLE_ON_FUNC_CALL = PhpVersion::PHP_70; + public const int VARIABLE_ON_FUNC_CALL = PhpVersion::PHP_70; - /** - * @var int - */ - public const NO_MKTIME_WITHOUT_ARG = PhpVersion::PHP_70; + public const int NO_MKTIME_WITHOUT_ARG = PhpVersion::PHP_70; - /** - * @var int - */ - public const NO_EMPTY_LIST = PhpVersion::PHP_70; + public const int NO_EMPTY_LIST = PhpVersion::PHP_70; /** * @see https://php.watch/versions/8.0/non-static-static-call-fatal-error * Deprecated since PHP 7.0 - * - * @var int */ - public const STATIC_CALL_ON_NON_STATIC = PhpVersion::PHP_70; + public const int STATIC_CALL_ON_NON_STATIC = PhpVersion::PHP_70; - /** - * @var int - */ - public const INSTANCE_CALL = PhpVersion::PHP_70; + public const int INSTANCE_CALL = PhpVersion::PHP_70; - /** - * @var int - */ - public const NO_MULTIPLE_DEFAULT_SWITCH = PhpVersion::PHP_70; + public const int NO_MULTIPLE_DEFAULT_SWITCH = PhpVersion::PHP_70; - /** - * @var int - */ - public const WRAP_VARIABLE_VARIABLE = PhpVersion::PHP_70; + public const int WRAP_VARIABLE_VARIABLE = PhpVersion::PHP_70; - /** - * @var int - */ - public const ANONYMOUS_FUNCTION_RETURN_TYPE = PhpVersion::PHP_70; + public const int ANONYMOUS_FUNCTION_RETURN_TYPE = PhpVersion::PHP_70; - /** - * @var int - */ - public const ITERABLE_TYPE = PhpVersion::PHP_71; + public const int ITERABLE_TYPE = PhpVersion::PHP_71; - /** - * @var int - */ - public const VOID_TYPE = PhpVersion::PHP_71; + public const int VOID_TYPE = PhpVersion::PHP_71; - /** - * @var int - */ - public const CONSTANT_VISIBILITY = PhpVersion::PHP_71; + public const int CONSTANT_VISIBILITY = PhpVersion::PHP_71; - /** - * @var int - */ - public const ARRAY_DESTRUCT = PhpVersion::PHP_71; + public const int ARRAY_DESTRUCT = PhpVersion::PHP_71; - /** - * @var int - */ - public const MULTI_EXCEPTION_CATCH = PhpVersion::PHP_71; + public const int MULTI_EXCEPTION_CATCH = PhpVersion::PHP_71; - /** - * @var int - */ - public const NO_ASSIGN_ARRAY_TO_STRING = PhpVersion::PHP_71; + public const int NO_ASSIGN_ARRAY_TO_STRING = PhpVersion::PHP_71; - /** - * @var int - */ - public const BINARY_OP_NUMBER_STRING = PhpVersion::PHP_71; + public const int BINARY_OP_NUMBER_STRING = PhpVersion::PHP_71; - /** - * @var int - */ - public const NO_EXTRA_PARAMETERS = PhpVersion::PHP_71; + public const int NO_EXTRA_PARAMETERS = PhpVersion::PHP_71; - /** - * @var int - */ - public const RESERVED_OBJECT_KEYWORD = PhpVersion::PHP_71; + public const int RESERVED_OBJECT_KEYWORD = PhpVersion::PHP_71; - /** - * @var int - */ - public const DEPRECATE_EACH = PhpVersion::PHP_72; + public const int DEPRECATE_EACH = PhpVersion::PHP_72; - /** - * @var int - */ - public const OBJECT_TYPE = PhpVersion::PHP_72; + public const int OBJECT_TYPE = PhpVersion::PHP_72; - /** - * @var int - */ - public const NO_EACH_OUTSIDE_LOOP = PhpVersion::PHP_72; + public const int NO_EACH_OUTSIDE_LOOP = PhpVersion::PHP_72; - /** - * @var int - */ - public const DEPRECATE_CREATE_FUNCTION = PhpVersion::PHP_72; + public const int DEPRECATE_CREATE_FUNCTION = PhpVersion::PHP_72; - /** - * @var int - */ - public const NO_NULL_ON_GET_CLASS = PhpVersion::PHP_72; + public const int NO_NULL_ON_GET_CLASS = PhpVersion::PHP_72; - /** - * @var int - */ - public const INVERTED_BOOL_IS_OBJECT_INCOMPLETE_CLASS = PhpVersion::PHP_72; + public const int INVERTED_BOOL_IS_OBJECT_INCOMPLETE_CLASS = PhpVersion::PHP_72; - /** - * @var int - */ - public const RESULT_ARG_IN_PARSE_STR = PhpVersion::PHP_72; + public const int RESULT_ARG_IN_PARSE_STR = PhpVersion::PHP_72; - /** - * @var int - */ - public const STRING_IN_FIRST_DEFINE_ARG = PhpVersion::PHP_72; + public const int STRING_IN_FIRST_DEFINE_ARG = PhpVersion::PHP_72; - /** - * @var int - */ - public const STRING_IN_ASSERT_ARG = PhpVersion::PHP_72; + public const int STRING_IN_ASSERT_ARG = PhpVersion::PHP_72; - /** - * @var int - */ - public const NO_UNSET_CAST = PhpVersion::PHP_72; + public const int NO_UNSET_CAST = PhpVersion::PHP_72; - /** - * @var int - */ - public const IS_COUNTABLE = PhpVersion::PHP_73; + public const int IS_COUNTABLE = PhpVersion::PHP_73; - /** - * @var int - */ - public const ARRAY_KEY_FIRST_LAST = PhpVersion::PHP_73; + public const int ARRAY_KEY_FIRST_LAST = PhpVersion::PHP_73; /** - * @var int * @see https://php.watch/versions/8.5/array_first-array_last */ - public const ARRAY_FIRST_LAST = PhpVersion::PHP_85; + public const int ARRAY_FIRST_LAST = PhpVersion::PHP_85; - /** - * @var int - */ - public const JSON_EXCEPTION = PhpVersion::PHP_73; + public const int JSON_EXCEPTION = PhpVersion::PHP_73; - /** - * @var int - */ - public const SETCOOKIE_ACCEPT_ARRAY_OPTIONS = PhpVersion::PHP_73; + public const int SETCOOKIE_ACCEPT_ARRAY_OPTIONS = PhpVersion::PHP_73; - /** - * @var int - */ - public const DEPRECATE_INSENSITIVE_CONSTANT_NAME = PhpVersion::PHP_73; + public const int DEPRECATE_INSENSITIVE_CONSTANT_NAME = PhpVersion::PHP_73; - /** - * @var int - */ - public const ESCAPE_DASH_IN_REGEX = PhpVersion::PHP_73; + public const int ESCAPE_DASH_IN_REGEX = PhpVersion::PHP_73; - /** - * @var int - */ - public const DEPRECATE_INSENSITIVE_CONSTANT_DEFINE = PhpVersion::PHP_73; + public const int DEPRECATE_INSENSITIVE_CONSTANT_DEFINE = PhpVersion::PHP_73; - /** - * @var int - */ - public const DEPRECATE_INT_IN_STR_NEEDLES = PhpVersion::PHP_73; + public const int DEPRECATE_INT_IN_STR_NEEDLES = PhpVersion::PHP_73; - /** - * @var int - */ - public const SENSITIVE_HERE_NOW_DOC = PhpVersion::PHP_73; + public const int SENSITIVE_HERE_NOW_DOC = PhpVersion::PHP_73; - /** - * @var int - */ - public const ARROW_FUNCTION = PhpVersion::PHP_74; + public const int ARROW_FUNCTION = PhpVersion::PHP_74; - /** - * @var int - */ - public const LITERAL_SEPARATOR = PhpVersion::PHP_74; + public const int LITERAL_SEPARATOR = PhpVersion::PHP_74; - /** - * @var int - */ - public const NULL_COALESCE_ASSIGN = PhpVersion::PHP_74; + public const int NULL_COALESCE_ASSIGN = PhpVersion::PHP_74; - /** - * @var int - */ - public const TYPED_PROPERTIES = PhpVersion::PHP_74; + public const int TYPED_PROPERTIES = PhpVersion::PHP_74; /** * @see https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters - * @var int */ - public const COVARIANT_RETURN = PhpVersion::PHP_74; + public const int COVARIANT_RETURN = PhpVersion::PHP_74; - /** - * @var int - */ - public const ARRAY_SPREAD = PhpVersion::PHP_74; + public const int ARRAY_SPREAD = PhpVersion::PHP_74; - /** - * @var int - */ - public const DEPRECATE_CURLY_BRACKET_ARRAY_STRING = PhpVersion::PHP_74; + public const int DEPRECATE_CURLY_BRACKET_ARRAY_STRING = PhpVersion::PHP_74; - /** - * @var int - */ - public const DEPRECATE_REAL = PhpVersion::PHP_74; + public const int DEPRECATE_REAL = PhpVersion::PHP_74; - /** - * @var int - */ - public const DEPRECATE_MONEY_FORMAT = PhpVersion::PHP_74; + public const int DEPRECATE_MONEY_FORMAT = PhpVersion::PHP_74; - /** - * @var int - */ - public const ARRAY_KEY_EXISTS_TO_PROPERTY_EXISTS = PhpVersion::PHP_74; + public const int ARRAY_KEY_EXISTS_TO_PROPERTY_EXISTS = PhpVersion::PHP_74; - /** - * @var int - */ - public const FILTER_VAR_TO_ADD_SLASHES = PhpVersion::PHP_74; + public const int FILTER_VAR_TO_ADD_SLASHES = PhpVersion::PHP_74; - /** - * @var int - */ - public const CHANGE_MB_STRPOS_ARG_POSITION = PhpVersion::PHP_74; + public const int CHANGE_MB_STRPOS_ARG_POSITION = PhpVersion::PHP_74; - /** - * @var int - */ - public const RESERVED_FN_FUNCTION_NAME = PhpVersion::PHP_74; + public const int RESERVED_FN_FUNCTION_NAME = PhpVersion::PHP_74; - /** - * @var int - */ - public const REFLECTION_TYPE_GETNAME = PhpVersion::PHP_74; + public const int REFLECTION_TYPE_GETNAME = PhpVersion::PHP_74; - /** - * @var int - */ - public const EXPORT_TO_REFLECTION_FUNCTION = PhpVersion::PHP_74; + public const int EXPORT_TO_REFLECTION_FUNCTION = PhpVersion::PHP_74; - /** - * @var int - */ - public const DEPRECATE_NESTED_TERNARY = PhpVersion::PHP_74; + public const int DEPRECATE_NESTED_TERNARY = PhpVersion::PHP_74; - /** - * @var int - */ - public const DEPRECATE_RESTORE_INCLUDE_PATH = PhpVersion::PHP_74; + public const int DEPRECATE_RESTORE_INCLUDE_PATH = PhpVersion::PHP_74; - /** - * @var int - */ - public const DEPRECATE_HEBREVC = PhpVersion::PHP_74; + public const int DEPRECATE_HEBREVC = PhpVersion::PHP_74; - /** - * @var int - */ - public const UNION_TYPES = PhpVersion::PHP_80; + public const int UNION_TYPES = PhpVersion::PHP_80; - /** - * @var int - */ - public const CLASS_ON_OBJECT = PhpVersion::PHP_80; + public const int CLASS_ON_OBJECT = PhpVersion::PHP_80; - /** - * @var int - */ - public const STATIC_RETURN_TYPE = PhpVersion::PHP_80; + public const int STATIC_RETURN_TYPE = PhpVersion::PHP_80; - /** - * @var int - */ - public const NO_FINAL_PRIVATE = PhpVersion::PHP_80; + public const int NO_FINAL_PRIVATE = PhpVersion::PHP_80; - /** - * @var int - */ - public const DEPRECATE_REQUIRED_PARAMETER_AFTER_OPTIONAL = PhpVersion::PHP_80; + public const int DEPRECATE_REQUIRED_PARAMETER_AFTER_OPTIONAL = PhpVersion::PHP_80; - /** - * @var int - */ - public const STATIC_VISIBILITY_SET_STATE = PhpVersion::PHP_80; + public const int STATIC_VISIBILITY_SET_STATE = PhpVersion::PHP_80; - /** - * @var int - */ - public const NULLSAFE_OPERATOR = PhpVersion::PHP_80; + public const int NULLSAFE_OPERATOR = PhpVersion::PHP_80; - /** - * @var int - */ - public const IS_ITERABLE = PhpVersion::PHP_71; + public const int IS_ITERABLE = PhpVersion::PHP_71; - /** - * @var int - */ - public const NULLABLE_TYPE = PhpVersion::PHP_71; + public const int NULLABLE_TYPE = PhpVersion::PHP_71; - /** - * @var int - */ - public const PARENT_VISIBILITY_OVERRIDE = PhpVersion::PHP_72; + public const int PARENT_VISIBILITY_OVERRIDE = PhpVersion::PHP_72; - /** - * @var int - */ - public const COUNT_ON_NULL = PhpVersion::PHP_71; + public const int COUNT_ON_NULL = PhpVersion::PHP_71; /** * @see https://wiki.php.net/rfc/constructor_promotion - * @var int */ - public const PROPERTY_PROMOTION = PhpVersion::PHP_80; + public const int PROPERTY_PROMOTION = PhpVersion::PHP_80; /** * @see https://wiki.php.net/rfc/attributes_v2 - * @var int */ - public const ATTRIBUTES = PhpVersion::PHP_80; + public const int ATTRIBUTES = PhpVersion::PHP_80; - /** - * @var int - */ - public const STRINGABLE = PhpVersion::PHP_80; + public const int STRINGABLE = PhpVersion::PHP_80; - /** - * @var int - */ - public const PHP_TOKEN = PhpVersion::PHP_80; + public const int PHP_TOKEN = PhpVersion::PHP_80; - /** - * @var int - */ - public const STR_ENDS_WITH = PhpVersion::PHP_80; + public const int STR_ENDS_WITH = PhpVersion::PHP_80; - /** - * @var int - */ - public const STR_STARTS_WITH = PhpVersion::PHP_80; + public const int STR_STARTS_WITH = PhpVersion::PHP_80; - /** - * @var int - */ - public const STR_CONTAINS = PhpVersion::PHP_80; + public const int STR_CONTAINS = PhpVersion::PHP_80; - /** - * @var int - */ - public const GET_DEBUG_TYPE = PhpVersion::PHP_80; + public const int GET_DEBUG_TYPE = PhpVersion::PHP_80; /** * @see https://wiki.php.net/rfc/noreturn_type - * @var int */ - public const NEVER_TYPE = PhpVersion::PHP_81; + public const int NEVER_TYPE = PhpVersion::PHP_81; /** * @see https://wiki.php.net/rfc/variadics - * @var int */ - public const VARIADIC_PARAM = PhpVersion::PHP_56; + public const int VARIADIC_PARAM = PhpVersion::PHP_56; /** * @see https://wiki.php.net/rfc/readonly_and_immutable_properties - * @var int */ - public const READONLY_PROPERTY = PhpVersion::PHP_81; + public const int READONLY_PROPERTY = PhpVersion::PHP_81; /** * @see https://wiki.php.net/rfc/final_class_const - * @var int */ - public const FINAL_CLASS_CONSTANTS = PhpVersion::PHP_81; + public const int FINAL_CLASS_CONSTANTS = PhpVersion::PHP_81; /** * @see https://wiki.php.net/rfc/enumerations - * @var int */ - public const ENUM = PhpVersion::PHP_81; + public const int ENUM = PhpVersion::PHP_81; /** * @see https://wiki.php.net/rfc/match_expression_v2 - * @var int */ - public const MATCH_EXPRESSION = PhpVersion::PHP_80; + public const int MATCH_EXPRESSION = PhpVersion::PHP_80; /** * @see https://wiki.php.net/rfc/non-capturing_catches - * @var int */ - public const NON_CAPTURING_CATCH = PhpVersion::PHP_80; + public const int NON_CAPTURING_CATCH = PhpVersion::PHP_80; /** * @see https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.resource2object - * @var int */ - public const PHP8_RESOURCE_TO_OBJECT = PhpVersion::PHP_80; + public const int PHP8_RESOURCE_TO_OBJECT = PhpVersion::PHP_80; /** * @see https://wiki.php.net/rfc/lsp_errors - * @var int */ - public const FATAL_ERROR_ON_INCOMPATIBLE_METHOD_SIGNATURE = PhpVersion::PHP_80; + public const int FATAL_ERROR_ON_INCOMPATIBLE_METHOD_SIGNATURE = PhpVersion::PHP_80; /** * @see https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.resource2object - * @var int */ - public const PHP81_RESOURCE_TO_OBJECT = PhpVersion::PHP_81; + public const int PHP81_RESOURCE_TO_OBJECT = PhpVersion::PHP_81; /** * @see https://wiki.php.net/rfc/new_in_initializers - * @var int */ - public const NEW_INITIALIZERS = PhpVersion::PHP_81; + public const int NEW_INITIALIZERS = PhpVersion::PHP_81; /** * @see https://wiki.php.net/rfc/pure-intersection-types - * @var int */ - public const INTERSECTION_TYPES = PhpVersion::PHP_81; + public const int INTERSECTION_TYPES = PhpVersion::PHP_81; /** * @see https://php.watch/versions/8.2/dnf-types - * @var int */ - public const UNION_INTERSECTION_TYPES = PhpVersion::PHP_82; + public const int UNION_INTERSECTION_TYPES = PhpVersion::PHP_82; /** * @see https://wiki.php.net/rfc/array_unpacking_string_keys - * @var int */ - public const ARRAY_SPREAD_STRING_KEYS = PhpVersion::PHP_81; + public const int ARRAY_SPREAD_STRING_KEYS = PhpVersion::PHP_81; /** * @see https://wiki.php.net/rfc/internal_method_return_types - * @var int */ - public const RETURN_TYPE_WILL_CHANGE_ATTRIBUTE = PhpVersion::PHP_81; + public const int RETURN_TYPE_WILL_CHANGE_ATTRIBUTE = PhpVersion::PHP_81; /** * @see https://wiki.php.net/rfc/first_class_callable_syntax - * @var int */ - public const FIRST_CLASS_CALLABLE_SYNTAX = PhpVersion::PHP_81; + public const int FIRST_CLASS_CALLABLE_SYNTAX = PhpVersion::PHP_81; /** * @see https://wiki.php.net/rfc/deprecate_dynamic_properties - * @var int */ - public const DEPRECATE_DYNAMIC_PROPERTIES = PhpVersion::PHP_82; + public const int DEPRECATE_DYNAMIC_PROPERTIES = PhpVersion::PHP_82; /** * @see https://wiki.php.net/rfc/readonly_classes - * @var int */ - public const READONLY_CLASS = PhpVersion::PHP_82; + public const int READONLY_CLASS = PhpVersion::PHP_82; /** * @see https://www.php.net/manual/en/migration83.new-features.php#migration83.new-features.core.readonly-modifier-improvements - * @var int */ - public const READONLY_ANONYMOUS_CLASS = PhpVersion::PHP_83; + public const int READONLY_ANONYMOUS_CLASS = PhpVersion::PHP_83; /** - * @var int * @see https://wiki.php.net/rfc/json_validate */ - public const JSON_VALIDATE = PhpVersion::PHP_83; + public const int JSON_VALIDATE = PhpVersion::PHP_83; /** * @see https://wiki.php.net/rfc/mixed_type_v2 - * @var int */ - public const MIXED_TYPE = PhpVersion::PHP_80; + public const int MIXED_TYPE = PhpVersion::PHP_80; /** * @see https://3v4l.org/OWtO5 - * @var int */ - public const ARRAY_ON_ARRAY_MERGE = PhpVersion::PHP_80; + public const int ARRAY_ON_ARRAY_MERGE = PhpVersion::PHP_80; - /** - * @var int - */ - public const DEPRECATE_NULL_ARG_IN_STRING_FUNCTION = PhpVersion::PHP_81; + public const int DEPRECATE_NULL_ARG_IN_STRING_FUNCTION = PhpVersion::PHP_81; /** * @see https://wiki.php.net/rfc/remove_utf8_decode_and_utf8_encode - * @var int */ - public const DEPRECATE_UTF8_DECODE_ENCODE_FUNCTION = PhpVersion::PHP_82; + public const int DEPRECATE_UTF8_DECODE_ENCODE_FUNCTION = PhpVersion::PHP_82; /** * @see https://www.php.net/manual/en/filesystemiterator.construct - * @var int */ - public const FILESYSTEM_ITERATOR_SKIP_DOTS = PhpVersion::PHP_82; + public const int FILESYSTEM_ITERATOR_SKIP_DOTS = PhpVersion::PHP_82; /** * @see https://wiki.php.net/rfc/null-false-standalone-types * @see https://wiki.php.net/rfc/true-type - * - * @var int */ - public const NULL_FALSE_TRUE_STANDALONE_TYPE = PhpVersion::PHP_82; + public const int NULL_FALSE_TRUE_STANDALONE_TYPE = PhpVersion::PHP_82; /** * @see https://wiki.php.net/rfc/redact_parameters_in_back_traces - * @var int */ - public const SENSITIVE_PARAMETER_ATTRIBUTE = PhpVersion::PHP_82; + public const int SENSITIVE_PARAMETER_ATTRIBUTE = PhpVersion::PHP_82; /** * @see https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation - * @var int */ - public const DEPRECATE_VARIABLE_IN_STRING_INTERPOLATION = PhpVersion::PHP_82; + public const int DEPRECATE_VARIABLE_IN_STRING_INTERPOLATION = PhpVersion::PHP_82; /** * @see https://wiki.php.net/rfc/marking_overriden_methods - * @var int */ - public const OVERRIDE_ATTRIBUTE = PhpVersion::PHP_83; + public const int OVERRIDE_ATTRIBUTE = PhpVersion::PHP_83; /** * @see https://wiki.php.net/rfc/typed_class_constants - * @var int */ - public const TYPED_CLASS_CONSTANTS = PhpVersion::PHP_83; + public const int TYPED_CLASS_CONSTANTS = PhpVersion::PHP_83; /** * @see https://wiki.php.net/rfc/dynamic_class_constant_fetch - * @var int */ - public const DYNAMIC_CLASS_CONST_FETCH = PhpVersion::PHP_83; + public const int DYNAMIC_CLASS_CONST_FETCH = PhpVersion::PHP_83; /** * @see https://wiki.php.net/rfc/deprecate-implicitly-nullable-types - * @var int */ - public const DEPRECATE_IMPLICIT_NULLABLE_PARAM_TYPE = PhpVersion::PHP_84; + public const int DEPRECATE_IMPLICIT_NULLABLE_PARAM_TYPE = PhpVersion::PHP_84; /** * @see https://wiki.php.net/rfc/new_without_parentheses - * @var int */ - public const NEW_METHOD_CALL_WITHOUT_PARENTHESES = PhpVersion::PHP_84; + public const int NEW_METHOD_CALL_WITHOUT_PARENTHESES = PhpVersion::PHP_84; /** * @see https://wiki.php.net/rfc/correctly_name_the_rounding_mode_and_make_it_an_enum - * @var int */ - public const ROUNDING_MODES = PhpVersion::PHP_84; + public const int ROUNDING_MODES = PhpVersion::PHP_84; /** * @see https://php.watch/versions/8.4/csv-functions-escape-parameter - * @var int */ - public const REQUIRED_ESCAPE_PARAMETER = PhpVersion::PHP_84; + public const int REQUIRED_ESCAPE_PARAMETER = PhpVersion::PHP_84; /** * @see https://www.php.net/manual/en/migration83.deprecated.php#migration83.deprecated.ldap - * @var int */ - public const DEPRECATE_HOST_PORT_SEPARATE_ARGS = PhpVersion::PHP_83; + public const int DEPRECATE_HOST_PORT_SEPARATE_ARGS = PhpVersion::PHP_83; /** * @see https://www.php.net/manual/en/migration83.deprecated.php#migration83.deprecated.core.get-class * @see https://php.watch/versions/8.3/get_class-get_parent_class-parameterless-deprecated - * @var int */ - public const DEPRECATE_GET_CLASS_WITHOUT_ARGS = PhpVersion::PHP_83; + public const int DEPRECATE_GET_CLASS_WITHOUT_ARGS = PhpVersion::PHP_83; /** * @see https://wiki.php.net/rfc/deprecated_attribute - * @var int */ - public const DEPRECATED_ATTRIBUTE = PhpVersion::PHP_84; + public const int DEPRECATED_ATTRIBUTE = PhpVersion::PHP_84; /** * @see https://php.watch/versions/8.4/array_find-array_find_key-array_any-array_all - * @var int */ - public const ARRAY_FIND = PhpVersion::PHP_84; + public const int ARRAY_FIND = PhpVersion::PHP_84; /** * @see https://php.watch/versions/8.4/array_find-array_find_key-array_any-array_all - * @var int */ - public const ARRAY_FIND_KEY = PhpVersion::PHP_84; + public const int ARRAY_FIND_KEY = PhpVersion::PHP_84; /** * @see https://php.watch/versions/8.4/array_find-array_find_key-array_any-array_all - * @var int */ - public const ARRAY_ALL = PhpVersion::PHP_84; + public const int ARRAY_ALL = PhpVersion::PHP_84; /** * @see https://php.watch/versions/8.4/array_find-array_find_key-array_any-array_all - * @var int */ - public const ARRAY_ANY = PhpVersion::PHP_84; + public const int ARRAY_ANY = PhpVersion::PHP_84; /** * @see https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_context_parameter_for_finfo_buffer - * @var int */ - public const DEPRECATE_FINFO_BUFFER_CONTEXT = PhpVersion::PHP_85; + public const int DEPRECATE_FINFO_BUFFER_CONTEXT = PhpVersion::PHP_85; /** * @see https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_debuginfo_returning_null - * @var int */ - public const DEPRECATED_NULL_DEBUG_INFO_RETURN = PhpVersion::PHP_85; + public const int DEPRECATED_NULL_DEBUG_INFO_RETURN = PhpVersion::PHP_85; /** * @see https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_semicolon_after_case_in_switch_statement - * @var int */ - public const COLON_AFTER_SWITCH_CASE = PhpVersion::PHP_85; + public const int COLON_AFTER_SWITCH_CASE = PhpVersion::PHP_85; /** * @see https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_using_values_null_as_an_array_offset_and_when_calling_array_key_exists - * @var int */ - public const DEPRECATE_NULL_ARG_IN_ARRAY_KEY_EXISTS_FUNCTION = PhpVersion::PHP_85; + public const int DEPRECATE_NULL_ARG_IN_ARRAY_KEY_EXISTS_FUNCTION = PhpVersion::PHP_85; /** * @see https://wiki.php.net/rfc/deprecations_php_8_5#eprecate_passing_integers_outside_the_interval_0_255_to_chr - * @var int */ - public const DEPRECATE_OUTSIDE_INTERVEL_VAL_IN_CHR_FUNCTION = PhpVersion::PHP_85; + public const int DEPRECATE_OUTSIDE_INTERVEL_VAL_IN_CHR_FUNCTION = PhpVersion::PHP_85; /** * @see https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_sleep_and_wakeup_magic_methods - * @var int */ - public const DEPRECATED_METHOD_SLEEP = PhpVersion::PHP_85; + public const int DEPRECATED_METHOD_SLEEP = PhpVersion::PHP_85; /** * @see https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_sleep_and_wakeup_magic_methods - * @var int */ - public const DEPRECATED_METHOD_WAKEUP = PhpVersion::PHP_85; + public const int DEPRECATED_METHOD_WAKEUP = PhpVersion::PHP_85; /** * @see https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_string_which_are_not_one_byte_long_to_ord - * @var int */ - public const DEPRECATE_ORD_WITH_MULTIBYTE_STRING = PhpVersion::PHP_85; + public const int DEPRECATE_ORD_WITH_MULTIBYTE_STRING = PhpVersion::PHP_85; /** * @see https://wiki.php.net/rfc/property-hooks - * @var int */ - public const PROPERTY_HOOKS = PhpVersion::PHP_84; + public const int PROPERTY_HOOKS = PhpVersion::PHP_84; /** * @see https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_backticks_as_an_alias_for_shell_exec - * @var int */ - public const DEPRECATE_BACKTICKS = PhpVersion::PHP_85; + public const int DEPRECATE_BACKTICKS = PhpVersion::PHP_85; /** * @see https://wiki.php.net/rfc/pipe-operator-v3 - * @var int */ - public const PIPE_OPERATOER = PhpVersion::PHP_85; + public const int PIPE_OPERATOER = PhpVersion::PHP_85; } diff --git a/src/ValueObject/PolyfillPackage.php b/src/ValueObject/PolyfillPackage.php index a3772b256ab..4e085e15761 100644 --- a/src/ValueObject/PolyfillPackage.php +++ b/src/ValueObject/PolyfillPackage.php @@ -9,18 +9,9 @@ */ final class PolyfillPackage { - /** - * @var string - */ - public const PHP_83 = 'symfony/polyfill-php83'; + public const string PHP_83 = 'symfony/polyfill-php83'; - /** - * @var string - */ - public const PHP_80 = 'symfony/polyfill-php80'; + public const string PHP_80 = 'symfony/polyfill-php80'; - /** - * @var string - */ - public const PHP_73 = 'symfony/polyfill-php73'; + public const string PHP_73 = 'symfony/polyfill-php73'; } diff --git a/src/ValueObject/Reporting/FileDiff.php b/src/ValueObject/Reporting/FileDiff.php index 5ff6dbc33ab..cac1ec6978b 100644 --- a/src/ValueObject/Reporting/FileDiff.php +++ b/src/ValueObject/Reporting/FileDiff.php @@ -18,18 +18,14 @@ final readonly class FileDiff implements SerializableInterface { /** - * @var string * @see https://en.wikipedia.org/wiki/Diff#Unified_format * @see https://regex101.com/r/AUPIX4/2 */ - private const DIFF_HUNK_HEADER_REGEX = '#@@(.*?)(?<' . self::FIRST_LINE_KEY . '>\d+)(,(?<' . self::LINE_RANGE_KEY . '>\d+))?(.*?)@@#'; + private const string DIFF_HUNK_HEADER_REGEX = '#@@(.*?)(?<' . self::FIRST_LINE_KEY . '>\d+)(,(?<' . self::LINE_RANGE_KEY . '>\d+))?(.*?)@@#'; - /** - * @var string - */ - private const FIRST_LINE_KEY = 'first_line'; + private const string FIRST_LINE_KEY = 'first_line'; - private const LINE_RANGE_KEY = 'line_range'; + private const string LINE_RANGE_KEY = 'line_range'; /** * @param RectorWithLineChange[] $rectorsWithLineChanges diff --git a/src/ValueObject/Visibility.php b/src/ValueObject/Visibility.php index 85b5458a6d2..38cf5c71f00 100644 --- a/src/ValueObject/Visibility.php +++ b/src/ValueObject/Visibility.php @@ -8,38 +8,17 @@ final class Visibility { - /** - * @var int - */ - public const PUBLIC = Modifiers::PUBLIC; - - /** - * @var int - */ - public const PROTECTED = Modifiers::PROTECTED; - - /** - * @var int - */ - public const PRIVATE = Modifiers::PRIVATE; - - /** - * @var int - */ - public const STATIC = Modifiers::STATIC; - - /** - * @var int - */ - public const ABSTRACT = Modifiers::ABSTRACT; - - /** - * @var int - */ - public const FINAL = Modifiers::FINAL; - - /** - * @var int - */ - public const READONLY = Modifiers::READONLY; + public const int PUBLIC = Modifiers::PUBLIC; + + public const int PROTECTED = Modifiers::PROTECTED; + + public const int PRIVATE = Modifiers::PRIVATE; + + public const int STATIC = Modifiers::STATIC; + + public const int ABSTRACT = Modifiers::ABSTRACT; + + public const int FINAL = Modifiers::FINAL; + + public const int READONLY = Modifiers::READONLY; } diff --git a/tests/Parallel/Command/WorkerCommandLineFactoryTest.php b/tests/Parallel/Command/WorkerCommandLineFactoryTest.php index 0e818e8d0c9..f33fb9bb19d 100644 --- a/tests/Parallel/Command/WorkerCommandLineFactoryTest.php +++ b/tests/Parallel/Command/WorkerCommandLineFactoryTest.php @@ -17,20 +17,11 @@ final class WorkerCommandLineFactoryTest extends AbstractLazyTestCase { - /** - * @var string - */ - private const COMMAND = 'command'; + private const string COMMAND = 'command'; - /** - * @var string - */ - private const DUMMY_MAIN_SCRIPT = 'main_script'; + private const string DUMMY_MAIN_SCRIPT = 'main_script'; - /** - * @var string - */ - private const SPACED_DUMMY_MAIN_SCRIPT = 'C:\Users\P\Desktop\Web Dev\vendor\bin\rector'; + private const string SPACED_DUMMY_MAIN_SCRIPT = 'C:\Users\P\Desktop\Web Dev\vendor\bin\rector'; private WorkerCommandLineFactory $workerCommandLineFactory; diff --git a/tests/PhpDocParser/PhpDocParser/SimplePhpDocNodeTraverser/PhpDocNodeTraverserTest.php b/tests/PhpDocParser/PhpDocParser/SimplePhpDocNodeTraverser/PhpDocNodeTraverserTest.php index 76267e8ccca..afb4e205251 100644 --- a/tests/PhpDocParser/PhpDocParser/SimplePhpDocNodeTraverser/PhpDocNodeTraverserTest.php +++ b/tests/PhpDocParser/PhpDocParser/SimplePhpDocNodeTraverser/PhpDocNodeTraverserTest.php @@ -14,10 +14,7 @@ final class PhpDocNodeTraverserTest extends AbstractLazyTestCase { - /** - * @var string - */ - private const SOME_DESCRIPTION = 'some description'; + private const string SOME_DESCRIPTION = 'some description'; private PhpDocNodeTraverser $phpDocNodeTraverser; diff --git a/utils/Compiler/Unprefixer.php b/utils/Compiler/Unprefixer.php index 74947643942..b13a09b3165 100644 --- a/utils/Compiler/Unprefixer.php +++ b/utils/Compiler/Unprefixer.php @@ -9,10 +9,9 @@ final class Unprefixer { /** - * @var string * @see https://regex101.com/r/P8sXfr/1 */ - private const QUOTED_VALUE_REGEX = '#\'\\\\(\w|@)#'; + private const string QUOTED_VALUE_REGEX = '#\'\\\\(\w|@)#'; /** * @api diff --git a/utils/Rector/MoveAbstractRectorToChildrenRector.php b/utils/Rector/MoveAbstractRectorToChildrenRector.php index afab8824573..c5500f4c54f 100644 --- a/utils/Rector/MoveAbstractRectorToChildrenRector.php +++ b/utils/Rector/MoveAbstractRectorToChildrenRector.php @@ -24,7 +24,7 @@ final class MoveAbstractRectorToChildrenRector extends AbstractRector /** * @var array */ - private const PROPERTIES_TO_TYPES = [ + private const array PROPERTIES_TO_TYPES = [ 'phpDocInfoFactory' => PhpDocInfoFactory::class, 'valueResolver' => ValueResolver::class, 'betterNodeFinder' => BetterNodeFinder::class,