From 9a4a5b2bc56f4d80ccf3f1908422eef7f5fbc099 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 20 Nov 2024 15:58:53 +0000 Subject: [PATCH] Updated Rector to commit eb5df4dde7515bbc497af6da84d5f9dbf96399d8 https://github.com/rectorphp/rector-src/commit/eb5df4dde7515bbc497af6da84d5f9dbf96399d8 Use vendor-patches main branch (#6453) --- .github/workflows/along_other_packages.yaml | 2 +- .github/workflows/e2e.yaml | 2 +- .github/workflows/e2e_diff.yaml | 2 +- .github/workflows/e2e_global.yaml | 2 +- .github/workflows/e2e_php72.yaml | 31 - .github/workflows/standalone_rule_test.yaml | 2 +- bin/rector.php | 2 +- composer.json | 4 +- config/phpstan/parser.neon | 1 - config/phpstan/static-reflection.neon | 6 - e2e/reflection-union-php72/composer.json | 11 - e2e/reflection-union-php72/rector.php | 17 - e2e/reflection-union-php72/src/foo.php | 14 - preload.php | 40 +- .../ArgumentDefaultValueReplacer.php | 6 +- .../NodeAnalyzer/ArgumentAddingScope.php | 3 +- .../NodeAnalyzer/ChangedArgumentsDetector.php | 12 +- .../ClassMethod/ArgumentAdderRector.php | 19 +- .../ReplaceArgumentDefaultValueRector.php | 5 +- ...tionArgumentDefaultValueReplacerRector.php | 5 +- .../RemoveMethodCallParamRector.php | 2 +- rules/Arguments/ValueObject/ArgumentAdder.php | 15 +- .../ArgumentAdderWithoutDefaultValue.php | 15 +- .../ValueObject/RemoveMethodCallParam.php | 9 +- .../ReplaceArgumentDefaultValue.php | 8 +- .../ReplaceFuncCallArgumentDefaultValue.php | 6 +- .../Carbon/NodeFactory/CarbonCallFactory.php | 10 +- .../DateTimeMethodCallToCarbonRector.php | 3 +- .../New_/DateTimeInstanceToCarbonRector.php | 3 +- rules/CodeQuality/CompactConverter.php | 5 +- .../NodeAnalyzer/ForeachAnalyzer.php | 3 +- .../NodeAnalyzer/LocalPropertyAnalyzer.php | 28 +- .../VariableDimFetchAssignResolver.php | 10 +- .../NodeFactory/MissingPropertiesFactory.php | 9 +- .../NodeFactory/PropertyTypeDecorator.php | 9 +- .../NodeFactory/TypedPropertyFactory.php | 10 +- .../NodeManipulator/ExprBoolCaster.php | 12 +- .../Rector/Assign/CombinedAssignRector.php | 3 +- .../SimplifyEmptyArrayCheckRector.php | 3 +- .../SimplifyDeMorganBinaryRector.php | 3 +- .../ThrowWithPreviousExceptionRector.php | 13 +- .../ClassMethod/ExplicitReturnNullRector.php | 19 +- .../InlineArrayReturnAssignRector.php | 12 +- ...llyCalledStaticMethodToNonStaticRector.php | 17 +- .../OptionalParametersAfterRequiredRector.php | 12 +- .../CompleteDynamicPropertiesRector.php | 21 +- ...DocBlockPropertyToNativePropertyRector.php | 25 +- ...lineConstructorDefaultToPropertyRector.php | 3 +- .../SimplifyEmptyCheckOnEmptyArrayRector.php | 15 +- .../Expression/InlineIfToExplicitIfRector.php | 3 +- .../TernaryFalseExpressionToIfRector.php | 3 +- ...hItemsAssignToEmptyArrayToAssignRector.php | 12 +- .../Foreach_/ForeachToInArrayRector.php | 13 +- .../UnusedForeachValueToArrayKeysRector.php | 40 +- ...rayMergeOfNonArraysToSimpleArrayRector.php | 2 +- ...serFuncWithArrowFunctionToInlineRector.php | 3 +- .../FuncCall/CompactToVariablesRector.php | 5 +- .../Rector/FuncCall/SetTypeToCastRector.php | 11 +- .../FuncCall/SimplifyRegexPatternRector.php | 3 +- .../FuncCall/SingleInArrayToCompareRector.php | 2 +- .../SimplifyUselessVariableRector.php | 17 +- ...lipTypeControlToUseExclusiveTypeRector.php | 6 +- .../Identical/SimplifyArraySearchRector.php | 10 +- .../SimplifyBoolIdenticalTrueRector.php | 3 +- .../Identical/SimplifyConditionsRector.php | 15 +- ...StrlenZeroToIdenticalEmptyStringRector.php | 3 +- .../Rector/If_/CombineIfRector.php | 14 +- .../CompleteMissingIfElseBracketRector.php | 2 +- ...ompareReturnsToNullCoalesceQueueRector.php | 14 +- .../Rector/If_/ExplicitBoolCompareRector.php | 31 +- .../If_/SimplifyIfElseToTernaryRector.php | 6 +- .../If_/SimplifyIfNotNullReturnRector.php | 6 +- .../If_/SimplifyIfNullableReturnRector.php | 12 +- .../Rector/If_/SimplifyIfReturnBoolRector.php | 14 +- .../AbsolutizeRequireAndIncludePathRector.php | 3 +- ...OnPropertyObjectToPropertyExistsRector.php | 9 +- .../LogicalAnd/LogicalToBooleanRector.php | 3 +- .../Rector/NotEqual/CommonNotEqualRector.php | 5 +- .../CleanupUnneededNullsafeOperatorRector.php | 3 +- .../Switch_/SingularSwitchToIfRector.php | 7 +- .../Rector/Switch_/SwitchTrueToIfRector.php | 3 +- ...istsTernaryThenValueToCoalescingRector.php | 3 +- .../SimplifyTautologyTernaryRector.php | 9 +- .../Ternary/SwitchNegatedTernaryRector.php | 9 +- .../UnnecessaryTernaryExpressionRector.php | 6 +- .../ArrayDimFetchTypeResolver.php | 3 +- .../AssignVariableTypeResolver.php | 3 +- rules/CodeQuality/ValueObject/KeyAndExpr.php | 8 +- .../Application/UseImportsAdder.php | 6 +- .../Application/UseImportsRemover.php | 3 +- .../ClassNameImport/AliasUsesResolver.php | 13 +- .../AliasClassNameImportSkipVoter.php | 3 +- .../ClassLikeNameClassNameImportSkipVoter.php | 3 +- ...yQualifiedNameClassNameImportSkipVoter.php | 3 +- .../UsesClassNameImportSkipVoter.php | 3 +- .../ClassNameImportSkipper.php | 13 +- .../ClassNameImport/ShortNameResolver.php | 21 +- .../ClassNameImport/UseImportsTraverser.php | 9 +- .../ClassNameImport/UsedImportsResolver.php | 17 +- .../ValueObject/UsedImports.php | 6 +- rules/CodingStyle/Guard/StaticGuard.php | 6 +- rules/CodingStyle/Node/NameImporter.php | 12 +- .../NodeAnalyzer/UseImportNameMatcher.php | 20 +- .../ArrayCallableToMethodCallFactory.php | 5 +- .../StaticArrowFunctionRector.php | 3 +- .../Rector/Assign/SplitDoubleAssignRector.php | 1 - .../CatchExceptionNameMatchingTypeRector.php | 7 +- .../ClassConst/RemoveFinalFromConstRector.php | 3 +- .../FuncGetArgsToVariadicParamRector.php | 3 +- ...itedMethodVisibilitySameAsParentRector.php | 6 +- .../NewlineBeforeNewAssignSetRector.php | 12 +- .../Rector/Closure/StaticClosureRector.php | 3 +- .../EncapsedStringsToSprintfRector.php | 30 +- ...rapEncapsedVariableInCurlyBracesRector.php | 6 +- ...iDimensionalArrayToArrayDestructRector.php | 17 +- .../ArraySpreadInsteadOfArrayMergeRector.php | 16 +- .../CallUserFuncArrayToVariadicRector.php | 6 +- .../CallUserFuncToMethodCallRector.php | 3 +- .../FuncCall/ConsistentImplodeRector.php | 3 +- ...CountArrayToEmptyArrayComparisonRector.php | 4 +- ...VersionCompareFuncCallToConstantRector.php | 8 +- .../Property/SplitGroupedPropertiesRector.php | 4 +- .../Stmt/NewlineAfterStatementRector.php | 4 +- .../String_/SymplifyQuoteEscapeRector.php | 5 +- ...assKeywordForClassNameResolutionRector.php | 11 +- .../Use_/SeparateMultiUseImportsRector.php | 2 +- .../Reflection/VendorLocationDetector.php | 3 +- rules/DeadCode/ConditionEvaluator.php | 3 +- rules/DeadCode/ConditionResolver.php | 9 +- .../NodeAnalyzer/CallCollectionAnalyzer.php | 6 +- .../NodeAnalyzer/ExprUsedInNodeAnalyzer.php | 6 +- .../IsClassMethodUsedAnalyzer.php | 36 +- .../PropertyWriteonlyAnalyzer.php | 3 +- .../SafeLeftTypeBooleanAndOrAnalyzer.php | 20 +- .../NodeAnalyzer/UsedVariableNameAnalyzer.php | 3 +- .../NodeCollector/UnusedParameterResolver.php | 3 +- .../ClassMethodParamRemover.php | 6 +- .../ControllerClassMethodManipulator.php | 9 +- .../NodeManipulator/CountManipulator.php | 13 +- .../NodeManipulator/LivingCodeManipulator.php | 3 +- .../VariadicFunctionLikeDetector.php | 10 +- .../PhpDoc/DeadParamTagValueNodeAnalyzer.php | 30 +- .../PhpDoc/DeadReturnTagValueNodeAnalyzer.php | 21 +- .../PhpDoc/DeadVarTagValueNodeAnalyzer.php | 12 +- .../PhpDoc/TagRemover/ParamTagRemover.php | 6 +- .../PhpDoc/TagRemover/ReturnTagRemover.php | 3 +- .../PhpDoc/TagRemover/VarTagRemover.php | 18 +- .../Array_/RemoveDuplicatedArrayKeyRector.php | 5 +- .../Assign/RemoveDoubleAssignRector.php | 10 +- .../RemoveUnusedVariableAssignRector.php | 19 +- .../Rector/BooleanAnd/RemoveAndTrueRector.php | 3 +- .../Rector/Cast/RecastingRemovalRector.php | 19 +- ...RemoveUnusedPrivateClassConstantRector.php | 10 +- .../ClassLike/RemoveAnnotationRector.php | 11 +- ...moveTypedPropertyNonMockDocblockRector.php | 9 +- .../RemoveEmptyClassMethodRector.php | 15 +- .../RemoveNullTagValueNodeRector.php | 6 +- .../RemoveUnusedConstructorParamRector.php | 9 +- ...moveUnusedPrivateMethodParameterRector.php | 18 +- .../RemoveUnusedPrivateMethodRector.php | 13 +- .../RemoveUnusedPromotedPropertyRector.php | 24 +- ...emoveUnusedPublicMethodParameterRector.php | 12 +- .../RemoveUselessParamTagRector.php | 6 +- ...moveUselessReturnExprInConstructRector.php | 7 +- .../RemoveUselessReturnTagRector.php | 9 +- .../RemovePhpVersionIdCheckRector.php | 31 +- .../Expression/RemoveDeadStmtRector.php | 16 +- .../Expression/SimplifyMirrorAssignRector.php | 4 +- .../Rector/For_/RemoveDeadContinueRector.php | 8 +- .../For_/RemoveDeadIfForeachForRector.php | 19 +- .../Rector/For_/RemoveDeadLoopRector.php | 4 +- .../Foreach_/RemoveUnusedForeachKeyRector.php | 16 +- .../FunctionLike/RemoveDeadReturnRector.php | 4 +- .../If_/ReduceAlwaysFalseIfOrRector.php | 3 +- .../If_/RemoveAlwaysTrueIfConditionRector.php | 13 +- .../Rector/If_/RemoveDeadInstanceOfRector.php | 12 +- ...emoveTypedPropertyDeadInstanceOfRector.php | 19 +- ...UnusedNonEmptyArrayBeforeForeachRector.php | 19 +- .../SimplifyIfElseWithSameContentRector.php | 3 +- ...wrapFutureCompatibleIfPhpVersionRector.php | 10 +- .../RemoveNonExistingVarAnnotationRector.php | 18 +- .../RemoveDeadZeroAndOneOperationRector.php | 3 +- .../RemoveUnusedPrivatePropertyRector.php | 13 +- .../RemoveUselessReadOnlyTagRector.php | 9 +- .../Property/RemoveUselessVarTagRector.php | 6 +- .../RemoveDeadConditionAboveReturnRector.php | 3 +- .../RemoveParentCallWithoutParentRector.php | 9 +- .../Stmt/RemoveUnreachableStatementRector.php | 3 +- .../RemoveDuplicatedCaseInSwitchRector.php | 5 +- ...naryToBooleanOrFalseToBooleanAndRector.php | 3 +- .../TryCatch/RemoveDeadTryCatchRector.php | 13 +- .../SideEffect/PureFunctionDetector.php | 6 +- .../SideEffect/SideEffectNodeDetector.php | 10 +- .../UselessIfCondBeforeForeachDetector.php | 3 +- .../BinaryToVersionCompareCondition.php | 6 +- .../ValueObject/VersionCompareCondition.php | 9 +- .../NodeTransformer/ConditionInverter.php | 3 +- ...eNestedForeachIfsToEarlyContinueRector.php | 9 +- ...geIfElseValueAssignToEarlyReturnRector.php | 12 +- .../ChangeNestedIfsToEarlyReturnRector.php | 6 +- ...hangeOrIfContinueToMultiContinueRector.php | 3 +- .../Rector/If_/RemoveAlwaysElseRector.php | 6 +- .../PreparedValueToEarlyReturnRector.php | 10 +- .../ReturnBinaryOrToEarlyReturnRector.php | 6 +- .../ReturnEarlyIfVariableRector.php | 6 +- .../ValueObject/BareSingleAssignIf.php | 6 +- .../NewAssignVariableNameResolver.php | 3 +- ...ropertyFetchAssignVariableNameResolver.php | 3 +- .../InflectorSingularResolver.php | 3 +- .../MatchParamTypeExpectedNameResolver.php | 12 +- .../MatchPropertyTypeExpectedNameResolver.php | 18 +- .../Guard/BreakingVariableRenameGuard.php | 18 +- .../Guard/DateTimeAtNamingConventionGuard.php | 6 +- rules/Naming/Guard/HasMagicGetSetGuard.php | 3 +- .../MatchPropertyTypeConflictingNameGuard.php | 9 +- rules/Naming/Matcher/ForeachMatcher.php | 6 +- .../Matcher/VariableAndCallAssignMatcher.php | 13 +- rules/Naming/Naming/AliasNameResolver.php | 3 +- .../Naming/Naming/ConflictingNameResolver.php | 17 +- rules/Naming/Naming/ExpectedNameResolver.php | 12 +- .../Naming/OverridenExistingNamesResolver.php | 12 +- rules/Naming/Naming/PropertyNaming.php | 6 +- rules/Naming/Naming/UseImportsResolver.php | 15 +- rules/Naming/Naming/VariableNaming.php | 8 +- .../NamingConventionAnalyzer.php | 3 +- rules/Naming/ParamRenamer/ParamRenamer.php | 9 +- .../MatchTypePropertyRenamer.php | 13 +- .../PropertyRenamer/PropertyFetchRenamer.php | 6 +- .../PropertyPromotionRenamer.php | 27 +- ...iableToMatchMethodCallReturnTypeRector.php | 24 +- .../RenameParamToMatchTypeRector.php | 20 +- .../RenameVariableToMatchNewTypeRector.php | 16 +- .../RenamePropertyToMatchTypeRector.php | 17 +- ...ValueVariableToMatchExprVariableRector.php | 12 +- ...iableToMatchMethodCallReturnTypeRector.php | 19 +- rules/Naming/RectorNamingInflector.php | 3 +- .../RenameGuard/PropertyRenameGuard.php | 9 +- rules/Naming/ValueObject/ExpectedName.php | 6 +- rules/Naming/ValueObject/ParamRename.php | 12 +- rules/Naming/ValueObject/PropertyRename.php | 28 +- .../ValueObject/VariableAndCallAssign.php | 9 +- .../ValueObject/VariableAndCallForeach.php | 6 +- .../ValueObjectFactory/ParamRenameFactory.php | 3 +- .../PropertyRenameFactory.php | 3 +- rules/Naming/VariableRenamer.php | 16 +- .../Property/VarToPublicPropertyRector.php | 3 +- .../Switch_/ContinueToBreakInSwitchRector.php | 18 +- .../Break_/RemoveZeroBreakContinueRector.php | 9 +- .../GetCalledClassToSelfClassRector.php | 3 +- .../FuncCall/PregReplaceEModifierRector.php | 6 +- .../StringClassNameToClassConstantRector.php | 14 +- rules/Php70/EregToPcreTransformer.php | 7 +- .../BattleshipTernaryAnalyzer.php | 6 +- .../Assign/ListSwapArrayOrderRector.php | 5 +- .../BreakNotInLoopOrSwitchToReturnRector.php | 9 +- .../ClassMethod/Php4ConstructorRector.php | 11 +- .../Rector/FuncCall/EregToPregMatchRector.php | 11 +- .../Rector/FuncCall/MultiDirnameRector.php | 13 +- .../Rector/FuncCall/RandomFunctionRector.php | 7 +- .../Php70/Rector/If_/IfToSpaceshipRector.php | 6 +- rules/Php70/Rector/List_/EmptyListRector.php | 2 +- ...isCallOnStaticMethodToStaticCallRector.php | 19 +- ...ticCallOnNonStaticToInstanceCallRector.php | 12 +- .../Ternary/TernaryToNullCoalescingRector.php | 5 +- .../Ternary/TernaryToSpaceshipRector.php | 3 +- rules/Php70/ValueObject/ComparedExprs.php | 6 +- rules/Php71/IsArrayAndDualCheckToAble.php | 9 +- .../Assign/AssignArrayToStringRector.php | 9 +- .../BinaryOpBetweenNumberAndStringRector.php | 11 +- .../Rector/BooleanOr/IsIterableRector.php | 9 +- .../FuncCall/RemoveExtraParametersRector.php | 10 +- .../TryCatch/MultiExceptionCatchRector.php | 3 +- rules/Php71/ValueObject/TwoNodeMatch.php | 6 +- .../NodeFactory/AnonymousFunctionFactory.php | 25 +- rules/Php72/Rector/Assign/ListEachRector.php | 5 +- ...laceEachAssignmentWithKeyCurrentRector.php | 4 +- ...reateFunctionToAnonymousFunctionRector.php | 13 +- .../Rector/FuncCall/GetClassOnNullRector.php | 4 +- .../ParseStrWithResultArgumentRector.php | 4 +- .../Rector/FuncCall/StringifyDefineRector.php | 3 +- .../FuncCall/StringsAssertNakedRector.php | 3 +- rules/Php72/Rector/Unset_/UnsetCastRector.php | 4 +- .../While_/WhileEachToForeachRector.php | 7 +- rules/Php72/ValueObject/ListAndEach.php | 6 +- .../Rector/BooleanOr/IsCountableRector.php | 6 +- .../SensitiveConstantNameRector.php | 3 +- .../FuncCall/ArrayKeyFirstLastRector.php | 11 +- .../FuncCall/JsonThrowOnErrorRector.php | 21 +- .../Php73/Rector/FuncCall/SetCookieRector.php | 2 +- .../FuncCall/StringifyStrNeedlesRector.php | 4 +- rules/Php74/Guard/MakePropertyTypedGuard.php | 6 +- rules/Php74/Guard/PropertyTypeChangeGuard.php | 12 +- .../ClosureArrowFunctionAnalyzer.php | 15 +- .../CurlyToSquareBracketArrayStringRector.php | 6 +- .../Closure/ClosureToArrowFunctionRector.php | 3 +- ...bStrrposEncodingArgumentPositionRector.php | 4 +- .../MoneyFormatToNumberFormatRector.php | 12 +- .../AddLiteralSeparatorToNumberRector.php | 17 +- ...efaultNullToNullableTypePropertyRector.php | 8 +- .../ExportToReflectionFunctionRector.php | 3 +- .../ParenthesizeNestedTernaryRector.php | 5 +- .../ParenthesizedNestedTernaryAnalyzer.php | 4 +- .../PropertyPromotionDocBlockMerger.php | 25 +- .../Guard/MakePropertyPromotionGuard.php | 3 +- .../StrncmpMatchAndRefactor.php | 16 +- .../StrposMatchAndRefactor.php | 9 +- .../SubstrMatchAndRefactor.php | 16 +- .../NodeAnalyzer/MatchSwitchAnalyzer.php | 20 +- .../NodeAnalyzer/PhpAttributeAnalyzer.php | 8 +- .../PromotedPropertyCandidateResolver.php | 12 +- rules/Php80/NodeAnalyzer/SwitchAnalyzer.php | 14 +- rules/Php80/NodeFactory/AttrGroupsFactory.php | 3 +- rules/Php80/NodeFactory/MatchFactory.php | 15 +- .../NodeFactory/NestedAttrGroupsFactory.php | 3 +- ...AttributeGroupNamedArgumentManipulator.php | 2 +- .../NodeResolver/SwitchExprsResolver.php | 9 +- .../RemoveUnusedVariableInCatchRector.php | 13 +- ...AddParamBasedOnParentClassMethodRector.php | 17 +- .../FinalPrivateToPrivateVisibilityRector.php | 3 +- .../ClassMethod/SetStateToStaticRector.php | 3 +- .../Class_/AnnotationToAttributeRector.php | 26 +- ...ertyAssignToConstructorPromotionRector.php | 36 +- .../Class_/StringableForToStringRector.php | 23 +- .../Rector/FunctionLike/MixedTypeRector.php | 17 +- .../Rector/Identical/StrEndsWithRector.php | 10 +- .../Rector/Identical/StrStartsWithRector.php | 2 +- .../Rector/NotIdentical/StrContainsRector.php | 7 +- .../NestedAnnotationToAttributeRector.php | 20 +- .../Switch_/ChangeSwitchToMatchRector.php | 15 +- .../AnnotationPropertyToAttributeClass.php | 6 +- .../ValueObject/AnnotationToAttribute.php | 8 +- rules/Php80/ValueObject/CondAndExpr.php | 5 +- .../DoctrineTagAndAnnotationToAttribute.php | 6 +- rules/Php80/ValueObject/MatchResult.php | 6 +- .../NestedAnnotationToAttribute.php | 8 +- ...tedDoctrineTagAndAnnotationToAttribute.php | 6 +- .../PropertyPromotionCandidate.php | 9 +- rules/Php80/ValueObject/StrStartsWith.php | 12 +- .../CoalesePropertyAssignMatcher.php | 6 +- .../Php81/NodeAnalyzer/ComplexNewAnalyzer.php | 5 +- rules/Php81/NodeFactory/EnumFactory.php | 27 +- .../Array_/FirstClassCallableRector.php | 13 +- .../ClassMethod/NewInInitializerRector.php | 16 +- .../Class_/MyCLabsClassToEnumRector.php | 3 +- .../Class_/SpatieEnumClassToEnumRector.php | 8 +- .../NullToStrictStringFuncCallArgRector.php | 20 +- .../MyCLabsMethodCallToEnumConstRector.php | 3 +- .../Property/ReadOnlyPropertyRector.php | 29 +- .../Rector/Class_/ReadOnlyClassRector.php | 12 +- ...riableInStringInterpolationFixerRector.php | 11 +- .../New_/FilesystemIteratorSkipDotsRector.php | 3 +- .../AddSensitiveParameterAttributeRector.php | 5 +- .../ClassConst/AddTypeToConstRector.php | 18 +- ...rideAttributeToOverriddenMethodsRector.php | 25 +- .../FuncCall/CombineHostPortLdapUriRector.php | 13 +- .../Param/ExplicitNullableParamTypeRector.php | 6 +- .../Guard/OverrideByParentClassGuard.php | 3 +- .../Guard/ParentPropertyLookupGuard.php | 18 +- .../NodeManipulator/VisibilityManipulator.php | 17 +- .../PrivatizeFinalClassMethodRector.php | 12 +- .../Class_/FinalizeTestCaseClassRector.php | 6 +- .../PrivatizeFinalClassPropertyRector.php | 9 +- .../ClassMethodVisibilityGuard.php | 3 +- .../NodeManipulator/ComplexNodeRemover.php | 12 +- .../ClassMethod/ArgumentRemoverRector.php | 10 +- .../Rector/Class_/RemoveInterfacesRector.php | 2 +- .../Rector/Class_/RemoveTraitUseRector.php | 2 +- .../FuncCall/RemoveFuncCallArgRector.php | 2 +- .../Rector/FuncCall/RemoveFuncCallRector.php | 6 +- .../Removing/ValueObject/ArgumentRemover.php | 9 +- .../ValueObject/RemoveFuncCallArg.php | 6 +- .../Collector/RenamedNameCollector.php | 2 +- .../Renaming/NodeManipulator/ClassRenamer.php | 23 +- .../NodeManipulator/SwitchManipulator.php | 6 +- .../RenameClassConstFetchRector.php | 2 +- .../ClassMethod/RenameAnnotationRector.php | 11 +- .../Rector/Class_/RenameAttributeRector.php | 2 +- .../ConstFetch/RenameConstantRector.php | 2 +- .../Rector/FuncCall/RenameFunctionRector.php | 2 +- ...nctionLikeParamWithinCallLikeArgRector.php | 15 +- .../Rector/MethodCall/RenameMethodRector.php | 11 +- .../Rector/Name/RenameClassRector.php | 6 +- .../PropertyFetch/RenamePropertyRector.php | 7 +- .../StaticCall/RenameStaticMethodRector.php | 2 +- .../Rector/String_/RenameStringRector.php | 5 +- .../Renaming/ValueObject/MethodCallRename.php | 9 +- .../MethodCallRenameWithArrayKey.php | 9 +- .../Renaming/ValueObject/RenameAnnotation.php | 6 +- .../ValueObject/RenameAnnotationByType.php | 9 +- .../Renaming/ValueObject/RenameAttribute.php | 6 +- .../ValueObject/RenameClassAndConstFetch.php | 12 +- .../ValueObject/RenameClassConstFetch.php | 9 +- ...nameFunctionLikeParamWithinCallLikeArg.php | 11 +- rules/Renaming/ValueObject/RenameProperty.php | 9 +- .../ValueObject/RenameStaticMethod.php | 12 +- .../UnitializedPropertyAnalyzer.php | 12 +- .../NodeFactory/ExactCompareFactory.php | 15 +- .../AbstractFalsyScalarRuleFixerRector.php | 5 +- .../BooleanInBooleanNotRuleFixerRector.php | 3 +- .../Empty_/DisallowedEmptyRuleFixerRector.php | 9 +- .../BooleanInIfConditionRuleFixerRector.php | 3 +- ...ooleanInTernaryOperatorRuleFixerRector.php | 3 +- .../DisallowedShortTernaryRuleFixerRector.php | 8 +- ...FuncCallStaticCallToMethodCallAnalyzer.php | 18 +- .../NodeFactory/PropertyFetchFactory.php | 3 +- .../TypeProvidingExprFromClassResolver.php | 9 +- .../ArrayDimFetchToMethodCallRector.php | 2 +- .../PropertyAssignToMethodCallRector.php | 2 +- .../PropertyFetchToMethodCallRector.php | 2 +- .../AttributeKeyToClassConstFetchRector.php | 5 +- .../ReturnTypeWillChangeRector.php | 11 +- .../Rector/ClassMethod/WrapReturnRector.php | 4 +- ...dAllowDynamicPropertiesAttributeRector.php | 22 +- .../Class_/AddInterfaceByTraitRector.php | 2 +- .../Rector/Class_/MergeInterfacesRector.php | 2 +- .../Class_/ParentClassToTraitsRector.php | 5 +- .../ConstFetchToClassConstFetchRector.php | 2 +- .../RectorConfigBuilderRector.php | 2 +- .../FuncCall/FuncCallToConstFetchRector.php | 2 +- .../FuncCall/FuncCallToMethodCallRector.php | 5 +- .../Rector/FuncCall/FuncCallToNewRector.php | 2 +- .../FuncCall/FuncCallToStaticCallRector.php | 2 +- .../MethodCall/MethodCallToFuncCallRector.php | 2 +- .../MethodCall/MethodCallToNewRector.php | 2 +- .../MethodCallToPropertyFetchRector.php | 2 +- .../MethodCallToStaticCallRector.php | 2 +- .../ReplaceParentCallByPropertyCallRector.php | 2 +- .../Rector/New_/NewToStaticCallRector.php | 2 +- .../Scalar/ScalarValueToConstFetchRector.php | 12 +- .../StaticCall/StaticCallToFuncCallRector.php | 2 +- .../StaticCallToMethodCallRector.php | 5 +- .../StaticCall/StaticCallToNewRector.php | 2 +- .../String_/StringToClassConstantRector.php | 7 +- .../ValueObject/ArrayDimFetchToMethodCall.php | 6 +- .../AttributeKeyToClassConstFetch.php | 11 +- .../ValueObject/ClassMethodReference.php | 6 +- .../ConstFetchToClassConstFetch.php | 9 +- .../ValueObject/FuncCallToMethodCall.php | 9 +- .../ValueObject/FuncCallToStaticCall.php | 9 +- .../ValueObject/MethodCallToFuncCall.php | 9 +- .../Transform/ValueObject/MethodCallToNew.php | 8 +- .../ValueObject/MethodCallToPropertyFetch.php | 9 +- .../ValueObject/MethodCallToStaticCall.php | 12 +- .../Transform/ValueObject/NewToStaticCall.php | 9 +- .../ValueObject/ParentClassToTraits.php | 5 +- .../PropertyAssignToMethodCall.php | 9 +- .../ValueObject/PropertyFetchToMethodCall.php | 14 +- .../ReplaceParentCallByPropertyCall.php | 9 +- .../ValueObject/ScalarValueToConstFetch.php | 10 +- .../ValueObject/StaticCallToFuncCall.php | 9 +- .../ValueObject/StaticCallToMethodCall.php | 12 +- .../Transform/ValueObject/StaticCallToNew.php | 6 +- .../ValueObject/StringToClassConstant.php | 9 +- rules/Transform/ValueObject/WrapReturn.php | 9 +- .../ConstructorAssignDetector.php | 28 +- .../NullTypeAssignDetector.php | 16 +- .../FunctionLikeReturnTypeResolver.php | 3 +- .../Guard/ParamTypeAddGuard.php | 25 +- .../Guard/PropertyTypeOverrideGuard.php | 8 +- .../Matcher/PropertyAssignMatcher.php | 3 +- ...AutowiredClassMethodOrPropertyAnalyzer.php | 6 +- .../NodeAnalyzer/CallTypesResolver.php | 12 +- .../NodeAnalyzer/CallerParamMatcher.php | 12 +- .../ClassMethodAndPropertyAnalyzer.php | 3 +- .../ClassMethodParamTypeCompleter.php | 6 +- .../NodeAnalyzer/NeverFuncCallAnalyzer.php | 3 +- .../NodeAnalyzer/ParamAnalyzer.php | 3 +- .../NodeAnalyzer/ReturnAnalyzer.php | 3 +- .../ExclusiveNativeCallLikeReturnMatcher.php | 3 +- ...StrictNativeFunctionReturnTypeAnalyzer.php | 9 +- .../StrictReturnNewAnalyzer.php | 12 +- .../NodeAnalyzer/TypeNodeUnwrapper.php | 3 +- .../NodeManipulator/AddNeverReturnType.php | 20 +- .../NodeManipulator/AddReturnTypeFromCast.php | 16 +- .../AddReturnTypeFromParam.php | 24 +- .../AddReturnTypeFromStrictNativeCall.php | 15 +- .../NodeManipulator/AddUnionReturnType.php | 9 +- .../PropertyTypeDecorator.php | 12 +- .../PHPStan/ObjectTypeSpecifier.php | 39 +- .../PhpDocParser/ParamPhpDocNodeFactory.php | 5 +- .../TypeExpressionFromVarTagResolver.php | 3 +- .../AddArrowFunctionReturnTypeRector.php | 3 +- .../BinaryOpNullableToInstanceofRector.php | 3 +- ...ddMethodCallBasedStrictParamTypeRector.php | 9 +- ...ockBasedOnCallableNativeFuncCallRector.php | 16 +- ...amTypeBasedOnPHPUnitDataProviderRector.php | 17 +- .../AddParamTypeDeclarationRector.php | 18 +- .../AddParamTypeFromPropertyTypeRector.php | 22 +- ...turnArrayDocblockBasedOnArrayMapRector.php | 18 +- ...larationBasedOnParentClassMethodRector.php | 9 +- .../AddReturnTypeDeclarationRector.php | 16 +- .../AddTypeFromResourceDocblockRector.php | 20 +- .../AddVoidReturnTypeWhereNoReturnRector.php | 14 +- ...eturnTypeFromBooleanConstReturnsRector.php | 12 +- ...turnTypeFromBooleanStrictReturnsRector.php | 19 +- ...mericReturnTypeFromStrictReturnsRector.php | 17 +- ...eturnTypeFromStrictScalarReturnsRector.php | 17 +- .../ParamTypeByMethodCallTypeRector.php | 23 +- .../ParamTypeByParentCallTypeRector.php | 11 +- .../ClassMethod/ReturnNeverTypeRector.php | 6 +- .../ClassMethod/ReturnNullableTypeRector.php | 9 +- .../ReturnTypeFromMockObjectRector.php | 9 +- .../ReturnTypeFromReturnCastRector.php | 3 +- .../ReturnTypeFromReturnDirectArrayRector.php | 6 +- .../ReturnTypeFromReturnNewRector.php | 33 +- ...turnTypeFromStrictConstantReturnRector.php | 15 +- ...ReturnTypeFromStrictFluentReturnRector.php | 12 +- .../ReturnTypeFromStrictNativeCallRector.php | 3 +- .../ReturnTypeFromStrictNewArrayRector.php | 28 +- .../ReturnTypeFromStrictParamRector.php | 3 +- .../ReturnTypeFromStrictTypedCallRector.php | 24 +- ...eturnTypeFromStrictTypedPropertyRector.php | 18 +- .../ReturnTypeFromSymfonySerializerRector.php | 9 +- .../ClassMethod/ReturnUnionTypeRector.php | 3 +- .../StrictArrayParamDimFetchRector.php | 11 +- .../StrictStringParamConcatRector.php | 12 +- ...eturnTypeFromStrictScalarReturnsRector.php | 13 +- ...eturnTypeFromStrictStringReturnsRector.php | 13 +- ...TestsVoidReturnTypeWhereNoReturnRector.php | 6 +- ...ChildDoctrineRepositoryClassTypeRector.php | 14 +- ...eDateTimePropertyTypeDeclarationRector.php | 6 +- ...opertyTypeFromStrictSetterGetterRector.php | 15 +- .../ReturnTypeFromStrictTernaryRector.php | 15 +- ...ypedPropertyFromCreateMockAssignRector.php | 9 +- ...tyFromJMSSerializerAttributeTypeRector.php | 24 +- .../AddClosureNeverReturnTypeRector.php | 3 +- ...osureVoidReturnTypeWhereNoReturnRector.php | 3 +- .../Closure/ClosureReturnTypeRector.php | 6 +- ...mptyOnNullableObjectToInstanceOfRector.php | 3 +- .../InlineVarDocTagToAssertRector.php | 9 +- .../AddClosureParamTypeFromArgRector.php | 11 +- ...eParamTypeFromIterableMethodCallRector.php | 12 +- .../AddClosureParamTypeFromObjectRector.php | 8 +- ...LikeWithinCallLikeArgDeclarationRector.php | 24 +- .../AddParamTypeSplFixedArrayRector.php | 6 +- ...dReturnTypeDeclarationFromYieldsRector.php | 20 +- ...ctionVoidReturnTypeWhereNoReturnRector.php | 3 +- .../AddPropertyTypeDeclarationRector.php | 5 +- .../TypedPropertyFromAssignsRector.php | 30 +- ...pedPropertyFromStrictConstructorRector.php | 30 +- .../TypedPropertyFromStrictSetUpRector.php | 12 +- .../DeclareStrictTypesRector.php | 13 +- .../IncreaseDeclareStrictTypesRector.php | 23 +- .../WhileNullableToInstanceofRector.php | 6 +- .../TypeAnalyzer/NullableTypeAnalyzer.php | 3 +- .../PropertyTypeDefaultValueAnalyzer.php | 11 +- .../TypeAnalyzer/ReturnStrictTypeAnalyzer.php | 19 +- .../AssignToPropertyTypeInferer.php | 36 +- .../AllAssignNodePropertyTypeInferer.php | 16 +- ...tterTypeDeclarationPropertyTypeInferer.php | 9 +- ...tterTypeDeclarationPropertyTypeInferer.php | 9 +- .../TrustedClassMethodPropertyTypeInferer.php | 40 +- .../TypeInferer/ReturnTypeInferer.php | 6 +- ...urnedNodesReturnTypeInfererTypeInferer.php | 18 +- .../TypeInferer/SilentVoidResolver.php | 27 +- rules/TypeDeclaration/TypeNormalizer.php | 12 +- .../AddClosureParamTypeFromArg.php | 10 +- .../AddClosureParamTypeFromObject.php | 10 +- .../ValueObject/AddParamTypeDeclaration.php | 11 +- ...nctionLikeWithinCallLikeArgDeclaration.php | 11 +- .../AddPropertyTypeDeclaration.php | 9 +- .../ValueObject/AddReturnTypeDeclaration.php | 9 +- .../ValueObject/AssignToVariable.php | 6 +- .../ValueObject/DataProviderNodes.php | 2 +- .../ValueObject/NestedArrayType.php | 9 +- .../ChangeConstantVisibilityRector.php | 5 +- .../ChangeMethodVisibilityRector.php | 8 +- .../ExplicitPublicClassMethodRector.php | 3 +- .../ValueObject/ChangeConstantVisibility.php | 9 +- .../ValueObject/ChangeMethodVisibility.php | 9 +- src/Application/ApplicationFileProcessor.php | 32 +- src/Application/ChangedNodeScopeRefresher.php | 6 +- src/Application/FileProcessor.php | 50 +- .../Provider/CurrentFileProvider.php | 5 +- src/Application/VersionResolver.php | 4 +- src/Autoloading/AdditionalAutoloader.php | 3 +- .../CurrentTokenIteratorProvider.php | 5 +- .../PhpDoc/DoctrineAnnotationTagValueNode.php | 5 +- src/BetterPhpDocParser/PhpDoc/StringNode.php | 5 +- .../PhpDocInfo/PhpDocInfo.php | 30 +- .../PhpDocInfo/PhpDocInfoFactory.php | 20 +- .../PhpDocInfo/TokenIteratorFactory.php | 3 +- .../PhpDocManipulator/PhpDocClassRenamer.php | 6 +- .../PhpDocManipulator/PhpDocTypeChanger.php | 15 +- src/BetterPhpDocParser/PhpDocNodeMapper.php | 8 +- .../ArrayTypePhpDocNodeVisitor.php | 3 +- .../CallableTypePhpDocNodeVisitor.php | 5 +- .../ChangedPhpDocNodeVisitor.php | 5 +- .../IntersectionTypeNodePhpDocNodeVisitor.php | 3 +- .../TemplatePhpDocNodeVisitor.php | 6 +- .../UnionTypeNodePhpDocNodeVisitor.php | 6 +- .../ArrayItemClassNameDecorator.php | 6 +- .../PhpDocParser/BetterPhpDocParser.php | 33 +- .../PhpDocParser/ClassAnnotationMatcher.php | 11 +- .../ConstExprClassNameDecorator.php | 6 +- .../DoctrineAnnotationDecorator.php | 73 +- .../StaticDoctrineAnnotationParser.php | 6 +- .../ArrayParser.php | 3 +- .../PlainValueParser.php | 13 +- .../Printer/PhpDocInfoPrinter.php | 36 +- .../AbstractValuesAwareNode.php | 21 +- .../DoctrineAnnotation/CurlyListNode.php | 6 +- .../SpacingAwareTemplateTagValueNode.php | 3 +- .../ValueObject/StartAndEnd.php | 6 +- .../Type/BracketsAwareUnionTypeNode.php | 3 +- src/Bridge/SetProviderCollector.php | 6 +- src/Caching/Cache.php | 3 +- src/Caching/CacheFactory.php | 3 +- src/Caching/Detector/ChangedFilesDetector.php | 11 +- src/Caching/UnchangedFilesFilter.php | 3 +- src/Caching/ValueObject/CacheFilePaths.php | 9 +- src/Caching/ValueObject/CacheItem.php | 3 +- .../ValueObject/Storage/FileCacheStorage.php | 6 +- .../Storage/MemoryCacheStorage.php | 2 +- .../Output/ConsoleOutputFormatter.php | 3 +- .../ValueObject/RectorWithLineChange.php | 8 +- .../ValueObjectFactory/ErrorFactory.php | 3 +- .../ValueObjectFactory/FileDiffFactory.php | 9 +- src/Comments/CommentRemover.php | 3 +- src/Comments/NodeDocBlock/DocBlockUpdater.php | 7 +- .../CommentRemovingNodeTraverser.php | 2 +- src/Composer/InstalledPackageResolver.php | 5 +- src/Composer/ValueObject/InstalledPackage.php | 6 +- src/Config/RectorConfig.php | 6 +- src/Config/RegisteredService.php | 9 +- src/Configuration/ConfigInitializer.php | 12 +- src/Configuration/ConfigurationFactory.php | 3 +- .../Parameter/SimpleParameterProvider.php | 2 +- src/Configuration/RectorConfigBuilder.php | 144 +- .../RenamedClassesDataCollector.php | 2 +- src/Console/Command/CustomRuleCommand.php | 3 +- src/Console/Command/ListRulesCommand.php | 16 +- src/Console/Command/ProcessCommand.php | 33 +- src/Console/Command/SetupCICommand.php | 3 +- src/Console/Command/WorkerCommand.php | 12 +- .../Formatter/ColorConsoleDiffFormatter.php | 3 +- src/Console/Formatter/ConsoleDiffer.php | 6 +- .../Output/OutputFormatterCollector.php | 2 +- src/Console/Style/RectorStyle.php | 5 +- src/Console/Style/SymfonyStyleFactory.php | 3 +- src/CustomRules/SimpleNodeDumper.php | 24 +- .../LazyContainerFactory.php | 8 +- src/Differ/DefaultDiffer.php | 3 +- .../Reflection/FamilyRelationsAnalyzer.php | 10 +- src/FileSystem/FileAndDirectoryFilter.php | 8 +- src/FileSystem/FilePathHelper.php | 3 +- src/FileSystem/FilesFinder.php | 26 +- src/FileSystem/FilesystemTweaker.php | 4 +- src/NodeAnalyzer/BinaryOpAnalyzer.php | 3 +- src/NodeAnalyzer/CallAnalyzer.php | 3 +- src/NodeAnalyzer/CompactFuncCallAnalyzer.php | 7 +- src/NodeAnalyzer/DoctrineEntityAnalyzer.php | 3 +- src/NodeAnalyzer/ExprAnalyzer.php | 10 +- src/NodeAnalyzer/MagicClassMethodAnalyzer.php | 3 +- src/NodeAnalyzer/ParamAnalyzer.php | 23 +- src/NodeAnalyzer/PropertyAnalyzer.php | 3 +- src/NodeAnalyzer/PropertyFetchAnalyzer.php | 19 +- src/NodeAnalyzer/PropertyPresenceChecker.php | 12 +- src/NodeAnalyzer/TerminatedNodeAnalyzer.php | 18 +- src/NodeAnalyzer/VariadicAnalyzer.php | 7 +- .../ArrayCallableMethodMatcher.php | 18 +- .../ValueObject/ArrayCallable.php | 9 +- src/NodeDecorator/CreatedByRuleDecorator.php | 4 +- src/NodeDecorator/PropertyTypeDecorator.php | 12 +- src/NodeManipulator/AssignManipulator.php | 9 +- src/NodeManipulator/BinaryOpManipulator.php | 7 +- src/NodeManipulator/ClassConstManipulator.php | 9 +- .../ClassDependencyManipulator.php | 27 +- .../ClassInsertManipulator.php | 3 +- src/NodeManipulator/ClassManipulator.php | 6 +- .../ClassMethodAssignManipulator.php | 8 +- .../ClassMethodManipulator.php | 6 +- .../ClassMethodPropertyFetchManipulator.php | 17 +- src/NodeManipulator/FuncCallManipulator.php | 3 +- .../FunctionLikeManipulator.php | 3 +- src/NodeManipulator/IfManipulator.php | 12 +- .../PropertyFetchAssignManipulator.php | 15 +- src/NodeManipulator/PropertyManipulator.php | 37 +- src/NodeManipulator/StmtsManipulator.php | 29 +- src/NodeNameResolver/NodeNameResolver.php | 14 +- .../NodeNameResolver/FuncCallNameResolver.php | 3 +- .../NodeNameResolver/FunctionNameResolver.php | 2 +- .../NodeNameResolver/NameNameResolver.php | 2 +- .../PHPStanServicesFactory.php | 3 +- .../NodeScopeAndMetadataDecorator.php | 9 +- .../GenericClassStringTypeCorrector.php | 3 +- src/NodeTypeResolver/NodeTypeResolver.php | 20 +- .../ClassAndInterfaceTypeResolver.php | 3 +- .../NodeTypeResolver/NewTypeResolver.php | 6 +- .../NodeTypeResolver/ParamTypeResolver.php | 5 +- .../PropertyFetchTypeResolver.php | 11 +- .../NodeTypeResolver/PropertyTypeResolver.php | 3 +- .../NodeTypeResolver/ScalarTypeResolver.php | 22 +- .../StaticCallMethodCallTypeResolver.php | 8 +- .../NodeTypeResolver/TraitTypeResolver.php | 3 +- .../ObjectWithoutClassTypeWithParentTypes.php | 2 +- .../NodeVisitor/ByRefReturnNodeVisitor.php | 7 +- .../NodeVisitor/ByRefVariableNodeVisitor.php | 11 +- .../Scope/NodeVisitor/ContextNodeVisitor.php | 7 +- .../NodeVisitor/GlobalVariableNodeVisitor.php | 7 +- .../Scope/NodeVisitor/ReprintNodeVisitor.php | 34 + .../NodeVisitor/StaticVariableNodeVisitor.php | 7 +- .../Scope/PHPStanNodeScopeResolver.php | 42 +- .../PHPStan/Scope/RectorNodeScopeResolver.php | 27 + .../PHPStan/Scope/ScopeFactory.php | 3 +- .../PHPStan/Type/StaticTypeAnalyzer.php | 3 +- .../PHPStan/Type/TypeFactory.php | 15 +- src/NodeTypeResolver/PHPStan/TypeHasher.php | 3 +- .../NodeAnalyzer/DocBlockClassRenamer.php | 3 +- .../NodeAnalyzer/DocBlockNameImporter.php | 3 +- .../NodeAnalyzer/DocBlockTagReplacer.php | 3 +- .../ClassRenamePhpDocNodeVisitor.php | 21 +- .../NameImportingPhpDocNodeVisitor.php | 25 +- ...orBetterReflectionSourceLocatorFactory.php | 6 +- .../IntermediateSourceLocator.php | 3 +- .../DynamicSourceLocatorProvider.php | 15 +- .../TypeAnalyzer/ArrayTypeAnalyzer.php | 3 +- .../TypeAnalyzer/StringTypeAnalyzer.php | 3 +- .../TypeComparator/ArrayTypeComparator.php | 6 +- .../TypeComparator/ScalarTypeComparator.php | 2 +- .../TypeComparator/TypeComparator.php | 18 +- .../ValueObject/OldToNewType.php | 6 +- .../UnreachableStatementNodeVisitor.php | 9 +- .../PHPStanStaticTypeMapper.php | 2 +- .../AccessoryLiteralStringTypeMapper.php | 3 +- .../AccessoryNonEmptyStringTypeMapper.php | 3 +- .../AccessoryNonFalsyStringTypeMapper.php | 3 +- .../AccessoryNumericStringTypeMapper.php | 3 +- .../TypeMapper/ArrayTypeMapper.php | 17 +- .../TypeMapper/BooleanTypeMapper.php | 3 +- .../TypeMapper/ClassStringTypeMapper.php | 3 +- .../TypeMapper/ClosureTypeMapper.php | 3 +- .../ConditionalTypeForParameterMapper.php | 5 +- .../TypeMapper/ConditionalTypeMapper.php | 5 +- .../TypeMapper/ConstantArrayTypeMapper.php | 45 + .../TypeMapper/FloatTypeMapper.php | 3 +- .../GenericClassStringTypeMapper.php | 3 +- .../TypeMapper/HasMethodTypeMapper.php | 3 +- .../TypeMapper/HasOffsetTypeMapper.php | 3 +- .../HasOffsetValueTypeTypeMapper.php | 3 +- .../TypeMapper/HasPropertyTypeMapper.php | 3 +- .../TypeMapper/IntegerTypeMapper.php | 3 +- .../TypeMapper/IntersectionTypeMapper.php | 12 +- .../TypeMapper/IterableTypeMapper.php | 3 +- .../TypeMapper/MixedTypeMapper.php | 3 +- .../TypeMapper/NonEmptyArrayTypeMapper.php | 3 +- .../TypeMapper/NullTypeMapper.php | 3 +- .../ObjectWithoutClassTypeMapper.php | 3 +- .../TypeMapper/OversizedArrayTypeMapper.php | 3 +- .../TypeMapper/ParentStaticTypeMapper.php | 3 +- .../TypeMapper/SelfObjectTypeMapper.php | 3 +- .../TypeMapper/StaticTypeMapper.php | 6 +- .../TypeMapper/StrictMixedTypeMapper.php | 3 +- .../TypeMapper/StringTypeMapper.php | 3 +- .../TypeMapper/ThisTypeMapper.php | 2 +- .../TypeWithClassNameTypeMapper.php | 3 +- .../TypeMapper/UnionTypeMapper.php | 8 +- .../TypeMapper/VoidTypeMapper.php | 3 +- .../Application/ParallelFileProcessor.php | 3 +- .../Command/WorkerCommandLineFactory.php | 6 +- .../ComposerJsonPhpVersionResolver.php | 2 +- src/Php/PolyfillPackagesProvider.php | 4 +- .../AnnotationToAttributeMapper.php | 2 +- .../ArrayAnnotationToAttributeMapper.php | 10 +- ...rayItemNodeAnnotationToAttributeMapper.php | 9 +- ...sConstFetchAnnotationToAttributeMapper.php | 2 +- ...rlyListNodeAnnotationToAttributeMapper.php | 13 +- ...eAnnotationAnnotationToAttributeMapper.php | 13 +- .../StringAnnotationToAttributeMapper.php | 4 +- .../AttributeArrayNameInliner.php | 28 +- .../AnnotationToAttributeMapperInterface.php | 4 +- ...nnotationToAttributeIntegerValueCaster.php | 21 +- .../NodeFactory/AttributeNameFactory.php | 3 +- .../NodeFactory/NamedArgsFactory.php | 46 +- .../NodeFactory/PhpAttributeGroupFactory.php | 21 +- .../PhpNestedAttributeGroupFactory.php | 18 +- src/PhpAttribute/UseAliasNameMatcher.php | 4 +- .../ValueObject/UseAliasMetadata.php | 19 +- .../NodeVisitor/CallableNodeVisitor.php | 13 +- .../PhpDocParser/PhpDocNodeTraverser.php | 6 +- .../CallablePhpDocNodeVisitor.php | 3 +- .../ParentConnectingPhpDocNodeVisitor.php | 2 +- src/PhpDocParser/PhpParser/SmartPhpParser.php | 3 +- .../PhpParser/SmartPhpParserFactory.php | 10 +- src/PhpParser/AstResolver.php | 23 +- src/PhpParser/Comparing/NodeComparator.php | 6 +- src/PhpParser/Node/AssignAndBinaryMap.php | 5 +- src/PhpParser/Node/BetterNodeFinder.php | 39 +- .../Node/CustomNode/FileWithoutNamespace.php | 2 +- src/PhpParser/Node/NodeFactory.php | 26 +- src/PhpParser/Node/Value/ValueResolver.php | 50 +- .../NodeFinder/LocalMethodCallFinder.php | 9 +- .../NodeFinder/PropertyFetchFinder.php | 23 +- src/PhpParser/NodeTransformer.php | 5 +- .../NodeTraverser/RectorNodeTraverser.php | 12 +- src/PhpParser/Parser/InlineCodeParser.php | 31 +- src/PhpParser/Parser/ParserErrors.php | 6 +- src/PhpParser/Parser/RectorParser.php | 34 +- src/PhpParser/Parser/SimplePhpParser.php | 8 +- .../Printer/BetterStandardPrinter.php | 88 +- src/PhpParser/ValueObject/StmtsAndTokens.php | 4 +- .../Application/PostFileProcessor.php | 23 +- .../Collector/UseNodesToAddCollector.php | 12 +- src/PostRector/Guard/AddUseStatementGuard.php | 5 +- .../Rector/ClassRenamingPostRector.php | 14 +- .../DocblockNameImportingPostRector.php | 17 +- .../Rector/NameImportingPostRector.php | 21 +- .../Rector/UnusedImportRemovingPostRector.php | 20 +- src/PostRector/Rector/UseAddingPostRector.php | 13 +- .../ValueObject/PropertyMetadata.php | 13 +- src/Rector/AbstractRector.php | 79 +- src/Reflection/ClassModifierChecker.php | 3 +- src/Reflection/MethodReflectionResolver.php | 3 +- src/Reflection/ReflectionResolver.php | 15 +- src/Reporting/DeprecatedRulesReporter.php | 3 +- src/Reporting/MissConfigurationReporter.php | 6 +- src/Set/SetManager.php | 6 +- src/Set/ValueObject/ComposerTriggeredSet.php | 12 +- src/Set/ValueObject/Set.php | 9 +- src/Skipper/Matcher/FileInfoMatcher.php | 9 +- .../SkippedPathsResolver.php | 3 +- src/Skipper/SkipVoter/ClassSkipVoter.php | 9 +- src/Skipper/Skipper/PathSkipper.php | 6 +- src/Skipper/Skipper/SkipSkipper.php | 3 +- src/Skipper/Skipper/Skipper.php | 9 +- .../DynamicSourceLocatorDecorator.php | 9 +- .../Mapper/PhpParserNodeMapper.php | 2 +- .../Naming/NameScopeFactory.php | 7 +- .../PhpDoc/PhpDocTypeMapper.php | 5 +- .../IdentifierPhpDocTypeMapper.php | 13 +- .../IntersectionPhpDocTypeMapper.php | 3 +- .../PhpDocParser/NullablePhpDocTypeMapper.php | 6 +- .../PhpDocParser/UnionPhpDocTypeMapper.php | 12 +- .../PhpParser/IdentifierNodeMapper.php | 3 +- .../PhpParser/IntersectionTypeNodeMapper.php | 9 +- .../PhpParser/NameNodeMapper.php | 6 +- .../PhpParser/NullableTypeNodeMapper.php | 12 +- .../PhpParser/UnionTypeNodeMapper.php | 15 +- src/StaticTypeMapper/StaticTypeMapper.php | 12 +- .../ValueObject/Type/AliasedObjectType.php | 9 +- .../Type/FullyQualifiedObjectType.php | 6 +- .../Type/ShortenedGenericObjectType.php | 6 +- .../ValueObject/Type/ShortenedObjectType.php | 6 +- .../ValueObject/Type/SimpleStaticType.php | 3 +- src/Testing/PHPUnit/AbstractLazyTestCase.php | 5 +- .../PHPUnit/AbstractRectorTestCase.php | 17 +- .../PHPUnit/ValueObject/RectorTestResult.php | 6 +- src/Testing/TestingParser/TestingParser.php | 12 +- src/Util/ArrayParametersMerger.php | 4 +- src/Util/NodePrinter.php | 11 +- src/ValueObject/Application/File.php | 39 +- .../Bootstrap/BootstrapConfigs.php | 5 +- src/ValueObject/Configuration.php | 28 +- src/ValueObject/Error/SystemError.php | 6 +- src/ValueObject/FileProcessResult.php | 5 +- src/ValueObject/FuncCallAndExpr.php | 6 +- src/ValueObject/ProcessResult.php | 4 +- src/ValueObject/Reporting/FileDiff.php | 14 +- src/ValueObject/SprintfStringAndArgs.php | 5 +- src/ValueObject/Visibility.php | 16 +- .../ClassMethodParamVendorLockResolver.php | 9 +- .../ClassMethodReturnTypeOverrideGuard.php | 16 +- .../ClassMethodReturnVendorLockResolver.php | 13 +- .../ParentClassMethodTypeOverrideGuard.php | 18 +- src/VersionBonding/PhpVersionedFilter.php | 6 +- vendor/autoload.php | 2 +- vendor/composer/autoload_classmap.php | 45 +- vendor/composer/autoload_real.php | 10 +- vendor/composer/autoload_static.php | 53 +- vendor/composer/installed.json | 120 +- vendor/composer/installed.php | 2 +- .../xdebug-handler/src/XdebugHandler.php | 2 +- .../illuminate/container/Attributes/Auth.php | 5 +- .../container/Attributes/Authenticated.php | 5 +- .../illuminate/container/Attributes/Cache.php | 5 +- .../container/Attributes/Config.php | 5 +- .../container/Attributes/Database.php | 5 +- .../illuminate/container/Attributes/Log.php | 5 +- .../container/Attributes/RouteParameter.php | 5 +- .../container/Attributes/Storage.php | 5 +- .../illuminate/container/Attributes/Tag.php | 5 +- vendor/illuminate/container/Container.php | 20 +- .../container/ContextualBindingBuilder.php | 4 +- .../utils/src/Iterators/CachingIterator.php | 5 +- vendor/nette/utils/src/Utils/ArrayList.php | 5 +- vendor/nette/utils/src/Utils/Arrays.php | 6 +- vendor/nette/utils/src/Utils/FileInfo.php | 5 +- vendor/nette/utils/src/Utils/Finder.php | 45 +- vendor/nette/utils/src/Utils/Html.php | 10 +- vendor/nette/utils/src/Utils/Image.php | 7 +- vendor/nette/utils/src/Utils/ImageColor.php | 20 +- vendor/nette/utils/src/Utils/Iterables.php | 10 +- .../nette/utils/src/Utils/ObjectHelpers.php | 12 +- vendor/nette/utils/src/Utils/Paginator.php | 14 +- vendor/nette/utils/src/Utils/Random.php | 4 +- .../utils/src/Utils/ReflectionMethod.php | 5 +- vendor/nette/utils/src/Utils/Strings.php | 12 +- vendor/nette/utils/src/Utils/Type.php | 38 +- vendor/nikic/php-parser/README.md | 32 +- vendor/nikic/php-parser/bin/php-parse | 37 +- vendor/nikic/php-parser/composer.json | 10 +- .../lib/PhpParser/Builder/ClassConst.php | 29 +- .../lib/PhpParser/Builder/Class_.php | 50 +- .../lib/PhpParser/Builder/Declaration.php | 12 +- .../lib/PhpParser/Builder/EnumCase.php | 12 +- .../lib/PhpParser/Builder/Enum_.php | 38 +- .../lib/PhpParser/Builder/FunctionLike.php | 11 +- .../lib/PhpParser/Builder/Function_.php | 9 +- .../lib/PhpParser/Builder/Interface_.php | 15 +- .../lib/PhpParser/Builder/Method.php | 25 +- .../lib/PhpParser/Builder/Namespace_.php | 5 +- .../lib/PhpParser/Builder/Param.php | 60 +- .../lib/PhpParser/Builder/Property.php | 85 +- .../lib/PhpParser/Builder/TraitUse.php | 6 +- .../PhpParser/Builder/TraitUseAdaptation.php | 43 +- .../lib/PhpParser/Builder/Trait_.php | 21 +- .../php-parser/lib/PhpParser/Builder/Use_.php | 11 +- .../lib/PhpParser/BuilderFactory.php | 55 +- .../lib/PhpParser/BuilderHelpers.php | 14 +- .../php-parser/lib/PhpParser/Comment.php | 81 +- .../ConstExprEvaluationException.php | 1 + .../lib/PhpParser/ConstExprEvaluator.php | 12 +- .../nikic/php-parser/lib/PhpParser/Error.php | 38 +- .../php-parser/lib/PhpParser/ErrorHandler.php | 2 +- .../lib/PhpParser/ErrorHandler/Collecting.php | 8 +- .../lib/PhpParser/ErrorHandler/Throwing.php | 2 +- .../lib/PhpParser/Internal/DiffElem.php | 15 +- .../lib/PhpParser/Internal/Differ.php | 47 +- .../Internal/PrintableNewAnonClassNode.php | 24 +- .../lib/PhpParser/Internal/TokenPolyfill.php | 208 ++ .../lib/PhpParser/Internal/TokenStream.php | 125 +- .../php-parser/lib/PhpParser/JsonDecoder.php | 12 +- .../nikic/php-parser/lib/PhpParser/Lexer.php | 480 +-- .../lib/PhpParser/Lexer/Emulative.php | 152 +- .../AsymmetricVisibilityTokenEmulator.php | 66 + .../Lexer/TokenEmulator/AttributeEmulator.php | 16 +- .../CoaleseEqualTokenEmulator.php | 41 - .../Lexer/TokenEmulator/EnumTokenEmulator.php | 8 +- .../TokenEmulator/ExplicitOctalEmulator.php | 14 +- .../FlexibleDocStringEmulator.php | 66 - .../Lexer/TokenEmulator/FnTokenEmulator.php | 21 - .../Lexer/TokenEmulator/KeywordEmulator.php | 32 +- .../TokenEmulator/MatchTokenEmulator.php | 6 +- .../TokenEmulator/NullsafeTokenEmulator.php | 25 +- .../NumericLiteralSeparatorEmulator.php | 88 - .../TokenEmulator/PropertyTokenEmulator.php | 21 + .../ReadonlyFunctionTokenEmulator.php | 6 +- .../TokenEmulator/ReadonlyTokenEmulator.php | 8 +- .../Lexer/TokenEmulator/ReverseEmulator.php | 5 +- .../Lexer/TokenEmulator/TokenEmulator.php | 11 +- .../php-parser/lib/PhpParser/Modifiers.php | 66 + .../php-parser/lib/PhpParser/NameContext.php | 38 +- .../nikic/php-parser/lib/PhpParser/Node.php | 30 +- .../php-parser/lib/PhpParser/Node/Arg.php | 17 +- .../lib/PhpParser/Node/ArrayItem.php | 43 + .../lib/PhpParser/Node/Attribute.php | 12 +- .../lib/PhpParser/Node/AttributeGroup.php | 5 +- .../lib/PhpParser/Node/ClosureUse.php | 36 + .../php-parser/lib/PhpParser/Node/Const_.php | 12 +- .../lib/PhpParser/Node/DeclareItem.php | 37 + .../lib/PhpParser/Node/Expr/ArrayDimFetch.php | 10 +- .../lib/PhpParser/Node/Expr/ArrayItem.php | 39 +- .../lib/PhpParser/Node/Expr/Array_.php | 13 +- .../lib/PhpParser/Node/Expr/ArrowFunction.php | 46 +- .../lib/PhpParser/Node/Expr/Assign.php | 10 +- .../lib/PhpParser/Node/Expr/AssignOp.php | 10 +- .../lib/PhpParser/Node/Expr/AssignRef.php | 10 +- .../lib/PhpParser/Node/Expr/BinaryOp.php | 12 +- .../lib/PhpParser/Node/Expr/BitwiseNot.php | 6 +- .../lib/PhpParser/Node/Expr/BooleanNot.php | 6 +- .../lib/PhpParser/Node/Expr/CallLike.php | 8 +- .../lib/PhpParser/Node/Expr/Cast.php | 6 +- .../lib/PhpParser/Node/Expr/Cast/Double.php | 6 +- .../PhpParser/Node/Expr/ClassConstFetch.php | 13 +- .../lib/PhpParser/Node/Expr/Clone_.php | 6 +- .../lib/PhpParser/Node/Expr/Closure.php | 44 +- .../lib/PhpParser/Node/Expr/ClosureUse.php | 32 +- .../lib/PhpParser/Node/Expr/ConstFetch.php | 6 +- .../lib/PhpParser/Node/Expr/Empty_.php | 6 +- .../lib/PhpParser/Node/Expr/Error.php | 2 +- .../lib/PhpParser/Node/Expr/ErrorSuppress.php | 6 +- .../lib/PhpParser/Node/Expr/Eval_.php | 6 +- .../lib/PhpParser/Node/Expr/Exit_.php | 10 +- .../lib/PhpParser/Node/Expr/FuncCall.php | 12 +- .../lib/PhpParser/Node/Expr/Include_.php | 18 +- .../lib/PhpParser/Node/Expr/Instanceof_.php | 13 +- .../lib/PhpParser/Node/Expr/Isset_.php | 6 +- .../lib/PhpParser/Node/Expr/List_.php | 12 +- .../lib/PhpParser/Node/Expr/Match_.php | 8 +- .../lib/PhpParser/Node/Expr/MethodCall.php | 15 +- .../lib/PhpParser/Node/Expr/New_.php | 12 +- .../Node/Expr/NullsafeMethodCall.php | 15 +- .../Node/Expr/NullsafePropertyFetch.php | 11 +- .../lib/PhpParser/Node/Expr/PostDec.php | 6 +- .../lib/PhpParser/Node/Expr/PostInc.php | 6 +- .../lib/PhpParser/Node/Expr/PreDec.php | 6 +- .../lib/PhpParser/Node/Expr/PreInc.php | 6 +- .../lib/PhpParser/Node/Expr/Print_.php | 6 +- .../lib/PhpParser/Node/Expr/PropertyFetch.php | 11 +- .../lib/PhpParser/Node/Expr/ShellExec.php | 9 +- .../lib/PhpParser/Node/Expr/StaticCall.php | 16 +- .../Node/Expr/StaticPropertyFetch.php | 13 +- .../lib/PhpParser/Node/Expr/Ternary.php | 16 +- .../lib/PhpParser/Node/Expr/Throw_.php | 6 +- .../lib/PhpParser/Node/Expr/UnaryMinus.php | 6 +- .../lib/PhpParser/Node/Expr/UnaryPlus.php | 6 +- .../lib/PhpParser/Node/Expr/Variable.php | 4 +- .../lib/PhpParser/Node/Expr/YieldFrom.php | 6 +- .../lib/PhpParser/Node/Expr/Yield_.php | 10 +- .../lib/PhpParser/Node/FunctionLike.php | 4 +- .../lib/PhpParser/Node/Identifier.php | 20 +- .../PhpParser/Node/InterpolatedStringPart.php | 32 + .../lib/PhpParser/Node/IntersectionType.php | 7 +- .../lib/PhpParser/Node/MatchArm.php | 10 +- .../php-parser/lib/PhpParser/Node/Name.php | 99 +- .../lib/PhpParser/Node/NullableType.php | 11 +- .../php-parser/lib/PhpParser/Node/Param.php | 88 +- .../lib/PhpParser/Node/PropertyHook.php | 79 + .../lib/PhpParser/Node/PropertyItem.php | 37 + .../lib/PhpParser/Node/Scalar/DNumber.php | 69 +- .../lib/PhpParser/Node/Scalar/Encapsed.php | 29 +- .../Node/Scalar/EncapsedStringPart.php | 28 +- .../lib/PhpParser/Node/Scalar/Float_.php | 73 + .../lib/PhpParser/Node/Scalar/Int_.php | 74 + .../Node/Scalar/InterpolatedString.php | 34 + .../lib/PhpParser/Node/Scalar/LNumber.php | 70 +- .../lib/PhpParser/Node/Scalar/MagicConst.php | 2 +- .../Node/Scalar/MagicConst/Property.php | 17 + .../lib/PhpParser/Node/Scalar/String_.php | 32 +- .../lib/PhpParser/Node/StaticVar.php | 37 + .../lib/PhpParser/Node/Stmt/Block.php | 30 + .../lib/PhpParser/Node/Stmt/Break_.php | 6 +- .../lib/PhpParser/Node/Stmt/Case_.php | 15 +- .../lib/PhpParser/Node/Stmt/Catch_.php | 14 +- .../lib/PhpParser/Node/Stmt/ClassConst.php | 39 +- .../lib/PhpParser/Node/Stmt/ClassLike.php | 15 +- .../lib/PhpParser/Node/Stmt/ClassMethod.php | 72 +- .../lib/PhpParser/Node/Stmt/Class_.php | 108 +- .../lib/PhpParser/Node/Stmt/Const_.php | 6 +- .../lib/PhpParser/Node/Stmt/Continue_.php | 6 +- .../PhpParser/Node/Stmt/DeclareDeclare.php | 32 +- .../lib/PhpParser/Node/Stmt/Declare_.php | 13 +- .../lib/PhpParser/Node/Stmt/Do_.php | 13 +- .../lib/PhpParser/Node/Stmt/Echo_.php | 6 +- .../lib/PhpParser/Node/Stmt/ElseIf_.php | 13 +- .../lib/PhpParser/Node/Stmt/Else_.php | 9 +- .../lib/PhpParser/Node/Stmt/EnumCase.php | 14 +- .../lib/PhpParser/Node/Stmt/Enum_.php | 23 +- .../lib/PhpParser/Node/Stmt/Expression.php | 6 +- .../lib/PhpParser/Node/Stmt/Finally_.php | 9 +- .../lib/PhpParser/Node/Stmt/For_.php | 28 +- .../lib/PhpParser/Node/Stmt/Foreach_.php | 31 +- .../lib/PhpParser/Node/Stmt/Function_.php | 37 +- .../lib/PhpParser/Node/Stmt/Global_.php | 6 +- .../lib/PhpParser/Node/Stmt/Goto_.php | 6 +- .../lib/PhpParser/Node/Stmt/GroupUse.php | 21 +- .../lib/PhpParser/Node/Stmt/HaltCompiler.php | 6 +- .../lib/PhpParser/Node/Stmt/If_.php | 27 +- .../lib/PhpParser/Node/Stmt/InlineHTML.php | 6 +- .../lib/PhpParser/Node/Stmt/Interface_.php | 16 +- .../lib/PhpParser/Node/Stmt/Label.php | 6 +- .../lib/PhpParser/Node/Stmt/Namespace_.php | 14 +- .../lib/PhpParser/Node/Stmt/Property.php | 73 +- .../PhpParser/Node/Stmt/PropertyProperty.php | 32 +- .../lib/PhpParser/Node/Stmt/Return_.php | 6 +- .../lib/PhpParser/Node/Stmt/StaticVar.php | 33 +- .../lib/PhpParser/Node/Stmt/Static_.php | 7 +- .../lib/PhpParser/Node/Stmt/Switch_.php | 10 +- .../lib/PhpParser/Node/Stmt/Throw_.php | 30 - .../lib/PhpParser/Node/Stmt/TraitUse.php | 8 +- .../Node/Stmt/TraitUseAdaptation.php | 4 +- .../Node/Stmt/TraitUseAdaptation/Alias.php | 16 +- .../Stmt/TraitUseAdaptation/Precedence.php | 10 +- .../lib/PhpParser/Node/Stmt/Trait_.php | 11 +- .../lib/PhpParser/Node/Stmt/TryCatch.php | 14 +- .../lib/PhpParser/Node/Stmt/Unset_.php | 6 +- .../lib/PhpParser/Node/Stmt/UseUse.php | 49 +- .../lib/PhpParser/Node/Stmt/Use_.php | 23 +- .../lib/PhpParser/Node/Stmt/While_.php | 13 +- .../lib/PhpParser/Node/UnionType.php | 6 +- .../php-parser/lib/PhpParser/Node/UseItem.php | 54 + .../PhpParser/Node/VariadicPlaceholder.php | 2 +- .../php-parser/lib/PhpParser/NodeAbstract.php | 18 +- .../php-parser/lib/PhpParser/NodeDumper.php | 220 +- .../php-parser/lib/PhpParser/NodeFinder.php | 37 +- .../lib/PhpParser/NodeTraverser.php | 142 +- .../lib/PhpParser/NodeTraverserInterface.php | 6 +- .../php-parser/lib/PhpParser/NodeVisitor.php | 58 +- .../NodeVisitor/CommentAnnotatingVisitor.php | 74 + .../PhpParser/NodeVisitor/FindingVisitor.php | 4 +- .../NodeVisitor/FirstFindingVisitor.php | 10 +- .../PhpParser/NodeVisitor/NameResolver.php | 112 +- .../NodeVisitor/NodeConnectingVisitor.php | 2 +- .../NodeVisitor/ParentConnectingVisitor.php | 6 +- .../lib/PhpParser/NodeVisitorAbstract.php | 2 +- .../nikic/php-parser/lib/PhpParser/Parser.php | 8 +- .../lib/PhpParser/Parser/Multiple.php | 53 - .../php-parser/lib/PhpParser/Parser/Php5.php | 1320 --------- .../php-parser/lib/PhpParser/Parser/Php7.php | 2628 ++++++++--------- .../php-parser/lib/PhpParser/Parser/Php8.php | 1281 ++++++++ .../lib/PhpParser/Parser/Tokens.php | 148 - .../lib/PhpParser/ParserAbstract.php | 640 ++-- .../lib/PhpParser/ParserFactory.php | 52 +- .../php-parser/lib/PhpParser/PhpVersion.php | 150 + .../lib/PhpParser/PrettyPrinter.php | 49 + .../lib/PhpParser/PrettyPrinter/Standard.php | 678 +++-- .../lib/PhpParser/PrettyPrinterAbstract.php | 824 +++--- .../nikic/php-parser/lib/PhpParser/Token.php | 21 + .../lib/PhpParser/compatibility_tokens.php | 59 + .../ondram/ci-detector/src/Ci/AbstractCi.php | 5 +- vendor/ondram/ci-detector/src/CiDetector.php | 5 +- .../ondram/ci-detector/src/TrinaryLogic.php | 9 +- vendor/phpstan/phpdoc-parser/README.md | 26 +- vendor/phpstan/phpdoc-parser/UPGRADING.md | 129 + vendor/phpstan/phpdoc-parser/composer.json | 12 +- .../Ast/ConstExpr/ConstExprArrayItemNode.php | 6 +- .../src/Ast/ConstExpr/ConstExprArrayNode.php | 2 +- .../src/Ast/ConstExpr/ConstExprFloatNode.php | 3 +- .../Ast/ConstExpr/ConstExprIntegerNode.php | 3 +- .../src/Ast/ConstExpr/ConstExprStringNode.php | 56 +- .../src/Ast/ConstExpr/ConstFetchNode.php | 5 +- .../ConstExpr/DoctrineConstExprStringNode.php | 5 +- .../QuoteAwareConstExprStringNode.php | 67 - .../phpdoc-parser/src/Ast/NodeAttributes.php | 2 +- .../phpdoc-parser/src/Ast/NodeTraverser.php | 4 +- .../src/Ast/NodeVisitor/CloningVisitor.php | 2 +- .../Ast/PhpDoc/AssertTagMethodValueNode.php | 19 +- .../Ast/PhpDoc/AssertTagPropertyValueNode.php | 19 +- .../src/Ast/PhpDoc/AssertTagValueNode.php | 16 +- .../src/Ast/PhpDoc/DeprecatedTagValueNode.php | 2 +- .../PhpDoc/Doctrine/DoctrineAnnotation.php | 5 +- .../Ast/PhpDoc/Doctrine/DoctrineArgument.php | 3 +- .../src/Ast/PhpDoc/Doctrine/DoctrineArray.php | 2 +- .../PhpDoc/Doctrine/DoctrineTagValueNode.php | 5 +- .../src/Ast/PhpDoc/ExtendsTagValueNode.php | 5 +- .../src/Ast/PhpDoc/GenericTagValueNode.php | 2 +- .../src/Ast/PhpDoc/ImplementsTagValueNode.php | 5 +- .../src/Ast/PhpDoc/InvalidTagValueNode.php | 4 +- .../src/Ast/PhpDoc/MethodTagValueNode.php | 17 +- .../PhpDoc/MethodTagValueParameterNode.php | 15 +- .../src/Ast/PhpDoc/MixinTagValueNode.php | 5 +- .../PhpDoc/ParamClosureThisTagValueNode.php | 8 +- ...ImmediatelyInvokedCallableTagValueNode.php | 5 +- .../ParamLaterInvokedCallableTagValueNode.php | 5 +- .../src/Ast/PhpDoc/ParamOutTagValueNode.php | 8 +- .../src/Ast/PhpDoc/ParamTagValueNode.php | 16 +- .../src/Ast/PhpDoc/PhpDocNode.php | 122 +- .../src/Ast/PhpDoc/PhpDocTagNode.php | 6 +- .../src/Ast/PhpDoc/PhpDocTextNode.php | 3 +- .../src/Ast/PhpDoc/PropertyTagValueNode.php | 8 +- ...PureUnlessCallableIsImpureTagValueNode.php | 5 +- .../Ast/PhpDoc/RequireExtendsTagValueNode.php | 5 +- .../PhpDoc/RequireImplementsTagValueNode.php | 5 +- .../src/Ast/PhpDoc/ReturnTagValueNode.php | 5 +- .../src/Ast/PhpDoc/SelfOutTagValueNode.php | 5 +- .../src/Ast/PhpDoc/TemplateTagValueNode.php | 13 +- .../src/Ast/PhpDoc/ThrowsTagValueNode.php | 5 +- .../PhpDoc/TypeAliasImportTagValueNode.php | 9 +- .../src/Ast/PhpDoc/TypeAliasTagValueNode.php | 6 +- .../Ast/PhpDoc/TypelessParamTagValueNode.php | 13 +- .../src/Ast/PhpDoc/UsesTagValueNode.php | 5 +- .../src/Ast/PhpDoc/VarTagValueNode.php | 7 +- .../src/Ast/Type/ArrayShapeItemNode.php | 9 +- .../src/Ast/Type/ArrayShapeNode.php | 28 +- .../Ast/Type/ArrayShapeUnsealedTypeNode.php | 6 +- .../src/Ast/Type/ArrayTypeNode.php | 3 +- .../src/Ast/Type/CallableTypeNode.php | 12 +- .../Ast/Type/CallableTypeParameterNode.php | 14 +- .../Type/ConditionalTypeForParameterNode.php | 15 +- .../src/Ast/Type/ConditionalTypeNode.php | 15 +- .../src/Ast/Type/ConstTypeNode.php | 3 +- .../src/Ast/Type/GenericTypeNode.php | 7 +- .../src/Ast/Type/IdentifierTypeNode.php | 3 +- .../src/Ast/Type/IntersectionTypeNode.php | 2 +- .../src/Ast/Type/InvalidTypeNode.php | 2 +- .../src/Ast/Type/NullableTypeNode.php | 3 +- .../src/Ast/Type/ObjectShapeItemNode.php | 9 +- .../src/Ast/Type/ObjectShapeNode.php | 2 +- .../src/Ast/Type/OffsetAccessTypeNode.php | 6 +- .../src/Ast/Type/UnionTypeNode.php | 2 +- .../phpstan/phpdoc-parser/src/Lexer/Lexer.php | 22 +- .../src/Parser/ConstExprParser.php | 46 +- .../src/Parser/ParserException.php | 20 +- .../phpdoc-parser/src/Parser/PhpDocParser.php | 205 +- .../src/Parser/TokenIterator.php | 12 +- .../phpdoc-parser/src/Parser/TypeParser.php | 66 +- .../phpdoc-parser/src/ParserConfig.php | 18 + .../phpdoc-parser/src/Printer/Printer.php | 65 +- vendor/psr/log/src/LoggerAwareTrait.php | 3 +- .../src/GeneratedConfig.php | 2 +- .../src/PluginInstaller.php | 35 +- vendor/rector/rector-doctrine/composer.json | 12 +- ...ntSubscriberInterfaceToAttributeRector.php | 7 +- .../InheritanceClassAttributeTransformer.php | 5 +- ...SoftDeletableClassAttributeTransformer.php | 3 +- .../TableClassAttributeTransformer.php | 3 +- .../ColumnAttributeTransformer.php | 3 +- .../EmbeddedPropertyAttributeTransformer.php | 3 +- ...GedmoTimestampableAttributeTransformer.php | 3 +- .../IdGeneratorAttributeTransformer.php | 3 +- .../InverseJoinColumnAttributeTransformer.php | 3 +- .../JoinColumnAttributeTransformer.php | 3 +- .../JoinTableAttributeTransformer.php | 3 +- .../ManyToManyAttributeTransformer.php | 3 +- .../ManyToOneAttributeTransformer.php | 3 +- .../OneToManyAttributeTransformer.php | 3 +- .../OrderByAttributeTransformer.php | 3 +- .../YamlToAttributeTransformer.php | 4 +- .../CodeQuality/EntityMappingResolver.php | 5 +- ...PropertyGetterByToManyAnnotationRector.php | 21 +- .../ExplicitRelationCollectionRector.php | 12 +- ...TimeDefaultInEntityToConstructorRector.php | 23 +- .../YamlToAttributeDoctrineMappingRector.php | 8 +- ...rectDefaultTypesOnEntityPropertyRector.php | 28 +- ...octrineCollectionDocTypeInEntityRector.php | 27 +- ...ateTimePropertyDateTimeInterfaceRector.php | 12 +- .../TypedPropertyFromColumnTypeRector.php | 15 +- ...edPropertyFromToManyRelationTypeRector.php | 18 +- ...pedPropertyFromToOneRelationTypeRector.php | 23 +- .../CodeQuality/SetterCollectionResolver.php | 18 +- .../CodeQuality/ValueObject/EntityMapping.php | 5 +- ...eriaOrderingConstantsDeprecationRector.php | 5 +- ...ractArrayArgOnQueryBuilderSelectRector.php | 4 +- ...iteExpressionAddMultipleWithWithRector.php | 3 +- .../MethodCall/IterateToToIterableRector.php | 3 - .../src/NodeAnalyzer/AttributeFinder.php | 3 +- .../src/NodeAnalyzer/AttrinationFinder.php | 6 +- .../ConstructorAssignPropertyAnalyzer.php | 9 +- .../NodeAnalyzer/DoctrineEntityDetector.php | 6 +- .../MethodUniqueReturnedPropertyResolver.php | 6 +- .../src/NodeAnalyzer/TargetEntityResolver.php | 6 +- .../ArrayCollectionAssignFactory.php | 3 +- .../ColumnPropertyTypeResolver.php | 13 +- .../ConstructorManipulator.php | 6 +- .../NullabilityColumnPropertyTypeResolver.php | 9 +- .../ToManyRelationPropertyTypeResolver.php | 15 +- .../ToOneRelationPropertyTypeResolver.php | 15 +- .../src/PhpDoc/ShortClassExpander.php | 6 +- .../PhpDocParser/DoctrineDocBlockResolver.php | 3 +- .../Set/SetProvider/DoctrineSetProvider.php | 18 +- .../TypeAnalyzer/CollectionTypeResolver.php | 12 +- .../CollectionVarTagValueNodeResolver.php | 6 +- .../rector/rector-downgrade-php/composer.json | 9 +- .../NodeAnalyzer/BuiltInMethodAnalyzer.php | 3 +- ...errideFromAnonymousClassMethodAnalyzer.php | 9 +- .../NodeAnalyzer/RegexFuncAnalyzer.php | 3 +- .../NodeManipulator/BitwiseFlagCleaner.php | 3 +- .../NodeManipulator/JsonConstCleaner.php | 13 +- .../PhpDoc/NativeParamToPhpDocDecorator.php | 18 +- .../DowngradeParameterTypeWideningRector.php | 20 +- .../DowngradePhp72JsonConstRector.php | 8 +- ...radeJsonDecodeNullAssociativeArgRector.php | 6 +- ...gradePregUnmatchedAsNullConstantRector.php | 13 +- .../FuncCall/DowngradeStreamIsattyRector.php | 14 +- .../DowngradeObjectTypeDeclarationRector.php | 3 +- .../DowngradePhp73JsonConstRector.php | 20 +- .../DowngradeArrayKeyFirstLastRector.php | 6 +- ...adeTrailingCommasInFunctionCallsRector.php | 3 +- ...SetCookieOptionsArrayToArgumentsRector.php | 7 +- ...DowngradeListReferenceAssignmentRector.php | 16 +- .../DowngradeFlexibleHeredocSyntaxRector.php | 11 +- .../DowngradeTrailingCommasInUnsetRector.php | 7 +- .../Tokenizer/FollowedByCommaAnalyzer.php | 4 +- ...yNewlineOnlyMaybeWithSemicolonAnalyzer.php | 4 +- .../Array_/DowngradeArraySpreadRector.php | 14 +- ...ArrowFunctionToAnonymousFunctionRector.php | 22 +- ...wngradeContravariantArgumentTypeRector.php | 24 +- .../DowngradeCovariantReturnTypeRector.php | 24 +- .../DowngradeStripTagsCallWithArrayRector.php | 3 +- ...ngradeFreadFwriteFalsyToNegationRector.php | 3 +- ...dePreviouslyImplementedInterfaceRector.php | 3 +- ...DowngradeNumericLiteralSeparatorRector.php | 14 +- .../DowngradeReflectionGetTypeRector.php | 3 +- .../Property/DowngradeTypedPropertyRector.php | 6 +- .../NodeAnalyzer/EnumAnalyzer.php | 6 +- .../NodeAnalyzer/NamedToUnnamedArgs.php | 6 +- .../NodeAnalyzer/UnnamedArgumentResolver.php | 10 +- ...owngradeDereferenceableOperationRector.php | 6 +- .../DowngradeNonCapturingCatchesRector.php | 3 +- ...radeAbstractPrivateMethodInTraitRector.php | 7 +- ...siveDirectoryIteratorHasChildrenRector.php | 3 +- .../DowngradeStaticTypeDeclarationRector.php | 6 +- ...ngradeStringReturnTypeOnToStringRector.php | 6 +- ...owngradeTrailingCommasInParamUseRector.php | 9 +- .../DowngradeAttributeToAnnotationRector.php | 18 +- .../DowngradePropertyPromotionRector.php | 16 +- ...DowngradeEnumToConstantListClassRector.php | 17 +- .../DowngradeMatchToSwitchRector.php | 21 +- .../Expression/DowngradeThrowExprRector.php | 41 +- ...gradeArrayFilterNullableCallbackRector.php | 13 +- ...DowngradeNumberFormatNoFourthArgRector.php | 3 +- .../FuncCall/DowngradeStrEndsWithRector.php | 6 +- .../FuncCall/DowngradeStrStartsWithRector.php | 6 +- .../DowngradeMixedTypeDeclarationRector.php | 3 +- .../DowngradeUnionTypeDeclarationRector.php | 3 +- ...gradePhp80ResourceReturnToObjectRector.php | 3 +- .../DowngradeNamedArgumentRector.php | 9 +- ...eflectionClassGetConstantsFilterRector.php | 8 +- ...DowngradeReflectionGetAttributesRector.php | 3 +- ...gradeArbitraryExpressionsSupportRector.php | 22 +- ...wngradeNullsafeToTernaryOperatorRector.php | 7 +- .../DowngradeMixedTypeTypedPropertyRector.php | 3 +- .../DowngradeUnionTypeTypedPropertyRector.php | 5 +- .../StaticCall/DowngradePhpTokenRector.php | 6 +- .../DefaultParameterValueResolver.php | 11 +- .../SimplePhpParameterReflection.php | 3 +- .../DowngradeAttributeToAnnotation.php | 4 +- .../NodeAnalyzer/ArraySpreadAnalyzer.php | 2 +- .../ArrayMergeFromArraySpreadFactory.php | 23 +- .../ObjectToResourceReturn.php | 15 +- .../DowngradeArraySpreadStringKeyRector.php | 20 +- ...gradeFinalizePublicClassConstantRector.php | 3 +- .../FuncCall/DowngradeArrayIsListRector.php | 11 +- ...owngradeFirstClassCallableSyntaxRector.php | 2 +- .../DowngradeHashAlgorithmXxHashRector.php | 11 +- .../DowngradeNeverTypeDeclarationRector.php | 3 +- .../DowngradeNewInInitializerRector.php | 8 +- .../DowngradePureIntersectionTypeRector.php | 3 +- ...gradePhp81ResourceReturnToObjectRector.php | 3 +- .../LNumber/DowngradeOctalNumberRector.php | 8 +- .../DowngradeReadonlyPropertyRector.php | 9 +- .../Class_/DowngradeReadonlyClassRector.php | 3 +- ...tandaloneNullTrueFalseReturnTypeRector.php | 9 +- .../DowngradeTypedClassConstRector.php | 3 +- .../NodeAnalyzer/DefineFuncCallAnalyzer.php | 3 +- .../src/NodeAnalyzer/ExprInTopStmtMatcher.php | 3 +- .../src/NodeFactory/ClassFromEnumFactory.php | 3 +- .../NodeFactory/DoctrineAnnotationFactory.php | 3 +- .../src/NodeFactory/NamedVariableFactory.php | 3 +- .../src/NodeManipulator/PropertyDecorator.php | 9 +- .../PhpDocFromTypeDeclarationDecorator.php | 31 +- .../ClassMethodWillChangeReturnType.php | 6 +- vendor/rector/rector-phpunit/composer.json | 11 +- ...ataProviderAnnotationToAttributeRector.php | 35 +- ...dsAnnotationWithValueToAttributeRector.php | 32 +- .../TestWithAnnotationToAttributeRector.php | 33 +- .../AnnotationWithValueToAttributeRector.php | 17 +- ...rsAnnotationWithValueToAttributeRector.php | 38 +- .../TicketAnnotationToAttributeRector.php | 30 +- .../NestedClosureAssertFactory.php | 8 +- .../CreateMockToAnonymousClassRector.php | 6 +- .../DataProviderArrayItemsNewLinedRector.php | 8 +- ...ityDocumentCreateMockToDirectNewRector.php | 9 +- .../RemoveEmptyTestMethodRector.php | 3 +- ...stAnnotationWithPrefixedFunctionRector.php | 12 +- ...eTestFunctionPrefixWithAttributeRector.php | 9 +- .../Class_/AddCoversClassAttributeRector.php | 16 +- .../AddParentSetupCallOnSetupRector.php | 6 +- .../Class_/AddSeeTestAnnotationRector.php | 12 +- ...structClassMethodToSetUpTestCaseRector.php | 15 +- ...NarrowUnusedSetUpDefinedPropertyRector.php | 12 +- .../Class_/PreferPHPUnitSelfCallRector.php | 6 +- .../Class_/PreferPHPUnitThisCallRector.php | 3 +- .../Class_/SetUpBeforeClassToSetUpRector.php | 12 +- .../Class_/SingleMockPropertyTypeRector.php | 3 +- .../Class_/TestWithToDataProviderRector.php | 25 +- .../Rector/Class_/YieldDataProviderRector.php | 15 +- ...CountableWithMethodToAssertCountRector.php | 3 +- .../AssertCompareToSpecificMethodRector.php | 5 +- ...AssertComparisonToSpecificMethodRector.php | 8 +- ...NullableObjectToAssertInstanceofRector.php | 3 +- ...atParameterToSpecificMethodsTypeRector.php | 10 +- .../MethodCall/AssertEqualsToSameRector.php | 10 +- .../AssertFalseStrposToContainsRector.php | 6 +- .../AssertInstanceOfComparisonRector.php | 6 +- .../AssertIssetToSpecificMethodRector.php | 6 +- .../MethodCall/AssertNotOperatorRector.php | 6 +- .../MethodCall/AssertPropertyExistsRector.php | 6 +- .../Rector/MethodCall/AssertRegExpRector.php | 13 +- ...sertSameBoolNullToSpecificMethodRector.php | 11 +- ...rtSameTrueFalseToAssertTrueFalseRector.php | 9 +- .../AssertTrueFalseToSpecificMethodRector.php | 3 +- .../Rector/MethodCall/FlipAssertRector.php | 3 +- .../NarrowIdenticalWithConsecutiveRector.php | 3 +- .../NarrowSingleWillReturnCallbackRector.php | 7 +- .../RemoveExpectAnyFromMockRector.php | 3 +- .../SingleWithConsecutiveToWithRector.php | 6 +- .../UseSpecificWillMethodRector.php | 3 +- .../UseSpecificWithMethodRector.php | 3 +- .../ValueObject/MatchAndReturnMatch.php | 6 +- .../NodeFactory/WillReturnCallbackFactory.php | 18 +- .../Rector/Class_/AddProphecyTraitRector.php | 13 +- .../PublicDataProviderClassMethodRector.php | 9 +- .../StaticDataProviderClassMethodRector.php | 16 +- .../RemoveSetMethodsMethodCallRector.php | 9 +- .../ExpectsMethodCallDecorator.php | 6 +- .../WithConsecutiveRector.php | 32 +- .../NamedArgumentForDataProviderRector.php | 14 +- .../Rector/StaticCall/GetMockRector.php | 6 +- ...rformAssertionToNonAssertingTestRector.php | 18 +- .../ClassMethod/ExceptionAnnotationRector.php | 15 +- .../DelegateExceptionArgumentsRector.php | 6 +- .../RemoveDataProviderTestPrefixRector.php | 9 +- ...lsParameterToSpecificMethodsTypeRector.php | 9 +- .../SpecificAssertContainsRector.php | 3 +- .../SpecificAssertInternalTypeRector.php | 3 +- .../MethodCall/ExplicitPhpErrorApiRector.php | 6 +- ...ficAssertContainsWithoutIdentityRector.php | 6 +- .../ProjectPackageVersionResolver.php | 3 +- .../rector-phpunit/src/MethodCallRemover.php | 6 +- .../src/NodeAnalyzer/AssertCallAnalyzer.php | 20 +- .../NodeAnalyzer/IdentifierManipulator.php | 3 +- .../NodeAnalyzer/MockedVariableAnalyzer.php | 9 +- .../src/NodeAnalyzer/SetUpMethodDecorator.php | 3 +- .../src/NodeAnalyzer/TestsNodeAnalyzer.php | 12 +- .../src/NodeFactory/ConsecutiveIfsFactory.php | 22 +- .../ExpectExceptionMethodCallFactory.php | 6 +- ...erInvocationCountMethodCallNodeFactory.php | 3 +- .../src/NodeFactory/UsedVariablesResolver.php | 6 +- .../DataProviderClassMethodFinder.php | 12 +- .../src/NodeFinder/MethodCallNodeFinder.php | 6 +- .../src/PhpDoc/DataProviderMethodRenamer.php | 6 +- .../src/PhpDoc/PhpDocValueToNodeMapper.php | 6 +- .../AnnotationWithValueToAttribute.php | 8 +- .../ValueObject/BinaryOpWithAssertMethod.php | 9 +- .../ValueObject/ConstantWithAssertMethods.php | 9 +- .../FunctionNameWithAssertMethods.php | 9 +- vendor/rector/rector-symfony/composer.json | 10 +- .../NodeFactory/SymfonyClosureFactory.php | 3 +- .../BinaryOp/ResponseStatusCodeRector.php | 25 +- .../ClassMethod/ActionSuffixRemoverRector.php | 3 +- .../ParamTypeFromRouteRequiredRegexRector.php | 11 +- .../RemoveUnusedRequestParamRector.php | 15 +- ...sponseReturnTypeControllerActionRector.php | 18 +- .../TemplateAnnotationToThisRenderRector.php | 31 +- .../EventListenerToEventSubscriberRector.php | 14 +- ...oadValidatorMetadataToAnnotationRector.php | 15 +- .../StringExtensionToConfigBuilderRector.php | 21 +- ...ameResponseCodeWithDebugContentsRector.php | 3 +- ...LiteralGetToRequestClassConstantRector.php | 6 +- ...rReturnTypeBasedOnSetterRequiredRector.php | 6 +- .../NestedConfigCallsFactory.php | 3 +- ...ccessDecisionManagerConfigArrayHandler.php | 2 +- .../ConfigServiceArgumentsResolver.php | 9 +- .../CollectServiceArgumentsNodeVisitor.php | 11 +- .../ClassMethod/AddRouteAnnotationRector.php | 15 +- .../Rector/Class_/AutowireAttributeRector.php | 8 +- .../ParameterBagToAutowireAttributeRector.php | 3 +- .../Closure/MergeServiceNameTypeRector.php | 11 +- .../ServiceArgsToServiceNamedArgRector.php | 15 +- .../ServiceSetStringNameToClassNameRector.php | 6 +- ...iceSettersToSettersAutodiscoveryRector.php | 19 +- ...rviceTagsToDefaultsAutoconfigureRector.php | 6 +- .../Configs/ValueObject/ServiceArguments.php | 7 +- ...DowngradeSymfonyCommandAttributeRector.php | 3 +- .../ClassMethod/SwiftMessageToEmailRector.php | 19 +- ...wiftSetBodyToHtmlPlainMethodCallRector.php | 3 +- .../AddViolationToBuildViolationRector.php | 2 +- ...MaxLengthSymfonyFormOptionToAttrRector.php | 5 +- .../MethodCall/RedirectToRouteRector.php | 6 +- ...ypeOptionNameFromTypeToEntryTypeRector.php | 14 +- .../GetToConstructorInjectionRector.php | 9 +- .../Rector/StaticCall/ParseFileRector.php | 3 +- .../ClassMethod/FormTypeGetParentRector.php | 3 +- .../Rector/ClassMethod/GetRequestRector.php | 14 +- .../RemoveDefaultGetBlockPrefixRector.php | 5 +- ...StringCollectionOptionToConstantRector.php | 17 +- .../FormTypeInstanceToClassConstRector.php | 20 +- .../Rector/MethodCall/OptionNameRector.php | 8 +- .../ReadOnlyOptionToAttributeRector.php | 11 +- .../StringFormTypeToClassRector.php | 6 +- ...oleExceptionToErrorEventConstantRector.php | 3 +- ...ethodAnnotationToRouteAnnotationRector.php | 9 +- .../RemoveServiceFromSensioRouteRector.php | 6 +- ...SensioRouteAnnotationWithSymfonyRector.php | 15 +- .../ContainerGetNameToTypeInTestsRector.php | 6 +- .../ConstFetch/ConstraintUrlOptionRector.php | 5 +- ...ntainerGetToConstructorInjectionRector.php | 9 +- .../Rector/New_/RootNodeTreeBuilderRector.php | 3 +- .../StringToArrayArgumentProcessRector.php | 3 +- .../EventDispatcherParentConstructRector.php | 3 +- ...plateShortNotationToBundleSyntaxRector.php | 3 +- ...tCurrencyBundleMethodCallsToIntlRector.php | 2 +- .../MakeDispatchFirstArgumentEventRector.php | 6 +- .../WebTestCaseAssertIsSuccessfulRector.php | 12 +- .../WebTestCaseAssertResponseCodeRector.php | 12 +- .../ConsoleExecuteReturnIntRector.php | 35 +- ...izationCheckerIsGrantedExtractorRector.php | 8 +- .../CommandConstantReturnCodeRector.php | 16 +- ...utHandlerToLogoutEventSubscriberRector.php | 12 +- ...ssHandlerToLogoutEventSubscriberRector.php | 12 +- ...nitionAliasSetPrivateToSetPublicRector.php | 5 +- .../FormBuilderSetDataMapperRector.php | 6 +- ...xtractorEnableMagicCallExtractorRector.php | 5 +- ...orBuilderEnableAnnotationMappingRector.php | 3 +- ...tyAccessorCreationBooleanToFlagsRector.php | 3 +- ...CaseContainerPropertyDeprecationRector.php | 3 +- .../FuncCall/ReplaceServiceArgumentRector.php | 5 +- .../GetHelperControllerToServiceRector.php | 9 +- .../CommandConfigureToAttributeRector.php | 8 +- .../CommandPropertyToAttributeRector.php | 9 +- ...sureTwigExtensionToNativeMethodsRector.php | 3 +- .../ErrorNamesPropertyToConstantRector.php | 3 +- ...terAttributeToMapEntityAttributeRector.php | 2 +- ...ssageHandlerInterfaceToAttributeRector.php | 12 +- ...geSubscriberInterfaceToAttributeRector.php | 25 +- .../SimplifyFormRenderingRector.php | 12 +- ...alableCommandInterfaceReturnTypeRector.php | 9 +- .../Return_/SimpleFunctionAndFilterRector.php | 10 +- .../src/Annotation/AnnotationAnalyzer.php | 3 +- .../ListenerServiceDefinitionProvider.php | 10 +- .../NodeAnalyzer/ControllerMethodAnalyzer.php | 3 +- .../Symfony/ContainerServiceProvider.php | 5 +- .../Symfony/Routing/SymfonyRoutesProvider.php | 5 +- .../src/BundleClassResolver.php | 12 +- .../src/DataProvider/ServiceMapProvider.php | 8 +- .../ServiceNameToTypeUniqueProvider.php | 3 +- .../FormTypeStringToTypeProvider.php | 5 +- .../src/Helper/MessengerHelper.php | 14 +- .../src/Helper/TemplateGuesser.php | 6 +- .../ClassAnnotationAssertResolver.php | 6 +- .../MethodCallAnnotationAssertResolver.php | 9 +- .../PropertyAnnotationAssertResolver.php | 9 +- .../Annotations/StmtMethodCallMatcher.php | 3 +- .../src/NodeAnalyzer/ClassAnalyzer.php | 3 +- .../DependencyInjectionMethodCallAnalyzer.php | 15 +- .../FormAddMethodCallAnalyzer.php | 8 +- .../NodeAnalyzer/FormCollectionAnalyzer.php | 6 +- ...InstanceToFormClassConstFetchConverter.php | 12 +- .../CreateFormTypeOptionsArgMover.php | 8 +- .../FormType/FormTypeClassResolver.php | 6 +- .../LiteralCallLikeConstFetchReplacer.php | 7 +- .../RouteRequiredParamNameToTypesResolver.php | 8 +- .../ServiceTypeMethodCallResolver.php | 6 +- .../SymfonyClosureExtensionMatcher.php | 6 +- .../SymfonyPhpClosureDetector.php | 13 +- .../NodeAnalyzer/SymfonyTestCaseAnalyzer.php | 3 +- .../DoctrineAnnotationFromNewFactory.php | 3 +- .../DoctrineAnnotationKeyToValuesResolver.php | 8 +- .../Annotations/StringValueQuoteWrapper.php | 3 +- .../NodeFactory/ArrayFromCompactFactory.php | 5 +- .../BareLogoutClassMethodFactory.php | 6 +- .../src/NodeFactory/EventReferenceFactory.php | 6 +- .../GetSubscribedEventsClassMethodFactory.php | 26 +- .../OnLogoutClassMethodFactory.php | 9 +- .../OnSuccessLogoutClassMethodFactory.php | 16 +- .../src/NodeFactory/ThisRenderFactory.php | 17 +- .../src/NodeFinder/EmptyReturnNodeFinder.php | 3 +- .../src/NodeManipulator/ArrayManipulator.php | 2 +- .../src/NodeManipulator/ClassManipulator.php | 3 +- .../src/PhpParser/NamedSimplePhpParser.php | 5 +- .../TypeAnalyzer/ContainerAwareAnalyzer.php | 5 +- .../src/TypeAnalyzer/ControllerAnalyzer.php | 3 +- .../ReturnTypeDeclarationUpdater.php | 15 +- .../src/ValueObject/ClassNameAndFilePath.php | 6 +- .../EventNameToClassAndConstant.php | 9 +- .../EventReferenceToMethodName.php | 6 +- ...EventReferenceToMethodNameWithPriority.php | 9 +- .../ExtensionKeyAndConfiguration.php | 6 +- .../ValueObject/IntlBundleClassToNewClass.php | 8 +- .../ValueObject/ReplaceServiceArgument.php | 3 +- .../src/ValueObject/ServiceDefinition.php | 17 +- .../src/ValueObject/ServiceMap/ServiceMap.php | 2 +- .../src/ValueObject/SymfonyRouteMetadata.php | 25 +- .../rector-symfony/src/ValueObject/Tag.php | 5 +- .../src/ValueObject/Tag/EventListenerTag.php | 9 +- .../ClassMethodAndAnnotation.php | 5 +- .../ValidatorAssert/PropertyAndAnnotation.php | 6 +- vendor/scoper-autoload.php | 2 +- vendor/sebastian/diff/src/Chunk.php | 25 +- vendor/sebastian/diff/src/Diff.php | 9 +- vendor/sebastian/diff/src/Differ.php | 5 +- vendor/sebastian/diff/src/Line.php | 10 +- .../diff/src/Output/DiffOnlyOutputBuilder.php | 5 +- .../Output/StrictUnifiedDiffOutputBuilder.php | 26 +- .../src/Output/UnifiedDiffOutputBuilder.php | 23 +- vendor/symfony/console/Application.php | 114 +- .../symfony/console/Attribute/AsCommand.php | 10 +- .../console/CI/GithubActionReporter.php | 5 +- vendor/symfony/console/Color.php | 15 +- vendor/symfony/console/Command/Command.php | 70 +- .../console/Command/CompleteCommand.php | 14 +- .../console/Command/DumpCompletionCommand.php | 5 +- .../symfony/console/Command/HelpCommand.php | 13 +- .../symfony/console/Command/LazyCommand.php | 5 +- .../symfony/console/Command/ListCommand.php | 6 +- .../symfony/console/Command/LockableTrait.php | 5 +- .../console/Command/TraceableCommand.php | 57 +- .../CommandLoader/ContainerCommandLoader.php | 10 +- .../CommandLoader/FactoryCommandLoader.php | 5 +- .../console/Completion/CompletionInput.php | 29 +- .../Completion/CompletionSuggestions.php | 10 +- .../symfony/console/Completion/Suggestion.php | 6 +- vendor/symfony/console/Cursor.php | 7 +- .../DataCollector/CommandDataCollector.php | 8 +- vendor/symfony/console/Debug/CliRequest.php | 6 +- .../AddConsoleCommandPass.php | 2 +- .../Descriptor/ApplicationDescription.php | 24 +- .../symfony/console/Descriptor/Descriptor.php | 5 +- .../console/Descriptor/MarkdownDescriptor.php | 12 +- .../Descriptor/ReStructuredTextDescriptor.php | 47 +- .../console/Descriptor/TextDescriptor.php | 8 +- .../Exception/CommandNotFoundException.php | 5 +- .../Exception/RunCommandFailedException.php | 3 +- .../console/Formatter/NullOutputFormatter.php | 7 +- .../console/Formatter/OutputFormatter.php | 15 +- .../Formatter/OutputFormatterStyle.php | 32 +- .../Formatter/OutputFormatterStyleStack.php | 7 +- .../console/Helper/DebugFormatterHelper.php | 10 +- .../console/Helper/DescriptorHelper.php | 2 +- vendor/symfony/console/Helper/Dumper.php | 24 +- vendor/symfony/console/Helper/Helper.php | 6 +- vendor/symfony/console/Helper/HelperSet.php | 2 +- .../symfony/console/Helper/OutputWrapper.php | 5 +- vendor/symfony/console/Helper/ProgressBar.php | 158 +- .../console/Helper/ProgressIndicator.php | 65 +- .../symfony/console/Helper/QuestionHelper.php | 18 +- vendor/symfony/console/Helper/Table.php | 84 +- vendor/symfony/console/Helper/TableCell.php | 10 +- .../symfony/console/Helper/TableCellStyle.php | 9 +- vendor/symfony/console/Helper/TableRows.php | 5 +- vendor/symfony/console/Helper/TableStyle.php | 120 +- vendor/symfony/console/Input/ArgvInput.php | 15 +- vendor/symfony/console/Input/ArrayInput.php | 5 +- vendor/symfony/console/Input/Input.php | 4 +- .../symfony/console/Input/InputArgument.php | 15 +- .../symfony/console/Input/InputDefinition.php | 35 +- vendor/symfony/console/Input/InputOption.php | 15 +- .../symfony/console/Logger/ConsoleLogger.php | 20 +- .../console/Messenger/RunCommandContext.php | 9 +- .../console/Messenger/RunCommandMessage.php | 7 +- .../Messenger/RunCommandMessageHandler.php | 3 +- .../symfony/console/Output/BufferedOutput.php | 5 +- .../symfony/console/Output/ConsoleOutput.php | 10 +- .../console/Output/ConsoleSectionOutput.php | 25 +- vendor/symfony/console/Output/NullOutput.php | 7 +- vendor/symfony/console/Output/Output.php | 10 +- .../symfony/console/Output/StreamOutput.php | 2 +- .../console/Output/TrimmedBufferOutput.php | 10 +- .../console/Question/ChoiceQuestion.php | 20 +- .../console/Question/ConfirmationQuestion.php | 5 +- vendor/symfony/console/Question/Question.php | 51 +- .../console/SignalRegistry/SignalMap.php | 9 +- .../console/SignalRegistry/SignalRegistry.php | 5 +- .../console/SingleCommandApplication.php | 15 +- vendor/symfony/console/Style/OutputStyle.php | 5 +- vendor/symfony/console/Style/SymfonyStyle.php | 36 +- vendor/symfony/console/Terminal.php | 22 +- .../filesystem/Exception/IOException.php | 5 +- vendor/symfony/filesystem/Filesystem.php | 9 +- vendor/symfony/filesystem/Path.php | 7 +- .../symfony/finder/Comparator/Comparator.php | 10 +- vendor/symfony/finder/Finder.php | 104 +- vendor/symfony/finder/Gitignore.php | 4 +- .../finder/Iterator/CustomFilterIterator.php | 5 +- .../Iterator/DateRangeFilterIterator.php | 5 +- .../Iterator/DepthRangeFilterIterator.php | 5 +- .../ExcludeDirectoryFilterIterator.php | 16 +- .../Iterator/FileTypeFilterIterator.php | 5 +- .../symfony/finder/Iterator/LazyIterator.php | 5 +- .../Iterator/RecursiveDirectoryIterator.php | 25 +- .../Iterator/SizeRangeFilterIterator.php | 5 +- .../finder/Iterator/SortableIterator.php | 42 +- .../Iterator/VcsIgnoredFilterIterator.php | 13 +- vendor/symfony/finder/SplFileInfo.php | 10 +- .../symfony/polyfill-mbstring/bootstrap80.php | 2 +- .../Exception/ProcessFailedException.php | 5 +- .../Exception/ProcessSignaledException.php | 5 +- .../Exception/ProcessTimedOutException.php | 10 +- .../Exception/RunProcessFailedException.php | 3 +- vendor/symfony/process/ExecutableFinder.php | 5 +- vendor/symfony/process/InputStream.php | 15 +- .../process/Messenger/RunProcessContext.php | 12 +- .../process/Messenger/RunProcessMessage.php | 12 +- .../symfony/process/PhpExecutableFinder.php | 5 +- .../symfony/process/Pipes/AbstractPipes.php | 20 +- vendor/symfony/process/Pipes/UnixPipes.php | 15 +- vendor/symfony/process/Pipes/WindowsPipes.php | 25 +- vendor/symfony/process/Process.php | 106 +- .../Attribute/SubscribedService.php | 8 +- .../service-contracts/ServiceLocatorTrait.php | 15 +- .../ServiceMethodsSubscriberTrait.php | 9 +- .../ServiceSubscriberTrait.php | 4 +- vendor/symfony/yaml/Command/LintCommand.php | 31 +- vendor/symfony/yaml/Dumper.php | 3 +- .../symfony/yaml/Exception/ParseException.php | 8 +- vendor/symfony/yaml/Inline.php | 30 +- vendor/symfony/yaml/Parser.php | 57 +- vendor/symfony/yaml/Tag/TaggedValue.php | 5 +- vendor/symfony/yaml/Unescaper.php | 4 +- .../CommandLine/WorkerCommandLineFactory.php | 3 +- .../src/ValueObject/ParallelProcess.php | 24 +- .../src/ValueObject/ProcessPool.php | 5 +- .../src/ValueObject/Schedule.php | 5 +- .../src/ValueObject/AbstractCodeSample.php | 4 +- .../ComposerJsonAwareCodeSample.php | 3 +- .../CodeSample/ConfiguredCodeSample.php | 2 +- .../CodeSample/ExtraFileCodeSample.php | 3 +- .../src/ValueObject/RuleDefinition.php | 15 +- 1689 files changed, 12969 insertions(+), 16845 deletions(-) delete mode 100644 .github/workflows/e2e_php72.yaml delete mode 100644 e2e/reflection-union-php72/composer.json delete mode 100644 e2e/reflection-union-php72/rector.php delete mode 100644 e2e/reflection-union-php72/src/foo.php create mode 100644 src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ReprintNodeVisitor.php create mode 100644 src/NodeTypeResolver/PHPStan/Scope/RectorNodeScopeResolver.php create mode 100644 src/PHPStanStaticTypeMapper/TypeMapper/ConstantArrayTypeMapper.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AsymmetricVisibilityTokenEmulator.php delete mode 100644 vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php delete mode 100644 vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php delete mode 100644 vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php delete mode 100644 vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/PropertyTokenEmulator.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Modifiers.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/PropertyHook.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Property.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/StaticVar.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php delete mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Node/UseItem.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php delete mode 100644 vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php delete mode 100644 vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php delete mode 100644 vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/PhpVersion.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/Token.php create mode 100644 vendor/nikic/php-parser/lib/PhpParser/compatibility_tokens.php create mode 100644 vendor/phpstan/phpdoc-parser/UPGRADING.md delete mode 100644 vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/QuoteAwareConstExprStringNode.php create mode 100644 vendor/phpstan/phpdoc-parser/src/ParserConfig.php diff --git a/.github/workflows/along_other_packages.yaml b/.github/workflows/along_other_packages.yaml index 4a291ca3c95..d2a88426d3e 100644 --- a/.github/workflows/along_other_packages.yaml +++ b/.github/workflows/along_other_packages.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php_version: ['7.2', '7.3', '7.4', '8.0', '8.1'] + php_version: ['7.4', '8.0', '8.1'] commands: - name: 'Composer Dependency' diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 8da797bd0d3..c09aa86b2f8 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - php_version: ['7.2', '7.3', '7.4', '8.0', '8.1'] + php_version: ['7.4', '8.0', '8.1'] directory: - 'e2e/define-constant' - 'e2e/dont-execute-code' diff --git a/.github/workflows/e2e_diff.yaml b/.github/workflows/e2e_diff.yaml index 4f98627d235..2bf284f0be9 100644 --- a/.github/workflows/e2e_diff.yaml +++ b/.github/workflows/e2e_diff.yaml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - php_version: ['7.2', '7.3', '7.4', '8.0', '8.1'] + php_version: ['7.4', '8.0', '8.1'] directory: - 'e2e/attributes' diff --git a/.github/workflows/e2e_global.yaml b/.github/workflows/e2e_global.yaml index f50f7c9c3e5..8e7c55f9471 100644 --- a/.github/workflows/e2e_global.yaml +++ b/.github/workflows/e2e_global.yaml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - php_version: ['7.2', '7.3', '7.4', '8.0', '8.1'] + php_version: ['7.4', '8.0', '8.1'] directory: - 'e2e/global-install' diff --git a/.github/workflows/e2e_php72.yaml b/.github/workflows/e2e_php72.yaml deleted file mode 100644 index 2e1420c0b6a..00000000000 --- a/.github/workflows/e2e_php72.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: End to End tests on PHP 7.2 - -on: - push: - branches: - - main - -jobs: - end_to_end_on_php72: - runs-on: ubuntu-latest - - name: End to end test - PHP 7.2 with load ReflectionUnionType stub - - steps: - - uses: actions/checkout@v4 - - - uses: shivammathur/setup-php@v2 - with: - php-version: "7.2" - coverage: none - - # wait for deploy to packagist - - run: sleep 40 - - - - run: composer require rector/rector:dev-main --ansi - working-directory: e2e/reflection-union-php72 - - - - run: vendor/bin/rector process --ansi - working-directory: e2e/reflection-union-php72 diff --git a/.github/workflows/standalone_rule_test.yaml b/.github/workflows/standalone_rule_test.yaml index 6435cf6d0fb..edcefd315d0 100644 --- a/.github/workflows/standalone_rule_test.yaml +++ b/.github/workflows/standalone_rule_test.yaml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - php_version: ['7.3'] + php_version: ['7.4'] directory: - 'e2e/rector-prefixed-rule-test' diff --git a/bin/rector.php b/bin/rector.php index 83097bcae5b..7009a72f83d 100755 --- a/bin/rector.php +++ b/bin/rector.php @@ -29,7 +29,7 @@ final class AutoloadIncluder /** * @var string[] */ - private $alreadyLoadedAutoloadFiles = []; + private array $alreadyLoadedAutoloadFiles = []; public function includeDependencyOrRepositoryVendorAutoloadIfExists() : void { // Rector's vendor is already loaded diff --git a/composer.json b/composer.json index e34e112c82a..16857cf6ca2 100644 --- a/composer.json +++ b/composer.json @@ -7,8 +7,8 @@ "bin/rector" ], "require": { - "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.12.5" + "php": "^7.4|^8.0", + "phpstan/phpstan": "^2.0.1" }, "autoload": { "files": [ diff --git a/config/phpstan/parser.neon b/config/phpstan/parser.neon index 623e87feb66..3b0f385dce2 100644 --- a/config/phpstan/parser.neon +++ b/config/phpstan/parser.neon @@ -24,5 +24,4 @@ services: class: PHPStan\Parser\RichParser arguments: parser: @currentPhpVersionPhpParser - lexer: @currentPhpVersionLexer autowired: no diff --git a/config/phpstan/static-reflection.neon b/config/phpstan/static-reflection.neon index a54673113a7..238529fc630 100644 --- a/config/phpstan/static-reflection.neon +++ b/config/phpstan/static-reflection.neon @@ -1,9 +1,3 @@ -parameters: - # see https://github.com/rectorphp/rector/issues/3490#issue-634342324 - featureToggles: - disableRuntimeReflectionProvider: false - nodeConnectingVisitorCompatibility: false - services: - Rector\NodeTypeResolver\Reflection\BetterReflection\RectorBetterReflectionSourceLocatorFactory - Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocator\IntermediateSourceLocator diff --git a/e2e/reflection-union-php72/composer.json b/e2e/reflection-union-php72/composer.json deleted file mode 100644 index 17cdb632c2f..00000000000 --- a/e2e/reflection-union-php72/composer.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "autoload": { - "psr-4": { - "App\\": "src/" - } - }, - "require": { - "php": "7.2.*", - "rector/rector": "dev-main" - } -} diff --git a/e2e/reflection-union-php72/rector.php b/e2e/reflection-union-php72/rector.php deleted file mode 100644 index ba64f6a2083..00000000000 --- a/e2e/reflection-union-php72/rector.php +++ /dev/null @@ -1,17 +0,0 @@ -paths([ - __DIR__ . '/src' - ]); - - $rectorConfig->skip([ - __DIR__ . '/vendor', - ]); - - $rectorConfig->sets([\Rector\Set\ValueObject\SetList::CODE_QUALITY]); -}; diff --git a/e2e/reflection-union-php72/src/foo.php b/e2e/reflection-union-php72/src/foo.php deleted file mode 100644 index 844a77709f1..00000000000 --- a/e2e/reflection-union-php72/src/foo.php +++ /dev/null @@ -1,14 +0,0 @@ -format('C'); - } -} diff --git a/preload.php b/preload.php index 5794a8c1c2d..3895d091c0e 100644 --- a/preload.php +++ b/preload.php @@ -12,6 +12,7 @@ require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Comment.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php'; @@ -56,28 +57,30 @@ require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Thro require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/JsonDecoder.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AsymmetricVisibilityTokenEmulator.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/PropertyTokenEmulator.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Modifiers.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NameContext.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Attribute.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php'; @@ -135,7 +138,6 @@ require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Un require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php'; @@ -169,16 +171,20 @@ require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variabl require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/MatchArm.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyHook.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php'; @@ -186,8 +192,11 @@ require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Magic require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Property.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/StaticVar.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php'; @@ -196,7 +205,6 @@ require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMe require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php'; @@ -220,12 +228,9 @@ require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.p require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php'; @@ -236,23 +241,26 @@ require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse. require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/UseItem.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php'; -require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/PhpVersion.php'; require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/Token.php'; +require_once __DIR__ . '/vendor/nikic/php-parser/lib/PhpParser/compatibility_tokens.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Ast/Node.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Ast/NodeVisitor.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Lexer/Lexer.php'; @@ -272,7 +280,6 @@ require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExp require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprTrueNode.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstFetchNode.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/DoctrineConstExprStringNode.php'; -require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/QuoteAwareConstExprStringNode.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Ast/NodeTraverser.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Ast/NodeVisitor/CloningVisitor.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagMethodValueNode.php'; @@ -338,6 +345,7 @@ require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Parser/PhpDocParser.ph require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Parser/StringUnescaper.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Parser/TokenIterator.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Parser/TypeParser.php'; +require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/ParserConfig.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Printer/DiffElem.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Printer/Differ.php'; require_once __DIR__ . '/vendor/phpstan/phpdoc-parser/src/Printer/Printer.php'; diff --git a/rules/Arguments/ArgumentDefaultValueReplacer.php b/rules/Arguments/ArgumentDefaultValueReplacer.php index 1220ca12c17..5aa1066f10d 100644 --- a/rules/Arguments/ArgumentDefaultValueReplacer.php +++ b/rules/Arguments/ArgumentDefaultValueReplacer.php @@ -20,14 +20,12 @@ final class ArgumentDefaultValueReplacer { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(NodeFactory $nodeFactory, ValueResolver $valueResolver) { $this->nodeFactory = $nodeFactory; diff --git a/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php b/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php index 3976fbb67a7..16f8352889d 100644 --- a/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php +++ b/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php @@ -14,9 +14,8 @@ final class ArgumentAddingScope { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @api * @var string diff --git a/rules/Arguments/NodeAnalyzer/ChangedArgumentsDetector.php b/rules/Arguments/NodeAnalyzer/ChangedArgumentsDetector.php index 5bcb031cfa3..e6a4072b2c3 100644 --- a/rules/Arguments/NodeAnalyzer/ChangedArgumentsDetector.php +++ b/rules/Arguments/NodeAnalyzer/ChangedArgumentsDetector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Arguments\NodeAnalyzer; +use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Param; use PHPStan\Type\Type; @@ -13,19 +14,16 @@ final class ChangedArgumentsDetector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; public function __construct(ValueResolver $valueResolver, StaticTypeMapper $staticTypeMapper, TypeComparator $typeComparator) { $this->valueResolver = $valueResolver; @@ -44,7 +42,7 @@ final class ChangedArgumentsDetector } public function isTypeChanged(Param $param, ?Type $newType) : bool { - if ($param->type === null) { + if (!$param->type instanceof Node) { return \false; } if (!$newType instanceof Type) { diff --git a/rules/Arguments/Rector/ClassMethod/ArgumentAdderRector.php b/rules/Arguments/Rector/ClassMethod/ArgumentAdderRector.php index 6ed6418c21b..b6a99651d31 100644 --- a/rules/Arguments/Rector/ClassMethod/ArgumentAdderRector.php +++ b/rules/Arguments/Rector/ClassMethod/ArgumentAdderRector.php @@ -37,32 +37,25 @@ final class ArgumentAdderRector extends AbstractRector implements ConfigurableRe { /** * @readonly - * @var \Rector\Arguments\NodeAnalyzer\ArgumentAddingScope */ - private $argumentAddingScope; + private ArgumentAddingScope $argumentAddingScope; /** * @readonly - * @var \Rector\Arguments\NodeAnalyzer\ChangedArgumentsDetector */ - private $changedArgumentsDetector; + private ChangedArgumentsDetector $changedArgumentsDetector; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @var ArgumentAdder[]|ArgumentAdderWithoutDefaultValue[] */ - private $addedArguments = []; - /** - * @var bool - */ - private $hasChanged = \false; + private array $addedArguments = []; + private bool $hasChanged = \false; public function __construct(ArgumentAddingScope $argumentAddingScope, ChangedArgumentsDetector $changedArgumentsDetector, AstResolver $astResolver, StaticTypeMapper $staticTypeMapper) { $this->argumentAddingScope = $argumentAddingScope; diff --git a/rules/Arguments/Rector/ClassMethod/ReplaceArgumentDefaultValueRector.php b/rules/Arguments/Rector/ClassMethod/ReplaceArgumentDefaultValueRector.php index 27c9616218c..817b6220f6d 100644 --- a/rules/Arguments/Rector/ClassMethod/ReplaceArgumentDefaultValueRector.php +++ b/rules/Arguments/Rector/ClassMethod/ReplaceArgumentDefaultValueRector.php @@ -24,13 +24,12 @@ final class ReplaceArgumentDefaultValueRector extends AbstractRector implements { /** * @readonly - * @var \Rector\Arguments\ArgumentDefaultValueReplacer */ - private $argumentDefaultValueReplacer; + private ArgumentDefaultValueReplacer $argumentDefaultValueReplacer; /** * @var ReplaceArgumentDefaultValue[] */ - private $replaceArgumentDefaultValues = []; + private array $replaceArgumentDefaultValues = []; public function __construct(ArgumentDefaultValueReplacer $argumentDefaultValueReplacer) { $this->argumentDefaultValueReplacer = $argumentDefaultValueReplacer; diff --git a/rules/Arguments/Rector/FuncCall/FunctionArgumentDefaultValueReplacerRector.php b/rules/Arguments/Rector/FuncCall/FunctionArgumentDefaultValueReplacerRector.php index fe4bd0084cf..f3a32ce36ff 100644 --- a/rules/Arguments/Rector/FuncCall/FunctionArgumentDefaultValueReplacerRector.php +++ b/rules/Arguments/Rector/FuncCall/FunctionArgumentDefaultValueReplacerRector.php @@ -19,13 +19,12 @@ final class FunctionArgumentDefaultValueReplacerRector extends AbstractRector im { /** * @readonly - * @var \Rector\Arguments\ArgumentDefaultValueReplacer */ - private $argumentDefaultValueReplacer; + private ArgumentDefaultValueReplacer $argumentDefaultValueReplacer; /** * @var ReplaceFuncCallArgumentDefaultValue[] */ - private $replacedArguments = []; + private array $replacedArguments = []; public function __construct(ArgumentDefaultValueReplacer $argumentDefaultValueReplacer) { $this->argumentDefaultValueReplacer = $argumentDefaultValueReplacer; diff --git a/rules/Arguments/Rector/MethodCall/RemoveMethodCallParamRector.php b/rules/Arguments/Rector/MethodCall/RemoveMethodCallParamRector.php index d0adeb2aef3..bf67eb28100 100644 --- a/rules/Arguments/Rector/MethodCall/RemoveMethodCallParamRector.php +++ b/rules/Arguments/Rector/MethodCall/RemoveMethodCallParamRector.php @@ -20,7 +20,7 @@ final class RemoveMethodCallParamRector extends AbstractRector implements Config /** * @var RemoveMethodCallParam[] */ - private $removeMethodCallParams = []; + private array $removeMethodCallParams = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Remove parameter of method call', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Arguments/ValueObject/ArgumentAdder.php b/rules/Arguments/ValueObject/ArgumentAdder.php index 38bad6602d0..14d1beeff8a 100644 --- a/rules/Arguments/ValueObject/ArgumentAdder.php +++ b/rules/Arguments/ValueObject/ArgumentAdder.php @@ -10,24 +10,20 @@ final class ArgumentAdder { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $method; + private string $method; /** * @readonly - * @var int */ - private $position; + private int $position; /** * @readonly - * @var string|null */ - private $argumentName; + private ?string $argumentName = null; /** * @var mixed|null */ @@ -39,9 +35,8 @@ final class ArgumentAdder private $argumentType = null; /** * @readonly - * @var string|null */ - private $scope; + private ?string $scope = null; /** * @param mixed|null $argumentDefaultValue */ diff --git a/rules/Arguments/ValueObject/ArgumentAdderWithoutDefaultValue.php b/rules/Arguments/ValueObject/ArgumentAdderWithoutDefaultValue.php index 4a075b3d682..d89ffd14a41 100644 --- a/rules/Arguments/ValueObject/ArgumentAdderWithoutDefaultValue.php +++ b/rules/Arguments/ValueObject/ArgumentAdderWithoutDefaultValue.php @@ -10,24 +10,20 @@ final class ArgumentAdderWithoutDefaultValue { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $method; + private string $method; /** * @readonly - * @var int */ - private $position; + private int $position; /** * @readonly - * @var string|null */ - private $argumentName; + private ?string $argumentName = null; /** * @readonly * @var \PHPStan\Type\Type|null @@ -35,9 +31,8 @@ final class ArgumentAdderWithoutDefaultValue private $argumentType = null; /** * @readonly - * @var string|null */ - private $scope; + private ?string $scope = null; public function __construct(string $class, string $method, int $position, ?string $argumentName = null, ?\PHPStan\Type\Type $argumentType = null, ?string $scope = null) { $this->class = $class; diff --git a/rules/Arguments/ValueObject/RemoveMethodCallParam.php b/rules/Arguments/ValueObject/RemoveMethodCallParam.php index 6626362eff5..6c1830842af 100644 --- a/rules/Arguments/ValueObject/RemoveMethodCallParam.php +++ b/rules/Arguments/ValueObject/RemoveMethodCallParam.php @@ -9,19 +9,16 @@ final class RemoveMethodCallParam { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $methodName; + private string $methodName; /** * @readonly - * @var int */ - private $paramPosition; + private int $paramPosition; public function __construct(string $class, string $methodName, int $paramPosition) { $this->class = $class; diff --git a/rules/Arguments/ValueObject/ReplaceArgumentDefaultValue.php b/rules/Arguments/ValueObject/ReplaceArgumentDefaultValue.php index da9d97613aa..8d0abf60250 100644 --- a/rules/Arguments/ValueObject/ReplaceArgumentDefaultValue.php +++ b/rules/Arguments/ValueObject/ReplaceArgumentDefaultValue.php @@ -10,19 +10,17 @@ final class ReplaceArgumentDefaultValue implements ReplaceArgumentDefaultValueIn { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $method; + private string $method; /** * @var int<0, max> * @readonly */ - private $position; + private int $position; /** * @readonly * @var mixed diff --git a/rules/Arguments/ValueObject/ReplaceFuncCallArgumentDefaultValue.php b/rules/Arguments/ValueObject/ReplaceFuncCallArgumentDefaultValue.php index 08908e61797..e02bff7f858 100644 --- a/rules/Arguments/ValueObject/ReplaceFuncCallArgumentDefaultValue.php +++ b/rules/Arguments/ValueObject/ReplaceFuncCallArgumentDefaultValue.php @@ -8,14 +8,12 @@ final class ReplaceFuncCallArgumentDefaultValue implements ReplaceArgumentDefaul { /** * @readonly - * @var string */ - private $function; + private string $function; /** * @readonly - * @var int */ - private $position; + private int $position; /** * @readonly * @var mixed diff --git a/rules/Carbon/NodeFactory/CarbonCallFactory.php b/rules/Carbon/NodeFactory/CarbonCallFactory.php index 552f8ca7bcc..ed11cdfebdd 100644 --- a/rules/Carbon/NodeFactory/CarbonCallFactory.php +++ b/rules/Carbon/NodeFactory/CarbonCallFactory.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\Carbon\NodeFactory; +use PhpParser\Node\Scalar\Int_; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\Node\Arg; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Identifier; use PhpParser\Node\Name\FullyQualified; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; final class CarbonCallFactory { @@ -32,7 +32,7 @@ final class CarbonCallFactory $string->value = Strings::replace($string->value, self::STATIC_DATE_REGEX); // Handle add/sub multiple times while ($match = Strings::match($string->value, self::PLUS_MINUS_COUNT_REGEX)) { - $methodCall = $this->createModifyMethodCall($carbonCall, new LNumber((int) $match['count']), $match['unit'], $match['operator']); + $methodCall = $this->createModifyMethodCall($carbonCall, new Int_((int) $match['count']), $match['unit'], $match['operator']); if ($methodCall instanceof MethodCall) { $carbonCall = $methodCall; $string->value = Strings::replace($string->value, self::PLUS_MINUS_COUNT_REGEX, '', 1); @@ -50,7 +50,7 @@ final class CarbonCallFactory return $carbonCall; } // If we fallback to a parse we want to include tomorrow/today/yesterday etc - if ($currentCall->name instanceof Identifier && $currentCall->name->name != 'now') { + if ($currentCall->name instanceof Identifier && $currentCall->name->name !== 'now') { $rest .= ' ' . $currentCall->name->name; } $currentCall->name = new Identifier('parse'); @@ -68,7 +68,7 @@ final class CarbonCallFactory /** * @param \PhpParser\Node\Expr\MethodCall|\PhpParser\Node\Expr\StaticCall $carbonCall */ - private function createModifyMethodCall($carbonCall, LNumber $countLNumber, string $unit, string $operator) : ?MethodCall + private function createModifyMethodCall($carbonCall, Int_ $int, string $unit, string $operator) : ?MethodCall { switch ($unit) { case 'sec': @@ -120,7 +120,7 @@ final class CarbonCallFactory return null; } $methodName = $operator . \ucfirst($unit); - return new MethodCall($carbonCall, new Identifier($methodName), [new Arg($countLNumber)]); + return new MethodCall($carbonCall, new Identifier($methodName), [new Arg($int)]); } /** * @param MethodCall[] $callStack diff --git a/rules/Carbon/Rector/MethodCall/DateTimeMethodCallToCarbonRector.php b/rules/Carbon/Rector/MethodCall/DateTimeMethodCallToCarbonRector.php index 863031a7219..c1a94936fa6 100644 --- a/rules/Carbon/Rector/MethodCall/DateTimeMethodCallToCarbonRector.php +++ b/rules/Carbon/Rector/MethodCall/DateTimeMethodCallToCarbonRector.php @@ -20,9 +20,8 @@ final class DateTimeMethodCallToCarbonRector extends AbstractRector { /** * @readonly - * @var \Rector\Carbon\NodeFactory\CarbonCallFactory */ - private $carbonCallFactory; + private CarbonCallFactory $carbonCallFactory; public function __construct(CarbonCallFactory $carbonCallFactory) { $this->carbonCallFactory = $carbonCallFactory; diff --git a/rules/Carbon/Rector/New_/DateTimeInstanceToCarbonRector.php b/rules/Carbon/Rector/New_/DateTimeInstanceToCarbonRector.php index 91374248ca3..df580d12d64 100644 --- a/rules/Carbon/Rector/New_/DateTimeInstanceToCarbonRector.php +++ b/rules/Carbon/Rector/New_/DateTimeInstanceToCarbonRector.php @@ -21,9 +21,8 @@ final class DateTimeInstanceToCarbonRector extends AbstractRector { /** * @readonly - * @var \Rector\Carbon\NodeFactory\CarbonCallFactory */ - private $carbonCallFactory; + private CarbonCallFactory $carbonCallFactory; public function __construct(CarbonCallFactory $carbonCallFactory) { $this->carbonCallFactory = $carbonCallFactory; diff --git a/rules/CodeQuality/CompactConverter.php b/rules/CodeQuality/CompactConverter.php index 68194710476..35c1f8d51f9 100644 --- a/rules/CodeQuality/CompactConverter.php +++ b/rules/CodeQuality/CompactConverter.php @@ -5,7 +5,7 @@ namespace Rector\CodeQuality; use PhpParser\Node\Arg; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Scalar\String_; @@ -15,9 +15,8 @@ final class CompactConverter { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/CodeQuality/NodeAnalyzer/ForeachAnalyzer.php b/rules/CodeQuality/NodeAnalyzer/ForeachAnalyzer.php index c89f5192391..76c28555e62 100644 --- a/rules/CodeQuality/NodeAnalyzer/ForeachAnalyzer.php +++ b/rules/CodeQuality/NodeAnalyzer/ForeachAnalyzer.php @@ -13,9 +13,8 @@ final class ForeachAnalyzer { /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; public function __construct(NodeComparator $nodeComparator) { $this->nodeComparator = $nodeComparator; diff --git a/rules/CodeQuality/NodeAnalyzer/LocalPropertyAnalyzer.php b/rules/CodeQuality/NodeAnalyzer/LocalPropertyAnalyzer.php index f17c9c07061..6535ca5bd60 100644 --- a/rules/CodeQuality/NodeAnalyzer/LocalPropertyAnalyzer.php +++ b/rules/CodeQuality/NodeAnalyzer/LocalPropertyAnalyzer.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\CodeQuality\NodeAnalyzer; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node\Expr\Assign; @@ -13,7 +14,6 @@ use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\Function_; -use PhpParser\NodeTraverser; use PHPStan\Analyser\Scope; use PHPStan\Type\MixedType; use PHPStan\Type\Type; @@ -28,34 +28,28 @@ final class LocalPropertyAnalyzer { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\CodeQuality\TypeResolver\ArrayDimFetchTypeResolver */ - private $arrayDimFetchTypeResolver; + private ArrayDimFetchTypeResolver $arrayDimFetchTypeResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @var string */ @@ -77,20 +71,20 @@ final class LocalPropertyAnalyzer $fetchedLocalPropertyNameToTypes = []; $this->simpleCallableNodeTraverser->traverseNodesWithCallable($class->getMethods(), function (Node $node) use(&$fetchedLocalPropertyNameToTypes) : ?int { if ($this->shouldSkip($node)) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($node instanceof Assign && ($node->var instanceof PropertyFetch || $node->var instanceof ArrayDimFetch)) { $propertyFetch = $node->var; $propertyName = $this->resolvePropertyName($propertyFetch instanceof ArrayDimFetch ? $propertyFetch->var : $propertyFetch); if ($propertyName === null) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($propertyFetch instanceof ArrayDimFetch) { $fetchedLocalPropertyNameToTypes[$propertyName][] = $this->arrayDimFetchTypeResolver->resolve($propertyFetch, $node); - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } $fetchedLocalPropertyNameToTypes[$propertyName][] = $this->nodeTypeResolver->getType($node->expr); - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } $propertyName = $this->resolvePropertyName($node); if ($propertyName === null) { diff --git a/rules/CodeQuality/NodeAnalyzer/VariableDimFetchAssignResolver.php b/rules/CodeQuality/NodeAnalyzer/VariableDimFetchAssignResolver.php index 9042e13cbee..e1406fffe10 100644 --- a/rules/CodeQuality/NodeAnalyzer/VariableDimFetchAssignResolver.php +++ b/rules/CodeQuality/NodeAnalyzer/VariableDimFetchAssignResolver.php @@ -17,14 +17,12 @@ final class VariableDimFetchAssignResolver { /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(NodeComparator $nodeComparator, BetterNodeFinder $betterNodeFinder) { $this->nodeComparator = $nodeComparator; @@ -68,9 +66,7 @@ final class VariableDimFetchAssignResolver if (!$this->nodeComparator->areNodesEqual($arrayDimFetch->var, $variable)) { return null; } - $isFoundInExpr = (bool) $this->betterNodeFinder->findFirst($assign->expr, function (Node $subNode) use($variable) : bool { - return $this->nodeComparator->areNodesEqual($subNode, $variable); - }); + $isFoundInExpr = (bool) $this->betterNodeFinder->findFirst($assign->expr, fn(Node $subNode): bool => $this->nodeComparator->areNodesEqual($subNode, $variable)); if ($isFoundInExpr) { return null; } diff --git a/rules/CodeQuality/NodeFactory/MissingPropertiesFactory.php b/rules/CodeQuality/NodeFactory/MissingPropertiesFactory.php index 8846e952621..df74aa45a80 100644 --- a/rules/CodeQuality/NodeFactory/MissingPropertiesFactory.php +++ b/rules/CodeQuality/NodeFactory/MissingPropertiesFactory.php @@ -3,17 +3,16 @@ declare (strict_types=1); namespace Rector\CodeQuality\NodeFactory; -use PhpParser\Node\Stmt\Class_; +use PhpParser\Modifiers; use PhpParser\Node\Stmt\Property; -use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\Node\PropertyItem; use PHPStan\Type\Type; final class MissingPropertiesFactory { /** * @readonly - * @var \Rector\CodeQuality\NodeFactory\PropertyTypeDecorator */ - private $propertyTypeDecorator; + private \Rector\CodeQuality\NodeFactory\PropertyTypeDecorator $propertyTypeDecorator; public function __construct(\Rector\CodeQuality\NodeFactory\PropertyTypeDecorator $propertyTypeDecorator) { $this->propertyTypeDecorator = $propertyTypeDecorator; @@ -30,7 +29,7 @@ final class MissingPropertiesFactory if (!\in_array($propertyName, $propertyNamesToComplete, \true)) { continue; } - $property = new Property(Class_::MODIFIER_PUBLIC, [new PropertyProperty($propertyName)]); + $property = new Property(Modifiers::PUBLIC, [new PropertyItem($propertyName)]); $this->propertyTypeDecorator->decorateProperty($property, $propertyType); $newProperties[] = $property; } diff --git a/rules/CodeQuality/NodeFactory/PropertyTypeDecorator.php b/rules/CodeQuality/NodeFactory/PropertyTypeDecorator.php index e6185ec269a..4273838fce8 100644 --- a/rules/CodeQuality/NodeFactory/PropertyTypeDecorator.php +++ b/rules/CodeQuality/NodeFactory/PropertyTypeDecorator.php @@ -12,19 +12,16 @@ final class PropertyTypeDecorator { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Privatization\TypeManipulator\TypeNormalizer */ - private $typeNormalizer; + private TypeNormalizer $typeNormalizer; public function __construct(PhpDocTypeChanger $phpDocTypeChanger, PhpDocInfoFactory $phpDocInfoFactory, TypeNormalizer $typeNormalizer) { $this->phpDocTypeChanger = $phpDocTypeChanger; diff --git a/rules/CodeQuality/NodeFactory/TypedPropertyFactory.php b/rules/CodeQuality/NodeFactory/TypedPropertyFactory.php index f6b95cd63e1..2b41c9dfa3d 100644 --- a/rules/CodeQuality/NodeFactory/TypedPropertyFactory.php +++ b/rules/CodeQuality/NodeFactory/TypedPropertyFactory.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\CodeQuality\NodeFactory; +use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\ComplexType; use PhpParser\Node\Identifier; @@ -10,7 +11,7 @@ use PhpParser\Node\Name; use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\Property; -use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\Node\PropertyItem; use PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode; use Rector\PHPStanStaticTypeMapper\Enum\TypeKind; use Rector\StaticTypeMapper\StaticTypeMapper; @@ -18,18 +19,17 @@ final class TypedPropertyFactory { /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(StaticTypeMapper $staticTypeMapper) { $this->staticTypeMapper = $staticTypeMapper; } public function createFromPropertyTagValueNode(PropertyTagValueNode $propertyTagValueNode, Class_ $class, string $propertyName) : Property { - $propertyProperty = new PropertyProperty($propertyName); + $propertyItem = new PropertyItem($propertyName); $propertyTypeNode = $this->createPropertyTypeNode($propertyTagValueNode, $class); - return new Property(Class_::MODIFIER_PRIVATE, [$propertyProperty], [], $propertyTypeNode); + return new Property(Modifiers::PRIVATE, [$propertyItem], [], $propertyTypeNode); } /** * @return \PhpParser\Node\Name|\PhpParser\Node\ComplexType|\PhpParser\Node\Identifier|null diff --git a/rules/CodeQuality/NodeManipulator/ExprBoolCaster.php b/rules/CodeQuality/NodeManipulator/ExprBoolCaster.php index 5b311663af6..0690762cf3f 100644 --- a/rules/CodeQuality/NodeManipulator/ExprBoolCaster.php +++ b/rules/CodeQuality/NodeManipulator/ExprBoolCaster.php @@ -19,24 +19,20 @@ final class ExprBoolCaster { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\Utils\TypeUnwrapper */ - private $typeUnwrapper; + private TypeUnwrapper $typeUnwrapper; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\StaticTypeAnalyzer */ - private $staticTypeAnalyzer; + private StaticTypeAnalyzer $staticTypeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeTypeResolver $nodeTypeResolver, TypeUnwrapper $typeUnwrapper, StaticTypeAnalyzer $staticTypeAnalyzer, NodeFactory $nodeFactory) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/rules/CodeQuality/Rector/Assign/CombinedAssignRector.php b/rules/CodeQuality/Rector/Assign/CombinedAssignRector.php index f2e2e47be34..425c2da78a5 100644 --- a/rules/CodeQuality/Rector/Assign/CombinedAssignRector.php +++ b/rules/CodeQuality/Rector/Assign/CombinedAssignRector.php @@ -17,9 +17,8 @@ final class CombinedAssignRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\AssignAndBinaryMap */ - private $assignAndBinaryMap; + private AssignAndBinaryMap $assignAndBinaryMap; public function __construct(AssignAndBinaryMap $assignAndBinaryMap) { $this->assignAndBinaryMap = $assignAndBinaryMap; diff --git a/rules/CodeQuality/Rector/BooleanAnd/SimplifyEmptyArrayCheckRector.php b/rules/CodeQuality/Rector/BooleanAnd/SimplifyEmptyArrayCheckRector.php index 21c232f3229..f3951e680ea 100644 --- a/rules/CodeQuality/Rector/BooleanAnd/SimplifyEmptyArrayCheckRector.php +++ b/rules/CodeQuality/Rector/BooleanAnd/SimplifyEmptyArrayCheckRector.php @@ -21,9 +21,8 @@ final class SimplifyEmptyArrayCheckRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\BinaryOpManipulator */ - private $binaryOpManipulator; + private BinaryOpManipulator $binaryOpManipulator; public function __construct(BinaryOpManipulator $binaryOpManipulator) { $this->binaryOpManipulator = $binaryOpManipulator; diff --git a/rules/CodeQuality/Rector/BooleanNot/SimplifyDeMorganBinaryRector.php b/rules/CodeQuality/Rector/BooleanNot/SimplifyDeMorganBinaryRector.php index 831449d03a3..68ab499e562 100644 --- a/rules/CodeQuality/Rector/BooleanNot/SimplifyDeMorganBinaryRector.php +++ b/rules/CodeQuality/Rector/BooleanNot/SimplifyDeMorganBinaryRector.php @@ -18,9 +18,8 @@ final class SimplifyDeMorganBinaryRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\BinaryOpManipulator */ - private $binaryOpManipulator; + private BinaryOpManipulator $binaryOpManipulator; public function __construct(BinaryOpManipulator $binaryOpManipulator) { $this->binaryOpManipulator = $binaryOpManipulator; diff --git a/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php b/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php index eeb4b9f5333..c985c9c69f9 100644 --- a/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php +++ b/rules/CodeQuality/Rector/Catch_/ThrowWithPreviousExceptionRector.php @@ -3,16 +3,16 @@ declare (strict_types=1); namespace Rector\CodeQuality\Rector\Catch_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\New_; +use PhpParser\Node\Expr\Throw_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Catch_; -use PhpParser\Node\Stmt\Throw_; -use PhpParser\NodeTraverser; use PHPStan\Reflection\ParametersAcceptorSelector; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\ObjectType; @@ -29,9 +29,8 @@ final class ThrowWithPreviousExceptionRector extends AbstractRector { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @var int */ @@ -142,7 +141,7 @@ CODE_SAMPLE // null the node, to fix broken format preserving printers, see https://github.com/rectorphp/rector/issues/5576 $new->setAttribute(AttributeKey::ORIGINAL_NODE, null); // nothing more to add - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } private function resolveExceptionArgumentPosition(Name $exceptionName) : ?int { @@ -160,8 +159,8 @@ CODE_SAMPLE return self::DEFAULT_EXCEPTION_ARGUMENT_POSITION; } $extendedMethodReflection = $classReflection->getConstructor(); - $parametersAcceptorWithPhpDocs = ParametersAcceptorSelector::combineAcceptors($extendedMethodReflection->getVariants()); - foreach ($parametersAcceptorWithPhpDocs->getParameters() as $position => $parameterReflectionWithPhpDoc) { + $extendedParametersAcceptor = ParametersAcceptorSelector::combineAcceptors($extendedMethodReflection->getVariants()); + foreach ($extendedParametersAcceptor->getParameters() as $position => $parameterReflectionWithPhpDoc) { $parameterType = $parameterReflectionWithPhpDoc->getType(); $className = ClassNameFromObjectTypeResolver::resolve($parameterReflectionWithPhpDoc->getType()); if ($className === null) { diff --git a/rules/CodeQuality/Rector/ClassMethod/ExplicitReturnNullRector.php b/rules/CodeQuality/Rector/ClassMethod/ExplicitReturnNullRector.php index b453bfdb28a..dc441773c90 100644 --- a/rules/CodeQuality/Rector/ClassMethod/ExplicitReturnNullRector.php +++ b/rules/CodeQuality/Rector/ClassMethod/ExplicitReturnNullRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\CodeQuality\Rector\ClassMethod; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Closure; @@ -12,7 +13,6 @@ use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Return_; -use PhpParser\NodeTraverser; use PHPStan\Type\NullType; use PHPStan\Type\UnionType; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; @@ -31,29 +31,24 @@ final class ExplicitReturnNullRector extends AbstractRector { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\SilentVoidResolver */ - private $silentVoidResolver; + private SilentVoidResolver $silentVoidResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; public function __construct(SilentVoidResolver $silentVoidResolver, PhpDocInfoFactory $phpDocInfoFactory, TypeFactory $typeFactory, PhpDocTypeChanger $phpDocTypeChanger, ReturnTypeInferer $returnTypeInferer) { $this->silentVoidResolver = $silentVoidResolver; @@ -122,7 +117,7 @@ CODE_SAMPLE $hasChanged = \false; $this->traverseNodesWithCallable((array) $node->stmts, static function (Node $node) use(&$hasChanged) { if ($node instanceof Class_ || $node instanceof Function_ || $node instanceof Closure) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($node instanceof Return_ && !$node->expr instanceof Expr) { $hasChanged = \true; diff --git a/rules/CodeQuality/Rector/ClassMethod/InlineArrayReturnAssignRector.php b/rules/CodeQuality/Rector/ClassMethod/InlineArrayReturnAssignRector.php index 8eb8315198a..2ba39ea8614 100644 --- a/rules/CodeQuality/Rector/ClassMethod/InlineArrayReturnAssignRector.php +++ b/rules/CodeQuality/Rector/ClassMethod/InlineArrayReturnAssignRector.php @@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Rector\ClassMethod; use PhpParser\Node; use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\ArrayDimFetch; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt; @@ -27,14 +27,12 @@ final class InlineArrayReturnAssignRector extends AbstractRector { /** * @readonly - * @var \Rector\CodeQuality\NodeAnalyzer\VariableDimFetchAssignResolver */ - private $variableDimFetchAssignResolver; + private VariableDimFetchAssignResolver $variableDimFetchAssignResolver; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(VariableDimFetchAssignResolver $variableDimFetchAssignResolver, ValueResolver $valueResolver) { $this->variableDimFetchAssignResolver = $variableDimFetchAssignResolver; @@ -150,9 +148,7 @@ CODE_SAMPLE */ private function areAssignExclusiveToDimFetch(array $stmts) : bool { - \end($stmts); - $lastKey = \key($stmts); - \reset($stmts); + $lastKey = \array_key_last($stmts); foreach ($stmts as $key => $stmt) { if ($key === $lastKey) { // skip last item diff --git a/rules/CodeQuality/Rector/ClassMethod/LocallyCalledStaticMethodToNonStaticRector.php b/rules/CodeQuality/Rector/ClassMethod/LocallyCalledStaticMethodToNonStaticRector.php index 00a1045ceff..2873e94ad71 100644 --- a/rules/CodeQuality/Rector/ClassMethod/LocallyCalledStaticMethodToNonStaticRector.php +++ b/rules/CodeQuality/Rector/ClassMethod/LocallyCalledStaticMethodToNonStaticRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\CodeQuality\Rector\ClassMethod; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\Expr\Closure; @@ -11,7 +12,6 @@ use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; -use PhpParser\NodeTraverser; use PHPStan\Reflection\ClassReflection; use Rector\Privatization\NodeManipulator\VisibilityManipulator; use Rector\Privatization\VisibilityGuard\ClassMethodVisibilityGuard; @@ -26,19 +26,16 @@ final class LocallyCalledStaticMethodToNonStaticRector extends AbstractRector { /** * @readonly - * @var \Rector\Privatization\VisibilityGuard\ClassMethodVisibilityGuard */ - private $classMethodVisibilityGuard; + private ClassMethodVisibilityGuard $classMethodVisibilityGuard; /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ClassMethodVisibilityGuard $classMethodVisibilityGuard, VisibilityManipulator $visibilityManipulator, ReflectionResolver $reflectionResolver) { $this->classMethodVisibilityGuard = $classMethodVisibilityGuard; @@ -134,10 +131,10 @@ CODE_SAMPLE return null; } $shouldSkip = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; }); if ($shouldSkip) { - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } return null; } @@ -188,7 +185,7 @@ CODE_SAMPLE return null; } $isInsideStaticClassMethod = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; }); if ($isInsideStaticClassMethod) { return $isInsideStaticClassMethod; diff --git a/rules/CodeQuality/Rector/ClassMethod/OptionalParametersAfterRequiredRector.php b/rules/CodeQuality/Rector/ClassMethod/OptionalParametersAfterRequiredRector.php index 16ae64ca762..af7762d17ea 100644 --- a/rules/CodeQuality/Rector/ClassMethod/OptionalParametersAfterRequiredRector.php +++ b/rules/CodeQuality/Rector/ClassMethod/OptionalParametersAfterRequiredRector.php @@ -30,24 +30,20 @@ final class OptionalParametersAfterRequiredRector extends AbstractRector { /** * @readonly - * @var \Rector\Php80\NodeResolver\RequireOptionalParamResolver */ - private $requireOptionalParamResolver; + private RequireOptionalParamResolver $requireOptionalParamResolver; /** * @readonly - * @var \Rector\Php80\NodeResolver\ArgumentSorter */ - private $argumentSorter; + private ArgumentSorter $argumentSorter; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\CodingStyle\Reflection\VendorLocationDetector */ - private $vendorLocationDetector; + private VendorLocationDetector $vendorLocationDetector; /** * @var string */ diff --git a/rules/CodeQuality/Rector/Class_/CompleteDynamicPropertiesRector.php b/rules/CodeQuality/Rector/Class_/CompleteDynamicPropertiesRector.php index a08968657cf..1033499e660 100644 --- a/rules/CodeQuality/Rector/Class_/CompleteDynamicPropertiesRector.php +++ b/rules/CodeQuality/Rector/Class_/CompleteDynamicPropertiesRector.php @@ -27,39 +27,32 @@ final class CompleteDynamicPropertiesRector extends AbstractRector { /** * @readonly - * @var \Rector\CodeQuality\NodeFactory\MissingPropertiesFactory */ - private $missingPropertiesFactory; + private MissingPropertiesFactory $missingPropertiesFactory; /** * @readonly - * @var \Rector\CodeQuality\NodeAnalyzer\LocalPropertyAnalyzer */ - private $localPropertyAnalyzer; + private LocalPropertyAnalyzer $localPropertyAnalyzer; /** * @readonly - * @var \Rector\CodeQuality\NodeAnalyzer\ClassLikeAnalyzer */ - private $classLikeAnalyzer; + private ClassLikeAnalyzer $classLikeAnalyzer; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyPresenceChecker */ - private $propertyPresenceChecker; + private PropertyPresenceChecker $propertyPresenceChecker; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; public function __construct(MissingPropertiesFactory $missingPropertiesFactory, LocalPropertyAnalyzer $localPropertyAnalyzer, ClassLikeAnalyzer $classLikeAnalyzer, ReflectionProvider $reflectionProvider, ClassAnalyzer $classAnalyzer, PropertyPresenceChecker $propertyPresenceChecker, PhpAttributeAnalyzer $phpAttributeAnalyzer) { $this->missingPropertiesFactory = $missingPropertiesFactory; diff --git a/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php b/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php index 8829edb50fd..f776342b6c9 100644 --- a/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php +++ b/rules/CodeQuality/Rector/Class_/DynamicDocBlockPropertyToNativePropertyRector.php @@ -31,39 +31,32 @@ final class DynamicDocBlockPropertyToNativePropertyRector extends AbstractRector { /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\CodeQuality\NodeFactory\TypedPropertyFactory */ - private $typedPropertyFactory; + private TypedPropertyFactory $typedPropertyFactory; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(PhpAttributeAnalyzer $phpAttributeAnalyzer, PhpDocInfoFactory $phpDocInfoFactory, PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, TypedPropertyFactory $typedPropertyFactory, TestsNodeAnalyzer $testsNodeAnalyzer, ValueResolver $valueResolver) { $this->phpAttributeAnalyzer = $phpAttributeAnalyzer; @@ -173,10 +166,10 @@ CODE_SAMPLE continue; } // is property already defined? - if ($class->getProperty($propertyName)) { + if ($class->getProperty($propertyName) instanceof Property) { // improve exising one type if needed $existingProperty = $class->getProperty($propertyName); - if ($existingProperty->type !== null) { + if ($existingProperty->type instanceof Node) { continue; } $defaultValue = $existingProperty->props[0]->default; diff --git a/rules/CodeQuality/Rector/Class_/InlineConstructorDefaultToPropertyRector.php b/rules/CodeQuality/Rector/Class_/InlineConstructorDefaultToPropertyRector.php index e04871bc0a8..313c4b7843e 100644 --- a/rules/CodeQuality/Rector/Class_/InlineConstructorDefaultToPropertyRector.php +++ b/rules/CodeQuality/Rector/Class_/InlineConstructorDefaultToPropertyRector.php @@ -24,9 +24,8 @@ final class InlineConstructorDefaultToPropertyRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; public function __construct(ExprAnalyzer $exprAnalyzer) { $this->exprAnalyzer = $exprAnalyzer; diff --git a/rules/CodeQuality/Rector/Empty_/SimplifyEmptyCheckOnEmptyArrayRector.php b/rules/CodeQuality/Rector/Empty_/SimplifyEmptyCheckOnEmptyArrayRector.php index 1c49e8ca071..fa27368fbb9 100644 --- a/rules/CodeQuality/Rector/Empty_/SimplifyEmptyCheckOnEmptyArrayRector.php +++ b/rules/CodeQuality/Rector/Empty_/SimplifyEmptyCheckOnEmptyArrayRector.php @@ -35,29 +35,24 @@ final class SimplifyEmptyCheckOnEmptyArrayRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\AllAssignNodePropertyTypeInferer */ - private $allAssignNodePropertyTypeInferer; + private AllAssignNodePropertyTypeInferer $allAssignNodePropertyTypeInferer; /** * @readonly - * @var \Rector\Php\ReservedKeywordAnalyzer */ - private $reservedKeywordAnalyzer; + private ReservedKeywordAnalyzer $reservedKeywordAnalyzer; public function __construct(ExprAnalyzer $exprAnalyzer, ReflectionResolver $reflectionResolver, AstResolver $astResolver, AllAssignNodePropertyTypeInferer $allAssignNodePropertyTypeInferer, ReservedKeywordAnalyzer $reservedKeywordAnalyzer) { $this->exprAnalyzer = $exprAnalyzer; diff --git a/rules/CodeQuality/Rector/Expression/InlineIfToExplicitIfRector.php b/rules/CodeQuality/Rector/Expression/InlineIfToExplicitIfRector.php index ce0f33ddc4a..9ea6e00bb7a 100644 --- a/rules/CodeQuality/Rector/Expression/InlineIfToExplicitIfRector.php +++ b/rules/CodeQuality/Rector/Expression/InlineIfToExplicitIfRector.php @@ -22,9 +22,8 @@ final class InlineIfToExplicitIfRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\BinaryOpManipulator */ - private $binaryOpManipulator; + private BinaryOpManipulator $binaryOpManipulator; public function __construct(BinaryOpManipulator $binaryOpManipulator) { $this->binaryOpManipulator = $binaryOpManipulator; diff --git a/rules/CodeQuality/Rector/Expression/TernaryFalseExpressionToIfRector.php b/rules/CodeQuality/Rector/Expression/TernaryFalseExpressionToIfRector.php index 4c376648cbc..48643a825d0 100644 --- a/rules/CodeQuality/Rector/Expression/TernaryFalseExpressionToIfRector.php +++ b/rules/CodeQuality/Rector/Expression/TernaryFalseExpressionToIfRector.php @@ -20,9 +20,8 @@ final class TernaryFalseExpressionToIfRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; public function __construct(ExprAnalyzer $exprAnalyzer) { $this->exprAnalyzer = $exprAnalyzer; diff --git a/rules/CodeQuality/Rector/Foreach_/ForeachItemsAssignToEmptyArrayToAssignRector.php b/rules/CodeQuality/Rector/Foreach_/ForeachItemsAssignToEmptyArrayToAssignRector.php index e8d8eac7dfd..6539eb91937 100644 --- a/rules/CodeQuality/Rector/Foreach_/ForeachItemsAssignToEmptyArrayToAssignRector.php +++ b/rules/CodeQuality/Rector/Foreach_/ForeachItemsAssignToEmptyArrayToAssignRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\CodeQuality\Rector\Foreach_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrayDimFetch; @@ -11,7 +12,6 @@ use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Foreach_; -use PhpParser\NodeTraverser; use Rector\CodeQuality\NodeAnalyzer\ForeachAnalyzer; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\PhpParser\Node\Value\ValueResolver; @@ -25,14 +25,12 @@ final class ForeachItemsAssignToEmptyArrayToAssignRector extends AbstractRector { /** * @readonly - * @var \Rector\CodeQuality\NodeAnalyzer\ForeachAnalyzer */ - private $foreachAnalyzer; + private ForeachAnalyzer $foreachAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ForeachAnalyzer $foreachAnalyzer, ValueResolver $valueResolver) { $this->foreachAnalyzer = $foreachAnalyzer; @@ -116,12 +114,12 @@ CODE_SAMPLE if ($subNode instanceof Assign && $subNode->var instanceof ArrayDimFetch) { $isAppend = $this->isNames($subNode->var->var, $emptyArrayVariables); if ($isAppend) { - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } } if ($subNode instanceof Assign && $subNode->var instanceof Variable && $this->isNames($subNode->var, $emptyArrayVariables) && !$this->valueResolver->isValue($subNode->expr, [])) { $isAppend = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } return null; }); diff --git a/rules/CodeQuality/Rector/Foreach_/ForeachToInArrayRector.php b/rules/CodeQuality/Rector/Foreach_/ForeachToInArrayRector.php index 4cf9b2b8c3e..56e745d2b96 100644 --- a/rules/CodeQuality/Rector/Foreach_/ForeachToInArrayRector.php +++ b/rules/CodeQuality/Rector/Foreach_/ForeachToInArrayRector.php @@ -28,19 +28,16 @@ final class ForeachToInArrayRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\BinaryOpManipulator */ - private $binaryOpManipulator; + private BinaryOpManipulator $binaryOpManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \PhpParser\NodeFinder */ - private $nodeFinder; + private NodeFinder $nodeFinder; public function __construct(BinaryOpManipulator $binaryOpManipulator, ValueResolver $valueResolver, NodeFinder $nodeFinder) { $this->binaryOpManipulator = $binaryOpManipulator; @@ -165,9 +162,7 @@ CODE_SAMPLE */ private function matchNodes($binaryOp, Expr $expr) : ?TwoNodeMatch { - return $this->binaryOpManipulator->matchFirstAndSecondConditionNode($binaryOp, Variable::class, function (Node $node, Node $otherNode) use($expr) : bool { - return $this->nodeComparator->areNodesEqual($otherNode, $expr); - }); + return $this->binaryOpManipulator->matchFirstAndSecondConditionNode($binaryOp, Variable::class, fn(Node $node, Node $otherNode): bool => $this->nodeComparator->areNodesEqual($otherNode, $expr)); } private function isIfBodyABoolReturnNode(If_ $if) : bool { diff --git a/rules/CodeQuality/Rector/Foreach_/UnusedForeachValueToArrayKeysRector.php b/rules/CodeQuality/Rector/Foreach_/UnusedForeachValueToArrayKeysRector.php index b09ee4db535..dec7efaffdc 100644 --- a/rules/CodeQuality/Rector/Foreach_/UnusedForeachValueToArrayKeysRector.php +++ b/rules/CodeQuality/Rector/Foreach_/UnusedForeachValueToArrayKeysRector.php @@ -5,8 +5,8 @@ namespace Rector\CodeQuality\Rector\Foreach_; use PhpParser\Node; use PhpParser\Node\Expr; -use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; +use PhpParser\Node\Expr\List_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\Foreach_; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; @@ -23,19 +23,16 @@ final class UnusedForeachValueToArrayKeysRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\NodeAnalyzer\ExprUsedInNodeAnalyzer */ - private $exprUsedInNodeAnalyzer; + private ExprUsedInNodeAnalyzer $exprUsedInNodeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeManipulator\StmtsManipulator */ - private $stmtsManipulator; + private StmtsManipulator $stmtsManipulator; public function __construct(ExprUsedInNodeAnalyzer $exprUsedInNodeAnalyzer, BetterNodeFinder $betterNodeFinder, StmtsManipulator $stmtsManipulator) { $this->exprUsedInNodeAnalyzer = $exprUsedInNodeAnalyzer; @@ -98,13 +95,14 @@ CODE_SAMPLE continue; } // special case of nested array items - if ($stmt->valueVar instanceof Array_) { + if ($stmt->valueVar instanceof List_) { $valueArray = $this->refactorArrayForeachValue($stmt->valueVar, $stmt); - if ($valueArray instanceof Array_) { - $stmt->valueVar = $valueArray; + if (!$valueArray instanceof List_) { + continue; } + $stmt->valueVar = $valueArray; // not sure what does this mean :) - if ($stmt->valueVar->items !== []) { + if ($valueArray->items !== []) { continue; } $hasChanged = \true; @@ -131,10 +129,10 @@ CODE_SAMPLE /** * @param int[] $removedKeys */ - private function isArrayItemsRemovalWithoutChangingOrder(Array_ $array, array $removedKeys) : bool + private function isArrayItemsRemovalWithoutChangingOrder(List_ $list, array $removedKeys) : bool { $hasRemovingStarted = \false; - foreach (\array_keys($array->items) as $key) { + foreach (\array_keys($list->items) as $key) { if (\in_array($key, $removedKeys, \true)) { $hasRemovingStarted = \true; } elseif ($hasRemovingStarted) { @@ -144,11 +142,11 @@ CODE_SAMPLE } return \true; } - private function refactorArrayForeachValue(Array_ $array, Foreach_ $foreach) : ?Array_ + private function refactorArrayForeachValue(List_ $list, Foreach_ $foreach) : ?List_ { // only last items can be removed, without changing the order $removedKeys = []; - foreach ($array->items as $key => $arrayItem) { + foreach ($list->items as $key => $arrayItem) { if (!$arrayItem instanceof ArrayItem) { // only known values can be processes return null; @@ -163,20 +161,18 @@ CODE_SAMPLE } $removedKeys[] = $key; } - if (!$this->isArrayItemsRemovalWithoutChangingOrder($array, $removedKeys)) { + if (!$this->isArrayItemsRemovalWithoutChangingOrder($list, $removedKeys)) { return null; } // clear removed items foreach ($removedKeys as $removedKey) { - unset($array->items[$removedKey]); + unset($list->items[$removedKey]); } - return $array; + return $list; } private function isVariableUsedInForeach(Variable $variable, Foreach_ $foreach) : bool { - return (bool) $this->betterNodeFinder->findFirst($foreach->stmts, function (Node $node) use($variable) : bool { - return $this->exprUsedInNodeAnalyzer->isUsed($node, $variable); - }); + return (bool) $this->betterNodeFinder->findFirst($foreach->stmts, fn(Node $node): bool => $this->exprUsedInNodeAnalyzer->isUsed($node, $variable)); } private function removeForeachValueAndUseArrayKeys(Foreach_ $foreach, Expr $keyVarExpr) : void { diff --git a/rules/CodeQuality/Rector/FuncCall/ArrayMergeOfNonArraysToSimpleArrayRector.php b/rules/CodeQuality/Rector/FuncCall/ArrayMergeOfNonArraysToSimpleArrayRector.php index 683b86a56bf..6085391c3f6 100644 --- a/rules/CodeQuality/Rector/FuncCall/ArrayMergeOfNonArraysToSimpleArrayRector.php +++ b/rules/CodeQuality/Rector/FuncCall/ArrayMergeOfNonArraysToSimpleArrayRector.php @@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Rector\FuncCall; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\FuncCall; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; diff --git a/rules/CodeQuality/Rector/FuncCall/CallUserFuncWithArrowFunctionToInlineRector.php b/rules/CodeQuality/Rector/FuncCall/CallUserFuncWithArrowFunctionToInlineRector.php index 188b1930868..4c99768cdd6 100644 --- a/rules/CodeQuality/Rector/FuncCall/CallUserFuncWithArrowFunctionToInlineRector.php +++ b/rules/CodeQuality/Rector/FuncCall/CallUserFuncWithArrowFunctionToInlineRector.php @@ -19,9 +19,8 @@ final class CallUserFuncWithArrowFunctionToInlineRector extends AbstractRector { /** * @readonly - * @var \Rector\Php74\NodeAnalyzer\ClosureArrowFunctionAnalyzer */ - private $closureArrowFunctionAnalyzer; + private ClosureArrowFunctionAnalyzer $closureArrowFunctionAnalyzer; public function __construct(ClosureArrowFunctionAnalyzer $closureArrowFunctionAnalyzer) { $this->closureArrowFunctionAnalyzer = $closureArrowFunctionAnalyzer; diff --git a/rules/CodeQuality/Rector/FuncCall/CompactToVariablesRector.php b/rules/CodeQuality/Rector/FuncCall/CompactToVariablesRector.php index 4aae925a6e1..b429b35d068 100644 --- a/rules/CodeQuality/Rector/FuncCall/CompactToVariablesRector.php +++ b/rules/CodeQuality/Rector/FuncCall/CompactToVariablesRector.php @@ -5,7 +5,7 @@ namespace Rector\CodeQuality\Rector\FuncCall; use PhpParser\Node; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Scalar\String_; @@ -23,9 +23,8 @@ final class CompactToVariablesRector extends AbstractRector { /** * @readonly - * @var \Rector\CodeQuality\CompactConverter */ - private $compactConverter; + private CompactConverter $compactConverter; public function __construct(CompactConverter $compactConverter) { $this->compactConverter = $compactConverter; diff --git a/rules/CodeQuality/Rector/FuncCall/SetTypeToCastRector.php b/rules/CodeQuality/Rector/FuncCall/SetTypeToCastRector.php index a5b5512d637..77e25bd0156 100644 --- a/rules/CodeQuality/Rector/FuncCall/SetTypeToCastRector.php +++ b/rules/CodeQuality/Rector/FuncCall/SetTypeToCastRector.php @@ -3,10 +3,11 @@ declare (strict_types=1); namespace Rector\CodeQuality\Rector\FuncCall; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\Cast; use PhpParser\Node\Expr\Cast\Array_; @@ -17,7 +18,6 @@ use PhpParser\Node\Expr\Cast\Object_; use PhpParser\Node\Expr\Cast\String_; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Stmt\Expression; -use PhpParser\NodeTraverser; use Rector\PhpParser\Node\Value\ValueResolver; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -29,9 +29,8 @@ final class SetTypeToCastRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var array> */ @@ -78,7 +77,7 @@ CODE_SAMPLE return [FuncCall::class, Expression::class, Assign::class, ArrayItem::class, Arg::class]; } /** - * @param FuncCall|Expression|Assign|Expr\ArrayItem|Node\Arg $node + * @param FuncCall|Expression|Assign|ArrayItem|Node\Arg $node * @return null|int|\PhpParser\Node\Stmt\Expression|\PhpParser\Node\Expr\Assign|\PhpParser\Node\Expr\Cast */ public function refactor(Node $node) @@ -93,7 +92,7 @@ CODE_SAMPLE if (!$this->isSetTypeFuncCall($node->expr)) { return null; } - return NodeTraverser::DONT_TRAVERSE_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CHILDREN; } if ($node instanceof Expression) { if (!$node->expr instanceof FuncCall) { diff --git a/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php b/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php index 877da71b9db..2a62a3b3fd9 100644 --- a/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php +++ b/rules/CodeQuality/Rector/FuncCall/SimplifyRegexPatternRector.php @@ -17,9 +17,8 @@ final class SimplifyRegexPatternRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeNameResolver\Regex\RegexPatternDetector */ - private $regexPatternDetector; + private RegexPatternDetector $regexPatternDetector; /** * @var array */ diff --git a/rules/CodeQuality/Rector/FuncCall/SingleInArrayToCompareRector.php b/rules/CodeQuality/Rector/FuncCall/SingleInArrayToCompareRector.php index 78205b23562..c31a9d19e26 100644 --- a/rules/CodeQuality/Rector/FuncCall/SingleInArrayToCompareRector.php +++ b/rules/CodeQuality/Rector/FuncCall/SingleInArrayToCompareRector.php @@ -6,7 +6,7 @@ namespace Rector\CodeQuality\Rector\FuncCall; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\BinaryOp\Equal; use PhpParser\Node\Expr\BinaryOp\Identical; use PhpParser\Node\Expr\BinaryOp\NotEqual; diff --git a/rules/CodeQuality/Rector/FunctionLike/SimplifyUselessVariableRector.php b/rules/CodeQuality/Rector/FunctionLike/SimplifyUselessVariableRector.php index e755d08e019..f4155fe3f8b 100644 --- a/rules/CodeQuality/Rector/FunctionLike/SimplifyUselessVariableRector.php +++ b/rules/CodeQuality/Rector/FunctionLike/SimplifyUselessVariableRector.php @@ -29,33 +29,26 @@ final class SimplifyUselessVariableRector extends AbstractRector implements Conf { /** * @readonly - * @var \Rector\PhpParser\Node\AssignAndBinaryMap */ - private $assignAndBinaryMap; + private AssignAndBinaryMap $assignAndBinaryMap; /** * @readonly - * @var \Rector\NodeAnalyzer\VariableAnalyzer */ - private $variableAnalyzer; + private VariableAnalyzer $variableAnalyzer; /** * @readonly - * @var \Rector\NodeAnalyzer\CallAnalyzer */ - private $callAnalyzer; + private CallAnalyzer $callAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @api * @var string */ public const ONLY_DIRECT_ASSIGN = 'only_direct_assign'; - /** - * @var bool - */ - private $onlyDirectAssign = \false; + private bool $onlyDirectAssign = \false; public function __construct(AssignAndBinaryMap $assignAndBinaryMap, VariableAnalyzer $variableAnalyzer, CallAnalyzer $callAnalyzer, PhpDocInfoFactory $phpDocInfoFactory) { $this->assignAndBinaryMap = $assignAndBinaryMap; diff --git a/rules/CodeQuality/Rector/Identical/FlipTypeControlToUseExclusiveTypeRector.php b/rules/CodeQuality/Rector/Identical/FlipTypeControlToUseExclusiveTypeRector.php index 668fdeaf98f..18ccbe73273 100644 --- a/rules/CodeQuality/Rector/Identical/FlipTypeControlToUseExclusiveTypeRector.php +++ b/rules/CodeQuality/Rector/Identical/FlipTypeControlToUseExclusiveTypeRector.php @@ -24,14 +24,12 @@ final class FlipTypeControlToUseExclusiveTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\TypeDeclaration\TypeAnalyzer\NullableTypeAnalyzer */ - private $nullableTypeAnalyzer; + private NullableTypeAnalyzer $nullableTypeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(NullableTypeAnalyzer $nullableTypeAnalyzer, ValueResolver $valueResolver) { $this->nullableTypeAnalyzer = $nullableTypeAnalyzer; diff --git a/rules/CodeQuality/Rector/Identical/SimplifyArraySearchRector.php b/rules/CodeQuality/Rector/Identical/SimplifyArraySearchRector.php index c9d75bd8caf..ce26bcf92ee 100644 --- a/rules/CodeQuality/Rector/Identical/SimplifyArraySearchRector.php +++ b/rules/CodeQuality/Rector/Identical/SimplifyArraySearchRector.php @@ -22,14 +22,12 @@ final class SimplifyArraySearchRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\BinaryOpManipulator */ - private $binaryOpManipulator; + private BinaryOpManipulator $binaryOpManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(BinaryOpManipulator $binaryOpManipulator, ValueResolver $valueResolver) { $this->binaryOpManipulator = $binaryOpManipulator; @@ -56,9 +54,7 @@ final class SimplifyArraySearchRector extends AbstractRector return \false; } return $this->nodeNameResolver->isName($node, 'array_search'); - }, function (Node $node) : bool { - return $node instanceof Expr && $this->valueResolver->isFalse($node); - }); + }, fn(Node $node): bool => $node instanceof Expr && $this->valueResolver->isFalse($node)); if (!$twoNodeMatch instanceof TwoNodeMatch) { return null; } diff --git a/rules/CodeQuality/Rector/Identical/SimplifyBoolIdenticalTrueRector.php b/rules/CodeQuality/Rector/Identical/SimplifyBoolIdenticalTrueRector.php index 065652184d7..6984cbe6797 100644 --- a/rules/CodeQuality/Rector/Identical/SimplifyBoolIdenticalTrueRector.php +++ b/rules/CodeQuality/Rector/Identical/SimplifyBoolIdenticalTrueRector.php @@ -19,9 +19,8 @@ final class SimplifyBoolIdenticalTrueRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/CodeQuality/Rector/Identical/SimplifyConditionsRector.php b/rules/CodeQuality/Rector/Identical/SimplifyConditionsRector.php index 92fd980c6b1..f3a75674882 100644 --- a/rules/CodeQuality/Rector/Identical/SimplifyConditionsRector.php +++ b/rules/CodeQuality/Rector/Identical/SimplifyConditionsRector.php @@ -24,19 +24,16 @@ final class SimplifyConditionsRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\AssignAndBinaryMap */ - private $assignAndBinaryMap; + private AssignAndBinaryMap $assignAndBinaryMap; /** * @readonly - * @var \Rector\NodeManipulator\BinaryOpManipulator */ - private $binaryOpManipulator; + private BinaryOpManipulator $binaryOpManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(AssignAndBinaryMap $assignAndBinaryMap, BinaryOpManipulator $binaryOpManipulator, ValueResolver $valueResolver) { $this->assignAndBinaryMap = $assignAndBinaryMap; @@ -76,11 +73,7 @@ final class SimplifyConditionsRector extends AbstractRector } private function processIdenticalAndNotIdentical(Identical $identical) : ?Node { - $twoNodeMatch = $this->binaryOpManipulator->matchFirstAndSecondConditionNode($identical, static function (Node $node) : bool { - return $node instanceof Identical || $node instanceof NotIdentical; - }, function (Node $node) : bool { - return $node instanceof Expr && $this->valueResolver->isTrueOrFalse($node); - }); + $twoNodeMatch = $this->binaryOpManipulator->matchFirstAndSecondConditionNode($identical, static fn(Node $node): bool => $node instanceof Identical || $node instanceof NotIdentical, fn(Node $node): bool => $node instanceof Expr && $this->valueResolver->isTrueOrFalse($node)); if (!$twoNodeMatch instanceof TwoNodeMatch) { return $twoNodeMatch; } diff --git a/rules/CodeQuality/Rector/Identical/StrlenZeroToIdenticalEmptyStringRector.php b/rules/CodeQuality/Rector/Identical/StrlenZeroToIdenticalEmptyStringRector.php index a1ed43b330f..bb33461cccc 100644 --- a/rules/CodeQuality/Rector/Identical/StrlenZeroToIdenticalEmptyStringRector.php +++ b/rules/CodeQuality/Rector/Identical/StrlenZeroToIdenticalEmptyStringRector.php @@ -19,9 +19,8 @@ final class StrlenZeroToIdenticalEmptyStringRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/CodeQuality/Rector/If_/CombineIfRector.php b/rules/CodeQuality/Rector/If_/CombineIfRector.php index 1b0c674daf3..57a7218cc73 100644 --- a/rules/CodeQuality/Rector/If_/CombineIfRector.php +++ b/rules/CodeQuality/Rector/If_/CombineIfRector.php @@ -4,6 +4,7 @@ declare (strict_types=1); namespace Rector\CodeQuality\Rector\If_; use PhpParser\Node; +use PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp\BooleanAnd; use PhpParser\Node\Stmt\Else_; use PhpParser\Node\Stmt\If_; @@ -22,14 +23,12 @@ final class CombineIfRector extends AbstractRector { /** * @readonly - * @var \Rector\BetterPhpDocParser\Comment\CommentsMerger */ - private $commentsMerger; + private CommentsMerger $commentsMerger; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(CommentsMerger $commentsMerger, PhpDocInfoFactory $phpDocInfoFactory) { $this->commentsMerger = $commentsMerger; @@ -84,6 +83,13 @@ CODE_SAMPLE return null; } $node->cond->setAttribute(AttributeKey::ORIGINAL_NODE, null); + $cond = $node->cond; + while ($cond instanceof BinaryOp) { + if (!$cond->right instanceof BinaryOp) { + $cond->right->setAttribute(AttributeKey::ORIGINAL_NODE, null); + } + $cond = $cond->right; + } $node->cond = new BooleanAnd($node->cond, $subIf->cond); $node->stmts = $subIf->stmts; $this->commentsMerger->keepComments($node, [$subIf]); diff --git a/rules/CodeQuality/Rector/If_/CompleteMissingIfElseBracketRector.php b/rules/CodeQuality/Rector/If_/CompleteMissingIfElseBracketRector.php index 70ea3da6aef..8fdc6fa561f 100644 --- a/rules/CodeQuality/Rector/If_/CompleteMissingIfElseBracketRector.php +++ b/rules/CodeQuality/Rector/If_/CompleteMissingIfElseBracketRector.php @@ -82,7 +82,7 @@ CODE_SAMPLE if ($i === $condEndTokenPos) { return \false; } - if (\in_array($oldTokens[$i], ['{', ':'], \true)) { + if (\in_array((string) $oldTokens[$i], ['{', ':'], \true)) { // all good return \true; } diff --git a/rules/CodeQuality/Rector/If_/ConsecutiveNullCompareReturnsToNullCoalesceQueueRector.php b/rules/CodeQuality/Rector/If_/ConsecutiveNullCompareReturnsToNullCoalesceQueueRector.php index 941aa004998..e60d48b337d 100644 --- a/rules/CodeQuality/Rector/If_/ConsecutiveNullCompareReturnsToNullCoalesceQueueRector.php +++ b/rules/CodeQuality/Rector/If_/ConsecutiveNullCompareReturnsToNullCoalesceQueueRector.php @@ -6,11 +6,11 @@ namespace Rector\CodeQuality\Rector\If_; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\BinaryOp\Coalesce; -use PhpParser\Node\Expr\Throw_ as ExprThrow_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\Return_; -use PhpParser\Node\Stmt\Throw_; +use PhpParser\Node\Expr\Throw_; +use PhpParser\Node\Stmt\Expression; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\NodeManipulator\IfManipulator; use Rector\PhpParser\Node\Value\ValueResolver; @@ -26,14 +26,12 @@ final class ConsecutiveNullCompareReturnsToNullCoalesceQueueRector extends Abstr { /** * @readonly - * @var \Rector\NodeManipulator\IfManipulator */ - private $ifManipulator; + private IfManipulator $ifManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(IfManipulator $ifManipulator, ValueResolver $valueResolver) { $this->ifManipulator = $ifManipulator; @@ -117,9 +115,9 @@ CODE_SAMPLE if (!$hasChanged) { continue; } - if ($stmt instanceof Throw_) { + if ($stmt instanceof Expression && $stmt->expr instanceof Throw_) { unset($node->stmts[$key]); - $appendExpr = new ExprThrow_($stmt->expr); + $appendExpr = $stmt->expr; continue; } if (!$this->isReturnNull($stmt)) { diff --git a/rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php b/rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php index 800f1c9ab8a..e77048d426a 100644 --- a/rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php +++ b/rules/CodeQuality/Rector/If_/ExplicitBoolCompareRector.php @@ -3,6 +3,8 @@ declare (strict_types=1); namespace Rector\CodeQuality\Rector\If_; +use PhpParser\Node\Scalar\Int_; +use PhpParser\Node\Scalar\Float_; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; @@ -18,8 +20,6 @@ use PhpParser\Node\Expr\Cast\Bool_; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Expr\Variable; -use PhpParser\Node\Scalar\DNumber; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\ElseIf_; @@ -40,19 +40,16 @@ final class ExplicitBoolCompareRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeTypeResolver\TypeAnalyzer\StringTypeAnalyzer */ - private $stringTypeAnalyzer; + private StringTypeAnalyzer $stringTypeAnalyzer; /** * @readonly - * @var \Rector\NodeTypeResolver\TypeAnalyzer\ArrayTypeAnalyzer */ - private $arrayTypeAnalyzer; + private ArrayTypeAnalyzer $arrayTypeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(StringTypeAnalyzer $stringTypeAnalyzer, ArrayTypeAnalyzer $arrayTypeAnalyzer, ValueResolver $valueResolver) { $this->stringTypeAnalyzer = $stringTypeAnalyzer; @@ -165,12 +162,12 @@ CODE_SAMPLE if ($countedType->isArray()->yes()) { return null; } - $lNumber = new LNumber(0); + $int = new Int_(0); // compare === 0, assumption if ($isNegated) { - return new Identical($funcCall, $lNumber); + return new Identical($funcCall, $int); } - return new Greater($funcCall, $lNumber); + return new Greater($funcCall, $int); } /** * @return Identical|NotIdentical|null @@ -234,22 +231,22 @@ CODE_SAMPLE */ private function resolveInteger(bool $isNegated, Expr $expr) { - $lNumber = new LNumber(0); + $int = new Int_(0); if ($isNegated) { - return new Identical($expr, $lNumber); + return new Identical($expr, $int); } - return new NotIdentical($expr, $lNumber); + return new NotIdentical($expr, $int); } /** * @return \PhpParser\Node\Expr\BinaryOp\Identical|\PhpParser\Node\Expr\BinaryOp\NotIdentical */ private function resolveFloat(bool $isNegated, Expr $expr) { - $dNumber = new DNumber(0.0); + $float = new Float_(0.0); if ($isNegated) { - return new Identical($expr, $dNumber); + return new Identical($expr, $float); } - return new NotIdentical($expr, $dNumber); + return new NotIdentical($expr, $float); } /** * @return \PhpParser\Node\Expr\BinaryOp\Identical|\PhpParser\Node\Expr\BinaryOp\NotIdentical diff --git a/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php b/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php index 9ec551b6d8f..a930f189cd4 100644 --- a/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php +++ b/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php @@ -23,14 +23,12 @@ final class SimplifyIfElseToTernaryRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @var int */ diff --git a/rules/CodeQuality/Rector/If_/SimplifyIfNotNullReturnRector.php b/rules/CodeQuality/Rector/If_/SimplifyIfNotNullReturnRector.php index d74f476cb10..f0344564b00 100644 --- a/rules/CodeQuality/Rector/If_/SimplifyIfNotNullReturnRector.php +++ b/rules/CodeQuality/Rector/If_/SimplifyIfNotNullReturnRector.php @@ -21,14 +21,12 @@ final class SimplifyIfNotNullReturnRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\IfManipulator */ - private $ifManipulator; + private IfManipulator $ifManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(IfManipulator $ifManipulator, ValueResolver $valueResolver) { $this->ifManipulator = $ifManipulator; diff --git a/rules/CodeQuality/Rector/If_/SimplifyIfNullableReturnRector.php b/rules/CodeQuality/Rector/If_/SimplifyIfNullableReturnRector.php index c47701ce778..f0e260e7f5c 100644 --- a/rules/CodeQuality/Rector/If_/SimplifyIfNullableReturnRector.php +++ b/rules/CodeQuality/Rector/If_/SimplifyIfNullableReturnRector.php @@ -32,24 +32,20 @@ final class SimplifyIfNullableReturnRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\IfManipulator */ - private $ifManipulator; + private IfManipulator $ifManipulator; /** * @readonly - * @var \Rector\CodeQuality\TypeResolver\AssignVariableTypeResolver */ - private $assignVariableTypeResolver; + private AssignVariableTypeResolver $assignVariableTypeResolver; /** * @readonly - * @var \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover */ - private $varTagRemover; + private VarTagRemover $varTagRemover; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(IfManipulator $ifManipulator, AssignVariableTypeResolver $assignVariableTypeResolver, VarTagRemover $varTagRemover, ValueResolver $valueResolver) { $this->ifManipulator = $ifManipulator; diff --git a/rules/CodeQuality/Rector/If_/SimplifyIfReturnBoolRector.php b/rules/CodeQuality/Rector/If_/SimplifyIfReturnBoolRector.php index 63fcdb3d68f..a8eb2081496 100644 --- a/rules/CodeQuality/Rector/If_/SimplifyIfReturnBoolRector.php +++ b/rules/CodeQuality/Rector/If_/SimplifyIfReturnBoolRector.php @@ -16,6 +16,7 @@ use PhpParser\Node\Stmt\Return_; use Rector\BetterPhpDocParser\Comment\CommentsMerger; use Rector\CodeQuality\NodeManipulator\ExprBoolCaster; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; +use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PhpParser\Node\Value\ValueResolver; use Rector\PhpParser\Printer\BetterStandardPrinter; use Rector\Rector\AbstractRector; @@ -28,24 +29,20 @@ final class SimplifyIfReturnBoolRector extends AbstractRector { /** * @readonly - * @var \Rector\BetterPhpDocParser\Comment\CommentsMerger */ - private $commentsMerger; + private CommentsMerger $commentsMerger; /** * @readonly - * @var \Rector\CodeQuality\NodeManipulator\ExprBoolCaster */ - private $exprBoolCaster; + private ExprBoolCaster $exprBoolCaster; /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(CommentsMerger $commentsMerger, ExprBoolCaster $exprBoolCaster, BetterStandardPrinter $betterStandardPrinter, ValueResolver $valueResolver) { $this->commentsMerger = $commentsMerger; @@ -101,6 +98,7 @@ CODE_SAMPLE if (!$innerIfInnerNode instanceof Expr) { continue; } + $if->cond->setAttribute(AttributeKey::ORIGINAL_NODE, null); $newReturn = $this->resolveReturn($innerIfInnerNode, $if, $return); if (!$newReturn instanceof Return_) { continue; diff --git a/rules/CodeQuality/Rector/Include_/AbsolutizeRequireAndIncludePathRector.php b/rules/CodeQuality/Rector/Include_/AbsolutizeRequireAndIncludePathRector.php index 74a93b3b581..d4250b26591 100644 --- a/rules/CodeQuality/Rector/Include_/AbsolutizeRequireAndIncludePathRector.php +++ b/rules/CodeQuality/Rector/Include_/AbsolutizeRequireAndIncludePathRector.php @@ -20,9 +20,8 @@ final class AbsolutizeRequireAndIncludePathRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/CodeQuality/Rector/Isset_/IssetOnPropertyObjectToPropertyExistsRector.php b/rules/CodeQuality/Rector/Isset_/IssetOnPropertyObjectToPropertyExistsRector.php index 81481006c75..8d0da6a1145 100644 --- a/rules/CodeQuality/Rector/Isset_/IssetOnPropertyObjectToPropertyExistsRector.php +++ b/rules/CodeQuality/Rector/Isset_/IssetOnPropertyObjectToPropertyExistsRector.php @@ -33,19 +33,16 @@ final class IssetOnPropertyObjectToPropertyExistsRector extends AbstractRector { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ReflectionProvider $reflectionProvider, ReflectionResolver $reflectionResolver, ValueResolver $valueResolver) { $this->reflectionProvider = $reflectionProvider; diff --git a/rules/CodeQuality/Rector/LogicalAnd/LogicalToBooleanRector.php b/rules/CodeQuality/Rector/LogicalAnd/LogicalToBooleanRector.php index 826e2a8ffcc..a846e96e712 100644 --- a/rules/CodeQuality/Rector/LogicalAnd/LogicalToBooleanRector.php +++ b/rules/CodeQuality/Rector/LogicalAnd/LogicalToBooleanRector.php @@ -39,8 +39,9 @@ CODE_SAMPLE } /** * @param LogicalOr|LogicalAnd $node + * @return \PhpParser\Node\Expr\BinaryOp\BooleanAnd|\PhpParser\Node\Expr\BinaryOp\BooleanOr */ - public function refactor(Node $node) : ?Node + public function refactor(Node $node) { return $this->refactorLogicalToBoolean($node); } diff --git a/rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php b/rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php index dd788954a7a..cfb1901a428 100644 --- a/rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php +++ b/rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php @@ -61,10 +61,7 @@ CODE_SAMPLE $tokenEndPos = $notEqual->getEndTokenPos(); for ($i = $tokenStartPos; $i < $tokenEndPos; ++$i) { $token = $this->file->getOldTokens()[$i]; - if (!isset($token[1])) { - continue; - } - if ($token[1] === '<>') { + if ((string) $token === '<>') { return \true; } } diff --git a/rules/CodeQuality/Rector/NullsafeMethodCall/CleanupUnneededNullsafeOperatorRector.php b/rules/CodeQuality/Rector/NullsafeMethodCall/CleanupUnneededNullsafeOperatorRector.php index 85e8a9ec7ee..0e0b96b7397 100644 --- a/rules/CodeQuality/Rector/NullsafeMethodCall/CleanupUnneededNullsafeOperatorRector.php +++ b/rules/CodeQuality/Rector/NullsafeMethodCall/CleanupUnneededNullsafeOperatorRector.php @@ -25,9 +25,8 @@ final class CleanupUnneededNullsafeOperatorRector extends AbstractRector impleme { /** * @readonly - * @var \Rector\TypeDeclaration\TypeAnalyzer\ReturnStrictTypeAnalyzer */ - private $returnStrictTypeAnalyzer; + private ReturnStrictTypeAnalyzer $returnStrictTypeAnalyzer; public function __construct(ReturnStrictTypeAnalyzer $returnStrictTypeAnalyzer) { $this->returnStrictTypeAnalyzer = $returnStrictTypeAnalyzer; diff --git a/rules/CodeQuality/Rector/Switch_/SingularSwitchToIfRector.php b/rules/CodeQuality/Rector/Switch_/SingularSwitchToIfRector.php index f8835ebb0c2..09764980738 100644 --- a/rules/CodeQuality/Rector/Switch_/SingularSwitchToIfRector.php +++ b/rules/CodeQuality/Rector/Switch_/SingularSwitchToIfRector.php @@ -21,9 +21,8 @@ final class SingularSwitchToIfRector extends AbstractRector { /** * @readonly - * @var \Rector\Renaming\NodeManipulator\SwitchManipulator */ - private $switchManipulator; + private SwitchManipulator $switchManipulator; public function __construct(SwitchManipulator $switchManipulator) { $this->switchManipulator = $switchManipulator; @@ -81,9 +80,7 @@ CODE_SAMPLE // only default → basically unwrap if (!$onlyCase->cond instanceof Expr) { // remove default clause because it cause syntax error - return \array_filter($onlyCase->stmts, static function (Stmt $stmt) : bool { - return !$stmt instanceof Break_; - }); + return \array_filter($onlyCase->stmts, static fn(Stmt $stmt): bool => !$stmt instanceof Break_); } $if = new If_(new Identical($node->cond, $onlyCase->cond)); $if->stmts = $this->switchManipulator->removeBreakNodes($onlyCase->stmts); diff --git a/rules/CodeQuality/Rector/Switch_/SwitchTrueToIfRector.php b/rules/CodeQuality/Rector/Switch_/SwitchTrueToIfRector.php index 7122b0a442f..97f141a514c 100644 --- a/rules/CodeQuality/Rector/Switch_/SwitchTrueToIfRector.php +++ b/rules/CodeQuality/Rector/Switch_/SwitchTrueToIfRector.php @@ -21,9 +21,8 @@ final class SwitchTrueToIfRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/CodeQuality/Rector/Ternary/ArrayKeyExistsTernaryThenValueToCoalescingRector.php b/rules/CodeQuality/Rector/Ternary/ArrayKeyExistsTernaryThenValueToCoalescingRector.php index 8c6a4140c5d..ee877d0dcac 100644 --- a/rules/CodeQuality/Rector/Ternary/ArrayKeyExistsTernaryThenValueToCoalescingRector.php +++ b/rules/CodeQuality/Rector/Ternary/ArrayKeyExistsTernaryThenValueToCoalescingRector.php @@ -20,9 +20,8 @@ final class ArrayKeyExistsTernaryThenValueToCoalescingRector extends AbstractRec { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/CodeQuality/Rector/Ternary/SimplifyTautologyTernaryRector.php b/rules/CodeQuality/Rector/Ternary/SimplifyTautologyTernaryRector.php index e8c4f150f4f..f6de3841b48 100644 --- a/rules/CodeQuality/Rector/Ternary/SimplifyTautologyTernaryRector.php +++ b/rules/CodeQuality/Rector/Ternary/SimplifyTautologyTernaryRector.php @@ -19,9 +19,8 @@ final class SimplifyTautologyTernaryRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\BinaryOpManipulator */ - private $binaryOpManipulator; + private BinaryOpManipulator $binaryOpManipulator; public function __construct(BinaryOpManipulator $binaryOpManipulator) { $this->binaryOpManipulator = $binaryOpManipulator; @@ -45,11 +44,7 @@ final class SimplifyTautologyTernaryRector extends AbstractRector if (!$node->cond instanceof NotIdentical && !$node->cond instanceof Identical) { return null; } - $twoNodeMatch = $this->binaryOpManipulator->matchFirstAndSecondConditionNode($node->cond, function (Node $leftNode) use($node) : bool { - return $this->nodeComparator->areNodesEqual($leftNode, $node->if); - }, function (Node $leftNode) use($node) : bool { - return $this->nodeComparator->areNodesEqual($leftNode, $node->else); - }); + $twoNodeMatch = $this->binaryOpManipulator->matchFirstAndSecondConditionNode($node->cond, fn(Node $leftNode): bool => $this->nodeComparator->areNodesEqual($leftNode, $node->if), fn(Node $leftNode): bool => $this->nodeComparator->areNodesEqual($leftNode, $node->else)); if (!$twoNodeMatch instanceof TwoNodeMatch) { return null; } diff --git a/rules/CodeQuality/Rector/Ternary/SwitchNegatedTernaryRector.php b/rules/CodeQuality/Rector/Ternary/SwitchNegatedTernaryRector.php index 3eb6131c4fc..484c166b9b2 100644 --- a/rules/CodeQuality/Rector/Ternary/SwitchNegatedTernaryRector.php +++ b/rules/CodeQuality/Rector/Ternary/SwitchNegatedTernaryRector.php @@ -61,12 +61,19 @@ CODE_SAMPLE return null; } $node->cond = $node->cond->expr; - [$node->if, $node->else] = [$node->else, $node->if]; + $else = clone $node->else; + $if = clone $node->if; + $node->else = $if; + $node->if = $else; if ($node->if instanceof Ternary) { $ternary = $node->if; $ternary->setAttribute(AttributeKey::KIND, 'wrapped_with_brackets'); $ternary->setAttribute(AttributeKey::ORIGINAL_NODE, null); } + if ($node->else instanceof Ternary) { + $ternary = $node->else; + $ternary->setAttribute(AttributeKey::ORIGINAL_NODE, null); + } return $node; } } diff --git a/rules/CodeQuality/Rector/Ternary/UnnecessaryTernaryExpressionRector.php b/rules/CodeQuality/Rector/Ternary/UnnecessaryTernaryExpressionRector.php index c4491004bd6..02aafefb158 100644 --- a/rules/CodeQuality/Rector/Ternary/UnnecessaryTernaryExpressionRector.php +++ b/rules/CodeQuality/Rector/Ternary/UnnecessaryTernaryExpressionRector.php @@ -21,14 +21,12 @@ final class UnnecessaryTernaryExpressionRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\AssignAndBinaryMap */ - private $assignAndBinaryMap; + private AssignAndBinaryMap $assignAndBinaryMap; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(AssignAndBinaryMap $assignAndBinaryMap, ValueResolver $valueResolver) { $this->assignAndBinaryMap = $assignAndBinaryMap; diff --git a/rules/CodeQuality/TypeResolver/ArrayDimFetchTypeResolver.php b/rules/CodeQuality/TypeResolver/ArrayDimFetchTypeResolver.php index cb36f025dc9..ba31fd488fc 100644 --- a/rules/CodeQuality/TypeResolver/ArrayDimFetchTypeResolver.php +++ b/rules/CodeQuality/TypeResolver/ArrayDimFetchTypeResolver.php @@ -14,9 +14,8 @@ final class ArrayDimFetchTypeResolver { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeTypeResolver $nodeTypeResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/rules/CodeQuality/TypeResolver/AssignVariableTypeResolver.php b/rules/CodeQuality/TypeResolver/AssignVariableTypeResolver.php index eec6e0213b6..ed315025b63 100644 --- a/rules/CodeQuality/TypeResolver/AssignVariableTypeResolver.php +++ b/rules/CodeQuality/TypeResolver/AssignVariableTypeResolver.php @@ -11,9 +11,8 @@ final class AssignVariableTypeResolver { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeTypeResolver $nodeTypeResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/rules/CodeQuality/ValueObject/KeyAndExpr.php b/rules/CodeQuality/ValueObject/KeyAndExpr.php index 41542b65f84..3b50d784824 100644 --- a/rules/CodeQuality/ValueObject/KeyAndExpr.php +++ b/rules/CodeQuality/ValueObject/KeyAndExpr.php @@ -9,19 +9,17 @@ final class KeyAndExpr { /** * @readonly - * @var \PhpParser\Node\Expr|null */ - private $keyExpr; + private ?Expr $keyExpr; /** * @readonly - * @var \PhpParser\Node\Expr */ - private $expr; + private Expr $expr; /** * @var Comment[] * @readonly */ - private $comments; + private array $comments; /** * @param Comment[] $comments */ diff --git a/rules/CodingStyle/Application/UseImportsAdder.php b/rules/CodingStyle/Application/UseImportsAdder.php index 406ad6aa71e..d12307d79d9 100644 --- a/rules/CodingStyle/Application/UseImportsAdder.php +++ b/rules/CodingStyle/Application/UseImportsAdder.php @@ -22,14 +22,12 @@ final class UseImportsAdder { /** * @readonly - * @var \Rector\CodingStyle\ClassNameImport\UsedImportsResolver */ - private $usedImportsResolver; + private UsedImportsResolver $usedImportsResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; public function __construct(UsedImportsResolver $usedImportsResolver, TypeFactory $typeFactory) { $this->usedImportsResolver = $usedImportsResolver; diff --git a/rules/CodingStyle/Application/UseImportsRemover.php b/rules/CodingStyle/Application/UseImportsRemover.php index 9508d7a8951..649461c7056 100644 --- a/rules/CodingStyle/Application/UseImportsRemover.php +++ b/rules/CodingStyle/Application/UseImportsRemover.php @@ -10,9 +10,8 @@ final class UseImportsRemover { /** * @readonly - * @var \Rector\Renaming\Collector\RenamedNameCollector */ - private $renamedNameCollector; + private RenamedNameCollector $renamedNameCollector; public function __construct(RenamedNameCollector $renamedNameCollector) { $this->renamedNameCollector = $renamedNameCollector; diff --git a/rules/CodingStyle/ClassNameImport/AliasUsesResolver.php b/rules/CodingStyle/ClassNameImport/AliasUsesResolver.php index 8eeb7e53cc1..ecd7e66be33 100644 --- a/rules/CodingStyle/ClassNameImport/AliasUsesResolver.php +++ b/rules/CodingStyle/ClassNameImport/AliasUsesResolver.php @@ -3,20 +3,19 @@ declare (strict_types=1); namespace Rector\CodingStyle\ClassNameImport; +use PhpParser\Node\UseItem; use PhpParser\Node; use PhpParser\Node\Identifier; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Namespace_; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace; final class AliasUsesResolver { /** * @readonly - * @var \Rector\CodingStyle\ClassNameImport\UseImportsTraverser */ - private $useImportsTraverser; + private \Rector\CodingStyle\ClassNameImport\UseImportsTraverser $useImportsTraverser; public function __construct(\Rector\CodingStyle\ClassNameImport\UseImportsTraverser $useImportsTraverser) { $this->useImportsTraverser = $useImportsTraverser; @@ -29,9 +28,7 @@ final class AliasUsesResolver { if (!$node instanceof Namespace_ && !$node instanceof FileWithoutNamespace) { /** @var Namespace_[]|FileWithoutNamespace[] $namespaces */ - $namespaces = \array_filter($stmts, static function (Stmt $stmt) : bool { - return $stmt instanceof Namespace_ || $stmt instanceof FileWithoutNamespace; - }); + $namespaces = \array_filter($stmts, static fn(Stmt $stmt): bool => $stmt instanceof Namespace_ || $stmt instanceof FileWithoutNamespace); if (\count($namespaces) !== 1) { return []; } @@ -47,11 +44,11 @@ final class AliasUsesResolver { $aliasedUses = []; /** @param Use_::TYPE_* $useType */ - $this->useImportsTraverser->traverserStmts($stmts, static function (int $useType, UseUse $useUse, string $name) use(&$aliasedUses) : void { + $this->useImportsTraverser->traverserStmts($stmts, static function (int $useType, UseItem $useItem, string $name) use(&$aliasedUses) : void { if ($useType !== Use_::TYPE_NORMAL) { return; } - if (!$useUse->alias instanceof Identifier) { + if (!$useItem->alias instanceof Identifier) { return; } $aliasedUses[] = $name; diff --git a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/AliasClassNameImportSkipVoter.php b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/AliasClassNameImportSkipVoter.php index 80bcef99a4d..215cd9c83a7 100644 --- a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/AliasClassNameImportSkipVoter.php +++ b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/AliasClassNameImportSkipVoter.php @@ -21,9 +21,8 @@ final class AliasClassNameImportSkipVoter implements ClassNameImportSkipVoterInt { /** * @readonly - * @var \Rector\CodingStyle\ClassNameImport\AliasUsesResolver */ - private $aliasUsesResolver; + private AliasUsesResolver $aliasUsesResolver; public function __construct(AliasUsesResolver $aliasUsesResolver) { $this->aliasUsesResolver = $aliasUsesResolver; diff --git a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/ClassLikeNameClassNameImportSkipVoter.php b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/ClassLikeNameClassNameImportSkipVoter.php index 20f611ee094..d03eb3033ea 100644 --- a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/ClassLikeNameClassNameImportSkipVoter.php +++ b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/ClassLikeNameClassNameImportSkipVoter.php @@ -21,9 +21,8 @@ final class ClassLikeNameClassNameImportSkipVoter implements ClassNameImportSkip { /** * @readonly - * @var \Rector\CodingStyle\ClassNameImport\ShortNameResolver */ - private $shortNameResolver; + private ShortNameResolver $shortNameResolver; public function __construct(ShortNameResolver $shortNameResolver) { $this->shortNameResolver = $shortNameResolver; diff --git a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/FullyQualifiedNameClassNameImportSkipVoter.php b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/FullyQualifiedNameClassNameImportSkipVoter.php index 9166d9f3016..b4ad7a3e096 100644 --- a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/FullyQualifiedNameClassNameImportSkipVoter.php +++ b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/FullyQualifiedNameClassNameImportSkipVoter.php @@ -22,9 +22,8 @@ final class FullyQualifiedNameClassNameImportSkipVoter implements ClassNameImpor { /** * @readonly - * @var \Rector\CodingStyle\ClassNameImport\ShortNameResolver */ - private $shortNameResolver; + private ShortNameResolver $shortNameResolver; public function __construct(ShortNameResolver $shortNameResolver) { $this->shortNameResolver = $shortNameResolver; diff --git a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/UsesClassNameImportSkipVoter.php b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/UsesClassNameImportSkipVoter.php index 58d0a044358..4169fcb58e4 100644 --- a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/UsesClassNameImportSkipVoter.php +++ b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/UsesClassNameImportSkipVoter.php @@ -19,9 +19,8 @@ final class UsesClassNameImportSkipVoter implements ClassNameImportSkipVoterInte { /** * @readonly - * @var \Rector\PostRector\Collector\UseNodesToAddCollector */ - private $useNodesToAddCollector; + private UseNodesToAddCollector $useNodesToAddCollector; public function __construct(UseNodesToAddCollector $useNodesToAddCollector) { $this->useNodesToAddCollector = $useNodesToAddCollector; diff --git a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipper.php b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipper.php index 57075fb38c9..d6709879dbd 100644 --- a/rules/CodingStyle/ClassNameImport/ClassNameImportSkipper.php +++ b/rules/CodingStyle/ClassNameImport/ClassNameImportSkipper.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\CodingStyle\ClassNameImport; +use PhpParser\Node\UseItem; use PhpParser\Node; use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Stmt\GroupUse; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; use Rector\CodingStyle\Contract\ClassNameImport\ClassNameImportSkipVoterInterface; use Rector\Configuration\Option; use Rector\Configuration\Parameter\SimpleParameterProvider; @@ -23,12 +23,11 @@ final class ClassNameImportSkipper * @var ClassNameImportSkipVoterInterface[] * @readonly */ - private $classNameImportSkipVoters; + private iterable $classNameImportSkipVoters; /** * @readonly - * @var \Rector\Naming\Naming\UseImportsResolver */ - private $useImportsResolver; + private UseImportsResolver $useImportsResolver; /** * @param ClassNameImportSkipVoterInterface[] $classNameImportSkipVoters */ @@ -102,11 +101,11 @@ final class ClassNameImportSkipper } return $fullyQualified->getAttribute(AttributeKey::IS_FUNCCALL_NAME) === \true; } - private function isConflictedShortNameInUse(UseUse $useUse, string $useName, string $lastUseName, string $stringName) : bool + private function isConflictedShortNameInUse(UseItem $useItem, string $useName, string $lastUseName, string $stringName) : bool { - if (!$useUse->alias instanceof Identifier && $useName !== $stringName && $lastUseName === $stringName) { + if (!$useItem->alias instanceof Identifier && $useName !== $stringName && $lastUseName === $stringName) { return \true; } - return $useUse->alias instanceof Identifier && $useUse->alias->toString() === $stringName; + return $useItem->alias instanceof Identifier && $useItem->alias->toString() === $stringName; } } diff --git a/rules/CodingStyle/ClassNameImport/ShortNameResolver.php b/rules/CodingStyle/ClassNameImport/ShortNameResolver.php index db6efd46015..648fb24f8fc 100644 --- a/rules/CodingStyle/ClassNameImport/ShortNameResolver.php +++ b/rules/CodingStyle/ClassNameImport/ShortNameResolver.php @@ -28,33 +28,28 @@ final class ShortNameResolver { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\CodingStyle\NodeAnalyzer\UseImportNameMatcher */ - private $useImportNameMatcher; + private UseImportNameMatcher $useImportNameMatcher; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var array */ - private $shortNamesByFilePath = []; + private array $shortNamesByFilePath = []; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder, UseImportNameMatcher $useImportNameMatcher, PhpDocInfoFactory $phpDocInfoFactory) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; @@ -84,9 +79,7 @@ final class ShortNameResolver { $newStmts = $file->getNewStmts(); /** @var Namespace_[]|FileWithoutNamespace[] $namespaces */ - $namespaces = \array_filter($newStmts, static function (Stmt $stmt) : bool { - return $stmt instanceof Namespace_ || $stmt instanceof FileWithoutNamespace; - }); + $namespaces = \array_filter($newStmts, static fn(Stmt $stmt): bool => $stmt instanceof Namespace_ || $stmt instanceof FileWithoutNamespace); if (\count($namespaces) !== 1) { // only handle single namespace nodes return []; diff --git a/rules/CodingStyle/ClassNameImport/UseImportsTraverser.php b/rules/CodingStyle/ClassNameImport/UseImportsTraverser.php index 0872c49a18d..47ed10430bb 100644 --- a/rules/CodingStyle/ClassNameImport/UseImportsTraverser.php +++ b/rules/CodingStyle/ClassNameImport/UseImportsTraverser.php @@ -3,27 +3,26 @@ declare (strict_types=1); namespace Rector\CodingStyle\ClassNameImport; +use PhpParser\Node\UseItem; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\GroupUse; use PhpParser\Node\Stmt\Namespace_; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace; final class UseImportsTraverser { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; } /** * @param Stmt[] $stmts - * @param callable(Use_::TYPE_* $useType, UseUse $useUse, string $name): void $callable + * @param callable(Use_::TYPE_* $useType, UseItem $useUse, string $name):void $callable */ public function traverserStmts(array $stmts, callable $callable) : void { @@ -48,7 +47,7 @@ final class UseImportsTraverser } } /** - * @param callable(Use_::TYPE_* $useType, UseUse $useUse, string $name): void $callable + * @param callable(Use_::TYPE_* $useType, UseItem $useUse, string $name):void $callable */ private function processGroupUse(GroupUse $groupUse, callable $callable) : void { diff --git a/rules/CodingStyle/ClassNameImport/UsedImportsResolver.php b/rules/CodingStyle/ClassNameImport/UsedImportsResolver.php index ac765353d51..4e94c5218f3 100644 --- a/rules/CodingStyle/ClassNameImport/UsedImportsResolver.php +++ b/rules/CodingStyle/ClassNameImport/UsedImportsResolver.php @@ -3,11 +3,11 @@ declare (strict_types=1); namespace Rector\CodingStyle\ClassNameImport; +use PhpParser\Node\UseItem; use PhpParser\Node\Identifier; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; use Rector\CodingStyle\ClassNameImport\ValueObject\UsedImports; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpParser\Node\BetterNodeFinder; @@ -17,19 +17,16 @@ final class UsedImportsResolver { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\CodingStyle\ClassNameImport\UseImportsTraverser */ - private $useImportsTraverser; + private \Rector\CodingStyle\ClassNameImport\UseImportsTraverser $useImportsTraverser; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(BetterNodeFinder $betterNodeFinder, \Rector\CodingStyle\ClassNameImport\UseImportsTraverser $useImportsTraverser, NodeNameResolver $nodeNameResolver) { $this->betterNodeFinder = $betterNodeFinder; @@ -53,10 +50,10 @@ final class UsedImportsResolver $usedConstImports = []; $usedFunctionImports = []; /** @param Use_::TYPE_* $useType */ - $this->useImportsTraverser->traverserStmts($stmts, static function (int $useType, UseUse $useUse, string $name) use(&$usedImports, &$usedFunctionImports, &$usedConstImports) : void { + $this->useImportsTraverser->traverserStmts($stmts, static function (int $useType, UseItem $useItem, string $name) use(&$usedImports, &$usedFunctionImports, &$usedConstImports) : void { if ($useType === Use_::TYPE_NORMAL) { - if ($useUse->alias instanceof Identifier) { - $usedImports[] = new AliasedObjectType($useUse->alias->toString(), $name); + if ($useItem->alias instanceof Identifier) { + $usedImports[] = new AliasedObjectType($useItem->alias->toString(), $name); } else { $usedImports[] = new FullyQualifiedObjectType($name); } diff --git a/rules/CodingStyle/ClassNameImport/ValueObject/UsedImports.php b/rules/CodingStyle/ClassNameImport/ValueObject/UsedImports.php index a60eb527f4a..f219b4dded8 100644 --- a/rules/CodingStyle/ClassNameImport/ValueObject/UsedImports.php +++ b/rules/CodingStyle/ClassNameImport/ValueObject/UsedImports.php @@ -11,17 +11,17 @@ final class UsedImports * @var array<(FullyQualifiedObjectType | AliasedObjectType)> * @readonly */ - private $useImports; + private array $useImports; /** * @var FullyQualifiedObjectType[] * @readonly */ - private $functionImports; + private array $functionImports; /** * @var FullyQualifiedObjectType[] * @readonly */ - private $constantImports; + private array $constantImports; /** * @param array $useImports * @param FullyQualifiedObjectType[] $functionImports diff --git a/rules/CodingStyle/Guard/StaticGuard.php b/rules/CodingStyle/Guard/StaticGuard.php index 21ccfeca4a6..15bbaf95ce3 100644 --- a/rules/CodingStyle/Guard/StaticGuard.php +++ b/rules/CodingStyle/Guard/StaticGuard.php @@ -15,14 +15,12 @@ final class StaticGuard { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(BetterNodeFinder $betterNodeFinder, ReflectionResolver $reflectionResolver) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/rules/CodingStyle/Node/NameImporter.php b/rules/CodingStyle/Node/NameImporter.php index fa278619b60..76c7ffa3cdc 100644 --- a/rules/CodingStyle/Node/NameImporter.php +++ b/rules/CodingStyle/Node/NameImporter.php @@ -19,24 +19,20 @@ final class NameImporter { /** * @readonly - * @var \Rector\CodingStyle\ClassNameImport\ClassNameImportSkipper */ - private $classNameImportSkipper; + private ClassNameImportSkipper $classNameImportSkipper; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper */ - private $fullyQualifiedNodeMapper; + private FullyQualifiedNodeMapper $fullyQualifiedNodeMapper; /** * @readonly - * @var \Rector\PostRector\Collector\UseNodesToAddCollector */ - private $useNodesToAddCollector; + private UseNodesToAddCollector $useNodesToAddCollector; /** * @readonly - * @var \Rector\Naming\Naming\AliasNameResolver */ - private $aliasNameResolver; + private AliasNameResolver $aliasNameResolver; public function __construct(ClassNameImportSkipper $classNameImportSkipper, FullyQualifiedNodeMapper $fullyQualifiedNodeMapper, UseNodesToAddCollector $useNodesToAddCollector, AliasNameResolver $aliasNameResolver) { $this->classNameImportSkipper = $classNameImportSkipper; diff --git a/rules/CodingStyle/NodeAnalyzer/UseImportNameMatcher.php b/rules/CodingStyle/NodeAnalyzer/UseImportNameMatcher.php index aedfd4c44e7..9f002a4508c 100644 --- a/rules/CodingStyle/NodeAnalyzer/UseImportNameMatcher.php +++ b/rules/CodingStyle/NodeAnalyzer/UseImportNameMatcher.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace Rector\CodingStyle\NodeAnalyzer; +use PhpParser\Node\UseItem; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\Node\Identifier; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\GroupUse; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; use Rector\Exception\ShouldNotHappenException; use Rector\Naming\Naming\UseImportsResolver; use Rector\NodeTypeResolver\Node\AttributeKey; @@ -18,14 +18,12 @@ final class UseImportNameMatcher { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\Naming\Naming\UseImportsResolver */ - private $useImportsResolver; + private UseImportsResolver $useImportsResolver; /** * @var string * @@ -63,11 +61,11 @@ final class UseImportNameMatcher } return null; } - private function resolveName(string $prefix, string $tag, UseUse $useUse) : string + private function resolveName(string $prefix, string $tag, UseItem $useItem) : string { // useuse can be renamed on the fly, so just in case, use the original one - $originalUseUseNode = $useUse->getAttribute(AttributeKey::ORIGINAL_NODE); - if (!$originalUseUseNode instanceof UseUse) { + $originalUseUseNode = $useItem->getAttribute(AttributeKey::ORIGINAL_NODE); + if (!$originalUseUseNode instanceof UseItem) { throw new ShouldNotHappenException(); } if (!$originalUseUseNode->alias instanceof Identifier) { @@ -84,11 +82,11 @@ final class UseImportNameMatcher } return $prefix . $originalUseUseNode->name . '\\' . $unaliasedShortClass; } - private function isUseMatchingName(string $tag, UseUse $useUse) : bool + private function isUseMatchingName(string $tag, UseItem $useItem) : bool { // useuse can be renamed on the fly, so just in case, use the original one - $originalUseUseNode = $useUse->getAttribute(AttributeKey::ORIGINAL_NODE); - if (!$originalUseUseNode instanceof UseUse) { + $originalUseUseNode = $useItem->getAttribute(AttributeKey::ORIGINAL_NODE); + if (!$originalUseUseNode instanceof UseItem) { return \false; } $shortName = $originalUseUseNode->alias instanceof Identifier ? $originalUseUseNode->alias->name : $originalUseUseNode->name->getLast(); diff --git a/rules/CodingStyle/NodeFactory/ArrayCallableToMethodCallFactory.php b/rules/CodingStyle/NodeFactory/ArrayCallableToMethodCallFactory.php index 370e3c68ac5..68157c1a248 100644 --- a/rules/CodingStyle/NodeFactory/ArrayCallableToMethodCallFactory.php +++ b/rules/CodingStyle/NodeFactory/ArrayCallableToMethodCallFactory.php @@ -4,7 +4,7 @@ declare (strict_types=1); namespace Rector\CodingStyle\NodeFactory; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\Variable; @@ -15,9 +15,8 @@ final class ArrayCallableToMethodCallFactory { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeTypeResolver $nodeTypeResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/rules/CodingStyle/Rector/ArrowFunction/StaticArrowFunctionRector.php b/rules/CodingStyle/Rector/ArrowFunction/StaticArrowFunctionRector.php index 5c3ecac0b7a..0b13214a39b 100644 --- a/rules/CodingStyle/Rector/ArrowFunction/StaticArrowFunctionRector.php +++ b/rules/CodingStyle/Rector/ArrowFunction/StaticArrowFunctionRector.php @@ -16,9 +16,8 @@ final class StaticArrowFunctionRector extends AbstractRector { /** * @readonly - * @var \Rector\CodingStyle\Guard\StaticGuard */ - private $staticGuard; + private StaticGuard $staticGuard; public function __construct(StaticGuard $staticGuard) { $this->staticGuard = $staticGuard; diff --git a/rules/CodingStyle/Rector/Assign/SplitDoubleAssignRector.php b/rules/CodingStyle/Rector/Assign/SplitDoubleAssignRector.php index 72bece7912d..aba7128971c 100644 --- a/rules/CodingStyle/Rector/Assign/SplitDoubleAssignRector.php +++ b/rules/CodingStyle/Rector/Assign/SplitDoubleAssignRector.php @@ -87,7 +87,6 @@ CODE_SAMPLE if (!$assign->expr instanceof Assign) { break; } - /** @var Expr $assign */ $assign = $assign->expr; } return $expressions; diff --git a/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php b/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php index 48a7df6baed..007c62d48d5 100644 --- a/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php +++ b/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\CodingStyle\Rector\Catch_; +use PhpParser\NodeVisitor; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\Node; use PhpParser\Node\Expr\Assign; @@ -15,7 +16,6 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Namespace_; use PhpParser\Node\Stmt\TryCatch; -use PhpParser\NodeTraverser; use PHPStan\Analyser\Scope; use PHPStan\Type\ObjectType; use Rector\Naming\Naming\PropertyNaming; @@ -31,9 +31,8 @@ final class CatchExceptionNameMatchingTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\Naming\Naming\PropertyNaming */ - private $propertyNaming; + private PropertyNaming $propertyNaming; /** * @var string * @see https://regex101.com/r/xmfMAX/1 @@ -162,7 +161,7 @@ CODE_SAMPLE $nonAssignedVariables = []; $this->traverseNodesWithCallable($nextNode, function (Node $node) use($oldVariableName, &$nonAssignedVariables) : ?int { if ($node instanceof Assign && $node->var instanceof Variable) { - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } if (!$node instanceof Variable) { return null; diff --git a/rules/CodingStyle/Rector/ClassConst/RemoveFinalFromConstRector.php b/rules/CodingStyle/Rector/ClassConst/RemoveFinalFromConstRector.php index 748c8161df7..2100035f396 100644 --- a/rules/CodingStyle/Rector/ClassConst/RemoveFinalFromConstRector.php +++ b/rules/CodingStyle/Rector/ClassConst/RemoveFinalFromConstRector.php @@ -18,9 +18,8 @@ final class RemoveFinalFromConstRector extends AbstractRector implements MinPhpV { /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; public function __construct(VisibilityManipulator $visibilityManipulator) { $this->visibilityManipulator = $visibilityManipulator; diff --git a/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php b/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php index 720552e33ca..ebc66d33e33 100644 --- a/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php @@ -26,9 +26,8 @@ final class FuncGetArgsToVariadicParamRector extends AbstractRector implements M { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(BetterNodeFinder $betterNodeFinder) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php b/rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php index 07117271fd9..eea55d4e6db 100644 --- a/rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php @@ -20,14 +20,12 @@ final class MakeInheritedMethodVisibilitySameAsParentRector extends AbstractRect { /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(VisibilityManipulator $visibilityManipulator, ReflectionResolver $reflectionResolver) { $this->visibilityManipulator = $visibilityManipulator; diff --git a/rules/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php b/rules/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php index f6b76d23c9c..1bf81e57f4a 100644 --- a/rules/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/NewlineBeforeNewAssignSetRector.php @@ -23,14 +23,8 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; */ final class NewlineBeforeNewAssignSetRector extends AbstractRector implements HTMLAverseRectorInterface { - /** - * @var string|null - */ - private $previousStmtVariableName; - /** - * @var string|null - */ - private $previousPreviousStmtVariableName; + private ?string $previousStmtVariableName = null; + private ?string $previousPreviousStmtVariableName = null; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Add extra space before new assign set', [new CodeSample(<<<'CODE_SAMPLE' @@ -162,6 +156,6 @@ CODE_SAMPLE } $previousNode = $node->stmts[$key - 1]; $currentNode = $node->stmts[$key]; - return \abs($currentNode->getLine() - $previousNode->getLine()) >= 2; + return \abs($currentNode->getStartLine() - $previousNode->getStartLine()) >= 2; } } diff --git a/rules/CodingStyle/Rector/Closure/StaticClosureRector.php b/rules/CodingStyle/Rector/Closure/StaticClosureRector.php index bd655fb5ad8..3f960470e94 100644 --- a/rules/CodingStyle/Rector/Closure/StaticClosureRector.php +++ b/rules/CodingStyle/Rector/Closure/StaticClosureRector.php @@ -16,9 +16,8 @@ final class StaticClosureRector extends AbstractRector { /** * @readonly - * @var \Rector\CodingStyle\Guard\StaticGuard */ - private $staticGuard; + private StaticGuard $staticGuard; public function __construct(StaticGuard $staticGuard) { $this->staticGuard = $staticGuard; diff --git a/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php b/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php index 1f2a97244a8..78794467df8 100644 --- a/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php +++ b/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php @@ -3,6 +3,8 @@ declare (strict_types=1); namespace Rector\CodingStyle\Rector\Encapsed; +use PhpParser\Node\Scalar\InterpolatedString; +use PhpParser\Node\InterpolatedStringPart; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\Node; use PhpParser\Node\Arg; @@ -12,8 +14,6 @@ use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\Encapsed; -use PhpParser\Node\Scalar\EncapsedStringPart; use PhpParser\Node\Scalar\String_; use PHPStan\Type\Type; use Rector\Contract\Rector\ConfigurableRectorInterface; @@ -35,18 +35,12 @@ final class EncapsedStringsToSprintfRector extends AbstractRector implements Con * @var array>> */ private const FORMAT_SPECIFIERS = ['%s' => ['PHPStan\\Type\\StringType'], '%d' => ['PHPStan\\Type\\Constant\\ConstantIntegerType', 'PHPStan\\Type\\IntegerRangeType', 'PHPStan\\Type\\IntegerType']]; - /** - * @var bool - */ - private $always = \false; - /** - * @var string - */ - private $sprintfFormat = ''; + private bool $always = \false; + private string $sprintfFormat = ''; /** * @var Expr[] */ - private $argumentVariables = []; + private array $argumentVariables = []; public function configure(array $configuration) : void { $this->always = $configuration[self::ALWAYS] ?? \false; @@ -80,10 +74,10 @@ CODE_SAMPLE */ public function getNodeTypes() : array { - return [Encapsed::class]; + return [InterpolatedString::class]; } /** - * @param Encapsed $node + * @param InterpolatedString $node */ public function refactor(Node $node) : ?Node { @@ -93,7 +87,7 @@ CODE_SAMPLE $this->sprintfFormat = ''; $this->argumentVariables = []; foreach ($node->parts as $part) { - if ($part instanceof EncapsedStringPart) { + if ($part instanceof InterpolatedStringPart) { $this->collectEncapsedStringPart($part); } else { $this->collectExpr($part); @@ -101,13 +95,13 @@ CODE_SAMPLE } return $this->createSprintfFuncCallOrConcat($this->sprintfFormat, $this->argumentVariables); } - private function shouldSkip(Encapsed $encapsed) : bool + private function shouldSkip(InterpolatedString $interpolatedString) : bool { - return $encapsed->hasAttribute(AttributeKey::DOC_LABEL); + return $interpolatedString->hasAttribute(AttributeKey::DOC_LABEL); } - private function collectEncapsedStringPart(EncapsedStringPart $encapsedStringPart) : void + private function collectEncapsedStringPart(InterpolatedStringPart $interpolatedStringPart) : void { - $stringValue = $encapsedStringPart->value; + $stringValue = $interpolatedStringPart->value; if ($stringValue === "\n") { $this->argumentVariables[] = new ConstFetch(new Name('PHP_EOL')); $this->sprintfFormat .= '%s'; diff --git a/rules/CodingStyle/Rector/Encapsed/WrapEncapsedVariableInCurlyBracesRector.php b/rules/CodingStyle/Rector/Encapsed/WrapEncapsedVariableInCurlyBracesRector.php index 9d83869b907..a0a9919df4c 100644 --- a/rules/CodingStyle/Rector/Encapsed/WrapEncapsedVariableInCurlyBracesRector.php +++ b/rules/CodingStyle/Rector/Encapsed/WrapEncapsedVariableInCurlyBracesRector.php @@ -3,9 +3,9 @@ declare (strict_types=1); namespace Rector\CodingStyle\Rector\Encapsed; +use PhpParser\Node\Scalar\InterpolatedString; use PhpParser\Node; use PhpParser\Node\Expr\Variable; -use PhpParser\Node\Scalar\Encapsed; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -35,10 +35,10 @@ CODE_SAMPLE */ public function getNodeTypes() : array { - return [Encapsed::class]; + return [InterpolatedString::class]; } /** - * @param Encapsed $node + * @param InterpolatedString $node */ public function refactor(Node $node) : ?Node { diff --git a/rules/CodingStyle/Rector/Foreach_/MultiDimensionalArrayToArrayDestructRector.php b/rules/CodingStyle/Rector/Foreach_/MultiDimensionalArrayToArrayDestructRector.php index ba4b2ac4b20..20655e0f0a6 100644 --- a/rules/CodingStyle/Rector/Foreach_/MultiDimensionalArrayToArrayDestructRector.php +++ b/rules/CodingStyle/Rector/Foreach_/MultiDimensionalArrayToArrayDestructRector.php @@ -3,15 +3,15 @@ declare (strict_types=1); namespace Rector\CodingStyle\Rector\Foreach_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\ArrayDimFetch; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Foreach_; use PhpParser\NodeFinder; -use PhpParser\NodeTraverser; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersionFeature; use Rector\VersionBonding\Contract\MinPhpVersionInterface; @@ -26,9 +26,8 @@ final class MultiDimensionalArrayToArrayDestructRector extends AbstractRector im { /** * @readonly - * @var \PhpParser\NodeFinder */ - private $nodeFinder; + private NodeFinder $nodeFinder; public function __construct(NodeFinder $nodeFinder) { $this->nodeFinder = $nodeFinder; @@ -110,7 +109,7 @@ CODE_SAMPLE $dim = $traverseNode->dim; if (!$dim instanceof String_) { $createdDestructedVariables = []; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } $destructedVariable = $this->getDestructedVariableName($usedVariableNames, $dim); $createdDestructedVariables[$dim->value] = $destructedVariable; @@ -122,15 +121,13 @@ CODE_SAMPLE * Get all variable names which are used in the foreach tree. We need this so that we don't create array destructor * with variable name which is already used somewhere bellow * - * @return list + * @return string[] */ private function getUsedVariableNamesInForeachTree(Foreach_ $foreach) : array { /** @var list $variableNodes */ $variableNodes = $this->nodeFinder->findInstanceOf($foreach, Variable::class); - return \array_unique(\array_map(function (Variable $variable) : string { - return (string) $this->getName($variable); - }, $variableNodes)); + return \array_unique(\array_map(fn(Variable $variable): string => (string) $this->getName($variable), $variableNodes)); } /** * Get variable name that will be used for destructor syntax. If variable name is already occupied @@ -140,7 +137,7 @@ CODE_SAMPLE */ private function getDestructedVariableName(array $usedVariableNames, String_ $string) : string { - $desiredVariableName = (string) $string->value; + $desiredVariableName = $string->value; if (\in_array($desiredVariableName, $usedVariableNames, \true) === \false) { return $desiredVariableName; } diff --git a/rules/CodingStyle/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php b/rules/CodingStyle/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php index e96bb29e4ce..c48faac8652 100644 --- a/rules/CodingStyle/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php +++ b/rules/CodingStyle/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php @@ -7,11 +7,12 @@ use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Expr\Variable; use PHPStan\Type\ArrayType; +use PHPStan\Type\Constant\ConstantArrayType; use Rector\NodeTypeResolver\TypeAnalyzer\ArrayTypeAnalyzer; use Rector\Php\PhpVersionProvider; use Rector\Rector\AbstractRector; @@ -27,14 +28,12 @@ final class ArraySpreadInsteadOfArrayMergeRector extends AbstractRector implemen { /** * @readonly - * @var \Rector\NodeTypeResolver\TypeAnalyzer\ArrayTypeAnalyzer */ - private $arrayTypeAnalyzer; + private ArrayTypeAnalyzer $arrayTypeAnalyzer; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(ArrayTypeAnalyzer $arrayTypeAnalyzer, PhpVersionProvider $phpVersionProvider) { $this->arrayTypeAnalyzer = $arrayTypeAnalyzer; @@ -126,12 +125,15 @@ CODE_SAMPLE return \true; } $arrayStaticType = $this->getType($expr); - if (!$arrayStaticType instanceof ArrayType) { + if (!$arrayStaticType->isArray()->yes()) { return \true; } return !$this->isArrayKeyTypeAllowed($arrayStaticType); } - private function isArrayKeyTypeAllowed(ArrayType $arrayType) : bool + /** + * @param \PHPStan\Type\ArrayType|\PHPStan\Type\Constant\ConstantArrayType $arrayType + */ + private function isArrayKeyTypeAllowed($arrayType) : bool { if ($arrayType->getKeyType()->isInteger()->yes()) { return \true; diff --git a/rules/CodingStyle/Rector/FuncCall/CallUserFuncArrayToVariadicRector.php b/rules/CodingStyle/Rector/FuncCall/CallUserFuncArrayToVariadicRector.php index eee075a25fc..790a7a7b865 100644 --- a/rules/CodingStyle/Rector/FuncCall/CallUserFuncArrayToVariadicRector.php +++ b/rules/CodingStyle/Rector/FuncCall/CallUserFuncArrayToVariadicRector.php @@ -24,14 +24,12 @@ final class CallUserFuncArrayToVariadicRector extends AbstractRector implements { /** * @readonly - * @var \Rector\CodingStyle\NodeFactory\ArrayCallableToMethodCallFactory */ - private $arrayCallableToMethodCallFactory; + private ArrayCallableToMethodCallFactory $arrayCallableToMethodCallFactory; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ArrayCallableToMethodCallFactory $arrayCallableToMethodCallFactory, ValueResolver $valueResolver) { $this->arrayCallableToMethodCallFactory = $arrayCallableToMethodCallFactory; diff --git a/rules/CodingStyle/Rector/FuncCall/CallUserFuncToMethodCallRector.php b/rules/CodingStyle/Rector/FuncCall/CallUserFuncToMethodCallRector.php index 41f8aafa9b7..727767e2e3d 100644 --- a/rules/CodingStyle/Rector/FuncCall/CallUserFuncToMethodCallRector.php +++ b/rules/CodingStyle/Rector/FuncCall/CallUserFuncToMethodCallRector.php @@ -18,9 +18,8 @@ final class CallUserFuncToMethodCallRector extends AbstractRector { /** * @readonly - * @var \Rector\CodingStyle\NodeFactory\ArrayCallableToMethodCallFactory */ - private $arrayCallableToMethodCallFactory; + private ArrayCallableToMethodCallFactory $arrayCallableToMethodCallFactory; public function __construct(ArrayCallableToMethodCallFactory $arrayCallableToMethodCallFactory) { $this->arrayCallableToMethodCallFactory = $arrayCallableToMethodCallFactory; diff --git a/rules/CodingStyle/Rector/FuncCall/ConsistentImplodeRector.php b/rules/CodingStyle/Rector/FuncCall/ConsistentImplodeRector.php index 0292388c4d8..1431194be98 100644 --- a/rules/CodingStyle/Rector/FuncCall/ConsistentImplodeRector.php +++ b/rules/CodingStyle/Rector/FuncCall/ConsistentImplodeRector.php @@ -18,9 +18,8 @@ final class ConsistentImplodeRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeTypeResolver\TypeAnalyzer\StringTypeAnalyzer */ - private $stringTypeAnalyzer; + private StringTypeAnalyzer $stringTypeAnalyzer; public function __construct(StringTypeAnalyzer $stringTypeAnalyzer) { $this->stringTypeAnalyzer = $stringTypeAnalyzer; diff --git a/rules/CodingStyle/Rector/FuncCall/CountArrayToEmptyArrayComparisonRector.php b/rules/CodingStyle/Rector/FuncCall/CountArrayToEmptyArrayComparisonRector.php index bea2dc549f4..8e633e45fc1 100644 --- a/rules/CodingStyle/Rector/FuncCall/CountArrayToEmptyArrayComparisonRector.php +++ b/rules/CodingStyle/Rector/FuncCall/CountArrayToEmptyArrayComparisonRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\CodingStyle\Rector\FuncCall; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; @@ -12,7 +13,6 @@ use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\BinaryOp\Smaller; use PhpParser\Node\Expr\BooleanNot; use PhpParser\Node\Expr\FuncCall; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt\ElseIf_; use PhpParser\Node\Stmt\If_; use Rector\Rector\AbstractRector; @@ -164,7 +164,7 @@ CODE_SAMPLE } private function isZeroLNumber(Expr $expr) : bool { - if (!$expr instanceof LNumber) { + if (!$expr instanceof Int_) { return \false; } return $expr->value === 0; diff --git a/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php b/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php index 7fa446633c1..6eb3dcc05f1 100644 --- a/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php +++ b/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\CodingStyle\Rector\FuncCall; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\BinaryOp; @@ -15,7 +16,6 @@ use PhpParser\Node\Expr\BinaryOp\SmallerOrEqual; use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use Rector\Rector\AbstractRector; use Rector\Util\PhpVersionFactory; @@ -98,7 +98,7 @@ CODE_SAMPLE return $expr->name->toString() === 'PHP_VERSION'; } /** - * @return \PhpParser\Node\Expr\ConstFetch|\PhpParser\Node\Scalar\LNumber|null + * @return \PhpParser\Node\Expr\ConstFetch|\PhpParser\Node\Scalar\Int_|null */ private function getNewNodeForArg(Expr $expr) { @@ -107,12 +107,12 @@ CODE_SAMPLE } return $this->getVersionNumberFormVersionString($expr); } - private function getVersionNumberFormVersionString(Expr $expr) : ?LNumber + private function getVersionNumberFormVersionString(Expr $expr) : ?Int_ { if (!$expr instanceof String_) { return null; } $value = PhpVersionFactory::createIntVersion($expr->value); - return new LNumber($value); + return new Int_($value); } } diff --git a/rules/CodingStyle/Rector/Property/SplitGroupedPropertiesRector.php b/rules/CodingStyle/Rector/Property/SplitGroupedPropertiesRector.php index 1faf9c45e40..d8fa06ff9d8 100644 --- a/rules/CodingStyle/Rector/Property/SplitGroupedPropertiesRector.php +++ b/rules/CodingStyle/Rector/Property/SplitGroupedPropertiesRector.php @@ -5,7 +5,7 @@ namespace Rector\CodingStyle\Rector\Property; use PhpParser\Node; use PhpParser\Node\Stmt\Property; -use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\Node\PropertyItem; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -58,7 +58,7 @@ CODE_SAMPLE if (\count($allProperties) === 1) { return null; } - /** @var PropertyProperty $firstPropertyProperty */ + /** @var PropertyItem $firstPropertyProperty */ $firstPropertyProperty = \array_shift($allProperties); $node->props = [$firstPropertyProperty]; $nextProperties = []; diff --git a/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php b/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php index 6f1d11553ef..06b6247bde6 100644 --- a/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php +++ b/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php @@ -88,9 +88,7 @@ CODE_SAMPLE if ($node->stmts === null) { return null; } - \end($node->stmts); - $totalKeys = \key($node->stmts); - \reset($node->stmts); + $totalKeys = \array_key_last($node->stmts); for ($key = $jumpToKey; $key < $totalKeys; ++$key) { if (!isset($node->stmts[$key], $node->stmts[$key + 1])) { break; diff --git a/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php b/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php index 52f4951f18a..7e9058305a2 100644 --- a/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php +++ b/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php @@ -26,10 +26,7 @@ final class SymplifyQuoteEscapeRector extends AbstractRector * @see https://regex101.com/r/lGUhRb/1 */ private const HAS_NON_PRINTABLE_CHARS = '#[\\x00-\\x1F\\x80-\\xFF]#'; - /** - * @var bool - */ - private $hasChanged = \false; + private bool $hasChanged = \false; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Prefer quote that are not inside the string', [new CodeSample(<<<'CODE_SAMPLE' diff --git a/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php b/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php index dcfb2ee6b1c..3a76f88717b 100644 --- a/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php +++ b/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php @@ -20,9 +20,8 @@ final class UseClassKeywordForClassNameResolutionRector extends AbstractRector { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @var string * @see https://regex101.com/r/Vv41Qr/1/ @@ -79,9 +78,7 @@ CODE_SAMPLE $quotedClassNames = \array_map(\Closure::fromCallable('preg_quote'), $classNames); // @see https://regex101.com/r/8nGS0F/1 $parts = Strings::split($string->value, '#(' . \implode('|', $quotedClassNames) . ')#'); - return \array_filter($parts, static function (string $className) : bool { - return $className !== ''; - }); + return \array_filter($parts, static fn(string $className): bool => $className !== ''); } /** * @return string[] @@ -124,8 +121,6 @@ CODE_SAMPLE */ private function filterOurShortClasses(array $classNames) : array { - return \array_filter($classNames, static function (string $className) : bool { - return \strpos($className, '\\') !== \false; - }); + return \array_filter($classNames, static fn(string $className): bool => \strpos($className, '\\') !== \false); } } diff --git a/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php b/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php index 5b630d61bc3..21dc118a405 100644 --- a/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php +++ b/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php @@ -105,7 +105,7 @@ CODE_SAMPLE foreach ($traitUse->traits as $singleTraitUse) { $adaptation = []; foreach ($traitUse->adaptations as $traitAdaptation) { - if ($traitAdaptation instanceof Alias && $traitAdaptation->trait && $traitAdaptation->trait instanceof Name && $traitAdaptation->trait->toString() === $singleTraitUse->toString()) { + if ($traitAdaptation instanceof Alias && $traitAdaptation->trait instanceof Name && $traitAdaptation->trait->toString() === $singleTraitUse->toString()) { $adaptation[] = $traitAdaptation; } } diff --git a/rules/CodingStyle/Reflection/VendorLocationDetector.php b/rules/CodingStyle/Reflection/VendorLocationDetector.php index b8d255613be..2b4f779fe9d 100644 --- a/rules/CodingStyle/Reflection/VendorLocationDetector.php +++ b/rules/CodingStyle/Reflection/VendorLocationDetector.php @@ -10,9 +10,8 @@ final class VendorLocationDetector { /** * @readonly - * @var \Rector\FileSystem\FilePathHelper */ - private $filePathHelper; + private FilePathHelper $filePathHelper; public function __construct(FilePathHelper $filePathHelper) { $this->filePathHelper = $filePathHelper; diff --git a/rules/DeadCode/ConditionEvaluator.php b/rules/DeadCode/ConditionEvaluator.php index 9b164c756ea..ce8f03aeb9b 100644 --- a/rules/DeadCode/ConditionEvaluator.php +++ b/rules/DeadCode/ConditionEvaluator.php @@ -16,9 +16,8 @@ final class ConditionEvaluator { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/rules/DeadCode/ConditionResolver.php b/rules/DeadCode/ConditionResolver.php index e371e9eef27..bcca3e1f161 100644 --- a/rules/DeadCode/ConditionResolver.php +++ b/rules/DeadCode/ConditionResolver.php @@ -21,19 +21,16 @@ final class ConditionResolver { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(NodeNameResolver $nodeNameResolver, PhpVersionProvider $phpVersionProvider, ValueResolver $valueResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/DeadCode/NodeAnalyzer/CallCollectionAnalyzer.php b/rules/DeadCode/NodeAnalyzer/CallCollectionAnalyzer.php index 46e757f9ea8..042db870fff 100644 --- a/rules/DeadCode/NodeAnalyzer/CallCollectionAnalyzer.php +++ b/rules/DeadCode/NodeAnalyzer/CallCollectionAnalyzer.php @@ -18,14 +18,12 @@ final class CallCollectionAnalyzer { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeTypeResolver $nodeTypeResolver, NodeNameResolver $nodeNameResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/rules/DeadCode/NodeAnalyzer/ExprUsedInNodeAnalyzer.php b/rules/DeadCode/NodeAnalyzer/ExprUsedInNodeAnalyzer.php index 484aa23b0d4..9271c90e692 100644 --- a/rules/DeadCode/NodeAnalyzer/ExprUsedInNodeAnalyzer.php +++ b/rules/DeadCode/NodeAnalyzer/ExprUsedInNodeAnalyzer.php @@ -13,14 +13,12 @@ final class ExprUsedInNodeAnalyzer { /** * @readonly - * @var \Rector\DeadCode\NodeAnalyzer\UsedVariableNameAnalyzer */ - private $usedVariableNameAnalyzer; + private \Rector\DeadCode\NodeAnalyzer\UsedVariableNameAnalyzer $usedVariableNameAnalyzer; /** * @readonly - * @var \Rector\NodeAnalyzer\CompactFuncCallAnalyzer */ - private $compactFuncCallAnalyzer; + private CompactFuncCallAnalyzer $compactFuncCallAnalyzer; public function __construct(\Rector\DeadCode\NodeAnalyzer\UsedVariableNameAnalyzer $usedVariableNameAnalyzer, CompactFuncCallAnalyzer $compactFuncCallAnalyzer) { $this->usedVariableNameAnalyzer = $usedVariableNameAnalyzer; diff --git a/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php b/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php index 2291ebd0302..65ed946437a 100644 --- a/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php +++ b/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace Rector\DeadCode\NodeAnalyzer; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\CallLike; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\NullsafeMethodCall; @@ -16,7 +16,6 @@ use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Trait_; -use PhpParser\NodeTraverser; use PHPStan\Analyser\Scope; use PHPStan\Parser\ArrayMapArgVisitor; use PHPStan\Reflection\ClassReflection; @@ -33,44 +32,36 @@ final class IsClassMethodUsedAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\NodeCollector\NodeAnalyzer\ArrayCallableMethodMatcher */ - private $arrayCallableMethodMatcher; + private ArrayCallableMethodMatcher $arrayCallableMethodMatcher; /** * @readonly - * @var \Rector\DeadCode\NodeAnalyzer\CallCollectionAnalyzer */ - private $callCollectionAnalyzer; + private \Rector\DeadCode\NodeAnalyzer\CallCollectionAnalyzer $callCollectionAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; public function __construct(NodeNameResolver $nodeNameResolver, AstResolver $astResolver, BetterNodeFinder $betterNodeFinder, ValueResolver $valueResolver, ArrayCallableMethodMatcher $arrayCallableMethodMatcher, \Rector\DeadCode\NodeAnalyzer\CallCollectionAnalyzer $callCollectionAnalyzer, ReflectionResolver $reflectionResolver, SimpleCallableNodeTraverser $simpleCallableNodeTraverser) { $this->nodeNameResolver = $nodeNameResolver; @@ -133,9 +124,6 @@ final class IsClassMethodUsedAnalyzer if (\count($array->items) !== 2) { return \false; } - if (!$array->items[1] instanceof ArrayItem) { - return \false; - } $value = $this->valueResolver->getValue($array->items[1]->value); if (!\is_string($value)) { return \false; @@ -201,15 +189,15 @@ final class IsClassMethodUsedAnalyzer $callMethod = null; $this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->stmts, function (Node $subNode) use($className, $classMethodName, &$callMethod) : ?int { if ($subNode instanceof Class_ || $subNode instanceof Function_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($subNode instanceof MethodCall && $this->nodeNameResolver->isName($subNode->var, 'this') && $this->nodeNameResolver->isName($subNode->name, $classMethodName)) { $callMethod = $subNode; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } if ($this->isStaticCallMatch($subNode, $className, $classMethodName)) { $callMethod = $subNode; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } return null; }); diff --git a/rules/DeadCode/NodeAnalyzer/PropertyWriteonlyAnalyzer.php b/rules/DeadCode/NodeAnalyzer/PropertyWriteonlyAnalyzer.php index 76bd3653ce1..f517471233d 100644 --- a/rules/DeadCode/NodeAnalyzer/PropertyWriteonlyAnalyzer.php +++ b/rules/DeadCode/NodeAnalyzer/PropertyWriteonlyAnalyzer.php @@ -15,9 +15,8 @@ final class PropertyWriteonlyAnalyzer { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(BetterNodeFinder $betterNodeFinder) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/rules/DeadCode/NodeAnalyzer/SafeLeftTypeBooleanAndOrAnalyzer.php b/rules/DeadCode/NodeAnalyzer/SafeLeftTypeBooleanAndOrAnalyzer.php index e950f7e00e6..67614aac950 100644 --- a/rules/DeadCode/NodeAnalyzer/SafeLeftTypeBooleanAndOrAnalyzer.php +++ b/rules/DeadCode/NodeAnalyzer/SafeLeftTypeBooleanAndOrAnalyzer.php @@ -22,24 +22,20 @@ final class SafeLeftTypeBooleanAndOrAnalyzer { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(BetterNodeFinder $betterNodeFinder, ExprAnalyzer $exprAnalyzer, ReflectionResolver $reflectionResolver, NodeTypeResolver $nodeTypeResolver) { $this->betterNodeFinder = $betterNodeFinder; @@ -52,15 +48,11 @@ final class SafeLeftTypeBooleanAndOrAnalyzer */ public function isSafe($booleanAnd) : bool { - $hasNonTypedFromParam = (bool) $this->betterNodeFinder->findFirst($booleanAnd->left, function (Node $node) : bool { - return $node instanceof Variable && $this->exprAnalyzer->isNonTypedFromParam($node); - }); + $hasNonTypedFromParam = (bool) $this->betterNodeFinder->findFirst($booleanAnd->left, fn(Node $node): bool => $node instanceof Variable && $this->exprAnalyzer->isNonTypedFromParam($node)); if ($hasNonTypedFromParam) { return \false; } - $hasPropertyFetchOrArrayDimFetch = (bool) $this->betterNodeFinder->findFirst($booleanAnd->left, static function (Node $node) : bool { - return $node instanceof PropertyFetch || $node instanceof StaticPropertyFetch || $node instanceof ArrayDimFetch; - }); + $hasPropertyFetchOrArrayDimFetch = (bool) $this->betterNodeFinder->findFirst($booleanAnd->left, static fn(Node $node): bool => $node instanceof PropertyFetch || $node instanceof StaticPropertyFetch || $node instanceof ArrayDimFetch); // get type from Property and ArrayDimFetch is unreliable if ($hasPropertyFetchOrArrayDimFetch) { return \false; diff --git a/rules/DeadCode/NodeAnalyzer/UsedVariableNameAnalyzer.php b/rules/DeadCode/NodeAnalyzer/UsedVariableNameAnalyzer.php index 03b93495362..18df028a505 100644 --- a/rules/DeadCode/NodeAnalyzer/UsedVariableNameAnalyzer.php +++ b/rules/DeadCode/NodeAnalyzer/UsedVariableNameAnalyzer.php @@ -12,9 +12,8 @@ final class UsedVariableNameAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/DeadCode/NodeCollector/UnusedParameterResolver.php b/rules/DeadCode/NodeCollector/UnusedParameterResolver.php index 448b3ba4a10..a63b30b8f61 100644 --- a/rules/DeadCode/NodeCollector/UnusedParameterResolver.php +++ b/rules/DeadCode/NodeCollector/UnusedParameterResolver.php @@ -10,9 +10,8 @@ final class UnusedParameterResolver { /** * @readonly - * @var \Rector\NodeAnalyzer\ParamAnalyzer */ - private $paramAnalyzer; + private ParamAnalyzer $paramAnalyzer; public function __construct(ParamAnalyzer $paramAnalyzer) { $this->paramAnalyzer = $paramAnalyzer; diff --git a/rules/DeadCode/NodeManipulator/ClassMethodParamRemover.php b/rules/DeadCode/NodeManipulator/ClassMethodParamRemover.php index a95cbf91af1..0a827fece01 100644 --- a/rules/DeadCode/NodeManipulator/ClassMethodParamRemover.php +++ b/rules/DeadCode/NodeManipulator/ClassMethodParamRemover.php @@ -10,14 +10,12 @@ final class ClassMethodParamRemover { /** * @readonly - * @var \Rector\NodeAnalyzer\ParamAnalyzer */ - private $paramAnalyzer; + private ParamAnalyzer $paramAnalyzer; /** * @readonly - * @var \Rector\Removing\NodeManipulator\ComplexNodeRemover */ - private $complexNodeRemover; + private ComplexNodeRemover $complexNodeRemover; public function __construct(ParamAnalyzer $paramAnalyzer, ComplexNodeRemover $complexNodeRemover) { $this->paramAnalyzer = $paramAnalyzer; diff --git a/rules/DeadCode/NodeManipulator/ControllerClassMethodManipulator.php b/rules/DeadCode/NodeManipulator/ControllerClassMethodManipulator.php index 40bfeeb748c..1f0ee8680cf 100644 --- a/rules/DeadCode/NodeManipulator/ControllerClassMethodManipulator.php +++ b/rules/DeadCode/NodeManipulator/ControllerClassMethodManipulator.php @@ -7,20 +7,19 @@ use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode; +use Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\NodeNameResolver\NodeNameResolver; final class ControllerClassMethodManipulator { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(NodeNameResolver $nodeNameResolver, PhpDocInfoFactory $phpDocInfoFactory) { $this->nodeNameResolver = $nodeNameResolver; @@ -35,7 +34,7 @@ final class ControllerClassMethodManipulator return \false; } $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($classMethod); - return $phpDocInfo->hasByType(GenericTagValueNode::class); + return $phpDocInfo->hasByTypes([GenericTagValueNode::class, SpacelessPhpDocTagNode::class]); } private function hasParentClassController(Class_ $class) : bool { diff --git a/rules/DeadCode/NodeManipulator/CountManipulator.php b/rules/DeadCode/NodeManipulator/CountManipulator.php index 06383a40115..f365d793553 100644 --- a/rules/DeadCode/NodeManipulator/CountManipulator.php +++ b/rules/DeadCode/NodeManipulator/CountManipulator.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\DeadCode\NodeManipulator; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Expr; use PhpParser\Node\Expr\BinaryOp\Greater; use PhpParser\Node\Expr\BinaryOp\GreaterOrEqual; use PhpParser\Node\Expr\BinaryOp\Smaller; use PhpParser\Node\Expr\BinaryOp\SmallerOrEqual; use PhpParser\Node\Expr\FuncCall; -use PhpParser\Node\Scalar\LNumber; use PHPStan\Type\NeverType; use Rector\NodeNameResolver\NodeNameResolver; use Rector\NodeTypeResolver\NodeTypeResolver; @@ -18,19 +18,16 @@ final class CountManipulator { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeNameResolver $nodeNameResolver, NodeComparator $nodeComparator, NodeTypeResolver $nodeTypeResolver) { $this->nodeNameResolver = $nodeNameResolver; @@ -87,7 +84,7 @@ final class CountManipulator } private function isNumber(Expr $expr, int $value) : bool { - if (!$expr instanceof LNumber) { + if (!$expr instanceof Int_) { return \false; } return $expr->value === $value; diff --git a/rules/DeadCode/NodeManipulator/LivingCodeManipulator.php b/rules/DeadCode/NodeManipulator/LivingCodeManipulator.php index 4cbba9db6d5..163a1451c57 100644 --- a/rules/DeadCode/NodeManipulator/LivingCodeManipulator.php +++ b/rules/DeadCode/NodeManipulator/LivingCodeManipulator.php @@ -34,9 +34,8 @@ final class LivingCodeManipulator { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeTypeResolver $nodeTypeResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/rules/DeadCode/NodeManipulator/VariadicFunctionLikeDetector.php b/rules/DeadCode/NodeManipulator/VariadicFunctionLikeDetector.php index 78bd1ee4f38..4a9b1f72da8 100644 --- a/rules/DeadCode/NodeManipulator/VariadicFunctionLikeDetector.php +++ b/rules/DeadCode/NodeManipulator/VariadicFunctionLikeDetector.php @@ -3,24 +3,22 @@ declare (strict_types=1); namespace Rector\DeadCode\NodeManipulator; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\FunctionLike; -use PhpParser\NodeTraverser; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; final class VariadicFunctionLikeDetector { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @var string[] */ @@ -44,7 +42,7 @@ final class VariadicFunctionLikeDetector return null; } $isVariadic = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; }); return $isVariadic; } diff --git a/rules/DeadCode/PhpDoc/DeadParamTagValueNodeAnalyzer.php b/rules/DeadCode/PhpDoc/DeadParamTagValueNodeAnalyzer.php index 1f9351ce52f..8bae9f1185b 100644 --- a/rules/DeadCode/PhpDoc/DeadParamTagValueNodeAnalyzer.php +++ b/rules/DeadCode/PhpDoc/DeadParamTagValueNodeAnalyzer.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\DeadCode\PhpDoc; +use PhpParser\Node; use PhpParser\Node\FunctionLike; use PhpParser\Node\Name; use PhpParser\Node\Param; @@ -22,49 +23,40 @@ final class DeadParamTagValueNodeAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; /** * @readonly - * @var \Rector\DeadCode\TypeNodeAnalyzer\GenericTypeNodeAnalyzer */ - private $genericTypeNodeAnalyzer; + private GenericTypeNodeAnalyzer $genericTypeNodeAnalyzer; /** * @readonly - * @var \Rector\DeadCode\TypeNodeAnalyzer\MixedArrayTypeNodeAnalyzer */ - private $mixedArrayTypeNodeAnalyzer; + private MixedArrayTypeNodeAnalyzer $mixedArrayTypeNodeAnalyzer; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ParamAnalyzer */ - private $paramAnalyzer; + private ParamAnalyzer $paramAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\DeadCode\PhpDoc\Guard\StandaloneTypeRemovalGuard */ - private $standaloneTypeRemovalGuard; + private StandaloneTypeRemovalGuard $standaloneTypeRemovalGuard; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\DeadCode\PhpDoc\Guard\TemplateTypeRemovalGuard */ - private $templateTypeRemovalGuard; + private TemplateTypeRemovalGuard $templateTypeRemovalGuard; public function __construct(NodeNameResolver $nodeNameResolver, TypeComparator $typeComparator, GenericTypeNodeAnalyzer $genericTypeNodeAnalyzer, MixedArrayTypeNodeAnalyzer $mixedArrayTypeNodeAnalyzer, ParamAnalyzer $paramAnalyzer, PhpDocTypeChanger $phpDocTypeChanger, StandaloneTypeRemovalGuard $standaloneTypeRemovalGuard, StaticTypeMapper $staticTypeMapper, TemplateTypeRemovalGuard $templateTypeRemovalGuard) { $this->nodeNameResolver = $nodeNameResolver; @@ -83,7 +75,7 @@ final class DeadParamTagValueNodeAnalyzer if (!$param instanceof Param) { return \false; } - if ($param->type === null) { + if (!$param->type instanceof Node) { return \false; } if ($paramTagValueNode->description !== '') { diff --git a/rules/DeadCode/PhpDoc/DeadReturnTagValueNodeAnalyzer.php b/rules/DeadCode/PhpDoc/DeadReturnTagValueNodeAnalyzer.php index 020e610236a..d3aa7ef38dc 100644 --- a/rules/DeadCode/PhpDoc/DeadReturnTagValueNodeAnalyzer.php +++ b/rules/DeadCode/PhpDoc/DeadReturnTagValueNodeAnalyzer.php @@ -26,39 +26,32 @@ final class DeadReturnTagValueNodeAnalyzer { /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; /** * @readonly - * @var \Rector\DeadCode\TypeNodeAnalyzer\GenericTypeNodeAnalyzer */ - private $genericTypeNodeAnalyzer; + private GenericTypeNodeAnalyzer $genericTypeNodeAnalyzer; /** * @readonly - * @var \Rector\DeadCode\TypeNodeAnalyzer\MixedArrayTypeNodeAnalyzer */ - private $mixedArrayTypeNodeAnalyzer; + private MixedArrayTypeNodeAnalyzer $mixedArrayTypeNodeAnalyzer; /** * @readonly - * @var \Rector\DeadCode\PhpDoc\Guard\StandaloneTypeRemovalGuard */ - private $standaloneTypeRemovalGuard; + private StandaloneTypeRemovalGuard $standaloneTypeRemovalGuard; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\DeadCode\PhpDoc\Guard\TemplateTypeRemovalGuard */ - private $templateTypeRemovalGuard; + private TemplateTypeRemovalGuard $templateTypeRemovalGuard; public function __construct(TypeComparator $typeComparator, GenericTypeNodeAnalyzer $genericTypeNodeAnalyzer, MixedArrayTypeNodeAnalyzer $mixedArrayTypeNodeAnalyzer, StandaloneTypeRemovalGuard $standaloneTypeRemovalGuard, PhpDocTypeChanger $phpDocTypeChanger, StaticTypeMapper $staticTypeMapper, TemplateTypeRemovalGuard $templateTypeRemovalGuard) { $this->typeComparator = $typeComparator; diff --git a/rules/DeadCode/PhpDoc/DeadVarTagValueNodeAnalyzer.php b/rules/DeadCode/PhpDoc/DeadVarTagValueNodeAnalyzer.php index e2f953d6b97..dd03b9af400 100644 --- a/rules/DeadCode/PhpDoc/DeadVarTagValueNodeAnalyzer.php +++ b/rules/DeadCode/PhpDoc/DeadVarTagValueNodeAnalyzer.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\DeadCode\PhpDoc; +use PhpParser\Node; use PhpParser\Node\Stmt\Property; use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode; use PHPStan\Type\IntersectionType; @@ -16,19 +17,16 @@ final class DeadVarTagValueNodeAnalyzer { /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\DeadCode\PhpDoc\Guard\TemplateTypeRemovalGuard */ - private $templateTypeRemovalGuard; + private TemplateTypeRemovalGuard $templateTypeRemovalGuard; public function __construct(TypeComparator $typeComparator, StaticTypeMapper $staticTypeMapper, TemplateTypeRemovalGuard $templateTypeRemovalGuard) { $this->typeComparator = $typeComparator; @@ -37,7 +35,7 @@ final class DeadVarTagValueNodeAnalyzer } public function isDead(VarTagValueNode $varTagValueNode, Property $property) : bool { - if ($property->type === null) { + if (!$property->type instanceof Node) { return \false; } if ($varTagValueNode->description !== '') { diff --git a/rules/DeadCode/PhpDoc/TagRemover/ParamTagRemover.php b/rules/DeadCode/PhpDoc/TagRemover/ParamTagRemover.php index ded731da3b4..545eb7c748f 100644 --- a/rules/DeadCode/PhpDoc/TagRemover/ParamTagRemover.php +++ b/rules/DeadCode/PhpDoc/TagRemover/ParamTagRemover.php @@ -16,14 +16,12 @@ final class ParamTagRemover { /** * @readonly - * @var \Rector\DeadCode\PhpDoc\DeadParamTagValueNodeAnalyzer */ - private $deadParamTagValueNodeAnalyzer; + private DeadParamTagValueNodeAnalyzer $deadParamTagValueNodeAnalyzer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(DeadParamTagValueNodeAnalyzer $deadParamTagValueNodeAnalyzer, DocBlockUpdater $docBlockUpdater) { $this->deadParamTagValueNodeAnalyzer = $deadParamTagValueNodeAnalyzer; diff --git a/rules/DeadCode/PhpDoc/TagRemover/ReturnTagRemover.php b/rules/DeadCode/PhpDoc/TagRemover/ReturnTagRemover.php index 26266bd1b8e..05caa6f9461 100644 --- a/rules/DeadCode/PhpDoc/TagRemover/ReturnTagRemover.php +++ b/rules/DeadCode/PhpDoc/TagRemover/ReturnTagRemover.php @@ -12,9 +12,8 @@ final class ReturnTagRemover { /** * @readonly - * @var \Rector\DeadCode\PhpDoc\DeadReturnTagValueNodeAnalyzer */ - private $deadReturnTagValueNodeAnalyzer; + private DeadReturnTagValueNodeAnalyzer $deadReturnTagValueNodeAnalyzer; public function __construct(DeadReturnTagValueNodeAnalyzer $deadReturnTagValueNodeAnalyzer) { $this->deadReturnTagValueNodeAnalyzer = $deadReturnTagValueNodeAnalyzer; diff --git a/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php b/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php index d3e97eac07e..6587c5a9db8 100644 --- a/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php +++ b/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php @@ -21,34 +21,28 @@ final class VarTagRemover { /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\DoctrineTypeAnalyzer */ - private $doctrineTypeAnalyzer; + private DoctrineTypeAnalyzer $doctrineTypeAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\DeadCode\PhpDoc\DeadVarTagValueNodeAnalyzer */ - private $deadVarTagValueNodeAnalyzer; + private DeadVarTagValueNodeAnalyzer $deadVarTagValueNodeAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; public function __construct(DoctrineTypeAnalyzer $doctrineTypeAnalyzer, PhpDocInfoFactory $phpDocInfoFactory, DeadVarTagValueNodeAnalyzer $deadVarTagValueNodeAnalyzer, PhpDocTypeChanger $phpDocTypeChanger, DocBlockUpdater $docBlockUpdater, TypeComparator $typeComparator) { $this->doctrineTypeAnalyzer = $doctrineTypeAnalyzer; diff --git a/rules/DeadCode/Rector/Array_/RemoveDuplicatedArrayKeyRector.php b/rules/DeadCode/Rector/Array_/RemoveDuplicatedArrayKeyRector.php index a1989fc8a5e..9420326948c 100644 --- a/rules/DeadCode/Rector/Array_/RemoveDuplicatedArrayKeyRector.php +++ b/rules/DeadCode/Rector/Array_/RemoveDuplicatedArrayKeyRector.php @@ -6,7 +6,7 @@ namespace Rector\DeadCode\Rector\Array_; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\PreDec; use PhpParser\Node\Expr\PreInc; use Rector\PhpParser\Printer\BetterStandardPrinter; @@ -20,9 +20,8 @@ final class RemoveDuplicatedArrayKeyRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; public function __construct(BetterStandardPrinter $betterStandardPrinter) { $this->betterStandardPrinter = $betterStandardPrinter; diff --git a/rules/DeadCode/Rector/Assign/RemoveDoubleAssignRector.php b/rules/DeadCode/Rector/Assign/RemoveDoubleAssignRector.php index 2de49d296c8..4d8ab8be0e6 100644 --- a/rules/DeadCode/Rector/Assign/RemoveDoubleAssignRector.php +++ b/rules/DeadCode/Rector/Assign/RemoveDoubleAssignRector.php @@ -23,14 +23,12 @@ final class RemoveDoubleAssignRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\SideEffect\SideEffectNodeDetector */ - private $sideEffectNodeDetector; + private SideEffectNodeDetector $sideEffectNodeDetector; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(SideEffectNodeDetector $sideEffectNodeDetector, BetterNodeFinder $betterNodeFinder) { $this->sideEffectNodeDetector = $sideEffectNodeDetector; @@ -110,8 +108,6 @@ CODE_SAMPLE } private function isSelfReferencing(Assign $assign) : bool { - return (bool) $this->betterNodeFinder->findFirst($assign->expr, function (Node $subNode) use($assign) : bool { - return $this->nodeComparator->areNodesEqual($assign->var, $subNode); - }); + return (bool) $this->betterNodeFinder->findFirst($assign->expr, fn(Node $subNode): bool => $this->nodeComparator->areNodesEqual($assign->var, $subNode)); } } diff --git a/rules/DeadCode/Rector/Assign/RemoveUnusedVariableAssignRector.php b/rules/DeadCode/Rector/Assign/RemoveUnusedVariableAssignRector.php index 861eda0905c..e0d30389b61 100644 --- a/rules/DeadCode/Rector/Assign/RemoveUnusedVariableAssignRector.php +++ b/rules/DeadCode/Rector/Assign/RemoveUnusedVariableAssignRector.php @@ -32,29 +32,24 @@ final class RemoveUnusedVariableAssignRector extends AbstractRector { /** * @readonly - * @var \Rector\Php\ReservedKeywordAnalyzer */ - private $reservedKeywordAnalyzer; + private ReservedKeywordAnalyzer $reservedKeywordAnalyzer; /** * @readonly - * @var \Rector\DeadCode\SideEffect\SideEffectNodeDetector */ - private $sideEffectNodeDetector; + private SideEffectNodeDetector $sideEffectNodeDetector; /** * @readonly - * @var \Rector\NodeAnalyzer\VariableAnalyzer */ - private $variableAnalyzer; + private VariableAnalyzer $variableAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeManipulator\StmtsManipulator */ - private $stmtsManipulator; + private StmtsManipulator $stmtsManipulator; public function __construct(ReservedKeywordAnalyzer $reservedKeywordAnalyzer, SideEffectNodeDetector $sideEffectNodeDetector, VariableAnalyzer $variableAnalyzer, BetterNodeFinder $betterNodeFinder, StmtsManipulator $stmtsManipulator) { $this->reservedKeywordAnalyzer = $reservedKeywordAnalyzer; @@ -141,9 +136,7 @@ CODE_SAMPLE } private function hasCallLikeInAssignExpr(Expr $expr, Scope $scope) : bool { - return (bool) $this->betterNodeFinder->findFirst($expr, function (Node $subNode) use($scope) : bool { - return $this->sideEffectNodeDetector->detectCallExpr($subNode, $scope); - }); + return (bool) $this->betterNodeFinder->findFirst($expr, fn(Node $subNode): bool => $this->sideEffectNodeDetector->detectCallExpr($subNode, $scope)); } /** * @param Stmt[] $stmts diff --git a/rules/DeadCode/Rector/BooleanAnd/RemoveAndTrueRector.php b/rules/DeadCode/Rector/BooleanAnd/RemoveAndTrueRector.php index c0d6986581a..f04a4d8a1da 100644 --- a/rules/DeadCode/Rector/BooleanAnd/RemoveAndTrueRector.php +++ b/rules/DeadCode/Rector/BooleanAnd/RemoveAndTrueRector.php @@ -17,9 +17,8 @@ final class RemoveAndTrueRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php b/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php index db50f0413c1..b608025b015 100644 --- a/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php +++ b/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\Cast; +use PHPStan\Type\Constant\ConstantArrayType; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Cast; @@ -36,19 +37,16 @@ final class RecastingRemovalRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; /** * @var array, class-string> */ @@ -97,6 +95,15 @@ CODE_SAMPLE if ($nodeType instanceof MixedType) { return null; } + if ($nodeType instanceof ConstantArrayType && $nodeClass === Array_::class) { + if ($this->shouldSkip($node->expr)) { + return null; + } + if ($this->shouldSkipCall($node->expr)) { + return null; + } + return $node->expr; + } $sameNodeType = self::CAST_CLASS_TO_NODE_TYPE[$nodeClass]; if (!$nodeType instanceof $sameNodeType) { return null; diff --git a/rules/DeadCode/Rector/ClassConst/RemoveUnusedPrivateClassConstantRector.php b/rules/DeadCode/Rector/ClassConst/RemoveUnusedPrivateClassConstantRector.php index 9f4e00bdfc6..789960f04bf 100644 --- a/rules/DeadCode/Rector/ClassConst/RemoveUnusedPrivateClassConstantRector.php +++ b/rules/DeadCode/Rector/ClassConst/RemoveUnusedPrivateClassConstantRector.php @@ -3,9 +3,9 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\ClassConst; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Stmt\ClassConst; -use PhpParser\NodeTraverser; use PHPStan\Reflection\ClassReflection; use Rector\NodeManipulator\ClassConstManipulator; use Rector\PHPStan\ScopeFetcher; @@ -20,14 +20,12 @@ final class RemoveUnusedPrivateClassConstantRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\ClassConstManipulator */ - private $classConstManipulator; + private ClassConstManipulator $classConstManipulator; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ClassConstManipulator $classConstManipulator, ReflectionResolver $reflectionResolver) { $this->classConstManipulator = $classConstManipulator; @@ -77,7 +75,7 @@ CODE_SAMPLE if ($this->classConstManipulator->hasClassConstFetch($node, $classReflection)) { return null; } - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } private function shouldSkipClassConst(ClassConst $classConst) : bool { diff --git a/rules/DeadCode/Rector/ClassLike/RemoveAnnotationRector.php b/rules/DeadCode/Rector/ClassLike/RemoveAnnotationRector.php index 4d4800186b9..69d57708727 100644 --- a/rules/DeadCode/Rector/ClassLike/RemoveAnnotationRector.php +++ b/rules/DeadCode/Rector/ClassLike/RemoveAnnotationRector.php @@ -25,23 +25,20 @@ final class RemoveAnnotationRector extends AbstractRector implements Configurabl { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var string[] */ - private $annotationsToRemove = []; + private array $annotationsToRemove = []; public function __construct(PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->phpDocTagRemover = $phpDocTagRemover; diff --git a/rules/DeadCode/Rector/ClassLike/RemoveTypedPropertyNonMockDocblockRector.php b/rules/DeadCode/Rector/ClassLike/RemoveTypedPropertyNonMockDocblockRector.php index 5984622d4ec..0d611959862 100644 --- a/rules/DeadCode/Rector/ClassLike/RemoveTypedPropertyNonMockDocblockRector.php +++ b/rules/DeadCode/Rector/ClassLike/RemoveTypedPropertyNonMockDocblockRector.php @@ -28,19 +28,16 @@ final class RemoveTypedPropertyNonMockDocblockRector extends AbstractRector impl { /** * @readonly - * @var \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover */ - private $varTagRemover; + private VarTagRemover $varTagRemover; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var string */ diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveEmptyClassMethodRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveEmptyClassMethodRector.php index ddc535be930..e11e08c47d0 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveEmptyClassMethodRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveEmptyClassMethodRector.php @@ -27,29 +27,24 @@ final class RemoveEmptyClassMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\ClassMethodManipulator */ - private $classMethodManipulator; + private ClassMethodManipulator $classMethodManipulator; /** * @readonly - * @var \Rector\DeadCode\NodeManipulator\ControllerClassMethodManipulator */ - private $controllerClassMethodManipulator; + private ControllerClassMethodManipulator $controllerClassMethodManipulator; /** * @readonly - * @var \Rector\NodeAnalyzer\ParamAnalyzer */ - private $paramAnalyzer; + private ParamAnalyzer $paramAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(ClassMethodManipulator $classMethodManipulator, ControllerClassMethodManipulator $controllerClassMethodManipulator, ParamAnalyzer $paramAnalyzer, PhpDocInfoFactory $phpDocInfoFactory, BetterNodeFinder $betterNodeFinder) { $this->classMethodManipulator = $classMethodManipulator; diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveNullTagValueNodeRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveNullTagValueNodeRector.php index e851c8c19cb..0e6770a4f2a 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveNullTagValueNodeRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveNullTagValueNodeRector.php @@ -28,14 +28,12 @@ final class RemoveNullTagValueNodeRector extends AbstractRector { /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->docBlockUpdater = $docBlockUpdater; diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedConstructorParamRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedConstructorParamRector.php index a0939c5da30..372d6325ccd 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedConstructorParamRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedConstructorParamRector.php @@ -21,19 +21,16 @@ final class RemoveUnusedConstructorParamRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\ParamAnalyzer */ - private $paramAnalyzer; + private ParamAnalyzer $paramAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\DeadCode\NodeManipulator\ClassMethodParamRemover */ - private $classMethodParamRemover; + private ClassMethodParamRemover $classMethodParamRemover; public function __construct(ParamAnalyzer $paramAnalyzer, ReflectionResolver $reflectionResolver, ClassMethodParamRemover $classMethodParamRemover) { $this->paramAnalyzer = $paramAnalyzer; diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodParameterRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodParameterRector.php index a76e938dc31..6548f1195dd 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodParameterRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodParameterRector.php @@ -26,34 +26,28 @@ final class RemoveUnusedPrivateMethodParameterRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\NodeManipulator\VariadicFunctionLikeDetector */ - private $variadicFunctionLikeDetector; + private VariadicFunctionLikeDetector $variadicFunctionLikeDetector; /** * @readonly - * @var \Rector\DeadCode\NodeCollector\UnusedParameterResolver */ - private $unusedParameterResolver; + private UnusedParameterResolver $unusedParameterResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(VariadicFunctionLikeDetector $variadicFunctionLikeDetector, UnusedParameterResolver $unusedParameterResolver, PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory, BetterNodeFinder $betterNodeFinder) { $this->variadicFunctionLikeDetector = $variadicFunctionLikeDetector; diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodRector.php index a7878ea276a..9467aed3198 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodRector.php @@ -25,19 +25,16 @@ final class RemoveUnusedPrivateMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\NodeAnalyzer\IsClassMethodUsedAnalyzer */ - private $isClassMethodUsedAnalyzer; + private IsClassMethodUsedAnalyzer $isClassMethodUsedAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(IsClassMethodUsedAnalyzer $isClassMethodUsedAnalyzer, ReflectionResolver $reflectionResolver, BetterNodeFinder $betterNodeFinder) { $this->isClassMethodUsedAnalyzer = $isClassMethodUsedAnalyzer; @@ -88,9 +85,7 @@ CODE_SAMPLE if ($classMethods === []) { return null; } - $filter = static function (ClassMethod $classMethod) : bool { - return $classMethod->isPrivate(); - }; + $filter = static fn(ClassMethod $classMethod): bool => $classMethod->isPrivate(); $privateMethods = \array_filter($classMethods, $filter); if ($privateMethods === []) { return null; diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPromotedPropertyRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPromotedPropertyRector.php index 9235c073dd8..afbb08be591 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPromotedPropertyRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPromotedPropertyRector.php @@ -33,44 +33,36 @@ final class RemoveUnusedPromotedPropertyRector extends AbstractRector implements { /** * @readonly - * @var \Rector\PhpParser\NodeFinder\PropertyFetchFinder */ - private $propertyFetchFinder; + private PropertyFetchFinder $propertyFetchFinder; /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @readonly - * @var \Rector\DeadCode\NodeAnalyzer\PropertyWriteonlyAnalyzer */ - private $propertyWriteonlyAnalyzer; + private PropertyWriteonlyAnalyzer $propertyWriteonlyAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(PropertyFetchFinder $propertyFetchFinder, VisibilityManipulator $visibilityManipulator, PropertyWriteonlyAnalyzer $propertyWriteonlyAnalyzer, BetterNodeFinder $betterNodeFinder, ReflectionResolver $reflectionResolver, PhpDocInfoFactory $phpDocInfoFactory, PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater) { $this->propertyFetchFinder = $propertyFetchFinder; diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPublicMethodParameterRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPublicMethodParameterRector.php index 733d00ed061..679f62f46c6 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPublicMethodParameterRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPublicMethodParameterRector.php @@ -21,24 +21,20 @@ final class RemoveUnusedPublicMethodParameterRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\NodeManipulator\VariadicFunctionLikeDetector */ - private $variadicFunctionLikeDetector; + private VariadicFunctionLikeDetector $variadicFunctionLikeDetector; /** * @readonly - * @var \Rector\DeadCode\NodeManipulator\ClassMethodParamRemover */ - private $classMethodParamRemover; + private ClassMethodParamRemover $classMethodParamRemover; /** * @readonly - * @var \Rector\NodeAnalyzer\MagicClassMethodAnalyzer */ - private $magicClassMethodAnalyzer; + private MagicClassMethodAnalyzer $magicClassMethodAnalyzer; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; public function __construct(VariadicFunctionLikeDetector $variadicFunctionLikeDetector, ClassMethodParamRemover $classMethodParamRemover, MagicClassMethodAnalyzer $magicClassMethodAnalyzer, PhpAttributeAnalyzer $phpAttributeAnalyzer) { $this->variadicFunctionLikeDetector = $variadicFunctionLikeDetector; diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUselessParamTagRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUselessParamTagRector.php index 329eeb0a9e6..64f15f15aca 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUselessParamTagRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUselessParamTagRector.php @@ -19,14 +19,12 @@ final class RemoveUselessParamTagRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\PhpDoc\TagRemover\ParamTagRemover */ - private $paramTagRemover; + private ParamTagRemover $paramTagRemover; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(ParamTagRemover $paramTagRemover, PhpDocInfoFactory $phpDocInfoFactory) { $this->paramTagRemover = $paramTagRemover; diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnExprInConstructRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnExprInConstructRector.php index 80cddebefe1..d5d2b5c08c1 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnExprInConstructRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnExprInConstructRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\ClassMethod; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Closure; @@ -11,7 +12,6 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Return_; -use PhpParser\NodeTraverser; use Rector\NodeAnalyzer\ExprAnalyzer; use Rector\Rector\AbstractRector; use Rector\ValueObject\MethodName; @@ -24,9 +24,8 @@ final class RemoveUselessReturnExprInConstructRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; public function __construct(ExprAnalyzer $exprAnalyzer) { $this->exprAnalyzer = $exprAnalyzer; @@ -93,7 +92,7 @@ CODE_SAMPLE $hasChanged = \false; $this->traverseNodesWithCallable($node->stmts, function (Node $subNode) use(&$hasChanged) { if ($subNode instanceof Class_ || $subNode instanceof Function_ || $subNode instanceof Closure) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$subNode instanceof Return_) { return null; diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector.php index 89d6b918e47..fa927ea1b81 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector.php @@ -19,19 +19,16 @@ final class RemoveUselessReturnTagRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\PhpDoc\TagRemover\ReturnTagRemover */ - private $returnTagRemover; + private ReturnTagRemover $returnTagRemover; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(ReturnTagRemover $returnTagRemover, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->returnTagRemover = $returnTagRemover; diff --git a/rules/DeadCode/Rector/ConstFetch/RemovePhpVersionIdCheckRector.php b/rules/DeadCode/Rector/ConstFetch/RemovePhpVersionIdCheckRector.php index 35c2d9776d0..ad62383cc1b 100644 --- a/rules/DeadCode/Rector/ConstFetch/RemovePhpVersionIdCheckRector.php +++ b/rules/DeadCode/Rector/ConstFetch/RemovePhpVersionIdCheckRector.php @@ -3,16 +3,16 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\ConstFetch; +use PhpParser\NodeVisitor; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\BinaryOp\Greater; use PhpParser\Node\Expr\BinaryOp\GreaterOrEqual; use PhpParser\Node\Expr\BinaryOp\Smaller; use PhpParser\Node\Expr\ConstFetch; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\If_; -use PhpParser\NodeTraverser; use Rector\Php\PhpVersionProvider; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersion; @@ -25,9 +25,8 @@ final class RemovePhpVersionIdCheckRector extends AbstractRector { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @var PhpVersion::*|null */ @@ -126,11 +125,11 @@ CODE_SAMPLE private function refactorSmallerLeft(Smaller $smaller) : ?int { $value = $smaller->right; - if (!$value instanceof LNumber) { + if (!$value instanceof Int_) { return null; } if ($this->phpVersion >= $value->value) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } return null; } @@ -140,14 +139,14 @@ CODE_SAMPLE private function refactorSmallerRight(Smaller $smaller, If_ $if) { $value = $smaller->left; - if (!$value instanceof LNumber) { + if (!$value instanceof Int_) { return null; } if ($this->phpVersion < $value->value) { return null; } if ($if->stmts === []) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } return $if->stmts; } @@ -157,25 +156,25 @@ CODE_SAMPLE private function refactorGreaterOrEqualLeft(GreaterOrEqual $greaterOrEqual, If_ $if) { $value = $greaterOrEqual->right; - if (!$value instanceof LNumber) { + if (!$value instanceof Int_) { return null; } if ($this->phpVersion < $value->value) { return null; } if ($if->stmts === []) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } return $if->stmts; } private function refactorGreaterOrEqualRight(GreaterOrEqual $greaterOrEqual) : ?int { $value = $greaterOrEqual->left; - if (!$value instanceof LNumber) { + if (!$value instanceof Int_) { return null; } if ($this->phpVersion >= $value->value) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } return null; } @@ -198,25 +197,25 @@ CODE_SAMPLE private function refactorGreaterLeft(Greater $greater, If_ $if) { $value = $greater->right; - if (!$value instanceof LNumber) { + if (!$value instanceof Int_) { return null; } if ($this->phpVersion < $value->value) { return null; } if ($if->stmts === []) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } return $if->stmts; } private function refactorGreaterRight(Greater $greater) : ?int { $value = $greater->left; - if (!$value instanceof LNumber) { + if (!$value instanceof Int_) { return null; } if ($this->phpVersion >= $value->value) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } return null; } diff --git a/rules/DeadCode/Rector/Expression/RemoveDeadStmtRector.php b/rules/DeadCode/Rector/Expression/RemoveDeadStmtRector.php index 38ce28d4275..6642246f17f 100644 --- a/rules/DeadCode/Rector/Expression/RemoveDeadStmtRector.php +++ b/rules/DeadCode/Rector/Expression/RemoveDeadStmtRector.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\Expression; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\StaticPropertyFetch; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Nop; -use PhpParser\NodeTraverser; use PHPStan\Reflection\Php\PhpPropertyReflection; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\DeadCode\NodeManipulator\LivingCodeManipulator; @@ -25,24 +25,20 @@ final class RemoveDeadStmtRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\NodeManipulator\LivingCodeManipulator */ - private $livingCodeManipulator; + private LivingCodeManipulator $livingCodeManipulator; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(LivingCodeManipulator $livingCodeManipulator, PropertyFetchAnalyzer $propertyFetchAnalyzer, ReflectionResolver $reflectionResolver, PhpDocInfoFactory $phpDocInfoFactory) { $this->livingCodeManipulator = $livingCodeManipulator; @@ -118,6 +114,6 @@ CODE_SAMPLE $nop->setAttribute(AttributeKey::PHP_DOC_INFO, $phpDocInfo); return $nop; } - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } } diff --git a/rules/DeadCode/Rector/Expression/SimplifyMirrorAssignRector.php b/rules/DeadCode/Rector/Expression/SimplifyMirrorAssignRector.php index 37f9ea090d9..c09032cab1d 100644 --- a/rules/DeadCode/Rector/Expression/SimplifyMirrorAssignRector.php +++ b/rules/DeadCode/Rector/Expression/SimplifyMirrorAssignRector.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\Expression; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Stmt\Expression; -use PhpParser\NodeTraverser; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -47,6 +47,6 @@ CODE_SAMPLE if (!$this->nodeComparator->areNodesEqual($assign->var, $assign->expr)) { return null; } - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } } diff --git a/rules/DeadCode/Rector/For_/RemoveDeadContinueRector.php b/rules/DeadCode/Rector/For_/RemoveDeadContinueRector.php index 1bd7165c9be..511c6d6121d 100644 --- a/rules/DeadCode/Rector/For_/RemoveDeadContinueRector.php +++ b/rules/DeadCode/Rector/For_/RemoveDeadContinueRector.php @@ -3,8 +3,8 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\For_; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Continue_; use PhpParser\Node\Stmt\Do_; @@ -61,9 +61,7 @@ CODE_SAMPLE if ($stmts === []) { return \false; } - \end($stmts); - $lastKey = \key($stmts); - \reset($stmts); + $lastKey = \array_key_last($stmts); $lastStmt = $stmts[$lastKey]; return $this->isRemovable($lastStmt); } @@ -72,7 +70,7 @@ CODE_SAMPLE if (!$stmt instanceof Continue_) { return \false; } - if ($stmt->num instanceof LNumber) { + if ($stmt->num instanceof Int_) { return $stmt->num->value < 2; } return \true; diff --git a/rules/DeadCode/Rector/For_/RemoveDeadIfForeachForRector.php b/rules/DeadCode/Rector/For_/RemoveDeadIfForeachForRector.php index fbdb0b8dce3..e326814c663 100644 --- a/rules/DeadCode/Rector/For_/RemoveDeadIfForeachForRector.php +++ b/rules/DeadCode/Rector/For_/RemoveDeadIfForeachForRector.php @@ -26,23 +26,17 @@ final class RemoveDeadIfForeachForRector extends AbstractRector { /** * @readonly - * @var \Rector\EarlyReturn\NodeTransformer\ConditionInverter */ - private $conditionInverter; + private ConditionInverter $conditionInverter; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeManipulator\StmtsManipulator */ - private $stmtsManipulator; - /** - * @var bool - */ - private $hasChanged = \false; + private StmtsManipulator $stmtsManipulator; + private bool $hasChanged = \false; public function __construct(ConditionInverter $conditionInverter, BetterNodeFinder $betterNodeFinder, StmtsManipulator $stmtsManipulator) { $this->conditionInverter = $conditionInverter; @@ -86,9 +80,8 @@ CODE_SAMPLE } /** * @param StmtsAwareInterface $node - * @return \PhpParser\Node|null|int */ - public function refactor(Node $node) + public function refactor(Node $node) : ?\PhpParser\Node { if ($node->stmts === null) { return null; @@ -148,7 +141,7 @@ CODE_SAMPLE $this->hasChanged = \true; return; } - $exprs = \array_filter([$for->expr, $for->valueVar, $for->valueVar]); + $exprs = [$for->expr, $for->valueVar, $for->valueVar]; $variables = $this->betterNodeFinder->findInstanceOf($exprs, Variable::class); foreach ($variables as $variable) { if ($this->stmtsManipulator->isVariableUsedInNextStmt($stmts, $key + 1, (string) $this->getName($variable))) { diff --git a/rules/DeadCode/Rector/For_/RemoveDeadLoopRector.php b/rules/DeadCode/Rector/For_/RemoveDeadLoopRector.php index bc320ae08a0..4faa1709420 100644 --- a/rules/DeadCode/Rector/For_/RemoveDeadLoopRector.php +++ b/rules/DeadCode/Rector/For_/RemoveDeadLoopRector.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\For_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Stmt\Do_; use PhpParser\Node\Stmt\For_; use PhpParser\Node\Stmt\Foreach_; use PhpParser\Node\Stmt\While_; -use PhpParser\NodeTraverser; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -54,6 +54,6 @@ CODE_SAMPLE if ($node->stmts !== []) { return null; } - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } } diff --git a/rules/DeadCode/Rector/Foreach_/RemoveUnusedForeachKeyRector.php b/rules/DeadCode/Rector/Foreach_/RemoveUnusedForeachKeyRector.php index deb5fd321f9..0f01882b8f2 100644 --- a/rules/DeadCode/Rector/Foreach_/RemoveUnusedForeachKeyRector.php +++ b/rules/DeadCode/Rector/Foreach_/RemoveUnusedForeachKeyRector.php @@ -23,24 +23,20 @@ final class RemoveUnusedForeachKeyRector extends AbstractRector { /** * @readonly - * @var \PhpParser\NodeFinder */ - private $nodeFinder; + private NodeFinder $nodeFinder; /** * @readonly - * @var \Rector\NodeManipulator\StmtsManipulator */ - private $stmtsManipulator; + private StmtsManipulator $stmtsManipulator; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(NodeFinder $nodeFinder, StmtsManipulator $stmtsManipulator, PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater) { $this->nodeFinder = $nodeFinder; @@ -88,9 +84,7 @@ CODE_SAMPLE continue; } $keyVar = $stmt->keyVar; - $isNodeUsed = (bool) $this->nodeFinder->findFirst($stmt->stmts, function (Node $node) use($keyVar) : bool { - return $this->nodeComparator->areNodesEqual($node, $keyVar); - }); + $isNodeUsed = (bool) $this->nodeFinder->findFirst($stmt->stmts, fn(Node $node): bool => $this->nodeComparator->areNodesEqual($node, $keyVar)); if ($isNodeUsed) { continue; } diff --git a/rules/DeadCode/Rector/FunctionLike/RemoveDeadReturnRector.php b/rules/DeadCode/Rector/FunctionLike/RemoveDeadReturnRector.php index f4499726847..3238079f3e1 100644 --- a/rules/DeadCode/Rector/FunctionLike/RemoveDeadReturnRector.php +++ b/rules/DeadCode/Rector/FunctionLike/RemoveDeadReturnRector.php @@ -66,9 +66,7 @@ CODE_SAMPLE if ($node->stmts === [] || $node->stmts === null) { return null; } - \end($node->stmts); - $lastStmtKey = \key($node->stmts); - \reset($node->stmts); + $lastStmtKey = \array_key_last($node->stmts); $lastStmt = $node->stmts[$lastStmtKey]; if ($lastStmt instanceof If_) { if (!$this->isBareIfWithOnlyStmtEmptyReturn($lastStmt)) { diff --git a/rules/DeadCode/Rector/If_/ReduceAlwaysFalseIfOrRector.php b/rules/DeadCode/Rector/If_/ReduceAlwaysFalseIfOrRector.php index 87e3d6d0b4b..3add425a7e9 100644 --- a/rules/DeadCode/Rector/If_/ReduceAlwaysFalseIfOrRector.php +++ b/rules/DeadCode/Rector/If_/ReduceAlwaysFalseIfOrRector.php @@ -17,9 +17,8 @@ final class ReduceAlwaysFalseIfOrRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\NodeAnalyzer\SafeLeftTypeBooleanAndOrAnalyzer */ - private $safeLeftTypeBooleanAndOrAnalyzer; + private SafeLeftTypeBooleanAndOrAnalyzer $safeLeftTypeBooleanAndOrAnalyzer; public function __construct(SafeLeftTypeBooleanAndOrAnalyzer $safeLeftTypeBooleanAndOrAnalyzer) { $this->safeLeftTypeBooleanAndOrAnalyzer = $safeLeftTypeBooleanAndOrAnalyzer; diff --git a/rules/DeadCode/Rector/If_/RemoveAlwaysTrueIfConditionRector.php b/rules/DeadCode/Rector/If_/RemoveAlwaysTrueIfConditionRector.php index b08b1e200fe..5e2a39f6f11 100644 --- a/rules/DeadCode/Rector/If_/RemoveAlwaysTrueIfConditionRector.php +++ b/rules/DeadCode/Rector/If_/RemoveAlwaysTrueIfConditionRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\If_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrayDimFetch; @@ -16,7 +17,6 @@ use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Else_; use PhpParser\Node\Stmt\If_; -use PhpParser\NodeTraverser; use PHPStan\Type\IntersectionType; use Rector\DeadCode\NodeAnalyzer\SafeLeftTypeBooleanAndOrAnalyzer; use Rector\NodeAnalyzer\ExprAnalyzer; @@ -31,19 +31,16 @@ final class RemoveAlwaysTrueIfConditionRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\DeadCode\NodeAnalyzer\SafeLeftTypeBooleanAndOrAnalyzer */ - private $safeLeftTypeBooleanAndOrAnalyzer; + private SafeLeftTypeBooleanAndOrAnalyzer $safeLeftTypeBooleanAndOrAnalyzer; public function __construct(ExprAnalyzer $exprAnalyzer, BetterNodeFinder $betterNodeFinder, SafeLeftTypeBooleanAndOrAnalyzer $safeLeftTypeBooleanAndOrAnalyzer) { $this->exprAnalyzer = $exprAnalyzer; @@ -116,7 +113,7 @@ CODE_SAMPLE return null; } if ($node->stmts === []) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } return $node->stmts; } diff --git a/rules/DeadCode/Rector/If_/RemoveDeadInstanceOfRector.php b/rules/DeadCode/Rector/If_/RemoveDeadInstanceOfRector.php index e741276436f..2f99f997d63 100644 --- a/rules/DeadCode/Rector/If_/RemoveDeadInstanceOfRector.php +++ b/rules/DeadCode/Rector/If_/RemoveDeadInstanceOfRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\If_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Assign; @@ -16,7 +17,6 @@ use PhpParser\Node\Name; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\If_; -use PhpParser\NodeTraverser; use PHPStan\Reflection\ClassReflection; use PHPStan\Type\MixedType; use PHPStan\Type\ObjectType; @@ -32,14 +32,12 @@ final class RemoveDeadInstanceOfRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\IfManipulator */ - private $ifManipulator; + private IfManipulator $ifManipulator; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(IfManipulator $ifManipulator, ReflectionResolver $reflectionResolver) { $this->ifManipulator = $ifManipulator; @@ -108,10 +106,10 @@ CODE_SAMPLE return \array_merge([$assignExpression], $if->stmts); } if ($if->cond !== $instanceof) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } if ($if->stmts === []) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } // unwrap stmts return $if->stmts; diff --git a/rules/DeadCode/Rector/If_/RemoveTypedPropertyDeadInstanceOfRector.php b/rules/DeadCode/Rector/If_/RemoveTypedPropertyDeadInstanceOfRector.php index 7684a54a3d7..ac36bd56f2b 100644 --- a/rules/DeadCode/Rector/If_/RemoveTypedPropertyDeadInstanceOfRector.php +++ b/rules/DeadCode/Rector/If_/RemoveTypedPropertyDeadInstanceOfRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\If_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\BooleanNot; use PhpParser\Node\Expr\Instanceof_; @@ -17,7 +18,6 @@ use PhpParser\Node\Stmt\Foreach_; use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\Property; use PhpParser\Node\Stmt\While_; -use PhpParser\NodeTraverser; use Rector\NodeManipulator\IfManipulator; use Rector\Php80\NodeAnalyzer\PromotedPropertyResolver; use Rector\Rector\AbstractRector; @@ -31,19 +31,16 @@ final class RemoveTypedPropertyDeadInstanceOfRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\IfManipulator */ - private $ifManipulator; + private IfManipulator $ifManipulator; /** * @readonly - * @var \Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector */ - private $constructorAssignDetector; + private ConstructorAssignDetector $constructorAssignDetector; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PromotedPropertyResolver */ - private $promotedPropertyResolver; + private PromotedPropertyResolver $promotedPropertyResolver; public function __construct(IfManipulator $ifManipulator, ConstructorAssignDetector $constructorAssignDetector, PromotedPropertyResolver $promotedPropertyResolver) { $this->ifManipulator = $ifManipulator; @@ -107,7 +104,7 @@ CODE_SAMPLE $this->traverseNodesWithCallable($node->getMethods(), function (Node $node) use(&$hasChanged, $class) { // avoid loop ifs if ($node instanceof While_ || $node instanceof Foreach_ || $node instanceof For_ || $node instanceof Do_) { - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } if (!$node instanceof If_) { return null; @@ -158,10 +155,10 @@ CODE_SAMPLE return null; } if ($if->cond !== $instanceof) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } if ($if->stmts === []) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } return $if->stmts; } @@ -181,7 +178,7 @@ CODE_SAMPLE if (!$property instanceof Property) { return \true; } - return $property->type === null; + return !$property->type instanceof Node; } /** * @param \PhpParser\Node\Expr\PropertyFetch|\PhpParser\Node\Expr\StaticPropertyFetch $propertyFetch diff --git a/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php b/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php index 8dd5a2cfbb1..63f87dbeeee 100644 --- a/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php +++ b/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php @@ -31,29 +31,24 @@ final class RemoveUnusedNonEmptyArrayBeforeForeachRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\NodeManipulator\CountManipulator */ - private $countManipulator; + private CountManipulator $countManipulator; /** * @readonly - * @var \Rector\NodeManipulator\IfManipulator */ - private $ifManipulator; + private IfManipulator $ifManipulator; /** * @readonly - * @var \Rector\DeadCode\UselessIfCondBeforeForeachDetector */ - private $uselessIfCondBeforeForeachDetector; + private UselessIfCondBeforeForeachDetector $uselessIfCondBeforeForeachDetector; /** * @readonly - * @var \Rector\Php\ReservedKeywordAnalyzer */ - private $reservedKeywordAnalyzer; + private ReservedKeywordAnalyzer $reservedKeywordAnalyzer; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; public function __construct(CountManipulator $countManipulator, IfManipulator $ifManipulator, UselessIfCondBeforeForeachDetector $uselessIfCondBeforeForeachDetector, ReservedKeywordAnalyzer $reservedKeywordAnalyzer, PropertyFetchAnalyzer $propertyFetchAnalyzer) { $this->countManipulator = $countManipulator; @@ -101,7 +96,7 @@ CODE_SAMPLE } /** * @param If_|StmtsAwareInterface $node - * @return Stmt[]|Foreach_|StmtsAwareInterface|null + * @return Foreach_|StmtsAwareInterface|null */ public function refactor(Node $node) { @@ -200,7 +195,7 @@ CODE_SAMPLE } private function shouldSkipForeachExpr(Expr $foreachExpr, Scope $scope) : bool { - if ($foreachExpr instanceof ArrayDimFetch && $foreachExpr->dim !== null) { + if ($foreachExpr instanceof ArrayDimFetch && $foreachExpr->dim instanceof Expr) { $exprType = $this->nodeTypeResolver->getNativeType($foreachExpr->var); $dimType = $this->nodeTypeResolver->getNativeType($foreachExpr->dim); if (!$exprType->hasOffsetValueType($dimType)->yes()) { diff --git a/rules/DeadCode/Rector/If_/SimplifyIfElseWithSameContentRector.php b/rules/DeadCode/Rector/If_/SimplifyIfElseWithSameContentRector.php index 3de2abf5bde..dafe763cc72 100644 --- a/rules/DeadCode/Rector/If_/SimplifyIfElseWithSameContentRector.php +++ b/rules/DeadCode/Rector/If_/SimplifyIfElseWithSameContentRector.php @@ -19,9 +19,8 @@ final class SimplifyIfElseWithSameContentRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; public function __construct(BetterStandardPrinter $betterStandardPrinter) { $this->betterStandardPrinter = $betterStandardPrinter; diff --git a/rules/DeadCode/Rector/If_/UnwrapFutureCompatibleIfPhpVersionRector.php b/rules/DeadCode/Rector/If_/UnwrapFutureCompatibleIfPhpVersionRector.php index c2d986fc4f1..3cf95e2a150 100644 --- a/rules/DeadCode/Rector/If_/UnwrapFutureCompatibleIfPhpVersionRector.php +++ b/rules/DeadCode/Rector/If_/UnwrapFutureCompatibleIfPhpVersionRector.php @@ -3,11 +3,11 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\If_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Else_; use PhpParser\Node\Stmt\If_; -use PhpParser\NodeTraverser; use Rector\DeadCode\ConditionEvaluator; use Rector\DeadCode\ConditionResolver; use Rector\DeadCode\Contract\ConditionInterface; @@ -21,14 +21,12 @@ final class UnwrapFutureCompatibleIfPhpVersionRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\ConditionEvaluator */ - private $conditionEvaluator; + private ConditionEvaluator $conditionEvaluator; /** * @readonly - * @var \Rector\DeadCode\ConditionResolver */ - private $conditionResolver; + private ConditionResolver $conditionResolver; public function __construct(ConditionEvaluator $conditionEvaluator, ConditionResolver $conditionResolver) { $this->conditionEvaluator = $conditionEvaluator; @@ -100,7 +98,7 @@ CODE_SAMPLE { // no else → just remove the node if (!$if->else instanceof Else_) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } // else is always used return $if->else->stmts; diff --git a/rules/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector.php b/rules/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector.php index 8f93d62a4ad..7dfeb77df6e 100644 --- a/rules/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector.php +++ b/rules/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector.php @@ -19,7 +19,6 @@ use PhpParser\Node\Stmt\Nop; use PhpParser\Node\Stmt\Return_; use PhpParser\Node\Stmt\Static_; use PhpParser\Node\Stmt\Switch_; -use PhpParser\Node\Stmt\Throw_; use PhpParser\Node\Stmt\While_; use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; @@ -39,33 +38,28 @@ final class RemoveNonExistingVarAnnotationRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\StmtsManipulator */ - private $stmtsManipulator; + private StmtsManipulator $stmtsManipulator; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @var array> */ - private const NODE_TYPES = [Foreach_::class, Static_::class, Echo_::class, Return_::class, Expression::class, Throw_::class, If_::class, While_::class, Switch_::class, Nop::class]; + private const NODE_TYPES = [Foreach_::class, Static_::class, Echo_::class, Return_::class, Expression::class, If_::class, While_::class, Switch_::class, Nop::class]; public function __construct(StmtsManipulator $stmtsManipulator, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory, ValueResolver $valueResolver, BetterNodeFinder $betterNodeFinder) { $this->stmtsManipulator = $stmtsManipulator; diff --git a/rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php b/rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php index 67cb0ff719c..63d60cdb904 100644 --- a/rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php +++ b/rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php @@ -28,9 +28,8 @@ final class RemoveDeadZeroAndOneOperationRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/DeadCode/Rector/Property/RemoveUnusedPrivatePropertyRector.php b/rules/DeadCode/Rector/Property/RemoveUnusedPrivatePropertyRector.php index 2282a849f07..c1fd9130e47 100644 --- a/rules/DeadCode/Rector/Property/RemoveUnusedPrivatePropertyRector.php +++ b/rules/DeadCode/Rector/Property/RemoveUnusedPrivatePropertyRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\Property; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Stmt\Class_; @@ -10,7 +11,6 @@ use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Property; use PhpParser\Node\Stmt\Return_; use PhpParser\Node\Stmt\TraitUse; -use PhpParser\NodeTraverser; use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; @@ -26,19 +26,16 @@ final class RemoveUnusedPrivatePropertyRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\NodeFinder\PropertyFetchFinder */ - private $propertyFetchFinder; + private PropertyFetchFinder $propertyFetchFinder; /** * @readonly - * @var \Rector\DeadCode\NodeAnalyzer\PropertyWriteonlyAnalyzer */ - private $propertyWriteonlyAnalyzer; + private PropertyWriteonlyAnalyzer $propertyWriteonlyAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(PropertyFetchFinder $propertyFetchFinder, PropertyWriteonlyAnalyzer $propertyWriteonlyAnalyzer, PhpDocInfoFactory $phpDocInfoFactory) { $this->propertyFetchFinder = $propertyFetchFinder; @@ -153,7 +150,7 @@ CODE_SAMPLE return null; } if ($node instanceof Expression) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } $node->expr = $node->expr->expr; return $node; diff --git a/rules/DeadCode/Rector/Property/RemoveUselessReadOnlyTagRector.php b/rules/DeadCode/Rector/Property/RemoveUselessReadOnlyTagRector.php index cf0b6ff17a3..fffb40fa9a6 100644 --- a/rules/DeadCode/Rector/Property/RemoveUselessReadOnlyTagRector.php +++ b/rules/DeadCode/Rector/Property/RemoveUselessReadOnlyTagRector.php @@ -24,19 +24,16 @@ final class RemoveUselessReadOnlyTagRector extends AbstractRector implements Min { /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(VisibilityManipulator $visibilityManipulator, PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater) { $this->visibilityManipulator = $visibilityManipulator; diff --git a/rules/DeadCode/Rector/Property/RemoveUselessVarTagRector.php b/rules/DeadCode/Rector/Property/RemoveUselessVarTagRector.php index 891c3c2cc36..0aa35d3f532 100644 --- a/rules/DeadCode/Rector/Property/RemoveUselessVarTagRector.php +++ b/rules/DeadCode/Rector/Property/RemoveUselessVarTagRector.php @@ -17,14 +17,12 @@ final class RemoveUselessVarTagRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover */ - private $varTagRemover; + private VarTagRemover $varTagRemover; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(VarTagRemover $varTagRemover, PhpDocInfoFactory $phpDocInfoFactory) { $this->varTagRemover = $varTagRemover; diff --git a/rules/DeadCode/Rector/Return_/RemoveDeadConditionAboveReturnRector.php b/rules/DeadCode/Rector/Return_/RemoveDeadConditionAboveReturnRector.php index 17b8f9c43d8..30f5154c012 100644 --- a/rules/DeadCode/Rector/Return_/RemoveDeadConditionAboveReturnRector.php +++ b/rules/DeadCode/Rector/Return_/RemoveDeadConditionAboveReturnRector.php @@ -22,9 +22,8 @@ final class RemoveDeadConditionAboveReturnRector extends AbstractRector { /** * @readonly - * @var \Rector\DeadCode\SideEffect\SideEffectNodeDetector */ - private $sideEffectNodeDetector; + private SideEffectNodeDetector $sideEffectNodeDetector; public function __construct(SideEffectNodeDetector $sideEffectNodeDetector) { $this->sideEffectNodeDetector = $sideEffectNodeDetector; diff --git a/rules/DeadCode/Rector/StaticCall/RemoveParentCallWithoutParentRector.php b/rules/DeadCode/Rector/StaticCall/RemoveParentCallWithoutParentRector.php index 5bd234b653b..adf72e3c49d 100644 --- a/rules/DeadCode/Rector/StaticCall/RemoveParentCallWithoutParentRector.php +++ b/rules/DeadCode/Rector/StaticCall/RemoveParentCallWithoutParentRector.php @@ -25,19 +25,16 @@ final class RemoveParentCallWithoutParentRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\ClassMethodManipulator */ - private $classMethodManipulator; + private ClassMethodManipulator $classMethodManipulator; /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(ClassMethodManipulator $classMethodManipulator, ClassAnalyzer $classAnalyzer, ReflectionProvider $reflectionProvider) { $this->classMethodManipulator = $classMethodManipulator; diff --git a/rules/DeadCode/Rector/Stmt/RemoveUnreachableStatementRector.php b/rules/DeadCode/Rector/Stmt/RemoveUnreachableStatementRector.php index 546b75b24b7..0798616b281 100644 --- a/rules/DeadCode/Rector/Stmt/RemoveUnreachableStatementRector.php +++ b/rules/DeadCode/Rector/Stmt/RemoveUnreachableStatementRector.php @@ -17,9 +17,8 @@ final class RemoveUnreachableStatementRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\TerminatedNodeAnalyzer */ - private $terminatedNodeAnalyzer; + private TerminatedNodeAnalyzer $terminatedNodeAnalyzer; public function __construct(TerminatedNodeAnalyzer $terminatedNodeAnalyzer) { $this->terminatedNodeAnalyzer = $terminatedNodeAnalyzer; diff --git a/rules/DeadCode/Rector/Switch_/RemoveDuplicatedCaseInSwitchRector.php b/rules/DeadCode/Rector/Switch_/RemoveDuplicatedCaseInSwitchRector.php index fc9d864a779..9963045d1be 100644 --- a/rules/DeadCode/Rector/Switch_/RemoveDuplicatedCaseInSwitchRector.php +++ b/rules/DeadCode/Rector/Switch_/RemoveDuplicatedCaseInSwitchRector.php @@ -16,10 +16,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; */ final class RemoveDuplicatedCaseInSwitchRector extends AbstractRector { - /** - * @var bool - */ - private $hasChanged = \false; + private bool $hasChanged = \false; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('2 following switch keys with identical will be reduced to one result', [new CodeSample(<<<'CODE_SAMPLE' diff --git a/rules/DeadCode/Rector/Ternary/TernaryToBooleanOrFalseToBooleanAndRector.php b/rules/DeadCode/Rector/Ternary/TernaryToBooleanOrFalseToBooleanAndRector.php index 7c0cc94de21..f02e63329c9 100644 --- a/rules/DeadCode/Rector/Ternary/TernaryToBooleanOrFalseToBooleanAndRector.php +++ b/rules/DeadCode/Rector/Ternary/TernaryToBooleanOrFalseToBooleanAndRector.php @@ -18,9 +18,8 @@ final class TernaryToBooleanOrFalseToBooleanAndRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/DeadCode/Rector/TryCatch/RemoveDeadTryCatchRector.php b/rules/DeadCode/Rector/TryCatch/RemoveDeadTryCatchRector.php index a01f9adc5ba..3d609868012 100644 --- a/rules/DeadCode/Rector/TryCatch/RemoveDeadTryCatchRector.php +++ b/rules/DeadCode/Rector/TryCatch/RemoveDeadTryCatchRector.php @@ -3,13 +3,14 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\TryCatch; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Finally_; use PhpParser\Node\Stmt\Nop; -use PhpParser\Node\Stmt\Throw_; +use PhpParser\Node\Expr\Throw_; +use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\TryCatch; -use PhpParser\NodeTraverser; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -53,7 +54,7 @@ CODE_SAMPLE } /** * @param TryCatch $node - * @return Stmt[]|null|TryCatch|int + * @return Stmt[]|null|int */ public function refactor(Node $node) { @@ -63,7 +64,7 @@ CODE_SAMPLE return null; } if ($this->isEmpty($node->stmts)) { - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } if (\count($node->catches) !== 1) { return null; @@ -73,10 +74,10 @@ CODE_SAMPLE return null; } $onlyCatchStmt = $onlyCatch->stmts[0]; - if (!$onlyCatchStmt instanceof Throw_) { + if (!($onlyCatchStmt instanceof Expression && $onlyCatchStmt->expr instanceof Throw_)) { return null; } - if (!$this->nodeComparator->areNodesEqual($onlyCatch->var, $onlyCatchStmt->expr)) { + if (!$this->nodeComparator->areNodesEqual($onlyCatch->var, $onlyCatchStmt->expr->expr)) { return null; } return $node->stmts; diff --git a/rules/DeadCode/SideEffect/PureFunctionDetector.php b/rules/DeadCode/SideEffect/PureFunctionDetector.php index 4d655ad2b7c..c79f106a7c3 100644 --- a/rules/DeadCode/SideEffect/PureFunctionDetector.php +++ b/rules/DeadCode/SideEffect/PureFunctionDetector.php @@ -13,14 +13,12 @@ final class PureFunctionDetector { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/DeadCode/SideEffect/SideEffectNodeDetector.php b/rules/DeadCode/SideEffect/SideEffectNodeDetector.php index 0a57d0b4eaa..d54951227ea 100644 --- a/rules/DeadCode/SideEffect/SideEffectNodeDetector.php +++ b/rules/DeadCode/SideEffect/SideEffectNodeDetector.php @@ -23,14 +23,12 @@ final class SideEffectNodeDetector { /** * @readonly - * @var \Rector\DeadCode\SideEffect\PureFunctionDetector */ - private $pureFunctionDetector; + private \Rector\DeadCode\SideEffect\PureFunctionDetector $pureFunctionDetector; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @var array> */ @@ -45,9 +43,7 @@ final class SideEffectNodeDetector if ($expr instanceof Assign) { return \true; } - return (bool) $this->betterNodeFinder->findFirst($expr, function (Node $subNode) use($scope) : bool { - return $this->detectCallExpr($subNode, $scope); - }); + return (bool) $this->betterNodeFinder->findFirst($expr, fn(Node $subNode): bool => $this->detectCallExpr($subNode, $scope)); } public function detectCallExpr(Node $node, Scope $scope) : bool { diff --git a/rules/DeadCode/UselessIfCondBeforeForeachDetector.php b/rules/DeadCode/UselessIfCondBeforeForeachDetector.php index 8d6f4916d98..1572cfc0f4f 100644 --- a/rules/DeadCode/UselessIfCondBeforeForeachDetector.php +++ b/rules/DeadCode/UselessIfCondBeforeForeachDetector.php @@ -17,9 +17,8 @@ final class UselessIfCondBeforeForeachDetector { /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; public function __construct(NodeComparator $nodeComparator) { $this->nodeComparator = $nodeComparator; diff --git a/rules/DeadCode/ValueObject/BinaryToVersionCompareCondition.php b/rules/DeadCode/ValueObject/BinaryToVersionCompareCondition.php index 13bd6888e1c..0d360368290 100644 --- a/rules/DeadCode/ValueObject/BinaryToVersionCompareCondition.php +++ b/rules/DeadCode/ValueObject/BinaryToVersionCompareCondition.php @@ -8,14 +8,12 @@ final class BinaryToVersionCompareCondition implements ConditionInterface { /** * @readonly - * @var \Rector\DeadCode\ValueObject\VersionCompareCondition */ - private $versionCompareCondition; + private \Rector\DeadCode\ValueObject\VersionCompareCondition $versionCompareCondition; /** * @readonly - * @var string */ - private $binaryClass; + private string $binaryClass; /** * @readonly * @var mixed diff --git a/rules/DeadCode/ValueObject/VersionCompareCondition.php b/rules/DeadCode/ValueObject/VersionCompareCondition.php index bb876afbe3c..2e498016afe 100644 --- a/rules/DeadCode/ValueObject/VersionCompareCondition.php +++ b/rules/DeadCode/ValueObject/VersionCompareCondition.php @@ -8,19 +8,16 @@ final class VersionCompareCondition implements ConditionInterface { /** * @readonly - * @var int */ - private $firstVersion; + private int $firstVersion; /** * @readonly - * @var int */ - private $secondVersion; + private int $secondVersion; /** * @readonly - * @var string|null */ - private $compareSign; + private ?string $compareSign; public function __construct(int $firstVersion, int $secondVersion, ?string $compareSign) { $this->firstVersion = $firstVersion; diff --git a/rules/EarlyReturn/NodeTransformer/ConditionInverter.php b/rules/EarlyReturn/NodeTransformer/ConditionInverter.php index 3b969508a87..b6008fc0180 100644 --- a/rules/EarlyReturn/NodeTransformer/ConditionInverter.php +++ b/rules/EarlyReturn/NodeTransformer/ConditionInverter.php @@ -12,9 +12,8 @@ final class ConditionInverter { /** * @readonly - * @var \Rector\NodeManipulator\BinaryOpManipulator */ - private $binaryOpManipulator; + private BinaryOpManipulator $binaryOpManipulator; public function __construct(BinaryOpManipulator $binaryOpManipulator) { $this->binaryOpManipulator = $binaryOpManipulator; diff --git a/rules/EarlyReturn/Rector/Foreach_/ChangeNestedForeachIfsToEarlyContinueRector.php b/rules/EarlyReturn/Rector/Foreach_/ChangeNestedForeachIfsToEarlyContinueRector.php index cb1e4b22f96..927e6a9df48 100644 --- a/rules/EarlyReturn/Rector/Foreach_/ChangeNestedForeachIfsToEarlyContinueRector.php +++ b/rules/EarlyReturn/Rector/Foreach_/ChangeNestedForeachIfsToEarlyContinueRector.php @@ -26,14 +26,12 @@ final class ChangeNestedForeachIfsToEarlyContinueRector extends AbstractRector { /** * @readonly - * @var \Rector\EarlyReturn\NodeTransformer\ConditionInverter */ - private $conditionInverter; + private ConditionInverter $conditionInverter; /** * @readonly - * @var \Rector\NodeManipulator\IfManipulator */ - private $ifManipulator; + private IfManipulator $ifManipulator; public function __construct(ConditionInverter $conditionInverter, IfManipulator $ifManipulator) { $this->conditionInverter = $conditionInverter; @@ -96,6 +94,9 @@ CODE_SAMPLE if (\count($nestedIfsWithOnlyNonReturn) < 2) { return null; } + foreach ($nestedIfsWithOnlyNonReturn as $nestedIfWithOnlyNonReturn) { + $nestedIfWithOnlyNonReturn->cond->setAttribute(AttributeKey::ORIGINAL_NODE, null); + } return $this->processNestedIfsWithNonBreaking($node, $nestedIfsWithOnlyNonReturn); } /** diff --git a/rules/EarlyReturn/Rector/If_/ChangeIfElseValueAssignToEarlyReturnRector.php b/rules/EarlyReturn/Rector/If_/ChangeIfElseValueAssignToEarlyReturnRector.php index bc807199262..c55febd12f0 100644 --- a/rules/EarlyReturn/Rector/If_/ChangeIfElseValueAssignToEarlyReturnRector.php +++ b/rules/EarlyReturn/Rector/If_/ChangeIfElseValueAssignToEarlyReturnRector.php @@ -23,14 +23,12 @@ final class ChangeIfElseValueAssignToEarlyReturnRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\IfManipulator */ - private $ifManipulator; + private IfManipulator $ifManipulator; /** * @readonly - * @var \Rector\NodeManipulator\StmtsManipulator */ - private $stmtsManipulator; + private StmtsManipulator $stmtsManipulator; public function __construct(IfManipulator $ifManipulator, StmtsManipulator $stmtsManipulator) { $this->ifManipulator = $ifManipulator; @@ -97,9 +95,7 @@ CODE_SAMPLE if (!$this->ifManipulator->isIfAndElseWithSameVariableAssignAsLastStmts($if, $stmt->expr)) { continue; } - \end($if->stmts); - $lastIfStmtKey = \key($if->stmts); - \reset($if->stmts); + $lastIfStmtKey = \array_key_last($if->stmts); /** @var Assign $assign */ $assign = $this->stmtsManipulator->getUnwrappedLastStmt($if->stmts); $returnLastIf = new Return_($assign->expr); @@ -116,7 +112,7 @@ CODE_SAMPLE $stmt->expr = $assign->expr; $lastStmt = \array_pop($node->stmts); $elseStmtsExceptLast = \array_slice($elseStmts, 0, -1); - $node->stmts = \array_merge($node->stmts, $elseStmtsExceptLast, [$lastStmt]); + $node->stmts = [...$node->stmts, ...$elseStmtsExceptLast, $lastStmt]; return $node; } return null; diff --git a/rules/EarlyReturn/Rector/If_/ChangeNestedIfsToEarlyReturnRector.php b/rules/EarlyReturn/Rector/If_/ChangeNestedIfsToEarlyReturnRector.php index 576158586c7..e949c7183c5 100644 --- a/rules/EarlyReturn/Rector/If_/ChangeNestedIfsToEarlyReturnRector.php +++ b/rules/EarlyReturn/Rector/If_/ChangeNestedIfsToEarlyReturnRector.php @@ -21,14 +21,12 @@ final class ChangeNestedIfsToEarlyReturnRector extends AbstractRector { /** * @readonly - * @var \Rector\EarlyReturn\NodeTransformer\ConditionInverter */ - private $conditionInverter; + private ConditionInverter $conditionInverter; /** * @readonly - * @var \Rector\NodeManipulator\IfManipulator */ - private $ifManipulator; + private IfManipulator $ifManipulator; public function __construct(ConditionInverter $conditionInverter, IfManipulator $ifManipulator) { $this->conditionInverter = $conditionInverter; diff --git a/rules/EarlyReturn/Rector/If_/ChangeOrIfContinueToMultiContinueRector.php b/rules/EarlyReturn/Rector/If_/ChangeOrIfContinueToMultiContinueRector.php index 35ce947d66f..2e11f4b0b77 100644 --- a/rules/EarlyReturn/Rector/If_/ChangeOrIfContinueToMultiContinueRector.php +++ b/rules/EarlyReturn/Rector/If_/ChangeOrIfContinueToMultiContinueRector.php @@ -19,9 +19,8 @@ final class ChangeOrIfContinueToMultiContinueRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\IfManipulator */ - private $ifManipulator; + private IfManipulator $ifManipulator; public function __construct(IfManipulator $ifManipulator) { $this->ifManipulator = $ifManipulator; diff --git a/rules/EarlyReturn/Rector/If_/RemoveAlwaysElseRector.php b/rules/EarlyReturn/Rector/If_/RemoveAlwaysElseRector.php index ca5b1cdd52b..5a2f1e4da7a 100644 --- a/rules/EarlyReturn/Rector/If_/RemoveAlwaysElseRector.php +++ b/rules/EarlyReturn/Rector/If_/RemoveAlwaysElseRector.php @@ -11,7 +11,7 @@ use PhpParser\Node\Stmt\ElseIf_; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\Return_; -use PhpParser\Node\Stmt\Throw_; +use PhpParser\Node\Expr\Throw_; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -91,7 +91,7 @@ CODE_SAMPLE // If the last statement in the `elseif` breaks flow, merge it into the original `if` and stop processing if ($this->doesLastStatementBreakFlow($currentElseIf)) { $this->updateIfWithElseIf($if, $currentElseIf); - $nodesToReturn = \array_merge(\is_array($nodesToReturn) ? $nodesToReturn : \iterator_to_array($nodesToReturn), [$if], $this->getStatementsElseIfs($if)); + $nodesToReturn = \array_merge($nodesToReturn, [$if], $this->getStatementsElseIfs($if)); break; } $isLastElseIf = $if->elseifs === []; @@ -141,7 +141,7 @@ CODE_SAMPLE } return \false; } - return !($lastStmt instanceof Return_ || $lastStmt instanceof Throw_ || $lastStmt instanceof Continue_ || $lastStmt instanceof Expression && $lastStmt->expr instanceof Exit_); + return !($lastStmt instanceof Return_ || $lastStmt instanceof Expression && $lastStmt->expr instanceof Throw_ || $lastStmt instanceof Continue_ || $lastStmt instanceof Expression && $lastStmt->expr instanceof Exit_); } /** * @param \PhpParser\Node\Stmt\If_|\PhpParser\Node\Stmt\ElseIf_ $node diff --git a/rules/EarlyReturn/Rector/Return_/PreparedValueToEarlyReturnRector.php b/rules/EarlyReturn/Rector/Return_/PreparedValueToEarlyReturnRector.php index 9007cc4b742..24b426590ad 100644 --- a/rules/EarlyReturn/Rector/Return_/PreparedValueToEarlyReturnRector.php +++ b/rules/EarlyReturn/Rector/Return_/PreparedValueToEarlyReturnRector.php @@ -26,14 +26,12 @@ final class PreparedValueToEarlyReturnRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\IfManipulator */ - private $ifManipulator; + private IfManipulator $ifManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(IfManipulator $ifManipulator, BetterNodeFinder $betterNodeFinder) { $this->ifManipulator = $ifManipulator; @@ -163,9 +161,7 @@ CODE_SAMPLE } foreach ($bareSingleAssignIfs as $bareSingleAssignIf) { $assign = $bareSingleAssignIf->getAssign(); - $isVariableUsed = (bool) $this->betterNodeFinder->findFirst([$bareSingleAssignIf->getIfCondExpr(), $assign->expr], function (Node $node) use($returnedExpr) : bool { - return $this->nodeComparator->areNodesEqual($node, $returnedExpr); - }); + $isVariableUsed = (bool) $this->betterNodeFinder->findFirst([$bareSingleAssignIf->getIfCondExpr(), $assign->expr], fn(Node $node): bool => $this->nodeComparator->areNodesEqual($node, $returnedExpr)); if ($isVariableUsed) { return \false; } diff --git a/rules/EarlyReturn/Rector/Return_/ReturnBinaryOrToEarlyReturnRector.php b/rules/EarlyReturn/Rector/Return_/ReturnBinaryOrToEarlyReturnRector.php index 806998096de..7538a4b4af0 100644 --- a/rules/EarlyReturn/Rector/Return_/ReturnBinaryOrToEarlyReturnRector.php +++ b/rules/EarlyReturn/Rector/Return_/ReturnBinaryOrToEarlyReturnRector.php @@ -22,14 +22,12 @@ final class ReturnBinaryOrToEarlyReturnRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\AssignAndBinaryMap */ - private $assignAndBinaryMap; + private AssignAndBinaryMap $assignAndBinaryMap; /** * @readonly - * @var \Rector\NodeAnalyzer\CallAnalyzer */ - private $callAnalyzer; + private CallAnalyzer $callAnalyzer; public function __construct(AssignAndBinaryMap $assignAndBinaryMap, CallAnalyzer $callAnalyzer) { $this->assignAndBinaryMap = $assignAndBinaryMap; diff --git a/rules/EarlyReturn/Rector/StmtsAwareInterface/ReturnEarlyIfVariableRector.php b/rules/EarlyReturn/Rector/StmtsAwareInterface/ReturnEarlyIfVariableRector.php index 764f6d17458..afb7f75bdc6 100644 --- a/rules/EarlyReturn/Rector/StmtsAwareInterface/ReturnEarlyIfVariableRector.php +++ b/rules/EarlyReturn/Rector/StmtsAwareInterface/ReturnEarlyIfVariableRector.php @@ -26,14 +26,12 @@ final class ReturnEarlyIfVariableRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\VariableAnalyzer */ - private $variableAnalyzer; + private VariableAnalyzer $variableAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(VariableAnalyzer $variableAnalyzer, PhpDocInfoFactory $phpDocInfoFactory) { $this->variableAnalyzer = $variableAnalyzer; diff --git a/rules/EarlyReturn/ValueObject/BareSingleAssignIf.php b/rules/EarlyReturn/ValueObject/BareSingleAssignIf.php index 7f142d58d62..3b6bda4898f 100644 --- a/rules/EarlyReturn/ValueObject/BareSingleAssignIf.php +++ b/rules/EarlyReturn/ValueObject/BareSingleAssignIf.php @@ -10,14 +10,12 @@ final class BareSingleAssignIf { /** * @readonly - * @var \PhpParser\Node\Stmt\If_ */ - private $if; + private If_ $if; /** * @readonly - * @var \PhpParser\Node\Expr\Assign */ - private $assign; + private Assign $assign; public function __construct(If_ $if, Assign $assign) { $this->if = $if; diff --git a/rules/Naming/AssignVariableNameResolver/NewAssignVariableNameResolver.php b/rules/Naming/AssignVariableNameResolver/NewAssignVariableNameResolver.php index 0ac9fa77153..e62d924b2bf 100644 --- a/rules/Naming/AssignVariableNameResolver/NewAssignVariableNameResolver.php +++ b/rules/Naming/AssignVariableNameResolver/NewAssignVariableNameResolver.php @@ -15,9 +15,8 @@ final class NewAssignVariableNameResolver implements AssignVariableNameResolverI { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Naming/AssignVariableNameResolver/PropertyFetchAssignVariableNameResolver.php b/rules/Naming/AssignVariableNameResolver/PropertyFetchAssignVariableNameResolver.php index 53e88b22a46..2d160a043d5 100644 --- a/rules/Naming/AssignVariableNameResolver/PropertyFetchAssignVariableNameResolver.php +++ b/rules/Naming/AssignVariableNameResolver/PropertyFetchAssignVariableNameResolver.php @@ -15,9 +15,8 @@ final class PropertyFetchAssignVariableNameResolver implements AssignVariableNam { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Naming/ExpectedNameResolver/InflectorSingularResolver.php b/rules/Naming/ExpectedNameResolver/InflectorSingularResolver.php index 7850e36b3e2..c456fbd34f4 100644 --- a/rules/Naming/ExpectedNameResolver/InflectorSingularResolver.php +++ b/rules/Naming/ExpectedNameResolver/InflectorSingularResolver.php @@ -13,9 +13,8 @@ final class InflectorSingularResolver { /** * @readonly - * @var \Doctrine\Inflector\Inflector */ - private $inflector; + private Inflector $inflector; /** * @var array */ diff --git a/rules/Naming/ExpectedNameResolver/MatchParamTypeExpectedNameResolver.php b/rules/Naming/ExpectedNameResolver/MatchParamTypeExpectedNameResolver.php index ccb2536bf78..2b4733731fb 100644 --- a/rules/Naming/ExpectedNameResolver/MatchParamTypeExpectedNameResolver.php +++ b/rules/Naming/ExpectedNameResolver/MatchParamTypeExpectedNameResolver.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Naming\ExpectedNameResolver; +use PhpParser\Node; use PhpParser\Node\Param; use PHPStan\Type\ObjectType; use Rector\Naming\Naming\PropertyNaming; @@ -13,19 +14,16 @@ final class MatchParamTypeExpectedNameResolver { /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\Naming\Naming\PropertyNaming */ - private $propertyNaming; + private PropertyNaming $propertyNaming; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(StaticTypeMapper $staticTypeMapper, PropertyNaming $propertyNaming, NodeTypeResolver $nodeTypeResolver) { $this->staticTypeMapper = $staticTypeMapper; @@ -35,7 +33,7 @@ final class MatchParamTypeExpectedNameResolver public function resolve(Param $param) : ?string { // nothing to verify - if ($param->type === null) { + if (!$param->type instanceof Node) { return null; } // include nullable too diff --git a/rules/Naming/ExpectedNameResolver/MatchPropertyTypeExpectedNameResolver.php b/rules/Naming/ExpectedNameResolver/MatchPropertyTypeExpectedNameResolver.php index bdf5ea562ee..75713f15ac7 100644 --- a/rules/Naming/ExpectedNameResolver/MatchPropertyTypeExpectedNameResolver.php +++ b/rules/Naming/ExpectedNameResolver/MatchPropertyTypeExpectedNameResolver.php @@ -21,34 +21,28 @@ final class MatchPropertyTypeExpectedNameResolver { /** * @readonly - * @var \Rector\Naming\Naming\PropertyNaming */ - private $propertyNaming; + private PropertyNaming $propertyNaming; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeManipulator\PropertyManipulator */ - private $propertyManipulator; + private PropertyManipulator $propertyManipulator; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(PropertyNaming $propertyNaming, PhpDocInfoFactory $phpDocInfoFactory, NodeNameResolver $nodeNameResolver, PropertyManipulator $propertyManipulator, ReflectionResolver $reflectionResolver, StaticTypeMapper $staticTypeMapper) { $this->propertyNaming = $propertyNaming; diff --git a/rules/Naming/Guard/BreakingVariableRenameGuard.php b/rules/Naming/Guard/BreakingVariableRenameGuard.php index 38930fc7a27..f9102fa3ed7 100644 --- a/rules/Naming/Guard/BreakingVariableRenameGuard.php +++ b/rules/Naming/Guard/BreakingVariableRenameGuard.php @@ -30,34 +30,28 @@ final class BreakingVariableRenameGuard { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\Naming\Naming\ConflictingNameResolver */ - private $conflictingNameResolver; + private ConflictingNameResolver $conflictingNameResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\Naming\Naming\OverridenExistingNamesResolver */ - private $overridenExistingNamesResolver; + private OverridenExistingNamesResolver $overridenExistingNamesResolver; /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\Utils\TypeUnwrapper */ - private $typeUnwrapper; + private TypeUnwrapper $typeUnwrapper; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @var string * @see https://regex101.com/r/1pKLgf/1 diff --git a/rules/Naming/Guard/DateTimeAtNamingConventionGuard.php b/rules/Naming/Guard/DateTimeAtNamingConventionGuard.php index 77460d371a9..67d143d838c 100644 --- a/rules/Naming/Guard/DateTimeAtNamingConventionGuard.php +++ b/rules/Naming/Guard/DateTimeAtNamingConventionGuard.php @@ -13,14 +13,12 @@ final class DateTimeAtNamingConventionGuard { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\Utils\TypeUnwrapper */ - private $typeUnwrapper; + private TypeUnwrapper $typeUnwrapper; public function __construct(NodeTypeResolver $nodeTypeResolver, TypeUnwrapper $typeUnwrapper) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/rules/Naming/Guard/HasMagicGetSetGuard.php b/rules/Naming/Guard/HasMagicGetSetGuard.php index fdee4cc784a..392c1f7da35 100644 --- a/rules/Naming/Guard/HasMagicGetSetGuard.php +++ b/rules/Naming/Guard/HasMagicGetSetGuard.php @@ -9,9 +9,8 @@ final class HasMagicGetSetGuard { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(ReflectionProvider $reflectionProvider) { $this->reflectionProvider = $reflectionProvider; diff --git a/rules/Naming/Guard/PropertyConflictingNameGuard/MatchPropertyTypeConflictingNameGuard.php b/rules/Naming/Guard/PropertyConflictingNameGuard/MatchPropertyTypeConflictingNameGuard.php index 9c339f639f1..d168b4ec6d9 100644 --- a/rules/Naming/Guard/PropertyConflictingNameGuard/MatchPropertyTypeConflictingNameGuard.php +++ b/rules/Naming/Guard/PropertyConflictingNameGuard/MatchPropertyTypeConflictingNameGuard.php @@ -12,19 +12,16 @@ final class MatchPropertyTypeConflictingNameGuard { /** * @readonly - * @var \Rector\Naming\ExpectedNameResolver\MatchPropertyTypeExpectedNameResolver */ - private $matchPropertyTypeExpectedNameResolver; + private MatchPropertyTypeExpectedNameResolver $matchPropertyTypeExpectedNameResolver; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Naming\PhpArray\ArrayFilter */ - private $arrayFilter; + private ArrayFilter $arrayFilter; public function __construct(MatchPropertyTypeExpectedNameResolver $matchPropertyTypeExpectedNameResolver, NodeNameResolver $nodeNameResolver, ArrayFilter $arrayFilter) { $this->matchPropertyTypeExpectedNameResolver = $matchPropertyTypeExpectedNameResolver; diff --git a/rules/Naming/Matcher/ForeachMatcher.php b/rules/Naming/Matcher/ForeachMatcher.php index 0e9bebc2cbc..ae0b5931ad8 100644 --- a/rules/Naming/Matcher/ForeachMatcher.php +++ b/rules/Naming/Matcher/ForeachMatcher.php @@ -15,14 +15,12 @@ final class ForeachMatcher { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Naming\Matcher\CallMatcher */ - private $callMatcher; + private \Rector\Naming\Matcher\CallMatcher $callMatcher; public function __construct(NodeNameResolver $nodeNameResolver, \Rector\Naming\Matcher\CallMatcher $callMatcher) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Naming/Matcher/VariableAndCallAssignMatcher.php b/rules/Naming/Matcher/VariableAndCallAssignMatcher.php index ccc623b06f2..17cb1395680 100644 --- a/rules/Naming/Matcher/VariableAndCallAssignMatcher.php +++ b/rules/Naming/Matcher/VariableAndCallAssignMatcher.php @@ -16,19 +16,16 @@ final class VariableAndCallAssignMatcher { /** * @readonly - * @var \Rector\Naming\Matcher\CallMatcher */ - private $callMatcher; + private \Rector\Naming\Matcher\CallMatcher $callMatcher; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(\Rector\Naming\Matcher\CallMatcher $callMatcher, NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder) { $this->callMatcher = $callMatcher; @@ -51,9 +48,7 @@ final class VariableAndCallAssignMatcher if ($variableName === null) { return null; } - $isVariableFoundInCallArgs = (bool) $this->betterNodeFinder->findFirst($call->isFirstClassCallable() ? [] : $call->getArgs(), function (Node $subNode) use($variableName) : bool { - return $subNode instanceof Variable && $this->nodeNameResolver->isName($subNode, $variableName); - }); + $isVariableFoundInCallArgs = (bool) $this->betterNodeFinder->findFirst($call->isFirstClassCallable() ? [] : $call->getArgs(), fn(Node $subNode): bool => $subNode instanceof Variable && $this->nodeNameResolver->isName($subNode, $variableName)); if ($isVariableFoundInCallArgs) { return null; } diff --git a/rules/Naming/Naming/AliasNameResolver.php b/rules/Naming/Naming/AliasNameResolver.php index 6c7dd82d51f..dd3acf9bd2a 100644 --- a/rules/Naming/Naming/AliasNameResolver.php +++ b/rules/Naming/Naming/AliasNameResolver.php @@ -11,9 +11,8 @@ final class AliasNameResolver { /** * @readonly - * @var \Rector\Naming\Naming\UseImportsResolver */ - private $useImportsResolver; + private \Rector\Naming\Naming\UseImportsResolver $useImportsResolver; public function __construct(\Rector\Naming\Naming\UseImportsResolver $useImportsResolver) { $this->useImportsResolver = $useImportsResolver; diff --git a/rules/Naming/Naming/ConflictingNameResolver.php b/rules/Naming/Naming/ConflictingNameResolver.php index da6e3a492d6..d7a777f5076 100644 --- a/rules/Naming/Naming/ConflictingNameResolver.php +++ b/rules/Naming/Naming/ConflictingNameResolver.php @@ -16,33 +16,28 @@ final class ConflictingNameResolver { /** * @readonly - * @var \Rector\Naming\PhpArray\ArrayFilter */ - private $arrayFilter; + private ArrayFilter $arrayFilter; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\Naming\Naming\ExpectedNameResolver */ - private $expectedNameResolver; + private \Rector\Naming\Naming\ExpectedNameResolver $expectedNameResolver; /** * @readonly - * @var \Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver */ - private $matchParamTypeExpectedNameResolver; + private MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver; /** * @readonly - * @var \Rector\NodeManipulator\FunctionLikeManipulator */ - private $functionLikeManipulator; + private FunctionLikeManipulator $functionLikeManipulator; /** * @var array */ - private $conflictingVariableNamesByClassMethod = []; + private array $conflictingVariableNamesByClassMethod = []; public function __construct(ArrayFilter $arrayFilter, BetterNodeFinder $betterNodeFinder, \Rector\Naming\Naming\ExpectedNameResolver $expectedNameResolver, MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver, FunctionLikeManipulator $functionLikeManipulator) { $this->arrayFilter = $arrayFilter; diff --git a/rules/Naming/Naming/ExpectedNameResolver.php b/rules/Naming/Naming/ExpectedNameResolver.php index fc84ad6bcf8..b221d73360c 100644 --- a/rules/Naming/Naming/ExpectedNameResolver.php +++ b/rules/Naming/Naming/ExpectedNameResolver.php @@ -26,24 +26,20 @@ final class ExpectedNameResolver { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\Naming\Naming\PropertyNaming */ - private $propertyNaming; + private \Rector\Naming\Naming\PropertyNaming $propertyNaming; /** * @readonly - * @var \Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver */ - private $matchParamTypeExpectedNameResolver; + private MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver; public function __construct(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, \Rector\Naming\Naming\PropertyNaming $propertyNaming, MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Naming/Naming/OverridenExistingNamesResolver.php b/rules/Naming/Naming/OverridenExistingNamesResolver.php index ad0a1694ad1..1cdf69ab9fd 100644 --- a/rules/Naming/Naming/OverridenExistingNamesResolver.php +++ b/rules/Naming/Naming/OverridenExistingNamesResolver.php @@ -16,23 +16,20 @@ final class OverridenExistingNamesResolver { /** * @readonly - * @var \Rector\Naming\PhpArray\ArrayFilter */ - private $arrayFilter; + private ArrayFilter $arrayFilter; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @var array> */ - private $overridenExistingVariableNamesByClassMethod = []; + private array $overridenExistingVariableNamesByClassMethod = []; public function __construct(ArrayFilter $arrayFilter, BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver) { $this->arrayFilter = $arrayFilter; @@ -89,7 +86,6 @@ final class OverridenExistingNamesResolver } $currentlyUsedNames[] = $currentVariableName; } - $currentlyUsedNames = \array_values($currentlyUsedNames); $currentlyUsedNames = $this->arrayFilter->filterWithAtLeastTwoOccurences($currentlyUsedNames); $this->overridenExistingVariableNamesByClassMethod[$classMethodId] = $currentlyUsedNames; return $currentlyUsedNames; diff --git a/rules/Naming/Naming/PropertyNaming.php b/rules/Naming/Naming/PropertyNaming.php index 6bb482e2469..9f4e1ebd78f 100644 --- a/rules/Naming/Naming/PropertyNaming.php +++ b/rules/Naming/Naming/PropertyNaming.php @@ -26,14 +26,12 @@ final class PropertyNaming { /** * @readonly - * @var \Rector\Naming\RectorNamingInflector */ - private $rectorNamingInflector; + private RectorNamingInflector $rectorNamingInflector; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @var string[] */ diff --git a/rules/Naming/Naming/UseImportsResolver.php b/rules/Naming/Naming/UseImportsResolver.php index ed9301192fb..a51dbf61795 100644 --- a/rules/Naming/Naming/UseImportsResolver.php +++ b/rules/Naming/Naming/UseImportsResolver.php @@ -15,9 +15,8 @@ final class UseImportsResolver { /** * @readonly - * @var \Rector\Application\Provider\CurrentFileProvider */ - private $currentFileProvider; + private CurrentFileProvider $currentFileProvider; public function __construct(CurrentFileProvider $currentFileProvider) { $this->currentFileProvider = $currentFileProvider; @@ -31,9 +30,7 @@ final class UseImportsResolver if (!$namespace instanceof Node) { return []; } - return \array_filter($namespace->stmts, static function (Stmt $stmt) : bool { - return $stmt instanceof Use_ || $stmt instanceof GroupUse; - }); + return \array_filter($namespace->stmts, static fn(Stmt $stmt): bool => $stmt instanceof Use_ || $stmt instanceof GroupUse); } /** * @api @@ -45,9 +42,7 @@ final class UseImportsResolver if (!$namespace instanceof Node) { return []; } - return \array_filter($namespace->stmts, static function (Stmt $stmt) : bool { - return $stmt instanceof Use_; - }); + return \array_filter($namespace->stmts, static fn(Stmt $stmt): bool => $stmt instanceof Use_); } /** * @param \PhpParser\Node\Stmt\Use_|\PhpParser\Node\Stmt\GroupUse $use @@ -71,9 +66,7 @@ final class UseImportsResolver return null; } /** @var Namespace_[]|FileWithoutNamespace[] $namespaces */ - $namespaces = \array_filter($newStmts, static function (Stmt $stmt) : bool { - return $stmt instanceof Namespace_ || $stmt instanceof FileWithoutNamespace; - }); + $namespaces = \array_filter($newStmts, static fn(Stmt $stmt): bool => $stmt instanceof Namespace_ || $stmt instanceof FileWithoutNamespace); // multiple namespaces is not supported if (\count($namespaces) !== 1) { return null; diff --git a/rules/Naming/Naming/VariableNaming.php b/rules/Naming/Naming/VariableNaming.php index 8c4e8fca8ee..6977f37f5fb 100644 --- a/rules/Naming/Naming/VariableNaming.php +++ b/rules/Naming/Naming/VariableNaming.php @@ -27,18 +27,16 @@ final class VariableNaming { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @var AssignVariableNameResolverInterface[] */ - private $assignVariableNameResolvers = []; + private array $assignVariableNameResolvers = []; public function __construct(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, PropertyFetchAssignVariableNameResolver $propertyFetchAssignVariableNameResolver, NewAssignVariableNameResolver $newAssignVariableNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Naming/NamingConvention/NamingConventionAnalyzer.php b/rules/Naming/NamingConvention/NamingConventionAnalyzer.php index a71f03fff22..9e676c04e89 100644 --- a/rules/Naming/NamingConvention/NamingConventionAnalyzer.php +++ b/rules/Naming/NamingConvention/NamingConventionAnalyzer.php @@ -12,9 +12,8 @@ final class NamingConventionAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Naming/ParamRenamer/ParamRenamer.php b/rules/Naming/ParamRenamer/ParamRenamer.php index e62f1bf7e09..6ba63b2eb2c 100644 --- a/rules/Naming/ParamRenamer/ParamRenamer.php +++ b/rules/Naming/ParamRenamer/ParamRenamer.php @@ -14,19 +14,16 @@ final class ParamRenamer { /** * @readonly - * @var \Rector\Naming\VariableRenamer */ - private $variableRenamer; + private VariableRenamer $variableRenamer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(VariableRenamer $variableRenamer, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->variableRenamer = $variableRenamer; diff --git a/rules/Naming/PropertyRenamer/MatchTypePropertyRenamer.php b/rules/Naming/PropertyRenamer/MatchTypePropertyRenamer.php index 0ffb77e0f28..bb5d29b73ab 100644 --- a/rules/Naming/PropertyRenamer/MatchTypePropertyRenamer.php +++ b/rules/Naming/PropertyRenamer/MatchTypePropertyRenamer.php @@ -12,19 +12,16 @@ final class MatchTypePropertyRenamer { /** * @readonly - * @var \Rector\Naming\Guard\PropertyConflictingNameGuard\MatchPropertyTypeConflictingNameGuard */ - private $matchPropertyTypeConflictingNameGuard; + private MatchPropertyTypeConflictingNameGuard $matchPropertyTypeConflictingNameGuard; /** * @readonly - * @var \Rector\Naming\RenameGuard\PropertyRenameGuard */ - private $propertyRenameGuard; + private PropertyRenameGuard $propertyRenameGuard; /** * @readonly - * @var \Rector\Naming\PropertyRenamer\PropertyFetchRenamer */ - private $propertyFetchRenamer; + private \Rector\Naming\PropertyRenamer\PropertyFetchRenamer $propertyFetchRenamer; public function __construct(MatchPropertyTypeConflictingNameGuard $matchPropertyTypeConflictingNameGuard, PropertyRenameGuard $propertyRenameGuard, \Rector\Naming\PropertyRenamer\PropertyFetchRenamer $propertyFetchRenamer) { $this->matchPropertyTypeConflictingNameGuard = $matchPropertyTypeConflictingNameGuard; @@ -42,8 +39,8 @@ final class MatchTypePropertyRenamer if ($this->propertyRenameGuard->shouldSkip($propertyRename)) { return null; } - $onlyPropertyProperty = $propertyRename->getPropertyProperty(); - $onlyPropertyProperty->name = new VarLikeIdentifier($propertyRename->getExpectedName()); + $propertyItem = $propertyRename->getPropertyProperty(); + $propertyItem->name = new VarLikeIdentifier($propertyRename->getExpectedName()); $this->renamePropertyFetchesInClass($propertyRename); return $propertyRename->getProperty(); } diff --git a/rules/Naming/PropertyRenamer/PropertyFetchRenamer.php b/rules/Naming/PropertyRenamer/PropertyFetchRenamer.php index 93208687acf..e7e0cbaec6c 100644 --- a/rules/Naming/PropertyRenamer/PropertyFetchRenamer.php +++ b/rules/Naming/PropertyRenamer/PropertyFetchRenamer.php @@ -15,14 +15,12 @@ final class PropertyFetchRenamer { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, PropertyFetchAnalyzer $propertyFetchAnalyzer) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; diff --git a/rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php b/rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php index 519cf54b113..1295dda57a8 100644 --- a/rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php +++ b/rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php @@ -27,49 +27,40 @@ final class PropertyPromotionRenamer { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver */ - private $matchParamTypeExpectedNameResolver; + private MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver; /** * @readonly - * @var \Rector\Naming\ValueObjectFactory\ParamRenameFactory */ - private $paramRenameFactory; + private ParamRenameFactory $paramRenameFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Naming\ParamRenamer\ParamRenamer */ - private $paramRenamer; + private ParamRenamer $paramRenamer; /** * @readonly - * @var \Rector\Naming\PropertyRenamer\PropertyFetchRenamer */ - private $propertyFetchRenamer; + private \Rector\Naming\PropertyRenamer\PropertyFetchRenamer $propertyFetchRenamer; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Naming\VariableRenamer */ - private $variableRenamer; + private VariableRenamer $variableRenamer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(PhpVersionProvider $phpVersionProvider, MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver, ParamRenameFactory $paramRenameFactory, PhpDocInfoFactory $phpDocInfoFactory, ParamRenamer $paramRenamer, \Rector\Naming\PropertyRenamer\PropertyFetchRenamer $propertyFetchRenamer, NodeNameResolver $nodeNameResolver, VariableRenamer $variableRenamer, DocBlockUpdater $docBlockUpdater) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/rules/Naming/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector.php b/rules/Naming/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector.php index 53d21c3235a..a5f2f8178c1 100644 --- a/rules/Naming/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector.php +++ b/rules/Naming/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector.php @@ -30,44 +30,36 @@ final class RenameVariableToMatchMethodCallReturnTypeRector extends AbstractRect { /** * @readonly - * @var \Rector\Naming\Guard\BreakingVariableRenameGuard */ - private $breakingVariableRenameGuard; + private BreakingVariableRenameGuard $breakingVariableRenameGuard; /** * @readonly - * @var \Rector\Naming\Naming\ExpectedNameResolver */ - private $expectedNameResolver; + private ExpectedNameResolver $expectedNameResolver; /** * @readonly - * @var \Rector\Naming\NamingConvention\NamingConventionAnalyzer */ - private $namingConventionAnalyzer; + private NamingConventionAnalyzer $namingConventionAnalyzer; /** * @readonly - * @var \Rector\Naming\PhpDoc\VarTagValueNodeRenamer */ - private $varTagValueNodeRenamer; + private VarTagValueNodeRenamer $varTagValueNodeRenamer; /** * @readonly - * @var \Rector\Naming\Matcher\VariableAndCallAssignMatcher */ - private $variableAndCallAssignMatcher; + private VariableAndCallAssignMatcher $variableAndCallAssignMatcher; /** * @readonly - * @var \Rector\Naming\VariableRenamer */ - private $variableRenamer; + private VariableRenamer $variableRenamer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var string * @see https://regex101.com/r/JG5w9j/1 diff --git a/rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php b/rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php index 3ffed0846a0..69350991e4a 100644 --- a/rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php +++ b/rules/Naming/Rector/ClassMethod/RenameParamToMatchTypeRector.php @@ -26,33 +26,25 @@ final class RenameParamToMatchTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\Naming\Guard\BreakingVariableRenameGuard */ - private $breakingVariableRenameGuard; + private BreakingVariableRenameGuard $breakingVariableRenameGuard; /** * @readonly - * @var \Rector\Naming\Naming\ExpectedNameResolver */ - private $expectedNameResolver; + private ExpectedNameResolver $expectedNameResolver; /** * @readonly - * @var \Rector\Naming\ExpectedNameResolver\MatchParamTypeExpectedNameResolver */ - private $matchParamTypeExpectedNameResolver; + private MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver; /** * @readonly - * @var \Rector\Naming\ValueObjectFactory\ParamRenameFactory */ - private $paramRenameFactory; + private ParamRenameFactory $paramRenameFactory; /** * @readonly - * @var \Rector\Naming\ParamRenamer\ParamRenamer */ - private $paramRenamer; - /** - * @var bool - */ - private $hasChanged = \false; + private ParamRenamer $paramRenamer; + private bool $hasChanged = \false; public function __construct(BreakingVariableRenameGuard $breakingVariableRenameGuard, ExpectedNameResolver $expectedNameResolver, MatchParamTypeExpectedNameResolver $matchParamTypeExpectedNameResolver, ParamRenameFactory $paramRenameFactory, ParamRenamer $paramRenamer) { $this->breakingVariableRenameGuard = $breakingVariableRenameGuard; diff --git a/rules/Naming/Rector/ClassMethod/RenameVariableToMatchNewTypeRector.php b/rules/Naming/Rector/ClassMethod/RenameVariableToMatchNewTypeRector.php index ce0c02644ab..d500bce7fea 100644 --- a/rules/Naming/Rector/ClassMethod/RenameVariableToMatchNewTypeRector.php +++ b/rules/Naming/Rector/ClassMethod/RenameVariableToMatchNewTypeRector.php @@ -22,24 +22,20 @@ final class RenameVariableToMatchNewTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\Naming\Guard\BreakingVariableRenameGuard */ - private $breakingVariableRenameGuard; + private BreakingVariableRenameGuard $breakingVariableRenameGuard; /** * @readonly - * @var \Rector\Naming\Naming\ExpectedNameResolver */ - private $expectedNameResolver; + private ExpectedNameResolver $expectedNameResolver; /** * @readonly - * @var \Rector\Naming\VariableRenamer */ - private $variableRenamer; + private VariableRenamer $variableRenamer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(BreakingVariableRenameGuard $breakingVariableRenameGuard, ExpectedNameResolver $expectedNameResolver, VariableRenamer $variableRenamer, BetterNodeFinder $betterNodeFinder) { $this->breakingVariableRenameGuard = $breakingVariableRenameGuard; @@ -124,8 +120,6 @@ CODE_SAMPLE { /** @var Assign[] $assigns */ $assigns = $this->betterNodeFinder->findInstanceOf((array) $classMethod->stmts, Assign::class); - return \array_filter($assigns, static function (Assign $assign) : bool { - return $assign->expr instanceof New_; - }); + return \array_filter($assigns, static fn(Assign $assign): bool => $assign->expr instanceof New_); } } diff --git a/rules/Naming/Rector/Class_/RenamePropertyToMatchTypeRector.php b/rules/Naming/Rector/Class_/RenamePropertyToMatchTypeRector.php index 30f517031e1..cca8bcbf631 100644 --- a/rules/Naming/Rector/Class_/RenamePropertyToMatchTypeRector.php +++ b/rules/Naming/Rector/Class_/RenamePropertyToMatchTypeRector.php @@ -23,28 +23,21 @@ final class RenamePropertyToMatchTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\Naming\PropertyRenamer\MatchTypePropertyRenamer */ - private $matchTypePropertyRenamer; + private MatchTypePropertyRenamer $matchTypePropertyRenamer; /** * @readonly - * @var \Rector\Naming\ValueObjectFactory\PropertyRenameFactory */ - private $propertyRenameFactory; + private PropertyRenameFactory $propertyRenameFactory; /** * @readonly - * @var \Rector\Naming\ExpectedNameResolver\MatchPropertyTypeExpectedNameResolver */ - private $matchPropertyTypeExpectedNameResolver; + private MatchPropertyTypeExpectedNameResolver $matchPropertyTypeExpectedNameResolver; /** * @readonly - * @var \Rector\Naming\PropertyRenamer\PropertyPromotionRenamer */ - private $propertyPromotionRenamer; - /** - * @var bool - */ - private $hasChanged = \false; + private PropertyPromotionRenamer $propertyPromotionRenamer; + private bool $hasChanged = \false; public function __construct(MatchTypePropertyRenamer $matchTypePropertyRenamer, PropertyRenameFactory $propertyRenameFactory, MatchPropertyTypeExpectedNameResolver $matchPropertyTypeExpectedNameResolver, PropertyPromotionRenamer $propertyPromotionRenamer) { $this->matchTypePropertyRenamer = $matchTypePropertyRenamer; diff --git a/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchExprVariableRector.php b/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchExprVariableRector.php index 338f3b64bbe..70b9ad7bcb3 100644 --- a/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchExprVariableRector.php +++ b/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchExprVariableRector.php @@ -21,24 +21,20 @@ final class RenameForeachValueVariableToMatchExprVariableRector extends Abstract { /** * @readonly - * @var \Rector\Naming\ExpectedNameResolver\InflectorSingularResolver */ - private $inflectorSingularResolver; + private InflectorSingularResolver $inflectorSingularResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; /** * @readonly - * @var \Rector\NodeManipulator\StmtsManipulator */ - private $stmtsManipulator; + private StmtsManipulator $stmtsManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(InflectorSingularResolver $inflectorSingularResolver, PropertyFetchAnalyzer $propertyFetchAnalyzer, StmtsManipulator $stmtsManipulator, BetterNodeFinder $betterNodeFinder) { $this->inflectorSingularResolver = $inflectorSingularResolver; diff --git a/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php b/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php index 59ae439016c..eaba29c727e 100644 --- a/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php +++ b/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\Naming\Rector\Foreach_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\Closure; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Foreach_; use PhpParser\Node\Stmt\Function_; -use PhpParser\NodeTraverser; use Rector\Naming\Guard\BreakingVariableRenameGuard; use Rector\Naming\Matcher\ForeachMatcher; use Rector\Naming\Naming\ExpectedNameResolver; @@ -26,29 +26,24 @@ final class RenameForeachValueVariableToMatchMethodCallReturnTypeRector extends { /** * @readonly - * @var \Rector\Naming\Guard\BreakingVariableRenameGuard */ - private $breakingVariableRenameGuard; + private BreakingVariableRenameGuard $breakingVariableRenameGuard; /** * @readonly - * @var \Rector\Naming\Naming\ExpectedNameResolver */ - private $expectedNameResolver; + private ExpectedNameResolver $expectedNameResolver; /** * @readonly - * @var \Rector\Naming\NamingConvention\NamingConventionAnalyzer */ - private $namingConventionAnalyzer; + private NamingConventionAnalyzer $namingConventionAnalyzer; /** * @readonly - * @var \Rector\Naming\VariableRenamer */ - private $variableRenamer; + private VariableRenamer $variableRenamer; /** * @readonly - * @var \Rector\Naming\Matcher\ForeachMatcher */ - private $foreachMatcher; + private ForeachMatcher $foreachMatcher; /** * @var string[] */ @@ -107,7 +102,7 @@ CODE_SAMPLE $hasRenamed = \false; $this->traverseNodesWithCallable($node->stmts, function (Node $subNode) use($node, &$hasRenamed) : ?int { if ($subNode instanceof Class_ || $subNode instanceof Closure || $subNode instanceof Function_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$subNode instanceof Foreach_) { return null; diff --git a/rules/Naming/RectorNamingInflector.php b/rules/Naming/RectorNamingInflector.php index f2f481588ff..34e6ebf4414 100644 --- a/rules/Naming/RectorNamingInflector.php +++ b/rules/Naming/RectorNamingInflector.php @@ -9,9 +9,8 @@ final class RectorNamingInflector { /** * @readonly - * @var \Doctrine\Inflector\Inflector */ - private $inflector; + private Inflector $inflector; /** * @var string * @see https://regex101.com/r/VqVvke/3 diff --git a/rules/Naming/RenameGuard/PropertyRenameGuard.php b/rules/Naming/RenameGuard/PropertyRenameGuard.php index ceacbacb3d6..12887022aa7 100644 --- a/rules/Naming/RenameGuard/PropertyRenameGuard.php +++ b/rules/Naming/RenameGuard/PropertyRenameGuard.php @@ -12,19 +12,16 @@ final class PropertyRenameGuard { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\Naming\Guard\DateTimeAtNamingConventionGuard */ - private $dateTimeAtNamingConventionGuard; + private DateTimeAtNamingConventionGuard $dateTimeAtNamingConventionGuard; /** * @readonly - * @var \Rector\Naming\Guard\HasMagicGetSetGuard */ - private $hasMagicGetSetGuard; + private HasMagicGetSetGuard $hasMagicGetSetGuard; public function __construct(NodeTypeResolver $nodeTypeResolver, DateTimeAtNamingConventionGuard $dateTimeAtNamingConventionGuard, HasMagicGetSetGuard $hasMagicGetSetGuard) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/rules/Naming/ValueObject/ExpectedName.php b/rules/Naming/ValueObject/ExpectedName.php index 47bb8ff6057..013bffddc62 100644 --- a/rules/Naming/ValueObject/ExpectedName.php +++ b/rules/Naming/ValueObject/ExpectedName.php @@ -7,14 +7,12 @@ final class ExpectedName { /** * @readonly - * @var string */ - private $name; + private string $name; /** * @readonly - * @var string */ - private $singularized; + private string $singularized; public function __construct(string $name, string $singularized) { $this->name = $name; diff --git a/rules/Naming/ValueObject/ParamRename.php b/rules/Naming/ValueObject/ParamRename.php index 1392dcb1ab0..be597029484 100644 --- a/rules/Naming/ValueObject/ParamRename.php +++ b/rules/Naming/ValueObject/ParamRename.php @@ -9,24 +9,20 @@ final class ParamRename { /** * @readonly - * @var string */ - private $currentName; + private string $currentName; /** * @readonly - * @var string */ - private $expectedName; + private string $expectedName; /** * @readonly - * @var \PhpParser\Node\Expr\Variable */ - private $variable; + private Variable $variable; /** * @readonly - * @var \PhpParser\Node\FunctionLike */ - private $functionLike; + private FunctionLike $functionLike; public function __construct(string $currentName, string $expectedName, Variable $variable, FunctionLike $functionLike) { $this->currentName = $currentName; diff --git a/rules/Naming/ValueObject/PropertyRename.php b/rules/Naming/ValueObject/PropertyRename.php index ff0cc466973..a1036106259 100644 --- a/rules/Naming/ValueObject/PropertyRename.php +++ b/rules/Naming/ValueObject/PropertyRename.php @@ -5,48 +5,42 @@ namespace Rector\Naming\ValueObject; use PhpParser\Node\Stmt\ClassLike; use PhpParser\Node\Stmt\Property; -use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\Node\PropertyItem; use Rector\Validation\RectorAssert; final class PropertyRename { /** * @readonly - * @var \PhpParser\Node\Stmt\Property */ - private $property; + private Property $property; /** * @readonly - * @var string */ - private $expectedName; + private string $expectedName; /** * @readonly - * @var string */ - private $currentName; + private string $currentName; /** * @readonly - * @var \PhpParser\Node\Stmt\ClassLike */ - private $classLike; + private ClassLike $classLike; /** * @readonly - * @var string */ - private $classLikeName; + private string $classLikeName; /** * @readonly - * @var \PhpParser\Node\Stmt\PropertyProperty */ - private $propertyProperty; - public function __construct(Property $property, string $expectedName, string $currentName, ClassLike $classLike, string $classLikeName, PropertyProperty $propertyProperty) + private PropertyItem $propertyItem; + public function __construct(Property $property, string $expectedName, string $currentName, ClassLike $classLike, string $classLikeName, PropertyItem $propertyItem) { $this->property = $property; $this->expectedName = $expectedName; $this->currentName = $currentName; $this->classLike = $classLike; $this->classLikeName = $classLikeName; - $this->propertyProperty = $propertyProperty; + $this->propertyItem = $propertyItem; // name must be valid RectorAssert::propertyName($currentName); RectorAssert::propertyName($expectedName); @@ -79,8 +73,8 @@ final class PropertyRename { return $this->classLikeName; } - public function getPropertyProperty() : PropertyProperty + public function getPropertyProperty() : PropertyItem { - return $this->propertyProperty; + return $this->propertyItem; } } diff --git a/rules/Naming/ValueObject/VariableAndCallAssign.php b/rules/Naming/ValueObject/VariableAndCallAssign.php index 554c1b0a011..ea7d83a3084 100644 --- a/rules/Naming/ValueObject/VariableAndCallAssign.php +++ b/rules/Naming/ValueObject/VariableAndCallAssign.php @@ -15,9 +15,8 @@ final class VariableAndCallAssign { /** * @readonly - * @var \PhpParser\Node\Expr\Variable */ - private $variable; + private Variable $variable; /** * @readonly * @var \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\StaticCall|\PhpParser\Node\Expr\MethodCall @@ -25,14 +24,12 @@ final class VariableAndCallAssign private $expr; /** * @readonly - * @var \PhpParser\Node\Expr\Assign */ - private $assign; + private Assign $assign; /** * @readonly - * @var string */ - private $variableName; + private string $variableName; /** * @readonly * @var \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure diff --git a/rules/Naming/ValueObject/VariableAndCallForeach.php b/rules/Naming/ValueObject/VariableAndCallForeach.php index 7b97199045f..cd4785a0b29 100644 --- a/rules/Naming/ValueObject/VariableAndCallForeach.php +++ b/rules/Naming/ValueObject/VariableAndCallForeach.php @@ -14,9 +14,8 @@ final class VariableAndCallForeach { /** * @readonly - * @var \PhpParser\Node\Expr\Variable */ - private $variable; + private Variable $variable; /** * @readonly * @var \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\StaticCall|\PhpParser\Node\Expr\MethodCall @@ -24,9 +23,8 @@ final class VariableAndCallForeach private $expr; /** * @readonly - * @var string */ - private $variableName; + private string $variableName; /** * @readonly * @var \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure diff --git a/rules/Naming/ValueObjectFactory/ParamRenameFactory.php b/rules/Naming/ValueObjectFactory/ParamRenameFactory.php index f45ebc345f4..7593f3f849c 100644 --- a/rules/Naming/ValueObjectFactory/ParamRenameFactory.php +++ b/rules/Naming/ValueObjectFactory/ParamRenameFactory.php @@ -12,9 +12,8 @@ final class ParamRenameFactory { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Naming/ValueObjectFactory/PropertyRenameFactory.php b/rules/Naming/ValueObjectFactory/PropertyRenameFactory.php index eb196e616e9..11121a22aa4 100644 --- a/rules/Naming/ValueObjectFactory/PropertyRenameFactory.php +++ b/rules/Naming/ValueObjectFactory/PropertyRenameFactory.php @@ -12,9 +12,8 @@ final class PropertyRenameFactory { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Naming/VariableRenamer.php b/rules/Naming/VariableRenamer.php index 10b761abc9c..bfb3de9a59c 100644 --- a/rules/Naming/VariableRenamer.php +++ b/rules/Naming/VariableRenamer.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\Naming; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\Variable; use PhpParser\Node\FunctionLike; use PhpParser\Node\Param; use PhpParser\Node\Stmt; -use PhpParser\NodeTraverser; use PHPStan\Analyser\MutatingScope; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; @@ -21,24 +21,20 @@ final class VariableRenamer { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Naming\PhpDoc\VarTagValueNodeRenamer */ - private $varTagValueNodeRenamer; + private VarTagValueNodeRenamer $varTagValueNodeRenamer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver, VarTagValueNodeRenamer $varTagValueNodeRenamer, PhpDocInfoFactory $phpDocInfoFactory) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; @@ -58,7 +54,7 @@ final class VariableRenamer $this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $functionLike->getStmts(), function (Node $node) use($oldName, $expectedName, $assign, &$isRenamingActive, &$hasRenamed, &$currentStmt, &$currentFunctionLike) { // skip param names if ($node instanceof Param) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($assign instanceof Assign && $node === $assign) { $isRenamingActive = \true; diff --git a/rules/Php52/Rector/Property/VarToPublicPropertyRector.php b/rules/Php52/Rector/Property/VarToPublicPropertyRector.php index 73fd47d537c..64727ee55f7 100644 --- a/rules/Php52/Rector/Property/VarToPublicPropertyRector.php +++ b/rules/Php52/Rector/Property/VarToPublicPropertyRector.php @@ -18,9 +18,8 @@ final class VarToPublicPropertyRector extends AbstractRector implements MinPhpVe { /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; public function __construct(VisibilityManipulator $visibilityManipulator) { $this->visibilityManipulator = $visibilityManipulator; diff --git a/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php b/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php index ee77f74d991..450740a97e7 100644 --- a/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php +++ b/rules/Php52/Rector/Switch_/ContinueToBreakInSwitchRector.php @@ -3,11 +3,12 @@ declare (strict_types=1); namespace Rector\Php52\Rector\Switch_; +use PhpParser\Node\Scalar\Int_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\Variable; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Break_; use PhpParser\Node\Stmt\Class_; @@ -18,7 +19,6 @@ use PhpParser\Node\Stmt\Foreach_; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Switch_; use PhpParser\Node\Stmt\While_; -use PhpParser\NodeTraverser; use PHPStan\Type\Constant\ConstantIntegerType; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\PhpParser\Node\Value\ValueResolver; @@ -34,13 +34,9 @@ final class ContinueToBreakInSwitchRector extends AbstractRector implements MinP { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; - /** - * @var bool - */ - private $hasChanged = \false; + private ValueResolver $valueResolver; + private bool $hasChanged = \false; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; @@ -107,11 +103,11 @@ CODE_SAMPLE { $this->traverseNodesWithCallable($stmt, function (Node $subNode) { if ($subNode instanceof Class_ || $subNode instanceof Function_ || $subNode instanceof Closure) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } // continue is belong to loop if ($subNode instanceof Foreach_ || $subNode instanceof While_ || $subNode instanceof Do_ || $subNode instanceof For_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$subNode instanceof Continue_) { return null; @@ -120,7 +116,7 @@ CODE_SAMPLE $this->hasChanged = \true; return new Break_(); } - if ($subNode->num instanceof LNumber) { + if ($subNode->num instanceof Int_) { $continueNumber = $this->valueResolver->getValue($subNode->num); if ($continueNumber <= 1) { $this->hasChanged = \true; diff --git a/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php b/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php index 616e06063d3..ae412e42e38 100644 --- a/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php +++ b/rules/Php54/Rector/Break_/RemoveZeroBreakContinueRector.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace Rector\Php54\Rector\Break_; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Variable; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt\Break_; use PhpParser\Node\Stmt\Continue_; use PHPStan\Type\Constant\ConstantIntegerType; @@ -23,9 +23,8 @@ final class RemoveZeroBreakContinueRector extends AbstractRector implements MinP { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; @@ -83,7 +82,7 @@ CODE_SAMPLE if (!$node->num instanceof Expr) { return null; } - if ($node->num instanceof LNumber) { + if ($node->num instanceof Int_) { $number = $this->valueResolver->getValue($node->num); if ($number > 1) { return null; @@ -112,7 +111,7 @@ CODE_SAMPLE return $stmt; } if ($staticType->getValue() > 0) { - $stmt->num = new LNumber($staticType->getValue()); + $stmt->num = new Int_($staticType->getValue()); return $stmt; } } diff --git a/rules/Php55/Rector/FuncCall/GetCalledClassToSelfClassRector.php b/rules/Php55/Rector/FuncCall/GetCalledClassToSelfClassRector.php index d0293b2eac2..7e7b8242aa9 100644 --- a/rules/Php55/Rector/FuncCall/GetCalledClassToSelfClassRector.php +++ b/rules/Php55/Rector/FuncCall/GetCalledClassToSelfClassRector.php @@ -21,9 +21,8 @@ final class GetCalledClassToSelfClassRector extends AbstractRector implements Mi { /** * @readonly - * @var \Rector\Reflection\ClassModifierChecker */ - private $classModifierChecker; + private ClassModifierChecker $classModifierChecker; public function __construct(ClassModifierChecker $classModifierChecker) { $this->classModifierChecker = $classModifierChecker; diff --git a/rules/Php55/Rector/FuncCall/PregReplaceEModifierRector.php b/rules/Php55/Rector/FuncCall/PregReplaceEModifierRector.php index dabac98d979..100d032f418 100644 --- a/rules/Php55/Rector/FuncCall/PregReplaceEModifierRector.php +++ b/rules/Php55/Rector/FuncCall/PregReplaceEModifierRector.php @@ -23,14 +23,12 @@ final class PregReplaceEModifierRector extends AbstractRector implements MinPhpV { /** * @readonly - * @var \Rector\Php72\NodeFactory\AnonymousFunctionFactory */ - private $anonymousFunctionFactory; + private AnonymousFunctionFactory $anonymousFunctionFactory; /** * @readonly - * @var \Rector\Php55\RegexMatcher */ - private $regexMatcher; + private RegexMatcher $regexMatcher; public function __construct(AnonymousFunctionFactory $anonymousFunctionFactory, RegexMatcher $regexMatcher) { $this->anonymousFunctionFactory = $anonymousFunctionFactory; diff --git a/rules/Php55/Rector/String_/StringClassNameToClassConstantRector.php b/rules/Php55/Rector/String_/StringClassNameToClassConstantRector.php index c8b379d1202..40f5f5b1ce7 100644 --- a/rules/Php55/Rector/String_/StringClassNameToClassConstantRector.php +++ b/rules/Php55/Rector/String_/StringClassNameToClassConstantRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Php55\Rector\String_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\BinaryOp\Concat; use PhpParser\Node\Expr\ClassConstFetch; @@ -10,7 +11,6 @@ use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\ClassConst; -use PhpParser\NodeTraverser; use PHPStan\Reflection\ReflectionProvider; use Rector\Contract\Rector\ConfigurableRectorInterface; use Rector\Rector\AbstractRector; @@ -26,9 +26,8 @@ final class StringClassNameToClassConstantRector extends AbstractRector implemen { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @var string */ @@ -40,11 +39,8 @@ final class StringClassNameToClassConstantRector extends AbstractRector implemen /** * @var string[] */ - private $classesToSkip = []; - /** - * @var bool - */ - private $shouldKeepPreslash = \false; + private array $classesToSkip = []; + private bool $shouldKeepPreslash = \false; public function __construct(ReflectionProvider $reflectionProvider) { $this->reflectionProvider = $reflectionProvider; @@ -100,7 +96,7 @@ CODE_SAMPLE // keep allowed string as condition if ($node instanceof FuncCall) { if ($this->isName($node, 'is_a')) { - return NodeTraverser::DONT_TRAVERSE_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CHILDREN; } return null; } diff --git a/rules/Php70/EregToPcreTransformer.php b/rules/Php70/EregToPcreTransformer.php index d95a2c9d16b..bb53257b97b 100644 --- a/rules/Php70/EregToPcreTransformer.php +++ b/rules/Php70/EregToPcreTransformer.php @@ -14,9 +14,8 @@ final class EregToPcreTransformer { /** * @readonly - * @var string */ - private $pcreDelimiter = '#'; + private string $pcreDelimiter = '#'; /** * @var array */ @@ -54,11 +53,11 @@ final class EregToPcreTransformer /** * @var array */ - private $icache = []; + private array $icache = []; /** * @var array */ - private $cache = []; + private array $cache = []; /** * Change this via services configuratoin in rector.php if you need it * Single type is chosen to prevent every regular with different delimiter. diff --git a/rules/Php70/NodeAnalyzer/BattleshipTernaryAnalyzer.php b/rules/Php70/NodeAnalyzer/BattleshipTernaryAnalyzer.php index bd1440f29a0..1cd1e571fbd 100644 --- a/rules/Php70/NodeAnalyzer/BattleshipTernaryAnalyzer.php +++ b/rules/Php70/NodeAnalyzer/BattleshipTernaryAnalyzer.php @@ -15,14 +15,12 @@ final class BattleshipTernaryAnalyzer { /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(NodeComparator $nodeComparator, ValueResolver $valueResolver) { $this->nodeComparator = $nodeComparator; diff --git a/rules/Php70/Rector/Assign/ListSwapArrayOrderRector.php b/rules/Php70/Rector/Assign/ListSwapArrayOrderRector.php index 137558708ae..c8a5675ee16 100644 --- a/rules/Php70/Rector/Assign/ListSwapArrayOrderRector.php +++ b/rules/Php70/Rector/Assign/ListSwapArrayOrderRector.php @@ -6,7 +6,7 @@ namespace Rector\Php70\Rector\Assign; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrayDimFetch; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\List_; @@ -23,9 +23,8 @@ final class ListSwapArrayOrderRector extends AbstractRector implements MinPhpVer { /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; public function __construct(BetterStandardPrinter $betterStandardPrinter) { $this->betterStandardPrinter = $betterStandardPrinter; diff --git a/rules/Php70/Rector/Break_/BreakNotInLoopOrSwitchToReturnRector.php b/rules/Php70/Rector/Break_/BreakNotInLoopOrSwitchToReturnRector.php index 6a4fd4d7689..ba973e40ec3 100644 --- a/rules/Php70/Rector/Break_/BreakNotInLoopOrSwitchToReturnRector.php +++ b/rules/Php70/Rector/Break_/BreakNotInLoopOrSwitchToReturnRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Php70\Rector\Break_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\FunctionLike; @@ -10,7 +11,6 @@ use PhpParser\Node\Stmt\Break_; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\Return_; use PhpParser\Node\Stmt\Switch_; -use PhpParser\NodeTraverser; use Rector\NodeNestingScope\ContextAnalyzer; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersionFeature; @@ -24,9 +24,8 @@ final class BreakNotInLoopOrSwitchToReturnRector extends AbstractRector implemen { /** * @readonly - * @var \Rector\NodeNestingScope\ContextAnalyzer */ - private $contextAnalyzer; + private ContextAnalyzer $contextAnalyzer; /** * @var string */ @@ -85,7 +84,7 @@ CODE_SAMPLE if ($node instanceof Switch_) { $this->traverseNodesWithCallable($node->cases, static function (Node $subNode) : ?int { if ($subNode instanceof Class_ || $subNode instanceof FunctionLike && !$subNode instanceof ArrowFunction) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$subNode instanceof Break_) { return null; @@ -104,6 +103,6 @@ CODE_SAMPLE if ($this->contextAnalyzer->isInIf($node)) { return new Return_(); } - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } } diff --git a/rules/Php70/Rector/ClassMethod/Php4ConstructorRector.php b/rules/Php70/Rector/ClassMethod/Php4ConstructorRector.php index aee27804ffa..0aeca20a77a 100644 --- a/rules/Php70/Rector/ClassMethod/Php4ConstructorRector.php +++ b/rules/Php70/Rector/ClassMethod/Php4ConstructorRector.php @@ -32,14 +32,12 @@ final class Php4ConstructorRector extends AbstractRector implements MinPhpVersio { /** * @readonly - * @var \Rector\Php70\NodeAnalyzer\Php4ConstructorClassMethodAnalyzer */ - private $php4ConstructorClassMethodAnalyzer; + private Php4ConstructorClassMethodAnalyzer $php4ConstructorClassMethodAnalyzer; /** * @readonly - * @var \Rector\NodeCollector\ScopeResolver\ParentClassScopeResolver */ - private $parentClassScopeResolver; + private ParentClassScopeResolver $parentClassScopeResolver; public function __construct(Php4ConstructorClassMethodAnalyzer $php4ConstructorClassMethodAnalyzer, ParentClassScopeResolver $parentClassScopeResolver) { $this->php4ConstructorClassMethodAnalyzer = $php4ConstructorClassMethodAnalyzer; @@ -78,9 +76,8 @@ CODE_SAMPLE } /** * @param Class_ $node - * @return \PhpParser\Node\Stmt\Class_|int|null */ - public function refactor(Node $node) + public function refactor(Node $node) : ?\PhpParser\Node\Stmt\Class_ { $className = $this->getName($node); if (!\is_string($className)) { @@ -109,7 +106,7 @@ CODE_SAMPLE return null; } if (\count($classMethodStmts) === 1) { - $stmt = $psr4ConstructorMethod->stmts[0]; + $stmt = $classMethodStmts[0]; if (!$stmt instanceof Expression) { return null; } diff --git a/rules/Php70/Rector/FuncCall/EregToPregMatchRector.php b/rules/Php70/Rector/FuncCall/EregToPregMatchRector.php index ae226dbf799..5c1a0c4a6e4 100644 --- a/rules/Php70/Rector/FuncCall/EregToPregMatchRector.php +++ b/rules/Php70/Rector/FuncCall/EregToPregMatchRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Php70\Rector\FuncCall; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; @@ -13,7 +14,6 @@ use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use Rector\Php70\EregToPcreTransformer; use Rector\Rector\AbstractRector; @@ -29,9 +29,8 @@ final class EregToPregMatchRector extends AbstractRector implements MinPhpVersio { /** * @readonly - * @var \Rector\Php70\EregToPcreTransformer */ - private $eregToPcreTransformer; + private EregToPcreTransformer $eregToPcreTransformer; /** * @var array */ @@ -121,10 +120,10 @@ final class EregToPregMatchRector extends AbstractRector implements MinPhpVersio return; } // 3rd argument - $limit, 0 → 1 - if (!$funcCall->args[2]->value instanceof LNumber) { + if (!$funcCall->args[2]->value instanceof Int_) { return; } - /** @var LNumber $limitNumberNode */ + /** @var Int_ $limitNumberNode */ $limitNumberNode = $funcCall->args[2]->value; if ($limitNumberNode->value !== 0) { return; @@ -134,7 +133,7 @@ final class EregToPregMatchRector extends AbstractRector implements MinPhpVersio private function createTernaryWithStrlenOfFirstMatch(FuncCall $funcCall) : Ternary { $thirdArg = $funcCall->getArgs()[2]; - $arrayDimFetch = new ArrayDimFetch($thirdArg->value, new LNumber(0)); + $arrayDimFetch = new ArrayDimFetch($thirdArg->value, new Int_(0)); $strlenFuncCall = $this->nodeFactory->createFuncCall('strlen', [$arrayDimFetch]); return new Ternary($funcCall, $strlenFuncCall, $this->nodeFactory->createFalse()); } diff --git a/rules/Php70/Rector/FuncCall/MultiDirnameRector.php b/rules/Php70/Rector/FuncCall/MultiDirnameRector.php index 284479eac39..dbed5c232db 100644 --- a/rules/Php70/Rector/FuncCall/MultiDirnameRector.php +++ b/rules/Php70/Rector/FuncCall/MultiDirnameRector.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace Rector\Php70\Rector\FuncCall; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\FuncCall; -use PhpParser\Node\Scalar\LNumber; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersionFeature; use Rector\VersionBonding\Contract\MinPhpVersionInterface; @@ -21,10 +21,7 @@ final class MultiDirnameRector extends AbstractRector implements MinPhpVersionIn * @var string */ private const DIRNAME = 'dirname'; - /** - * @var int - */ - private $nestingLevel = 0; + private int $nestingLevel = 0; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Changes multiple dirname() calls to one with nesting level', [new CodeSample('dirname(dirname($path));', 'dirname($path, 2);')]); @@ -55,7 +52,7 @@ final class MultiDirnameRector extends AbstractRector implements MinPhpVersionIn return null; } $node->args[0] = $lastFuncCallNode->args[0]; - $node->args[1] = new Arg(new LNumber($this->nestingLevel)); + $node->args[1] = new Arg(new Int_($this->nestingLevel)); return $node; } public function provideMinPhpVersion() : int @@ -80,10 +77,10 @@ final class MultiDirnameRector extends AbstractRector implements MinPhpVersionIn } // dirname($path, ); if (\count($args) === 2) { - if (!$args[1]->value instanceof LNumber) { + if (!$args[1]->value instanceof Int_) { return null; } - /** @var LNumber $levelNumber */ + /** @var Int_ $levelNumber */ $levelNumber = $args[1]->value; $this->nestingLevel += $levelNumber->value; } else { diff --git a/rules/Php70/Rector/FuncCall/RandomFunctionRector.php b/rules/Php70/Rector/FuncCall/RandomFunctionRector.php index b984924f55c..1ab8e2dcb5a 100644 --- a/rules/Php70/Rector/FuncCall/RandomFunctionRector.php +++ b/rules/Php70/Rector/FuncCall/RandomFunctionRector.php @@ -3,11 +3,11 @@ declare (strict_types=1); namespace Rector\Php70\Rector\FuncCall; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; use Rector\PhpParser\Node\Value\ValueResolver; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersionFeature; @@ -21,9 +21,8 @@ final class RandomFunctionRector extends AbstractRector implements MinPhpVersion { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var array */ @@ -58,7 +57,7 @@ final class RandomFunctionRector extends AbstractRector implements MinPhpVersion if ($newFunctionName === 'random_int') { $args = $node->getArgs(); if ($args === []) { - $node->args[0] = new Arg(new LNumber(0)); + $node->args[0] = new Arg(new Int_(0)); $node->args[1] = new Arg($this->nodeFactory->createFuncCall('mt_getrandmax')); } elseif (\count($args) === 2) { $minValue = $this->valueResolver->getValue($args[0]->value); diff --git a/rules/Php70/Rector/If_/IfToSpaceshipRector.php b/rules/Php70/Rector/If_/IfToSpaceshipRector.php index de23455e040..45ed69cb76f 100644 --- a/rules/Php70/Rector/If_/IfToSpaceshipRector.php +++ b/rules/Php70/Rector/If_/IfToSpaceshipRector.php @@ -29,14 +29,12 @@ final class IfToSpaceshipRector extends AbstractRector implements MinPhpVersionI { /** * @readonly - * @var \Rector\Php70\NodeAnalyzer\BattleshipTernaryAnalyzer */ - private $battleshipTernaryAnalyzer; + private BattleshipTernaryAnalyzer $battleshipTernaryAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(BattleshipTernaryAnalyzer $battleshipTernaryAnalyzer, ValueResolver $valueResolver) { $this->battleshipTernaryAnalyzer = $battleshipTernaryAnalyzer; diff --git a/rules/Php70/Rector/List_/EmptyListRector.php b/rules/Php70/Rector/List_/EmptyListRector.php index b906c008727..9070cbb0fe7 100644 --- a/rules/Php70/Rector/List_/EmptyListRector.php +++ b/rules/Php70/Rector/List_/EmptyListRector.php @@ -4,7 +4,7 @@ declare (strict_types=1); namespace Rector\Php70\Rector\List_; use PhpParser\Node; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\List_; use PhpParser\Node\Expr\Variable; use Rector\Rector\AbstractRector; diff --git a/rules/Php70/Rector/MethodCall/ThisCallOnStaticMethodToStaticCallRector.php b/rules/Php70/Rector/MethodCall/ThisCallOnStaticMethodToStaticCallRector.php index 2473a3e1b26..5fa93d29c5e 100644 --- a/rules/Php70/Rector/MethodCall/ThisCallOnStaticMethodToStaticCallRector.php +++ b/rules/Php70/Rector/MethodCall/ThisCallOnStaticMethodToStaticCallRector.php @@ -3,14 +3,14 @@ declare (strict_types=1); namespace Rector\Php70\Rector\MethodCall; +use PhpParser\Node\Scalar\InterpolatedString; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\Encapsed; use PhpParser\Node\Stmt\Class_; -use PhpParser\NodeTraverser; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\Php\PhpMethodReflection; use Rector\Enum\ObjectReference; @@ -29,18 +29,13 @@ final class ThisCallOnStaticMethodToStaticCallRector extends AbstractRector impl { /** * @readonly - * @var \Rector\NodeCollector\StaticAnalyzer */ - private $staticAnalyzer; + private StaticAnalyzer $staticAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; - /** - * @var bool - */ - private $hasChanged = \false; + private ReflectionResolver $reflectionResolver; + private bool $hasChanged = \false; public function __construct(StaticAnalyzer $staticAnalyzer, ReflectionResolver $reflectionResolver) { $this->staticAnalyzer = $staticAnalyzer; @@ -111,8 +106,8 @@ CODE_SAMPLE private function processThisToStatic(Class_ $class, ClassReflection $classReflection) : void { $this->traverseNodesWithCallable($class, function (Node $subNode) use($class, $classReflection) { - if ($subNode instanceof Encapsed) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + if ($subNode instanceof InterpolatedString) { + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$subNode instanceof MethodCall) { return null; diff --git a/rules/Php70/Rector/StaticCall/StaticCallOnNonStaticToInstanceCallRector.php b/rules/Php70/Rector/StaticCall/StaticCallOnNonStaticToInstanceCallRector.php index 6773f519952..7255abc4431 100644 --- a/rules/Php70/Rector/StaticCall/StaticCallOnNonStaticToInstanceCallRector.php +++ b/rules/Php70/Rector/StaticCall/StaticCallOnNonStaticToInstanceCallRector.php @@ -33,24 +33,20 @@ final class StaticCallOnNonStaticToInstanceCallRector extends AbstractRector imp { /** * @readonly - * @var \Rector\NodeCollector\StaticAnalyzer */ - private $staticAnalyzer; + private StaticAnalyzer $staticAnalyzer; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\NodeCollector\ScopeResolver\ParentClassScopeResolver */ - private $parentClassScopeResolver; + private ParentClassScopeResolver $parentClassScopeResolver; public function __construct(StaticAnalyzer $staticAnalyzer, ReflectionProvider $reflectionProvider, ReflectionResolver $reflectionResolver, ParentClassScopeResolver $parentClassScopeResolver) { $this->staticAnalyzer = $staticAnalyzer; diff --git a/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php b/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php index 7322c30e3df..82d5661ded2 100644 --- a/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php +++ b/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php @@ -23,9 +23,8 @@ final class TernaryToNullCoalescingRector extends AbstractRector implements MinP { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; @@ -84,7 +83,7 @@ final class TernaryToNullCoalescingRector extends AbstractRector implements MinP if (!$ternary->if instanceof Expr) { return null; } - if ($isset->vars === null) { + if ($isset->vars === []) { return null; } // none or multiple isset values cannot be handled here diff --git a/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php b/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php index 7fd239d9e41..42570270e3d 100644 --- a/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php +++ b/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php @@ -22,9 +22,8 @@ final class TernaryToSpaceshipRector extends AbstractRector implements MinPhpVer { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/Php70/ValueObject/ComparedExprs.php b/rules/Php70/ValueObject/ComparedExprs.php index 985fa725dc9..d4ff7b0bb49 100644 --- a/rules/Php70/ValueObject/ComparedExprs.php +++ b/rules/Php70/ValueObject/ComparedExprs.php @@ -8,14 +8,12 @@ final class ComparedExprs { /** * @readonly - * @var \PhpParser\Node\Expr */ - private $firstExpr; + private Expr $firstExpr; /** * @readonly - * @var \PhpParser\Node\Expr */ - private $secondExpr; + private Expr $secondExpr; public function __construct(Expr $firstExpr, Expr $secondExpr) { $this->firstExpr = $firstExpr; diff --git a/rules/Php71/IsArrayAndDualCheckToAble.php b/rules/Php71/IsArrayAndDualCheckToAble.php index 04ec0363428..8d0c0d6c166 100644 --- a/rules/Php71/IsArrayAndDualCheckToAble.php +++ b/rules/Php71/IsArrayAndDualCheckToAble.php @@ -17,19 +17,16 @@ final class IsArrayAndDualCheckToAble { /** * @readonly - * @var \Rector\NodeManipulator\BinaryOpManipulator */ - private $binaryOpManipulator; + private BinaryOpManipulator $binaryOpManipulator; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; public function __construct(BinaryOpManipulator $binaryOpManipulator, NodeNameResolver $nodeNameResolver, NodeComparator $nodeComparator) { $this->binaryOpManipulator = $binaryOpManipulator; diff --git a/rules/Php71/Rector/Assign/AssignArrayToStringRector.php b/rules/Php71/Rector/Assign/AssignArrayToStringRector.php index 29fc4ae4e36..2860f1198af 100644 --- a/rules/Php71/Rector/Assign/AssignArrayToStringRector.php +++ b/rules/Php71/Rector/Assign/AssignArrayToStringRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Php71\Rector\Assign; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; @@ -16,7 +17,6 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Namespace_; use PhpParser\Node\Stmt\Property; -use PhpParser\NodeTraverser; use PHPStan\Type\UnionType; use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace; use Rector\PhpParser\NodeFinder\PropertyFetchFinder; @@ -32,9 +32,8 @@ final class AssignArrayToStringRector extends AbstractRector implements MinPhpVe { /** * @readonly - * @var \Rector\PhpParser\NodeFinder\PropertyFetchFinder */ - private $propertyFetchFinder; + private PropertyFetchFinder $propertyFetchFinder; public function __construct(PropertyFetchFinder $propertyFetchFinder) { $this->propertyFetchFinder = $propertyFetchFinder; @@ -76,7 +75,7 @@ CODE_SAMPLE $hasChanged = \false; $this->traverseNodesWithCallable($node->stmts, function (Node $subNode) use(&$hasChanged, $node) : ?int { if ($subNode instanceof Class_ || $subNode instanceof Function_ || $subNode instanceof Closure) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($subNode instanceof Assign) { $assign = $this->refactorAssign($subNode, $node); @@ -148,7 +147,7 @@ CODE_SAMPLE } if ($this->isReAssignedAsArray($node, $variableName, $variable)) { $assignedArrayDimFetches = []; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } if (!$node->var instanceof ArrayDimFetch) { return null; diff --git a/rules/Php71/Rector/BinaryOp/BinaryOpBetweenNumberAndStringRector.php b/rules/Php71/Rector/BinaryOp/BinaryOpBetweenNumberAndStringRector.php index 7427b5998da..0603d8a0296 100644 --- a/rules/Php71/Rector/BinaryOp/BinaryOpBetweenNumberAndStringRector.php +++ b/rules/Php71/Rector/BinaryOp/BinaryOpBetweenNumberAndStringRector.php @@ -3,6 +3,8 @@ declare (strict_types=1); namespace Rector\Php71\Rector\BinaryOp; +use PhpParser\Node\Scalar\Int_; +use PhpParser\Node\Scalar\Float_; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\BinaryOp; @@ -10,8 +12,6 @@ use PhpParser\Node\Expr\BinaryOp\Coalesce; use PhpParser\Node\Expr\BinaryOp\Concat; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Scalar; -use PhpParser\Node\Scalar\DNumber; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\MagicConst\Line; use PhpParser\Node\Scalar\String_; use PHPStan\Type\Constant\ConstantStringType; @@ -28,9 +28,8 @@ final class BinaryOpBetweenNumberAndStringRector extends AbstractRector implemen { /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; public function __construct(ExprAnalyzer $exprAnalyzer) { $this->exprAnalyzer = $exprAnalyzer; @@ -88,11 +87,11 @@ CODE_SAMPLE return null; } if ($this->isStringOrStaticNonNumericString($node->left) && $this->nodeTypeResolver->isNumberType($node->right)) { - $node->left = $this->nodeTypeResolver->getNativeType($node->right)->isInteger()->yes() ? new LNumber(0) : new DNumber(0); + $node->left = $this->nodeTypeResolver->getNativeType($node->right)->isInteger()->yes() ? new Int_(0) : new Float_(0); return $node; } if ($this->isStringOrStaticNonNumericString($node->right) && $this->nodeTypeResolver->isNumberType($node->left)) { - $node->right = $this->nodeTypeResolver->getNativeType($node->left)->isInteger()->yes() ? new LNumber(0) : new DNumber(0); + $node->right = $this->nodeTypeResolver->getNativeType($node->left)->isInteger()->yes() ? new Int_(0) : new Float_(0); return $node; } return null; diff --git a/rules/Php71/Rector/BooleanOr/IsIterableRector.php b/rules/Php71/Rector/BooleanOr/IsIterableRector.php index 569122fee9d..39343a7b358 100644 --- a/rules/Php71/Rector/BooleanOr/IsIterableRector.php +++ b/rules/Php71/Rector/BooleanOr/IsIterableRector.php @@ -21,19 +21,16 @@ final class IsIterableRector extends AbstractRector implements MinPhpVersionInte { /** * @readonly - * @var \Rector\Php71\IsArrayAndDualCheckToAble */ - private $isArrayAndDualCheckToAble; + private IsArrayAndDualCheckToAble $isArrayAndDualCheckToAble; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(IsArrayAndDualCheckToAble $isArrayAndDualCheckToAble, ReflectionProvider $reflectionProvider, PhpVersionProvider $phpVersionProvider) { $this->isArrayAndDualCheckToAble = $isArrayAndDualCheckToAble; diff --git a/rules/Php71/Rector/FuncCall/RemoveExtraParametersRector.php b/rules/Php71/Rector/FuncCall/RemoveExtraParametersRector.php index 9e6fed93d94..eec90a8d33d 100644 --- a/rules/Php71/Rector/FuncCall/RemoveExtraParametersRector.php +++ b/rules/Php71/Rector/FuncCall/RemoveExtraParametersRector.php @@ -27,14 +27,12 @@ final class RemoveExtraParametersRector extends AbstractRector implements MinPhp { /** * @readonly - * @var \Rector\NodeAnalyzer\VariadicAnalyzer */ - private $variadicAnalyzer; + private VariadicAnalyzer $variadicAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(VariadicAnalyzer $variadicAnalyzer, ReflectionResolver $reflectionResolver) { $this->variadicAnalyzer = $variadicAnalyzer; @@ -140,8 +138,8 @@ final class RemoveExtraParametersRector extends AbstractRector implements MinPhp private function resolveMaximumAllowedParameterCount($functionLikeReflection) : int { $parameterCounts = [0]; - foreach ($functionLikeReflection->getVariants() as $parametersAcceptor) { - $parameterCounts[] = \count($parametersAcceptor->getParameters()); + foreach ($functionLikeReflection->getVariants() as $variant) { + $parameterCounts[] = \count($variant->getParameters()); } return \max($parameterCounts); } diff --git a/rules/Php71/Rector/TryCatch/MultiExceptionCatchRector.php b/rules/Php71/Rector/TryCatch/MultiExceptionCatchRector.php index 56a0bde7fcd..cfcfb95a43f 100644 --- a/rules/Php71/Rector/TryCatch/MultiExceptionCatchRector.php +++ b/rules/Php71/Rector/TryCatch/MultiExceptionCatchRector.php @@ -18,9 +18,8 @@ final class MultiExceptionCatchRector extends AbstractRector implements MinPhpVe { /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; public function __construct(BetterStandardPrinter $betterStandardPrinter) { $this->betterStandardPrinter = $betterStandardPrinter; diff --git a/rules/Php71/ValueObject/TwoNodeMatch.php b/rules/Php71/ValueObject/TwoNodeMatch.php index 57837d27f1b..67ca5a4a050 100644 --- a/rules/Php71/ValueObject/TwoNodeMatch.php +++ b/rules/Php71/ValueObject/TwoNodeMatch.php @@ -8,14 +8,12 @@ final class TwoNodeMatch { /** * @readonly - * @var \PhpParser\Node\Expr */ - private $firstExpr; + private Expr $firstExpr; /** * @readonly - * @var \PhpParser\Node\Expr */ - private $secondExpr; + private Expr $secondExpr; public function __construct(Expr $firstExpr, Expr $secondExpr) { $this->firstExpr = $firstExpr; diff --git a/rules/Php72/NodeFactory/AnonymousFunctionFactory.php b/rules/Php72/NodeFactory/AnonymousFunctionFactory.php index 954854317c9..48917e333ab 100644 --- a/rules/Php72/NodeFactory/AnonymousFunctionFactory.php +++ b/rules/Php72/NodeFactory/AnonymousFunctionFactory.php @@ -3,19 +3,19 @@ declare (strict_types=1); namespace Rector\Php72\NodeFactory; +use PhpParser\Node\ClosureUse; +use PhpParser\Node\Scalar\Int_; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\Node; use PhpParser\Node\ComplexType; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node\Expr\Closure; -use PhpParser\Node\Expr\ClosureUse; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\NullableType; use PhpParser\Node\Param; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; @@ -31,29 +31,24 @@ final class AnonymousFunctionFactory { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\PhpParser\Parser\SimplePhpParser */ - private $simplePhpParser; + private SimplePhpParser $simplePhpParser; /** * @readonly - * @var \Rector\PhpParser\Parser\InlineCodeParser */ - private $inlineCodeParser; + private InlineCodeParser $inlineCodeParser; /** * @var string * @see https://regex101.com/r/jkLLlM/2 @@ -110,14 +105,12 @@ final class AnonymousFunctionFactory return $node; } $matchesVariable = new Variable('matches'); - return new ArrayDimFetch($matchesVariable, new LNumber((int) $match['number'])); + return new ArrayDimFetch($matchesVariable, new Int_((int) $match['number'])); }); $anonymousFunction->stmts[] = new Return_($stmt); $anonymousFunction->params[] = new Param(new Variable('matches')); $variables = $expr instanceof Variable ? [] : $this->betterNodeFinder->findInstanceOf($expr, Variable::class); - $anonymousFunction->uses = \array_map(static function (Variable $variable) : ClosureUse { - return new ClosureUse($variable); - }, $variables); + $anonymousFunction->uses = \array_map(static fn(Variable $variable): ClosureUse => new ClosureUse($variable), $variables); return $anonymousFunction; } /** diff --git a/rules/Php72/Rector/Assign/ListEachRector.php b/rules/Php72/Rector/Assign/ListEachRector.php index 782d91aeeb8..8fbfa350ddc 100644 --- a/rules/Php72/Rector/Assign/ListEachRector.php +++ b/rules/Php72/Rector/Assign/ListEachRector.php @@ -4,7 +4,7 @@ declare (strict_types=1); namespace Rector\Php72\Rector\Assign; use PhpParser\Node; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; @@ -23,9 +23,8 @@ final class ListEachRector extends AbstractRector implements MinPhpVersionInterf { /** * @readonly - * @var \Rector\NodeManipulator\AssignManipulator */ - private $assignManipulator; + private AssignManipulator $assignManipulator; public function __construct(AssignManipulator $assignManipulator) { $this->assignManipulator = $assignManipulator; diff --git a/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php b/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php index ed170fc122c..78fbc214003 100644 --- a/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php +++ b/rules/Php72/Rector/Assign/ReplaceEachAssignmentWithKeyCurrentRector.php @@ -98,9 +98,7 @@ CODE_SAMPLE private function createNewStmts(Expr $assignVariable, Expr $eachedVariable) : array { $exprs = [$this->createDimFetchAssignWithFuncCall($assignVariable, $eachedVariable, 1, 'current'), $this->createDimFetchAssignWithFuncCall($assignVariable, $eachedVariable, 'value', 'current'), $this->createDimFetchAssignWithFuncCall($assignVariable, $eachedVariable, 0, self::KEY), $this->createDimFetchAssignWithFuncCall($assignVariable, $eachedVariable, self::KEY, self::KEY), $this->nodeFactory->createFuncCall('next', [new Arg($eachedVariable)])]; - return \array_map(static function (Expr $expr) : Expression { - return new Expression($expr); - }, $exprs); + return \array_map(static fn(Expr $expr): Expression => new Expression($expr), $exprs); } /** * @param string|int $dimValue diff --git a/rules/Php72/Rector/FuncCall/CreateFunctionToAnonymousFunctionRector.php b/rules/Php72/Rector/FuncCall/CreateFunctionToAnonymousFunctionRector.php index c953d6d819e..69d47ba2c11 100644 --- a/rules/Php72/Rector/FuncCall/CreateFunctionToAnonymousFunctionRector.php +++ b/rules/Php72/Rector/FuncCall/CreateFunctionToAnonymousFunctionRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Php72\Rector\FuncCall; +use PhpParser\Node\Scalar\InterpolatedString; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; @@ -12,7 +13,6 @@ use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; use PhpParser\Node\Param; -use PhpParser\Node\Scalar\Encapsed; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; @@ -32,19 +32,16 @@ final class CreateFunctionToAnonymousFunctionRector extends AbstractRector imple { /** * @readonly - * @var \Rector\PhpParser\Parser\InlineCodeParser */ - private $inlineCodeParser; + private InlineCodeParser $inlineCodeParser; /** * @readonly - * @var \Rector\Php72\NodeFactory\AnonymousFunctionFactory */ - private $anonymousFunctionFactory; + private AnonymousFunctionFactory $anonymousFunctionFactory; /** * @readonly - * @var \Rector\Php\ReservedKeywordAnalyzer */ - private $reservedKeywordAnalyzer; + private ReservedKeywordAnalyzer $reservedKeywordAnalyzer; public function __construct(InlineCodeParser $inlineCodeParser, AnonymousFunctionFactory $anonymousFunctionFactory, ReservedKeywordAnalyzer $reservedKeywordAnalyzer) { $this->inlineCodeParser = $inlineCodeParser; @@ -140,7 +137,7 @@ CODE_SAMPLE */ private function parseStringToBody(Expr $expr) : array { - if (!$expr instanceof String_ && !$expr instanceof Encapsed && !$expr instanceof Concat) { + if (!$expr instanceof String_ && !$expr instanceof InterpolatedString && !$expr instanceof Concat) { // special case of code elsewhere return [$this->createEval($expr)]; } diff --git a/rules/Php72/Rector/FuncCall/GetClassOnNullRector.php b/rules/Php72/Rector/FuncCall/GetClassOnNullRector.php index 065c08d490f..24bfd44567f 100644 --- a/rules/Php72/Rector/FuncCall/GetClassOnNullRector.php +++ b/rules/Php72/Rector/FuncCall/GetClassOnNullRector.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\Php72\Rector\FuncCall; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Stmt\Class_; -use PhpParser\NodeTraverser; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersionFeature; @@ -64,7 +64,7 @@ CODE_SAMPLE $hasChanged = \false; $this->traverseNodesWithCallable($node, function (Node $node) use(&$hasChanged) { if ($node instanceof Ternary) { - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } if (!$node instanceof FuncCall) { return null; diff --git a/rules/Php72/Rector/FuncCall/ParseStrWithResultArgumentRector.php b/rules/Php72/Rector/FuncCall/ParseStrWithResultArgumentRector.php index ec4736a9c0c..4ec20d52811 100644 --- a/rules/Php72/Rector/FuncCall/ParseStrWithResultArgumentRector.php +++ b/rules/Php72/Rector/FuncCall/ParseStrWithResultArgumentRector.php @@ -55,9 +55,7 @@ CODE_SAMPLE if ($stmtsAware->stmts === null) { return null; } - \end($stmtsAware->stmts); - $totalKeys = \key($stmtsAware->stmts); - \reset($stmtsAware->stmts); + $totalKeys = \array_key_last($stmtsAware->stmts); for ($key = $jumpToKey; $key < $totalKeys; ++$key) { if (!isset($stmtsAware->stmts[$key], $stmtsAware->stmts[$key + 1])) { break; diff --git a/rules/Php72/Rector/FuncCall/StringifyDefineRector.php b/rules/Php72/Rector/FuncCall/StringifyDefineRector.php index 6ab1502225f..6dbfc3976bc 100644 --- a/rules/Php72/Rector/FuncCall/StringifyDefineRector.php +++ b/rules/Php72/Rector/FuncCall/StringifyDefineRector.php @@ -20,9 +20,8 @@ final class StringifyDefineRector extends AbstractRector implements MinPhpVersio { /** * @readonly - * @var \Rector\NodeTypeResolver\TypeAnalyzer\StringTypeAnalyzer */ - private $stringTypeAnalyzer; + private StringTypeAnalyzer $stringTypeAnalyzer; public function __construct(StringTypeAnalyzer $stringTypeAnalyzer) { $this->stringTypeAnalyzer = $stringTypeAnalyzer; diff --git a/rules/Php72/Rector/FuncCall/StringsAssertNakedRector.php b/rules/Php72/Rector/FuncCall/StringsAssertNakedRector.php index 1c264b74834..715013b8007 100644 --- a/rules/Php72/Rector/FuncCall/StringsAssertNakedRector.php +++ b/rules/Php72/Rector/FuncCall/StringsAssertNakedRector.php @@ -21,9 +21,8 @@ final class StringsAssertNakedRector extends AbstractRector implements MinPhpVer { /** * @readonly - * @var \Rector\PhpParser\Parser\SimplePhpParser */ - private $simplePhpParser; + private SimplePhpParser $simplePhpParser; public function __construct(SimplePhpParser $simplePhpParser) { $this->simplePhpParser = $simplePhpParser; diff --git a/rules/Php72/Rector/Unset_/UnsetCastRector.php b/rules/Php72/Rector/Unset_/UnsetCastRector.php index 634b3cda403..558c8b9193d 100644 --- a/rules/Php72/Rector/Unset_/UnsetCastRector.php +++ b/rules/Php72/Rector/Unset_/UnsetCastRector.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace Rector\Php72\Rector\Unset_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\Cast\Unset_; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Stmt\Expression; -use PhpParser\NodeTraverser; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersionFeature; use Rector\VersionBonding\Contract\MinPhpVersionInterface; @@ -57,7 +57,7 @@ CODE_SAMPLE if (!$node->expr instanceof Unset_) { return null; } - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } return $this->nodeFactory->createNull(); } diff --git a/rules/Php72/Rector/While_/WhileEachToForeachRector.php b/rules/Php72/Rector/While_/WhileEachToForeachRector.php index efae476e3bb..3d7c5d2940d 100644 --- a/rules/Php72/Rector/While_/WhileEachToForeachRector.php +++ b/rules/Php72/Rector/While_/WhileEachToForeachRector.php @@ -4,7 +4,7 @@ declare (strict_types=1); namespace Rector\Php72\Rector\While_; use PhpParser\Node; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Stmt\Foreach_; use PhpParser\Node\Stmt\While_; @@ -22,9 +22,8 @@ final class WhileEachToForeachRector extends AbstractRector implements MinPhpVer { /** * @readonly - * @var \Rector\NodeManipulator\AssignManipulator */ - private $assignManipulator; + private AssignManipulator $assignManipulator; public function __construct(AssignManipulator $assignManipulator) { $this->assignManipulator = $assignManipulator; @@ -91,7 +90,7 @@ CODE_SAMPLE $arrayItem = \current($list->items); $isTrailingCommaLast = \true; } - $foreach = new Foreach_($foreachedExpr, $arrayItem, ['stmts' => $node->stmts]); + $foreach = new Foreach_($foreachedExpr, $arrayItem->value, ['stmts' => $node->stmts]); $this->mirrorComments($foreach, $node); // is key included? add it to foreach if ($list->items !== []) { diff --git a/rules/Php72/ValueObject/ListAndEach.php b/rules/Php72/ValueObject/ListAndEach.php index a60db26b36d..e7056970b9b 100644 --- a/rules/Php72/ValueObject/ListAndEach.php +++ b/rules/Php72/ValueObject/ListAndEach.php @@ -9,14 +9,12 @@ final class ListAndEach { /** * @readonly - * @var \PhpParser\Node\Expr\List_ */ - private $list; + private List_ $list; /** * @readonly - * @var \PhpParser\Node\Expr\FuncCall */ - private $eachFuncCall; + private FuncCall $eachFuncCall; public function __construct(List_ $list, FuncCall $eachFuncCall) { $this->list = $list; diff --git a/rules/Php73/Rector/BooleanOr/IsCountableRector.php b/rules/Php73/Rector/BooleanOr/IsCountableRector.php index 2e7b6a361b0..fb9c0077678 100644 --- a/rules/Php73/Rector/BooleanOr/IsCountableRector.php +++ b/rules/Php73/Rector/BooleanOr/IsCountableRector.php @@ -22,14 +22,12 @@ final class IsCountableRector extends AbstractRector implements MinPhpVersionInt { /** * @readonly - * @var \Rector\Php71\IsArrayAndDualCheckToAble */ - private $isArrayAndDualCheckToAble; + private IsArrayAndDualCheckToAble $isArrayAndDualCheckToAble; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(IsArrayAndDualCheckToAble $isArrayAndDualCheckToAble, ReflectionProvider $reflectionProvider) { $this->isArrayAndDualCheckToAble = $isArrayAndDualCheckToAble; diff --git a/rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php b/rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php index 7c07bc440f6..e7a6b7d7080 100644 --- a/rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php +++ b/rules/Php73/Rector/ConstFetch/SensitiveConstantNameRector.php @@ -20,9 +20,8 @@ final class SensitiveConstantNameRector extends AbstractRector implements MinPhp { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @see http://php.net/manual/en/reserved.constants.php * @var string[] diff --git a/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php b/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php index 1cf350d3136..cb19539cdbb 100644 --- a/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php +++ b/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php @@ -28,14 +28,12 @@ final class ArrayKeyFirstLastRector extends AbstractRector implements MinPhpVers { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @var string */ @@ -99,10 +97,7 @@ CODE_SAMPLE return null; } /** @var int $totalKeys */ - \end($stmtsAware->stmts); - /** @var int $totalKeys */ - $totalKeys = \key($stmtsAware->stmts); - \reset($stmtsAware->stmts); + $totalKeys = \array_key_last($stmtsAware->stmts); for ($key = $jumpToKey; $key < $totalKeys; ++$key) { if (!isset($stmtsAware->stmts[$key], $stmtsAware->stmts[$key + 1])) { break; diff --git a/rules/Php73/Rector/FuncCall/JsonThrowOnErrorRector.php b/rules/Php73/Rector/FuncCall/JsonThrowOnErrorRector.php index 9d38ef442f0..bb12127ece2 100644 --- a/rules/Php73/Rector/FuncCall/JsonThrowOnErrorRector.php +++ b/rules/Php73/Rector/FuncCall/JsonThrowOnErrorRector.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\Php73\Rector\FuncCall; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\PhpParser\Node\BetterNodeFinder; use Rector\PhpParser\Node\Value\ValueResolver; @@ -25,18 +25,13 @@ final class JsonThrowOnErrorRector extends AbstractRector implements MinPhpVersi { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; - /** - * @var bool - */ - private $hasChanged = \false; + private BetterNodeFinder $betterNodeFinder; + private bool $hasChanged = \false; public function __construct(ValueResolver $valueResolver, BetterNodeFinder $betterNodeFinder) { $this->valueResolver = $valueResolver; @@ -67,9 +62,7 @@ CODE_SAMPLE public function refactor(Node $node) : ?Node { // if found, skip it :) - $hasJsonErrorFuncCall = (bool) $this->betterNodeFinder->findFirst($node, function (Node $node) : bool { - return $this->isNames($node, ['json_last_error', 'json_last_error_msg']); - }); + $hasJsonErrorFuncCall = (bool) $this->betterNodeFinder->findFirst($node, fn(Node $node): bool => $this->isNames($node, ['json_last_error', 'json_last_error_msg'])); if ($hasJsonErrorFuncCall) { return null; } @@ -103,7 +96,7 @@ CODE_SAMPLE if ($funcCall->isFirstClassCallable()) { return \true; } - if ($funcCall->args === null) { + if ($funcCall->args === []) { return \true; } foreach ($funcCall->args as $arg) { @@ -135,7 +128,7 @@ CODE_SAMPLE $funcCall->args[1] = new Arg($this->nodeFactory->createNull()); } if (!isset($funcCall->args[2])) { - $funcCall->args[2] = new Arg(new LNumber(512)); + $funcCall->args[2] = new Arg(new Int_(512)); } $this->hasChanged = \true; $funcCall->args[3] = new Arg($this->createConstFetch('JSON_THROW_ON_ERROR')); diff --git a/rules/Php73/Rector/FuncCall/SetCookieRector.php b/rules/Php73/Rector/FuncCall/SetCookieRector.php index a30a7dcfc3e..d208291dc4d 100644 --- a/rules/Php73/Rector/FuncCall/SetCookieRector.php +++ b/rules/Php73/Rector/FuncCall/SetCookieRector.php @@ -6,7 +6,7 @@ namespace Rector\Php73\Rector\FuncCall; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Scalar\String_; diff --git a/rules/Php73/Rector/FuncCall/StringifyStrNeedlesRector.php b/rules/Php73/Rector/FuncCall/StringifyStrNeedlesRector.php index d4404b1ae20..d7ca7012383 100644 --- a/rules/Php73/Rector/FuncCall/StringifyStrNeedlesRector.php +++ b/rules/Php73/Rector/FuncCall/StringifyStrNeedlesRector.php @@ -3,11 +3,11 @@ declare (strict_types=1); namespace Rector\Php73\Rector\FuncCall; +use PhpParser\Node\Scalar\InterpolatedString; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\Cast\String_; use PhpParser\Node\Expr\FuncCall; -use PhpParser\Node\Scalar\Encapsed; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersionFeature; use Rector\VersionBonding\Contract\MinPhpVersionInterface; @@ -65,7 +65,7 @@ CODE_SAMPLE if ($needleType->isString()->yes()) { return null; } - if ($needleArgValue instanceof Encapsed) { + if ($needleArgValue instanceof InterpolatedString) { return null; } $node->args[1]->value = new String_($node->args[1]->value); diff --git a/rules/Php74/Guard/MakePropertyTypedGuard.php b/rules/Php74/Guard/MakePropertyTypedGuard.php index 79c44b942a2..63d5ca6f1ef 100644 --- a/rules/Php74/Guard/MakePropertyTypedGuard.php +++ b/rules/Php74/Guard/MakePropertyTypedGuard.php @@ -3,22 +3,22 @@ declare (strict_types=1); namespace Rector\Php74\Guard; +use PhpParser\Node; use PhpParser\Node\Stmt\Property; use PHPStan\Reflection\ClassReflection; final class MakePropertyTypedGuard { /** * @readonly - * @var \Rector\Php74\Guard\PropertyTypeChangeGuard */ - private $propertyTypeChangeGuard; + private \Rector\Php74\Guard\PropertyTypeChangeGuard $propertyTypeChangeGuard; public function __construct(\Rector\Php74\Guard\PropertyTypeChangeGuard $propertyTypeChangeGuard) { $this->propertyTypeChangeGuard = $propertyTypeChangeGuard; } public function isLegal(Property $property, ClassReflection $classReflection, bool $inlinePublic = \true) : bool { - if ($property->type !== null) { + if ($property->type instanceof Node) { return \false; } return $this->propertyTypeChangeGuard->isLegal($property, $classReflection, $inlinePublic); diff --git a/rules/Php74/Guard/PropertyTypeChangeGuard.php b/rules/Php74/Guard/PropertyTypeChangeGuard.php index b0d4abb34eb..b1ee97363a6 100644 --- a/rules/Php74/Guard/PropertyTypeChangeGuard.php +++ b/rules/Php74/Guard/PropertyTypeChangeGuard.php @@ -13,24 +13,20 @@ final class PropertyTypeChangeGuard { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyAnalyzer */ - private $propertyAnalyzer; + private PropertyAnalyzer $propertyAnalyzer; /** * @readonly - * @var \Rector\NodeManipulator\PropertyManipulator */ - private $propertyManipulator; + private PropertyManipulator $propertyManipulator; /** * @readonly - * @var \Rector\Privatization\Guard\ParentPropertyLookupGuard */ - private $parentPropertyLookupGuard; + private ParentPropertyLookupGuard $parentPropertyLookupGuard; public function __construct(NodeNameResolver $nodeNameResolver, PropertyAnalyzer $propertyAnalyzer, PropertyManipulator $propertyManipulator, ParentPropertyLookupGuard $parentPropertyLookupGuard) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Php74/NodeAnalyzer/ClosureArrowFunctionAnalyzer.php b/rules/Php74/NodeAnalyzer/ClosureArrowFunctionAnalyzer.php index 4d442d7d45c..afd4d09c0ba 100644 --- a/rules/Php74/NodeAnalyzer/ClosureArrowFunctionAnalyzer.php +++ b/rules/Php74/NodeAnalyzer/ClosureArrowFunctionAnalyzer.php @@ -6,7 +6,7 @@ namespace Rector\Php74\NodeAnalyzer; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Closure; -use PhpParser\Node\Expr\ClosureUse; +use PhpParser\Node\ClosureUse; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\Return_; use Rector\PhpParser\Comparing\NodeComparator; @@ -16,19 +16,16 @@ final class ClosureArrowFunctionAnalyzer { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; /** * @readonly - * @var \Rector\Util\ArrayChecker */ - private $arrayChecker; + private ArrayChecker $arrayChecker; public function __construct(BetterNodeFinder $betterNodeFinder, NodeComparator $nodeComparator, ArrayChecker $arrayChecker) { $this->betterNodeFinder = $betterNodeFinder; @@ -83,9 +80,7 @@ final class ClosureArrowFunctionAnalyzer return \false; } foreach ($referencedValues as $referencedValue) { - $isFoundInInnerUses = $this->arrayChecker->doesExist($subNode->uses, function (ClosureUse $closureUse) use($referencedValue) : bool { - return $closureUse->byRef && $this->nodeComparator->areNodesEqual($closureUse->var, $referencedValue); - }); + $isFoundInInnerUses = $this->arrayChecker->doesExist($subNode->uses, fn(ClosureUse $closureUse): bool => $closureUse->byRef && $this->nodeComparator->areNodesEqual($closureUse->var, $referencedValue)); if ($isFoundInInnerUses) { return \true; } diff --git a/rules/Php74/Rector/ArrayDimFetch/CurlyToSquareBracketArrayStringRector.php b/rules/Php74/Rector/ArrayDimFetch/CurlyToSquareBracketArrayStringRector.php index 4c1dce00828..f1eb70729ab 100644 --- a/rules/Php74/Rector/ArrayDimFetch/CurlyToSquareBracketArrayStringRector.php +++ b/rules/Php74/Rector/ArrayDimFetch/CurlyToSquareBracketArrayStringRector.php @@ -62,9 +62,9 @@ CODE_SAMPLE { $oldTokens = $file->getOldTokens(); $endTokenPost = $arrayDimFetch->getEndTokenPos(); - if (isset($oldTokens[$endTokenPost]) && $oldTokens[$endTokenPost] === '}') { - $startTokenPost = $arrayDimFetch->getStartTokenPos(); - return !(isset($oldTokens[$startTokenPost][1]) && $oldTokens[$startTokenPost][1] === '${'); + if (isset($oldTokens[$endTokenPost]) && (string) $oldTokens[$endTokenPost] === '}') { + $startTokenPos = $arrayDimFetch->getStartTokenPos(); + return !(isset($oldTokens[$startTokenPos]) && (string) $oldTokens[$startTokenPos] === '${'); } return \false; } diff --git a/rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php b/rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php index d5c4f5fa2e6..305c6c3a838 100644 --- a/rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php +++ b/rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php @@ -21,9 +21,8 @@ final class ClosureToArrowFunctionRector extends AbstractRector implements MinPh { /** * @readonly - * @var \Rector\Php74\NodeAnalyzer\ClosureArrowFunctionAnalyzer */ - private $closureArrowFunctionAnalyzer; + private ClosureArrowFunctionAnalyzer $closureArrowFunctionAnalyzer; public function __construct(ClosureArrowFunctionAnalyzer $closureArrowFunctionAnalyzer) { $this->closureArrowFunctionAnalyzer = $closureArrowFunctionAnalyzer; diff --git a/rules/Php74/Rector/FuncCall/MbStrrposEncodingArgumentPositionRector.php b/rules/Php74/Rector/FuncCall/MbStrrposEncodingArgumentPositionRector.php index 5017b4cc85d..3bc1a3843a9 100644 --- a/rules/Php74/Rector/FuncCall/MbStrrposEncodingArgumentPositionRector.php +++ b/rules/Php74/Rector/FuncCall/MbStrrposEncodingArgumentPositionRector.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace Rector\Php74\Rector\FuncCall; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\FuncCall; -use PhpParser\Node\Scalar\LNumber; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersionFeature; use Rector\VersionBonding\Contract\MinPhpVersionInterface; @@ -54,7 +54,7 @@ final class MbStrrposEncodingArgumentPositionRector extends AbstractRector imple return null; } $node->args[3] = $node->args[2]; - $node->args[2] = new Arg(new LNumber(0)); + $node->args[2] = new Arg(new Int_(0)); return $node; } } diff --git a/rules/Php74/Rector/FuncCall/MoneyFormatToNumberFormatRector.php b/rules/Php74/Rector/FuncCall/MoneyFormatToNumberFormatRector.php index 0d0764c587a..08fd1dd2f48 100644 --- a/rules/Php74/Rector/FuncCall/MoneyFormatToNumberFormatRector.php +++ b/rules/Php74/Rector/FuncCall/MoneyFormatToNumberFormatRector.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\Php74\Rector\FuncCall; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use Rector\NodeAnalyzer\ArgsAnalyzer; use Rector\PhpParser\Node\Value\ValueResolver; @@ -25,14 +25,12 @@ final class MoneyFormatToNumberFormatRector extends AbstractRector implements Mi { /** * @readonly - * @var \Rector\NodeAnalyzer\ArgsAnalyzer */ - private $argsAnalyzer; + private ArgsAnalyzer $argsAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ArgsAnalyzer $argsAnalyzer, ValueResolver $valueResolver) { $this->argsAnalyzer = $argsAnalyzer; @@ -82,9 +80,9 @@ CODE_SAMPLE } private function warpInNumberFormatFuncCall(FuncCall $funcCall, Expr $expr) : FuncCall { - $roundFuncCall = $this->nodeFactory->createFuncCall('round', [$expr, new LNumber(2), new ConstFetch(new Name('PHP_ROUND_HALF_ODD'))]); + $roundFuncCall = $this->nodeFactory->createFuncCall('round', [$expr, new Int_(2), new ConstFetch(new Name('PHP_ROUND_HALF_ODD'))]); $funcCall->name = new Name('number_format'); - $funcCall->args = [new Arg($roundFuncCall), new Arg(new LNumber(2)), new Arg(new String_('.')), new Arg(new String_(''))]; + $funcCall->args = [new Arg($roundFuncCall), new Arg(new Int_(2)), new Arg(new String_('.')), new Arg(new String_(''))]; return $funcCall; } } diff --git a/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php b/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php index fc205241fa1..796e3e4b642 100644 --- a/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php +++ b/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php @@ -3,9 +3,9 @@ declare (strict_types=1); namespace Rector\Php74\Rector\LNumber; +use PhpParser\Node\Scalar\Int_; +use PhpParser\Node\Scalar\Float_; use PhpParser\Node; -use PhpParser\Node\Scalar\DNumber; -use PhpParser\Node\Scalar\LNumber; use Rector\Contract\Rector\ConfigurableRectorInterface; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\Rector\AbstractRector; @@ -36,10 +36,7 @@ final class AddLiteralSeparatorToNumberRector extends AbstractRector implements * @var int */ private const DEFAULT_LIMIT_VALUE = 1000000; - /** - * @var int - */ - private $limitValue = self::DEFAULT_LIMIT_VALUE; + private int $limitValue = self::DEFAULT_LIMIT_VALUE; /** * @param mixed[] $configuration */ @@ -78,10 +75,10 @@ CODE_SAMPLE */ public function getNodeTypes() : array { - return [LNumber::class, DNumber::class]; + return [Int_::class, Float_::class]; } /** - * @param LNumber|DNumber $node + * @param Int_|Float_ $node */ public function refactor(Node $node) : ?Node { @@ -113,7 +110,7 @@ CODE_SAMPLE return PhpVersionFeature::LITERAL_SEPARATOR; } /** - * @param \PhpParser\Node\Scalar\LNumber|\PhpParser\Node\Scalar\DNumber $node + * @param \PhpParser\Node\Scalar\Int_|\PhpParser\Node\Scalar\Float_ $node * @param mixed $rawValue */ private function shouldSkip($node, $rawValue) : bool @@ -129,7 +126,7 @@ CODE_SAMPLE return \true; } $kind = $node->getAttribute(AttributeKey::KIND); - if (\in_array($kind, [LNumber::KIND_BIN, LNumber::KIND_OCT, LNumber::KIND_HEX], \true)) { + if (\in_array($kind, [Int_::KIND_BIN, Int_::KIND_OCT, Int_::KIND_HEX], \true)) { return \true; } // e+/e- diff --git a/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php b/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php index af42c4ca5ae..6c7eeb6acd9 100644 --- a/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php +++ b/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php @@ -21,14 +21,12 @@ final class RestoreDefaultNullToNullableTypePropertyRector extends AbstractRecto { /** * @readonly - * @var \Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector */ - private $constructorAssignDetector; + private ConstructorAssignDetector $constructorAssignDetector; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(ConstructorAssignDetector $constructorAssignDetector, PhpDocInfoFactory $phpDocInfoFactory) { $this->constructorAssignDetector = $constructorAssignDetector; @@ -85,7 +83,7 @@ CODE_SAMPLE } private function shouldSkipProperty(Property $property, Class_ $class) : bool { - if ($property->type === null) { + if (!$property->type instanceof Node) { return \true; } if (\count($property->props) > 1) { diff --git a/rules/Php74/Rector/StaticCall/ExportToReflectionFunctionRector.php b/rules/Php74/Rector/StaticCall/ExportToReflectionFunctionRector.php index b8b6e6749da..9c0a371a17a 100644 --- a/rules/Php74/Rector/StaticCall/ExportToReflectionFunctionRector.php +++ b/rules/Php74/Rector/StaticCall/ExportToReflectionFunctionRector.php @@ -23,9 +23,8 @@ final class ExportToReflectionFunctionRector extends AbstractRector implements M { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/Php74/Rector/Ternary/ParenthesizeNestedTernaryRector.php b/rules/Php74/Rector/Ternary/ParenthesizeNestedTernaryRector.php index 9f06b71ba6d..ce51147efa1 100644 --- a/rules/Php74/Rector/Ternary/ParenthesizeNestedTernaryRector.php +++ b/rules/Php74/Rector/Ternary/ParenthesizeNestedTernaryRector.php @@ -19,9 +19,8 @@ final class ParenthesizeNestedTernaryRector extends AbstractRector implements Mi { /** * @readonly - * @var \Rector\Php74\Tokenizer\ParenthesizedNestedTernaryAnalyzer */ - private $parenthesizedNestedTernaryAnalyzer; + private ParenthesizedNestedTernaryAnalyzer $parenthesizedNestedTernaryAnalyzer; public function __construct(ParenthesizedNestedTernaryAnalyzer $parenthesizedNestedTernaryAnalyzer) { $this->parenthesizedNestedTernaryAnalyzer = $parenthesizedNestedTernaryAnalyzer; @@ -57,7 +56,7 @@ CODE_SAMPLE return null; } // re-print with brackets - $node->setAttribute(AttributeKey::ORIGINAL_NODE, null); + $node->cond->setAttribute(AttributeKey::ORIGINAL_NODE, null); return $node; } return null; diff --git a/rules/Php74/Tokenizer/ParenthesizedNestedTernaryAnalyzer.php b/rules/Php74/Tokenizer/ParenthesizedNestedTernaryAnalyzer.php index 4aec8953c64..4ea9e6f299b 100644 --- a/rules/Php74/Tokenizer/ParenthesizedNestedTernaryAnalyzer.php +++ b/rules/Php74/Tokenizer/ParenthesizedNestedTernaryAnalyzer.php @@ -12,8 +12,8 @@ final class ParenthesizedNestedTernaryAnalyzer $oldTokens = $file->getOldTokens(); $startTokenPos = $ternary->getStartTokenPos(); $endTokenPos = $ternary->getEndTokenPos(); - $hasOpenParentheses = isset($oldTokens[$startTokenPos]) && $oldTokens[$startTokenPos] === '('; - $hasCloseParentheses = isset($oldTokens[$endTokenPos]) && $oldTokens[$endTokenPos] === ')'; + $hasOpenParentheses = isset($oldTokens[$startTokenPos]) && (string) $oldTokens[$startTokenPos] === '('; + $hasCloseParentheses = isset($oldTokens[$endTokenPos]) && (string) $oldTokens[$endTokenPos] === ')'; return $hasOpenParentheses || $hasCloseParentheses; } } diff --git a/rules/Php80/DocBlock/PropertyPromotionDocBlockMerger.php b/rules/Php80/DocBlock/PropertyPromotionDocBlockMerger.php index c1bd7039086..05426014699 100644 --- a/rules/Php80/DocBlock/PropertyPromotionDocBlockMerger.php +++ b/rules/Php80/DocBlock/PropertyPromotionDocBlockMerger.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Php80\DocBlock; +use PhpParser\Node; use PhpParser\Comment; use PhpParser\Node\Param; use PhpParser\Node\Stmt\ClassMethod; @@ -20,34 +21,28 @@ final class PropertyPromotionDocBlockMerger { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover */ - private $varTagRemover; + private VarTagRemover $varTagRemover; /** * @readonly - * @var \Rector\BetterPhpDocParser\Printer\PhpDocInfoPrinter */ - private $phpDocInfoPrinter; + private PhpDocInfoPrinter $phpDocInfoPrinter; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper, PhpDocTypeChanger $phpDocTypeChanger, VarTagRemover $varTagRemover, PhpDocInfoPrinter $phpDocInfoPrinter, DocBlockUpdater $docBlockUpdater) { $this->phpDocInfoFactory = $phpDocInfoFactory; @@ -79,7 +74,7 @@ final class PropertyPromotionDocBlockMerger $propertyPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property); $param->setAttribute(AttributeKey::PHP_DOC_INFO, $propertyPhpDocInfo); // make sure the docblock is useful - if ($param->type === null) { + if (!$param->type instanceof Node) { $varTagValueNode = $propertyPhpDocInfo->getVarTagValueNode(); if (!$varTagValueNode instanceof VarTagValueNode) { return; @@ -98,8 +93,6 @@ final class PropertyPromotionDocBlockMerger */ private function removeEmptyComments(array $mergedComments) : array { - return \array_filter($mergedComments, static function (Comment $comment) : bool { - return $comment->getText() !== ''; - }); + return \array_filter($mergedComments, static fn(Comment $comment): bool => $comment->getText() !== ''); } } diff --git a/rules/Php80/Guard/MakePropertyPromotionGuard.php b/rules/Php80/Guard/MakePropertyPromotionGuard.php index d4624ad4adf..535020fb3f6 100644 --- a/rules/Php80/Guard/MakePropertyPromotionGuard.php +++ b/rules/Php80/Guard/MakePropertyPromotionGuard.php @@ -13,9 +13,8 @@ final class MakePropertyPromotionGuard { /** * @readonly - * @var \Rector\Php74\Guard\PropertyTypeChangeGuard */ - private $propertyTypeChangeGuard; + private PropertyTypeChangeGuard $propertyTypeChangeGuard; public function __construct(PropertyTypeChangeGuard $propertyTypeChangeGuard) { $this->propertyTypeChangeGuard = $propertyTypeChangeGuard; diff --git a/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrncmpMatchAndRefactor.php b/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrncmpMatchAndRefactor.php index 672353085dc..02146606f2e 100644 --- a/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrncmpMatchAndRefactor.php +++ b/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrncmpMatchAndRefactor.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\Php80\MatchAndRefactor\StrStartsWithMatchAndRefactor; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Expr\BinaryOp\Equal; use PhpParser\Node\Expr\BinaryOp\Identical; use PhpParser\Node\Expr\BinaryOp\NotEqual; use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\FuncCall; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use Rector\NodeNameResolver\NodeNameResolver; use Rector\Php80\Contract\StrStartWithMatchAndRefactorInterface; @@ -21,24 +21,20 @@ final class StrncmpMatchAndRefactor implements StrStartWithMatchAndRefactorInter { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Php80\ValueObjectFactory\StrStartsWithFactory */ - private $strStartsWithFactory; + private StrStartsWithFactory $strStartsWithFactory; /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; /** * @readonly - * @var \Rector\Php80\NodeFactory\StrStartsWithFuncCallFactory */ - private $strStartsWithFuncCallFactory; + private StrStartsWithFuncCallFactory $strStartsWithFuncCallFactory; /** * @var string */ @@ -110,7 +106,7 @@ final class StrncmpMatchAndRefactor implements StrStartWithMatchAndRefactorInter return \false; } $lNumberLength = $strncmpFuncCall->getArgs()[2]->value; - if (!$lNumberLength instanceof LNumber) { + if (!$lNumberLength instanceof Int_) { return \false; } return $lNumberLength->value === \strlen($hardcodedStringNeedle->value); diff --git a/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrposMatchAndRefactor.php b/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrposMatchAndRefactor.php index db064efe6ff..bb8080c6718 100644 --- a/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrposMatchAndRefactor.php +++ b/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/StrposMatchAndRefactor.php @@ -21,19 +21,16 @@ final class StrposMatchAndRefactor implements StrStartWithMatchAndRefactorInterf { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\Php80\NodeFactory\StrStartsWithFuncCallFactory */ - private $strStartsWithFuncCallFactory; + private StrStartsWithFuncCallFactory $strStartsWithFuncCallFactory; public function __construct(NodeNameResolver $nodeNameResolver, ValueResolver $valueResolver, StrStartsWithFuncCallFactory $strStartsWithFuncCallFactory) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/SubstrMatchAndRefactor.php b/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/SubstrMatchAndRefactor.php index 16ac46d2bac..2a5c78b9970 100644 --- a/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/SubstrMatchAndRefactor.php +++ b/rules/Php80/MatchAndRefactor/StrStartsWithMatchAndRefactor/SubstrMatchAndRefactor.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\Php80\MatchAndRefactor\StrStartsWithMatchAndRefactor; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Expr\BinaryOp\Equal; use PhpParser\Node\Expr\BinaryOp\Identical; use PhpParser\Node\Expr\BinaryOp\NotEqual; use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\FuncCall; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use Rector\NodeNameResolver\NodeNameResolver; use Rector\Php80\Contract\StrStartWithMatchAndRefactorInterface; @@ -21,24 +21,20 @@ final class SubstrMatchAndRefactor implements StrStartWithMatchAndRefactorInterf { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; /** * @readonly - * @var \Rector\Php80\NodeFactory\StrStartsWithFuncCallFactory */ - private $strStartsWithFuncCallFactory; + private StrStartsWithFuncCallFactory $strStartsWithFuncCallFactory; public function __construct(NodeNameResolver $nodeNameResolver, ValueResolver $valueResolver, NodeComparator $nodeComparator, StrStartsWithFuncCallFactory $strStartsWithFuncCallFactory) { $this->nodeNameResolver = $nodeNameResolver; @@ -116,7 +112,7 @@ final class SubstrMatchAndRefactor implements StrStartWithMatchAndRefactorInterf return \false; } $lNumberLength = $substrFuncCall->getArgs()[2]->value; - if (!$lNumberLength instanceof LNumber) { + if (!$lNumberLength instanceof Int_) { return \false; } return $lNumberLength->value === \strlen($expr->value); diff --git a/rules/Php80/NodeAnalyzer/MatchSwitchAnalyzer.php b/rules/Php80/NodeAnalyzer/MatchSwitchAnalyzer.php index 398792a9de1..a660a90002e 100644 --- a/rules/Php80/NodeAnalyzer/MatchSwitchAnalyzer.php +++ b/rules/Php80/NodeAnalyzer/MatchSwitchAnalyzer.php @@ -8,11 +8,11 @@ use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\Match_; +use PhpParser\Node\Expr\Throw_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Return_; use PhpParser\Node\Stmt\Switch_; -use PhpParser\Node\Stmt\Throw_; use Rector\NodeNameResolver\NodeNameResolver; use Rector\Php80\Enum\MatchKind; use Rector\Php80\ValueObject\CondAndExpr; @@ -22,24 +22,20 @@ final class MatchSwitchAnalyzer { /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\SwitchAnalyzer */ - private $switchAnalyzer; + private \Rector\Php80\NodeAnalyzer\SwitchAnalyzer $switchAnalyzer; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; public function __construct(\Rector\Php80\NodeAnalyzer\SwitchAnalyzer $switchAnalyzer, NodeNameResolver $nodeNameResolver, NodeComparator $nodeComparator, BetterStandardPrinter $betterStandardPrinter) { $this->switchAnalyzer = $switchAnalyzer; @@ -83,7 +79,7 @@ final class MatchSwitchAnalyzer if ($this->isNextStmtReturnWithExpr($switch, $nextStmt)) { return \false; } - return !$nextStmt instanceof Throw_; + return !($nextStmt instanceof Expression && $nextStmt->expr instanceof Throw_); } /** * @param CondAndExpr[] $condAndExprs @@ -158,9 +154,7 @@ final class MatchSwitchAnalyzer } foreach ($switch->cases as $case) { /** @var Expression[] $expressions */ - $expressions = \array_filter($case->stmts, static function (Node $node) : bool { - return $node instanceof Expression; - }); + $expressions = \array_filter($case->stmts, static fn(Node $node): bool => $node instanceof Expression); foreach ($expressions as $expression) { if (!$expression->expr instanceof Assign) { continue; diff --git a/rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php b/rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php index 4daa42508f3..a3cd6fe2ed4 100644 --- a/rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php +++ b/rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php @@ -6,7 +6,7 @@ namespace Rector\Php80\NodeAnalyzer; use PhpParser\Node\Arg; use PhpParser\Node\AttributeGroup; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Param; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_; @@ -21,14 +21,12 @@ final class PhpAttributeAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Php80/NodeAnalyzer/PromotedPropertyCandidateResolver.php b/rules/Php80/NodeAnalyzer/PromotedPropertyCandidateResolver.php index 1f292c13d1a..6cb466fd1ea 100644 --- a/rules/Php80/NodeAnalyzer/PromotedPropertyCandidateResolver.php +++ b/rules/Php80/NodeAnalyzer/PromotedPropertyCandidateResolver.php @@ -21,24 +21,20 @@ final class PromotedPropertyCandidateResolver { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; public function __construct(NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder, NodeComparator $nodeComparator, PropertyFetchAnalyzer $propertyFetchAnalyzer) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Php80/NodeAnalyzer/SwitchAnalyzer.php b/rules/Php80/NodeAnalyzer/SwitchAnalyzer.php index 2c051047710..09b178a1a77 100644 --- a/rules/Php80/NodeAnalyzer/SwitchAnalyzer.php +++ b/rules/Php80/NodeAnalyzer/SwitchAnalyzer.php @@ -16,14 +16,12 @@ final class SwitchAnalyzer { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; public function __construct(NodeTypeResolver $nodeTypeResolver, TypeFactory $typeFactory) { $this->nodeTypeResolver = $nodeTypeResolver; @@ -76,9 +74,7 @@ final class SwitchAnalyzer if (!$case->cond instanceof Expr) { continue; } - $stmtsWithoutBreak = \array_filter($case->stmts, static function (Node $node) : bool { - return !$node instanceof Break_; - }); + $stmtsWithoutBreak = \array_filter($case->stmts, static fn(Node $node): bool => !$node instanceof Break_); if (\count($stmtsWithoutBreak) !== 1) { return \false; } @@ -89,9 +85,7 @@ final class SwitchAnalyzer { foreach ($switch->cases as $case) { if (!$case->cond instanceof Expr) { - $stmtsWithoutBreak = \array_filter($case->stmts, static function (Node $node) : bool { - return !$node instanceof Break_; - }); + $stmtsWithoutBreak = \array_filter($case->stmts, static fn(Node $node): bool => !$node instanceof Break_); return \count($stmtsWithoutBreak) === 1; } } diff --git a/rules/Php80/NodeFactory/AttrGroupsFactory.php b/rules/Php80/NodeFactory/AttrGroupsFactory.php index 5825b6aa92f..eb045493f77 100644 --- a/rules/Php80/NodeFactory/AttrGroupsFactory.php +++ b/rules/Php80/NodeFactory/AttrGroupsFactory.php @@ -11,9 +11,8 @@ final class AttrGroupsFactory { /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; public function __construct(PhpAttributeGroupFactory $phpAttributeGroupFactory) { $this->phpAttributeGroupFactory = $phpAttributeGroupFactory; diff --git a/rules/Php80/NodeFactory/MatchFactory.php b/rules/Php80/NodeFactory/MatchFactory.php index b7d532d2eb8..c01cd8a0a5f 100644 --- a/rules/Php80/NodeFactory/MatchFactory.php +++ b/rules/Php80/NodeFactory/MatchFactory.php @@ -9,8 +9,8 @@ use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\Match_; use PhpParser\Node\Expr\Throw_; use PhpParser\Node\Stmt; +use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Return_; -use PhpParser\Node\Stmt\Throw_ as ThrowsStmt; use Rector\Php80\Enum\MatchKind; use Rector\Php80\NodeAnalyzer\MatchSwitchAnalyzer; use Rector\Php80\ValueObject\CondAndExpr; @@ -20,19 +20,16 @@ final class MatchFactory { /** * @readonly - * @var \Rector\Php80\NodeFactory\MatchArmsFactory */ - private $matchArmsFactory; + private \Rector\Php80\NodeFactory\MatchArmsFactory $matchArmsFactory; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\MatchSwitchAnalyzer */ - private $matchSwitchAnalyzer; + private MatchSwitchAnalyzer $matchSwitchAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; public function __construct(\Rector\Php80\NodeFactory\MatchArmsFactory $matchArmsFactory, MatchSwitchAnalyzer $matchSwitchAnalyzer, NodeComparator $nodeComparator) { $this->matchArmsFactory = $matchArmsFactory; @@ -48,8 +45,8 @@ final class MatchFactory // is default value missing? maybe it can be found in next stmt if (!$this->matchSwitchAnalyzer->hasCondsAndExprDefaultValue($condAndExprs)) { // 1. is followed by throws stmts? - if ($nextStmt instanceof ThrowsStmt) { - $throw = new Throw_($nextStmt->expr); + if ($nextStmt instanceof Expression && $nextStmt->expr instanceof Throw_) { + $throw = $nextStmt->expr; $condAndExprs[] = new CondAndExpr([], $throw, MatchKind::RETURN); $shouldRemoteNextStmt = \true; } diff --git a/rules/Php80/NodeFactory/NestedAttrGroupsFactory.php b/rules/Php80/NodeFactory/NestedAttrGroupsFactory.php index 8c391ae5aab..a2a1bdf4f01 100644 --- a/rules/Php80/NodeFactory/NestedAttrGroupsFactory.php +++ b/rules/Php80/NodeFactory/NestedAttrGroupsFactory.php @@ -11,9 +11,8 @@ final class NestedAttrGroupsFactory { /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpNestedAttributeGroupFactory */ - private $phpNestedAttributeGroupFactory; + private PhpNestedAttributeGroupFactory $phpNestedAttributeGroupFactory; public function __construct(PhpNestedAttributeGroupFactory $phpNestedAttributeGroupFactory) { $this->phpNestedAttributeGroupFactory = $phpNestedAttributeGroupFactory; diff --git a/rules/Php80/NodeManipulator/AttributeGroupNamedArgumentManipulator.php b/rules/Php80/NodeManipulator/AttributeGroupNamedArgumentManipulator.php index 7d0af054979..b93de8fd215 100644 --- a/rules/Php80/NodeManipulator/AttributeGroupNamedArgumentManipulator.php +++ b/rules/Php80/NodeManipulator/AttributeGroupNamedArgumentManipulator.php @@ -12,7 +12,7 @@ final class AttributeGroupNamedArgumentManipulator * @var ConverterAttributeDecoratorInterface[] * @readonly */ - private $converterAttributeDecorators; + private array $converterAttributeDecorators; /** * @param ConverterAttributeDecoratorInterface[] $converterAttributeDecorators */ diff --git a/rules/Php80/NodeResolver/SwitchExprsResolver.php b/rules/Php80/NodeResolver/SwitchExprsResolver.php index 858944c031e..63ebdc6b134 100644 --- a/rules/Php80/NodeResolver/SwitchExprsResolver.php +++ b/rules/Php80/NodeResolver/SwitchExprsResolver.php @@ -5,12 +5,12 @@ namespace Rector\Php80\NodeResolver; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Assign; +use PhpParser\Node\Expr\Throw_; use PhpParser\Node\Stmt\Break_; use PhpParser\Node\Stmt\Case_; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Return_; use PhpParser\Node\Stmt\Switch_; -use PhpParser\Node\Stmt\Throw_; use Rector\Php80\Enum\MatchKind; use Rector\Php80\ValueObject\CondAndExpr; final class SwitchExprsResolver @@ -57,7 +57,9 @@ final class SwitchExprsResolver $condExprs = $emptyCasesCond; $condExprs[] = $case->cond; } - if ($expr instanceof Return_) { + if ($expr instanceof Throw_) { + $condAndExpr[] = new CondAndExpr($condExprs, $expr, MatchKind::THROW); + } elseif ($expr instanceof Return_) { $returnedExpr = $expr->expr; if (!$returnedExpr instanceof Expr) { return []; @@ -67,9 +69,6 @@ final class SwitchExprsResolver $condAndExpr[] = new CondAndExpr($condExprs, $expr, MatchKind::ASSIGN); } elseif ($expr instanceof Expr) { $condAndExpr[] = new CondAndExpr($condExprs, $expr, MatchKind::NORMAL); - } elseif ($expr instanceof Throw_) { - $throwExpr = new Expr\Throw_($expr->expr); - $condAndExpr[] = new CondAndExpr($condExprs, $throwExpr, MatchKind::THROW); } else { return []; } diff --git a/rules/Php80/Rector/Catch_/RemoveUnusedVariableInCatchRector.php b/rules/Php80/Rector/Catch_/RemoveUnusedVariableInCatchRector.php index f7cf1be4fb9..d55f35a7e8d 100644 --- a/rules/Php80/Rector/Catch_/RemoveUnusedVariableInCatchRector.php +++ b/rules/Php80/Rector/Catch_/RemoveUnusedVariableInCatchRector.php @@ -22,19 +22,16 @@ final class RemoveUnusedVariableInCatchRector extends AbstractRector implements { /** * @readonly - * @var \Rector\NodeManipulator\StmtsManipulator */ - private $stmtsManipulator; + private StmtsManipulator $stmtsManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\DeadCode\NodeAnalyzer\ExprUsedInNodeAnalyzer */ - private $exprUsedInNodeAnalyzer; + private ExprUsedInNodeAnalyzer $exprUsedInNodeAnalyzer; public function __construct(StmtsManipulator $stmtsManipulator, BetterNodeFinder $betterNodeFinder, ExprUsedInNodeAnalyzer $exprUsedInNodeAnalyzer) { $this->stmtsManipulator = $stmtsManipulator; @@ -94,9 +91,7 @@ CODE_SAMPLE } /** @var string $variableName */ $variableName = $this->getName($caughtVar); - $isFoundInCatchStmts = (bool) $this->betterNodeFinder->findFirst($catch->stmts, function (Node $subNode) use($caughtVar) : bool { - return $this->exprUsedInNodeAnalyzer->isUsed($subNode, $caughtVar); - }); + $isFoundInCatchStmts = (bool) $this->betterNodeFinder->findFirst($catch->stmts, fn(Node $subNode): bool => $this->exprUsedInNodeAnalyzer->isUsed($subNode, $caughtVar)); if ($isFoundInCatchStmts) { continue; } diff --git a/rules/Php80/Rector/ClassMethod/AddParamBasedOnParentClassMethodRector.php b/rules/Php80/Rector/ClassMethod/AddParamBasedOnParentClassMethodRector.php index 0eeafe72a91..751d3c2ac41 100644 --- a/rules/Php80/Rector/ClassMethod/AddParamBasedOnParentClassMethodRector.php +++ b/rules/Php80/Rector/ClassMethod/AddParamBasedOnParentClassMethodRector.php @@ -33,29 +33,24 @@ final class AddParamBasedOnParentClassMethodRector extends AbstractRector implem { /** * @readonly - * @var \Rector\VendorLocker\ParentClassMethodTypeOverrideGuard */ - private $parentClassMethodTypeOverrideGuard; + private ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard, AstResolver $astResolver, BetterStandardPrinter $betterStandardPrinter, BetterNodeFinder $betterNodeFinder, ReflectionResolver $reflectionResolver) { $this->parentClassMethodTypeOverrideGuard = $parentClassMethodTypeOverrideGuard; @@ -216,7 +211,7 @@ CODE_SAMPLE */ private function resolveParamType(Param $param) { - if ($param->type === null) { + if (!$param->type instanceof Node) { return null; } return $this->nodeFactory->createReprintedNode($param->type); diff --git a/rules/Php80/Rector/ClassMethod/FinalPrivateToPrivateVisibilityRector.php b/rules/Php80/Rector/ClassMethod/FinalPrivateToPrivateVisibilityRector.php index 8b81738d5bd..2e0bd724f80 100644 --- a/rules/Php80/Rector/ClassMethod/FinalPrivateToPrivateVisibilityRector.php +++ b/rules/Php80/Rector/ClassMethod/FinalPrivateToPrivateVisibilityRector.php @@ -19,9 +19,8 @@ final class FinalPrivateToPrivateVisibilityRector extends AbstractRector impleme { /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; public function __construct(VisibilityManipulator $visibilityManipulator) { $this->visibilityManipulator = $visibilityManipulator; diff --git a/rules/Php80/Rector/ClassMethod/SetStateToStaticRector.php b/rules/Php80/Rector/ClassMethod/SetStateToStaticRector.php index edcbee9df5e..fe7c5703fb9 100644 --- a/rules/Php80/Rector/ClassMethod/SetStateToStaticRector.php +++ b/rules/Php80/Rector/ClassMethod/SetStateToStaticRector.php @@ -19,9 +19,8 @@ final class SetStateToStaticRector extends AbstractRector implements MinPhpVersi { /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; public function __construct(VisibilityManipulator $visibilityManipulator) { $this->visibilityManipulator = $visibilityManipulator; diff --git a/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php b/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php index 2406a14e286..47aa31c89da 100644 --- a/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php +++ b/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php @@ -46,48 +46,40 @@ final class AnnotationToAttributeRector extends AbstractRector implements Config { /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \Rector\Php80\NodeFactory\AttrGroupsFactory */ - private $attrGroupsFactory; + private AttrGroupsFactory $attrGroupsFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Php80\NodeManipulator\AttributeGroupNamedArgumentManipulator */ - private $attributeGroupNamedArgumentManipulator; + private AttributeGroupNamedArgumentManipulator $attributeGroupNamedArgumentManipulator; /** * @readonly - * @var \Rector\Naming\Naming\UseImportsResolver */ - private $useImportsResolver; + private UseImportsResolver $useImportsResolver; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var AnnotationToAttribute[] */ - private $annotationsToAttributes = []; + private array $annotationsToAttributes = []; public function __construct(PhpAttributeGroupFactory $phpAttributeGroupFactory, AttrGroupsFactory $attrGroupsFactory, PhpDocTagRemover $phpDocTagRemover, AttributeGroupNamedArgumentManipulator $attributeGroupNamedArgumentManipulator, UseImportsResolver $useImportsResolver, PhpAttributeAnalyzer $phpAttributeAnalyzer, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->phpAttributeGroupFactory = $phpAttributeGroupFactory; diff --git a/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php b/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php index 813bbd3815c..09855167e11 100644 --- a/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php +++ b/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php @@ -44,54 +44,44 @@ final class ClassPropertyAssignToConstructorPromotionRector extends AbstractRect { /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PromotedPropertyCandidateResolver */ - private $promotedPropertyCandidateResolver; + private PromotedPropertyCandidateResolver $promotedPropertyCandidateResolver; /** * @readonly - * @var \Rector\Naming\VariableRenamer */ - private $variableRenamer; + private VariableRenamer $variableRenamer; /** * @readonly - * @var \Rector\NodeAnalyzer\ParamAnalyzer */ - private $paramAnalyzer; + private ParamAnalyzer $paramAnalyzer; /** * @readonly - * @var \Rector\Php80\DocBlock\PropertyPromotionDocBlockMerger */ - private $propertyPromotionDocBlockMerger; + private PropertyPromotionDocBlockMerger $propertyPromotionDocBlockMerger; /** * @readonly - * @var \Rector\Php80\Guard\MakePropertyPromotionGuard */ - private $makePropertyPromotionGuard; + private MakePropertyPromotionGuard $makePropertyPromotionGuard; /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\Naming\PropertyRenamer\PropertyPromotionRenamer */ - private $propertyPromotionRenamer; + private PropertyPromotionRenamer $propertyPromotionRenamer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @api * @var string @@ -109,14 +99,12 @@ final class ClassPropertyAssignToConstructorPromotionRector extends AbstractRect * - protected/public modifier property when property typed * * Set to true will allow change whether property is typed or not as far as not forbidden, eg: callable type, null type, etc. - * @var bool */ - private $inlinePublic = \false; + private bool $inlinePublic = \false; /** * Set to false will skip property promotion when parameter and property have different names. - * @var bool */ - private $renameProperty = \true; + private bool $renameProperty = \true; public function __construct(PromotedPropertyCandidateResolver $promotedPropertyCandidateResolver, VariableRenamer $variableRenamer, ParamAnalyzer $paramAnalyzer, PropertyPromotionDocBlockMerger $propertyPromotionDocBlockMerger, MakePropertyPromotionGuard $makePropertyPromotionGuard, TypeComparator $typeComparator, ReflectionResolver $reflectionResolver, PropertyPromotionRenamer $propertyPromotionRenamer, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper) { $this->promotedPropertyCandidateResolver = $promotedPropertyCandidateResolver; diff --git a/rules/Php80/Rector/Class_/StringableForToStringRector.php b/rules/Php80/Rector/Class_/StringableForToStringRector.php index b76df8908ba..fc211649b4c 100644 --- a/rules/Php80/Rector/Class_/StringableForToStringRector.php +++ b/rules/Php80/Rector/Class_/StringableForToStringRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Php80\Rector\Class_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Cast\String_ as CastString_; @@ -14,7 +15,6 @@ use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Return_; -use PhpParser\NodeTraverser; use Rector\FamilyTree\Reflection\FamilyRelationsAnalyzer; use Rector\NodeAnalyzer\ClassAnalyzer; use Rector\PhpParser\Node\BetterNodeFinder; @@ -32,32 +32,25 @@ final class StringableForToStringRector extends AbstractRector implements MinPhp { /** * @readonly - * @var \Rector\FamilyTree\Reflection\FamilyRelationsAnalyzer */ - private $familyRelationsAnalyzer; + private FamilyRelationsAnalyzer $familyRelationsAnalyzer; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @var string */ private const STRINGABLE = 'Stringable'; - /** - * @var bool - */ - private $hasChanged = \false; + private bool $hasChanged = \false; public function __construct(FamilyRelationsAnalyzer $familyRelationsAnalyzer, ReturnTypeInferer $returnTypeInferer, ClassAnalyzer $classAnalyzer, BetterNodeFinder $betterNodeFinder) { $this->familyRelationsAnalyzer = $familyRelationsAnalyzer; @@ -125,7 +118,7 @@ CODE_SAMPLE $this->hasChanged = \true; } // add return type - if ($toStringClassMethod->returnType === null) { + if (!$toStringClassMethod->returnType instanceof Node) { $toStringClassMethod->returnType = new Identifier('string'); $this->hasChanged = \true; } @@ -148,7 +141,7 @@ CODE_SAMPLE } $this->traverseNodesWithCallable((array) $toStringClassMethod->stmts, function (Node $subNode) : ?int { if ($subNode instanceof Class_ || $subNode instanceof Function_ || $subNode instanceof Closure) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$subNode instanceof Return_) { return null; diff --git a/rules/Php80/Rector/FunctionLike/MixedTypeRector.php b/rules/Php80/Rector/FunctionLike/MixedTypeRector.php index 42f836e4e9d..e5e63ea29fb 100644 --- a/rules/Php80/Rector/FunctionLike/MixedTypeRector.php +++ b/rules/Php80/Rector/FunctionLike/MixedTypeRector.php @@ -31,28 +31,21 @@ final class MixedTypeRector extends AbstractRector implements MinPhpVersionInter { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\FamilyTree\NodeAnalyzer\ClassChildAnalyzer */ - private $classChildAnalyzer; + private ClassChildAnalyzer $classChildAnalyzer; /** * @readonly - * @var \Rector\DeadCode\PhpDoc\TagRemover\ParamTagRemover */ - private $paramTagRemover; + private ParamTagRemover $paramTagRemover; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; - /** - * @var bool - */ - private $hasChanged = \false; + private PhpDocInfoFactory $phpDocInfoFactory; + private bool $hasChanged = \false; public function __construct(ReflectionResolver $reflectionResolver, ClassChildAnalyzer $classChildAnalyzer, ParamTagRemover $paramTagRemover, PhpDocInfoFactory $phpDocInfoFactory) { $this->reflectionResolver = $reflectionResolver; diff --git a/rules/Php80/Rector/Identical/StrEndsWithRector.php b/rules/Php80/Rector/Identical/StrEndsWithRector.php index 7da26114491..81c3518988d 100644 --- a/rules/Php80/Rector/Identical/StrEndsWithRector.php +++ b/rules/Php80/Rector/Identical/StrEndsWithRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Php80\Rector\Identical; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; @@ -14,7 +15,6 @@ use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\BooleanNot; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\UnaryMinus; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use Rector\NodeAnalyzer\BinaryOpAnalyzer; use Rector\PhpParser\Node\Value\ValueResolver; @@ -33,14 +33,12 @@ final class StrEndsWithRector extends AbstractRector implements MinPhpVersionInt { /** * @readonly - * @var \Rector\NodeAnalyzer\BinaryOpAnalyzer */ - private $binaryOpAnalyzer; + private BinaryOpAnalyzer $binaryOpAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(BinaryOpAnalyzer $binaryOpAnalyzer, ValueResolver $valueResolver) { $this->binaryOpAnalyzer = $binaryOpAnalyzer; @@ -204,7 +202,7 @@ CODE_SAMPLE if (!$substrOffset instanceof UnaryMinus) { return \false; } - if (!$substrOffset->expr instanceof LNumber) { + if (!$substrOffset->expr instanceof Int_) { return \false; } $lNumber = $substrOffset->expr; diff --git a/rules/Php80/Rector/Identical/StrStartsWithRector.php b/rules/Php80/Rector/Identical/StrStartsWithRector.php index 4aafdb0ca29..ea4386c6c49 100644 --- a/rules/Php80/Rector/Identical/StrStartsWithRector.php +++ b/rules/Php80/Rector/Identical/StrStartsWithRector.php @@ -28,7 +28,7 @@ final class StrStartsWithRector extends AbstractRector implements MinPhpVersionI /** * @var StrStartWithMatchAndRefactorInterface[] */ - private $strStartWithMatchAndRefactors = []; + private array $strStartWithMatchAndRefactors = []; public function __construct(StrncmpMatchAndRefactor $strncmpMatchAndRefactor, SubstrMatchAndRefactor $substrMatchAndRefactor, StrposMatchAndRefactor $strposMatchAndRefactor) { $this->strStartWithMatchAndRefactors = [$strncmpMatchAndRefactor, $substrMatchAndRefactor, $strposMatchAndRefactor]; diff --git a/rules/Php80/Rector/NotIdentical/StrContainsRector.php b/rules/Php80/Rector/NotIdentical/StrContainsRector.php index 274a590beec..cd6a138c4af 100644 --- a/rules/Php80/Rector/NotIdentical/StrContainsRector.php +++ b/rules/Php80/Rector/NotIdentical/StrContainsRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Php80\Rector\NotIdentical; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; @@ -13,7 +14,6 @@ use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\BooleanNot; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; use Rector\PhpParser\Node\Value\ValueResolver; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersionFeature; @@ -29,9 +29,8 @@ final class StrContainsRector extends AbstractRector implements MinPhpVersionInt { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var string[] */ @@ -133,7 +132,7 @@ CODE_SAMPLE } private function isIntegerZero(Expr $expr) : bool { - if (!$expr instanceof LNumber) { + if (!$expr instanceof Int_) { return \false; } return $expr->value === 0; diff --git a/rules/Php80/Rector/Property/NestedAnnotationToAttributeRector.php b/rules/Php80/Rector/Property/NestedAnnotationToAttributeRector.php index fc2dae064f7..9e0e45eaae0 100644 --- a/rules/Php80/Rector/Property/NestedAnnotationToAttributeRector.php +++ b/rules/Php80/Rector/Property/NestedAnnotationToAttributeRector.php @@ -38,38 +38,32 @@ final class NestedAnnotationToAttributeRector extends AbstractRector implements { /** * @readonly - * @var \Rector\Naming\Naming\UseImportsResolver */ - private $useImportsResolver; + private UseImportsResolver $useImportsResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Php80\NodeFactory\NestedAttrGroupsFactory */ - private $nestedAttrGroupsFactory; + private NestedAttrGroupsFactory $nestedAttrGroupsFactory; /** * @readonly - * @var \Rector\PostRector\Collector\UseNodesToAddCollector */ - private $useNodesToAddCollector; + private UseNodesToAddCollector $useNodesToAddCollector; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var NestedAnnotationToAttribute[] */ - private $nestedAnnotationsToAttributes = []; + private array $nestedAnnotationsToAttributes = []; public function __construct(UseImportsResolver $useImportsResolver, PhpDocTagRemover $phpDocTagRemover, NestedAttrGroupsFactory $nestedAttrGroupsFactory, UseNodesToAddCollector $useNodesToAddCollector, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->useImportsResolver = $useImportsResolver; diff --git a/rules/Php80/Rector/Switch_/ChangeSwitchToMatchRector.php b/rules/Php80/Rector/Switch_/ChangeSwitchToMatchRector.php index 5b3a489c040..5691cdb352a 100644 --- a/rules/Php80/Rector/Switch_/ChangeSwitchToMatchRector.php +++ b/rules/Php80/Rector/Switch_/ChangeSwitchToMatchRector.php @@ -32,19 +32,16 @@ final class ChangeSwitchToMatchRector extends AbstractRector implements MinPhpVe { /** * @readonly - * @var \Rector\Php80\NodeResolver\SwitchExprsResolver */ - private $switchExprsResolver; + private SwitchExprsResolver $switchExprsResolver; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\MatchSwitchAnalyzer */ - private $matchSwitchAnalyzer; + private MatchSwitchAnalyzer $matchSwitchAnalyzer; /** * @readonly - * @var \Rector\Php80\NodeFactory\MatchFactory */ - private $matchFactory; + private MatchFactory $matchFactory; public function __construct(SwitchExprsResolver $switchExprsResolver, MatchSwitchAnalyzer $matchSwitchAnalyzer, MatchFactory $matchFactory) { $this->switchExprsResolver = $switchExprsResolver; @@ -141,6 +138,12 @@ CODE_SAMPLE if (!$hasDefaultValue) { continue; } + foreach ($match->arms as $arm) { + if ($arm->conds === null) { + continue; + } + $arm->conds = \array_values($arm->conds); + } $node->stmts[$key] = $isReturn ? new Return_($match) : new Expression($match); $this->mirrorComments($node->stmts[$key], $stmt); $hasChanged = \true; diff --git a/rules/Php80/ValueObject/AnnotationPropertyToAttributeClass.php b/rules/Php80/ValueObject/AnnotationPropertyToAttributeClass.php index 856ac834cd0..faec5fe4855 100644 --- a/rules/Php80/ValueObject/AnnotationPropertyToAttributeClass.php +++ b/rules/Php80/ValueObject/AnnotationPropertyToAttributeClass.php @@ -8,9 +8,8 @@ final class AnnotationPropertyToAttributeClass { /** * @readonly - * @var string */ - private $attributeClass; + private string $attributeClass; /** * @readonly * @var int|string|null @@ -18,9 +17,8 @@ final class AnnotationPropertyToAttributeClass private $annotationProperty = null; /** * @readonly - * @var bool */ - private $doesNeedNewImport = \false; + private bool $doesNeedNewImport = \false; /** * @param string|int|null $annotationProperty */ diff --git a/rules/Php80/ValueObject/AnnotationToAttribute.php b/rules/Php80/ValueObject/AnnotationToAttribute.php index c5343030850..ab0a4952e2f 100644 --- a/rules/Php80/ValueObject/AnnotationToAttribute.php +++ b/rules/Php80/ValueObject/AnnotationToAttribute.php @@ -10,19 +10,17 @@ final class AnnotationToAttribute implements AnnotationToAttributeInterface { /** * @readonly - * @var string */ - private $tag; + private string $tag; /** * @readonly - * @var string|null */ - private $attributeClass; + private ?string $attributeClass = null; /** * @var string[] * @readonly */ - private $classReferenceFields = []; + private array $classReferenceFields = []; /** * @param string[] $classReferenceFields */ diff --git a/rules/Php80/ValueObject/CondAndExpr.php b/rules/Php80/ValueObject/CondAndExpr.php index 214e4da730f..17dbff6ce19 100644 --- a/rules/Php80/ValueObject/CondAndExpr.php +++ b/rules/Php80/ValueObject/CondAndExpr.php @@ -14,14 +14,13 @@ final class CondAndExpr private $condExprs; /** * @readonly - * @var \PhpParser\Node\Expr */ - private $expr; + private Expr $expr; /** * @var MatchKind::* * @readonly */ - private $matchKind; + private string $matchKind; /** * @param Expr[]|null $condExprs * @param MatchKind::* $matchKind diff --git a/rules/Php80/ValueObject/DoctrineTagAndAnnotationToAttribute.php b/rules/Php80/ValueObject/DoctrineTagAndAnnotationToAttribute.php index b65c78d15ca..7df25a0de02 100644 --- a/rules/Php80/ValueObject/DoctrineTagAndAnnotationToAttribute.php +++ b/rules/Php80/ValueObject/DoctrineTagAndAnnotationToAttribute.php @@ -8,14 +8,12 @@ final class DoctrineTagAndAnnotationToAttribute { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode */ - private $doctrineAnnotationTagValueNode; + private DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode; /** * @readonly - * @var \Rector\Php80\ValueObject\AnnotationToAttribute */ - private $annotationToAttribute; + private \Rector\Php80\ValueObject\AnnotationToAttribute $annotationToAttribute; public function __construct(DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode, \Rector\Php80\ValueObject\AnnotationToAttribute $annotationToAttribute) { $this->doctrineAnnotationTagValueNode = $doctrineAnnotationTagValueNode; diff --git a/rules/Php80/ValueObject/MatchResult.php b/rules/Php80/ValueObject/MatchResult.php index 9dfa1131bab..4f3ff80c53a 100644 --- a/rules/Php80/ValueObject/MatchResult.php +++ b/rules/Php80/ValueObject/MatchResult.php @@ -8,14 +8,12 @@ final class MatchResult { /** * @readonly - * @var \PhpParser\Node\Expr\Match_ */ - private $match; + private Match_ $match; /** * @readonly - * @var bool */ - private $shouldRemoveNextStmt; + private bool $shouldRemoveNextStmt; public function __construct(Match_ $match, bool $shouldRemoveNextStmt) { $this->match = $match; diff --git a/rules/Php80/ValueObject/NestedAnnotationToAttribute.php b/rules/Php80/ValueObject/NestedAnnotationToAttribute.php index de17df8607e..45e34e77330 100644 --- a/rules/Php80/ValueObject/NestedAnnotationToAttribute.php +++ b/rules/Php80/ValueObject/NestedAnnotationToAttribute.php @@ -9,18 +9,16 @@ final class NestedAnnotationToAttribute implements AnnotationToAttributeInterfac { /** * @readonly - * @var string */ - private $tag; + private string $tag; /** * @readonly - * @var bool */ - private $removeOriginal = \false; + private bool $removeOriginal = \false; /** * @var AnnotationPropertyToAttributeClass[] */ - private $annotationPropertiesToAttributeClasses = []; + private array $annotationPropertiesToAttributeClasses = []; /** * @param array|string[]|AnnotationPropertyToAttributeClass[] $annotationPropertiesToAttributeClasses */ diff --git a/rules/Php80/ValueObject/NestedDoctrineTagAndAnnotationToAttribute.php b/rules/Php80/ValueObject/NestedDoctrineTagAndAnnotationToAttribute.php index adea5de654f..561ac54a430 100644 --- a/rules/Php80/ValueObject/NestedDoctrineTagAndAnnotationToAttribute.php +++ b/rules/Php80/ValueObject/NestedDoctrineTagAndAnnotationToAttribute.php @@ -8,14 +8,12 @@ final class NestedDoctrineTagAndAnnotationToAttribute { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode */ - private $doctrineAnnotationTagValueNode; + private DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode; /** * @readonly - * @var \Rector\Php80\ValueObject\NestedAnnotationToAttribute */ - private $nestedAnnotationToAttribute; + private \Rector\Php80\ValueObject\NestedAnnotationToAttribute $nestedAnnotationToAttribute; public function __construct(DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode, \Rector\Php80\ValueObject\NestedAnnotationToAttribute $nestedAnnotationToAttribute) { $this->doctrineAnnotationTagValueNode = $doctrineAnnotationTagValueNode; diff --git a/rules/Php80/ValueObject/PropertyPromotionCandidate.php b/rules/Php80/ValueObject/PropertyPromotionCandidate.php index 2854d883db5..a1bcafe8302 100644 --- a/rules/Php80/ValueObject/PropertyPromotionCandidate.php +++ b/rules/Php80/ValueObject/PropertyPromotionCandidate.php @@ -13,19 +13,16 @@ final class PropertyPromotionCandidate { /** * @readonly - * @var \PhpParser\Node\Stmt\Property */ - private $property; + private Property $property; /** * @readonly - * @var \PhpParser\Node\Param */ - private $param; + private Param $param; /** * @readonly - * @var \PhpParser\Node\Stmt\Expression */ - private $expression; + private Expression $expression; public function __construct(Property $property, Param $param, Expression $expression) { $this->property = $property; diff --git a/rules/Php80/ValueObject/StrStartsWith.php b/rules/Php80/ValueObject/StrStartsWith.php index 90ececd2f21..db70edab6dd 100644 --- a/rules/Php80/ValueObject/StrStartsWith.php +++ b/rules/Php80/ValueObject/StrStartsWith.php @@ -9,24 +9,20 @@ final class StrStartsWith { /** * @readonly - * @var \PhpParser\Node\Expr\FuncCall */ - private $funcCall; + private FuncCall $funcCall; /** * @readonly - * @var \PhpParser\Node\Expr */ - private $haystackExpr; + private Expr $haystackExpr; /** * @readonly - * @var \PhpParser\Node\Expr */ - private $needleExpr; + private Expr $needleExpr; /** * @readonly - * @var bool */ - private $isPositive; + private bool $isPositive; public function __construct(FuncCall $funcCall, Expr $haystackExpr, Expr $needleExpr, bool $isPositive) { $this->funcCall = $funcCall; diff --git a/rules/Php81/NodeAnalyzer/CoalesePropertyAssignMatcher.php b/rules/Php81/NodeAnalyzer/CoalesePropertyAssignMatcher.php index 3e1667eff51..dc473ec88d7 100644 --- a/rules/Php81/NodeAnalyzer/CoalesePropertyAssignMatcher.php +++ b/rules/Php81/NodeAnalyzer/CoalesePropertyAssignMatcher.php @@ -15,14 +15,12 @@ final class CoalesePropertyAssignMatcher { /** * @readonly - * @var \Rector\Php81\NodeAnalyzer\ComplexNewAnalyzer */ - private $complexNewAnalyzer; + private \Rector\Php81\NodeAnalyzer\ComplexNewAnalyzer $complexNewAnalyzer; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(\Rector\Php81\NodeAnalyzer\ComplexNewAnalyzer $complexNewAnalyzer, NodeNameResolver $nodeNameResolver) { $this->complexNewAnalyzer = $complexNewAnalyzer; diff --git a/rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php b/rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php index 599a9f4c1cc..7ff1bfb693a 100644 --- a/rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php +++ b/rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php @@ -5,7 +5,7 @@ namespace Rector\Php81\NodeAnalyzer; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\New_; use PhpParser\Node\Name\FullyQualified; use Rector\NodeAnalyzer\ExprAnalyzer; @@ -13,9 +13,8 @@ final class ComplexNewAnalyzer { /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; public function __construct(ExprAnalyzer $exprAnalyzer) { $this->exprAnalyzer = $exprAnalyzer; diff --git a/rules/Php81/NodeFactory/EnumFactory.php b/rules/Php81/NodeFactory/EnumFactory.php index ad71d29961c..31f190654c3 100644 --- a/rules/Php81/NodeFactory/EnumFactory.php +++ b/rules/Php81/NodeFactory/EnumFactory.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace Rector\Php81\NodeFactory; +use PhpParser\Node\Scalar\Int_; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\BuilderFactory; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassConst; @@ -26,29 +26,24 @@ final class EnumFactory { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \PhpParser\BuilderFactory */ - private $builderFactory; + private BuilderFactory $builderFactory; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @var string * @see https://stackoverflow.com/a/2560017 @@ -163,10 +158,10 @@ final class EnumFactory if (!$item instanceof ArrayItem) { continue; } - if (!$item->key instanceof LNumber && !$item->key instanceof String_) { + if (!$item->key instanceof Int_ && !$item->key instanceof String_) { continue; } - if (!$item->value instanceof LNumber && !$item->value instanceof String_) { + if (!$item->value instanceof Int_ && !$item->value instanceof String_) { continue; } $mapping[$item->key->value] = $item->value->value; @@ -178,9 +173,7 @@ final class EnumFactory */ private function getIdentifierTypeFromMappings(array $mapping) : string { - $callableGetType = static function ($value) : string { - return \gettype($value); - }; + $callableGetType = static fn($value): string => \gettype($value); $valueTypes = \array_map($callableGetType, $mapping); $uniqueValueTypes = \array_unique($valueTypes); if (\count($uniqueValueTypes) === 1) { diff --git a/rules/Php81/Rector/Array_/FirstClassCallableRector.php b/rules/Php81/Rector/Array_/FirstClassCallableRector.php index b5b320b28ca..189bc0f735d 100644 --- a/rules/Php81/Rector/Array_/FirstClassCallableRector.php +++ b/rules/Php81/Rector/Array_/FirstClassCallableRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Php81\Rector\Array_; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\ClassConstFetch; @@ -13,7 +14,6 @@ use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\Property; use PhpParser\Node\VariadicPlaceholder; -use PhpParser\NodeTraverser; use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ReflectionProvider; @@ -34,19 +34,16 @@ final class FirstClassCallableRector extends AbstractRector implements MinPhpVer { /** * @readonly - * @var \Rector\NodeCollector\NodeAnalyzer\ArrayCallableMethodMatcher */ - private $arrayCallableMethodMatcher; + private ArrayCallableMethodMatcher $arrayCallableMethodMatcher; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ArrayCallableMethodMatcher $arrayCallableMethodMatcher, ReflectionProvider $reflectionProvider, ReflectionResolver $reflectionResolver) { $this->arrayCallableMethodMatcher = $arrayCallableMethodMatcher; @@ -98,7 +95,7 @@ CODE_SAMPLE public function refactor(Node $node) { if ($node instanceof Property || $node instanceof ClassConst) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } $scope = ScopeFetcher::fetch($node); $arrayCallable = $this->arrayCallableMethodMatcher->match($node, $scope); diff --git a/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php b/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php index 3108c5c42f0..8c7ea050fcf 100644 --- a/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php +++ b/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php @@ -28,24 +28,20 @@ final class NewInInitializerRector extends AbstractRector implements MinPhpVersi { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\FamilyTree\NodeAnalyzer\ClassChildAnalyzer */ - private $classChildAnalyzer; + private ClassChildAnalyzer $classChildAnalyzer; /** * @readonly - * @var \Rector\Php81\NodeAnalyzer\CoalesePropertyAssignMatcher */ - private $coalesePropertyAssignMatcher; + private CoalesePropertyAssignMatcher $coalesePropertyAssignMatcher; /** * @readonly - * @var \Rector\NodeManipulator\StmtsManipulator */ - private $stmtsManipulator; + private StmtsManipulator $stmtsManipulator; public function __construct(ReflectionResolver $reflectionResolver, ClassChildAnalyzer $classChildAnalyzer, CoalesePropertyAssignMatcher $coalesePropertyAssignMatcher, StmtsManipulator $stmtsManipulator) { $this->reflectionResolver = $reflectionResolver; @@ -182,8 +178,6 @@ CODE_SAMPLE if ($classMethod->stmts === null || $classMethod->stmts === []) { return []; } - return \array_filter($classMethod->params, static function (Param $param) : bool { - return $param->type instanceof NullableType; - }); + return \array_filter($classMethod->params, static fn(Param $param): bool => $param->type instanceof NullableType); } } diff --git a/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php b/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php index 79547d9b971..2972a8e640f 100644 --- a/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php +++ b/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php @@ -19,9 +19,8 @@ final class MyCLabsClassToEnumRector extends AbstractRector implements MinPhpVer { /** * @readonly - * @var \Rector\Php81\NodeFactory\EnumFactory */ - private $enumFactory; + private EnumFactory $enumFactory; public function __construct(EnumFactory $enumFactory) { $this->enumFactory = $enumFactory; diff --git a/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php b/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php index 6bba6f0ee33..2e6e6471f9e 100644 --- a/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php +++ b/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php @@ -21,17 +21,13 @@ final class SpatieEnumClassToEnumRector extends AbstractRector implements MinPhp { /** * @readonly - * @var \Rector\Php81\NodeFactory\EnumFactory */ - private $enumFactory; + private EnumFactory $enumFactory; /** * @var string */ public const TO_UPPER_SNAKE_CASE = 'toUpperSnakeCase'; - /** - * @var bool - */ - private $toUpperSnakeCase = \false; + private bool $toUpperSnakeCase = \false; public function __construct(EnumFactory $enumFactory) { $this->enumFactory = $enumFactory; diff --git a/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php b/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php index 2e035193a1e..e8c0d5ef124 100644 --- a/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php +++ b/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php @@ -3,6 +3,8 @@ declare (strict_types=1); namespace Rector\Php81\Rector\FuncCall; +use PhpParser\Node\Scalar\InterpolatedString; +use PHPStan\Reflection\Native\ExtendedNativeParameterReflection; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; @@ -11,13 +13,11 @@ use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\Encapsed; use PhpParser\Node\Scalar\String_; use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\Native\NativeFunctionReflection; -use PHPStan\Reflection\Native\NativeParameterWithPhpDocsReflection; use PHPStan\Reflection\ParametersAcceptor; use PHPStan\Type\ErrorType; use PHPStan\Type\MixedType; @@ -42,24 +42,20 @@ final class NullToStrictStringFuncCallArgRector extends AbstractRector implement { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\ArgsAnalyzer */ - private $argsAnalyzer; + private ArgsAnalyzer $argsAnalyzer; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ReflectionResolver $reflectionResolver, ArgsAnalyzer $argsAnalyzer, PropertyFetchAnalyzer $propertyFetchAnalyzer, ValueResolver $valueResolver) { $this->reflectionResolver = $reflectionResolver; @@ -183,7 +179,7 @@ CODE_SAMPLE if ($this->shouldSkipType($type)) { return null; } - if ($argValue instanceof Encapsed) { + if ($argValue instanceof InterpolatedString) { return null; } if ($this->isAnErrorType($argValue, $nativeType, $scope)) { @@ -193,7 +189,7 @@ CODE_SAMPLE return null; } $parameter = $parametersAcceptor->getParameters()[$position] ?? null; - if ($parameter instanceof NativeParameterWithPhpDocsReflection && $parameter->getType() instanceof UnionType) { + if ($parameter instanceof ExtendedNativeParameterReflection && $parameter->getType() instanceof UnionType) { $parameterType = $parameter->getType(); if (!$this->isValidUnionType($parameterType)) { return null; diff --git a/rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php b/rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php index c1d0d4e8f77..028c4179ea3 100644 --- a/rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php +++ b/rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php @@ -26,9 +26,8 @@ final class MyCLabsMethodCallToEnumConstRector extends AbstractRector implements { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @var string[] */ diff --git a/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php b/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php index 646cd019c66..e83ce051570 100644 --- a/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php +++ b/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Php81\Rector\Property; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Assign; @@ -13,7 +14,6 @@ use PhpParser\Node\Param; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Property; -use PhpParser\NodeTraverser; use PHPStan\Analyser\Scope; use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; @@ -40,39 +40,32 @@ final class ReadOnlyPropertyRector extends AbstractRector implements MinPhpVersi { /** * @readonly - * @var \Rector\NodeManipulator\PropertyManipulator */ - private $propertyManipulator; + private PropertyManipulator $propertyManipulator; /** * @readonly - * @var \Rector\NodeManipulator\PropertyFetchAssignManipulator */ - private $propertyFetchAssignManipulator; + private PropertyFetchAssignManipulator $propertyFetchAssignManipulator; /** * @readonly - * @var \Rector\NodeAnalyzer\ParamAnalyzer */ - private $paramAnalyzer; + private ParamAnalyzer $paramAnalyzer; /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(PropertyManipulator $propertyManipulator, PropertyFetchAssignManipulator $propertyFetchAssignManipulator, ParamAnalyzer $paramAnalyzer, VisibilityManipulator $visibilityManipulator, BetterNodeFinder $betterNodeFinder, PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater) { $this->propertyManipulator = $propertyManipulator; @@ -166,7 +159,7 @@ CODE_SAMPLE if ($property->props[0]->default instanceof Expr) { return null; } - if ($property->type === null) { + if (!$property->type instanceof Node) { return null; } if ($property->isStatic()) { @@ -213,7 +206,7 @@ CODE_SAMPLE if (!$this->visibilityManipulator->hasVisibility($param, Visibility::PRIVATE)) { return null; } - if ($param->type === null) { + if (!$param->type instanceof Node) { return null; } // early check not property promotion and already readonly @@ -253,7 +246,7 @@ CODE_SAMPLE } if ($this->nodeComparator->areNodesEqual($propertyFetch, $node->var)) { $isAssigned = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } return null; }); diff --git a/rules/Php82/Rector/Class_/ReadOnlyClassRector.php b/rules/Php82/Rector/Class_/ReadOnlyClassRector.php index 12d0e6df6c7..e30393ca3e7 100644 --- a/rules/Php82/Rector/Class_/ReadOnlyClassRector.php +++ b/rules/Php82/Rector/Class_/ReadOnlyClassRector.php @@ -33,24 +33,20 @@ final class ReadOnlyClassRector extends AbstractRector implements MinPhpVersionI { /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(ClassAnalyzer $classAnalyzer, VisibilityManipulator $visibilityManipulator, PhpAttributeAnalyzer $phpAttributeAnalyzer, ReflectionProvider $reflectionProvider) { $this->classAnalyzer = $classAnalyzer; diff --git a/rules/Php82/Rector/Encapsed/VariableInStringInterpolationFixerRector.php b/rules/Php82/Rector/Encapsed/VariableInStringInterpolationFixerRector.php index 7798055e8dd..02792fe3137 100644 --- a/rules/Php82/Rector/Encapsed/VariableInStringInterpolationFixerRector.php +++ b/rules/Php82/Rector/Encapsed/VariableInStringInterpolationFixerRector.php @@ -3,9 +3,9 @@ declare (strict_types=1); namespace Rector\Php82\Rector\Encapsed; +use PhpParser\Node\Scalar\InterpolatedString; use PhpParser\Node; use PhpParser\Node\Expr\Variable; -use PhpParser\Node\Scalar\Encapsed; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersionFeature; @@ -34,10 +34,10 @@ CODE_SAMPLE */ public function getNodeTypes() : array { - return [Encapsed::class]; + return [InterpolatedString::class]; } /** - * @param Encapsed $node + * @param InterpolatedString $node */ public function refactor(Node $node) : ?Node { @@ -51,10 +51,7 @@ CODE_SAMPLE if (!isset($oldTokens[$startTokenPos])) { continue; } - if (!\is_array($oldTokens[$startTokenPos])) { - continue; - } - if ($oldTokens[$startTokenPos][1] !== '${') { + if ((string) $oldTokens[$startTokenPos] !== '${') { continue; } $part->setAttribute(AttributeKey::ORIGINAL_NODE, null); diff --git a/rules/Php82/Rector/New_/FilesystemIteratorSkipDotsRector.php b/rules/Php82/Rector/New_/FilesystemIteratorSkipDotsRector.php index 60b38235600..f4e931c9efd 100644 --- a/rules/Php82/Rector/New_/FilesystemIteratorSkipDotsRector.php +++ b/rules/Php82/Rector/New_/FilesystemIteratorSkipDotsRector.php @@ -24,9 +24,8 @@ final class FilesystemIteratorSkipDotsRector extends AbstractRector implements M { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php b/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php index ad98331bfc1..9010d65bad4 100644 --- a/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php +++ b/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php @@ -23,14 +23,13 @@ final class AddSensitiveParameterAttributeRector extends AbstractRector implemen { /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; public const SENSITIVE_PARAMETERS = 'sensitive_parameters'; /** * @var string[] */ - private $sensitiveParameters = []; + private array $sensitiveParameters = []; public function __construct(PhpAttributeAnalyzer $phpAttributeAnalyzer) { $this->phpAttributeAnalyzer = $phpAttributeAnalyzer; diff --git a/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php b/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php index 2783a1fe54b..837cef3990d 100644 --- a/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php +++ b/rules/Php83/Rector/ClassConst/AddTypeToConstRector.php @@ -3,6 +3,8 @@ declare (strict_types=1); namespace Rector\Php83\Rector\ClassConst; +use PhpParser\Node\Scalar\Int_; +use PhpParser\Node\Scalar\Float_; use PhpParser\Node; use PhpParser\Node\Const_; use PhpParser\Node\Expr; @@ -13,8 +15,6 @@ use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\UnaryMinus; use PhpParser\Node\Expr\UnaryPlus; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\DNumber; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassConst; @@ -34,14 +34,12 @@ final class AddTypeToConstRector extends AbstractRector implements MinPhpVersion { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(ReflectionProvider $reflectionProvider, StaticTypeMapper $staticTypeMapper) { $this->reflectionProvider = $reflectionProvider; @@ -147,10 +145,10 @@ CODE_SAMPLE if ($expr instanceof String_) { return new Identifier('string'); } - if ($expr instanceof LNumber) { + if ($expr instanceof Int_) { return new Identifier('int'); } - if ($expr instanceof DNumber) { + if ($expr instanceof Float_) { return new Identifier('float'); } if ($expr instanceof ConstFetch || $expr instanceof ClassConstFetch) { @@ -181,9 +179,7 @@ CODE_SAMPLE return []; } $currentClassReflection = $this->reflectionProvider->getClass($className); - return \array_filter($currentClassReflection->getAncestors(), static function (ClassReflection $classReflection) use($currentClassReflection) : bool { - return $currentClassReflection !== $classReflection; - }); + return \array_filter($currentClassReflection->getAncestors(), static fn(ClassReflection $classReflection): bool => $currentClassReflection !== $classReflection); } private function canBeInherited(ClassConst $classConst, Class_ $class) : bool { diff --git a/rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php b/rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php index 31988d9c9ff..928cb6ee0c9 100644 --- a/rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php +++ b/rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php @@ -13,7 +13,8 @@ use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassLike; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Return_; -use PhpParser\Node\Stmt\Throw_; +use PhpParser\Node\Expr\Throw_; +use PhpParser\Node\Stmt\Expression; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ReflectionProvider; use Rector\NodeAnalyzer\ClassAnalyzer; @@ -35,37 +36,29 @@ final class AddOverrideAttributeToOverriddenMethodsRector extends AbstractRector { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var string */ private const OVERRIDE_CLASS = 'Override'; - /** - * @var bool - */ - private $hasChanged = \false; + private bool $hasChanged = \false; public function __construct(ReflectionProvider $reflectionProvider, ClassAnalyzer $classAnalyzer, PhpAttributeAnalyzer $phpAttributeAnalyzer, AstResolver $astResolver, ValueResolver $valueResolver) { $this->reflectionProvider = $reflectionProvider; @@ -213,7 +206,7 @@ CODE_SAMPLE if ($soleStmt instanceof Return_ && $soleStmt->expr instanceof Expr && $this->valueResolver->isNull($soleStmt->expr)) { return \true; } - if ($soleStmt instanceof Throw_) { + if ($soleStmt instanceof Expression && $soleStmt->expr instanceof Throw_) { return \true; } } diff --git a/rules/Php83/Rector/FuncCall/CombineHostPortLdapUriRector.php b/rules/Php83/Rector/FuncCall/CombineHostPortLdapUriRector.php index 2586bbc1125..f7adc4c31d3 100644 --- a/rules/Php83/Rector/FuncCall/CombineHostPortLdapUriRector.php +++ b/rules/Php83/Rector/FuncCall/CombineHostPortLdapUriRector.php @@ -3,11 +3,11 @@ declare (strict_types=1); namespace Rector\Php83\Rector\FuncCall; +use PhpParser\Node\Scalar\Int_; +use PhpParser\Node\Scalar\InterpolatedString; +use PhpParser\Node\InterpolatedStringPart; use PhpParser\Node; use PhpParser\Node\Expr\FuncCall; -use PhpParser\Node\Scalar\Encapsed; -use PhpParser\Node\Scalar\EncapsedStringPart; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use Rector\NodeAnalyzer\ExprAnalyzer; use Rector\Rector\AbstractRector; @@ -23,9 +23,8 @@ final class CombineHostPortLdapUriRector extends AbstractRector implements MinPh { /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; public function __construct(ExprAnalyzer $exprAnalyzer) { $this->exprAnalyzer = $exprAnalyzer; @@ -64,10 +63,10 @@ CODE_SAMPLE } $firstArg = $args[0]->value; $secondArg = $args[1]->value; - if ($firstArg instanceof String_ && $secondArg instanceof LNumber) { + if ($firstArg instanceof String_ && $secondArg instanceof Int_) { $args[0]->value = new String_($firstArg->value . ':' . $secondArg->value); } elseif ($this->exprAnalyzer->isDynamicExpr($firstArg) && $this->exprAnalyzer->isDynamicExpr($secondArg)) { - $args[0]->value = new Encapsed([$firstArg, new EncapsedStringPart(':'), $secondArg]); + $args[0]->value = new InterpolatedString([$firstArg, new InterpolatedStringPart(':'), $secondArg]); } else { return null; } diff --git a/rules/Php84/Rector/Param/ExplicitNullableParamTypeRector.php b/rules/Php84/Rector/Param/ExplicitNullableParamTypeRector.php index e7bd64115c7..dfc775a29c1 100644 --- a/rules/Php84/Rector/Param/ExplicitNullableParamTypeRector.php +++ b/rules/Php84/Rector/Param/ExplicitNullableParamTypeRector.php @@ -28,14 +28,12 @@ final class ExplicitNullableParamTypeRector extends AbstractRector implements Mi { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(ValueResolver $valueResolver, StaticTypeMapper $staticTypeMapper) { $this->valueResolver = $valueResolver; diff --git a/rules/Privatization/Guard/OverrideByParentClassGuard.php b/rules/Privatization/Guard/OverrideByParentClassGuard.php index b5515543957..6d399229797 100644 --- a/rules/Privatization/Guard/OverrideByParentClassGuard.php +++ b/rules/Privatization/Guard/OverrideByParentClassGuard.php @@ -13,9 +13,8 @@ final class OverrideByParentClassGuard { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(ReflectionProvider $reflectionProvider) { $this->reflectionProvider = $reflectionProvider; diff --git a/rules/Privatization/Guard/ParentPropertyLookupGuard.php b/rules/Privatization/Guard/ParentPropertyLookupGuard.php index dacfb2f9d04..2e3d75851cf 100644 --- a/rules/Privatization/Guard/ParentPropertyLookupGuard.php +++ b/rules/Privatization/Guard/ParentPropertyLookupGuard.php @@ -21,34 +21,28 @@ final class ParentPropertyLookupGuard { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\NodeManipulator\PropertyManipulator */ - private $propertyManipulator; + private PropertyManipulator $propertyManipulator; /** * @readonly - * @var \Rector\Reflection\ClassReflectionAnalyzer */ - private $classReflectionAnalyzer; + private ClassReflectionAnalyzer $classReflectionAnalyzer; public function __construct(BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver, PropertyFetchAnalyzer $propertyFetchAnalyzer, AstResolver $astResolver, PropertyManipulator $propertyManipulator, ClassReflectionAnalyzer $classReflectionAnalyzer) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/rules/Privatization/NodeManipulator/VisibilityManipulator.php b/rules/Privatization/NodeManipulator/VisibilityManipulator.php index 6ef5b4cfba4..d32d80952e5 100644 --- a/rules/Privatization/NodeManipulator/VisibilityManipulator.php +++ b/rules/Privatization/NodeManipulator/VisibilityManipulator.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Privatization\NodeManipulator; +use PhpParser\Modifiers; use PhpParser\Node\Param; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassConst; @@ -39,7 +40,7 @@ final class VisibilityManipulator if (!$node->isStatic()) { return; } - $node->flags -= Class_::MODIFIER_STATIC; + $node->flags -= Modifiers::STATIC; } /** * @api @@ -50,7 +51,7 @@ final class VisibilityManipulator if (!$node->isAbstract()) { return; } - $node->flags -= Class_::MODIFIER_ABSTRACT; + $node->flags -= Modifiers::ABSTRACT; } /** * @api @@ -69,7 +70,7 @@ final class VisibilityManipulator if (!$node->isFinal()) { return; } - $node->flags -= Class_::MODIFIER_FINAL; + $node->flags -= Modifiers::FINAL; } /** * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Stmt\ClassConst $node @@ -107,7 +108,7 @@ final class VisibilityManipulator */ public function removeFinal($node) : void { - $node->flags -= Class_::MODIFIER_FINAL; + $node->flags -= Modifiers::FINAL; } /** * @param \PhpParser\Node\Stmt\Class_|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Param $node @@ -163,14 +164,14 @@ final class VisibilityManipulator return; } if ($node->isPublic()) { - $node->flags |= Class_::MODIFIER_PUBLIC; - $node->flags -= Class_::MODIFIER_PUBLIC; + $node->flags |= Modifiers::PUBLIC; + $node->flags -= Modifiers::PUBLIC; } if ($node->isProtected()) { - $node->flags -= Class_::MODIFIER_PROTECTED; + $node->flags -= Modifiers::PROTECTED; } if ($node->isPrivate()) { - $node->flags -= Class_::MODIFIER_PRIVATE; + $node->flags -= Modifiers::PRIVATE; } } /** diff --git a/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php b/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php index 51b1949fcd8..683462c2de3 100644 --- a/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php +++ b/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php @@ -23,24 +23,20 @@ final class PrivatizeFinalClassMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\Privatization\VisibilityGuard\ClassMethodVisibilityGuard */ - private $classMethodVisibilityGuard; + private ClassMethodVisibilityGuard $classMethodVisibilityGuard; /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @readonly - * @var \Rector\Privatization\Guard\OverrideByParentClassGuard */ - private $overrideByParentClassGuard; + private OverrideByParentClassGuard $overrideByParentClassGuard; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(ClassMethodVisibilityGuard $classMethodVisibilityGuard, VisibilityManipulator $visibilityManipulator, OverrideByParentClassGuard $overrideByParentClassGuard, BetterNodeFinder $betterNodeFinder) { $this->classMethodVisibilityGuard = $classMethodVisibilityGuard; diff --git a/rules/Privatization/Rector/Class_/FinalizeTestCaseClassRector.php b/rules/Privatization/Rector/Class_/FinalizeTestCaseClassRector.php index 4b50a4af531..228c397fd6b 100644 --- a/rules/Privatization/Rector/Class_/FinalizeTestCaseClassRector.php +++ b/rules/Privatization/Rector/Class_/FinalizeTestCaseClassRector.php @@ -18,14 +18,12 @@ final class FinalizeTestCaseClassRector extends AbstractRector { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; public function __construct(ReflectionProvider $reflectionProvider, VisibilityManipulator $visibilityManipulator) { $this->reflectionProvider = $reflectionProvider; diff --git a/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php b/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php index 7773af16546..5c5ee4947f6 100644 --- a/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php +++ b/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php @@ -23,19 +23,16 @@ final class PrivatizeFinalClassPropertyRector extends AbstractRector { /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @readonly - * @var \Rector\Privatization\Guard\ParentPropertyLookupGuard */ - private $parentPropertyLookupGuard; + private ParentPropertyLookupGuard $parentPropertyLookupGuard; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(VisibilityManipulator $visibilityManipulator, ParentPropertyLookupGuard $parentPropertyLookupGuard, ReflectionResolver $reflectionResolver) { $this->visibilityManipulator = $visibilityManipulator; diff --git a/rules/Privatization/VisibilityGuard/ClassMethodVisibilityGuard.php b/rules/Privatization/VisibilityGuard/ClassMethodVisibilityGuard.php index 41c36d90c45..5dc1d3fa7a5 100644 --- a/rules/Privatization/VisibilityGuard/ClassMethodVisibilityGuard.php +++ b/rules/Privatization/VisibilityGuard/ClassMethodVisibilityGuard.php @@ -10,9 +10,8 @@ final class ClassMethodVisibilityGuard { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/Removing/NodeManipulator/ComplexNodeRemover.php b/rules/Removing/NodeManipulator/ComplexNodeRemover.php index 7f924a6c8d2..03858c47d49 100644 --- a/rules/Removing/NodeManipulator/ComplexNodeRemover.php +++ b/rules/Removing/NodeManipulator/ComplexNodeRemover.php @@ -13,24 +13,20 @@ final class ComplexNodeRemover { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, PhpDocTagRemover $phpDocTagRemover, NodeNameResolver $nodeNameResolver, DocBlockUpdater $docBlockUpdater) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php b/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php index 076c759655f..b5c8502f171 100644 --- a/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php +++ b/rules/Removing/Rector/ClassMethod/ArgumentRemoverRector.php @@ -23,17 +23,13 @@ final class ArgumentRemoverRector extends AbstractRector implements Configurable { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var ArgumentRemover[] */ - private $removedArguments = []; - /** - * @var bool - */ - private $hasChanged = \false; + private array $removedArguments = []; + private bool $hasChanged = \false; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/Removing/Rector/Class_/RemoveInterfacesRector.php b/rules/Removing/Rector/Class_/RemoveInterfacesRector.php index 55c4e8f6dd2..692679a2125 100644 --- a/rules/Removing/Rector/Class_/RemoveInterfacesRector.php +++ b/rules/Removing/Rector/Class_/RemoveInterfacesRector.php @@ -18,7 +18,7 @@ final class RemoveInterfacesRector extends AbstractRector implements Configurabl /** * @var string[] */ - private $interfacesToRemove = []; + private array $interfacesToRemove = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Removes interfaces usage from class.', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Removing/Rector/Class_/RemoveTraitUseRector.php b/rules/Removing/Rector/Class_/RemoveTraitUseRector.php index b19c00a08c7..d679dc87c10 100644 --- a/rules/Removing/Rector/Class_/RemoveTraitUseRector.php +++ b/rules/Removing/Rector/Class_/RemoveTraitUseRector.php @@ -20,7 +20,7 @@ final class RemoveTraitUseRector extends AbstractRector implements ConfigurableR /** * @var string[] */ - private $traitsToRemove = []; + private array $traitsToRemove = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Remove specific traits from code', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Removing/Rector/FuncCall/RemoveFuncCallArgRector.php b/rules/Removing/Rector/FuncCall/RemoveFuncCallArgRector.php index a756702fe67..53c9fc1544c 100644 --- a/rules/Removing/Rector/FuncCall/RemoveFuncCallArgRector.php +++ b/rules/Removing/Rector/FuncCall/RemoveFuncCallArgRector.php @@ -20,7 +20,7 @@ final class RemoveFuncCallArgRector extends AbstractRector implements Configurab /** * @var RemoveFuncCallArg[] */ - private $removedFunctionArguments = []; + private array $removedFunctionArguments = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Remove argument by position by function name', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Removing/Rector/FuncCall/RemoveFuncCallRector.php b/rules/Removing/Rector/FuncCall/RemoveFuncCallRector.php index d63475e9c4d..b6d6380f384 100644 --- a/rules/Removing/Rector/FuncCall/RemoveFuncCallRector.php +++ b/rules/Removing/Rector/FuncCall/RemoveFuncCallRector.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace Rector\Removing\Rector\FuncCall; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Stmt\Expression; -use PhpParser\NodeTraverser; use Rector\Contract\Rector\ConfigurableRectorInterface; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample; @@ -20,7 +20,7 @@ final class RemoveFuncCallRector extends AbstractRector implements ConfigurableR /** * @var string[] */ - private $removedFunctions = []; + private array $removedFunctions = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Remove function', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' @@ -52,7 +52,7 @@ CODE_SAMPLE if (!$this->isName($expr->name, $removedFunction)) { continue; } - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } return null; } diff --git a/rules/Removing/ValueObject/ArgumentRemover.php b/rules/Removing/ValueObject/ArgumentRemover.php index 1d7403f80ca..4163cc0a4a0 100644 --- a/rules/Removing/ValueObject/ArgumentRemover.php +++ b/rules/Removing/ValueObject/ArgumentRemover.php @@ -9,19 +9,16 @@ final class ArgumentRemover { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $method; + private string $method; /** * @readonly - * @var int */ - private $position; + private int $position; /** * @readonly * @var mixed diff --git a/rules/Removing/ValueObject/RemoveFuncCallArg.php b/rules/Removing/ValueObject/RemoveFuncCallArg.php index a36e2921002..4abe5397792 100644 --- a/rules/Removing/ValueObject/RemoveFuncCallArg.php +++ b/rules/Removing/ValueObject/RemoveFuncCallArg.php @@ -8,14 +8,12 @@ final class RemoveFuncCallArg { /** * @readonly - * @var string */ - private $function; + private string $function; /** * @readonly - * @var int */ - private $argumentPosition; + private int $argumentPosition; public function __construct(string $function, int $argumentPosition) { $this->function = $function; diff --git a/rules/Renaming/Collector/RenamedNameCollector.php b/rules/Renaming/Collector/RenamedNameCollector.php index 753acc8d837..956e8404200 100644 --- a/rules/Renaming/Collector/RenamedNameCollector.php +++ b/rules/Renaming/Collector/RenamedNameCollector.php @@ -8,7 +8,7 @@ final class RenamedNameCollector /** * @var string[] */ - private $names = []; + private array $names = []; public function add(string $name) : void { $this->names[] = $name; diff --git a/rules/Renaming/NodeManipulator/ClassRenamer.php b/rules/Renaming/NodeManipulator/ClassRenamer.php index f6f896ad904..fe0fb32d212 100644 --- a/rules/Renaming/NodeManipulator/ClassRenamer.php +++ b/rules/Renaming/NodeManipulator/ClassRenamer.php @@ -27,43 +27,36 @@ final class ClassRenamer { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocClassRenamer */ - private $phpDocClassRenamer; + private PhpDocClassRenamer $phpDocClassRenamer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockClassRenamer */ - private $docBlockClassRenamer; + private DocBlockClassRenamer $docBlockClassRenamer; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\Util\FileHasher */ - private $fileHasher; + private FileHasher $fileHasher; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\Renaming\Collector\RenamedNameCollector */ - private $renamedNameCollector; + private RenamedNameCollector $renamedNameCollector; /** * @var array */ - private $oldToNewTypesByCacheKey = []; + private array $oldToNewTypesByCacheKey = []; public function __construct(PhpDocClassRenamer $phpDocClassRenamer, PhpDocInfoFactory $phpDocInfoFactory, DocBlockClassRenamer $docBlockClassRenamer, ReflectionProvider $reflectionProvider, FileHasher $fileHasher, DocBlockUpdater $docBlockUpdater, RenamedNameCollector $renamedNameCollector) { $this->phpDocClassRenamer = $phpDocClassRenamer; diff --git a/rules/Renaming/NodeManipulator/SwitchManipulator.php b/rules/Renaming/NodeManipulator/SwitchManipulator.php index 37b7bff1c65..49c4c0995a8 100644 --- a/rules/Renaming/NodeManipulator/SwitchManipulator.php +++ b/rules/Renaming/NodeManipulator/SwitchManipulator.php @@ -3,7 +3,7 @@ declare (strict_types=1); namespace Rector\Renaming\NodeManipulator; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Break_; final class SwitchManipulator @@ -18,11 +18,11 @@ final class SwitchManipulator if (!$node instanceof Break_) { continue; } - if (!$node->num instanceof LNumber || $node->num->value === 1) { + if (!$node->num instanceof Int_ || $node->num->value === 1) { unset($stmts[$key]); continue; } - $node->num = $node->num->value === 2 ? null : new LNumber($node->num->value - 1); + $node->num = $node->num->value === 2 ? null : new Int_($node->num->value - 1); } return $stmts; } diff --git a/rules/Renaming/Rector/ClassConstFetch/RenameClassConstFetchRector.php b/rules/Renaming/Rector/ClassConstFetch/RenameClassConstFetchRector.php index 84335ab627a..51222aeb4c1 100644 --- a/rules/Renaming/Rector/ClassConstFetch/RenameClassConstFetchRector.php +++ b/rules/Renaming/Rector/ClassConstFetch/RenameClassConstFetchRector.php @@ -23,7 +23,7 @@ final class RenameClassConstFetchRector extends AbstractRector implements Config /** * @var RenameClassConstFetchInterface[] */ - private $renameClassConstFetches = []; + private array $renameClassConstFetches = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Replaces defined class constants in their calls.', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Renaming/Rector/ClassMethod/RenameAnnotationRector.php b/rules/Renaming/Rector/ClassMethod/RenameAnnotationRector.php index 357ca9614b9..71e47298885 100644 --- a/rules/Renaming/Rector/ClassMethod/RenameAnnotationRector.php +++ b/rules/Renaming/Rector/ClassMethod/RenameAnnotationRector.php @@ -26,23 +26,20 @@ final class RenameAnnotationRector extends AbstractRector implements Configurabl { /** * @readonly - * @var \Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockTagReplacer */ - private $docBlockTagReplacer; + private DocBlockTagReplacer $docBlockTagReplacer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var RenameAnnotationInterface[] */ - private $renameAnnotations = []; + private array $renameAnnotations = []; public function __construct(DocBlockTagReplacer $docBlockTagReplacer, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->docBlockTagReplacer = $docBlockTagReplacer; diff --git a/rules/Renaming/Rector/Class_/RenameAttributeRector.php b/rules/Renaming/Rector/Class_/RenameAttributeRector.php index 8a524171d59..387b6d1adb0 100644 --- a/rules/Renaming/Rector/Class_/RenameAttributeRector.php +++ b/rules/Renaming/Rector/Class_/RenameAttributeRector.php @@ -25,7 +25,7 @@ final class RenameAttributeRector extends AbstractRector implements Configurable /** * @var RenameAttribute[] */ - private $renameAttributes = []; + private array $renameAttributes = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Rename attribute class names', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Renaming/Rector/ConstFetch/RenameConstantRector.php b/rules/Renaming/Rector/ConstFetch/RenameConstantRector.php index d04db27b24c..012033a473f 100644 --- a/rules/Renaming/Rector/ConstFetch/RenameConstantRector.php +++ b/rules/Renaming/Rector/ConstFetch/RenameConstantRector.php @@ -20,7 +20,7 @@ final class RenameConstantRector extends AbstractRector implements ConfigurableR /** * @var array */ - private $oldToNewConstants = []; + private array $oldToNewConstants = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Replace constant by new ones', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Renaming/Rector/FuncCall/RenameFunctionRector.php b/rules/Renaming/Rector/FuncCall/RenameFunctionRector.php index 10f23a5e447..f9d990bbaaa 100644 --- a/rules/Renaming/Rector/FuncCall/RenameFunctionRector.php +++ b/rules/Renaming/Rector/FuncCall/RenameFunctionRector.php @@ -20,7 +20,7 @@ final class RenameFunctionRector extends AbstractRector implements ConfigurableR /** * @var array */ - private $oldFunctionToNewFunction = []; + private array $oldFunctionToNewFunction = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Turns defined function call new one.', [new ConfiguredCodeSample('view("...", []);', 'Laravel\\Templating\\render("...", []);', ['view' => 'Laravel\\Templating\\render'])]); diff --git a/rules/Renaming/Rector/FunctionLike/RenameFunctionLikeParamWithinCallLikeArgRector.php b/rules/Renaming/Rector/FunctionLike/RenameFunctionLikeParamWithinCallLikeArgRector.php index ab734a10166..7c5e4e5c689 100644 --- a/rules/Renaming/Rector/FunctionLike/RenameFunctionLikeParamWithinCallLikeArgRector.php +++ b/rules/Renaming/Rector/FunctionLike/RenameFunctionLikeParamWithinCallLikeArgRector.php @@ -31,23 +31,20 @@ final class RenameFunctionLikeParamWithinCallLikeArgRector extends AbstractRecto { /** * @readonly - * @var \Rector\Naming\Guard\BreakingVariableRenameGuard */ - private $breakingVariableRenameGuard; + private BreakingVariableRenameGuard $breakingVariableRenameGuard; /** * @readonly - * @var \Rector\Naming\ParamRenamer\ParamRenamer */ - private $paramRenamer; + private ParamRenamer $paramRenamer; /** * @readonly - * @var \Rector\Naming\ValueObjectFactory\ParamRenameFactory */ - private $paramRenameFactory; + private ParamRenameFactory $paramRenameFactory; /** * @var RenameFunctionLikeParamWithinCallLikeArg[] */ - private $renameFunctionLikeParamWithinCallLikeArgs = []; + private array $renameFunctionLikeParamWithinCallLikeArgs = []; public function __construct(BreakingVariableRenameGuard $breakingVariableRenameGuard, ParamRenamer $paramRenamer, ParamRenameFactory $paramRenameFactory) { $this->breakingVariableRenameGuard = $breakingVariableRenameGuard; @@ -167,7 +164,7 @@ CODE_SAMPLE return null; } // int positions shouldn't have names - if ($arg->name !== null) { + if ($arg->name instanceof Identifier) { return null; } return $arg; @@ -175,7 +172,7 @@ CODE_SAMPLE private function processNamedArg(CallLike $callLike, RenameFunctionLikeParamWithinCallLikeArg $renameFunctionLikeParamWithinCallLikeArg) : ?Arg { $args = \array_filter($callLike->getArgs(), static function (Arg $arg) use($renameFunctionLikeParamWithinCallLikeArg) : bool { - if ($arg->name === null) { + if (!$arg->name instanceof Identifier) { return \false; } return $arg->name->name === $renameFunctionLikeParamWithinCallLikeArg->getCallLikePosition(); diff --git a/rules/Renaming/Rector/MethodCall/RenameMethodRector.php b/rules/Renaming/Rector/MethodCall/RenameMethodRector.php index 119a0f2064f..ec27c4b54b0 100644 --- a/rules/Renaming/Rector/MethodCall/RenameMethodRector.php +++ b/rules/Renaming/Rector/MethodCall/RenameMethodRector.php @@ -34,23 +34,20 @@ final class RenameMethodRector extends AbstractRector implements ConfigurableRec { /** * @readonly - * @var \Rector\NodeManipulator\ClassManipulator */ - private $classManipulator; + private ClassManipulator $classManipulator; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @var MethodCallRenameInterface[] */ - private $methodCallRenames = []; + private array $methodCallRenames = []; public function __construct(ClassManipulator $classManipulator, ReflectionResolver $reflectionResolver, ReflectionProvider $reflectionProvider) { $this->classManipulator = $classManipulator; diff --git a/rules/Renaming/Rector/Name/RenameClassRector.php b/rules/Renaming/Rector/Name/RenameClassRector.php index 728c9865bf8..fcc665e8140 100644 --- a/rules/Renaming/Rector/Name/RenameClassRector.php +++ b/rules/Renaming/Rector/Name/RenameClassRector.php @@ -26,14 +26,12 @@ final class RenameClassRector extends AbstractRector implements ConfigurableRect { /** * @readonly - * @var \Rector\Configuration\RenamedClassesDataCollector */ - private $renamedClassesDataCollector; + private RenamedClassesDataCollector $renamedClassesDataCollector; /** * @readonly - * @var \Rector\Renaming\NodeManipulator\ClassRenamer */ - private $classRenamer; + private ClassRenamer $classRenamer; public function __construct(RenamedClassesDataCollector $renamedClassesDataCollector, ClassRenamer $classRenamer) { $this->renamedClassesDataCollector = $renamedClassesDataCollector; diff --git a/rules/Renaming/Rector/PropertyFetch/RenamePropertyRector.php b/rules/Renaming/Rector/PropertyFetch/RenamePropertyRector.php index 981bac4defb..ed0d7a1be4c 100644 --- a/rules/Renaming/Rector/PropertyFetch/RenamePropertyRector.php +++ b/rules/Renaming/Rector/PropertyFetch/RenamePropertyRector.php @@ -24,11 +24,8 @@ final class RenamePropertyRector extends AbstractRector implements ConfigurableR /** * @var RenameProperty[] */ - private $renamedProperties = []; - /** - * @var bool - */ - private $hasChanged = \false; + private array $renamedProperties = []; + private bool $hasChanged = \false; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Replaces defined old properties by new ones.', [new ConfiguredCodeSample('$someObject->someOldProperty;', '$someObject->someNewProperty;', [new RenameProperty('SomeClass', 'someOldProperty', 'someNewProperty')])]); diff --git a/rules/Renaming/Rector/StaticCall/RenameStaticMethodRector.php b/rules/Renaming/Rector/StaticCall/RenameStaticMethodRector.php index 74c6d1e952e..595ee03af33 100644 --- a/rules/Renaming/Rector/StaticCall/RenameStaticMethodRector.php +++ b/rules/Renaming/Rector/StaticCall/RenameStaticMethodRector.php @@ -21,7 +21,7 @@ final class RenameStaticMethodRector extends AbstractRector implements Configura /** * @var RenameStaticMethod[] */ - private $staticMethodRenames = []; + private array $staticMethodRenames = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Turns method names to new ones.', [new ConfiguredCodeSample('SomeClass::oldStaticMethod();', 'AnotherExampleClass::newStaticMethod();', [new RenameStaticMethod('SomeClass', 'oldMethod', 'AnotherExampleClass', 'newStaticMethod')])]); diff --git a/rules/Renaming/Rector/String_/RenameStringRector.php b/rules/Renaming/Rector/String_/RenameStringRector.php index 728b3c03c5f..468571f8617 100644 --- a/rules/Renaming/Rector/String_/RenameStringRector.php +++ b/rules/Renaming/Rector/String_/RenameStringRector.php @@ -18,13 +18,12 @@ final class RenameStringRector extends AbstractRector implements ConfigurableRec { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var array */ - private $stringChanges = []; + private array $stringChanges = []; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/Renaming/ValueObject/MethodCallRename.php b/rules/Renaming/ValueObject/MethodCallRename.php index 4d74239f0c7..cbd65bbd81d 100644 --- a/rules/Renaming/ValueObject/MethodCallRename.php +++ b/rules/Renaming/ValueObject/MethodCallRename.php @@ -10,19 +10,16 @@ final class MethodCallRename implements MethodCallRenameInterface { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $oldMethod; + private string $oldMethod; /** * @readonly - * @var string */ - private $newMethod; + private string $newMethod; public function __construct(string $class, string $oldMethod, string $newMethod) { $this->class = $class; diff --git a/rules/Renaming/ValueObject/MethodCallRenameWithArrayKey.php b/rules/Renaming/ValueObject/MethodCallRenameWithArrayKey.php index cf46490bfee..620850062f9 100644 --- a/rules/Renaming/ValueObject/MethodCallRenameWithArrayKey.php +++ b/rules/Renaming/ValueObject/MethodCallRenameWithArrayKey.php @@ -10,19 +10,16 @@ final class MethodCallRenameWithArrayKey implements MethodCallRenameInterface { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $oldMethod; + private string $oldMethod; /** * @readonly - * @var string */ - private $newMethod; + private string $newMethod; /** * @readonly * @var mixed diff --git a/rules/Renaming/ValueObject/RenameAnnotation.php b/rules/Renaming/ValueObject/RenameAnnotation.php index 396c0d88f5a..fd5f4ef7ec9 100644 --- a/rules/Renaming/ValueObject/RenameAnnotation.php +++ b/rules/Renaming/ValueObject/RenameAnnotation.php @@ -11,14 +11,12 @@ final class RenameAnnotation implements RenameAnnotationInterface { /** * @readonly - * @var string */ - private $oldAnnotation; + private string $oldAnnotation; /** * @readonly - * @var string */ - private $newAnnotation; + private string $newAnnotation; public function __construct(string $oldAnnotation, string $newAnnotation) { $this->oldAnnotation = $oldAnnotation; diff --git a/rules/Renaming/ValueObject/RenameAnnotationByType.php b/rules/Renaming/ValueObject/RenameAnnotationByType.php index d2a4bfa1b94..a95cf1deaa3 100644 --- a/rules/Renaming/ValueObject/RenameAnnotationByType.php +++ b/rules/Renaming/ValueObject/RenameAnnotationByType.php @@ -10,19 +10,16 @@ final class RenameAnnotationByType implements RenameAnnotationInterface { /** * @readonly - * @var string */ - private $type; + private string $type; /** * @readonly - * @var string */ - private $oldAnnotation; + private string $oldAnnotation; /** * @readonly - * @var string */ - private $newAnnotation; + private string $newAnnotation; public function __construct(string $type, string $oldAnnotation, string $newAnnotation) { $this->type = $type; diff --git a/rules/Renaming/ValueObject/RenameAttribute.php b/rules/Renaming/ValueObject/RenameAttribute.php index 1bf73addc78..4a644c5ed34 100644 --- a/rules/Renaming/ValueObject/RenameAttribute.php +++ b/rules/Renaming/ValueObject/RenameAttribute.php @@ -10,14 +10,12 @@ final class RenameAttribute { /** * @readonly - * @var string */ - private $oldAttribute; + private string $oldAttribute; /** * @readonly - * @var string */ - private $newAttribute; + private string $newAttribute; public function __construct(string $oldAttribute, string $newAttribute) { $this->oldAttribute = $oldAttribute; diff --git a/rules/Renaming/ValueObject/RenameClassAndConstFetch.php b/rules/Renaming/ValueObject/RenameClassAndConstFetch.php index a798f8cd00f..9db205ba7fe 100644 --- a/rules/Renaming/ValueObject/RenameClassAndConstFetch.php +++ b/rules/Renaming/ValueObject/RenameClassAndConstFetch.php @@ -10,24 +10,20 @@ final class RenameClassAndConstFetch implements RenameClassConstFetchInterface { /** * @readonly - * @var string */ - private $oldClass; + private string $oldClass; /** * @readonly - * @var string */ - private $oldConstant; + private string $oldConstant; /** * @readonly - * @var string */ - private $newClass; + private string $newClass; /** * @readonly - * @var string */ - private $newConstant; + private string $newConstant; public function __construct(string $oldClass, string $oldConstant, string $newClass, string $newConstant) { $this->oldClass = $oldClass; diff --git a/rules/Renaming/ValueObject/RenameClassConstFetch.php b/rules/Renaming/ValueObject/RenameClassConstFetch.php index 0b24c662417..3f425caf118 100644 --- a/rules/Renaming/ValueObject/RenameClassConstFetch.php +++ b/rules/Renaming/ValueObject/RenameClassConstFetch.php @@ -10,19 +10,16 @@ final class RenameClassConstFetch implements RenameClassConstFetchInterface { /** * @readonly - * @var string */ - private $oldClass; + private string $oldClass; /** * @readonly - * @var string */ - private $oldConstant; + private string $oldConstant; /** * @readonly - * @var string */ - private $newConstant; + private string $newConstant; public function __construct(string $oldClass, string $oldConstant, string $newConstant) { $this->oldClass = $oldClass; diff --git a/rules/Renaming/ValueObject/RenameFunctionLikeParamWithinCallLikeArg.php b/rules/Renaming/ValueObject/RenameFunctionLikeParamWithinCallLikeArg.php index 71b28ae217a..8c5a9a1109c 100644 --- a/rules/Renaming/ValueObject/RenameFunctionLikeParamWithinCallLikeArg.php +++ b/rules/Renaming/ValueObject/RenameFunctionLikeParamWithinCallLikeArg.php @@ -9,14 +9,12 @@ final class RenameFunctionLikeParamWithinCallLikeArg { /** * @readonly - * @var string */ - private $className; + private string $className; /** * @readonly - * @var string */ - private $methodName; + private string $methodName; /** * @var int<0, max>|string * @readonly @@ -26,12 +24,11 @@ final class RenameFunctionLikeParamWithinCallLikeArg * @var int<0, max> * @readonly */ - private $functionLikePosition; + private int $functionLikePosition; /** * @readonly - * @var string */ - private $newParamName; + private string $newParamName; /** * @param int<0, max>|string $callLikePosition * @param int<0, max> $functionLikePosition diff --git a/rules/Renaming/ValueObject/RenameProperty.php b/rules/Renaming/ValueObject/RenameProperty.php index fd146c1bc14..1af746b8c7d 100644 --- a/rules/Renaming/ValueObject/RenameProperty.php +++ b/rules/Renaming/ValueObject/RenameProperty.php @@ -9,19 +9,16 @@ final class RenameProperty { /** * @readonly - * @var string */ - private $type; + private string $type; /** * @readonly - * @var string */ - private $oldProperty; + private string $oldProperty; /** * @readonly - * @var string */ - private $newProperty; + private string $newProperty; public function __construct(string $type, string $oldProperty, string $newProperty) { $this->type = $type; diff --git a/rules/Renaming/ValueObject/RenameStaticMethod.php b/rules/Renaming/ValueObject/RenameStaticMethod.php index c41ffb27c9c..668adef0c17 100644 --- a/rules/Renaming/ValueObject/RenameStaticMethod.php +++ b/rules/Renaming/ValueObject/RenameStaticMethod.php @@ -9,24 +9,20 @@ final class RenameStaticMethod { /** * @readonly - * @var string */ - private $oldClass; + private string $oldClass; /** * @readonly - * @var string */ - private $oldMethod; + private string $oldMethod; /** * @readonly - * @var string */ - private $newClass; + private string $newClass; /** * @readonly - * @var string */ - private $newMethod; + private string $newMethod; public function __construct(string $oldClass, string $oldMethod, string $newClass, string $newMethod) { $this->oldClass = $oldClass; diff --git a/rules/Strict/NodeAnalyzer/UnitializedPropertyAnalyzer.php b/rules/Strict/NodeAnalyzer/UnitializedPropertyAnalyzer.php index be84d8210f4..b7aa777c4d4 100644 --- a/rules/Strict/NodeAnalyzer/UnitializedPropertyAnalyzer.php +++ b/rules/Strict/NodeAnalyzer/UnitializedPropertyAnalyzer.php @@ -18,24 +18,20 @@ final class UnitializedPropertyAnalyzer { /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector */ - private $constructorAssignDetector; + private ConstructorAssignDetector $constructorAssignDetector; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(AstResolver $astResolver, NodeTypeResolver $nodeTypeResolver, ConstructorAssignDetector $constructorAssignDetector, NodeNameResolver $nodeNameResolver) { $this->astResolver = $astResolver; diff --git a/rules/Strict/NodeFactory/ExactCompareFactory.php b/rules/Strict/NodeFactory/ExactCompareFactory.php index 00279edb6b0..36af17dd593 100644 --- a/rules/Strict/NodeFactory/ExactCompareFactory.php +++ b/rules/Strict/NodeFactory/ExactCompareFactory.php @@ -3,10 +3,11 @@ declare (strict_types=1); namespace Rector\Strict\NodeFactory; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Arg; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\BinaryOp\BooleanAnd; use PhpParser\Node\Expr\BinaryOp\BooleanOr; use PhpParser\Node\Expr\BinaryOp\Identical; @@ -18,7 +19,6 @@ use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Instanceof_; use PhpParser\Node\Name; use PhpParser\Node\Name\FullyQualified; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; @@ -29,15 +29,14 @@ final class ExactCompareFactory { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; } /** - * @return \PhpParser\Node\Expr\BinaryOp\Identical|\PhpParser\Node\Expr\BinaryOp\BooleanOr|\PhpParser\Node\Expr\BinaryOp\NotIdentical|\PhpParser\Node\Expr\BooleanNot|\PhpParser\Node\Expr\Instanceof_|\PhpParser\Node\Expr\BinaryOp\BooleanAnd|null|\PhpParser\Node\Expr\FuncCall + * @return \PhpParser\Node\Expr\BinaryOp\Identical|\PhpParser\Node\Expr\BinaryOp\BooleanOr|\PhpParser\Node\Expr\BinaryOp\NotIdentical|\PhpParser\Node\Expr\BooleanNot|null|\PhpParser\Node\Expr\FuncCall */ public function createIdenticalFalsyCompare(Type $exprType, Expr $expr, bool $treatAsNonEmpty, bool $isOnlyString = \true) { @@ -48,7 +47,7 @@ final class ExactCompareFactory } $result = new BooleanOr(new Identical($expr, new String_('')), new Identical($expr, new String_('0'))); } elseif ($exprType->isInteger()->yes()) { - return new Identical($expr, new LNumber(0)); + return new Identical($expr, new Int_(0)); } elseif ($exprType->isBoolean()->yes()) { return new Identical($expr, $this->nodeFactory->createFalse()); } elseif ($exprType->isArray()->yes()) { @@ -66,7 +65,7 @@ final class ExactCompareFactory return $result; } /** - * @return \PhpParser\Node\Expr\BinaryOp\Identical|\PhpParser\Node\Expr\Instanceof_|\PhpParser\Node\Expr\BinaryOp\BooleanOr|\PhpParser\Node\Expr\BinaryOp\NotIdentical|\PhpParser\Node\Expr\BinaryOp\BooleanAnd|\PhpParser\Node\Expr\BooleanNot|null + * @return \PhpParser\Node\Expr\BinaryOp\Identical|\PhpParser\Node\Expr\Instanceof_|\PhpParser\Node\Expr\BinaryOp\NotIdentical|\PhpParser\Node\Expr\BinaryOp\BooleanAnd|\PhpParser\Node\Expr\BooleanNot|null */ public function createNotIdenticalFalsyCompare(Type $exprType, Expr $expr, bool $treatAsNotEmpty, bool $isOnlyString = \true) { @@ -77,7 +76,7 @@ final class ExactCompareFactory } $result = new BooleanAnd(new NotIdentical($expr, new String_('')), new NotIdentical($expr, new String_('0'))); } elseif ($exprType->isInteger()->yes()) { - return new NotIdentical($expr, new LNumber(0)); + return new NotIdentical($expr, new Int_(0)); } elseif ($exprType->isArray()->yes()) { return new NotIdentical($expr, new Array_([])); } elseif (!$exprType instanceof UnionType) { diff --git a/rules/Strict/Rector/AbstractFalsyScalarRuleFixerRector.php b/rules/Strict/Rector/AbstractFalsyScalarRuleFixerRector.php index 2456f95fc98..b2921b5c900 100644 --- a/rules/Strict/Rector/AbstractFalsyScalarRuleFixerRector.php +++ b/rules/Strict/Rector/AbstractFalsyScalarRuleFixerRector.php @@ -18,10 +18,7 @@ abstract class AbstractFalsyScalarRuleFixerRector extends AbstractRector impleme * @var string */ public const TREAT_AS_NON_EMPTY = 'treat_as_non_empty'; - /** - * @var bool - */ - protected $treatAsNonEmpty = \false; + protected bool $treatAsNonEmpty = \false; /** * @param mixed[] $configuration */ diff --git a/rules/Strict/Rector/BooleanNot/BooleanInBooleanNotRuleFixerRector.php b/rules/Strict/Rector/BooleanNot/BooleanInBooleanNotRuleFixerRector.php index bf131f0b495..45203cc6dff 100644 --- a/rules/Strict/Rector/BooleanNot/BooleanInBooleanNotRuleFixerRector.php +++ b/rules/Strict/Rector/BooleanNot/BooleanInBooleanNotRuleFixerRector.php @@ -21,9 +21,8 @@ final class BooleanInBooleanNotRuleFixerRector extends AbstractFalsyScalarRuleFi { /** * @readonly - * @var \Rector\Strict\NodeFactory\ExactCompareFactory */ - private $exactCompareFactory; + private ExactCompareFactory $exactCompareFactory; public function __construct(ExactCompareFactory $exactCompareFactory) { $this->exactCompareFactory = $exactCompareFactory; diff --git a/rules/Strict/Rector/Empty_/DisallowedEmptyRuleFixerRector.php b/rules/Strict/Rector/Empty_/DisallowedEmptyRuleFixerRector.php index 0337e834e59..abb8066bf57 100644 --- a/rules/Strict/Rector/Empty_/DisallowedEmptyRuleFixerRector.php +++ b/rules/Strict/Rector/Empty_/DisallowedEmptyRuleFixerRector.php @@ -27,19 +27,16 @@ final class DisallowedEmptyRuleFixerRector extends AbstractFalsyScalarRuleFixerR { /** * @readonly - * @var \Rector\Strict\NodeFactory\ExactCompareFactory */ - private $exactCompareFactory; + private ExactCompareFactory $exactCompareFactory; /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; /** * @readonly - * @var \Rector\Strict\NodeAnalyzer\UnitializedPropertyAnalyzer */ - private $unitializedPropertyAnalyzer; + private UnitializedPropertyAnalyzer $unitializedPropertyAnalyzer; public function __construct(ExactCompareFactory $exactCompareFactory, ExprAnalyzer $exprAnalyzer, UnitializedPropertyAnalyzer $unitializedPropertyAnalyzer) { $this->exactCompareFactory = $exactCompareFactory; diff --git a/rules/Strict/Rector/If_/BooleanInIfConditionRuleFixerRector.php b/rules/Strict/Rector/If_/BooleanInIfConditionRuleFixerRector.php index e3bb4db54bb..4cf2dd73ba4 100644 --- a/rules/Strict/Rector/If_/BooleanInIfConditionRuleFixerRector.php +++ b/rules/Strict/Rector/If_/BooleanInIfConditionRuleFixerRector.php @@ -22,9 +22,8 @@ final class BooleanInIfConditionRuleFixerRector extends AbstractFalsyScalarRuleF { /** * @readonly - * @var \Rector\Strict\NodeFactory\ExactCompareFactory */ - private $exactCompareFactory; + private ExactCompareFactory $exactCompareFactory; public function __construct(ExactCompareFactory $exactCompareFactory) { $this->exactCompareFactory = $exactCompareFactory; diff --git a/rules/Strict/Rector/Ternary/BooleanInTernaryOperatorRuleFixerRector.php b/rules/Strict/Rector/Ternary/BooleanInTernaryOperatorRuleFixerRector.php index 8d02e781ea5..838ee301f03 100644 --- a/rules/Strict/Rector/Ternary/BooleanInTernaryOperatorRuleFixerRector.php +++ b/rules/Strict/Rector/Ternary/BooleanInTernaryOperatorRuleFixerRector.php @@ -21,9 +21,8 @@ final class BooleanInTernaryOperatorRuleFixerRector extends AbstractFalsyScalarR { /** * @readonly - * @var \Rector\Strict\NodeFactory\ExactCompareFactory */ - private $exactCompareFactory; + private ExactCompareFactory $exactCompareFactory; public function __construct(ExactCompareFactory $exactCompareFactory) { $this->exactCompareFactory = $exactCompareFactory; diff --git a/rules/Strict/Rector/Ternary/DisallowedShortTernaryRuleFixerRector.php b/rules/Strict/Rector/Ternary/DisallowedShortTernaryRuleFixerRector.php index 754fd7bef5f..370a3fbbd06 100644 --- a/rules/Strict/Rector/Ternary/DisallowedShortTernaryRuleFixerRector.php +++ b/rules/Strict/Rector/Ternary/DisallowedShortTernaryRuleFixerRector.php @@ -23,13 +23,9 @@ final class DisallowedShortTernaryRuleFixerRector extends AbstractFalsyScalarRul { /** * @readonly - * @var \Rector\Strict\NodeFactory\ExactCompareFactory */ - private $exactCompareFactory; - /** - * @var bool - */ - private $hasChanged = \false; + private ExactCompareFactory $exactCompareFactory; + private bool $hasChanged = \false; public function __construct(ExactCompareFactory $exactCompareFactory) { $this->exactCompareFactory = $exactCompareFactory; diff --git a/rules/Transform/NodeAnalyzer/FuncCallStaticCallToMethodCallAnalyzer.php b/rules/Transform/NodeAnalyzer/FuncCallStaticCallToMethodCallAnalyzer.php index 9d61adee5db..1ecab243aaf 100644 --- a/rules/Transform/NodeAnalyzer/FuncCallStaticCallToMethodCallAnalyzer.php +++ b/rules/Transform/NodeAnalyzer/FuncCallStaticCallToMethodCallAnalyzer.php @@ -22,34 +22,28 @@ final class FuncCallStaticCallToMethodCallAnalyzer { /** * @readonly - * @var \Rector\Transform\NodeTypeAnalyzer\TypeProvidingExprFromClassResolver */ - private $typeProvidingExprFromClassResolver; + private TypeProvidingExprFromClassResolver $typeProvidingExprFromClassResolver; /** * @readonly - * @var \Rector\Naming\Naming\PropertyNaming */ - private $propertyNaming; + private PropertyNaming $propertyNaming; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \Rector\Transform\NodeFactory\PropertyFetchFactory */ - private $propertyFetchFactory; + private PropertyFetchFactory $propertyFetchFactory; /** * @readonly - * @var \Rector\NodeManipulator\ClassDependencyManipulator */ - private $classDependencyManipulator; + private ClassDependencyManipulator $classDependencyManipulator; public function __construct(TypeProvidingExprFromClassResolver $typeProvidingExprFromClassResolver, PropertyNaming $propertyNaming, NodeNameResolver $nodeNameResolver, NodeFactory $nodeFactory, PropertyFetchFactory $propertyFetchFactory, ClassDependencyManipulator $classDependencyManipulator) { $this->typeProvidingExprFromClassResolver = $typeProvidingExprFromClassResolver; diff --git a/rules/Transform/NodeFactory/PropertyFetchFactory.php b/rules/Transform/NodeFactory/PropertyFetchFactory.php index 8db027020fc..af6936edfd6 100644 --- a/rules/Transform/NodeFactory/PropertyFetchFactory.php +++ b/rules/Transform/NodeFactory/PropertyFetchFactory.php @@ -11,9 +11,8 @@ final class PropertyFetchFactory { /** * @readonly - * @var \Rector\Naming\Naming\PropertyNaming */ - private $propertyNaming; + private PropertyNaming $propertyNaming; public function __construct(PropertyNaming $propertyNaming) { $this->propertyNaming = $propertyNaming; diff --git a/rules/Transform/NodeTypeAnalyzer/TypeProvidingExprFromClassResolver.php b/rules/Transform/NodeTypeAnalyzer/TypeProvidingExprFromClassResolver.php index 709d3802b4d..9d18f3db6d8 100644 --- a/rules/Transform/NodeTypeAnalyzer/TypeProvidingExprFromClassResolver.php +++ b/rules/Transform/NodeTypeAnalyzer/TypeProvidingExprFromClassResolver.php @@ -26,19 +26,16 @@ final class TypeProvidingExprFromClassResolver { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Naming\Naming\PropertyNaming */ - private $propertyNaming; + private PropertyNaming $propertyNaming; public function __construct(ReflectionProvider $reflectionProvider, NodeNameResolver $nodeNameResolver, PropertyNaming $propertyNaming) { $this->reflectionProvider = $reflectionProvider; diff --git a/rules/Transform/Rector/ArrayDimFetch/ArrayDimFetchToMethodCallRector.php b/rules/Transform/Rector/ArrayDimFetch/ArrayDimFetchToMethodCallRector.php index d38d0c9752e..07d4e638747 100644 --- a/rules/Transform/Rector/ArrayDimFetch/ArrayDimFetchToMethodCallRector.php +++ b/rules/Transform/Rector/ArrayDimFetch/ArrayDimFetchToMethodCallRector.php @@ -22,7 +22,7 @@ class ArrayDimFetchToMethodCallRector extends AbstractRector implements Configur /** * @var ArrayDimFetchToMethodCall[] */ - private $arrayDimFetchToMethodCalls; + private array $arrayDimFetchToMethodCalls; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Change array dim fetch to method call', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/Assign/PropertyAssignToMethodCallRector.php b/rules/Transform/Rector/Assign/PropertyAssignToMethodCallRector.php index fa14360fcbf..2db57191644 100644 --- a/rules/Transform/Rector/Assign/PropertyAssignToMethodCallRector.php +++ b/rules/Transform/Rector/Assign/PropertyAssignToMethodCallRector.php @@ -21,7 +21,7 @@ final class PropertyAssignToMethodCallRector extends AbstractRector implements C /** * @var PropertyAssignToMethodCall[] */ - private $propertyAssignsToMethodCalls = []; + private array $propertyAssignsToMethodCalls = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Turns property assign of specific type and property name to method call', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/Assign/PropertyFetchToMethodCallRector.php b/rules/Transform/Rector/Assign/PropertyFetchToMethodCallRector.php index e0b5fb7876d..efcf6481585 100644 --- a/rules/Transform/Rector/Assign/PropertyFetchToMethodCallRector.php +++ b/rules/Transform/Rector/Assign/PropertyFetchToMethodCallRector.php @@ -22,7 +22,7 @@ final class PropertyFetchToMethodCallRector extends AbstractRector implements Co /** * @var PropertyFetchToMethodCall[] */ - private $propertiesToMethodCalls = []; + private array $propertiesToMethodCalls = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Replaces properties assign calls be defined methods.', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/Attribute/AttributeKeyToClassConstFetchRector.php b/rules/Transform/Rector/Attribute/AttributeKeyToClassConstFetchRector.php index c2e23ab77a8..c113521c4e3 100644 --- a/rules/Transform/Rector/Attribute/AttributeKeyToClassConstFetchRector.php +++ b/rules/Transform/Rector/Attribute/AttributeKeyToClassConstFetchRector.php @@ -31,13 +31,12 @@ final class AttributeKeyToClassConstFetchRector extends AbstractRector implement { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var AttributeKeyToClassConstFetch[] */ - private $attributeKeysToClassConstFetches = []; + private array $attributeKeysToClassConstFetches = []; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/rules/Transform/Rector/ClassMethod/ReturnTypeWillChangeRector.php b/rules/Transform/Rector/ClassMethod/ReturnTypeWillChangeRector.php index 8b096a17acf..bacb1476d1c 100644 --- a/rules/Transform/Rector/ClassMethod/ReturnTypeWillChangeRector.php +++ b/rules/Transform/Rector/ClassMethod/ReturnTypeWillChangeRector.php @@ -25,23 +25,20 @@ final class ReturnTypeWillChangeRector extends AbstractRector implements MinPhpV { /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @var ClassMethodReference[] */ - private $returnTypeChangedClassMethodReferences = []; + private array $returnTypeChangedClassMethodReferences = []; public function __construct(PhpAttributeAnalyzer $phpAttributeAnalyzer, PhpAttributeGroupFactory $phpAttributeGroupFactory, ReflectionResolver $reflectionResolver) { $this->phpAttributeAnalyzer = $phpAttributeAnalyzer; diff --git a/rules/Transform/Rector/ClassMethod/WrapReturnRector.php b/rules/Transform/Rector/ClassMethod/WrapReturnRector.php index 965b7a21904..e0882ba6b76 100644 --- a/rules/Transform/Rector/ClassMethod/WrapReturnRector.php +++ b/rules/Transform/Rector/ClassMethod/WrapReturnRector.php @@ -6,7 +6,7 @@ namespace Rector\Transform\Rector\ClassMethod; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Return_; @@ -24,7 +24,7 @@ final class WrapReturnRector extends AbstractRector implements ConfigurableRecto /** * @var WrapReturn[] */ - private $typeMethodWraps = []; + private array $typeMethodWraps = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Wrap return value of specific method', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/Class_/AddAllowDynamicPropertiesAttributeRector.php b/rules/Transform/Rector/Class_/AddAllowDynamicPropertiesAttributeRector.php index 40e47d9ae7f..078134af8a4 100644 --- a/rules/Transform/Rector/Class_/AddAllowDynamicPropertiesAttributeRector.php +++ b/rules/Transform/Rector/Class_/AddAllowDynamicPropertiesAttributeRector.php @@ -26,28 +26,24 @@ final class AddAllowDynamicPropertiesAttributeRector extends AbstractRector impl { /** * @readonly - * @var \Rector\FamilyTree\Reflection\FamilyRelationsAnalyzer */ - private $familyRelationsAnalyzer; + private FamilyRelationsAnalyzer $familyRelationsAnalyzer; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @var array */ - private $transformOnNamespaces = []; + private array $transformOnNamespaces = []; public function __construct(FamilyRelationsAnalyzer $familyRelationsAnalyzer, PhpAttributeAnalyzer $phpAttributeAnalyzer, PhpAttributeGroupFactory $phpAttributeGroupFactory, ReflectionProvider $reflectionProvider) { $this->familyRelationsAnalyzer = $familyRelationsAnalyzer; @@ -144,9 +140,7 @@ CODE_SAMPLE } private function isExistsWithWildCards(string $className) : bool { - $wildcardTransformOnNamespaces = \array_filter($this->transformOnNamespaces, static function (string $transformOnNamespace) : bool { - return \strpos($transformOnNamespace, '*') !== \false; - }); + $wildcardTransformOnNamespaces = \array_filter($this->transformOnNamespaces, static fn(string $transformOnNamespace): bool => \strpos($transformOnNamespace, '*') !== \false); foreach ($wildcardTransformOnNamespaces as $wildcardTransformOnNamespace) { if (!\fnmatch($wildcardTransformOnNamespace, $className, \FNM_NOESCAPE)) { continue; @@ -157,9 +151,7 @@ CODE_SAMPLE } private function isExistsWithClassName(string $className) : bool { - $transformedClassNames = \array_filter($this->transformOnNamespaces, static function (string $transformOnNamespace) : bool { - return \strpos($transformOnNamespace, '*') === \false; - }); + $transformedClassNames = \array_filter($this->transformOnNamespaces, static fn(string $transformOnNamespace): bool => \strpos($transformOnNamespace, '*') === \false); foreach ($transformedClassNames as $transformedClassName) { if (!$this->nodeNameResolver->isStringName($className, $transformedClassName)) { continue; diff --git a/rules/Transform/Rector/Class_/AddInterfaceByTraitRector.php b/rules/Transform/Rector/Class_/AddInterfaceByTraitRector.php index c25379122b9..152e85ad546 100644 --- a/rules/Transform/Rector/Class_/AddInterfaceByTraitRector.php +++ b/rules/Transform/Rector/Class_/AddInterfaceByTraitRector.php @@ -22,7 +22,7 @@ final class AddInterfaceByTraitRector extends AbstractRector implements Configur /** * @var array */ - private $interfaceByTrait = []; + private array $interfaceByTrait = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Add interface by used trait', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/Class_/MergeInterfacesRector.php b/rules/Transform/Rector/Class_/MergeInterfacesRector.php index f74e91a6f03..e5a65df11b4 100644 --- a/rules/Transform/Rector/Class_/MergeInterfacesRector.php +++ b/rules/Transform/Rector/Class_/MergeInterfacesRector.php @@ -24,7 +24,7 @@ final class MergeInterfacesRector extends AbstractRector implements Configurable /** * @var array */ - private $oldToNewInterfaces = []; + private array $oldToNewInterfaces = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Merges old interface to a new one, that already has its methods', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/Class_/ParentClassToTraitsRector.php b/rules/Transform/Rector/Class_/ParentClassToTraitsRector.php index 0361e115f52..ab3c6333e98 100644 --- a/rules/Transform/Rector/Class_/ParentClassToTraitsRector.php +++ b/rules/Transform/Rector/Class_/ParentClassToTraitsRector.php @@ -26,13 +26,12 @@ final class ParentClassToTraitsRector extends AbstractRector implements Configur { /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @var ParentClassToTraits[] */ - private $parentClassToTraits = []; + private array $parentClassToTraits = []; public function __construct(ClassAnalyzer $classAnalyzer) { $this->classAnalyzer = $classAnalyzer; diff --git a/rules/Transform/Rector/ConstFetch/ConstFetchToClassConstFetchRector.php b/rules/Transform/Rector/ConstFetch/ConstFetchToClassConstFetchRector.php index 33d5bc447ae..09fd5564aa3 100644 --- a/rules/Transform/Rector/ConstFetch/ConstFetchToClassConstFetchRector.php +++ b/rules/Transform/Rector/ConstFetch/ConstFetchToClassConstFetchRector.php @@ -20,7 +20,7 @@ final class ConstFetchToClassConstFetchRector extends AbstractRector implements /** * @var ConstFetchToClassConstFetch[] */ - private $constFetchToClassConsts = []; + private array $constFetchToClassConsts = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Change const fetch to class const fetch', [new ConfiguredCodeSample('$x = CONTEXT_COURSE', '$x = course::LEVEL', [new ConstFetchToClassConstFetch('CONTEXT_COURSE', 'course', 'LEVEL')])]); diff --git a/rules/Transform/Rector/FileWithoutNamespace/RectorConfigBuilderRector.php b/rules/Transform/Rector/FileWithoutNamespace/RectorConfigBuilderRector.php index 017107dd67b..ee5a09338f0 100644 --- a/rules/Transform/Rector/FileWithoutNamespace/RectorConfigBuilderRector.php +++ b/rules/Transform/Rector/FileWithoutNamespace/RectorConfigBuilderRector.php @@ -5,7 +5,7 @@ namespace Rector\Transform\Rector\FileWithoutNamespace; use PhpParser\Node; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\StaticCall; diff --git a/rules/Transform/Rector/FuncCall/FuncCallToConstFetchRector.php b/rules/Transform/Rector/FuncCall/FuncCallToConstFetchRector.php index cea9ec90532..4c023baac54 100644 --- a/rules/Transform/Rector/FuncCall/FuncCallToConstFetchRector.php +++ b/rules/Transform/Rector/FuncCall/FuncCallToConstFetchRector.php @@ -20,7 +20,7 @@ final class FuncCallToConstFetchRector extends AbstractRector implements Configu /** * @var string[] */ - private $functionsToConstants = []; + private array $functionsToConstants = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Changes use of function calls to use constants', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/FuncCall/FuncCallToMethodCallRector.php b/rules/Transform/Rector/FuncCall/FuncCallToMethodCallRector.php index 3d7aa9878c5..c2889229db6 100644 --- a/rules/Transform/Rector/FuncCall/FuncCallToMethodCallRector.php +++ b/rules/Transform/Rector/FuncCall/FuncCallToMethodCallRector.php @@ -20,13 +20,12 @@ final class FuncCallToMethodCallRector extends AbstractRector implements Configu { /** * @readonly - * @var \Rector\Transform\NodeAnalyzer\FuncCallStaticCallToMethodCallAnalyzer */ - private $funcCallStaticCallToMethodCallAnalyzer; + private FuncCallStaticCallToMethodCallAnalyzer $funcCallStaticCallToMethodCallAnalyzer; /** * @var FuncCallToMethodCall[] */ - private $funcNameToMethodCallNames = []; + private array $funcNameToMethodCallNames = []; public function __construct(FuncCallStaticCallToMethodCallAnalyzer $funcCallStaticCallToMethodCallAnalyzer) { $this->funcCallStaticCallToMethodCallAnalyzer = $funcCallStaticCallToMethodCallAnalyzer; diff --git a/rules/Transform/Rector/FuncCall/FuncCallToNewRector.php b/rules/Transform/Rector/FuncCall/FuncCallToNewRector.php index 1a21066b563..51507ef030a 100644 --- a/rules/Transform/Rector/FuncCall/FuncCallToNewRector.php +++ b/rules/Transform/Rector/FuncCall/FuncCallToNewRector.php @@ -20,7 +20,7 @@ final class FuncCallToNewRector extends AbstractRector implements ConfigurableRe /** * @var string[] */ - private $functionToNew = []; + private array $functionToNew = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Change configured function calls to new Instance', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/FuncCall/FuncCallToStaticCallRector.php b/rules/Transform/Rector/FuncCall/FuncCallToStaticCallRector.php index 6cb07932a14..31295e7cdd9 100644 --- a/rules/Transform/Rector/FuncCall/FuncCallToStaticCallRector.php +++ b/rules/Transform/Rector/FuncCall/FuncCallToStaticCallRector.php @@ -19,7 +19,7 @@ final class FuncCallToStaticCallRector extends AbstractRector implements Configu /** * @var FuncCallToStaticCall[] */ - private $funcCallsToStaticCalls = []; + private array $funcCallsToStaticCalls = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Turns defined function call to static method call.', [new ConfiguredCodeSample('view("...", []);', 'SomeClass::render("...", []);', [new FuncCallToStaticCall('view', 'SomeStaticClass', 'render')])]); diff --git a/rules/Transform/Rector/MethodCall/MethodCallToFuncCallRector.php b/rules/Transform/Rector/MethodCall/MethodCallToFuncCallRector.php index 495a7768197..260dc81f5c1 100644 --- a/rules/Transform/Rector/MethodCall/MethodCallToFuncCallRector.php +++ b/rules/Transform/Rector/MethodCall/MethodCallToFuncCallRector.php @@ -22,7 +22,7 @@ final class MethodCallToFuncCallRector extends AbstractRector implements Configu /** * @var MethodCallToFuncCall[] */ - private $methodCallsToFuncCalls = []; + private array $methodCallsToFuncCalls = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Change method call to function call', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/MethodCall/MethodCallToNewRector.php b/rules/Transform/Rector/MethodCall/MethodCallToNewRector.php index 72cac86abaa..e95379f250e 100644 --- a/rules/Transform/Rector/MethodCall/MethodCallToNewRector.php +++ b/rules/Transform/Rector/MethodCall/MethodCallToNewRector.php @@ -22,7 +22,7 @@ class MethodCallToNewRector extends AbstractRector implements ConfigurableRector /** * @var MethodCallToNew[] */ - private $methodCallToNew; + private array $methodCallToNew; /** * @param MethodCallToNew[] $configuration */ diff --git a/rules/Transform/Rector/MethodCall/MethodCallToPropertyFetchRector.php b/rules/Transform/Rector/MethodCall/MethodCallToPropertyFetchRector.php index 83bfba916db..ac4ac001715 100644 --- a/rules/Transform/Rector/MethodCall/MethodCallToPropertyFetchRector.php +++ b/rules/Transform/Rector/MethodCall/MethodCallToPropertyFetchRector.php @@ -19,7 +19,7 @@ final class MethodCallToPropertyFetchRector extends AbstractRector implements Co /** * @var MethodCallToPropertyFetch[] */ - private $methodCallsToPropertyFetches = []; + private array $methodCallsToPropertyFetches = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Turns method call "$this->getFirstname()" to property fetch "$this->firstname"', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/MethodCall/MethodCallToStaticCallRector.php b/rules/Transform/Rector/MethodCall/MethodCallToStaticCallRector.php index 0f9d1f82d1d..c114e6b22ae 100644 --- a/rules/Transform/Rector/MethodCall/MethodCallToStaticCallRector.php +++ b/rules/Transform/Rector/MethodCall/MethodCallToStaticCallRector.php @@ -19,7 +19,7 @@ final class MethodCallToStaticCallRector extends AbstractRector implements Confi /** * @var MethodCallToStaticCall[] */ - private $methodCallsToStaticCalls = []; + private array $methodCallsToStaticCalls = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Change method call to desired static call', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/MethodCall/ReplaceParentCallByPropertyCallRector.php b/rules/Transform/Rector/MethodCall/ReplaceParentCallByPropertyCallRector.php index 1edd7dd0c42..084f7da2361 100644 --- a/rules/Transform/Rector/MethodCall/ReplaceParentCallByPropertyCallRector.php +++ b/rules/Transform/Rector/MethodCall/ReplaceParentCallByPropertyCallRector.php @@ -19,7 +19,7 @@ final class ReplaceParentCallByPropertyCallRector extends AbstractRector impleme /** * @var ReplaceParentCallByPropertyCall[] */ - private $parentCallToProperties = []; + private array $parentCallToProperties = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Changes method calls in child of specific types to defined property method call', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/New_/NewToStaticCallRector.php b/rules/Transform/Rector/New_/NewToStaticCallRector.php index bce70c9fea3..72b6d4890bd 100644 --- a/rules/Transform/Rector/New_/NewToStaticCallRector.php +++ b/rules/Transform/Rector/New_/NewToStaticCallRector.php @@ -19,7 +19,7 @@ final class NewToStaticCallRector extends AbstractRector implements Configurable /** * @var NewToStaticCall[] */ - private $typeToStaticCalls = []; + private array $typeToStaticCalls = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Change new Object to static call', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/Scalar/ScalarValueToConstFetchRector.php b/rules/Transform/Rector/Scalar/ScalarValueToConstFetchRector.php index b16f0ea5717..975a07a6c1d 100644 --- a/rules/Transform/Rector/Scalar/ScalarValueToConstFetchRector.php +++ b/rules/Transform/Rector/Scalar/ScalarValueToConstFetchRector.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\Transform\Rector\Scalar; +use PhpParser\Node\Scalar\Int_; +use PhpParser\Node\Scalar\Float_; use PhpParser\Node; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Identifier; use PhpParser\Node\Name\FullyQualified; -use PhpParser\Node\Scalar\DNumber; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use Rector\Contract\Rector\ConfigurableRectorInterface; use Rector\Rector\AbstractRector; @@ -25,7 +25,7 @@ class ScalarValueToConstFetchRector extends AbstractRector implements Configurab /** * @var ScalarValueToConstFetch[] */ - private $scalarValueToConstFetches; + private array $scalarValueToConstFetches; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Replaces Scalar values with a ConstFetch or ClassConstFetch', [new ConfiguredCodeSample(<<<'SAMPLE' @@ -34,14 +34,14 @@ SAMPLE , <<<'SAMPLE' $var = \SomeClass::FOOBAR_INT; SAMPLE -, [new ScalarValueToConstFetch(new LNumber(10), new ClassConstFetch(new FullyQualified('SomeClass'), new Identifier('FOOBAR_INT')))])]); +, [new ScalarValueToConstFetch(new Int_(10), new ClassConstFetch(new FullyQualified('SomeClass'), new Identifier('FOOBAR_INT')))])]); } public function getNodeTypes() : array { - return [String_::class, DNumber::class, LNumber::class]; + return [String_::class, Float_::class, Int_::class]; } /** - * @param String_|DNumber|LNumber $node + * @param String_|Float_|Int_ $node * @return \PhpParser\Node\Expr\ConstFetch|\PhpParser\Node\Expr\ClassConstFetch|null */ public function refactor(Node $node) diff --git a/rules/Transform/Rector/StaticCall/StaticCallToFuncCallRector.php b/rules/Transform/Rector/StaticCall/StaticCallToFuncCallRector.php index e9592304402..c232b3d4113 100644 --- a/rules/Transform/Rector/StaticCall/StaticCallToFuncCallRector.php +++ b/rules/Transform/Rector/StaticCall/StaticCallToFuncCallRector.php @@ -21,7 +21,7 @@ final class StaticCallToFuncCallRector extends AbstractRector implements Configu /** * @var StaticCallToFuncCall[] */ - private $staticCallsToFunctions = []; + private array $staticCallsToFunctions = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Turns static call to function call.', [new ConfiguredCodeSample('OldClass::oldMethod("args");', 'new_function("args");', [new StaticCallToFuncCall('OldClass', 'oldMethod', 'new_function')])]); diff --git a/rules/Transform/Rector/StaticCall/StaticCallToMethodCallRector.php b/rules/Transform/Rector/StaticCall/StaticCallToMethodCallRector.php index 34b1a1d2e76..d37014c5906 100644 --- a/rules/Transform/Rector/StaticCall/StaticCallToMethodCallRector.php +++ b/rules/Transform/Rector/StaticCall/StaticCallToMethodCallRector.php @@ -24,13 +24,12 @@ final class StaticCallToMethodCallRector extends AbstractRector implements Confi { /** * @readonly - * @var \Rector\Transform\NodeAnalyzer\FuncCallStaticCallToMethodCallAnalyzer */ - private $funcCallStaticCallToMethodCallAnalyzer; + private FuncCallStaticCallToMethodCallAnalyzer $funcCallStaticCallToMethodCallAnalyzer; /** * @var StaticCallToMethodCall[] */ - private $staticCallsToMethodCalls = []; + private array $staticCallsToMethodCalls = []; public function __construct(FuncCallStaticCallToMethodCallAnalyzer $funcCallStaticCallToMethodCallAnalyzer) { $this->funcCallStaticCallToMethodCallAnalyzer = $funcCallStaticCallToMethodCallAnalyzer; diff --git a/rules/Transform/Rector/StaticCall/StaticCallToNewRector.php b/rules/Transform/Rector/StaticCall/StaticCallToNewRector.php index 987098c0c6a..a5ced1b6d5f 100644 --- a/rules/Transform/Rector/StaticCall/StaticCallToNewRector.php +++ b/rules/Transform/Rector/StaticCall/StaticCallToNewRector.php @@ -21,7 +21,7 @@ final class StaticCallToNewRector extends AbstractRector implements Configurable /** * @var StaticCallToNew[] */ - private $staticCallsToNews = []; + private array $staticCallsToNews = []; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Change static call to new instance', [new ConfiguredCodeSample(<<<'CODE_SAMPLE' diff --git a/rules/Transform/Rector/String_/StringToClassConstantRector.php b/rules/Transform/Rector/String_/StringToClassConstantRector.php index 52a2105efaf..068c1fdf463 100644 --- a/rules/Transform/Rector/String_/StringToClassConstantRector.php +++ b/rules/Transform/Rector/String_/StringToClassConstantRector.php @@ -19,13 +19,12 @@ final class StringToClassConstantRector extends AbstractRector implements Config { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var StringToClassConstant[] */ - private $stringsToClassConstants = []; + private array $stringsToClassConstants = []; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; @@ -70,7 +69,7 @@ CODE_SAMPLE } return $this->nodeFactory->createClassConstFetch($stringToClassConstant->getClass(), $stringToClassConstant->getConstant()); } - return $node; + return null; } /** * @param mixed[] $configuration diff --git a/rules/Transform/ValueObject/ArrayDimFetchToMethodCall.php b/rules/Transform/ValueObject/ArrayDimFetchToMethodCall.php index c0850b3447b..3c6051d5a35 100644 --- a/rules/Transform/ValueObject/ArrayDimFetchToMethodCall.php +++ b/rules/Transform/ValueObject/ArrayDimFetchToMethodCall.php @@ -8,14 +8,12 @@ class ArrayDimFetchToMethodCall { /** * @readonly - * @var \PHPStan\Type\ObjectType */ - private $objectType; + private ObjectType $objectType; /** * @readonly - * @var string */ - private $method; + private string $method; public function __construct(ObjectType $objectType, string $method) { $this->objectType = $objectType; diff --git a/rules/Transform/ValueObject/AttributeKeyToClassConstFetch.php b/rules/Transform/ValueObject/AttributeKeyToClassConstFetch.php index 8ace355268c..d444ee0ba23 100644 --- a/rules/Transform/ValueObject/AttributeKeyToClassConstFetch.php +++ b/rules/Transform/ValueObject/AttributeKeyToClassConstFetch.php @@ -7,24 +7,21 @@ final class AttributeKeyToClassConstFetch { /** * @readonly - * @var string */ - private $attributeClass; + private string $attributeClass; /** * @readonly - * @var string */ - private $attributeKey; + private string $attributeKey; /** * @readonly - * @var string */ - private $constantClass; + private string $constantClass; /** * @var array * @readonly */ - private $valuesToConstantsMap; + private array $valuesToConstantsMap; /** * @param array $valuesToConstantsMap */ diff --git a/rules/Transform/ValueObject/ClassMethodReference.php b/rules/Transform/ValueObject/ClassMethodReference.php index 1e13bc8106a..47f6512d6fc 100644 --- a/rules/Transform/ValueObject/ClassMethodReference.php +++ b/rules/Transform/ValueObject/ClassMethodReference.php @@ -8,14 +8,12 @@ final class ClassMethodReference { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $method; + private string $method; public function __construct(string $class, string $method) { $this->class = $class; diff --git a/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php b/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php index bd42f267b99..919b0e0cf0b 100644 --- a/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php +++ b/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php @@ -8,19 +8,16 @@ final class ConstFetchToClassConstFetch { /** * @readonly - * @var string */ - private $oldConstName; + private string $oldConstName; /** * @readonly - * @var string */ - private $newClassName; + private string $newClassName; /** * @readonly - * @var string */ - private $newConstName; + private string $newConstName; public function __construct(string $oldConstName, string $newClassName, string $newConstName) { $this->oldConstName = $oldConstName; diff --git a/rules/Transform/ValueObject/FuncCallToMethodCall.php b/rules/Transform/ValueObject/FuncCallToMethodCall.php index aba2a1d425f..61297ec5a00 100644 --- a/rules/Transform/ValueObject/FuncCallToMethodCall.php +++ b/rules/Transform/ValueObject/FuncCallToMethodCall.php @@ -9,19 +9,16 @@ final class FuncCallToMethodCall { /** * @readonly - * @var string */ - private $oldFuncName; + private string $oldFuncName; /** * @readonly - * @var string */ - private $newClassName; + private string $newClassName; /** * @readonly - * @var string */ - private $newMethodName; + private string $newMethodName; public function __construct(string $oldFuncName, string $newClassName, string $newMethodName) { $this->oldFuncName = $oldFuncName; diff --git a/rules/Transform/ValueObject/FuncCallToStaticCall.php b/rules/Transform/ValueObject/FuncCallToStaticCall.php index 6cc9c97399c..bfa4e5d640a 100644 --- a/rules/Transform/ValueObject/FuncCallToStaticCall.php +++ b/rules/Transform/ValueObject/FuncCallToStaticCall.php @@ -8,19 +8,16 @@ final class FuncCallToStaticCall { /** * @readonly - * @var string */ - private $oldFuncName; + private string $oldFuncName; /** * @readonly - * @var string */ - private $newClassName; + private string $newClassName; /** * @readonly - * @var string */ - private $newMethodName; + private string $newMethodName; public function __construct(string $oldFuncName, string $newClassName, string $newMethodName) { $this->oldFuncName = $oldFuncName; diff --git a/rules/Transform/ValueObject/MethodCallToFuncCall.php b/rules/Transform/ValueObject/MethodCallToFuncCall.php index 58f13b66494..ac06765425a 100644 --- a/rules/Transform/ValueObject/MethodCallToFuncCall.php +++ b/rules/Transform/ValueObject/MethodCallToFuncCall.php @@ -7,19 +7,16 @@ final class MethodCallToFuncCall { /** * @readonly - * @var string */ - private $objectType; + private string $objectType; /** * @readonly - * @var string */ - private $methodName; + private string $methodName; /** * @readonly - * @var string */ - private $functionName; + private string $functionName; public function __construct(string $objectType, string $methodName, string $functionName) { $this->objectType = $objectType; diff --git a/rules/Transform/ValueObject/MethodCallToNew.php b/rules/Transform/ValueObject/MethodCallToNew.php index 16081016ed2..140cc21edfe 100644 --- a/rules/Transform/ValueObject/MethodCallToNew.php +++ b/rules/Transform/ValueObject/MethodCallToNew.php @@ -8,19 +8,17 @@ final class MethodCallToNew { /** * @readonly - * @var \PHPStan\Type\ObjectType */ - private $objectType; + private ObjectType $objectType; /** * @readonly - * @var string */ - private $methodName; + private string $methodName; /** * @var class-string * @readonly */ - private $newClassString; + private string $newClassString; /** * @param class-string $newClassString */ diff --git a/rules/Transform/ValueObject/MethodCallToPropertyFetch.php b/rules/Transform/ValueObject/MethodCallToPropertyFetch.php index ae6d49ebf60..44b613d89f2 100644 --- a/rules/Transform/ValueObject/MethodCallToPropertyFetch.php +++ b/rules/Transform/ValueObject/MethodCallToPropertyFetch.php @@ -9,19 +9,16 @@ final class MethodCallToPropertyFetch { /** * @readonly - * @var string */ - private $oldType; + private string $oldType; /** * @readonly - * @var string */ - private $oldMethod; + private string $oldMethod; /** * @readonly - * @var string */ - private $newProperty; + private string $newProperty; public function __construct(string $oldType, string $oldMethod, string $newProperty) { $this->oldType = $oldType; diff --git a/rules/Transform/ValueObject/MethodCallToStaticCall.php b/rules/Transform/ValueObject/MethodCallToStaticCall.php index 20d4ca8b7d8..32a1db79908 100644 --- a/rules/Transform/ValueObject/MethodCallToStaticCall.php +++ b/rules/Transform/ValueObject/MethodCallToStaticCall.php @@ -9,24 +9,20 @@ final class MethodCallToStaticCall { /** * @readonly - * @var string */ - private $oldClass; + private string $oldClass; /** * @readonly - * @var string */ - private $oldMethod; + private string $oldMethod; /** * @readonly - * @var string */ - private $newClass; + private string $newClass; /** * @readonly - * @var string */ - private $newMethod; + private string $newMethod; public function __construct(string $oldClass, string $oldMethod, string $newClass, string $newMethod) { $this->oldClass = $oldClass; diff --git a/rules/Transform/ValueObject/NewToStaticCall.php b/rules/Transform/ValueObject/NewToStaticCall.php index e29c271d519..5f27e332d90 100644 --- a/rules/Transform/ValueObject/NewToStaticCall.php +++ b/rules/Transform/ValueObject/NewToStaticCall.php @@ -9,19 +9,16 @@ final class NewToStaticCall { /** * @readonly - * @var string */ - private $type; + private string $type; /** * @readonly - * @var string */ - private $staticCallClass; + private string $staticCallClass; /** * @readonly - * @var string */ - private $staticCallMethod; + private string $staticCallMethod; public function __construct(string $type, string $staticCallClass, string $staticCallMethod) { $this->type = $type; diff --git a/rules/Transform/ValueObject/ParentClassToTraits.php b/rules/Transform/ValueObject/ParentClassToTraits.php index 05aa6aafa37..7e498dad9a8 100644 --- a/rules/Transform/ValueObject/ParentClassToTraits.php +++ b/rules/Transform/ValueObject/ParentClassToTraits.php @@ -9,14 +9,13 @@ final class ParentClassToTraits { /** * @readonly - * @var string */ - private $parentType; + private string $parentType; /** * @var string[] * @readonly */ - private $traitNames; + private array $traitNames; /** * @param string[] $traitNames */ diff --git a/rules/Transform/ValueObject/PropertyAssignToMethodCall.php b/rules/Transform/ValueObject/PropertyAssignToMethodCall.php index c39c9518470..a66e9e3c57e 100644 --- a/rules/Transform/ValueObject/PropertyAssignToMethodCall.php +++ b/rules/Transform/ValueObject/PropertyAssignToMethodCall.php @@ -9,19 +9,16 @@ final class PropertyAssignToMethodCall { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $oldPropertyName; + private string $oldPropertyName; /** * @readonly - * @var string */ - private $newMethodName; + private string $newMethodName; public function __construct(string $class, string $oldPropertyName, string $newMethodName) { $this->class = $class; diff --git a/rules/Transform/ValueObject/PropertyFetchToMethodCall.php b/rules/Transform/ValueObject/PropertyFetchToMethodCall.php index f15fda48103..2aa1925c7ec 100644 --- a/rules/Transform/ValueObject/PropertyFetchToMethodCall.php +++ b/rules/Transform/ValueObject/PropertyFetchToMethodCall.php @@ -9,29 +9,25 @@ final class PropertyFetchToMethodCall { /** * @readonly - * @var string */ - private $oldType; + private string $oldType; /** * @readonly - * @var string */ - private $oldProperty; + private string $oldProperty; /** * @readonly - * @var string */ - private $newGetMethod; + private string $newGetMethod; /** * @readonly - * @var string|null */ - private $newSetMethod; + private ?string $newSetMethod = null; /** * @var mixed[] * @readonly */ - private $newGetArguments = []; + private array $newGetArguments = []; /** * @param mixed[] $newGetArguments */ diff --git a/rules/Transform/ValueObject/ReplaceParentCallByPropertyCall.php b/rules/Transform/ValueObject/ReplaceParentCallByPropertyCall.php index c5f5cf8d0d6..7ab9ef8ca9a 100644 --- a/rules/Transform/ValueObject/ReplaceParentCallByPropertyCall.php +++ b/rules/Transform/ValueObject/ReplaceParentCallByPropertyCall.php @@ -9,19 +9,16 @@ final class ReplaceParentCallByPropertyCall { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $method; + private string $method; /** * @readonly - * @var string */ - private $property; + private string $property; public function __construct(string $class, string $method, string $property) { $this->class = $class; diff --git a/rules/Transform/ValueObject/ScalarValueToConstFetch.php b/rules/Transform/ValueObject/ScalarValueToConstFetch.php index 14a839a8de5..bf12b0dc496 100644 --- a/rules/Transform/ValueObject/ScalarValueToConstFetch.php +++ b/rules/Transform/ValueObject/ScalarValueToConstFetch.php @@ -3,16 +3,16 @@ declare (strict_types=1); namespace Rector\Transform\ValueObject; +use PhpParser\Node\Scalar\Float_; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\ConstFetch; -use PhpParser\Node\Scalar\DNumber; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; final class ScalarValueToConstFetch { /** * @readonly - * @var \PhpParser\Node\Scalar\DNumber|\PhpParser\Node\Scalar\String_|\PhpParser\Node\Scalar\LNumber + * @var \PhpParser\Node\Scalar\Float_|\PhpParser\Node\Scalar\String_|\PhpParser\Node\Scalar\Int_ */ private $scalar; /** @@ -21,7 +21,7 @@ final class ScalarValueToConstFetch */ private $constFetch; /** - * @param \PhpParser\Node\Scalar\DNumber|\PhpParser\Node\Scalar\String_|\PhpParser\Node\Scalar\LNumber $scalar + * @param \PhpParser\Node\Scalar\Float_|\PhpParser\Node\Scalar\String_|\PhpParser\Node\Scalar\Int_ $scalar * @param \PhpParser\Node\Expr\ConstFetch|\PhpParser\Node\Expr\ClassConstFetch $constFetch */ public function __construct($scalar, $constFetch) @@ -30,7 +30,7 @@ final class ScalarValueToConstFetch $this->constFetch = $constFetch; } /** - * @return \PhpParser\Node\Scalar\DNumber|\PhpParser\Node\Scalar\String_|\PhpParser\Node\Scalar\LNumber + * @return \PhpParser\Node\Scalar\Float_|\PhpParser\Node\Scalar\String_|\PhpParser\Node\Scalar\Int_ */ public function getScalar() { diff --git a/rules/Transform/ValueObject/StaticCallToFuncCall.php b/rules/Transform/ValueObject/StaticCallToFuncCall.php index dbe2948a89e..eeef7454ebc 100644 --- a/rules/Transform/ValueObject/StaticCallToFuncCall.php +++ b/rules/Transform/ValueObject/StaticCallToFuncCall.php @@ -9,19 +9,16 @@ final class StaticCallToFuncCall { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $method; + private string $method; /** * @readonly - * @var string */ - private $function; + private string $function; public function __construct(string $class, string $method, string $function) { $this->class = $class; diff --git a/rules/Transform/ValueObject/StaticCallToMethodCall.php b/rules/Transform/ValueObject/StaticCallToMethodCall.php index 1946a62393b..66357653355 100644 --- a/rules/Transform/ValueObject/StaticCallToMethodCall.php +++ b/rules/Transform/ValueObject/StaticCallToMethodCall.php @@ -12,24 +12,20 @@ final class StaticCallToMethodCall { /** * @readonly - * @var string */ - private $staticClass; + private string $staticClass; /** * @readonly - * @var string */ - private $staticMethod; + private string $staticMethod; /** * @readonly - * @var string */ - private $classType; + private string $classType; /** * @readonly - * @var string */ - private $methodName; + private string $methodName; public function __construct(string $staticClass, string $staticMethod, string $classType, string $methodName) { $this->staticClass = $staticClass; diff --git a/rules/Transform/ValueObject/StaticCallToNew.php b/rules/Transform/ValueObject/StaticCallToNew.php index 9906b95ddc9..526a5acfb19 100644 --- a/rules/Transform/ValueObject/StaticCallToNew.php +++ b/rules/Transform/ValueObject/StaticCallToNew.php @@ -8,14 +8,12 @@ final class StaticCallToNew { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $method; + private string $method; public function __construct(string $class, string $method) { $this->class = $class; diff --git a/rules/Transform/ValueObject/StringToClassConstant.php b/rules/Transform/ValueObject/StringToClassConstant.php index 9aa0d4d444a..5d299b3bd51 100644 --- a/rules/Transform/ValueObject/StringToClassConstant.php +++ b/rules/Transform/ValueObject/StringToClassConstant.php @@ -8,19 +8,16 @@ final class StringToClassConstant { /** * @readonly - * @var string */ - private $string; + private string $string; /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $constant; + private string $constant; public function __construct(string $string, string $class, string $constant) { $this->string = $string; diff --git a/rules/Transform/ValueObject/WrapReturn.php b/rules/Transform/ValueObject/WrapReturn.php index e386759dbe0..a082975a2ee 100644 --- a/rules/Transform/ValueObject/WrapReturn.php +++ b/rules/Transform/ValueObject/WrapReturn.php @@ -9,19 +9,16 @@ final class WrapReturn { /** * @readonly - * @var string */ - private $type; + private string $type; /** * @readonly - * @var string */ - private $method; + private string $method; /** * @readonly - * @var bool */ - private $isArrayWrap; + private bool $isArrayWrap; public function __construct(string $type, string $method, bool $isArrayWrap) { $this->type = $type; diff --git a/rules/TypeDeclaration/AlreadyAssignDetector/ConstructorAssignDetector.php b/rules/TypeDeclaration/AlreadyAssignDetector/ConstructorAssignDetector.php index a044323c49d..415786657a5 100644 --- a/rules/TypeDeclaration/AlreadyAssignDetector/ConstructorAssignDetector.php +++ b/rules/TypeDeclaration/AlreadyAssignDetector/ConstructorAssignDetector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\AlreadyAssignDetector; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Assign; @@ -16,7 +17,6 @@ use PhpParser\Node\Stmt\Else_; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\If_; use PhpParser\NodeFinder; -use PhpParser\NodeTraverser; use PHPStan\Type\ObjectType; use Rector\NodeAnalyzer\PropertyFetchAnalyzer; use Rector\NodeDecorator\StatementDepthAttributeDecorator; @@ -31,34 +31,28 @@ final class ConstructorAssignDetector { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\TypeDeclaration\Matcher\PropertyAssignMatcher */ - private $propertyAssignMatcher; + private PropertyAssignMatcher $propertyAssignMatcher; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\AutowiredClassMethodOrPropertyAnalyzer */ - private $autowiredClassMethodOrPropertyAnalyzer; + private AutowiredClassMethodOrPropertyAnalyzer $autowiredClassMethodOrPropertyAnalyzer; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; public function __construct(NodeTypeResolver $nodeTypeResolver, PropertyAssignMatcher $propertyAssignMatcher, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, AutowiredClassMethodOrPropertyAnalyzer $autowiredClassMethodOrPropertyAnalyzer, PropertyFetchAnalyzer $propertyFetchAnalyzer, NodeComparator $nodeComparator) { $this->nodeTypeResolver = $nodeTypeResolver; @@ -84,7 +78,7 @@ final class ConstructorAssignDetector $this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $initializeClassMethod->stmts, function (Node $node) use($propertyName, &$isAssignedInConstructor, $allowConditional) : ?int { if ($this->isIfElseAssign($node, $propertyName)) { $isAssignedInConstructor = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } $expr = $this->matchAssignExprToPropertyName($node, $propertyName); if (!$expr instanceof Expr) { @@ -95,19 +89,19 @@ final class ConstructorAssignDetector // is merged in assign? if ($this->isPropertyUsedInAssign($assign, $propertyName)) { $isAssignedInConstructor = \false; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } $isFirstLevelStatement = $assign->getAttribute(AttributeKey::IS_FIRST_LEVEL_STATEMENT); // cannot be nested if ($isFirstLevelStatement !== \true) { if ($allowConditional) { $isAssignedInConstructor = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } return null; } $isAssignedInConstructor = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; }); } if (!$isAssignedInConstructor) { diff --git a/rules/TypeDeclaration/AlreadyAssignDetector/NullTypeAssignDetector.php b/rules/TypeDeclaration/AlreadyAssignDetector/NullTypeAssignDetector.php index 8727467f094..a356d12e306 100644 --- a/rules/TypeDeclaration/AlreadyAssignDetector/NullTypeAssignDetector.php +++ b/rules/TypeDeclaration/AlreadyAssignDetector/NullTypeAssignDetector.php @@ -3,11 +3,11 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\AlreadyAssignDetector; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Stmt\ClassLike; -use PhpParser\NodeTraverser; use Rector\NodeTypeResolver\NodeTypeResolver; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; use Rector\PHPStanStaticTypeMapper\DoctrineTypeAnalyzer; @@ -19,24 +19,20 @@ final class NullTypeAssignDetector { /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\DoctrineTypeAnalyzer */ - private $doctrineTypeAnalyzer; + private DoctrineTypeAnalyzer $doctrineTypeAnalyzer; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\TypeDeclaration\Matcher\PropertyAssignMatcher */ - private $propertyAssignMatcher; + private PropertyAssignMatcher $propertyAssignMatcher; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; public function __construct(DoctrineTypeAnalyzer $doctrineTypeAnalyzer, NodeTypeResolver $nodeTypeResolver, PropertyAssignMatcher $propertyAssignMatcher, SimpleCallableNodeTraverser $simpleCallableNodeTraverser) { $this->doctrineTypeAnalyzer = $doctrineTypeAnalyzer; @@ -56,7 +52,7 @@ final class NullTypeAssignDetector $staticType = $this->nodeTypeResolver->getType($expr); if ($this->doctrineTypeAnalyzer->isDoctrineCollectionWithIterableUnionType($staticType)) { $needsNullType = \false; - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } return null; }); diff --git a/rules/TypeDeclaration/FunctionLikeReturnTypeResolver.php b/rules/TypeDeclaration/FunctionLikeReturnTypeResolver.php index 959dd00d83d..ef0c2436b33 100644 --- a/rules/TypeDeclaration/FunctionLikeReturnTypeResolver.php +++ b/rules/TypeDeclaration/FunctionLikeReturnTypeResolver.php @@ -11,9 +11,8 @@ final class FunctionLikeReturnTypeResolver { /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(StaticTypeMapper $staticTypeMapper) { $this->staticTypeMapper = $staticTypeMapper; diff --git a/rules/TypeDeclaration/Guard/ParamTypeAddGuard.php b/rules/TypeDeclaration/Guard/ParamTypeAddGuard.php index 22fe6e310a4..36f52540869 100644 --- a/rules/TypeDeclaration/Guard/ParamTypeAddGuard.php +++ b/rules/TypeDeclaration/Guard/ParamTypeAddGuard.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Guard; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\Ternary; @@ -10,7 +11,6 @@ use PhpParser\Node\Expr\Variable; use PhpParser\Node\Param; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\If_; -use PhpParser\NodeTraverser; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; use Rector\PhpParser\Node\BetterNodeFinder; @@ -18,19 +18,16 @@ final class ParamTypeAddGuard { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(NodeNameResolver $nodeNameResolver, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, BetterNodeFinder $betterNodeFinder) { $this->nodeNameResolver = $nodeNameResolver; @@ -47,19 +44,15 @@ final class ParamTypeAddGuard $this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->stmts, function (Node $subNode) use(&$isLegal, $paramName) : ?int { if ($subNode instanceof Assign && $subNode->var instanceof Variable && $this->nodeNameResolver->isName($subNode->var, $paramName)) { $isLegal = \false; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } - if ($subNode instanceof If_ && (bool) $this->betterNodeFinder->findFirst($subNode->cond, function (Node $node) use($paramName) : bool { - return $node instanceof Variable && $this->nodeNameResolver->isName($node, $paramName); - })) { + if ($subNode instanceof If_ && (bool) $this->betterNodeFinder->findFirst($subNode->cond, fn(Node $node): bool => $node instanceof Variable && $this->nodeNameResolver->isName($node, $paramName))) { $isLegal = \false; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } - if ($subNode instanceof Ternary && (bool) $this->betterNodeFinder->findFirst($subNode, function (Node $node) use($paramName) : bool { - return $node instanceof Variable && $this->nodeNameResolver->isName($node, $paramName); - })) { + if ($subNode instanceof Ternary && (bool) $this->betterNodeFinder->findFirst($subNode, fn(Node $node): bool => $node instanceof Variable && $this->nodeNameResolver->isName($node, $paramName))) { $isLegal = \false; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } return null; }); diff --git a/rules/TypeDeclaration/Guard/PropertyTypeOverrideGuard.php b/rules/TypeDeclaration/Guard/PropertyTypeOverrideGuard.php index af9b5489484..f5f4a276adf 100644 --- a/rules/TypeDeclaration/Guard/PropertyTypeOverrideGuard.php +++ b/rules/TypeDeclaration/Guard/PropertyTypeOverrideGuard.php @@ -11,14 +11,12 @@ final class PropertyTypeOverrideGuard { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Php74\Guard\MakePropertyTypedGuard */ - private $makePropertyTypedGuard; + private MakePropertyTypedGuard $makePropertyTypedGuard; public function __construct(NodeNameResolver $nodeNameResolver, MakePropertyTypedGuard $makePropertyTypedGuard) { $this->nodeNameResolver = $nodeNameResolver; @@ -37,7 +35,7 @@ final class PropertyTypeOverrideGuard } $parentPropertyReflection = $nativeReflectionClass->getProperty($propertyName); // empty type override is not allowed - return (\method_exists($parentPropertyReflection, 'getType') ? $parentPropertyReflection->getType() : null) !== null; + return $parentPropertyReflection->getType() !== null; } return \true; } diff --git a/rules/TypeDeclaration/Matcher/PropertyAssignMatcher.php b/rules/TypeDeclaration/Matcher/PropertyAssignMatcher.php index e6063d1f331..c33e3c09b45 100644 --- a/rules/TypeDeclaration/Matcher/PropertyAssignMatcher.php +++ b/rules/TypeDeclaration/Matcher/PropertyAssignMatcher.php @@ -11,9 +11,8 @@ final class PropertyAssignMatcher { /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; public function __construct(PropertyFetchAnalyzer $propertyFetchAnalyzer) { $this->propertyFetchAnalyzer = $propertyFetchAnalyzer; diff --git a/rules/TypeDeclaration/NodeAnalyzer/AutowiredClassMethodOrPropertyAnalyzer.php b/rules/TypeDeclaration/NodeAnalyzer/AutowiredClassMethodOrPropertyAnalyzer.php index 29e8cd199a1..d7885ebd4ab 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/AutowiredClassMethodOrPropertyAnalyzer.php +++ b/rules/TypeDeclaration/NodeAnalyzer/AutowiredClassMethodOrPropertyAnalyzer.php @@ -12,14 +12,12 @@ final class AutowiredClassMethodOrPropertyAnalyzer { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, PhpAttributeAnalyzer $phpAttributeAnalyzer) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php b/rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php index 462b7a68595..43a583fbb8c 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php +++ b/rules/TypeDeclaration/NodeAnalyzer/CallTypesResolver.php @@ -21,24 +21,20 @@ final class CallTypesResolver { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; public function __construct(NodeTypeResolver $nodeTypeResolver, TypeFactory $typeFactory, ReflectionProvider $reflectionProvider, TypeComparator $typeComparator) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/rules/TypeDeclaration/NodeAnalyzer/CallerParamMatcher.php b/rules/TypeDeclaration/NodeAnalyzer/CallerParamMatcher.php index 86a74f9ea8a..2fd4fd485be 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/CallerParamMatcher.php +++ b/rules/TypeDeclaration/NodeAnalyzer/CallerParamMatcher.php @@ -29,24 +29,20 @@ final class CallerParamMatcher { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; public function __construct(NodeNameResolver $nodeNameResolver, AstResolver $astResolver, StaticTypeMapper $staticTypeMapper, TypeComparator $typeComparator) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/TypeDeclaration/NodeAnalyzer/ClassMethodAndPropertyAnalyzer.php b/rules/TypeDeclaration/NodeAnalyzer/ClassMethodAndPropertyAnalyzer.php index 675cfc51125..2acc6507c30 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/ClassMethodAndPropertyAnalyzer.php +++ b/rules/TypeDeclaration/NodeAnalyzer/ClassMethodAndPropertyAnalyzer.php @@ -14,9 +14,8 @@ final class ClassMethodAndPropertyAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/TypeDeclaration/NodeAnalyzer/ClassMethodParamTypeCompleter.php b/rules/TypeDeclaration/NodeAnalyzer/ClassMethodParamTypeCompleter.php index 87429855d47..1fbcabcb751 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/ClassMethodParamTypeCompleter.php +++ b/rules/TypeDeclaration/NodeAnalyzer/ClassMethodParamTypeCompleter.php @@ -19,14 +19,12 @@ final class ClassMethodParamTypeCompleter { /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodParamVendorLockResolver */ - private $classMethodParamVendorLockResolver; + private ClassMethodParamVendorLockResolver $classMethodParamVendorLockResolver; public function __construct(StaticTypeMapper $staticTypeMapper, ClassMethodParamVendorLockResolver $classMethodParamVendorLockResolver) { $this->staticTypeMapper = $staticTypeMapper; diff --git a/rules/TypeDeclaration/NodeAnalyzer/NeverFuncCallAnalyzer.php b/rules/TypeDeclaration/NodeAnalyzer/NeverFuncCallAnalyzer.php index 59aadaf9000..13dc045ea13 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/NeverFuncCallAnalyzer.php +++ b/rules/TypeDeclaration/NodeAnalyzer/NeverFuncCallAnalyzer.php @@ -14,9 +14,8 @@ final class NeverFuncCallAnalyzer { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeTypeResolver $nodeTypeResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/rules/TypeDeclaration/NodeAnalyzer/ParamAnalyzer.php b/rules/TypeDeclaration/NodeAnalyzer/ParamAnalyzer.php index 0839eea677a..1bcc3939c55 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/ParamAnalyzer.php +++ b/rules/TypeDeclaration/NodeAnalyzer/ParamAnalyzer.php @@ -10,9 +10,8 @@ final class ParamAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/rules/TypeDeclaration/NodeAnalyzer/ReturnAnalyzer.php b/rules/TypeDeclaration/NodeAnalyzer/ReturnAnalyzer.php index 548deec2224..210c42ee4f5 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/ReturnAnalyzer.php +++ b/rules/TypeDeclaration/NodeAnalyzer/ReturnAnalyzer.php @@ -12,9 +12,8 @@ final class ReturnAnalyzer { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\SilentVoidResolver */ - private $silentVoidResolver; + private SilentVoidResolver $silentVoidResolver; public function __construct(SilentVoidResolver $silentVoidResolver) { $this->silentVoidResolver = $silentVoidResolver; diff --git a/rules/TypeDeclaration/NodeAnalyzer/ReturnFilter/ExclusiveNativeCallLikeReturnMatcher.php b/rules/TypeDeclaration/NodeAnalyzer/ReturnFilter/ExclusiveNativeCallLikeReturnMatcher.php index ce3c33ef3b0..1919dfd7fcf 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/ReturnFilter/ExclusiveNativeCallLikeReturnMatcher.php +++ b/rules/TypeDeclaration/NodeAnalyzer/ReturnFilter/ExclusiveNativeCallLikeReturnMatcher.php @@ -14,9 +14,8 @@ final class ExclusiveNativeCallLikeReturnMatcher { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ReflectionResolver $reflectionResolver) { $this->reflectionResolver = $reflectionResolver; diff --git a/rules/TypeDeclaration/NodeAnalyzer/ReturnTypeAnalyzer/StrictNativeFunctionReturnTypeAnalyzer.php b/rules/TypeDeclaration/NodeAnalyzer/ReturnTypeAnalyzer/StrictNativeFunctionReturnTypeAnalyzer.php index daf0d0c3416..2e98a7f6c95 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/ReturnTypeAnalyzer/StrictNativeFunctionReturnTypeAnalyzer.php +++ b/rules/TypeDeclaration/NodeAnalyzer/ReturnTypeAnalyzer/StrictNativeFunctionReturnTypeAnalyzer.php @@ -13,19 +13,16 @@ final class StrictNativeFunctionReturnTypeAnalyzer { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnFilter\ExclusiveNativeCallLikeReturnMatcher */ - private $exclusiveNativeCallLikeReturnMatcher; + private ExclusiveNativeCallLikeReturnMatcher $exclusiveNativeCallLikeReturnMatcher; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; public function __construct(BetterNodeFinder $betterNodeFinder, ExclusiveNativeCallLikeReturnMatcher $exclusiveNativeCallLikeReturnMatcher, ReturnAnalyzer $returnAnalyzer) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/rules/TypeDeclaration/NodeAnalyzer/ReturnTypeAnalyzer/StrictReturnNewAnalyzer.php b/rules/TypeDeclaration/NodeAnalyzer/ReturnTypeAnalyzer/StrictReturnNewAnalyzer.php index f17183f5eae..72e20a303b2 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/ReturnTypeAnalyzer/StrictReturnNewAnalyzer.php +++ b/rules/TypeDeclaration/NodeAnalyzer/ReturnTypeAnalyzer/StrictReturnNewAnalyzer.php @@ -21,24 +21,20 @@ final class StrictReturnNewAnalyzer { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; public function __construct(BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, ReturnAnalyzer $returnAnalyzer) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/rules/TypeDeclaration/NodeAnalyzer/TypeNodeUnwrapper.php b/rules/TypeDeclaration/NodeAnalyzer/TypeNodeUnwrapper.php index 5625a5a5c17..36f3456a489 100644 --- a/rules/TypeDeclaration/NodeAnalyzer/TypeNodeUnwrapper.php +++ b/rules/TypeDeclaration/NodeAnalyzer/TypeNodeUnwrapper.php @@ -14,9 +14,8 @@ final class TypeNodeUnwrapper { /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; public function __construct(NodeComparator $nodeComparator) { $this->nodeComparator = $nodeComparator; diff --git a/rules/TypeDeclaration/NodeManipulator/AddNeverReturnType.php b/rules/TypeDeclaration/NodeManipulator/AddNeverReturnType.php index 285a93f40c0..3d1f6d1af29 100644 --- a/rules/TypeDeclaration/NodeManipulator/AddNeverReturnType.php +++ b/rules/TypeDeclaration/NodeManipulator/AddNeverReturnType.php @@ -11,7 +11,8 @@ use PhpParser\Node\Identifier; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Return_; -use PhpParser\Node\Stmt\Throw_; +use PhpParser\Node\Expr\Throw_; +use PhpParser\Node\Stmt\Expression; use PHPStan\Analyser\Scope; use Rector\NodeNameResolver\NodeNameResolver; use Rector\NodeNestingScope\ValueObject\ControlStructure; @@ -23,29 +24,24 @@ final class AddNeverReturnType { /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\Reflection\ClassModifierChecker */ - private $classModifierChecker; + private ClassModifierChecker $classModifierChecker; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\NeverFuncCallAnalyzer */ - private $neverFuncCallAnalyzer; + private NeverFuncCallAnalyzer $neverFuncCallAnalyzer; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, ClassModifierChecker $classModifierChecker, BetterNodeFinder $betterNodeFinder, NeverFuncCallAnalyzer $neverFuncCallAnalyzer, NodeNameResolver $nodeNameResolver) { $this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard; @@ -103,7 +99,7 @@ final class AddNeverReturnType */ private function hasNeverNodesOrNeverFuncCalls($node) : bool { - $hasNeverNodes = $this->betterNodeFinder->hasInstancesOfInFunctionLikeScoped($node, [Throw_::class]); + $hasNeverNodes = (bool) $this->betterNodeFinder->findFirstInFunctionLikeScoped($node, fn(Node $subNode): bool => $subNode instanceof Expression && $subNode->expr instanceof Throw_); if ($hasNeverNodes) { return \true; } diff --git a/rules/TypeDeclaration/NodeManipulator/AddReturnTypeFromCast.php b/rules/TypeDeclaration/NodeManipulator/AddReturnTypeFromCast.php index 023d08925b7..b05b4a7905c 100644 --- a/rules/TypeDeclaration/NodeManipulator/AddReturnTypeFromCast.php +++ b/rules/TypeDeclaration/NodeManipulator/AddReturnTypeFromCast.php @@ -19,24 +19,20 @@ final class AddReturnTypeFromCast { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; public function __construct(BetterNodeFinder $betterNodeFinder, ReturnTypeInferer $returnTypeInferer, StaticTypeMapper $staticTypeMapper, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard) { $this->betterNodeFinder = $betterNodeFinder; @@ -56,9 +52,7 @@ final class AddReturnTypeFromCast if ($functionLike instanceof ClassMethod && $this->classMethodReturnTypeOverrideGuard->shouldSkipClassMethod($functionLike, $scope)) { return null; } - $hasNonCastReturn = (bool) $this->betterNodeFinder->findFirstInFunctionLikeScoped($functionLike, static function (Node $subNode) : bool { - return $subNode instanceof Return_ && !$subNode->expr instanceof Cast; - }); + $hasNonCastReturn = (bool) $this->betterNodeFinder->findFirstInFunctionLikeScoped($functionLike, static fn(Node $subNode): bool => $subNode instanceof Return_ && !$subNode->expr instanceof Cast); if ($hasNonCastReturn) { return null; } diff --git a/rules/TypeDeclaration/NodeManipulator/AddReturnTypeFromParam.php b/rules/TypeDeclaration/NodeManipulator/AddReturnTypeFromParam.php index 540a6addfce..f07d347397a 100644 --- a/rules/TypeDeclaration/NodeManipulator/AddReturnTypeFromParam.php +++ b/rules/TypeDeclaration/NodeManipulator/AddReturnTypeFromParam.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\NodeManipulator; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Assign; @@ -15,7 +16,6 @@ use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Return_; -use PhpParser\NodeTraverser; use PHPStan\Analyser\Scope; use PHPStan\Type\MixedType; use PHPStan\Type\TypeCombinator; @@ -28,24 +28,20 @@ final class AddReturnTypeFromParam { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; public function __construct(NodeNameResolver $nodeNameResolver, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, ReturnTypeInferer $returnTypeInferer) { $this->nodeNameResolver = $nodeNameResolver; @@ -97,14 +93,14 @@ final class AddReturnTypeFromParam // skip scope nesting if ($node instanceof Class_ || $node instanceof FunctionLike) { $return = null; - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$node instanceof Return_) { return null; } if (!$node->expr instanceof Variable) { $return = null; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } $return = $node; return null; @@ -121,11 +117,11 @@ final class AddReturnTypeFromParam $this->simpleCallableNodeTraverser->traverseNodesWithCallable($stmts, function (Node $node) use($paramName, &$isParamModified) : ?int { // skip scope nesting if ($node instanceof Class_ || $node instanceof FunctionLike) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($node instanceof AssignRef && $this->nodeNameResolver->isName($node->expr, $paramName)) { $isParamModified = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } if (!$node instanceof Assign) { return null; @@ -137,7 +133,7 @@ final class AddReturnTypeFromParam return null; } $isParamModified = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; }); return $isParamModified; } diff --git a/rules/TypeDeclaration/NodeManipulator/AddReturnTypeFromStrictNativeCall.php b/rules/TypeDeclaration/NodeManipulator/AddReturnTypeFromStrictNativeCall.php index 871ad5be5ef..0bedd5d2437 100644 --- a/rules/TypeDeclaration/NodeManipulator/AddReturnTypeFromStrictNativeCall.php +++ b/rules/TypeDeclaration/NodeManipulator/AddReturnTypeFromStrictNativeCall.php @@ -18,29 +18,24 @@ final class AddReturnTypeFromStrictNativeCall { /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnTypeAnalyzer\StrictNativeFunctionReturnTypeAnalyzer */ - private $strictNativeFunctionReturnTypeAnalyzer; + private StrictNativeFunctionReturnTypeAnalyzer $strictNativeFunctionReturnTypeAnalyzer; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; public function __construct(StaticTypeMapper $staticTypeMapper, StrictNativeFunctionReturnTypeAnalyzer $strictNativeFunctionReturnTypeAnalyzer, NodeTypeResolver $nodeTypeResolver, TypeFactory $typeFactory, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard) { $this->staticTypeMapper = $staticTypeMapper; diff --git a/rules/TypeDeclaration/NodeManipulator/AddUnionReturnType.php b/rules/TypeDeclaration/NodeManipulator/AddUnionReturnType.php index 2617cc55c62..8c8cc68f778 100644 --- a/rules/TypeDeclaration/NodeManipulator/AddUnionReturnType.php +++ b/rules/TypeDeclaration/NodeManipulator/AddUnionReturnType.php @@ -17,19 +17,16 @@ final class AddUnionReturnType { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\TypeMapper\UnionTypeMapper */ - private $unionTypeMapper; + private UnionTypeMapper $unionTypeMapper; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; public function __construct(ReturnTypeInferer $returnTypeInferer, UnionTypeMapper $unionTypeMapper, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard) { $this->returnTypeInferer = $returnTypeInferer; diff --git a/rules/TypeDeclaration/NodeTypeAnalyzer/PropertyTypeDecorator.php b/rules/TypeDeclaration/NodeTypeAnalyzer/PropertyTypeDecorator.php index 1ca17e59d00..cc31bad4d23 100644 --- a/rules/TypeDeclaration/NodeTypeAnalyzer/PropertyTypeDecorator.php +++ b/rules/TypeDeclaration/NodeTypeAnalyzer/PropertyTypeDecorator.php @@ -20,24 +20,20 @@ final class PropertyTypeDecorator { /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeAnalyzer */ - private $unionTypeAnalyzer; + private UnionTypeAnalyzer $unionTypeAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(UnionTypeAnalyzer $unionTypeAnalyzer, PhpDocTypeChanger $phpDocTypeChanger, PhpVersionProvider $phpVersionProvider, NodeFactory $nodeFactory) { $this->unionTypeAnalyzer = $unionTypeAnalyzer; diff --git a/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php b/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php index cb69562c483..98cbe1cf9a7 100644 --- a/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php +++ b/rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\PHPStan; +use PhpParser\Node\UseItem; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\Node; use PhpParser\Node\Identifier; use PhpParser\Node\Stmt\GroupUse; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ReflectionProvider; @@ -31,19 +31,16 @@ final class ObjectTypeSpecifier { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\Naming\Naming\UseImportsResolver */ - private $useImportsResolver; + private UseImportsResolver $useImportsResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\Naming\NameScopeFactory */ - private $nameScopeFactory; + private NameScopeFactory $nameScopeFactory; public function __construct(ReflectionProvider $reflectionProvider, UseImportsResolver $useImportsResolver, NameScopeFactory $nameScopeFactory) { $this->reflectionProvider = $reflectionProvider; @@ -65,6 +62,9 @@ final class ObjectTypeSpecifier return $shortenedObjectType; } $className = \ltrim($objectType->getClassName(), '\\'); + if (\strncmp($objectType->getClassName(), '\\', \strlen('\\')) === 0) { + return new FullyQualifiedObjectType($className); + } if ($this->reflectionProvider->hasClass($className)) { return new FullyQualifiedObjectType($className); } @@ -135,6 +135,9 @@ final class ObjectTypeSpecifier if ($useName === $className) { return new AliasedObjectType($alias, $fullyQualifiedName); } + if (\strncmp($className, $alias . '\\', \strlen($alias . '\\')) === 0) { + return new AliasedObjectType($alias, $fullyQualifiedName . \ltrim($className, $alias)); + } return null; } /** @@ -171,17 +174,17 @@ final class ObjectTypeSpecifier } return null; } - private function matchPartialNamespaceObjectType(string $prefix, ObjectType $objectType, UseUse $useUse) : ?ShortenedObjectType + private function matchPartialNamespaceObjectType(string $prefix, ObjectType $objectType, UseItem $useItem) : ?ShortenedObjectType { + if ($objectType->getClassName() === $useItem->name->getLast()) { + return new ShortenedObjectType($objectType->getClassName(), $prefix . $useItem->name->toString()); + } // partial namespace - if (\strncmp($objectType->getClassName(), $useUse->name->getLast() . '\\', \strlen($useUse->name->getLast() . '\\')) !== 0) { + if (\strncmp($objectType->getClassName(), $useItem->name->getLast() . '\\', \strlen($useItem->name->getLast() . '\\')) !== 0) { return null; } $classNameWithoutLastUsePart = Strings::after($objectType->getClassName(), '\\', 1); - $connectedClassName = $prefix . $useUse->name->toString() . '\\' . $classNameWithoutLastUsePart; - if (!$this->reflectionProvider->hasClass($connectedClassName)) { - return null; - } + $connectedClassName = $prefix . $useItem->name->toString() . '\\' . $classNameWithoutLastUsePart; if ($objectType->getClassName() === $connectedClassName) { return null; } @@ -190,17 +193,17 @@ final class ObjectTypeSpecifier /** * @return FullyQualifiedObjectType|ShortenedObjectType|null */ - private function matchClassWithLastUseImportPart(string $prefix, ObjectType $objectType, UseUse $useUse) : ?ObjectType + private function matchClassWithLastUseImportPart(string $prefix, ObjectType $objectType, UseItem $useItem) : ?ObjectType { - if ($useUse->name->getLast() !== $objectType->getClassName()) { + if ($useItem->name->getLast() !== $objectType->getClassName()) { return null; } - if (!$this->reflectionProvider->hasClass($prefix . $useUse->name->toString())) { + if (!$this->reflectionProvider->hasClass($prefix . $useItem->name->toString())) { return null; } - if ($objectType->getClassName() === $prefix . $useUse->name->toString()) { + if ($objectType->getClassName() === $prefix . $useItem->name->toString()) { return new FullyQualifiedObjectType($objectType->getClassName()); } - return new ShortenedObjectType($objectType->getClassName(), $prefix . $useUse->name->toString()); + return new ShortenedObjectType($objectType->getClassName(), $prefix . $useItem->name->toString()); } } diff --git a/rules/TypeDeclaration/PhpDocParser/ParamPhpDocNodeFactory.php b/rules/TypeDeclaration/PhpDocParser/ParamPhpDocNodeFactory.php index eb0aae5e055..00350474051 100644 --- a/rules/TypeDeclaration/PhpDocParser/ParamPhpDocNodeFactory.php +++ b/rules/TypeDeclaration/PhpDocParser/ParamPhpDocNodeFactory.php @@ -11,15 +11,14 @@ final class ParamPhpDocNodeFactory { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; } public function create(TypeNode $typeNode, Param $param) : ParamTagValueNode { - return new ParamTagValueNode($typeNode, $param->variadic, '$' . $this->nodeNameResolver->getName($param), ''); + return new ParamTagValueNode($typeNode, $param->variadic, '$' . $this->nodeNameResolver->getName($param), '', \false); } } diff --git a/rules/TypeDeclaration/PhpDocParser/TypeExpressionFromVarTagResolver.php b/rules/TypeDeclaration/PhpDocParser/TypeExpressionFromVarTagResolver.php index f221a3c4a01..f2ebe0e48d5 100644 --- a/rules/TypeDeclaration/PhpDocParser/TypeExpressionFromVarTagResolver.php +++ b/rules/TypeDeclaration/PhpDocParser/TypeExpressionFromVarTagResolver.php @@ -33,9 +33,8 @@ final class TypeExpressionFromVarTagResolver { /** * @readonly - * @var \Rector\StaticTypeMapper\Mapper\ScalarStringToTypeMapper */ - private $scalarStringToTypeMapper; + private ScalarStringToTypeMapper $scalarStringToTypeMapper; public function __construct(ScalarStringToTypeMapper $scalarStringToTypeMapper) { $this->scalarStringToTypeMapper = $scalarStringToTypeMapper; diff --git a/rules/TypeDeclaration/Rector/ArrowFunction/AddArrowFunctionReturnTypeRector.php b/rules/TypeDeclaration/Rector/ArrowFunction/AddArrowFunctionReturnTypeRector.php index 32274849575..b5369300af9 100644 --- a/rules/TypeDeclaration/Rector/ArrowFunction/AddArrowFunctionReturnTypeRector.php +++ b/rules/TypeDeclaration/Rector/ArrowFunction/AddArrowFunctionReturnTypeRector.php @@ -19,9 +19,8 @@ final class AddArrowFunctionReturnTypeRector extends AbstractRector implements M { /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(StaticTypeMapper $staticTypeMapper) { $this->staticTypeMapper = $staticTypeMapper; diff --git a/rules/TypeDeclaration/Rector/BooleanAnd/BinaryOpNullableToInstanceofRector.php b/rules/TypeDeclaration/Rector/BooleanAnd/BinaryOpNullableToInstanceofRector.php index 692891affb3..5e0f997d49d 100644 --- a/rules/TypeDeclaration/Rector/BooleanAnd/BinaryOpNullableToInstanceofRector.php +++ b/rules/TypeDeclaration/Rector/BooleanAnd/BinaryOpNullableToInstanceofRector.php @@ -22,9 +22,8 @@ final class BinaryOpNullableToInstanceofRector extends AbstractRector { /** * @readonly - * @var \Rector\TypeDeclaration\TypeAnalyzer\NullableTypeAnalyzer */ - private $nullableTypeAnalyzer; + private NullableTypeAnalyzer $nullableTypeAnalyzer; public function __construct(NullableTypeAnalyzer $nullableTypeAnalyzer) { $this->nullableTypeAnalyzer = $nullableTypeAnalyzer; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddMethodCallBasedStrictParamTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddMethodCallBasedStrictParamTypeRector.php index fb1572d89e0..fd0c36ff7c4 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddMethodCallBasedStrictParamTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddMethodCallBasedStrictParamTypeRector.php @@ -20,19 +20,16 @@ final class AddMethodCallBasedStrictParamTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\CallTypesResolver */ - private $callTypesResolver; + private CallTypesResolver $callTypesResolver; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ClassMethodParamTypeCompleter */ - private $classMethodParamTypeCompleter; + private ClassMethodParamTypeCompleter $classMethodParamTypeCompleter; /** * @readonly - * @var \Rector\PhpParser\NodeFinder\LocalMethodCallFinder */ - private $localMethodCallFinder; + private LocalMethodCallFinder $localMethodCallFinder; /** * @var int */ diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddParamArrayDocblockBasedOnCallableNativeFuncCallRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddParamArrayDocblockBasedOnCallableNativeFuncCallRector.php index c8291a8134f..920aa81c607 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddParamArrayDocblockBasedOnCallableNativeFuncCallRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddParamArrayDocblockBasedOnCallableNativeFuncCallRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\ClassMethod; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\Expr\Closure; @@ -13,7 +14,6 @@ use PhpParser\Node\Param; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; -use PhpParser\NodeTraverser; use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode; use PHPStan\Type\ArrayType; use PHPStan\Type\MixedType; @@ -33,24 +33,20 @@ final class AddParamArrayDocblockBasedOnCallableNativeFuncCallRector extends Abs { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\NodeAnalyzer\ArgsAnalyzer */ - private $argsAnalyzer; + private ArgsAnalyzer $argsAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @var array> */ @@ -112,7 +108,7 @@ CODE_SAMPLE $paramsWithType = []; $this->traverseNodesWithCallable($node->stmts, function (Node $subNode) use($variableNamesWithArrayType, $node, &$paramsWithType) : ?int { if ($subNode instanceof Class_ || $subNode instanceof Function_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$subNode instanceof FuncCall) { return null; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeBasedOnPHPUnitDataProviderRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeBasedOnPHPUnitDataProviderRector.php index c5be54715b1..93aaf6901ad 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeBasedOnPHPUnitDataProviderRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeBasedOnPHPUnitDataProviderRector.php @@ -8,7 +8,7 @@ use PhpParser\Node; use PhpParser\Node\Attribute; use PhpParser\Node\AttributeGroup; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Yield_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_; @@ -39,29 +39,24 @@ final class AddParamTypeBasedOnPHPUnitDataProviderRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @var string */ diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeDeclarationRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeDeclarationRector.php index 5d5081916cb..cfaecd9154f 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeDeclarationRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeDeclarationRector.php @@ -29,27 +29,21 @@ final class AddParamTypeDeclarationRector extends AbstractRector implements Conf { /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @var AddParamTypeDeclaration[] */ - private $addParamTypeDeclarations = []; - /** - * @var bool - */ - private $hasChanged = \false; + private array $addParamTypeDeclarations = []; + private bool $hasChanged = \false; public function __construct(TypeComparator $typeComparator, PhpVersionProvider $phpVersionProvider, StaticTypeMapper $staticTypeMapper) { $this->typeComparator = $typeComparator; @@ -143,7 +137,7 @@ CODE_SAMPLE private function refactorParameter(Param $param, AddParamTypeDeclaration $addParamTypeDeclaration) : void { // already set → no change - if ($param->type !== null) { + if ($param->type instanceof Node) { $currentParamType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($param->type); if ($this->typeComparator->areTypesEqual($currentParamType, $addParamTypeDeclaration->getParamType())) { return; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeFromPropertyTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeFromPropertyTypeRector.php index caca58cc780..49aba60e268 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeFromPropertyTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeFromPropertyTypeRector.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\ClassMethod; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; -use PhpParser\NodeTraverser; use PHPStan\Type\Type; use Rector\NodeAnalyzer\PropertyFetchAnalyzer; use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory; @@ -29,34 +29,28 @@ final class AddParamTypeFromPropertyTypeRector extends AbstractRector implements { /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\VendorLocker\ParentClassMethodTypeOverrideGuard */ - private $parentClassMethodTypeOverrideGuard; + private ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard; /** * @readonly - * @var \Rector\TypeDeclaration\Guard\ParamTypeAddGuard */ - private $paramTypeAddGuard; + private ParamTypeAddGuard $paramTypeAddGuard; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @var string */ @@ -151,7 +145,7 @@ CODE_SAMPLE $this->simpleCallableNodeTraverser->traverseNodesWithCallable($classMethod, function (Node $node) use($paramName, &$propertyStaticTypes) : ?int { if ($node instanceof Class_ || $node instanceof Function_) { // skip anonymous classes and inner function - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$node instanceof Assign) { return null; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddReturnArrayDocblockBasedOnArrayMapRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddReturnArrayDocblockBasedOnArrayMapRector.php index f6a031e5d35..3639177ad2d 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddReturnArrayDocblockBasedOnArrayMapRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddReturnArrayDocblockBasedOnArrayMapRector.php @@ -29,34 +29,28 @@ final class AddReturnArrayDocblockBasedOnArrayMapRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(BetterNodeFinder $betterNodeFinder, ReturnAnalyzer $returnAnalyzer, StaticTypeMapper $staticTypeMapper, TypeFactory $typeFactory, PhpDocTypeChanger $phpDocTypeChanger, PhpDocInfoFactory $phpDocInfoFactory) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationBasedOnParentClassMethodRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationBasedOnParentClassMethodRector.php index ea1ccd4c33e..f0ed3c3e415 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationBasedOnParentClassMethodRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationBasedOnParentClassMethodRector.php @@ -28,19 +28,16 @@ final class AddReturnTypeDeclarationBasedOnParentClassMethodRector extends Abstr { /** * @readonly - * @var \Rector\VendorLocker\ParentClassMethodTypeOverrideGuard */ - private $parentClassMethodTypeOverrideGuard; + private ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard, PhpVersionProvider $phpVersionProvider, StaticTypeMapper $staticTypeMapper) { $this->parentClassMethodTypeOverrideGuard = $parentClassMethodTypeOverrideGuard; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationRector.php index f5eb3833faf..5f71f9173d4 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationRector.php @@ -28,27 +28,21 @@ final class AddReturnTypeDeclarationRector extends AbstractRector implements Con { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\VendorLocker\ParentClassMethodTypeOverrideGuard */ - private $parentClassMethodTypeOverrideGuard; + private ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @var AddReturnTypeDeclaration[] */ - private $methodReturnTypes = []; - /** - * @var bool - */ - private $hasChanged = \false; + private array $methodReturnTypes = []; + private bool $hasChanged = \false; public function __construct(PhpVersionProvider $phpVersionProvider, ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard, StaticTypeMapper $staticTypeMapper) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddTypeFromResourceDocblockRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddTypeFromResourceDocblockRector.php index 3678461ad05..dbe75c8fef6 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddTypeFromResourceDocblockRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddTypeFromResourceDocblockRector.php @@ -32,33 +32,25 @@ final class AddTypeFromResourceDocblockRector extends AbstractRector implements { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; - /** - * @var string - */ - private $newTypeFromResourceDoc; + private PhpDocTagRemover $phpDocTagRemover; + private string $newTypeFromResourceDoc; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, PhpDocTypeChanger $phpDocTypeChanger, DocBlockUpdater $docBlockUpdater, StaticTypeMapper $staticTypeMapper, PhpDocTagRemover $phpDocTagRemover) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddVoidReturnTypeWhereNoReturnRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddVoidReturnTypeWhereNoReturnRector.php index b26b9bc4ddb..4588fc5a4af 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddVoidReturnTypeWhereNoReturnRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddVoidReturnTypeWhereNoReturnRector.php @@ -6,7 +6,8 @@ namespace Rector\TypeDeclaration\Rector\ClassMethod; use PhpParser\Node; use PhpParser\Node\Identifier; use PhpParser\Node\Stmt\ClassMethod; -use PhpParser\Node\Stmt\Throw_; +use PhpParser\Node\Expr\Throw_; +use PhpParser\Node\Stmt\Expression; use Rector\Rector\AbstractRector; use Rector\Reflection\ClassModifierChecker; use Rector\TypeDeclaration\TypeInferer\SilentVoidResolver; @@ -22,19 +23,16 @@ final class AddVoidReturnTypeWhereNoReturnRector extends AbstractRector implemen { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\SilentVoidResolver */ - private $silentVoidResolver; + private SilentVoidResolver $silentVoidResolver; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnVendorLockResolver */ - private $classMethodReturnVendorLockResolver; + private ClassMethodReturnVendorLockResolver $classMethodReturnVendorLockResolver; /** * @readonly - * @var \Rector\Reflection\ClassModifierChecker */ - private $classModifierChecker; + private ClassModifierChecker $classModifierChecker; public function __construct(SilentVoidResolver $silentVoidResolver, ClassMethodReturnVendorLockResolver $classMethodReturnVendorLockResolver, ClassModifierChecker $classModifierChecker) { $this->silentVoidResolver = $silentVoidResolver; @@ -124,7 +122,7 @@ CODE_SAMPLE return \false; } $onlyStmt = $classMethod->stmts[0] ?? null; - return $onlyStmt instanceof Throw_; + return $onlyStmt instanceof Expression && $onlyStmt->expr instanceof Throw_; } private function isNotFinalAndEmpty(ClassMethod $classMethod) : bool { diff --git a/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromBooleanConstReturnsRector.php b/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromBooleanConstReturnsRector.php index 169481a9c81..0ada028b105 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromBooleanConstReturnsRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromBooleanConstReturnsRector.php @@ -28,24 +28,20 @@ final class BoolReturnTypeFromBooleanConstReturnsRector extends AbstractRector i { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; public function __construct(ValueResolver $valueResolver, BetterNodeFinder $betterNodeFinder, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, ReturnAnalyzer $returnAnalyzer) { $this->valueResolver = $valueResolver; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromBooleanStrictReturnsRector.php b/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromBooleanStrictReturnsRector.php index 3c09d67aadb..e15e46ea105 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromBooleanStrictReturnsRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromBooleanStrictReturnsRector.php @@ -45,29 +45,24 @@ final class BoolReturnTypeFromBooleanStrictReturnsRector extends AbstractRector { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; public function __construct(ReflectionProvider $reflectionProvider, ValueResolver $valueResolver, BetterNodeFinder $betterNodeFinder, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, ReturnAnalyzer $returnAnalyzer) { $this->reflectionProvider = $reflectionProvider; @@ -177,8 +172,8 @@ CODE_SAMPLE if (!$functionReflection->isBuiltin()) { return \false; } - foreach ($functionReflection->getVariants() as $parametersAcceptorWithPhpDoc) { - if (!$parametersAcceptorWithPhpDoc->getNativeReturnType()->isBoolean()->yes()) { + foreach ($functionReflection->getVariants() as $variant) { + if (!$variant->getNativeReturnType()->isBoolean()->yes()) { return \false; } } diff --git a/rules/TypeDeclaration/Rector/ClassMethod/NumericReturnTypeFromStrictReturnsRector.php b/rules/TypeDeclaration/Rector/ClassMethod/NumericReturnTypeFromStrictReturnsRector.php index de8cc7f874a..05d273f7bc0 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/NumericReturnTypeFromStrictReturnsRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/NumericReturnTypeFromStrictReturnsRector.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\ClassMethod; +use PhpParser\Node\Scalar\Float_; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\UnaryMinus; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\DNumber; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Return_; @@ -29,19 +29,16 @@ final class NumericReturnTypeFromStrictReturnsRector extends AbstractRector impl { /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; public function __construct(ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, BetterNodeFinder $betterNodeFinder, ReturnAnalyzer $returnAnalyzer) { $this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard; @@ -152,10 +149,10 @@ CODE_SAMPLE if ($epxr instanceof UnaryMinus) { $epxr = $epxr->expr; } - if (!$epxr instanceof DNumber) { + if (!$epxr instanceof Float_) { $isAlwaysFloat = \false; } - if (!$epxr instanceof LNumber) { + if (!$epxr instanceof Int_) { $isAlwaysInt = \false; } } diff --git a/rules/TypeDeclaration/Rector/ClassMethod/NumericReturnTypeFromStrictScalarReturnsRector.php b/rules/TypeDeclaration/Rector/ClassMethod/NumericReturnTypeFromStrictScalarReturnsRector.php index 5dfdfd6315a..4bc3e00894b 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/NumericReturnTypeFromStrictScalarReturnsRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/NumericReturnTypeFromStrictScalarReturnsRector.php @@ -3,11 +3,11 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\ClassMethod; +use PhpParser\Node\Scalar\Float_; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Expr\UnaryMinus; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\DNumber; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PHPStan\Analyser\Scope; @@ -27,19 +27,16 @@ final class NumericReturnTypeFromStrictScalarReturnsRector extends AbstractRecto { /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; public function __construct(ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, BetterNodeFinder $betterNodeFinder, ReturnAnalyzer $returnAnalyzer) { $this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard; @@ -95,10 +92,10 @@ CODE_SAMPLE if ($expr instanceof UnaryMinus) { $expr = $expr->expr; } - if (!$expr instanceof DNumber) { + if (!$expr instanceof Float_) { $isAlwaysFloat = \false; } - if (!$expr instanceof LNumber) { + if (!$expr instanceof Int_) { $isAlwaysInt = \false; } } diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php index f59297378c9..97f2fc134d8 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByMethodCallTypeRector.php @@ -30,39 +30,32 @@ final class ParamTypeByMethodCallTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\CallerParamMatcher */ - private $callerParamMatcher; + private CallerParamMatcher $callerParamMatcher; /** * @readonly - * @var \Rector\VendorLocker\ParentClassMethodTypeOverrideGuard */ - private $parentClassMethodTypeOverrideGuard; + private ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard; /** * @readonly - * @var \Rector\TypeDeclaration\Guard\ParamTypeAddGuard */ - private $paramTypeAddGuard; + private ParamTypeAddGuard $paramTypeAddGuard; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper */ - private $phpParserNodeMapper; + private PhpParserNodeMapper $phpParserNodeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; public function __construct(CallerParamMatcher $callerParamMatcher, ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard, ParamTypeAddGuard $paramTypeAddGuard, BetterNodeFinder $betterNodeFinder, PhpParserNodeMapper $phpParserNodeMapper, StaticTypeMapper $staticTypeMapper, TypeFactory $typeFactory) { $this->callerParamMatcher = $callerParamMatcher; @@ -159,7 +152,7 @@ CODE_SAMPLE private function shouldSkipParam(Param $param, ClassMethod $classMethod) : bool { // already has type, skip - if ($param->type !== null) { + if ($param->type instanceof Node) { return \true; } if ($param->variadic) { diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector.php index 1bafa3a52a4..0aa8018826c 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector.php @@ -24,19 +24,16 @@ final class ParamTypeByParentCallTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\CallerParamMatcher */ - private $callerParamMatcher; + private CallerParamMatcher $callerParamMatcher; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(CallerParamMatcher $callerParamMatcher, ReflectionResolver $reflectionResolver, BetterNodeFinder $betterNodeFinder) { $this->callerParamMatcher = $callerParamMatcher; @@ -109,7 +106,7 @@ CODE_SAMPLE if (!$parentParam instanceof Param) { continue; } - if ($parentParam->type === null) { + if (!$parentParam->type instanceof Node) { continue; } // mimic type diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnNeverTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnNeverTypeRector.php index ba6da9cd683..49e8d0be5ff 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnNeverTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnNeverTypeRector.php @@ -21,14 +21,12 @@ final class ReturnNeverTypeRector extends AbstractRector implements MinPhpVersio { /** * @readonly - * @var \Rector\TypeDeclaration\NodeManipulator\AddNeverReturnType */ - private $addNeverReturnType; + private AddNeverReturnType $addNeverReturnType; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(AddNeverReturnType $addNeverReturnType, TestsNodeAnalyzer $testsNodeAnalyzer) { $this->addNeverReturnType = $addNeverReturnType; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnNullableTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnNullableTypeRector.php index eae93244a75..0acd658a77f 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnNullableTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnNullableTypeRector.php @@ -25,19 +25,16 @@ final class ReturnNullableTypeRector extends AbstractRector implements MinPhpVer { /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\TypeMapper\UnionTypeMapper */ - private $unionTypeMapper; + private UnionTypeMapper $unionTypeMapper; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; public function __construct(UnionTypeMapper $unionTypeMapper, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, ReturnTypeInferer $returnTypeInferer) { $this->unionTypeMapper = $unionTypeMapper; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromMockObjectRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromMockObjectRector.php index e7f625a751e..b83fdc8ebf8 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromMockObjectRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromMockObjectRector.php @@ -29,19 +29,16 @@ final class ReturnTypeFromMockObjectRector extends AbstractRector implements Min { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; /** * @var string */ diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnCastRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnCastRector.php index c3b7058e3c4..b268bdd7fae 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnCastRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnCastRector.php @@ -20,9 +20,8 @@ final class ReturnTypeFromReturnCastRector extends AbstractRector implements Min { /** * @readonly - * @var \Rector\TypeDeclaration\NodeManipulator\AddReturnTypeFromCast */ - private $addReturnTypeFromCast; + private AddReturnTypeFromCast $addReturnTypeFromCast; public function __construct(AddReturnTypeFromCast $addReturnTypeFromCast) { $this->addReturnTypeFromCast = $addReturnTypeFromCast; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnDirectArrayRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnDirectArrayRector.php index a19e5bea602..56eef299de5 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnDirectArrayRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnDirectArrayRector.php @@ -24,14 +24,12 @@ final class ReturnTypeFromReturnDirectArrayRector extends AbstractRector impleme { /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; public function __construct(ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, ReturnTypeInferer $returnTypeInferer) { $this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php index 305b456b340..9ec42622ebe 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php @@ -44,59 +44,48 @@ final class ReturnTypeFromReturnNewRector extends AbstractRector implements MinP { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnTypeAnalyzer\StrictReturnNewAnalyzer */ - private $strictReturnNewAnalyzer; + private StrictReturnNewAnalyzer $strictReturnNewAnalyzer; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver\NewTypeResolver */ - private $newTypeResolver; + private NewTypeResolver $newTypeResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer */ - private $controllerAnalyzer; + private ControllerAnalyzer $controllerAnalyzer; public function __construct(TypeFactory $typeFactory, ReflectionProvider $reflectionProvider, ReflectionResolver $reflectionResolver, StrictReturnNewAnalyzer $strictReturnNewAnalyzer, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, ClassAnalyzer $classAnalyzer, NewTypeResolver $newTypeResolver, BetterNodeFinder $betterNodeFinder, StaticTypeMapper $staticTypeMapper, ReturnAnalyzer $returnAnalyzer, ControllerAnalyzer $controllerAnalyzer) { $this->typeFactory = $typeFactory; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictConstantReturnRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictConstantReturnRector.php index fa5cb876aed..60acae2cdec 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictConstantReturnRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictConstantReturnRector.php @@ -28,29 +28,24 @@ final class ReturnTypeFromStrictConstantReturnRector extends AbstractRector impl { /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; public function __construct(ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, StaticTypeMapper $staticTypeMapper, BetterNodeFinder $betterNodeFinder, TypeFactory $typeFactory, ReturnAnalyzer $returnAnalyzer) { $this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictFluentReturnRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictFluentReturnRector.php index 13bc00af566..59036856aa1 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictFluentReturnRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictFluentReturnRector.php @@ -27,24 +27,20 @@ final class ReturnTypeFromStrictFluentReturnRector extends AbstractRector implem { /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, ReflectionResolver $reflectionResolver, ReturnTypeInferer $returnTypeInferer, PhpVersionProvider $phpVersionProvider) { $this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector.php index 1f0158e6dc1..d5c1aff6942 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNativeCallRector.php @@ -20,9 +20,8 @@ final class ReturnTypeFromStrictNativeCallRector extends AbstractRector implemen { /** * @readonly - * @var \Rector\TypeDeclaration\NodeManipulator\AddReturnTypeFromStrictNativeCall */ - private $addReturnTypeFromStrictNativeCall; + private AddReturnTypeFromStrictNativeCall $addReturnTypeFromStrictNativeCall; public function __construct(AddReturnTypeFromStrictNativeCall $addReturnTypeFromStrictNativeCall) { $this->addReturnTypeFromStrictNativeCall = $addReturnTypeFromStrictNativeCall; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php index d10fe9f1422..2f4194ee208 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php @@ -39,34 +39,28 @@ final class ReturnTypeFromStrictNewArrayRector extends AbstractRector implements { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; public function __construct(PhpDocTypeChanger $phpDocTypeChanger, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, ReturnTypeInferer $returnTypeInferer, PhpDocInfoFactory $phpDocInfoFactory, BetterNodeFinder $betterNodeFinder, ReturnAnalyzer $returnAnalyzer) { $this->phpDocTypeChanger = $phpDocTypeChanger; @@ -165,7 +159,7 @@ CODE_SAMPLE // always returns array $node->returnType = new Identifier('array'); // add more precise array type if suitable - if ($returnType instanceof ArrayType && $this->shouldAddReturnArrayDocType($returnType)) { + if ($this->shouldAddReturnArrayDocType($returnType)) { $this->changeReturnType($node, $returnType); } return $node; @@ -182,8 +176,9 @@ CODE_SAMPLE } /** * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure $node + * @param \PHPStan\Type\ArrayType|\PHPStan\Type\Constant\ConstantArrayType $arrayType */ - private function changeReturnType($node, ArrayType $arrayType) : void + private function changeReturnType($node, $arrayType) : void { $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node); // skip already filled type, on purpose @@ -256,7 +251,10 @@ CODE_SAMPLE } return $variables; } - private function shouldAddReturnArrayDocType(ArrayType $arrayType) : bool + /** + * @param \PHPStan\Type\ArrayType|\PHPStan\Type\Constant\ConstantArrayType $arrayType + */ + private function shouldAddReturnArrayDocType($arrayType) : bool { if ($arrayType instanceof ConstantArrayType) { if ($arrayType->getItemType() instanceof NeverType) { diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictParamRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictParamRector.php index 94497b8943f..1991ae75632 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictParamRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictParamRector.php @@ -20,9 +20,8 @@ final class ReturnTypeFromStrictParamRector extends AbstractRector implements Mi { /** * @readonly - * @var \Rector\TypeDeclaration\NodeManipulator\AddReturnTypeFromParam */ - private $addReturnTypeFromParam; + private AddReturnTypeFromParam $addReturnTypeFromParam; public function __construct(AddReturnTypeFromParam $addReturnTypeFromParam) { $this->addReturnTypeFromParam = $addReturnTypeFromParam; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php index 975c4f012d3..50908191e4c 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php @@ -39,44 +39,36 @@ final class ReturnTypeFromStrictTypedCallRector extends AbstractRector implement { /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\TypeNodeUnwrapper */ - private $typeNodeUnwrapper; + private TypeNodeUnwrapper $typeNodeUnwrapper; /** * @readonly - * @var \Rector\TypeDeclaration\TypeAnalyzer\ReturnStrictTypeAnalyzer */ - private $returnStrictTypeAnalyzer; + private ReturnStrictTypeAnalyzer $returnStrictTypeAnalyzer; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(TypeNodeUnwrapper $typeNodeUnwrapper, ReturnStrictTypeAnalyzer $returnStrictTypeAnalyzer, ReturnTypeInferer $returnTypeInferer, BetterNodeFinder $betterNodeFinder, PhpVersionProvider $phpVersionProvider, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, ReturnAnalyzer $returnAnalyzer, StaticTypeMapper $staticTypeMapper) { $this->typeNodeUnwrapper = $typeNodeUnwrapper; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php index 65296a69e14..e6131fe72e0 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php @@ -31,34 +31,28 @@ final class ReturnTypeFromStrictTypedPropertyRector extends AbstractRector imple { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; public function __construct(TypeFactory $typeFactory, ReflectionResolver $reflectionResolver, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, BetterNodeFinder $betterNodeFinder, StaticTypeMapper $staticTypeMapper, ReturnAnalyzer $returnAnalyzer) { $this->typeFactory = $typeFactory; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromSymfonySerializerRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromSymfonySerializerRector.php index e335f063e5e..d240835c92d 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromSymfonySerializerRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromSymfonySerializerRector.php @@ -25,19 +25,16 @@ final class ReturnTypeFromSymfonySerializerRector extends AbstractRector impleme { /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\ArgsAnalyzer */ - private $argsAnalyzer; + private ArgsAnalyzer $argsAnalyzer; public function __construct(ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, ValueResolver $valueResolver, ArgsAnalyzer $argsAnalyzer) { $this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnUnionTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnUnionTypeRector.php index c657641247d..a5884789ceb 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnUnionTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnUnionTypeRector.php @@ -20,9 +20,8 @@ final class ReturnUnionTypeRector extends AbstractRector implements MinPhpVersio { /** * @readonly - * @var \Rector\TypeDeclaration\NodeManipulator\AddUnionReturnType */ - private $addUnionReturnType; + private AddUnionReturnType $addUnionReturnType; public function __construct(AddUnionReturnType $addUnionReturnType) { $this->addUnionReturnType = $addUnionReturnType; diff --git a/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php b/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php index 170d94e7dad..78c56c6eb93 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\ClassMethod; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrayDimFetch; @@ -25,7 +26,6 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Echo_; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Function_; -use PhpParser\NodeTraverser; use Rector\Rector\AbstractRector; use Rector\VendorLocker\ParentClassMethodTypeOverrideGuard; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -37,9 +37,8 @@ final class StrictArrayParamDimFetchRector extends AbstractRector { /** * @readonly - * @var \Rector\VendorLocker\ParentClassMethodTypeOverrideGuard */ - private $parentClassMethodTypeOverrideGuard; + private ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard; public function __construct(ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard) { $this->parentClassMethodTypeOverrideGuard = $parentClassMethodTypeOverrideGuard; @@ -115,12 +114,12 @@ CODE_SAMPLE $isParamAccessedArrayDimFetch = \false; $this->traverseNodesWithCallable($functionLike->stmts, function (Node $node) use($param, $paramName, &$isParamAccessedArrayDimFetch) : ?int { if ($node instanceof Class_ || $node instanceof FunctionLike) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($this->shouldStop($node, $param, $paramName)) { // force set to false to avoid too early replaced $isParamAccessedArrayDimFetch = \false; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } if (!$node instanceof ArrayDimFetch) { return null; @@ -139,7 +138,7 @@ CODE_SAMPLE if ($variableType->isString()->yes()) { // force set to false to avoid too early replaced $isParamAccessedArrayDimFetch = \false; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } // skip integer in possibly string type as string can be accessed via int $dimType = $this->getType($node->dim); diff --git a/rules/TypeDeclaration/Rector/ClassMethod/StrictStringParamConcatRector.php b/rules/TypeDeclaration/Rector/ClassMethod/StrictStringParamConcatRector.php index b6407b5d47b..04bfbda0014 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/StrictStringParamConcatRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/StrictStringParamConcatRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\ClassMethod; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Assign; @@ -16,7 +17,6 @@ use PhpParser\Node\Param; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; -use PhpParser\NodeTraverser; use PHPStan\Type\MixedType; use PHPStan\Type\Type; use PHPStan\Type\TypeCombinator; @@ -32,14 +32,12 @@ final class StrictStringParamConcatRector extends AbstractRector { /** * @readonly - * @var \Rector\VendorLocker\ParentClassMethodTypeOverrideGuard */ - private $parentClassMethodTypeOverrideGuard; + private ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard, PhpDocInfoFactory $phpDocInfoFactory) { $this->parentClassMethodTypeOverrideGuard = $parentClassMethodTypeOverrideGuard; @@ -132,11 +130,11 @@ CODE_SAMPLE $this->traverseNodesWithCallable($functionLike->stmts, function (Node $node) use($paramName, &$variableConcatted) : ?int { // skip nested class and function nodes if ($node instanceof FunctionLike || $node instanceof Class_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($node instanceof Assign && $node->var instanceof Variable && $this->isName($node->var, $paramName)) { $variableConcatted = null; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } $expr = $this->resolveAssignConcatVariable($node, $paramName); if ($expr instanceof Variable) { diff --git a/rules/TypeDeclaration/Rector/ClassMethod/StringReturnTypeFromStrictScalarReturnsRector.php b/rules/TypeDeclaration/Rector/ClassMethod/StringReturnTypeFromStrictScalarReturnsRector.php index 2e730b0a408..a6556022fc1 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/StringReturnTypeFromStrictScalarReturnsRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/StringReturnTypeFromStrictScalarReturnsRector.php @@ -3,9 +3,9 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\ClassMethod; +use PhpParser\Node\Scalar\InterpolatedString; use PhpParser\Node; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\Encapsed; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; @@ -26,19 +26,16 @@ final class StringReturnTypeFromStrictScalarReturnsRector extends AbstractRector { /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; public function __construct(ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, BetterNodeFinder $betterNodeFinder, ReturnAnalyzer $returnAnalyzer) { $this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard; @@ -98,7 +95,7 @@ CODE_SAMPLE } foreach ($returns as $return) { // we need exact string "value" return - if (!$return->expr instanceof String_ && !$return->expr instanceof Encapsed) { + if (!$return->expr instanceof String_ && !$return->expr instanceof InterpolatedString) { return null; } } diff --git a/rules/TypeDeclaration/Rector/ClassMethod/StringReturnTypeFromStrictStringReturnsRector.php b/rules/TypeDeclaration/Rector/ClassMethod/StringReturnTypeFromStrictStringReturnsRector.php index 788570a869c..fc3ca20ba30 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/StringReturnTypeFromStrictStringReturnsRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/StringReturnTypeFromStrictStringReturnsRector.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\ClassMethod; +use PhpParser\Node\Scalar\InterpolatedString; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\Encapsed; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; @@ -28,19 +28,16 @@ final class StringReturnTypeFromStrictStringReturnsRector extends AbstractRector { /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; public function __construct(ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, BetterNodeFinder $betterNodeFinder, ReturnAnalyzer $returnAnalyzer) { $this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard; @@ -133,7 +130,7 @@ CODE_SAMPLE { foreach ($returns as $return) { // we need exact string "value" return - if (!$return->expr instanceof String_ && !$return->expr instanceof Encapsed) { + if (!$return->expr instanceof String_ && !$return->expr instanceof InterpolatedString) { return \false; } } diff --git a/rules/TypeDeclaration/Rector/Class_/AddTestsVoidReturnTypeWhereNoReturnRector.php b/rules/TypeDeclaration/Rector/Class_/AddTestsVoidReturnTypeWhereNoReturnRector.php index a91ba1eefde..1e06c00d3b6 100644 --- a/rules/TypeDeclaration/Rector/Class_/AddTestsVoidReturnTypeWhereNoReturnRector.php +++ b/rules/TypeDeclaration/Rector/Class_/AddTestsVoidReturnTypeWhereNoReturnRector.php @@ -20,14 +20,12 @@ final class AddTestsVoidReturnTypeWhereNoReturnRector extends AbstractRector imp { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\SilentVoidResolver */ - private $silentVoidResolver; + private SilentVoidResolver $silentVoidResolver; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, SilentVoidResolver $silentVoidResolver) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/rules/TypeDeclaration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector.php b/rules/TypeDeclaration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector.php index f765b42f9a2..16396a0a958 100644 --- a/rules/TypeDeclaration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector.php +++ b/rules/TypeDeclaration/Rector/Class_/ChildDoctrineRepositoryClassTypeRector.php @@ -14,7 +14,6 @@ use PhpParser\NodeFinder; use PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode; use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode; -use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; use PHPStan\Type\ObjectType; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; @@ -30,19 +29,16 @@ final class ChildDoctrineRepositoryClassTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \PhpParser\NodeFinder */ - private $nodeFinder; + private NodeFinder $nodeFinder; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, NodeFinder $nodeFinder, DocBlockUpdater $docBlockUpdater) { $this->phpDocInfoFactory = $phpDocInfoFactory; @@ -145,10 +141,6 @@ CODE_SAMPLE if (!$extendsTagValueNode instanceof ExtendsTagValueNode) { return null; } - // we look for generic type class - if (!$extendsTagValueNode->type instanceof GenericTypeNode) { - return null; - } $genericTypeNode = $extendsTagValueNode->type; if ($genericTypeNode->type->name !== 'EntityRepository') { return null; diff --git a/rules/TypeDeclaration/Rector/Class_/MergeDateTimePropertyTypeDeclarationRector.php b/rules/TypeDeclaration/Rector/Class_/MergeDateTimePropertyTypeDeclarationRector.php index 00c769ecb20..07c4900ecff 100644 --- a/rules/TypeDeclaration/Rector/Class_/MergeDateTimePropertyTypeDeclarationRector.php +++ b/rules/TypeDeclaration/Rector/Class_/MergeDateTimePropertyTypeDeclarationRector.php @@ -23,14 +23,12 @@ final class MergeDateTimePropertyTypeDeclarationRector extends AbstractRector im { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/rules/TypeDeclaration/Rector/Class_/PropertyTypeFromStrictSetterGetterRector.php b/rules/TypeDeclaration/Rector/Class_/PropertyTypeFromStrictSetterGetterRector.php index e07438994a8..ee9680c5dcf 100644 --- a/rules/TypeDeclaration/Rector/Class_/PropertyTypeFromStrictSetterGetterRector.php +++ b/rules/TypeDeclaration/Rector/Class_/PropertyTypeFromStrictSetterGetterRector.php @@ -31,29 +31,24 @@ final class PropertyTypeFromStrictSetterGetterRector extends AbstractRector impl { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\GetterTypeDeclarationPropertyTypeInferer */ - private $getterTypeDeclarationPropertyTypeInferer; + private GetterTypeDeclarationPropertyTypeInferer $getterTypeDeclarationPropertyTypeInferer; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\SetterTypeDeclarationPropertyTypeInferer */ - private $setterTypeDeclarationPropertyTypeInferer; + private SetterTypeDeclarationPropertyTypeInferer $setterTypeDeclarationPropertyTypeInferer; /** * @readonly - * @var \Rector\Php74\Guard\MakePropertyTypedGuard */ - private $makePropertyTypedGuard; + private MakePropertyTypedGuard $makePropertyTypedGuard; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(GetterTypeDeclarationPropertyTypeInferer $getterTypeDeclarationPropertyTypeInferer, SetterTypeDeclarationPropertyTypeInferer $setterTypeDeclarationPropertyTypeInferer, MakePropertyTypedGuard $makePropertyTypedGuard, ReflectionResolver $reflectionResolver, StaticTypeMapper $staticTypeMapper) { $this->getterTypeDeclarationPropertyTypeInferer = $getterTypeDeclarationPropertyTypeInferer; diff --git a/rules/TypeDeclaration/Rector/Class_/ReturnTypeFromStrictTernaryRector.php b/rules/TypeDeclaration/Rector/Class_/ReturnTypeFromStrictTernaryRector.php index 066e1514174..29f3638fdd8 100644 --- a/rules/TypeDeclaration/Rector/Class_/ReturnTypeFromStrictTernaryRector.php +++ b/rules/TypeDeclaration/Rector/Class_/ReturnTypeFromStrictTernaryRector.php @@ -31,29 +31,24 @@ final class ReturnTypeFromStrictTernaryRector extends AbstractRector implements { /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; public function __construct(ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, ReturnTypeInferer $returnTypeInferer, BetterNodeFinder $betterNodeFinder, StaticTypeMapper $staticTypeMapper, ReturnAnalyzer $returnAnalyzer) { $this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard; diff --git a/rules/TypeDeclaration/Rector/Class_/TypedPropertyFromCreateMockAssignRector.php b/rules/TypeDeclaration/Rector/Class_/TypedPropertyFromCreateMockAssignRector.php index 3e0f9f6e23c..fca0589286a 100644 --- a/rules/TypeDeclaration/Rector/Class_/TypedPropertyFromCreateMockAssignRector.php +++ b/rules/TypeDeclaration/Rector/Class_/TypedPropertyFromCreateMockAssignRector.php @@ -25,19 +25,16 @@ final class TypedPropertyFromCreateMockAssignRector extends AbstractRector imple { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\AssignToPropertyTypeInferer */ - private $assignToPropertyTypeInferer; + private AssignToPropertyTypeInferer $assignToPropertyTypeInferer; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector */ - private $constructorAssignDetector; + private ConstructorAssignDetector $constructorAssignDetector; /** * @var string */ diff --git a/rules/TypeDeclaration/Rector/Class_/TypedPropertyFromJMSSerializerAttributeTypeRector.php b/rules/TypeDeclaration/Rector/Class_/TypedPropertyFromJMSSerializerAttributeTypeRector.php index 675df860e53..fadae6733ed 100644 --- a/rules/TypeDeclaration/Rector/Class_/TypedPropertyFromJMSSerializerAttributeTypeRector.php +++ b/rules/TypeDeclaration/Rector/Class_/TypedPropertyFromJMSSerializerAttributeTypeRector.php @@ -36,44 +36,36 @@ final class TypedPropertyFromJMSSerializerAttributeTypeRector extends AbstractRe { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\AllAssignNodePropertyTypeInferer */ - private $allAssignNodePropertyTypeInferer; + private AllAssignNodePropertyTypeInferer $allAssignNodePropertyTypeInferer; /** * @readonly - * @var \Rector\Php74\Guard\MakePropertyTypedGuard */ - private $makePropertyTypedGuard; + private MakePropertyTypedGuard $makePropertyTypedGuard; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @readonly - * @var \Rector\StaticTypeMapper\Mapper\ScalarStringToTypeMapper */ - private $scalarStringToTypeMapper; + private ScalarStringToTypeMapper $scalarStringToTypeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector */ - private $constructorAssignDetector; + private ConstructorAssignDetector $constructorAssignDetector; /** * @var string */ diff --git a/rules/TypeDeclaration/Rector/Closure/AddClosureNeverReturnTypeRector.php b/rules/TypeDeclaration/Rector/Closure/AddClosureNeverReturnTypeRector.php index 8b0caff5af4..145811753d4 100644 --- a/rules/TypeDeclaration/Rector/Closure/AddClosureNeverReturnTypeRector.php +++ b/rules/TypeDeclaration/Rector/Closure/AddClosureNeverReturnTypeRector.php @@ -19,9 +19,8 @@ final class AddClosureNeverReturnTypeRector extends AbstractRector implements Mi { /** * @readonly - * @var \Rector\TypeDeclaration\NodeManipulator\AddNeverReturnType */ - private $addNeverReturnType; + private AddNeverReturnType $addNeverReturnType; public function __construct(AddNeverReturnType $addNeverReturnType) { $this->addNeverReturnType = $addNeverReturnType; diff --git a/rules/TypeDeclaration/Rector/Closure/AddClosureVoidReturnTypeWhereNoReturnRector.php b/rules/TypeDeclaration/Rector/Closure/AddClosureVoidReturnTypeWhereNoReturnRector.php index 21d5aaa871d..bd8abc94670 100644 --- a/rules/TypeDeclaration/Rector/Closure/AddClosureVoidReturnTypeWhereNoReturnRector.php +++ b/rules/TypeDeclaration/Rector/Closure/AddClosureVoidReturnTypeWhereNoReturnRector.php @@ -19,9 +19,8 @@ final class AddClosureVoidReturnTypeWhereNoReturnRector extends AbstractRector i { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\SilentVoidResolver */ - private $silentVoidResolver; + private SilentVoidResolver $silentVoidResolver; public function __construct(SilentVoidResolver $silentVoidResolver) { $this->silentVoidResolver = $silentVoidResolver; diff --git a/rules/TypeDeclaration/Rector/Closure/ClosureReturnTypeRector.php b/rules/TypeDeclaration/Rector/Closure/ClosureReturnTypeRector.php index 0da137c6d81..d8ca65c3bb3 100644 --- a/rules/TypeDeclaration/Rector/Closure/ClosureReturnTypeRector.php +++ b/rules/TypeDeclaration/Rector/Closure/ClosureReturnTypeRector.php @@ -21,14 +21,12 @@ final class ClosureReturnTypeRector extends AbstractRector implements MinPhpVers { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(ReturnTypeInferer $returnTypeInferer, StaticTypeMapper $staticTypeMapper) { $this->returnTypeInferer = $returnTypeInferer; diff --git a/rules/TypeDeclaration/Rector/Empty_/EmptyOnNullableObjectToInstanceOfRector.php b/rules/TypeDeclaration/Rector/Empty_/EmptyOnNullableObjectToInstanceOfRector.php index 97c042bec7c..ded65ef5331 100644 --- a/rules/TypeDeclaration/Rector/Empty_/EmptyOnNullableObjectToInstanceOfRector.php +++ b/rules/TypeDeclaration/Rector/Empty_/EmptyOnNullableObjectToInstanceOfRector.php @@ -25,9 +25,8 @@ final class EmptyOnNullableObjectToInstanceOfRector extends AbstractRector { /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(StaticTypeMapper $staticTypeMapper) { $this->staticTypeMapper = $staticTypeMapper; diff --git a/rules/TypeDeclaration/Rector/Expression/InlineVarDocTagToAssertRector.php b/rules/TypeDeclaration/Rector/Expression/InlineVarDocTagToAssertRector.php index cfe783c86d5..892406067fa 100644 --- a/rules/TypeDeclaration/Rector/Expression/InlineVarDocTagToAssertRector.php +++ b/rules/TypeDeclaration/Rector/Expression/InlineVarDocTagToAssertRector.php @@ -29,19 +29,16 @@ final class InlineVarDocTagToAssertRector extends AbstractRector implements MinP { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\TypeDeclaration\PhpDocParser\TypeExpressionFromVarTagResolver */ - private $typeExpressionFromVarTagResolver; + private TypeExpressionFromVarTagResolver $typeExpressionFromVarTagResolver; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater, TypeExpressionFromVarTagResolver $typeExpressionFromVarTagResolver) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromArgRector.php b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromArgRector.php index a27e1808ae2..28a9ad1340d 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromArgRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromArgRector.php @@ -35,19 +35,16 @@ final class AddClosureParamTypeFromArgRector extends AbstractRector implements C { /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @var int */ @@ -55,7 +52,7 @@ final class AddClosureParamTypeFromArgRector extends AbstractRector implements C /** * @var AddClosureParamTypeFromArg[] */ - private $addClosureParamTypeFromArgs = []; + private array $addClosureParamTypeFromArgs = []; public function __construct(TypeComparator $typeComparator, StaticTypeMapper $staticTypeMapper, ReflectionProvider $reflectionProvider) { $this->typeComparator = $typeComparator; diff --git a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromIterableMethodCallRector.php b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromIterableMethodCallRector.php index 751ed43526f..8df1cc47297 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromIterableMethodCallRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromIterableMethodCallRector.php @@ -31,24 +31,20 @@ final class AddClosureParamTypeFromIterableMethodCallRector extends AbstractRect { /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\Reflection\MethodReflectionResolver */ - private $methodReflectionResolver; + private MethodReflectionResolver $methodReflectionResolver; /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\Utils\TypeUnwrapper */ - private $typeUnwrapper; + private TypeUnwrapper $typeUnwrapper; public function __construct(TypeComparator $typeComparator, StaticTypeMapper $staticTypeMapper, MethodReflectionResolver $methodReflectionResolver, TypeUnwrapper $typeUnwrapper) { $this->typeComparator = $typeComparator; diff --git a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromObjectRector.php b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromObjectRector.php index f1d2aaa6f9d..566499060cc 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromObjectRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeFromObjectRector.php @@ -30,14 +30,12 @@ final class AddClosureParamTypeFromObjectRector extends AbstractRector implement { /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @var int */ @@ -45,7 +43,7 @@ final class AddClosureParamTypeFromObjectRector extends AbstractRector implement /** * @var AddClosureParamTypeFromObject[] */ - private $addClosureParamTypeFromObjects = []; + private array $addClosureParamTypeFromObjects = []; public function __construct(TypeComparator $typeComparator, StaticTypeMapper $staticTypeMapper) { $this->typeComparator = $typeComparator; diff --git a/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeForFunctionLikeWithinCallLikeArgDeclarationRector.php b/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeForFunctionLikeWithinCallLikeArgDeclarationRector.php index 84b721fd487..cc9f8d7acb4 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeForFunctionLikeWithinCallLikeArgDeclarationRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeForFunctionLikeWithinCallLikeArgDeclarationRector.php @@ -31,27 +31,21 @@ final class AddParamTypeForFunctionLikeWithinCallLikeArgDeclarationRector extend { /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @var AddParamTypeForFunctionLikeWithinCallLikeArgDeclaration[] */ - private $addParamTypeForFunctionLikeParamDeclarations = []; - /** - * @var bool - */ - private $hasChanged = \false; + private array $addParamTypeForFunctionLikeParamDeclarations = []; + private bool $hasChanged = \false; public function __construct(TypeComparator $typeComparator, PhpVersionProvider $phpVersionProvider, StaticTypeMapper $staticTypeMapper) { $this->typeComparator = $typeComparator; @@ -93,7 +87,7 @@ CODE_SAMPLE $type = null; break; } - if ($type === null) { + if (!$type instanceof Node) { continue; } if (!$this->isObjectType($type, $addParamTypeForFunctionLikeParamDeclaration->getObjectType())) { @@ -134,12 +128,12 @@ CODE_SAMPLE return; } // int positions shouldn't have names - if ($arg->name !== null) { + if ($arg->name instanceof Identifier) { return; } } else { $args = \array_filter($callLike->getArgs(), static function (Arg $arg) use($addParamTypeForFunctionLikeWithinCallLikeArgDeclaration) : bool { - if ($arg->name === null) { + if (!$arg->name instanceof Identifier) { return \false; } return $arg->name->name === $addParamTypeForFunctionLikeWithinCallLikeArgDeclaration->getCallLikePosition(); @@ -162,7 +156,7 @@ CODE_SAMPLE { $newParameterType = $addParamTypeForFunctionLikeWithinCallLikeArgDeclaration->getParamType(); // already set → no change - if ($param->type !== null) { + if ($param->type instanceof Node) { $currentParamType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($param->type); if ($this->typeComparator->areTypesEqual($currentParamType, $newParameterType)) { return; diff --git a/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeSplFixedArrayRector.php b/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeSplFixedArrayRector.php index b29ac018892..820964bdbbc 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeSplFixedArrayRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/AddParamTypeSplFixedArrayRector.php @@ -23,14 +23,12 @@ final class AddParamTypeSplFixedArrayRector extends AbstractRector { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var array */ diff --git a/rules/TypeDeclaration/Rector/FunctionLike/AddReturnTypeDeclarationFromYieldsRector.php b/rules/TypeDeclaration/Rector/FunctionLike/AddReturnTypeDeclarationFromYieldsRector.php index f1a69612d01..16b662f8ac3 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/AddReturnTypeDeclarationFromYieldsRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/AddReturnTypeDeclarationFromYieldsRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\FunctionLike; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Closure; @@ -16,7 +17,6 @@ use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Function_; -use PhpParser\NodeTraverser; use PHPStan\Type\MixedType; use PHPStan\Type\Type; use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory; @@ -39,24 +39,20 @@ final class AddReturnTypeDeclarationFromYieldsRector extends AbstractRector impl { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; public function __construct(TypeFactory $typeFactory, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, StaticTypeMapper $staticTypeMapper, ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard) { $this->typeFactory = $typeFactory; @@ -134,15 +130,15 @@ CODE_SAMPLE $this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $functionLike->getStmts(), static function (Node $node) use(&$yieldNodes) : ?int { // skip anonymous class and inner function if ($node instanceof Class_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } // skip nested scope if ($node instanceof FunctionLike) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($node instanceof Stmt && !$node instanceof Expression) { $yieldNodes = []; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } if (!$node instanceof Yield_ && !$node instanceof YieldFrom) { return null; diff --git a/rules/TypeDeclaration/Rector/Function_/AddFunctionVoidReturnTypeWhereNoReturnRector.php b/rules/TypeDeclaration/Rector/Function_/AddFunctionVoidReturnTypeWhereNoReturnRector.php index 19b9eb85016..4d1c2d42e25 100644 --- a/rules/TypeDeclaration/Rector/Function_/AddFunctionVoidReturnTypeWhereNoReturnRector.php +++ b/rules/TypeDeclaration/Rector/Function_/AddFunctionVoidReturnTypeWhereNoReturnRector.php @@ -19,9 +19,8 @@ final class AddFunctionVoidReturnTypeWhereNoReturnRector extends AbstractRector { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\SilentVoidResolver */ - private $silentVoidResolver; + private SilentVoidResolver $silentVoidResolver; public function __construct(SilentVoidResolver $silentVoidResolver) { $this->silentVoidResolver = $silentVoidResolver; diff --git a/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php b/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php index 365902cf029..502799b4618 100644 --- a/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php +++ b/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php @@ -24,13 +24,12 @@ final class AddPropertyTypeDeclarationRector extends AbstractRector implements C { /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @var AddPropertyTypeDeclaration[] */ - private $addPropertyTypeDeclarations = []; + private array $addPropertyTypeDeclarations = []; public function __construct(StaticTypeMapper $staticTypeMapper) { $this->staticTypeMapper = $staticTypeMapper; diff --git a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php index ef501e75b7a..f49266cdc09 100644 --- a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php +++ b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php @@ -39,49 +39,40 @@ final class TypedPropertyFromAssignsRector extends AbstractRector implements Min { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\AllAssignNodePropertyTypeInferer */ - private $allAssignNodePropertyTypeInferer; + private AllAssignNodePropertyTypeInferer $allAssignNodePropertyTypeInferer; /** * @readonly - * @var \Rector\TypeDeclaration\NodeTypeAnalyzer\PropertyTypeDecorator */ - private $propertyTypeDecorator; + private PropertyTypeDecorator $propertyTypeDecorator; /** * @readonly - * @var \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover */ - private $varTagRemover; + private VarTagRemover $varTagRemover; /** * @readonly - * @var \Rector\Php74\Guard\MakePropertyTypedGuard */ - private $makePropertyTypedGuard; + private MakePropertyTypedGuard $makePropertyTypedGuard; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttrinationFinder */ - private $attrinationFinder; + private AttrinationFinder $attrinationFinder; /** * @api * @var string @@ -94,9 +85,8 @@ final class TypedPropertyFromAssignsRector extends AbstractRector implements Min * - protected modifier property on final class without extends or has extends but property and/or its usage only in current class * * Set to true will allow change other modifiers as well as far as not forbidden, eg: callable type, null type, etc. - * @var bool */ - private $inlinePublic = \false; + private bool $inlinePublic = \false; public function __construct(AllAssignNodePropertyTypeInferer $allAssignNodePropertyTypeInferer, PropertyTypeDecorator $propertyTypeDecorator, VarTagRemover $varTagRemover, MakePropertyTypedGuard $makePropertyTypedGuard, ReflectionResolver $reflectionResolver, PhpDocInfoFactory $phpDocInfoFactory, ValueResolver $valueResolver, StaticTypeMapper $staticTypeMapper, AttrinationFinder $attrinationFinder) { $this->allAssignNodePropertyTypeInferer = $allAssignNodePropertyTypeInferer; diff --git a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php index 1c0b34af632..af76800f744 100644 --- a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php +++ b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php @@ -33,54 +33,44 @@ final class TypedPropertyFromStrictConstructorRector extends AbstractRector impl { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\TrustedClassMethodPropertyTypeInferer */ - private $trustedClassMethodPropertyTypeInferer; + private TrustedClassMethodPropertyTypeInferer $trustedClassMethodPropertyTypeInferer; /** * @readonly - * @var \Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover */ - private $varTagRemover; + private VarTagRemover $varTagRemover; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector */ - private $constructorAssignDetector; + private ConstructorAssignDetector $constructorAssignDetector; /** * @readonly - * @var \Rector\TypeDeclaration\Guard\PropertyTypeOverrideGuard */ - private $propertyTypeOverrideGuard; + private PropertyTypeOverrideGuard $propertyTypeOverrideGuard; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\DoctrineTypeAnalyzer */ - private $doctrineTypeAnalyzer; + private DoctrineTypeAnalyzer $doctrineTypeAnalyzer; /** * @readonly - * @var \Rector\TypeDeclaration\TypeAnalyzer\PropertyTypeDefaultValueAnalyzer */ - private $propertyTypeDefaultValueAnalyzer; + private PropertyTypeDefaultValueAnalyzer $propertyTypeDefaultValueAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(TrustedClassMethodPropertyTypeInferer $trustedClassMethodPropertyTypeInferer, VarTagRemover $varTagRemover, PhpDocTypeChanger $phpDocTypeChanger, ConstructorAssignDetector $constructorAssignDetector, PropertyTypeOverrideGuard $propertyTypeOverrideGuard, ReflectionResolver $reflectionResolver, DoctrineTypeAnalyzer $doctrineTypeAnalyzer, PropertyTypeDefaultValueAnalyzer $propertyTypeDefaultValueAnalyzer, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper) { $this->trustedClassMethodPropertyTypeInferer = $trustedClassMethodPropertyTypeInferer; diff --git a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictSetUpRector.php b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictSetUpRector.php index 98cc969d218..4cc8adbbf69 100644 --- a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictSetUpRector.php +++ b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictSetUpRector.php @@ -28,24 +28,20 @@ final class TypedPropertyFromStrictSetUpRector extends AbstractRector implements { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\TrustedClassMethodPropertyTypeInferer */ - private $trustedClassMethodPropertyTypeInferer; + private TrustedClassMethodPropertyTypeInferer $trustedClassMethodPropertyTypeInferer; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(TrustedClassMethodPropertyTypeInferer $trustedClassMethodPropertyTypeInferer, StaticTypeMapper $staticTypeMapper, PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater) { $this->trustedClassMethodPropertyTypeInferer = $trustedClassMethodPropertyTypeInferer; diff --git a/rules/TypeDeclaration/Rector/StmtsAwareInterface/DeclareStrictTypesRector.php b/rules/TypeDeclaration/Rector/StmtsAwareInterface/DeclareStrictTypesRector.php index 22ae8441460..622d76cbd42 100644 --- a/rules/TypeDeclaration/Rector/StmtsAwareInterface/DeclareStrictTypesRector.php +++ b/rules/TypeDeclaration/Rector/StmtsAwareInterface/DeclareStrictTypesRector.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\StmtsAwareInterface; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; +use PhpParser\Node\DeclareItem; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Declare_; -use PhpParser\Node\Stmt\DeclareDeclare; use PhpParser\Node\Stmt\Nop; use Rector\ChangesReporting\ValueObject\RectorWithLineChange; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; @@ -26,9 +26,8 @@ final class DeclareStrictTypesRector extends AbstractRector implements HTMLAvers { /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\DeclareStrictTypeFinder */ - private $declareStrictTypeFinder; + private DeclareStrictTypeFinder $declareStrictTypeFinder; public function __construct(DeclareStrictTypeFinder $declareStrictTypeFinder) { $this->declareStrictTypeFinder = $declareStrictTypeFinder; @@ -81,9 +80,9 @@ CODE_SAMPLE if ($this->declareStrictTypeFinder->hasDeclareStrictTypes($stmt)) { return null; } - $declareDeclare = new DeclareDeclare(new Identifier('strict_types'), new LNumber(1)); - $strictTypesDeclare = new Declare_([$declareDeclare]); - $rectorWithLineChange = new RectorWithLineChange(self::class, $stmt->getLine()); + $declareItem = new DeclareItem(new Identifier('strict_types'), new Int_(1)); + $strictTypesDeclare = new Declare_([$declareItem]); + $rectorWithLineChange = new RectorWithLineChange(self::class, $stmt->getStartLine()); $this->file->addRectorClassWithLine($rectorWithLineChange); if ($rootStmt instanceof FileWithoutNamespace) { /** @var Stmt[] $nodes */ diff --git a/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php b/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php index 02b5ef8b6ca..5af249102ae 100644 --- a/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php +++ b/rules/TypeDeclaration/Rector/StmtsAwareInterface/IncreaseDeclareStrictTypesRector.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\StmtsAwareInterface; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; +use PhpParser\Node\DeclareItem; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Declare_; -use PhpParser\Node\Stmt\DeclareDeclare; use PhpParser\Node\Stmt\Nop; use Rector\ChangesReporting\ValueObject\RectorWithLineChange; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; @@ -26,18 +26,11 @@ final class IncreaseDeclareStrictTypesRector extends AbstractRector implements C { /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\DeclareStrictTypeFinder */ - private $declareStrictTypeFinder; + private DeclareStrictTypeFinder $declareStrictTypeFinder; private const LIMIT = 'limit'; - /** - * @var int - */ - private $limit = 10; - /** - * @var int - */ - private $changedItemCount = 0; + private int $limit = 10; + private int $changedItemCount = 0; public function __construct(DeclareStrictTypeFinder $declareStrictTypeFinder) { $this->declareStrictTypeFinder = $declareStrictTypeFinder; @@ -83,7 +76,7 @@ CODE_SAMPLE } ++$this->changedItemCount; $strictTypesDeclare = $this->creteStrictTypesDeclare(); - $rectorWithLineChange = new RectorWithLineChange(self::class, $stmt->getLine()); + $rectorWithLineChange = new RectorWithLineChange(self::class, $stmt->getStartLine()); $this->file->addRectorClassWithLine($rectorWithLineChange); return \array_merge([$strictTypesDeclare, new Nop()], $nodes); } @@ -109,7 +102,7 @@ CODE_SAMPLE } private function creteStrictTypesDeclare() : Declare_ { - $declareDeclare = new DeclareDeclare(new Identifier('strict_types'), new LNumber(1)); - return new Declare_([$declareDeclare]); + $declareItem = new DeclareItem(new Identifier('strict_types'), new Int_(1)); + return new Declare_([$declareItem]); } } diff --git a/rules/TypeDeclaration/Rector/While_/WhileNullableToInstanceofRector.php b/rules/TypeDeclaration/Rector/While_/WhileNullableToInstanceofRector.php index 7da22284bd0..1b631005705 100644 --- a/rules/TypeDeclaration/Rector/While_/WhileNullableToInstanceofRector.php +++ b/rules/TypeDeclaration/Rector/While_/WhileNullableToInstanceofRector.php @@ -24,14 +24,12 @@ final class WhileNullableToInstanceofRector extends AbstractRector { /** * @readonly - * @var \Rector\TypeDeclaration\TypeAnalyzer\NullableTypeAnalyzer */ - private $nullableTypeAnalyzer; + private NullableTypeAnalyzer $nullableTypeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(NullableTypeAnalyzer $nullableTypeAnalyzer, ValueResolver $valueResolver) { $this->nullableTypeAnalyzer = $nullableTypeAnalyzer; diff --git a/rules/TypeDeclaration/TypeAnalyzer/NullableTypeAnalyzer.php b/rules/TypeDeclaration/TypeAnalyzer/NullableTypeAnalyzer.php index ebaa18fbfb9..b0982e6daed 100644 --- a/rules/TypeDeclaration/TypeAnalyzer/NullableTypeAnalyzer.php +++ b/rules/TypeDeclaration/TypeAnalyzer/NullableTypeAnalyzer.php @@ -11,9 +11,8 @@ final class NullableTypeAnalyzer { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeTypeResolver $nodeTypeResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/rules/TypeDeclaration/TypeAnalyzer/PropertyTypeDefaultValueAnalyzer.php b/rules/TypeDeclaration/TypeAnalyzer/PropertyTypeDefaultValueAnalyzer.php index 86bddc0b5a0..2dc05eea1cd 100644 --- a/rules/TypeDeclaration/TypeAnalyzer/PropertyTypeDefaultValueAnalyzer.php +++ b/rules/TypeDeclaration/TypeAnalyzer/PropertyTypeDefaultValueAnalyzer.php @@ -4,27 +4,26 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\TypeAnalyzer; use PhpParser\Node\Expr; -use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\Node\PropertyItem; use PHPStan\Type\Type; use Rector\StaticTypeMapper\StaticTypeMapper; final class PropertyTypeDefaultValueAnalyzer { /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(StaticTypeMapper $staticTypeMapper) { $this->staticTypeMapper = $staticTypeMapper; } - public function doesConflictWithDefaultValue(PropertyProperty $propertyProperty, Type $propertyType) : bool + public function doesConflictWithDefaultValue(PropertyItem $propertyItem, Type $propertyType) : bool { - if (!$propertyProperty->default instanceof Expr) { + if (!$propertyItem->default instanceof Expr) { return \false; } // the defaults can be in conflict - $defaultType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($propertyProperty->default); + $defaultType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($propertyItem->default); if ($defaultType->isArray()->yes() && $propertyType->isArray()->yes()) { return \false; } diff --git a/rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php b/rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php index 0cc79cacf24..53916c8ea67 100644 --- a/rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php +++ b/rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php @@ -3,6 +3,9 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\TypeAnalyzer; +use PHPStan\Reflection\ExtendedParametersAcceptor; +use PhpParser\Node\Scalar\Int_; +use PhpParser\Node\Scalar\Float_; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; @@ -14,15 +17,12 @@ use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\NullableType; use PhpParser\Node\Scalar; -use PhpParser\Node\Scalar\DNumber; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Return_; use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\Native\NativeFunctionReflection; use PHPStan\Reflection\Native\NativeMethodReflection; -use PHPStan\Reflection\ParametersAcceptorWithPhpDocs; use PHPStan\Type\MixedType; use PHPStan\Type\StaticType; use PHPStan\Type\Type; @@ -38,19 +38,16 @@ final class ReturnStrictTypeAnalyzer { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\TypeNodeUnwrapper */ - private $typeNodeUnwrapper; + private TypeNodeUnwrapper $typeNodeUnwrapper; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(ReflectionResolver $reflectionResolver, TypeNodeUnwrapper $typeNodeUnwrapper, StaticTypeMapper $staticTypeMapper) { $this->reflectionResolver = $reflectionResolver; @@ -75,7 +72,7 @@ final class ReturnStrictTypeAnalyzer $returnNode = $this->resolveMethodCallReturnNode($returnedExpr); } elseif ($returnedExpr instanceof ClassConstFetch) { $returnNode = $this->resolveConstFetchReturnNode($returnedExpr, $scope); - } elseif ($returnedExpr instanceof Array_ || $returnedExpr instanceof String_ || $returnedExpr instanceof LNumber || $returnedExpr instanceof DNumber) { + } elseif ($returnedExpr instanceof Array_ || $returnedExpr instanceof String_ || $returnedExpr instanceof Int_ || $returnedExpr instanceof Float_) { $returnNode = $this->resolveLiteralReturnNode($returnedExpr, $scope); } else { return []; @@ -120,7 +117,7 @@ final class ReturnStrictTypeAnalyzer $parametersAcceptorWithPhpDocs = ParametersAcceptorSelectorVariantsWrapper::select($methodReflection, $call, $scope); if ($methodReflection instanceof NativeFunctionReflection || $methodReflection instanceof NativeMethodReflection) { $returnType = $parametersAcceptorWithPhpDocs->getReturnType(); - } elseif ($parametersAcceptorWithPhpDocs instanceof ParametersAcceptorWithPhpDocs) { + } elseif ($parametersAcceptorWithPhpDocs instanceof ExtendedParametersAcceptor) { // native return type is needed, as docblock can be false $returnType = $parametersAcceptorWithPhpDocs->getNativeReturnType(); } else { diff --git a/rules/TypeDeclaration/TypeInferer/AssignToPropertyTypeInferer.php b/rules/TypeDeclaration/TypeInferer/AssignToPropertyTypeInferer.php index 1f7f2e46b2d..44b5d763777 100644 --- a/rules/TypeDeclaration/TypeInferer/AssignToPropertyTypeInferer.php +++ b/rules/TypeDeclaration/TypeInferer/AssignToPropertyTypeInferer.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\TypeInferer; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrayDimFetch; @@ -12,7 +13,6 @@ use PhpParser\Node\Expr\StaticPropertyFetch; use PhpParser\Node\Identifier; use PhpParser\Node\Stmt\ClassLike; use PhpParser\Node\Stmt\Property; -use PhpParser\NodeTraverser; use PHPStan\Type\ArrayType; use PHPStan\Type\MixedType; use PHPStan\Type\NullType; @@ -34,54 +34,44 @@ final class AssignToPropertyTypeInferer { /** * @readonly - * @var \Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector */ - private $constructorAssignDetector; + private ConstructorAssignDetector $constructorAssignDetector; /** * @readonly - * @var \Rector\TypeDeclaration\Matcher\PropertyAssignMatcher */ - private $propertyAssignMatcher; + private PropertyAssignMatcher $propertyAssignMatcher; /** * @readonly - * @var \Rector\TypeDeclaration\AlreadyAssignDetector\PropertyDefaultAssignDetector */ - private $propertyDefaultAssignDetector; + private PropertyDefaultAssignDetector $propertyDefaultAssignDetector; /** * @readonly - * @var \Rector\TypeDeclaration\AlreadyAssignDetector\NullTypeAssignDetector */ - private $nullTypeAssignDetector; + private NullTypeAssignDetector $nullTypeAssignDetector; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; public function __construct(ConstructorAssignDetector $constructorAssignDetector, PropertyAssignMatcher $propertyAssignMatcher, PropertyDefaultAssignDetector $propertyDefaultAssignDetector, NullTypeAssignDetector $nullTypeAssignDetector, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, TypeFactory $typeFactory, NodeTypeResolver $nodeTypeResolver, ExprAnalyzer $exprAnalyzer, ValueResolver $valueResolver, PropertyFetchAnalyzer $propertyFetchAnalyzer) { $this->constructorAssignDetector = $constructorAssignDetector; @@ -185,7 +175,7 @@ final class AssignToPropertyTypeInferer $assignVar = $node->var; if (!$assignVar->name instanceof Identifier) { $hasAssignDynamicPropertyValue = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } return null; } @@ -209,7 +199,7 @@ final class AssignToPropertyTypeInferer } if ($this->exprAnalyzer->isNonTypedFromParam($node->expr)) { $assignedExprTypes = []; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } $assignedExprTypes[] = $this->resolveExprStaticTypeIncludingDimFetch($node); return null; diff --git a/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/AllAssignNodePropertyTypeInferer.php b/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/AllAssignNodePropertyTypeInferer.php index 519c3f249c4..ca04ee0fd8a 100644 --- a/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/AllAssignNodePropertyTypeInferer.php +++ b/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/AllAssignNodePropertyTypeInferer.php @@ -17,24 +17,20 @@ final class AllAssignNodePropertyTypeInferer { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\AssignToPropertyTypeInferer */ - private $assignToPropertyTypeInferer; + private AssignToPropertyTypeInferer $assignToPropertyTypeInferer; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(AssignToPropertyTypeInferer $assignToPropertyTypeInferer, NodeNameResolver $nodeNameResolver, AstResolver $astResolver, BetterNodeFinder $betterNodeFinder) { $this->assignToPropertyTypeInferer = $assignToPropertyTypeInferer; @@ -46,9 +42,7 @@ final class AllAssignNodePropertyTypeInferer { if ($classReflection->getFileName() === $file->getFilePath()) { $className = $classReflection->getName(); - $classLike = $this->betterNodeFinder->findFirst($file->getNewStmts(), function (Node $node) use($className) : bool { - return $node instanceof ClassLike && $this->nodeNameResolver->isName($node, $className); - }); + $classLike = $this->betterNodeFinder->findFirst($file->getNewStmts(), fn(Node $node): bool => $node instanceof ClassLike && $this->nodeNameResolver->isName($node, $className)); } else { $classLike = $this->astResolver->resolveClassFromClassReflection($classReflection); } diff --git a/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/GetterTypeDeclarationPropertyTypeInferer.php b/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/GetterTypeDeclarationPropertyTypeInferer.php index 6c561d69c5e..f39152985ef 100644 --- a/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/GetterTypeDeclarationPropertyTypeInferer.php +++ b/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/GetterTypeDeclarationPropertyTypeInferer.php @@ -14,19 +14,16 @@ final class GetterTypeDeclarationPropertyTypeInferer { /** * @readonly - * @var \Rector\TypeDeclaration\FunctionLikeReturnTypeResolver */ - private $functionLikeReturnTypeResolver; + private FunctionLikeReturnTypeResolver $functionLikeReturnTypeResolver; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ClassMethodAndPropertyAnalyzer */ - private $classMethodAndPropertyAnalyzer; + private ClassMethodAndPropertyAnalyzer $classMethodAndPropertyAnalyzer; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(FunctionLikeReturnTypeResolver $functionLikeReturnTypeResolver, ClassMethodAndPropertyAnalyzer $classMethodAndPropertyAnalyzer, NodeNameResolver $nodeNameResolver) { $this->functionLikeReturnTypeResolver = $functionLikeReturnTypeResolver; diff --git a/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/SetterTypeDeclarationPropertyTypeInferer.php b/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/SetterTypeDeclarationPropertyTypeInferer.php index 82751ec5eb5..d7ef8b1bd8f 100644 --- a/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/SetterTypeDeclarationPropertyTypeInferer.php +++ b/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/SetterTypeDeclarationPropertyTypeInferer.php @@ -15,19 +15,16 @@ final class SetterTypeDeclarationPropertyTypeInferer { /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ClassMethodAndPropertyAnalyzer */ - private $classMethodAndPropertyAnalyzer; + private ClassMethodAndPropertyAnalyzer $classMethodAndPropertyAnalyzer; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(ClassMethodAndPropertyAnalyzer $classMethodAndPropertyAnalyzer, NodeNameResolver $nodeNameResolver, StaticTypeMapper $staticTypeMapper) { $this->classMethodAndPropertyAnalyzer = $classMethodAndPropertyAnalyzer; diff --git a/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/TrustedClassMethodPropertyTypeInferer.php b/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/TrustedClassMethodPropertyTypeInferer.php index 670508a441d..8533df8a581 100644 --- a/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/TrustedClassMethodPropertyTypeInferer.php +++ b/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/TrustedClassMethodPropertyTypeInferer.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Variable; @@ -13,7 +14,6 @@ use PhpParser\Node\Param; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Property; -use PhpParser\NodeTraverser; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\ArrayType; use PHPStan\Type\MixedType; @@ -40,54 +40,44 @@ final class TrustedClassMethodPropertyTypeInferer { /** * @readonly - * @var \Rector\NodeManipulator\ClassMethodPropertyFetchManipulator */ - private $classMethodPropertyFetchManipulator; + private ClassMethodPropertyFetchManipulator $classMethodPropertyFetchManipulator; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\ParamAnalyzer */ - private $paramAnalyzer; + private ParamAnalyzer $paramAnalyzer; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\AssignToPropertyTypeInferer */ - private $assignToPropertyTypeInferer; + private AssignToPropertyTypeInferer $assignToPropertyTypeInferer; /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; public function __construct(ClassMethodPropertyFetchManipulator $classMethodPropertyFetchManipulator, ReflectionProvider $reflectionProvider, NodeNameResolver $nodeNameResolver, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, TypeFactory $typeFactory, StaticTypeMapper $staticTypeMapper, NodeTypeResolver $nodeTypeResolver, ParamAnalyzer $paramAnalyzer, AssignToPropertyTypeInferer $assignToPropertyTypeInferer, TypeComparator $typeComparator) { $this->classMethodPropertyFetchManipulator = $classMethodPropertyFetchManipulator; @@ -153,7 +143,7 @@ final class TrustedClassMethodPropertyTypeInferer } private function resolveParamTypeToPHPStanType(Param $param) : Type { - if ($param->type === null) { + if (!$param->type instanceof Node) { return new MixedType(); } if ($this->paramAnalyzer->isNullable($param)) { @@ -184,7 +174,7 @@ final class TrustedClassMethodPropertyTypeInferer return null; } $paramStaticType = $this->nodeTypeResolver->getType($node); - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; }); return $paramStaticType; } @@ -203,7 +193,7 @@ final class TrustedClassMethodPropertyTypeInferer } private function resolveFullyQualifiedOrAliasedObjectType(Param $param) : ?Type { - if ($param->type === null) { + if (!$param->type instanceof Node) { return null; } $fullyQualifiedName = $this->nodeNameResolver->getName($param->type); @@ -227,7 +217,7 @@ final class TrustedClassMethodPropertyTypeInferer } private function resolveTypeFromParam(Param $param, ClassMethod $classMethod, string $propertyName, Property $property, Class_ $class) : Type { - if ($param->type === null) { + if (!$param->type instanceof Node) { return new MixedType(); } $resolvedType = $this->resolveFromParamType($param, $classMethod, $propertyName); diff --git a/rules/TypeDeclaration/TypeInferer/ReturnTypeInferer.php b/rules/TypeDeclaration/TypeInferer/ReturnTypeInferer.php index 3b459b1ae3b..f99980f9a19 100644 --- a/rules/TypeDeclaration/TypeInferer/ReturnTypeInferer.php +++ b/rules/TypeDeclaration/TypeInferer/ReturnTypeInferer.php @@ -17,14 +17,12 @@ final class ReturnTypeInferer { /** * @readonly - * @var \Rector\TypeDeclaration\TypeNormalizer */ - private $typeNormalizer; + private TypeNormalizer $typeNormalizer; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer\ReturnedNodesReturnTypeInfererTypeInferer */ - private $returnedNodesReturnTypeInfererTypeInferer; + private ReturnedNodesReturnTypeInfererTypeInferer $returnedNodesReturnTypeInfererTypeInferer; public function __construct(TypeNormalizer $typeNormalizer, ReturnedNodesReturnTypeInfererTypeInferer $returnedNodesReturnTypeInfererTypeInferer) { $this->typeNormalizer = $typeNormalizer; diff --git a/rules/TypeDeclaration/TypeInferer/ReturnTypeInferer/ReturnedNodesReturnTypeInfererTypeInferer.php b/rules/TypeDeclaration/TypeInferer/ReturnTypeInferer/ReturnedNodesReturnTypeInfererTypeInferer.php index 9e81c1fd919..f6d3f56f10d 100644 --- a/rules/TypeDeclaration/TypeInferer/ReturnTypeInferer/ReturnedNodesReturnTypeInfererTypeInferer.php +++ b/rules/TypeDeclaration/TypeInferer/ReturnTypeInferer/ReturnedNodesReturnTypeInfererTypeInferer.php @@ -24,34 +24,28 @@ final class ReturnedNodesReturnTypeInfererTypeInferer { /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\SilentVoidResolver */ - private $silentVoidResolver; + private SilentVoidResolver $silentVoidResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\SplArrayFixedTypeNarrower */ - private $splArrayFixedTypeNarrower; + private SplArrayFixedTypeNarrower $splArrayFixedTypeNarrower; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(SilentVoidResolver $silentVoidResolver, BetterNodeFinder $betterNodeFinder, NodeTypeResolver $nodeTypeResolver, TypeFactory $typeFactory, SplArrayFixedTypeNarrower $splArrayFixedTypeNarrower, ReflectionResolver $reflectionResolver) { $this->silentVoidResolver = $silentVoidResolver; diff --git a/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php b/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php index 1ab3fb98344..f230dd25f36 100644 --- a/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php +++ b/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\TypeInferer; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrowFunction; @@ -26,10 +27,9 @@ use PhpParser\Node\Stmt\Goto_; use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\Return_; use PhpParser\Node\Stmt\Switch_; -use PhpParser\Node\Stmt\Throw_; +use PhpParser\Node\Expr\Throw_; use PhpParser\Node\Stmt\TryCatch; use PhpParser\Node\Stmt\While_; -use PhpParser\NodeTraverser; use PHPStan\Reflection\ClassReflection; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; use Rector\PhpParser\Node\BetterNodeFinder; @@ -40,29 +40,24 @@ final class SilentVoidResolver { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\NeverFuncCallAnalyzer */ - private $neverFuncCallAnalyzer; + private NeverFuncCallAnalyzer $neverFuncCallAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; public function __construct(BetterNodeFinder $betterNodeFinder, ReflectionResolver $reflectionResolver, NeverFuncCallAnalyzer $neverFuncCallAnalyzer, ValueResolver $valueResolver, SimpleCallableNodeTraverser $simpleCallableNodeTraverser) { $this->betterNodeFinder = $betterNodeFinder; @@ -132,11 +127,11 @@ final class SilentVoidResolver $isFoundLoopControl = \false; $this->simpleCallableNodeTraverser->traverseNodesWithCallable($node->stmts, static function (Node $subNode) use(&$isFoundLoopControl) { if ($subNode instanceof Class_ || $subNode instanceof Function_ || $subNode instanceof Closure) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($subNode instanceof Break_ || $subNode instanceof Continue_ || $subNode instanceof Goto_) { $isFoundLoopControl = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } }); return $isFoundLoopControl; @@ -195,9 +190,7 @@ final class SilentVoidResolver return \false; } $casesWithReturnOrExitCount = $this->resolveReturnOrExitCount($switch); - $cases = \array_filter($switch->cases, static function (Case_ $case) : bool { - return $case->stmts !== []; - }); + $cases = \array_filter($switch->cases, static fn(Case_ $case): bool => $case->stmts !== []); // has same amount of first return or exit nodes as switches return \count($cases) === $casesWithReturnOrExitCount; } diff --git a/rules/TypeDeclaration/TypeNormalizer.php b/rules/TypeDeclaration/TypeNormalizer.php index f07d6a0ba4d..6ca7777eab4 100644 --- a/rules/TypeDeclaration/TypeNormalizer.php +++ b/rules/TypeDeclaration/TypeNormalizer.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration; +use PHPStan\Type\IntersectionType; use PHPStan\Type\ArrayType; use PHPStan\Type\Constant\ConstantArrayType; use PHPStan\Type\MixedType; @@ -19,13 +20,12 @@ final class TypeNormalizer { /** * @readonly - * @var \Rector\Util\Reflection\PrivatesAccessor */ - private $privatesAccessor; + private PrivatesAccessor $privatesAccessor; /** * @var NestedArrayType[] */ - private $collectedNestedArrayTypes = []; + private array $collectedNestedArrayTypes = []; public function __construct(PrivatesAccessor $privatesAccessor) { $this->privatesAccessor = $privatesAccessor; @@ -40,9 +40,13 @@ final class TypeNormalizer */ public function normalizeArrayOfUnionToUnionArray(Type $type, int $arrayNesting = 1) : Type { - if (!$type instanceof ArrayType) { + if (!$type->isArray()->yes()) { return $type; } + if ($type instanceof UnionType || $type instanceof IntersectionType) { + return $type; + } + /** @var ArrayType|ConstantArrayType $type */ if ($type instanceof ConstantArrayType && $arrayNesting === 1) { return $type; } diff --git a/rules/TypeDeclaration/ValueObject/AddClosureParamTypeFromArg.php b/rules/TypeDeclaration/ValueObject/AddClosureParamTypeFromArg.php index b8ed12cbf9f..5dd94160578 100644 --- a/rules/TypeDeclaration/ValueObject/AddClosureParamTypeFromArg.php +++ b/rules/TypeDeclaration/ValueObject/AddClosureParamTypeFromArg.php @@ -9,24 +9,22 @@ final class AddClosureParamTypeFromArg { /** * @readonly - * @var string */ - private $className; + private string $className; /** * @readonly - * @var string */ - private $methodName; + private string $methodName; /** * @var int<0, max> * @readonly */ - private $callLikePosition; + private int $callLikePosition; /** * @var int<0, max> * @readonly */ - private $functionLikePosition; + private int $functionLikePosition; /** * @param int<0, max> $callLikePosition * @param int<0, max> $functionLikePosition diff --git a/rules/TypeDeclaration/ValueObject/AddClosureParamTypeFromObject.php b/rules/TypeDeclaration/ValueObject/AddClosureParamTypeFromObject.php index b9ad8b0f650..eae1bd67e66 100644 --- a/rules/TypeDeclaration/ValueObject/AddClosureParamTypeFromObject.php +++ b/rules/TypeDeclaration/ValueObject/AddClosureParamTypeFromObject.php @@ -9,24 +9,22 @@ final class AddClosureParamTypeFromObject { /** * @readonly - * @var string */ - private $className; + private string $className; /** * @readonly - * @var string */ - private $methodName; + private string $methodName; /** * @var int<0, max> * @readonly */ - private $callLikePosition; + private int $callLikePosition; /** * @var int<0, max> * @readonly */ - private $functionLikePosition; + private int $functionLikePosition; /** * @param int<0, max> $callLikePosition * @param int<0, max> $functionLikePosition diff --git a/rules/TypeDeclaration/ValueObject/AddParamTypeDeclaration.php b/rules/TypeDeclaration/ValueObject/AddParamTypeDeclaration.php index d7aeef94031..6a0c001ea71 100644 --- a/rules/TypeDeclaration/ValueObject/AddParamTypeDeclaration.php +++ b/rules/TypeDeclaration/ValueObject/AddParamTypeDeclaration.php @@ -10,24 +10,21 @@ final class AddParamTypeDeclaration { /** * @readonly - * @var string */ - private $className; + private string $className; /** * @readonly - * @var string */ - private $methodName; + private string $methodName; /** * @var int<0, max> * @readonly */ - private $position; + private int $position; /** * @readonly - * @var \PHPStan\Type\Type */ - private $paramType; + private Type $paramType; /** * @param int<0, max> $position */ diff --git a/rules/TypeDeclaration/ValueObject/AddParamTypeForFunctionLikeWithinCallLikeArgDeclaration.php b/rules/TypeDeclaration/ValueObject/AddParamTypeForFunctionLikeWithinCallLikeArgDeclaration.php index 82db11f6008..c6278838267 100644 --- a/rules/TypeDeclaration/ValueObject/AddParamTypeForFunctionLikeWithinCallLikeArgDeclaration.php +++ b/rules/TypeDeclaration/ValueObject/AddParamTypeForFunctionLikeWithinCallLikeArgDeclaration.php @@ -13,14 +13,12 @@ final class AddParamTypeForFunctionLikeWithinCallLikeArgDeclaration { /** * @readonly - * @var string */ - private $className; + private string $className; /** * @readonly - * @var string */ - private $methodName; + private string $methodName; /** * @var int<0, max>|string * @readonly @@ -30,12 +28,11 @@ final class AddParamTypeForFunctionLikeWithinCallLikeArgDeclaration * @var int<0, max> * @readonly */ - private $functionLikePosition; + private int $functionLikePosition; /** * @readonly - * @var \PHPStan\Type\Type */ - private $paramType; + private Type $paramType; /** * @param int<0, max>|string $callLikePosition * @param int<0, max> $functionLikePosition diff --git a/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php b/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php index 01f163704f6..d03f3490ebb 100644 --- a/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php +++ b/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php @@ -9,19 +9,16 @@ final class AddPropertyTypeDeclaration { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $propertyName; + private string $propertyName; /** * @readonly - * @var \PHPStan\Type\Type */ - private $type; + private Type $type; public function __construct(string $class, string $propertyName, Type $type) { $this->class = $class; diff --git a/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php b/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php index 00df440e5f5..01181f52c3d 100644 --- a/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php +++ b/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php @@ -13,19 +13,16 @@ final class AddReturnTypeDeclaration { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $method; + private string $method; /** * @readonly - * @var \PHPStan\Type\Type */ - private $returnType; + private Type $returnType; public function __construct(string $class, string $method, Type $returnType) { $this->class = $class; diff --git a/rules/TypeDeclaration/ValueObject/AssignToVariable.php b/rules/TypeDeclaration/ValueObject/AssignToVariable.php index 7b0f7156760..9cfb3a8e6cc 100644 --- a/rules/TypeDeclaration/ValueObject/AssignToVariable.php +++ b/rules/TypeDeclaration/ValueObject/AssignToVariable.php @@ -8,14 +8,12 @@ final class AssignToVariable { /** * @readonly - * @var string */ - private $variableName; + private string $variableName; /** * @readonly - * @var \PhpParser\Node\Expr */ - private $assignedExpr; + private Expr $assignedExpr; public function __construct(string $variableName, Expr $assignedExpr) { $this->variableName = $variableName; diff --git a/rules/TypeDeclaration/ValueObject/DataProviderNodes.php b/rules/TypeDeclaration/ValueObject/DataProviderNodes.php index cffc4e58cdd..63829fd69de 100644 --- a/rules/TypeDeclaration/ValueObject/DataProviderNodes.php +++ b/rules/TypeDeclaration/ValueObject/DataProviderNodes.php @@ -11,7 +11,7 @@ final class DataProviderNodes * @var array * @readonly */ - public $nodes; + public array $nodes; /** * @param array $nodes */ diff --git a/rules/TypeDeclaration/ValueObject/NestedArrayType.php b/rules/TypeDeclaration/ValueObject/NestedArrayType.php index 67447090d71..c06cec65032 100644 --- a/rules/TypeDeclaration/ValueObject/NestedArrayType.php +++ b/rules/TypeDeclaration/ValueObject/NestedArrayType.php @@ -9,19 +9,16 @@ final class NestedArrayType { /** * @readonly - * @var \PHPStan\Type\Type */ - private $type; + private Type $type; /** * @readonly - * @var int */ - private $arrayNestingLevel; + private int $arrayNestingLevel; /** * @readonly - * @var \PHPStan\Type\Type|null */ - private $keyType; + private ?Type $keyType = null; public function __construct(Type $type, int $arrayNestingLevel, ?Type $keyType = null) { $this->type = $type; diff --git a/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php b/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php index 93eaf29a4ac..9f4a4dc4055 100644 --- a/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php +++ b/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php @@ -21,13 +21,12 @@ final class ChangeConstantVisibilityRector extends AbstractRector implements Con { /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @var ChangeConstantVisibility[] */ - private $classConstantVisibilityChanges = []; + private array $classConstantVisibilityChanges = []; public function __construct(VisibilityManipulator $visibilityManipulator) { $this->visibilityManipulator = $visibilityManipulator; diff --git a/rules/Visibility/Rector/ClassMethod/ChangeMethodVisibilityRector.php b/rules/Visibility/Rector/ClassMethod/ChangeMethodVisibilityRector.php index f7a6f7af87d..d80def075ac 100644 --- a/rules/Visibility/Rector/ClassMethod/ChangeMethodVisibilityRector.php +++ b/rules/Visibility/Rector/ClassMethod/ChangeMethodVisibilityRector.php @@ -22,18 +22,16 @@ final class ChangeMethodVisibilityRector extends AbstractRector implements Confi { /** * @readonly - * @var \Rector\NodeCollector\ScopeResolver\ParentClassScopeResolver */ - private $parentClassScopeResolver; + private ParentClassScopeResolver $parentClassScopeResolver; /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @var ChangeMethodVisibility[] */ - private $methodVisibilities = []; + private array $methodVisibilities = []; public function __construct(ParentClassScopeResolver $parentClassScopeResolver, VisibilityManipulator $visibilityManipulator) { $this->parentClassScopeResolver = $parentClassScopeResolver; diff --git a/rules/Visibility/Rector/ClassMethod/ExplicitPublicClassMethodRector.php b/rules/Visibility/Rector/ClassMethod/ExplicitPublicClassMethodRector.php index 4ccd6e6e72e..51f32ae2941 100644 --- a/rules/Visibility/Rector/ClassMethod/ExplicitPublicClassMethodRector.php +++ b/rules/Visibility/Rector/ClassMethod/ExplicitPublicClassMethodRector.php @@ -16,9 +16,8 @@ final class ExplicitPublicClassMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; public function __construct(VisibilityManipulator $visibilityManipulator) { $this->visibilityManipulator = $visibilityManipulator; diff --git a/rules/Visibility/ValueObject/ChangeConstantVisibility.php b/rules/Visibility/ValueObject/ChangeConstantVisibility.php index 32d19dbb477..a99993dc719 100644 --- a/rules/Visibility/ValueObject/ChangeConstantVisibility.php +++ b/rules/Visibility/ValueObject/ChangeConstantVisibility.php @@ -9,19 +9,16 @@ final class ChangeConstantVisibility { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $constant; + private string $constant; /** * @readonly - * @var int */ - private $visibility; + private int $visibility; public function __construct(string $class, string $constant, int $visibility) { $this->class = $class; diff --git a/rules/Visibility/ValueObject/ChangeMethodVisibility.php b/rules/Visibility/ValueObject/ChangeMethodVisibility.php index 03f7b8e7d39..c1cb529bc78 100644 --- a/rules/Visibility/ValueObject/ChangeMethodVisibility.php +++ b/rules/Visibility/ValueObject/ChangeMethodVisibility.php @@ -8,19 +8,16 @@ final class ChangeMethodVisibility { /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $method; + private string $method; /** * @readonly - * @var int */ - private $visibility; + private int $visibility; public function __construct(string $class, string $method, int $visibility) { $this->class = $class; diff --git a/src/Application/ApplicationFileProcessor.php b/src/Application/ApplicationFileProcessor.php index 325c41b1e11..6890b118f26 100644 --- a/src/Application/ApplicationFileProcessor.php +++ b/src/Application/ApplicationFileProcessor.php @@ -31,54 +31,44 @@ final class ApplicationFileProcessor { /** * @readonly - * @var \Symfony\Component\Console\Style\SymfonyStyle */ - private $symfonyStyle; + private SymfonyStyle $symfonyStyle; /** * @readonly - * @var \Rector\FileSystem\FilesFinder */ - private $filesFinder; + private FilesFinder $filesFinder; /** * @readonly - * @var \Rector\Parallel\Application\ParallelFileProcessor */ - private $parallelFileProcessor; + private ParallelFileProcessor $parallelFileProcessor; /** * @readonly - * @var \Symplify\EasyParallel\ScheduleFactory */ - private $scheduleFactory; + private ScheduleFactory $scheduleFactory; /** * @readonly - * @var \Symplify\EasyParallel\CpuCoreCountProvider */ - private $cpuCoreCountProvider; + private CpuCoreCountProvider $cpuCoreCountProvider; /** * @readonly - * @var \Rector\Caching\Detector\ChangedFilesDetector */ - private $changedFilesDetector; + private ChangedFilesDetector $changedFilesDetector; /** * @readonly - * @var \Rector\Application\Provider\CurrentFileProvider */ - private $currentFileProvider; + private CurrentFileProvider $currentFileProvider; /** * @readonly - * @var \Rector\Application\FileProcessor */ - private $fileProcessor; + private \Rector\Application\FileProcessor $fileProcessor; /** * @readonly - * @var \Rector\Util\ArrayParametersMerger */ - private $arrayParametersMerger; + private ArrayParametersMerger $arrayParametersMerger; /** * @readonly - * @var \Rector\Reporting\MissConfigurationReporter */ - private $missConfigurationReporter; + private MissConfigurationReporter $missConfigurationReporter; /** * @var string */ @@ -86,7 +76,7 @@ final class ApplicationFileProcessor /** * @var SystemError[] */ - private $systemErrors = []; + private array $systemErrors = []; public function __construct(SymfonyStyle $symfonyStyle, FilesFinder $filesFinder, ParallelFileProcessor $parallelFileProcessor, ScheduleFactory $scheduleFactory, CpuCoreCountProvider $cpuCoreCountProvider, ChangedFilesDetector $changedFilesDetector, CurrentFileProvider $currentFileProvider, \Rector\Application\FileProcessor $fileProcessor, ArrayParametersMerger $arrayParametersMerger, MissConfigurationReporter $missConfigurationReporter) { $this->symfonyStyle = $symfonyStyle; diff --git a/src/Application/ChangedNodeScopeRefresher.php b/src/Application/ChangedNodeScopeRefresher.php index 313bcf1793a..bebad0e14e1 100644 --- a/src/Application/ChangedNodeScopeRefresher.php +++ b/src/Application/ChangedNodeScopeRefresher.php @@ -31,14 +31,12 @@ final class ChangedNodeScopeRefresher { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Scope\PHPStanNodeScopeResolver */ - private $phpStanNodeScopeResolver; + private PHPStanNodeScopeResolver $phpStanNodeScopeResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\ScopeAnalyzer */ - private $scopeAnalyzer; + private ScopeAnalyzer $scopeAnalyzer; public function __construct(PHPStanNodeScopeResolver $phpStanNodeScopeResolver, ScopeAnalyzer $scopeAnalyzer) { $this->phpStanNodeScopeResolver = $phpStanNodeScopeResolver; diff --git a/src/Application/FileProcessor.php b/src/Application/FileProcessor.php index fc228d4135f..e5055fd2e5d 100644 --- a/src/Application/FileProcessor.php +++ b/src/Application/FileProcessor.php @@ -30,54 +30,44 @@ final class FileProcessor { /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; /** * @readonly - * @var \Rector\PhpParser\NodeTraverser\RectorNodeTraverser */ - private $rectorNodeTraverser; + private RectorNodeTraverser $rectorNodeTraverser; /** * @readonly - * @var \Symfony\Component\Console\Style\SymfonyStyle */ - private $symfonyStyle; + private SymfonyStyle $symfonyStyle; /** * @readonly - * @var \Rector\ChangesReporting\ValueObjectFactory\FileDiffFactory */ - private $fileDiffFactory; + private FileDiffFactory $fileDiffFactory; /** * @readonly - * @var \Rector\Caching\Detector\ChangedFilesDetector */ - private $changedFilesDetector; + private ChangedFilesDetector $changedFilesDetector; /** * @readonly - * @var \Rector\ChangesReporting\ValueObjectFactory\ErrorFactory */ - private $errorFactory; + private ErrorFactory $errorFactory; /** * @readonly - * @var \Rector\FileSystem\FilePathHelper */ - private $filePathHelper; + private FilePathHelper $filePathHelper; /** * @readonly - * @var \Rector\PostRector\Application\PostFileProcessor */ - private $postFileProcessor; + private PostFileProcessor $postFileProcessor; /** * @readonly - * @var \Rector\PhpParser\Parser\RectorParser */ - private $rectorParser; + private RectorParser $rectorParser; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeScopeAndMetadataDecorator */ - private $nodeScopeAndMetadataDecorator; + private NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator; /** * @var string * @see https://regex101.com/r/llm7XZ/1 @@ -138,7 +128,11 @@ final class FileProcessor private function parseFileAndDecorateNodes(File $file) : ?SystemError { try { - $this->parseFileNodes($file); + try { + $this->parseFileNodes($file); + } catch (ParserErrorsException $exception) { + $this->parseFileNodes($file, \false); + } } catch (ShouldNotHappenException $shouldNotHappenException) { throw $shouldNotHappenException; } catch (AnalysedCodeException $analysedCodeException) { @@ -173,14 +167,14 @@ final class FileProcessor * Handle new line or space before getOriginalFileContent()); - if ($ltrimOriginalFileContent === $newContent) { + $originalFileContent = $file->getOriginalFileContent(); + if ($originalFileContent === $newContent) { return; } // handle space before rectorParser->parseFileContentToStmtsAndTokens($file->getOriginalFileContent()); + $stmtsAndTokens = $this->rectorParser->parseFileContentToStmtsAndTokens($file->getOriginalFileContent(), $forNewestSupportedVersion); $oldStmts = $stmtsAndTokens->getStmts(); $oldTokens = $stmtsAndTokens->getTokens(); $newStmts = $this->nodeScopeAndMetadataDecorator->decorateNodesFromFile($file->getFilePath(), $oldStmts); diff --git a/src/Application/Provider/CurrentFileProvider.php b/src/Application/Provider/CurrentFileProvider.php index 17536432d0d..1a97b9e33be 100644 --- a/src/Application/Provider/CurrentFileProvider.php +++ b/src/Application/Provider/CurrentFileProvider.php @@ -9,10 +9,7 @@ use Rector\ValueObject\Application\File; */ final class CurrentFileProvider { - /** - * @var \Rector\ValueObject\Application\File|null - */ - private $file; + private ?File $file = null; public function setFile(File $file) : void { $this->file = $file; diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index b1a31e842ff..d599095cdf2 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = 'cb76a5fb76548fd3b659c0af8b9e89625319e5fc'; + public const PACKAGE_VERSION = 'eb5df4dde7515bbc497af6da84d5f9dbf96399d8'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-11-19 18:25:55'; + public const RELEASE_DATE = '2024-11-20 15:37:26'; /** * @var int */ diff --git a/src/Autoloading/AdditionalAutoloader.php b/src/Autoloading/AdditionalAutoloader.php index 61477bc78ae..3962cbf9be2 100644 --- a/src/Autoloading/AdditionalAutoloader.php +++ b/src/Autoloading/AdditionalAutoloader.php @@ -15,9 +15,8 @@ final class AdditionalAutoloader { /** * @readonly - * @var \Rector\StaticReflection\DynamicSourceLocatorDecorator */ - private $dynamicSourceLocatorDecorator; + private DynamicSourceLocatorDecorator $dynamicSourceLocatorDecorator; public function __construct(DynamicSourceLocatorDecorator $dynamicSourceLocatorDecorator) { $this->dynamicSourceLocatorDecorator = $dynamicSourceLocatorDecorator; diff --git a/src/BetterPhpDocParser/DataProvider/CurrentTokenIteratorProvider.php b/src/BetterPhpDocParser/DataProvider/CurrentTokenIteratorProvider.php index 80d849787e2..35ae3b8b725 100644 --- a/src/BetterPhpDocParser/DataProvider/CurrentTokenIteratorProvider.php +++ b/src/BetterPhpDocParser/DataProvider/CurrentTokenIteratorProvider.php @@ -7,10 +7,7 @@ use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator; use Rector\Exception\ShouldNotHappenException; final class CurrentTokenIteratorProvider { - /** - * @var \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator|null - */ - private $betterTokenIterator; + private ?BetterTokenIterator $betterTokenIterator = null; public function setBetterTokenIterator(BetterTokenIterator $betterTokenIterator) : void { $this->betterTokenIterator = $betterTokenIterator; diff --git a/src/BetterPhpDocParser/PhpDoc/DoctrineAnnotationTagValueNode.php b/src/BetterPhpDocParser/PhpDoc/DoctrineAnnotationTagValueNode.php index 026c95842cf..6d919f4cfa1 100644 --- a/src/BetterPhpDocParser/PhpDoc/DoctrineAnnotationTagValueNode.php +++ b/src/BetterPhpDocParser/PhpDoc/DoctrineAnnotationTagValueNode.php @@ -10,10 +10,7 @@ use Rector\NodeTypeResolver\Node\AttributeKey; use Stringable; final class DoctrineAnnotationTagValueNode extends AbstractValuesAwareNode { - /** - * @var \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode - */ - public $identifierTypeNode; + public IdentifierTypeNode $identifierTypeNode; /** * @param ArrayItemNode[] $values */ diff --git a/src/BetterPhpDocParser/PhpDoc/StringNode.php b/src/BetterPhpDocParser/PhpDoc/StringNode.php index 9f34973c867..dfb68e9754b 100644 --- a/src/BetterPhpDocParser/PhpDoc/StringNode.php +++ b/src/BetterPhpDocParser/PhpDoc/StringNode.php @@ -10,10 +10,7 @@ use Rector\NodeTypeResolver\Node\AttributeKey; use Stringable; final class StringNode implements PhpDocTagValueNode { - /** - * @var string - */ - public $value; + public string $value; use NodeAttributes; public function __construct(string $value) { diff --git a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php index 5bfa59413ef..a6abea79507 100644 --- a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php +++ b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php @@ -41,47 +41,37 @@ final class PhpDocInfo { /** * @readonly - * @var \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode */ - private $phpDocNode; + private PhpDocNode $phpDocNode; /** * @readonly - * @var \Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator */ - private $betterTokenIterator; + private BetterTokenIterator $betterTokenIterator; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \PhpParser\Node */ - private $node; + private \PhpParser\Node $node; /** * @readonly - * @var \Rector\BetterPhpDocParser\Annotation\AnnotationNaming */ - private $annotationNaming; + private AnnotationNaming $annotationNaming; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder */ - private $phpDocNodeByTypeFinder; + private PhpDocNodeByTypeFinder $phpDocNodeByTypeFinder; /** * @var array, string> */ private const TAGS_TYPES_TO_NAMES = [ReturnTagValueNode::class => '@return', ParamTagValueNode::class => '@param', VarTagValueNode::class => '@var', MethodTagValueNode::class => '@method', PropertyTagValueNode::class => '@property', ExtendsTagValueNode::class => '@extends', ImplementsTagValueNode::class => '@implements']; - /** - * @var bool - */ - private $isSingleLine = \false; + private bool $isSingleLine = \false; /** * @readonly - * @var \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode */ - private $originalPhpDocNode; + private PhpDocNode $originalPhpDocNode; public function __construct(PhpDocNode $phpDocNode, BetterTokenIterator $betterTokenIterator, StaticTypeMapper $staticTypeMapper, \PhpParser\Node $node, AnnotationNaming $annotationNaming, PhpDocNodeByTypeFinder $phpDocNodeByTypeFinder) { $this->phpDocNode = $phpDocNode; @@ -138,9 +128,7 @@ final class PhpDocInfo } $tags = $this->phpDocNode->getTags(); $name = $this->annotationNaming->normalizeName($name); - $tags = \array_filter($tags, static function (PhpDocTagNode $phpDocTagNode) use($name) : bool { - return $phpDocTagNode->name === $name; - }); + $tags = \array_filter($tags, static fn(PhpDocTagNode $phpDocTagNode): bool => $phpDocTagNode->name === $name); return \array_values($tags); } public function getParamType(string $name) : Type diff --git a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfoFactory.php b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfoFactory.php index 03aebdb67cc..b53f3f2187a 100644 --- a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfoFactory.php +++ b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfoFactory.php @@ -20,38 +20,32 @@ final class PhpDocInfoFactory { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocNodeMapper */ - private $phpDocNodeMapper; + private PhpDocNodeMapper $phpDocNodeMapper; /** * @readonly - * @var \PHPStan\PhpDocParser\Lexer\Lexer */ - private $lexer; + private Lexer $lexer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocParser\BetterPhpDocParser */ - private $betterPhpDocParser; + private BetterPhpDocParser $betterPhpDocParser; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\BetterPhpDocParser\Annotation\AnnotationNaming */ - private $annotationNaming; + private AnnotationNaming $annotationNaming; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder */ - private $phpDocNodeByTypeFinder; + private PhpDocNodeByTypeFinder $phpDocNodeByTypeFinder; /** * @var array */ - private $phpDocInfosByObjectId = []; + private array $phpDocInfosByObjectId = []; public function __construct(PhpDocNodeMapper $phpDocNodeMapper, Lexer $lexer, BetterPhpDocParser $betterPhpDocParser, StaticTypeMapper $staticTypeMapper, AnnotationNaming $annotationNaming, PhpDocNodeByTypeFinder $phpDocNodeByTypeFinder) { $this->phpDocNodeMapper = $phpDocNodeMapper; diff --git a/src/BetterPhpDocParser/PhpDocInfo/TokenIteratorFactory.php b/src/BetterPhpDocParser/PhpDocInfo/TokenIteratorFactory.php index d06001ae440..62a06fcb5d2 100644 --- a/src/BetterPhpDocParser/PhpDocInfo/TokenIteratorFactory.php +++ b/src/BetterPhpDocParser/PhpDocInfo/TokenIteratorFactory.php @@ -10,9 +10,8 @@ final class TokenIteratorFactory { /** * @readonly - * @var \PHPStan\PhpDocParser\Lexer\Lexer */ - private $lexer; + private Lexer $lexer; public function __construct(Lexer $lexer) { $this->lexer = $lexer; diff --git a/src/BetterPhpDocParser/PhpDocManipulator/PhpDocClassRenamer.php b/src/BetterPhpDocParser/PhpDocManipulator/PhpDocClassRenamer.php index 5af221efe52..04b573a9fc7 100644 --- a/src/BetterPhpDocParser/PhpDocManipulator/PhpDocClassRenamer.php +++ b/src/BetterPhpDocParser/PhpDocManipulator/PhpDocClassRenamer.php @@ -17,14 +17,12 @@ final class PhpDocClassRenamer { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher */ - private $classAnnotationMatcher; + private ClassAnnotationMatcher $classAnnotationMatcher; /** * @readonly - * @var \Rector\Renaming\Collector\RenamedNameCollector */ - private $renamedNameCollector; + private RenamedNameCollector $renamedNameCollector; public function __construct(ClassAnnotationMatcher $classAnnotationMatcher, RenamedNameCollector $renamedNameCollector) { $this->classAnnotationMatcher = $classAnnotationMatcher; diff --git a/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTypeChanger.php b/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTypeChanger.php index 92f2d2b763b..526822cb383 100644 --- a/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTypeChanger.php +++ b/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTypeChanger.php @@ -34,29 +34,24 @@ final class PhpDocTypeChanger { /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; /** * @readonly - * @var \Rector\TypeDeclaration\PhpDocParser\ParamPhpDocNodeFactory */ - private $paramPhpDocNodeFactory; + private ParamPhpDocNodeFactory $paramPhpDocNodeFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\Guard\NewPhpDocFromPHPStanTypeGuard */ - private $newPhpDocFromPHPStanTypeGuard; + private NewPhpDocFromPHPStanTypeGuard $newPhpDocFromPHPStanTypeGuard; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @var array> */ diff --git a/src/BetterPhpDocParser/PhpDocNodeMapper.php b/src/BetterPhpDocParser/PhpDocNodeMapper.php index cf71aff19de..1e41a34571b 100644 --- a/src/BetterPhpDocParser/PhpDocNodeMapper.php +++ b/src/BetterPhpDocParser/PhpDocNodeMapper.php @@ -18,19 +18,17 @@ final class PhpDocNodeMapper { /** * @readonly - * @var \Rector\BetterPhpDocParser\DataProvider\CurrentTokenIteratorProvider */ - private $currentTokenIteratorProvider; + private CurrentTokenIteratorProvider $currentTokenIteratorProvider; /** * @var BasePhpDocNodeVisitorInterface[] * @readonly */ - private $phpDocNodeVisitors; + private array $phpDocNodeVisitors; /** * @readonly - * @var \Rector\PhpDocParser\PhpDocParser\PhpDocNodeTraverser */ - private $phpDocNodeTraverser; + private PhpDocNodeTraverser $phpDocNodeTraverser; /** * @param BasePhpDocNodeVisitorInterface[] $phpDocNodeVisitors */ diff --git a/src/BetterPhpDocParser/PhpDocNodeVisitor/ArrayTypePhpDocNodeVisitor.php b/src/BetterPhpDocParser/PhpDocNodeVisitor/ArrayTypePhpDocNodeVisitor.php index 3c7ced13da4..e0ad307320c 100644 --- a/src/BetterPhpDocParser/PhpDocNodeVisitor/ArrayTypePhpDocNodeVisitor.php +++ b/src/BetterPhpDocParser/PhpDocNodeVisitor/ArrayTypePhpDocNodeVisitor.php @@ -13,9 +13,8 @@ final class ArrayTypePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor impleme { /** * @readonly - * @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer */ - private $attributeMirrorer; + private AttributeMirrorer $attributeMirrorer; public function __construct(AttributeMirrorer $attributeMirrorer) { $this->attributeMirrorer = $attributeMirrorer; diff --git a/src/BetterPhpDocParser/PhpDocNodeVisitor/CallableTypePhpDocNodeVisitor.php b/src/BetterPhpDocParser/PhpDocNodeVisitor/CallableTypePhpDocNodeVisitor.php index 6a2995676d1..bb479b91b71 100644 --- a/src/BetterPhpDocParser/PhpDocNodeVisitor/CallableTypePhpDocNodeVisitor.php +++ b/src/BetterPhpDocParser/PhpDocNodeVisitor/CallableTypePhpDocNodeVisitor.php @@ -13,9 +13,8 @@ final class CallableTypePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor impl { /** * @readonly - * @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer */ - private $attributeMirrorer; + private AttributeMirrorer $attributeMirrorer; public function __construct(AttributeMirrorer $attributeMirrorer) { $this->attributeMirrorer = $attributeMirrorer; @@ -28,7 +27,7 @@ final class CallableTypePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor impl if ($node instanceof SpacingAwareCallableTypeNode) { return null; } - $spacingAwareCallableTypeNode = new SpacingAwareCallableTypeNode($node->identifier, $node->parameters, $node->returnType); + $spacingAwareCallableTypeNode = new SpacingAwareCallableTypeNode($node->identifier, $node->parameters, $node->returnType, []); $this->attributeMirrorer->mirror($node, $spacingAwareCallableTypeNode); return $spacingAwareCallableTypeNode; } diff --git a/src/BetterPhpDocParser/PhpDocNodeVisitor/ChangedPhpDocNodeVisitor.php b/src/BetterPhpDocParser/PhpDocNodeVisitor/ChangedPhpDocNodeVisitor.php index 204edcefe82..f79017892e0 100644 --- a/src/BetterPhpDocParser/PhpDocNodeVisitor/ChangedPhpDocNodeVisitor.php +++ b/src/BetterPhpDocParser/PhpDocNodeVisitor/ChangedPhpDocNodeVisitor.php @@ -8,10 +8,7 @@ use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey; use Rector\PhpDocParser\PhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor; final class ChangedPhpDocNodeVisitor extends AbstractPhpDocNodeVisitor { - /** - * @var bool - */ - private $hasChanged = \false; + private bool $hasChanged = \false; public function beforeTraverse(Node $node) : void { $this->hasChanged = \false; diff --git a/src/BetterPhpDocParser/PhpDocNodeVisitor/IntersectionTypeNodePhpDocNodeVisitor.php b/src/BetterPhpDocParser/PhpDocNodeVisitor/IntersectionTypeNodePhpDocNodeVisitor.php index b790d8e86bb..c00112d5d18 100644 --- a/src/BetterPhpDocParser/PhpDocNodeVisitor/IntersectionTypeNodePhpDocNodeVisitor.php +++ b/src/BetterPhpDocParser/PhpDocNodeVisitor/IntersectionTypeNodePhpDocNodeVisitor.php @@ -13,9 +13,8 @@ final class IntersectionTypeNodePhpDocNodeVisitor extends AbstractPhpDocNodeVisi { /** * @readonly - * @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer */ - private $attributeMirrorer; + private AttributeMirrorer $attributeMirrorer; public function __construct(AttributeMirrorer $attributeMirrorer) { $this->attributeMirrorer = $attributeMirrorer; diff --git a/src/BetterPhpDocParser/PhpDocNodeVisitor/TemplatePhpDocNodeVisitor.php b/src/BetterPhpDocParser/PhpDocNodeVisitor/TemplatePhpDocNodeVisitor.php index 4de51b35299..43834c974da 100644 --- a/src/BetterPhpDocParser/PhpDocNodeVisitor/TemplatePhpDocNodeVisitor.php +++ b/src/BetterPhpDocParser/PhpDocNodeVisitor/TemplatePhpDocNodeVisitor.php @@ -18,14 +18,12 @@ final class TemplatePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor implemen { /** * @readonly - * @var \Rector\BetterPhpDocParser\DataProvider\CurrentTokenIteratorProvider */ - private $currentTokenIteratorProvider; + private CurrentTokenIteratorProvider $currentTokenIteratorProvider; /** * @readonly - * @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer */ - private $attributeMirrorer; + private AttributeMirrorer $attributeMirrorer; public function __construct(CurrentTokenIteratorProvider $currentTokenIteratorProvider, AttributeMirrorer $attributeMirrorer) { $this->currentTokenIteratorProvider = $currentTokenIteratorProvider; diff --git a/src/BetterPhpDocParser/PhpDocNodeVisitor/UnionTypeNodePhpDocNodeVisitor.php b/src/BetterPhpDocParser/PhpDocNodeVisitor/UnionTypeNodePhpDocNodeVisitor.php index 670814fe66f..eb43d5f0f69 100644 --- a/src/BetterPhpDocParser/PhpDocNodeVisitor/UnionTypeNodePhpDocNodeVisitor.php +++ b/src/BetterPhpDocParser/PhpDocNodeVisitor/UnionTypeNodePhpDocNodeVisitor.php @@ -18,14 +18,12 @@ final class UnionTypeNodePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor imp { /** * @readonly - * @var \Rector\BetterPhpDocParser\DataProvider\CurrentTokenIteratorProvider */ - private $currentTokenIteratorProvider; + private CurrentTokenIteratorProvider $currentTokenIteratorProvider; /** * @readonly - * @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer */ - private $attributeMirrorer; + private AttributeMirrorer $attributeMirrorer; public function __construct(CurrentTokenIteratorProvider $currentTokenIteratorProvider, AttributeMirrorer $attributeMirrorer) { $this->currentTokenIteratorProvider = $currentTokenIteratorProvider; diff --git a/src/BetterPhpDocParser/PhpDocParser/ArrayItemClassNameDecorator.php b/src/BetterPhpDocParser/PhpDocParser/ArrayItemClassNameDecorator.php index a21f3c3f5bc..bb1df03ab9c 100644 --- a/src/BetterPhpDocParser/PhpDocParser/ArrayItemClassNameDecorator.php +++ b/src/BetterPhpDocParser/PhpDocParser/ArrayItemClassNameDecorator.php @@ -19,14 +19,12 @@ final class ArrayItemClassNameDecorator implements PhpDocNodeDecoratorInterface { /** * @readonly - * @var \Rector\StaticTypeMapper\Naming\NameScopeFactory */ - private $nameScopeFactory; + private NameScopeFactory $nameScopeFactory; /** * @readonly - * @var \Rector\PhpDocParser\PhpDocParser\PhpDocNodeTraverser */ - private $phpDocNodeTraverser; + private PhpDocNodeTraverser $phpDocNodeTraverser; public function __construct(NameScopeFactory $nameScopeFactory, PhpDocNodeTraverser $phpDocNodeTraverser) { $this->nameScopeFactory = $nameScopeFactory; diff --git a/src/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php b/src/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php index 949ec9766f6..2819ff9f5f0 100644 --- a/src/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php +++ b/src/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php @@ -16,6 +16,7 @@ use PHPStan\PhpDocParser\Parser\ConstExprParser; use PHPStan\PhpDocParser\Parser\PhpDocParser; use PHPStan\PhpDocParser\Parser\TokenIterator; use PHPStan\PhpDocParser\Parser\TypeParser; +use PHPStan\PhpDocParser\ParserConfig; use Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface; use Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory; use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator; @@ -30,19 +31,17 @@ final class BetterPhpDocParser extends PhpDocParser { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory */ - private $tokenIteratorFactory; + private TokenIteratorFactory $tokenIteratorFactory; /** * @var PhpDocNodeDecoratorInterface[] * @readonly */ - private $phpDocNodeDecorators; + private array $phpDocNodeDecorators; /** * @readonly - * @var \Rector\Util\Reflection\PrivatesAccessor */ - private $privatesAccessor; + private PrivatesAccessor $privatesAccessor; /** * @var string * @see https://regex101.com/r/JDzr0c/1 @@ -56,26 +55,18 @@ final class BetterPhpDocParser extends PhpDocParser /** * @param PhpDocNodeDecoratorInterface[] $phpDocNodeDecorators */ - public function __construct(TypeParser $typeParser, ConstExprParser $constExprParser, TokenIteratorFactory $tokenIteratorFactory, array $phpDocNodeDecorators, PrivatesAccessor $privatesAccessor) + public function __construct(ParserConfig $parserConfig, TypeParser $typeParser, ConstExprParser $constExprParser, TokenIteratorFactory $tokenIteratorFactory, array $phpDocNodeDecorators, PrivatesAccessor $privatesAccessor) { $this->tokenIteratorFactory = $tokenIteratorFactory; $this->phpDocNodeDecorators = $phpDocNodeDecorators; $this->privatesAccessor = $privatesAccessor; parent::__construct( + // ParserConfig + $parserConfig, // TypeParser $typeParser, // ConstExprParser - $constExprParser, - // requireWhitespaceBeforeDescription - \false, - // preserveTypeAliasesWithInvalidTypes - \false, - // usedAttributes - ['lines' => \true, 'indexes' => \true], - // parseDoctrineAnnotations - \false, - // textBetweenTagsBelongsToDescription, default to false, exists since 1.23.0 - \true + $constExprParser ); } public function parseWithNode(BetterTokenIterator $betterTokenIterator, Node $node) : PhpDocNode @@ -117,16 +108,12 @@ final class BetterPhpDocParser extends PhpDocParser $phpDocTagValueNode = parent::parseTagValue($tokenIterator, $tag); $endPosition = $tokenIterator->currentPosition(); if ($isPrecededByHorizontalWhitespace && \property_exists($phpDocTagValueNode, 'description')) { - $phpDocTagValueNode->description = Strings::replace((string) $phpDocTagValueNode->description, self::NEW_LINE_REGEX, static function (array $match) : string { - return $match['new_line'] . ' * '; - }); + $phpDocTagValueNode->description = Strings::replace((string) $phpDocTagValueNode->description, self::NEW_LINE_REGEX, static fn(array $match): string => $match['new_line'] . ' * '); } $startAndEnd = new StartAndEnd($startPosition, $endPosition); $phpDocTagValueNode->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd); if ($phpDocTagValueNode instanceof GenericTagValueNode) { - $phpDocTagValueNode->value = Strings::replace($phpDocTagValueNode->value, self::MULTI_NEW_LINES_REGEX, static function (array $match) { - return $match['new_line']; - }); + $phpDocTagValueNode->value = Strings::replace($phpDocTagValueNode->value, self::MULTI_NEW_LINES_REGEX, static fn(array $match) => $match['new_line']); } return $phpDocTagValueNode; } diff --git a/src/BetterPhpDocParser/PhpDocParser/ClassAnnotationMatcher.php b/src/BetterPhpDocParser/PhpDocParser/ClassAnnotationMatcher.php index ea9d264bc71..11020982915 100644 --- a/src/BetterPhpDocParser/PhpDocParser/ClassAnnotationMatcher.php +++ b/src/BetterPhpDocParser/PhpDocParser/ClassAnnotationMatcher.php @@ -19,23 +19,20 @@ final class ClassAnnotationMatcher { /** * @readonly - * @var \Rector\CodingStyle\NodeAnalyzer\UseImportNameMatcher */ - private $useImportNameMatcher; + private UseImportNameMatcher $useImportNameMatcher; /** * @readonly - * @var \Rector\Naming\Naming\UseImportsResolver */ - private $useImportsResolver; + private UseImportsResolver $useImportsResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @var array */ - private $fullyQualifiedNameByHash = []; + private array $fullyQualifiedNameByHash = []; public function __construct(UseImportNameMatcher $useImportNameMatcher, UseImportsResolver $useImportsResolver, ReflectionProvider $reflectionProvider) { $this->useImportNameMatcher = $useImportNameMatcher; diff --git a/src/BetterPhpDocParser/PhpDocParser/ConstExprClassNameDecorator.php b/src/BetterPhpDocParser/PhpDocParser/ConstExprClassNameDecorator.php index 87de5359f29..fcb5d16f054 100644 --- a/src/BetterPhpDocParser/PhpDocParser/ConstExprClassNameDecorator.php +++ b/src/BetterPhpDocParser/PhpDocParser/ConstExprClassNameDecorator.php @@ -19,14 +19,12 @@ final class ConstExprClassNameDecorator implements PhpDocNodeDecoratorInterface { /** * @readonly - * @var \Rector\StaticTypeMapper\Naming\NameScopeFactory */ - private $nameScopeFactory; + private NameScopeFactory $nameScopeFactory; /** * @readonly - * @var \Rector\PhpDocParser\PhpDocParser\PhpDocNodeTraverser */ - private $phpDocNodeTraverser; + private PhpDocNodeTraverser $phpDocNodeTraverser; public function __construct(NameScopeFactory $nameScopeFactory, PhpDocNodeTraverser $phpDocNodeTraverser) { $this->nameScopeFactory = $nameScopeFactory; diff --git a/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php b/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php index c6c080a4926..f8b110a1422 100644 --- a/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php +++ b/src/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php @@ -3,9 +3,12 @@ declare (strict_types=1); namespace Rector\BetterPhpDocParser\PhpDocParser; +use PHPStan\Type\ObjectType; +use PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine\DoctrineTagValueNode; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\Node; use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode; +use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; @@ -20,30 +23,34 @@ use Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory; use Rector\BetterPhpDocParser\ValueObject\DoctrineAnnotation\SilentKeyMap; use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey; use Rector\BetterPhpDocParser\ValueObject\StartAndEnd; +use Rector\NodeTypeResolver\Node\AttributeKey; +use Rector\StaticTypeMapper\ValueObject\Type\AliasedObjectType; +use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType; +use Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier; use Rector\Util\StringUtils; use RectorPrefix202411\Webmozart\Assert\Assert; final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher */ - private $classAnnotationMatcher; + private \Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher $classAnnotationMatcher; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser */ - private $staticDoctrineAnnotationParser; + private \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser $staticDoctrineAnnotationParser; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory */ - private $tokenIteratorFactory; + private TokenIteratorFactory $tokenIteratorFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer */ - private $attributeMirrorer; + private AttributeMirrorer $attributeMirrorer; + /** + * @readonly + */ + private ObjectTypeSpecifier $objectTypeSpecifier; /** * @see https://regex101.com/r/bGp2V0/2 * @var string @@ -64,12 +71,18 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface * @var string */ private const NEWLINE_ANNOTATION_FQCN_REGEX = '#\\r?\\n@\\\\#'; - public function __construct(\Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher $classAnnotationMatcher, \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser $staticDoctrineAnnotationParser, TokenIteratorFactory $tokenIteratorFactory, AttributeMirrorer $attributeMirrorer) + /** + * @var string + * @see https://regex101.com/r/3zXEh7/1 + */ + private const STAR_COMMENT_REGEX = '#^\\s*\\*#ms'; + public function __construct(\Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher $classAnnotationMatcher, \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser $staticDoctrineAnnotationParser, TokenIteratorFactory $tokenIteratorFactory, AttributeMirrorer $attributeMirrorer, ObjectTypeSpecifier $objectTypeSpecifier) { $this->classAnnotationMatcher = $classAnnotationMatcher; $this->staticDoctrineAnnotationParser = $staticDoctrineAnnotationParser; $this->tokenIteratorFactory = $tokenIteratorFactory; $this->attributeMirrorer = $attributeMirrorer; + $this->objectTypeSpecifier = $objectTypeSpecifier; } public function decorate(PhpDocNode $phpDocNode, Node $phpNode) : void { @@ -171,6 +184,19 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface if (!$phpDocChildNode instanceof PhpDocTagNode) { continue; } + // single quoted got invalid tag, keep process + if ($phpDocChildNode->value instanceof InvalidTagValueNode) { + $name = \ltrim($phpDocChildNode->name, '@'); + $values = $phpDocChildNode->value->value; + $this->processDoctrine($currentPhpNode, $name, $phpDocChildNode, $phpDocNode, $key, $values); + } + // needs stable correct detection of full class name + if ($phpDocChildNode->value instanceof DoctrineTagValueNode) { + $name = \ltrim($phpDocChildNode->name, '@'); + $values = \implode(', ', $phpDocChildNode->value->annotation->arguments); + $this->processDoctrine($currentPhpNode, $name, $phpDocChildNode, $phpDocNode, $key, $values); + continue; + } if (!$phpDocChildNode->value instanceof GenericTagValueNode) { $this->processDescriptionAsSpacelessPhpDoctagNode($phpDocNode, $phpDocChildNode, $currentPhpNode, $key); continue; @@ -212,6 +238,35 @@ final class DoctrineAnnotationDecorator implements PhpDocNodeDecoratorInterface \array_splice($phpDocNode->children, $key + 1, 0, $spacelessPhpDocTagNodes); } } + /** + * @param mixed $key + */ + private function processDoctrine(Node $currentPhpNode, string $name, PhpDocTagNode $phpDocTagNode, PhpDocNode $phpDocNode, $key, string $values) : void + { + $type = $this->objectTypeSpecifier->narrowToFullyQualifiedOrAliasedObjectType($currentPhpNode, new ObjectType($name), $currentPhpNode->getAttribute(AttributeKey::SCOPE)); + $fullyQualifiedAnnotationClass = null; + if ($type instanceof ShortenedObjectType || $type instanceof AliasedObjectType) { + $fullyQualifiedAnnotationClass = $type->getFullyQualifiedName(); + } elseif ($type instanceof ObjectType) { + $fullyQualifiedAnnotationClass = $type->getClassName(); + } + if ($fullyQualifiedAnnotationClass === null) { + return; + } + if ($values !== '') { + $values = Strings::replace($values, self::STAR_COMMENT_REGEX); + $values = \strncmp($values, '(', \strlen('(')) === 0 ? \str_replace("'", '"', $values) : '(' . $values . ')'; + if ($phpDocTagNode->value instanceof DoctrineTagValueNode && $phpDocTagNode->value->description !== '') { + $values .= $phpDocTagNode->value->description; + } + } + $genericTagValueNode = new GenericTagValueNode($values); + $startAndEnd = $phpDocTagNode->getAttribute(PhpDocAttributeKey::START_AND_END); + $genericTagValueNode->setAttribute(PhpDocAttributeKey::START_AND_END, $startAndEnd); + $spacelessPhpDocTagNode = $this->createSpacelessPhpDocTagNode('@' . $name, $genericTagValueNode, $fullyQualifiedAnnotationClass, $currentPhpNode); + $this->attributeMirrorer->mirror($phpDocTagNode, $spacelessPhpDocTagNode); + $phpDocNode->children[$key] = $spacelessPhpDocTagNode; + } private function processDescriptionAsSpacelessPhpDoctagNode(PhpDocNode $phpDocNode, PhpDocTagNode $phpDocTagNode, Node $currentPhpNode, int $key) : void { if (!\property_exists($phpDocTagNode->value, 'description')) { diff --git a/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php b/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php index 8862737d880..96732475c1d 100644 --- a/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php +++ b/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php @@ -22,14 +22,12 @@ final class StaticDoctrineAnnotationParser { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\PlainValueParser */ - private $plainValueParser; + private PlainValueParser $plainValueParser; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\ArrayParser */ - private $arrayParser; + private ArrayParser $arrayParser; /** * @var string * @see https://regex101.com/r/Pthg5d/1 diff --git a/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/ArrayParser.php b/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/ArrayParser.php index 1d4f9cbca8d..4c813d6dbde 100644 --- a/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/ArrayParser.php +++ b/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/ArrayParser.php @@ -17,9 +17,8 @@ final class ArrayParser { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\PlainValueParser */ - private $plainValueParser; + private \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\PlainValueParser $plainValueParser; public function __construct(\Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\PlainValueParser $plainValueParser) { $this->plainValueParser = $plainValueParser; diff --git a/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/PlainValueParser.php b/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/PlainValueParser.php index eb0e14ccacf..b0b2924df7c 100644 --- a/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/PlainValueParser.php +++ b/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/PlainValueParser.php @@ -20,17 +20,10 @@ final class PlainValueParser { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher */ - private $classAnnotationMatcher; - /** - * @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser - */ - private $staticDoctrineAnnotationParser; - /** - * @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\ArrayParser - */ - private $arrayParser; + private ClassAnnotationMatcher $classAnnotationMatcher; + private StaticDoctrineAnnotationParser $staticDoctrineAnnotationParser; + private \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\ArrayParser $arrayParser; public function __construct(ClassAnnotationMatcher $classAnnotationMatcher) { $this->classAnnotationMatcher = $classAnnotationMatcher; diff --git a/src/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php b/src/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php index 97a6cb6ec7a..bc765a1b14e 100644 --- a/src/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php +++ b/src/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php @@ -29,24 +29,20 @@ final class PhpDocInfoPrinter { /** * @readonly - * @var \Rector\BetterPhpDocParser\Printer\EmptyPhpDocDetector */ - private $emptyPhpDocDetector; + private \Rector\BetterPhpDocParser\Printer\EmptyPhpDocDetector $emptyPhpDocDetector; /** * @readonly - * @var \Rector\BetterPhpDocParser\Printer\DocBlockInliner */ - private $docBlockInliner; + private \Rector\BetterPhpDocParser\Printer\DocBlockInliner $docBlockInliner; /** * @readonly - * @var \Rector\BetterPhpDocParser\Printer\RemoveNodesStartAndEndResolver */ - private $removeNodesStartAndEndResolver; + private \Rector\BetterPhpDocParser\Printer\RemoveNodesStartAndEndResolver $removeNodesStartAndEndResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocNodeVisitor\ChangedPhpDocNodeVisitor */ - private $changedPhpDocNodeVisitor; + private ChangedPhpDocNodeVisitor $changedPhpDocNodeVisitor; /** * @var string * @see https://regex101.com/r/Ab0Vey/1 @@ -70,27 +66,17 @@ final class PhpDocInfoPrinter * @see https://regex101.com/r/ME5Fcn/1 */ private const NEW_LINE_WITH_SPACE_REGEX = "# (?\r\n|\n)#"; - /** - * @var int - */ - private $tokenCount = 0; - /** - * @var int - */ - private $currentTokenPosition = 0; + private int $tokenCount = 0; + private int $currentTokenPosition = 0; /** * @var mixed[] */ - private $tokens = []; - /** - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo|null - */ - private $phpDocInfo; + private array $tokens = []; + private ?PhpDocInfo $phpDocInfo = null; /** * @readonly - * @var \Rector\PhpDocParser\PhpDocParser\PhpDocNodeTraverser */ - private $changedPhpDocNodeTraverser; + private PhpDocNodeTraverser $changedPhpDocNodeTraverser; public function __construct(\Rector\BetterPhpDocParser\Printer\EmptyPhpDocDetector $emptyPhpDocDetector, \Rector\BetterPhpDocParser\Printer\DocBlockInliner $docBlockInliner, \Rector\BetterPhpDocParser\Printer\RemoveNodesStartAndEndResolver $removeNodesStartAndEndResolver, ChangedPhpDocNodeVisitor $changedPhpDocNodeVisitor) { $this->emptyPhpDocDetector = $emptyPhpDocDetector; @@ -179,9 +165,7 @@ final class PhpDocInfoPrinter if (\strncmp($output, '/**', \strlen('/**')) === 0 && !StringUtils::isMatch($output, self::CLOSING_DOCBLOCK_REGEX)) { $output .= ' */'; } - return Strings::replace($output, self::NEW_LINE_WITH_SPACE_REGEX, static function (array $match) { - return $match['new_line']; - }); + return Strings::replace($output, self::NEW_LINE_WITH_SPACE_REGEX, static fn(array $match) => $match['new_line']); } private function hasDocblockStart(string $output) : bool { diff --git a/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php b/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php index 4e8a45aa86b..60ba3449800 100644 --- a/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php +++ b/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php @@ -13,20 +13,11 @@ abstract class AbstractValuesAwareNode implements PhpDocTagValueNode /** * @var ArrayItemNode[] */ - public $values = []; - /** - * @var string|null - */ - protected $originalContent; - /** - * @var string|null - */ - protected $silentKey; + public array $values = []; + protected ?string $originalContent = null; + protected ?string $silentKey = null; use NodeAttributes; - /** - * @var bool - */ - protected $hasChanged = \false; + protected bool $hasChanged = \false; /** * @param ArrayItemNode[] $values Must be public so node traverser can go through them */ @@ -103,9 +94,7 @@ abstract class AbstractValuesAwareNode implements PhpDocTagValueNode protected function printValuesContent(array $values) : string { $itemContents = ''; - \end($values); - $lastItemKey = \key($values); - \reset($values); + $lastItemKey = \array_key_last($values); foreach ($values as $key => $value) { if (\is_int($key)) { $itemContents .= $this->stringifyValue($value); diff --git a/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/CurlyListNode.php b/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/CurlyListNode.php index e61201fad58..a1fbf93931a 100644 --- a/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/CurlyListNode.php +++ b/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/CurlyListNode.php @@ -12,7 +12,7 @@ final class CurlyListNode extends \Rector\BetterPhpDocParser\ValueObject\PhpDoc\ * @var ArrayItemNode[] * @readonly */ - private $arrayItemNodes = []; + private array $arrayItemNodes = []; /** * @param ArrayItemNode[] $arrayItemNodes */ @@ -33,9 +33,7 @@ final class CurlyListNode extends \Rector\BetterPhpDocParser\ValueObject\PhpDoc\ private function implode(array $array) : string { $itemContents = ''; - \end($array); - $lastItemKey = \key($array); - \reset($array); + $lastItemKey = \array_key_last($array); foreach ($array as $key => $value) { if (\is_int($key)) { $itemContents .= (string) $value; diff --git a/src/BetterPhpDocParser/ValueObject/PhpDoc/SpacingAwareTemplateTagValueNode.php b/src/BetterPhpDocParser/ValueObject/PhpDoc/SpacingAwareTemplateTagValueNode.php index 09408f0b6a0..449215e2427 100644 --- a/src/BetterPhpDocParser/ValueObject/PhpDoc/SpacingAwareTemplateTagValueNode.php +++ b/src/BetterPhpDocParser/ValueObject/PhpDoc/SpacingAwareTemplateTagValueNode.php @@ -10,9 +10,8 @@ final class SpacingAwareTemplateTagValueNode extends TemplateTagValueNode { /** * @readonly - * @var string */ - private $preposition; + private string $preposition; public function __construct(string $name, ?TypeNode $typeNode, string $description, string $preposition) { $this->preposition = $preposition; diff --git a/src/BetterPhpDocParser/ValueObject/StartAndEnd.php b/src/BetterPhpDocParser/ValueObject/StartAndEnd.php index 5b2621b58d8..49f86da40ca 100644 --- a/src/BetterPhpDocParser/ValueObject/StartAndEnd.php +++ b/src/BetterPhpDocParser/ValueObject/StartAndEnd.php @@ -8,14 +8,12 @@ final class StartAndEnd { /** * @readonly - * @var int */ - private $start; + private int $start; /** * @readonly - * @var int */ - private $end; + private int $end; public function __construct(int $start, int $end) { $this->start = $start; diff --git a/src/BetterPhpDocParser/ValueObject/Type/BracketsAwareUnionTypeNode.php b/src/BetterPhpDocParser/ValueObject/Type/BracketsAwareUnionTypeNode.php index d566e953b81..3cb85ce1347 100644 --- a/src/BetterPhpDocParser/ValueObject/Type/BracketsAwareUnionTypeNode.php +++ b/src/BetterPhpDocParser/ValueObject/Type/BracketsAwareUnionTypeNode.php @@ -10,9 +10,8 @@ final class BracketsAwareUnionTypeNode extends UnionTypeNode { /** * @readonly - * @var bool */ - private $isWrappedInBrackets = \false; + private bool $isWrappedInBrackets = \false; /** * @param TypeNode[] $types */ diff --git a/src/Bridge/SetProviderCollector.php b/src/Bridge/SetProviderCollector.php index 2780e071848..c05a0767d9a 100644 --- a/src/Bridge/SetProviderCollector.php +++ b/src/Bridge/SetProviderCollector.php @@ -23,7 +23,7 @@ final class SetProviderCollector * @var SetProviderInterface[] * @readonly */ - private $setProviders; + private array $setProviders; /** * @param SetProviderInterface[] $extraSetProviders */ @@ -63,8 +63,6 @@ final class SetProviderCollector */ public function provideComposerTriggeredSets() : array { - return \array_filter($this->provideSets(), function (SetInterface $set) : bool { - return $set instanceof ComposerTriggeredSet; - }); + return \array_filter($this->provideSets(), fn(SetInterface $set): bool => $set instanceof ComposerTriggeredSet); } } diff --git a/src/Caching/Cache.php b/src/Caching/Cache.php index c3f4c7983f2..54df4f0de40 100644 --- a/src/Caching/Cache.php +++ b/src/Caching/Cache.php @@ -9,9 +9,8 @@ final class Cache { /** * @readonly - * @var \Rector\Caching\Contract\ValueObject\Storage\CacheStorageInterface */ - private $cacheStorage; + private CacheStorageInterface $cacheStorage; public function __construct(CacheStorageInterface $cacheStorage) { $this->cacheStorage = $cacheStorage; diff --git a/src/Caching/CacheFactory.php b/src/Caching/CacheFactory.php index de80f5be9c5..2154b626f84 100644 --- a/src/Caching/CacheFactory.php +++ b/src/Caching/CacheFactory.php @@ -12,9 +12,8 @@ final class CacheFactory { /** * @readonly - * @var \Symfony\Component\Filesystem\Filesystem */ - private $fileSystem; + private Filesystem $fileSystem; public function __construct(Filesystem $fileSystem) { $this->fileSystem = $fileSystem; diff --git a/src/Caching/Detector/ChangedFilesDetector.php b/src/Caching/Detector/ChangedFilesDetector.php index 1246e2fc84d..4017b502ecb 100644 --- a/src/Caching/Detector/ChangedFilesDetector.php +++ b/src/Caching/Detector/ChangedFilesDetector.php @@ -16,23 +16,20 @@ final class ChangedFilesDetector { /** * @readonly - * @var \Rector\Caching\Config\FileHashComputer */ - private $fileHashComputer; + private FileHashComputer $fileHashComputer; /** * @readonly - * @var \Rector\Caching\Cache */ - private $cache; + private Cache $cache; /** * @readonly - * @var \Rector\Util\FileHasher */ - private $fileHasher; + private FileHasher $fileHasher; /** * @var array */ - private $cachableFiles = []; + private array $cachableFiles = []; public function __construct(FileHashComputer $fileHashComputer, Cache $cache, FileHasher $fileHasher) { $this->fileHashComputer = $fileHashComputer; diff --git a/src/Caching/UnchangedFilesFilter.php b/src/Caching/UnchangedFilesFilter.php index 595ba65cfa3..797242d9db8 100644 --- a/src/Caching/UnchangedFilesFilter.php +++ b/src/Caching/UnchangedFilesFilter.php @@ -8,9 +8,8 @@ final class UnchangedFilesFilter { /** * @readonly - * @var \Rector\Caching\Detector\ChangedFilesDetector */ - private $changedFilesDetector; + private ChangedFilesDetector $changedFilesDetector; public function __construct(ChangedFilesDetector $changedFilesDetector) { $this->changedFilesDetector = $changedFilesDetector; diff --git a/src/Caching/ValueObject/CacheFilePaths.php b/src/Caching/ValueObject/CacheFilePaths.php index d30aa9a6dec..5c3415e609a 100644 --- a/src/Caching/ValueObject/CacheFilePaths.php +++ b/src/Caching/ValueObject/CacheFilePaths.php @@ -7,19 +7,16 @@ final class CacheFilePaths { /** * @readonly - * @var string */ - private $firstDirectory; + private string $firstDirectory; /** * @readonly - * @var string */ - private $secondDirectory; + private string $secondDirectory; /** * @readonly - * @var string */ - private $filePath; + private string $filePath; public function __construct(string $firstDirectory, string $secondDirectory, string $filePath) { $this->firstDirectory = $firstDirectory; diff --git a/src/Caching/ValueObject/CacheItem.php b/src/Caching/ValueObject/CacheItem.php index ebb60a5b57a..42fa4fa4e48 100644 --- a/src/Caching/ValueObject/CacheItem.php +++ b/src/Caching/ValueObject/CacheItem.php @@ -11,9 +11,8 @@ final class CacheItem { /** * @readonly - * @var string */ - private $variableKey; + private string $variableKey; /** * @readonly * @var mixed diff --git a/src/Caching/ValueObject/Storage/FileCacheStorage.php b/src/Caching/ValueObject/Storage/FileCacheStorage.php index 61154a0a422..b635e74daca 100644 --- a/src/Caching/ValueObject/Storage/FileCacheStorage.php +++ b/src/Caching/ValueObject/Storage/FileCacheStorage.php @@ -18,14 +18,12 @@ final class FileCacheStorage implements CacheStorageInterface { /** * @readonly - * @var string */ - private $directory; + private string $directory; /** * @readonly - * @var \Symfony\Component\Filesystem\Filesystem */ - private $filesystem; + private \RectorPrefix202411\Symfony\Component\Filesystem\Filesystem $filesystem; public function __construct(string $directory, \RectorPrefix202411\Symfony\Component\Filesystem\Filesystem $filesystem) { $this->directory = $directory; diff --git a/src/Caching/ValueObject/Storage/MemoryCacheStorage.php b/src/Caching/ValueObject/Storage/MemoryCacheStorage.php index be137b17810..e6cec6a9a77 100644 --- a/src/Caching/ValueObject/Storage/MemoryCacheStorage.php +++ b/src/Caching/ValueObject/Storage/MemoryCacheStorage.php @@ -13,7 +13,7 @@ final class MemoryCacheStorage implements CacheStorageInterface /** * @var array */ - private $storage = []; + private array $storage = []; /** * @return null|mixed */ diff --git a/src/ChangesReporting/Output/ConsoleOutputFormatter.php b/src/ChangesReporting/Output/ConsoleOutputFormatter.php index 773b5c16f72..fa37307b404 100644 --- a/src/ChangesReporting/Output/ConsoleOutputFormatter.php +++ b/src/ChangesReporting/Output/ConsoleOutputFormatter.php @@ -17,9 +17,8 @@ final class ConsoleOutputFormatter implements OutputFormatterInterface { /** * @readonly - * @var \Symfony\Component\Console\Style\SymfonyStyle */ - private $symfonyStyle; + private SymfonyStyle $symfonyStyle; /** * @var string */ diff --git a/src/ChangesReporting/ValueObject/RectorWithLineChange.php b/src/ChangesReporting/ValueObject/RectorWithLineChange.php index d25c6007619..8777ade9b63 100644 --- a/src/ChangesReporting/ValueObject/RectorWithLineChange.php +++ b/src/ChangesReporting/ValueObject/RectorWithLineChange.php @@ -10,9 +10,8 @@ final class RectorWithLineChange implements SerializableInterface { /** * @readonly - * @var int */ - private $line; + private int $line; /** * @var string */ @@ -25,7 +24,7 @@ final class RectorWithLineChange implements SerializableInterface * @var class-string * @readonly */ - private $rectorClass; + private string $rectorClass; /** * @param class-string|RectorInterface $rectorClass */ @@ -46,9 +45,8 @@ final class RectorWithLineChange implements SerializableInterface } /** * @param array $json - * @return $this */ - public static function decode(array $json) : \RectorPrefix202411\Symplify\EasyParallel\Contract\SerializableInterface + public static function decode(array $json) : self { /** @var class-string $rectorClass */ $rectorClass = $json[self::KEY_RECTOR_CLASS]; diff --git a/src/ChangesReporting/ValueObjectFactory/ErrorFactory.php b/src/ChangesReporting/ValueObjectFactory/ErrorFactory.php index df2b6f8b6f7..9c3bdcef33e 100644 --- a/src/ChangesReporting/ValueObjectFactory/ErrorFactory.php +++ b/src/ChangesReporting/ValueObjectFactory/ErrorFactory.php @@ -10,9 +10,8 @@ final class ErrorFactory { /** * @readonly - * @var \Rector\FileSystem\FilePathHelper */ - private $filePathHelper; + private FilePathHelper $filePathHelper; public function __construct(FilePathHelper $filePathHelper) { $this->filePathHelper = $filePathHelper; diff --git a/src/ChangesReporting/ValueObjectFactory/FileDiffFactory.php b/src/ChangesReporting/ValueObjectFactory/FileDiffFactory.php index fdf7d757b3f..ce6f1d93aa2 100644 --- a/src/ChangesReporting/ValueObjectFactory/FileDiffFactory.php +++ b/src/ChangesReporting/ValueObjectFactory/FileDiffFactory.php @@ -13,19 +13,16 @@ final class FileDiffFactory { /** * @readonly - * @var \Rector\Differ\DefaultDiffer */ - private $defaultDiffer; + private DefaultDiffer $defaultDiffer; /** * @readonly - * @var \Rector\Console\Formatter\ConsoleDiffer */ - private $consoleDiffer; + private ConsoleDiffer $consoleDiffer; /** * @readonly - * @var \Rector\FileSystem\FilePathHelper */ - private $filePathHelper; + private FilePathHelper $filePathHelper; public function __construct(DefaultDiffer $defaultDiffer, ConsoleDiffer $consoleDiffer, FilePathHelper $filePathHelper) { $this->defaultDiffer = $defaultDiffer; diff --git a/src/Comments/CommentRemover.php b/src/Comments/CommentRemover.php index e7682900036..5235beffa23 100644 --- a/src/Comments/CommentRemover.php +++ b/src/Comments/CommentRemover.php @@ -12,9 +12,8 @@ final class CommentRemover { /** * @readonly - * @var \Rector\Comments\NodeTraverser\CommentRemovingNodeTraverser */ - private $commentRemovingNodeTraverser; + private CommentRemovingNodeTraverser $commentRemovingNodeTraverser; public function __construct(CommentRemovingNodeTraverser $commentRemovingNodeTraverser) { $this->commentRemovingNodeTraverser = $commentRemovingNodeTraverser; diff --git a/src/Comments/NodeDocBlock/DocBlockUpdater.php b/src/Comments/NodeDocBlock/DocBlockUpdater.php index 6cf4ccb1777..a196fcc09ee 100644 --- a/src/Comments/NodeDocBlock/DocBlockUpdater.php +++ b/src/Comments/NodeDocBlock/DocBlockUpdater.php @@ -13,9 +13,8 @@ final class DocBlockUpdater { /** * @readonly - * @var \Rector\BetterPhpDocParser\Printer\PhpDocInfoPrinter */ - private $phpDocInfoPrinter; + private PhpDocInfoPrinter $phpDocInfoPrinter; public function __construct(PhpDocInfoPrinter $phpDocInfoPrinter) { $this->phpDocInfoPrinter = $phpDocInfoPrinter; @@ -37,9 +36,7 @@ final class DocBlockUpdater } private function setCommentsAttribute(Node $node) : void { - $comments = \array_filter($node->getComments(), static function (Comment $comment) : bool { - return !$comment instanceof Doc; - }); + $comments = \array_filter($node->getComments(), static fn(Comment $comment): bool => !$comment instanceof Doc); $node->setAttribute(AttributeKey::COMMENTS, $comments); } private function printPhpDocInfoToString(PhpDocInfo $phpDocInfo) : string diff --git a/src/Comments/NodeTraverser/CommentRemovingNodeTraverser.php b/src/Comments/NodeTraverser/CommentRemovingNodeTraverser.php index cbaec495479..99e502c151a 100644 --- a/src/Comments/NodeTraverser/CommentRemovingNodeTraverser.php +++ b/src/Comments/NodeTraverser/CommentRemovingNodeTraverser.php @@ -9,7 +9,7 @@ final class CommentRemovingNodeTraverser extends NodeTraverser { public function __construct(CommentRemovingNodeVisitor $commentRemovingNodeVisitor) { - $this->addVisitor($commentRemovingNodeVisitor); parent::__construct(); + $this->addVisitor($commentRemovingNodeVisitor); } } diff --git a/src/Composer/InstalledPackageResolver.php b/src/Composer/InstalledPackageResolver.php index 80dbdcebad1..c40e7d67ecd 100644 --- a/src/Composer/InstalledPackageResolver.php +++ b/src/Composer/InstalledPackageResolver.php @@ -15,13 +15,12 @@ final class InstalledPackageResolver { /** * @readonly - * @var string|null */ - private $projectDirectory; + private ?string $projectDirectory = null; /** * @var InstalledPackage[] */ - private $resolvedInstalledPackages = []; + private array $resolvedInstalledPackages = []; public function __construct(?string $projectDirectory = null) { $this->projectDirectory = $projectDirectory; diff --git a/src/Composer/ValueObject/InstalledPackage.php b/src/Composer/ValueObject/InstalledPackage.php index 3337877015c..8fb30c63ec4 100644 --- a/src/Composer/ValueObject/InstalledPackage.php +++ b/src/Composer/ValueObject/InstalledPackage.php @@ -7,14 +7,12 @@ final class InstalledPackage { /** * @readonly - * @var string */ - private $name; + private string $name; /** * @readonly - * @var string */ - private $version; + private string $version; public function __construct(string $name, string $version) { $this->name = $name; diff --git a/src/Config/RectorConfig.php b/src/Config/RectorConfig.php index c706b4ee715..fb229bc8e60 100644 --- a/src/Config/RectorConfig.php +++ b/src/Config/RectorConfig.php @@ -29,13 +29,13 @@ use RectorPrefix202411\Webmozart\Assert\Assert; final class RectorConfig extends Container { /** - * @var array, mixed[]>> + * @var array, mixed[]> */ - private $ruleConfigurations = []; + private array $ruleConfigurations = []; /** * @var string[] */ - private $autotagInterfaces = [Command::class, ResetableInterface::class]; + private array $autotagInterfaces = [Command::class, ResetableInterface::class]; public static function configure() : RectorConfigBuilder { return new RectorConfigBuilder(); diff --git a/src/Config/RegisteredService.php b/src/Config/RegisteredService.php index aca7fb89b6e..c240edf663a 100644 --- a/src/Config/RegisteredService.php +++ b/src/Config/RegisteredService.php @@ -7,19 +7,16 @@ final class RegisteredService { /** * @readonly - * @var string */ - private $className; + private string $className; /** * @readonly - * @var string|null */ - private $alias; + private ?string $alias; /** * @readonly - * @var string|null */ - private $tag; + private ?string $tag; public function __construct(string $className, ?string $alias, ?string $tag) { $this->className = $className; diff --git a/src/Configuration/ConfigInitializer.php b/src/Configuration/ConfigInitializer.php index ff789008d3f..bf7c67b066b 100644 --- a/src/Configuration/ConfigInitializer.php +++ b/src/Configuration/ConfigInitializer.php @@ -14,17 +14,15 @@ final class ConfigInitializer * @var RectorInterface[] * @readonly */ - private $rectors; + private array $rectors; /** * @readonly - * @var \Rector\FileSystem\InitFilePathsResolver */ - private $initFilePathsResolver; + private InitFilePathsResolver $initFilePathsResolver; /** * @readonly - * @var \Symfony\Component\Console\Style\SymfonyStyle */ - private $symfonyStyle; + private SymfonyStyle $symfonyStyle; /** * @param RectorInterface[] $rectors */ @@ -63,9 +61,7 @@ final class ConfigInitializer */ private function filterActiveRectors(array $rectors) : array { - return \array_filter($rectors, static function (RectorInterface $rector) : bool { - return !$rector instanceof PostRectorInterface; - }); + return \array_filter($rectors, static fn(RectorInterface $rector): bool => !$rector instanceof PostRectorInterface); } private function replacePathsContents(string $rectorPhpTemplateContents, string $projectDirectory) : string { diff --git a/src/Configuration/ConfigurationFactory.php b/src/Configuration/ConfigurationFactory.php index 2690e4d1a69..a874c8f4628 100644 --- a/src/Configuration/ConfigurationFactory.php +++ b/src/Configuration/ConfigurationFactory.php @@ -15,9 +15,8 @@ final class ConfigurationFactory { /** * @readonly - * @var \Symfony\Component\Console\Style\SymfonyStyle */ - private $symfonyStyle; + private SymfonyStyle $symfonyStyle; public function __construct(SymfonyStyle $symfonyStyle) { $this->symfonyStyle = $symfonyStyle; diff --git a/src/Configuration/Parameter/SimpleParameterProvider.php b/src/Configuration/Parameter/SimpleParameterProvider.php index a7a8d0bbf84..32d00557f4e 100644 --- a/src/Configuration/Parameter/SimpleParameterProvider.php +++ b/src/Configuration/Parameter/SimpleParameterProvider.php @@ -14,7 +14,7 @@ final class SimpleParameterProvider /** * @var array */ - private static $parameters = []; + private static array $parameters = []; /** * @param Option::* $name * @param mixed $value diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index 12b3b6345cd..8a2008e6eb2 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -41,158 +41,90 @@ final class RectorConfigBuilder /** * @var string[] */ - private $paths = []; + private array $paths = []; /** * @var string[] */ - private $sets = []; + private array $sets = []; /** * @var array */ - private $skip = []; + private array $skip = []; /** * @var array> */ - private $rules = []; + private array $rules = []; /** * @var array, mixed[]> */ - private $rulesWithConfigurations = []; + private array $rulesWithConfigurations = []; /** * @var string[] */ - private $fileExtensions = []; + private array $fileExtensions = []; /** * @var null|class-string */ - private $cacheClass; - /** - * @var string|null - */ - private $cacheDirectory; - /** - * @var string|null - */ - private $containerCacheDirectory; - /** - * @var bool|null - */ - private $parallel; - /** - * @var int - */ - private $parallelTimeoutSeconds = 120; - /** - * @var int - */ - private $parallelMaxNumberOfProcess = 16; - /** - * @var int - */ - private $parallelJobSize = 16; - /** - * @var bool - */ - private $importNames = \false; - /** - * @var bool - */ - private $importDocBlockNames = \false; - /** - * @var bool - */ - private $importShortClasses = \true; - /** - * @var bool - */ - private $removeUnusedImports = \false; - /** - * @var bool - */ - private $noDiffs = \false; - /** - * @var string|null - */ - private $memoryLimit; + private ?string $cacheClass = null; + private ?string $cacheDirectory = null; + private ?string $containerCacheDirectory = null; + private ?bool $parallel = null; + private int $parallelTimeoutSeconds = 120; + private int $parallelMaxNumberOfProcess = 16; + private int $parallelJobSize = 16; + private bool $importNames = \false; + private bool $importDocBlockNames = \false; + private bool $importShortClasses = \true; + private bool $removeUnusedImports = \false; + private bool $noDiffs = \false; + private ?string $memoryLimit = null; /** * @var string[] */ - private $autoloadPaths = []; + private array $autoloadPaths = []; /** * @var string[] */ - private $bootstrapFiles = []; - /** - * @var string - */ - private $indentChar = ' '; - /** - * @var int - */ - private $indentSize = 4; + private array $bootstrapFiles = []; + private string $indentChar = ' '; + private int $indentSize = 4; /** * @var string[] */ - private $phpstanConfigs = []; + private array $phpstanConfigs = []; /** * @var null|PhpVersion::* */ - private $phpVersion; - /** - * @var string|null - */ - private $symfonyContainerXmlFile; - /** - * @var string|null - */ - private $symfonyContainerPhpFile; + private ?int $phpVersion = null; + private ?string $symfonyContainerXmlFile = null; + private ?string $symfonyContainerPhpFile = null; /** * To make sure type declarations set and level are not duplicated, * as both contain same rules - * @var bool|null */ - private $isTypeCoverageLevelUsed; - /** - * @var bool|null - */ - private $isDeadCodeLevelUsed; - /** - * @var bool|null - */ - private $isCodeQualityLevelUsed; - /** - * @var bool|null - */ - private $isFluentNewLine; + private ?bool $isTypeCoverageLevelUsed = null; + private ?bool $isDeadCodeLevelUsed = null; + private ?bool $isCodeQualityLevelUsed = null; + private ?bool $isFluentNewLine = null; /** * @var RegisteredService[] */ - private $registerServices = []; + private array $registerServices = []; /** * @var array */ - private $setGroups = []; - /** - * @var bool|null - */ - private $reportingRealPath; + private array $setGroups = []; + private ?bool $reportingRealPath = null; /** * @var string[] */ - private $groupLoadedSets = []; - /** - * @var string|null - */ - private $editorUrl; + private array $groupLoadedSets = []; + private ?string $editorUrl = null; /** * @api soon to be used - * @var bool|null */ - private $isWithPhpSetsUsed; - /** - * @var bool|null - */ - private $isWithPhpLevelUsed; + private ?bool $isWithPhpSetsUsed = null; + private ?bool $isWithPhpLevelUsed = null; public function __invoke(RectorConfig $rectorConfig) : void { if ($this->setGroups !== []) { diff --git a/src/Configuration/RenamedClassesDataCollector.php b/src/Configuration/RenamedClassesDataCollector.php index f85573cd323..b018fa2a219 100644 --- a/src/Configuration/RenamedClassesDataCollector.php +++ b/src/Configuration/RenamedClassesDataCollector.php @@ -10,7 +10,7 @@ final class RenamedClassesDataCollector implements ResetableInterface /** * @var array */ - private $oldToNewClasses = []; + private array $oldToNewClasses = []; public function reset() : void { $this->oldToNewClasses = []; diff --git a/src/Console/Command/CustomRuleCommand.php b/src/Console/Command/CustomRuleCommand.php index c248958dc34..fc93f2cf8ff 100644 --- a/src/Console/Command/CustomRuleCommand.php +++ b/src/Console/Command/CustomRuleCommand.php @@ -21,9 +21,8 @@ final class CustomRuleCommand extends Command { /** * @readonly - * @var \Symfony\Component\Console\Style\SymfonyStyle */ - private $symfonyStyle; + private SymfonyStyle $symfonyStyle; /** * @see https://regex101.com/r/2eP4rw/1 * @var string diff --git a/src/Console/Command/ListRulesCommand.php b/src/Console/Command/ListRulesCommand.php index 2de98e3cd20..a090e53609f 100644 --- a/src/Console/Command/ListRulesCommand.php +++ b/src/Console/Command/ListRulesCommand.php @@ -18,19 +18,17 @@ final class ListRulesCommand extends Command { /** * @readonly - * @var \Symfony\Component\Console\Style\SymfonyStyle */ - private $symfonyStyle; + private SymfonyStyle $symfonyStyle; /** * @readonly - * @var \Rector\Skipper\SkipCriteriaResolver\SkippedClassResolver */ - private $skippedClassResolver; + private SkippedClassResolver $skippedClassResolver; /** * @var RectorInterface[] * @readonly */ - private $rectors; + private array $rectors; /** * @param RectorInterface[] $rectors */ @@ -73,12 +71,8 @@ final class ListRulesCommand extends Command */ private function resolveRectorClasses() : array { - $customRectors = \array_filter($this->rectors, static function (RectorInterface $rector) : bool { - return !$rector instanceof PostRectorInterface; - }); - $rectorClasses = \array_map(static function (RectorInterface $rector) : string { - return \get_class($rector); - }, $customRectors); + $customRectors = \array_filter($this->rectors, static fn(RectorInterface $rector): bool => !$rector instanceof PostRectorInterface); + $rectorClasses = \array_map(static fn(RectorInterface $rector): string => \get_class($rector), $customRectors); \sort($rectorClasses); return \array_unique($rectorClasses); } diff --git a/src/Console/Command/ProcessCommand.php b/src/Console/Command/ProcessCommand.php index 9f4d0248005..406a1021aa6 100644 --- a/src/Console/Command/ProcessCommand.php +++ b/src/Console/Command/ProcessCommand.php @@ -30,59 +30,48 @@ final class ProcessCommand extends Command { /** * @readonly - * @var \Rector\Autoloading\AdditionalAutoloader */ - private $additionalAutoloader; + private AdditionalAutoloader $additionalAutoloader; /** * @readonly - * @var \Rector\Caching\Detector\ChangedFilesDetector */ - private $changedFilesDetector; + private ChangedFilesDetector $changedFilesDetector; /** * @readonly - * @var \Rector\Configuration\ConfigInitializer */ - private $configInitializer; + private ConfigInitializer $configInitializer; /** * @readonly - * @var \Rector\Application\ApplicationFileProcessor */ - private $applicationFileProcessor; + private ApplicationFileProcessor $applicationFileProcessor; /** * @readonly - * @var \Rector\StaticReflection\DynamicSourceLocatorDecorator */ - private $dynamicSourceLocatorDecorator; + private DynamicSourceLocatorDecorator $dynamicSourceLocatorDecorator; /** * @readonly - * @var \Rector\Console\Output\OutputFormatterCollector */ - private $outputFormatterCollector; + private OutputFormatterCollector $outputFormatterCollector; /** * @readonly - * @var \Symfony\Component\Console\Style\SymfonyStyle */ - private $symfonyStyle; + private SymfonyStyle $symfonyStyle; /** * @readonly - * @var \Rector\Util\MemoryLimiter */ - private $memoryLimiter; + private MemoryLimiter $memoryLimiter; /** * @readonly - * @var \Rector\Configuration\ConfigurationFactory */ - private $configurationFactory; + private ConfigurationFactory $configurationFactory; /** * @readonly - * @var \Rector\Reporting\DeprecatedRulesReporter */ - private $deprecatedRulesReporter; + private DeprecatedRulesReporter $deprecatedRulesReporter; /** * @readonly - * @var \Rector\Reporting\MissConfigurationReporter */ - private $missConfigurationReporter; + private MissConfigurationReporter $missConfigurationReporter; public function __construct(AdditionalAutoloader $additionalAutoloader, ChangedFilesDetector $changedFilesDetector, ConfigInitializer $configInitializer, ApplicationFileProcessor $applicationFileProcessor, DynamicSourceLocatorDecorator $dynamicSourceLocatorDecorator, OutputFormatterCollector $outputFormatterCollector, SymfonyStyle $symfonyStyle, MemoryLimiter $memoryLimiter, ConfigurationFactory $configurationFactory, DeprecatedRulesReporter $deprecatedRulesReporter, MissConfigurationReporter $missConfigurationReporter) { $this->additionalAutoloader = $additionalAutoloader; diff --git a/src/Console/Command/SetupCICommand.php b/src/Console/Command/SetupCICommand.php index 4ee94f03539..34605c212d2 100644 --- a/src/Console/Command/SetupCICommand.php +++ b/src/Console/Command/SetupCICommand.php @@ -15,9 +15,8 @@ final class SetupCICommand extends Command { /** * @readonly - * @var \Symfony\Component\Console\Style\SymfonyStyle */ - private $symfonyStyle; + private SymfonyStyle $symfonyStyle; public function __construct(SymfonyStyle $symfonyStyle) { $this->symfonyStyle = $symfonyStyle; diff --git a/src/Console/Command/WorkerCommand.php b/src/Console/Command/WorkerCommand.php index e519897594e..3a2941910c3 100644 --- a/src/Console/Command/WorkerCommand.php +++ b/src/Console/Command/WorkerCommand.php @@ -35,24 +35,20 @@ final class WorkerCommand extends Command { /** * @readonly - * @var \Rector\StaticReflection\DynamicSourceLocatorDecorator */ - private $dynamicSourceLocatorDecorator; + private DynamicSourceLocatorDecorator $dynamicSourceLocatorDecorator; /** * @readonly - * @var \Rector\Application\ApplicationFileProcessor */ - private $applicationFileProcessor; + private ApplicationFileProcessor $applicationFileProcessor; /** * @readonly - * @var \Rector\Util\MemoryLimiter */ - private $memoryLimiter; + private MemoryLimiter $memoryLimiter; /** * @readonly - * @var \Rector\Configuration\ConfigurationFactory */ - private $configurationFactory; + private ConfigurationFactory $configurationFactory; /** * @var string */ diff --git a/src/Console/Formatter/ColorConsoleDiffFormatter.php b/src/Console/Formatter/ColorConsoleDiffFormatter.php index 7ce6611f151..7904a4d26ca 100644 --- a/src/Console/Formatter/ColorConsoleDiffFormatter.php +++ b/src/Console/Formatter/ColorConsoleDiffFormatter.php @@ -31,9 +31,8 @@ final class ColorConsoleDiffFormatter private const AT_START_REGEX = '#^(@.*)#'; /** * @readonly - * @var string */ - private $template; + private string $template; public function __construct() { $this->template = \sprintf(' ---------- begin diff ----------%s%%s%s ----------- end diff -----------' . \PHP_EOL, \PHP_EOL, \PHP_EOL); diff --git a/src/Console/Formatter/ConsoleDiffer.php b/src/Console/Formatter/ConsoleDiffer.php index 51bcfabc6c7..5b009a1d2c2 100644 --- a/src/Console/Formatter/ConsoleDiffer.php +++ b/src/Console/Formatter/ConsoleDiffer.php @@ -9,14 +9,12 @@ final class ConsoleDiffer { /** * @readonly - * @var \Rector\Console\Formatter\ColorConsoleDiffFormatter */ - private $colorConsoleDiffFormatter; + private \Rector\Console\Formatter\ColorConsoleDiffFormatter $colorConsoleDiffFormatter; /** * @readonly - * @var \SebastianBergmann\Diff\Differ */ - private $differ; + private Differ $differ; public function __construct(\Rector\Console\Formatter\ColorConsoleDiffFormatter $colorConsoleDiffFormatter) { $this->colorConsoleDiffFormatter = $colorConsoleDiffFormatter; diff --git a/src/Console/Output/OutputFormatterCollector.php b/src/Console/Output/OutputFormatterCollector.php index 9480d99fbc3..1e8263bab2c 100644 --- a/src/Console/Output/OutputFormatterCollector.php +++ b/src/Console/Output/OutputFormatterCollector.php @@ -10,7 +10,7 @@ final class OutputFormatterCollector /** * @var array */ - private $outputFormatters = []; + private array $outputFormatters = []; /** * @param OutputFormatterInterface[] $outputFormatters */ diff --git a/src/Console/Style/RectorStyle.php b/src/Console/Style/RectorStyle.php index ab6cd558021..e7c83c1b140 100644 --- a/src/Console/Style/RectorStyle.php +++ b/src/Console/Style/RectorStyle.php @@ -11,10 +11,7 @@ use RectorPrefix202411\Symfony\Component\Console\Output\OutputInterface; use RectorPrefix202411\Symfony\Component\Console\Style\SymfonyStyle; final class RectorStyle extends SymfonyStyle { - /** - * @var \Symfony\Component\Console\Helper\ProgressBar|null - */ - private $progressBar; + private ?ProgressBar $progressBar = null; /** * @var bool|null */ diff --git a/src/Console/Style/SymfonyStyleFactory.php b/src/Console/Style/SymfonyStyleFactory.php index 057ca57f098..f0db395d1e8 100644 --- a/src/Console/Style/SymfonyStyleFactory.php +++ b/src/Console/Style/SymfonyStyleFactory.php @@ -12,9 +12,8 @@ final class SymfonyStyleFactory { /** * @readonly - * @var \Rector\Util\Reflection\PrivatesAccessor */ - private $privatesAccessor; + private PrivatesAccessor $privatesAccessor; public function __construct(PrivatesAccessor $privatesAccessor) { $this->privatesAccessor = $privatesAccessor; diff --git a/src/CustomRules/SimpleNodeDumper.php b/src/CustomRules/SimpleNodeDumper.php index b281b23d212..ccc7192e073 100644 --- a/src/CustomRules/SimpleNodeDumper.php +++ b/src/CustomRules/SimpleNodeDumper.php @@ -3,16 +3,16 @@ declare (strict_types=1); namespace Rector\CustomRules; +use PhpParser\Modifiers; +use PhpParser\Node\UseItem; use PhpParser\Node; use PhpParser\Node\Expr\Include_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Scalar; -use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\GroupUse; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; /** * Inspired by @see \PhpParser\NodeDumper */ @@ -31,7 +31,7 @@ final class SimpleNodeDumper return self::dumpSingleNode($node); } if (self::isStringList($node)) { - return \json_encode($node, 0); + return \json_encode($node, \JSON_THROW_ON_ERROR); } $result = '['; foreach ($node as $key => $value) { @@ -75,25 +75,25 @@ final class SimpleNodeDumper private static function dumpFlags($flags) : string { $strs = []; - if (($flags & Class_::MODIFIER_PUBLIC) !== 0) { + if (($flags & Modifiers::PUBLIC) !== 0) { $strs[] = 'MODIFIER_PUBLIC'; } - if (($flags & Class_::MODIFIER_PROTECTED) !== 0) { + if (($flags & Modifiers::PROTECTED) !== 0) { $strs[] = 'MODIFIER_PROTECTED'; } - if (($flags & Class_::MODIFIER_PRIVATE) !== 0) { + if (($flags & Modifiers::PRIVATE) !== 0) { $strs[] = 'MODIFIER_PRIVATE'; } - if (($flags & Class_::MODIFIER_ABSTRACT) !== 0) { + if (($flags & Modifiers::ABSTRACT) !== 0) { $strs[] = 'MODIFIER_ABSTRACT'; } - if (($flags & Class_::MODIFIER_STATIC) !== 0) { + if (($flags & Modifiers::STATIC) !== 0) { $strs[] = 'MODIFIER_STATIC'; } - if (($flags & Class_::MODIFIER_FINAL) !== 0) { + if (($flags & Modifiers::FINAL) !== 0) { $strs[] = 'MODIFIER_FINAL'; } - if (($flags & Class_::MODIFIER_READONLY) !== 0) { + if (($flags & Modifiers::READONLY) !== 0) { $strs[] = 'MODIFIER_READONLY'; } if ($strs !== []) { @@ -132,7 +132,7 @@ final class SimpleNodeDumper } elseif ($node instanceof Identifier) { $result .= '( name: "' . $node->name . '" )'; } elseif ($node instanceof Name) { - $result .= '( parts: ' . \json_encode($node->getParts(), 0) . ' )'; + $result .= '( parts: ' . \json_encode($node->getParts(), \JSON_THROW_ON_ERROR) . ' )'; } elseif ($node instanceof Scalar && $node->getSubNodeNames() === ['value']) { if (\is_string($node->value)) { $result .= '( value: "' . $node->value . '" )'; @@ -155,7 +155,7 @@ final class SimpleNodeDumper $result .= self::dumpFlags($value); } elseif ($key === 'type' && $node instanceof Include_) { $result .= self::dumpIncludeType($value); - } elseif ($key === 'type' && ($node instanceof Use_ || $node instanceof UseUse || $node instanceof GroupUse)) { + } elseif ($key === 'type' && ($node instanceof Use_ || $node instanceof UseItem || $node instanceof GroupUse)) { $result .= self::dumpUseType($value); } elseif (\is_string($value)) { $result .= '"' . $value . '"'; diff --git a/src/DependencyInjection/LazyContainerFactory.php b/src/DependencyInjection/LazyContainerFactory.php index ddb146ca185..6d1d8dc588c 100644 --- a/src/DependencyInjection/LazyContainerFactory.php +++ b/src/DependencyInjection/LazyContainerFactory.php @@ -13,6 +13,7 @@ use PHPStan\Parser\Parser; use PHPStan\PhpDoc\TypeNodeResolver; use PHPStan\PhpDocParser\Parser\ConstExprParser; use PHPStan\PhpDocParser\Parser\TypeParser; +use PHPStan\PhpDocParser\ParserConfig; use PHPStan\Reflection\ReflectionProvider; use Rector\Application\ChangedNodeScopeRefresher; use Rector\Application\FileProcessor; @@ -93,6 +94,7 @@ use Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor\ByRefVariableNodeVisitor; use Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor\ContextNodeVisitor; use Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor\GlobalVariableNodeVisitor; use Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor\NameNodeVisitor; +use Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor\ReprintNodeVisitor; use Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor\StaticVariableNodeVisitor; use Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor\StmtKeyNodeVisitor; use Rector\NodeTypeResolver\PHPStan\Scope\PHPStanNodeScopeResolver; @@ -128,6 +130,7 @@ use Rector\PHPStanStaticTypeMapper\TypeMapper\ClassStringTypeMapper; use Rector\PHPStanStaticTypeMapper\TypeMapper\ClosureTypeMapper; use Rector\PHPStanStaticTypeMapper\TypeMapper\ConditionalTypeForParameterMapper; use Rector\PHPStanStaticTypeMapper\TypeMapper\ConditionalTypeMapper; +use Rector\PHPStanStaticTypeMapper\TypeMapper\ConstantArrayTypeMapper; use Rector\PHPStanStaticTypeMapper\TypeMapper\FloatTypeMapper; use Rector\PHPStanStaticTypeMapper\TypeMapper\GenericClassStringTypeMapper; use Rector\PHPStanStaticTypeMapper\TypeMapper\HasMethodTypeMapper; @@ -194,7 +197,7 @@ final class LazyContainerFactory /** * @var array> */ - private const SCOPE_RESOLVER_NODE_VISITOR_CLASSES = [ArgNodeVisitor::class, AssignedToNodeVisitor::class, ByRefReturnNodeVisitor::class, ByRefVariableNodeVisitor::class, ContextNodeVisitor::class, GlobalVariableNodeVisitor::class, NameNodeVisitor::class, StaticVariableNodeVisitor::class, StmtKeyNodeVisitor::class]; + private const SCOPE_RESOLVER_NODE_VISITOR_CLASSES = [ArgNodeVisitor::class, AssignedToNodeVisitor::class, ByRefReturnNodeVisitor::class, ByRefVariableNodeVisitor::class, ContextNodeVisitor::class, GlobalVariableNodeVisitor::class, NameNodeVisitor::class, StaticVariableNodeVisitor::class, StmtKeyNodeVisitor::class, ReprintNodeVisitor::class]; /** * @var array> */ @@ -206,7 +209,7 @@ final class LazyContainerFactory /** * @var array> */ - private const TYPE_MAPPER_CLASSES = [AccessoryLiteralStringTypeMapper::class, AccessoryNonEmptyStringTypeMapper::class, AccessoryNonFalsyStringTypeMapper::class, AccessoryNumericStringTypeMapper::class, ArrayTypeMapper::class, BooleanTypeMapper::class, CallableTypeMapper::class, ClassStringTypeMapper::class, ClosureTypeMapper::class, ConditionalTypeForParameterMapper::class, ConditionalTypeMapper::class, FloatTypeMapper::class, GenericClassStringTypeMapper::class, HasMethodTypeMapper::class, HasOffsetTypeMapper::class, HasOffsetValueTypeTypeMapper::class, HasPropertyTypeMapper::class, IntegerTypeMapper::class, IntersectionTypeMapper::class, IterableTypeMapper::class, MixedTypeMapper::class, NeverTypeMapper::class, NonEmptyArrayTypeMapper::class, NullTypeMapper::class, ObjectTypeMapper::class, ObjectWithoutClassTypeMapper::class, OversizedArrayTypeMapper::class, ParentStaticTypeMapper::class, ResourceTypeMapper::class, SelfObjectTypeMapper::class, StaticTypeMapper::class, StrictMixedTypeMapper::class, StringTypeMapper::class, ThisTypeMapper::class, TypeWithClassNameTypeMapper::class, UnionTypeMapper::class, VoidTypeMapper::class]; + private const TYPE_MAPPER_CLASSES = [AccessoryLiteralStringTypeMapper::class, AccessoryNonEmptyStringTypeMapper::class, AccessoryNonFalsyStringTypeMapper::class, AccessoryNumericStringTypeMapper::class, ConstantArrayTypeMapper::class, ArrayTypeMapper::class, BooleanTypeMapper::class, CallableTypeMapper::class, ClassStringTypeMapper::class, ClosureTypeMapper::class, ConditionalTypeForParameterMapper::class, ConditionalTypeMapper::class, FloatTypeMapper::class, GenericClassStringTypeMapper::class, HasMethodTypeMapper::class, HasOffsetTypeMapper::class, HasOffsetValueTypeTypeMapper::class, HasPropertyTypeMapper::class, IntegerTypeMapper::class, IntersectionTypeMapper::class, IterableTypeMapper::class, MixedTypeMapper::class, NeverTypeMapper::class, NonEmptyArrayTypeMapper::class, NullTypeMapper::class, ObjectTypeMapper::class, ObjectWithoutClassTypeMapper::class, OversizedArrayTypeMapper::class, ParentStaticTypeMapper::class, ResourceTypeMapper::class, SelfObjectTypeMapper::class, StaticTypeMapper::class, StrictMixedTypeMapper::class, StringTypeMapper::class, ThisTypeMapper::class, TypeWithClassNameTypeMapper::class, UnionTypeMapper::class, VoidTypeMapper::class]; /** * @var array> */ @@ -350,6 +353,7 @@ final class LazyContainerFactory $this->registerTagged($rectorConfig, self::SCOPE_RESOLVER_NODE_VISITOR_CLASSES, ScopeResolverNodeVisitorInterface::class); $this->createPHPStanServices($rectorConfig); $rectorConfig->when(PhpDocNodeMapper::class)->needs('$phpDocNodeVisitors')->giveTagged(BasePhpDocNodeVisitorInterface::class); + $rectorConfig->singleton(ParserConfig::class, static fn(Container $container): ParserConfig => new ParserConfig(['lines' => \true, 'indexes' => \true])); return $rectorConfig; } /** diff --git a/src/Differ/DefaultDiffer.php b/src/Differ/DefaultDiffer.php index d5e7e9d53f0..e97806ec716 100644 --- a/src/Differ/DefaultDiffer.php +++ b/src/Differ/DefaultDiffer.php @@ -9,9 +9,8 @@ final class DefaultDiffer { /** * @readonly - * @var \SebastianBergmann\Diff\Differ */ - private $differ; + private Differ $differ; public function __construct() { $strictUnifiedDiffOutputBuilder = new StrictUnifiedDiffOutputBuilder(['fromFile' => 'Original', 'toFile' => 'New']); diff --git a/src/FamilyTree/Reflection/FamilyRelationsAnalyzer.php b/src/FamilyTree/Reflection/FamilyRelationsAnalyzer.php index 9915012f6ac..b95a8e3cf9a 100644 --- a/src/FamilyTree/Reflection/FamilyRelationsAnalyzer.php +++ b/src/FamilyTree/Reflection/FamilyRelationsAnalyzer.php @@ -13,14 +13,12 @@ final class FamilyRelationsAnalyzer { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(ReflectionProvider $reflectionProvider, NodeNameResolver $nodeNameResolver) { $this->reflectionProvider = $reflectionProvider; @@ -41,9 +39,7 @@ final class FamilyRelationsAnalyzer } $classReflection = $this->reflectionProvider->getClass($fullName); $ancestors = \array_merge($classReflection->getParents(), $classReflection->getInterfaces()); - return \array_map(static function (ClassReflection $classReflection) : string { - return $classReflection->getName(); - }, $ancestors); + return \array_map(static fn(ClassReflection $classReflection): string => $classReflection->getName(), $ancestors); } if ($classOrName instanceof Interface_) { foreach ($classOrName->extends as $extendInterfaceName) { diff --git a/src/FileSystem/FileAndDirectoryFilter.php b/src/FileSystem/FileAndDirectoryFilter.php index 10f0bedfd75..a7c017ea74b 100644 --- a/src/FileSystem/FileAndDirectoryFilter.php +++ b/src/FileSystem/FileAndDirectoryFilter.php @@ -14,9 +14,7 @@ final class FileAndDirectoryFilter */ public function filterDirectories(array $filesAndDirectories) : array { - $directories = \array_filter($filesAndDirectories, static function (string $path) : bool { - return \is_dir($path) && \realpath($path) !== \false; - }); + $directories = \array_filter($filesAndDirectories, static fn(string $path): bool => \is_dir($path) && \realpath($path) !== \false); return \array_values($directories); } /** @@ -25,9 +23,7 @@ final class FileAndDirectoryFilter */ public function filterFiles(array $filesAndDirectories) : array { - $files = \array_filter($filesAndDirectories, static function (string $path) : bool { - return \is_file($path) && \realpath($path) !== \false; - }); + $files = \array_filter($filesAndDirectories, static fn(string $path): bool => \is_file($path) && \realpath($path) !== \false); return \array_values($files); } } diff --git a/src/FileSystem/FilePathHelper.php b/src/FileSystem/FilePathHelper.php index 1a91e30e676..4f63ef91c47 100644 --- a/src/FileSystem/FilePathHelper.php +++ b/src/FileSystem/FilePathHelper.php @@ -14,9 +14,8 @@ final class FilePathHelper { /** * @readonly - * @var \Symfony\Component\Filesystem\Filesystem */ - private $filesystem; + private Filesystem $filesystem; /** * @see https://regex101.com/r/d4F5Fm/1 * @var string diff --git a/src/FileSystem/FilesFinder.php b/src/FileSystem/FilesFinder.php index ba9476b1e2e..5ba3125e72e 100644 --- a/src/FileSystem/FilesFinder.php +++ b/src/FileSystem/FilesFinder.php @@ -18,34 +18,28 @@ final class FilesFinder { /** * @readonly - * @var \Rector\FileSystem\FilesystemTweaker */ - private $filesystemTweaker; + private \Rector\FileSystem\FilesystemTweaker $filesystemTweaker; /** * @readonly - * @var \Rector\Caching\UnchangedFilesFilter */ - private $unchangedFilesFilter; + private UnchangedFilesFilter $unchangedFilesFilter; /** * @readonly - * @var \Rector\FileSystem\FileAndDirectoryFilter */ - private $fileAndDirectoryFilter; + private \Rector\FileSystem\FileAndDirectoryFilter $fileAndDirectoryFilter; /** * @readonly - * @var \Rector\Skipper\Skipper\PathSkipper */ - private $pathSkipper; + private PathSkipper $pathSkipper; /** * @readonly - * @var \Rector\FileSystem\FilePathHelper */ - private $filePathHelper; + private \Rector\FileSystem\FilePathHelper $filePathHelper; /** * @readonly - * @var \Rector\Caching\Detector\ChangedFilesDetector */ - private $changedFilesDetector; + private ChangedFilesDetector $changedFilesDetector; public function __construct(\Rector\FileSystem\FilesystemTweaker $filesystemTweaker, UnchangedFilesFilter $unchangedFilesFilter, \Rector\FileSystem\FileAndDirectoryFilter $fileAndDirectoryFilter, PathSkipper $pathSkipper, \Rector\FileSystem\FilePathHelper $filePathHelper, ChangedFilesDetector $changedFilesDetector) { $this->filesystemTweaker = $filesystemTweaker; @@ -65,12 +59,8 @@ final class FilesFinder $filesAndDirectories = $this->filesystemTweaker->resolveWithFnmatch($source); // filtering files in files collection $filteredFilePaths = $this->fileAndDirectoryFilter->filterFiles($filesAndDirectories); - $filteredFilePaths = \array_map(function (string $filePath) : string { - return \realpath($filePath); - }, $filteredFilePaths); - $filteredFilePaths = \array_filter($filteredFilePaths, function (string $filePath) : bool { - return !$this->pathSkipper->shouldSkip($filePath); - }); + $filteredFilePaths = \array_map(fn(string $filePath): string => \realpath($filePath), $filteredFilePaths); + $filteredFilePaths = \array_filter($filteredFilePaths, fn(string $filePath): bool => !$this->pathSkipper->shouldSkip($filePath)); if ($suffixes !== []) { $fileWithExtensionsFilter = static function (string $filePath) use($suffixes) : bool { $filePathExtension = \pathinfo($filePath, \PATHINFO_EXTENSION); diff --git a/src/FileSystem/FilesystemTweaker.php b/src/FileSystem/FilesystemTweaker.php index 2c02929e732..d351599c44e 100644 --- a/src/FileSystem/FilesystemTweaker.php +++ b/src/FileSystem/FilesystemTweaker.php @@ -32,8 +32,6 @@ final class FilesystemTweaker { /** @var string[] $paths */ $paths = (array) \glob($path); - return \array_filter($paths, static function (string $path) : bool { - return \file_exists($path); - }); + return \array_filter($paths, static fn(string $path): bool => \file_exists($path)); } } diff --git a/src/NodeAnalyzer/BinaryOpAnalyzer.php b/src/NodeAnalyzer/BinaryOpAnalyzer.php index 38fba21732c..cdf2d6e987a 100644 --- a/src/NodeAnalyzer/BinaryOpAnalyzer.php +++ b/src/NodeAnalyzer/BinaryOpAnalyzer.php @@ -11,9 +11,8 @@ final class BinaryOpAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/src/NodeAnalyzer/CallAnalyzer.php b/src/NodeAnalyzer/CallAnalyzer.php index 9c4f3a393cd..953d8c7d1e1 100644 --- a/src/NodeAnalyzer/CallAnalyzer.php +++ b/src/NodeAnalyzer/CallAnalyzer.php @@ -19,9 +19,8 @@ final class CallAnalyzer { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @var array> */ diff --git a/src/NodeAnalyzer/CompactFuncCallAnalyzer.php b/src/NodeAnalyzer/CompactFuncCallAnalyzer.php index e689ffae866..37d2cfaa901 100644 --- a/src/NodeAnalyzer/CompactFuncCallAnalyzer.php +++ b/src/NodeAnalyzer/CompactFuncCallAnalyzer.php @@ -5,7 +5,7 @@ namespace Rector\NodeAnalyzer; use PhpParser\Node\Arg; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Scalar\String_; @@ -15,9 +15,8 @@ final class CompactFuncCallAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; @@ -58,7 +57,7 @@ final class CompactFuncCallAnalyzer return \false; } /** - * @param \PhpParser\Node\Arg|\PhpParser\Node\VariadicPlaceholder|\PhpParser\Node\Expr\ArrayItem|null $node + * @param \PhpParser\Node\Arg|\PhpParser\Node\VariadicPlaceholder|\PhpParser\Node\ArrayItem|null $node */ private function shouldSkip($node) : bool { diff --git a/src/NodeAnalyzer/DoctrineEntityAnalyzer.php b/src/NodeAnalyzer/DoctrineEntityAnalyzer.php index ac2505626e0..f794b9cb8ff 100644 --- a/src/NodeAnalyzer/DoctrineEntityAnalyzer.php +++ b/src/NodeAnalyzer/DoctrineEntityAnalyzer.php @@ -15,9 +15,8 @@ final class DoctrineEntityAnalyzer { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var string[] */ diff --git a/src/NodeAnalyzer/ExprAnalyzer.php b/src/NodeAnalyzer/ExprAnalyzer.php index fc50a39658d..5bcecc0b34a 100644 --- a/src/NodeAnalyzer/ExprAnalyzer.php +++ b/src/NodeAnalyzer/ExprAnalyzer.php @@ -3,9 +3,11 @@ declare (strict_types=1); namespace Rector\NodeAnalyzer; +use PhpParser\Node\Scalar\InterpolatedString; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\UnaryMinus; @@ -14,8 +16,6 @@ use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Scalar; -use PhpParser\Node\Scalar\Encapsed; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use PHPStan\Analyser\Scope; use PHPStan\Type\MixedType; @@ -59,7 +59,7 @@ final class ExprAnalyzer } if ($expr instanceof Scalar) { // string interpolation is true, otherwise false - return $expr instanceof Encapsed; + return $expr instanceof InterpolatedString; } return !$this->isAllowedConstFetchOrClassConstFetch($expr); } @@ -103,7 +103,7 @@ final class ExprAnalyzer if ($expr instanceof String_) { return \true; } - return $expr instanceof LNumber; + return $expr instanceof Int_; } private function isAllowedArrayValue(Expr $expr) : bool { diff --git a/src/NodeAnalyzer/MagicClassMethodAnalyzer.php b/src/NodeAnalyzer/MagicClassMethodAnalyzer.php index d992c85d186..27a936f0013 100644 --- a/src/NodeAnalyzer/MagicClassMethodAnalyzer.php +++ b/src/NodeAnalyzer/MagicClassMethodAnalyzer.php @@ -10,9 +10,8 @@ final class MagicClassMethodAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/src/NodeAnalyzer/ParamAnalyzer.php b/src/NodeAnalyzer/ParamAnalyzer.php index 40305c5af02..0156c9807e3 100644 --- a/src/NodeAnalyzer/ParamAnalyzer.php +++ b/src/NodeAnalyzer/ParamAnalyzer.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\NodeAnalyzer; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\CallLike; @@ -16,7 +17,6 @@ use PhpParser\Node\Param; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; -use PhpParser\NodeTraverser; use Rector\NodeManipulator\FuncCallManipulator; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; @@ -26,29 +26,24 @@ final class ParamAnalyzer { /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeManipulator\FuncCallManipulator */ - private $funcCallManipulator; + private FuncCallManipulator $funcCallManipulator; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(NodeComparator $nodeComparator, NodeNameResolver $nodeNameResolver, FuncCallManipulator $funcCallManipulator, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, BetterNodeFinder $betterNodeFinder) { $this->nodeComparator = $nodeComparator; @@ -65,14 +60,14 @@ final class ParamAnalyzer } $this->simpleCallableNodeTraverser->traverseNodesWithCallable($classMethod->stmts, function (Node $node) use(&$isParamUsed, $param) : ?int { if ($isParamUsed) { - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } if ($this->isUsedAsArg($node, $param)) { $isParamUsed = \true; } // skip nested anonymous class if ($node instanceof Class_ || $node instanceof Function_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($node instanceof Variable && $this->nodeComparator->areNodesEqual($node, $param->var)) { $isParamUsed = \true; @@ -104,7 +99,7 @@ final class ParamAnalyzer if ($param->variadic) { return \false; } - if ($param->type === null) { + if (!$param->type instanceof Node) { return \false; } return $param->type instanceof NullableType; diff --git a/src/NodeAnalyzer/PropertyAnalyzer.php b/src/NodeAnalyzer/PropertyAnalyzer.php index ea1210ca30c..8ed70da7316 100644 --- a/src/NodeAnalyzer/PropertyAnalyzer.php +++ b/src/NodeAnalyzer/PropertyAnalyzer.php @@ -13,9 +13,8 @@ final class PropertyAnalyzer { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeTypeResolver $nodeTypeResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/src/NodeAnalyzer/PropertyFetchAnalyzer.php b/src/NodeAnalyzer/PropertyFetchAnalyzer.php index 8678cf3221d..f81335aee55 100644 --- a/src/NodeAnalyzer/PropertyFetchAnalyzer.php +++ b/src/NodeAnalyzer/PropertyFetchAnalyzer.php @@ -31,29 +31,24 @@ final class PropertyFetchAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @var string */ @@ -99,9 +94,7 @@ final class PropertyFetchAnalyzer if ($trait->getProperty($propertyName) instanceof Property) { return \true; } - return (bool) $this->betterNodeFinder->findFirst($trait, function (Node $node) use($propertyName) : bool { - return $this->isLocalPropertyFetchName($node, $propertyName); - }); + return (bool) $this->betterNodeFinder->findFirst($trait, fn(Node $node): bool => $this->isLocalPropertyFetchName($node, $propertyName)); } /** * @phpstan-assert-if-true PropertyFetch|StaticPropertyFetch $node diff --git a/src/NodeAnalyzer/PropertyPresenceChecker.php b/src/NodeAnalyzer/PropertyPresenceChecker.php index 059b2106c54..22810e22e0e 100644 --- a/src/NodeAnalyzer/PropertyPresenceChecker.php +++ b/src/NodeAnalyzer/PropertyPresenceChecker.php @@ -22,24 +22,20 @@ final class PropertyPresenceChecker { /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PromotedPropertyResolver */ - private $promotedPropertyResolver; + private PromotedPropertyResolver $promotedPropertyResolver; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; public function __construct(PromotedPropertyResolver $promotedPropertyResolver, NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider, AstResolver $astResolver) { $this->promotedPropertyResolver = $promotedPropertyResolver; diff --git a/src/NodeAnalyzer/TerminatedNodeAnalyzer.php b/src/NodeAnalyzer/TerminatedNodeAnalyzer.php index 61d2e43e750..62aae997efb 100644 --- a/src/NodeAnalyzer/TerminatedNodeAnalyzer.php +++ b/src/NodeAnalyzer/TerminatedNodeAnalyzer.php @@ -6,6 +6,7 @@ namespace Rector\NodeAnalyzer; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Exit_; +use PhpParser\Node\Expr\Throw_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Break_; use PhpParser\Node\Stmt\ClassLike; @@ -22,7 +23,6 @@ use PhpParser\Node\Stmt\Namespace_; use PhpParser\Node\Stmt\Nop; use PhpParser\Node\Stmt\Return_; use PhpParser\Node\Stmt\Switch_; -use PhpParser\Node\Stmt\Throw_; use PhpParser\Node\Stmt\TryCatch; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace; @@ -31,11 +31,7 @@ final class TerminatedNodeAnalyzer /** * @var array> */ - private const TERMINATED_NODES = [Return_::class, Throw_::class]; - /** - * @var array> - */ - private const TERMINABLE_NODES = [Throw_::class, Return_::class, Break_::class, Continue_::class]; + private const TERMINABLE_NODES = [Return_::class, Break_::class, Continue_::class]; /** * @var array> */ @@ -69,7 +65,7 @@ final class TerminatedNodeAnalyzer if (\in_array(\get_class($previousNode), self::TERMINABLE_NODES, \true)) { return \true; } - if ($previousNode instanceof Expression && $previousNode->expr instanceof Exit_) { + if ($previousNode instanceof Expression && ($previousNode->expr instanceof Exit_ || $previousNode->expr instanceof Throw_)) { return \true; } if ($previousNode instanceof Goto_) { @@ -135,16 +131,14 @@ final class TerminatedNodeAnalyzer if ($stmts === []) { return \false; } - \end($stmts); - $lastKey = \key($stmts); - \reset($stmts); + $lastKey = \array_key_last($stmts); $lastNode = $stmts[$lastKey]; if (isset($stmts[$lastKey - 1]) && $this->isTerminatedNode($stmts[$lastKey - 1], $node)) { return \false; } if ($lastNode instanceof Expression) { - return $lastNode->expr instanceof Exit_; + return $lastNode->expr instanceof Exit_ || $lastNode->expr instanceof Throw_; } - return \in_array(\get_class($lastNode), self::TERMINATED_NODES, \true); + return $lastNode instanceof Return_; } } diff --git a/src/NodeAnalyzer/VariadicAnalyzer.php b/src/NodeAnalyzer/VariadicAnalyzer.php index 43eaaf8b9f5..cc23a468e82 100644 --- a/src/NodeAnalyzer/VariadicAnalyzer.php +++ b/src/NodeAnalyzer/VariadicAnalyzer.php @@ -13,9 +13,8 @@ final class VariadicAnalyzer { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ReflectionResolver $reflectionResolver) { $this->reflectionResolver = $reflectionResolver; @@ -36,9 +35,9 @@ final class VariadicAnalyzer */ private function hasVariadicVariant($functionLikeReflection) : bool { - foreach ($functionLikeReflection->getVariants() as $parametersAcceptor) { + foreach ($functionLikeReflection->getVariants() as $variant) { // can be any number of arguments → nothing to limit here - if ($parametersAcceptor->isVariadic()) { + if ($variant->isVariadic()) { return \true; } } diff --git a/src/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php b/src/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php index 385e8509e6b..3bd982f85d7 100644 --- a/src/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php +++ b/src/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php @@ -5,7 +5,7 @@ namespace Rector\NodeCollector\NodeAnalyzer; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Scalar\MagicConst\Class_; use PhpParser\Node\Scalar\String_; @@ -30,24 +30,20 @@ final class ArrayCallableMethodMatcher { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(NodeTypeResolver $nodeTypeResolver, ValueResolver $valueResolver, ReflectionProvider $reflectionProvider, ReflectionResolver $reflectionResolver) { $this->nodeTypeResolver = $nodeTypeResolver; @@ -165,8 +161,8 @@ final class ArrayCallableMethodMatcher return new ObjectType($classConstantReference, null, $classReflection); } $extendedMethodReflection = $classReflection->getMethod(MethodName::CONSTRUCT, $scope); - $parametersAcceptorWithPhpDocs = ParametersAcceptorSelector::combineAcceptors($extendedMethodReflection->getVariants()); - foreach ($parametersAcceptorWithPhpDocs->getParameters() as $parameterReflectionWithPhpDoc) { + $extendedParametersAcceptor = ParametersAcceptorSelector::combineAcceptors($extendedMethodReflection->getVariants()); + foreach ($extendedParametersAcceptor->getParameters() as $parameterReflectionWithPhpDoc) { if (!$parameterReflectionWithPhpDoc->getDefaultValue() instanceof Type) { return new MixedType(); } diff --git a/src/NodeCollector/ValueObject/ArrayCallable.php b/src/NodeCollector/ValueObject/ArrayCallable.php index 6e3e9cd0868..1a33f3935c1 100644 --- a/src/NodeCollector/ValueObject/ArrayCallable.php +++ b/src/NodeCollector/ValueObject/ArrayCallable.php @@ -9,19 +9,16 @@ final class ArrayCallable { /** * @readonly - * @var \PhpParser\Node\Expr */ - private $callerExpr; + private Expr $callerExpr; /** * @readonly - * @var string */ - private $class; + private string $class; /** * @readonly - * @var string */ - private $method; + private string $method; public function __construct(Expr $callerExpr, string $class, string $method) { $this->callerExpr = $callerExpr; diff --git a/src/NodeDecorator/CreatedByRuleDecorator.php b/src/NodeDecorator/CreatedByRuleDecorator.php index ef81e00522e..ed7b7e616ee 100644 --- a/src/NodeDecorator/CreatedByRuleDecorator.php +++ b/src/NodeDecorator/CreatedByRuleDecorator.php @@ -45,9 +45,7 @@ final class CreatedByRuleDecorator return; } // filter out when exists, then append - $createdByRule = \array_filter($createdByRule, static function (string $rectorRule) use($rectorClass) : bool { - return $rectorRule !== $rectorClass; - }); + $createdByRule = \array_filter($createdByRule, static fn(string $rectorRule): bool => $rectorRule !== $rectorClass); $node->setAttribute(AttributeKey::CREATED_BY_RULE, \array_merge($createdByRule, [$rectorClass])); } } diff --git a/src/NodeDecorator/PropertyTypeDecorator.php b/src/NodeDecorator/PropertyTypeDecorator.php index f9c67a56912..c97530f69ce 100644 --- a/src/NodeDecorator/PropertyTypeDecorator.php +++ b/src/NodeDecorator/PropertyTypeDecorator.php @@ -17,24 +17,20 @@ final class PropertyTypeDecorator { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, PhpVersionProvider $phpVersionProvider, StaticTypeMapper $staticTypeMapper, PhpDocTypeChanger $phpDocTypeChanger) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/src/NodeManipulator/AssignManipulator.php b/src/NodeManipulator/AssignManipulator.php index 21e6100237a..7e3a6daf200 100644 --- a/src/NodeManipulator/AssignManipulator.php +++ b/src/NodeManipulator/AssignManipulator.php @@ -20,19 +20,16 @@ final class AssignManipulator { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; public function __construct(NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder, PropertyFetchAnalyzer $propertyFetchAnalyzer) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/src/NodeManipulator/BinaryOpManipulator.php b/src/NodeManipulator/BinaryOpManipulator.php index 82729fa803b..a0df4a41381 100644 --- a/src/NodeManipulator/BinaryOpManipulator.php +++ b/src/NodeManipulator/BinaryOpManipulator.php @@ -16,9 +16,8 @@ final class BinaryOpManipulator { /** * @readonly - * @var \Rector\PhpParser\Node\AssignAndBinaryMap */ - private $assignAndBinaryMap; + private AssignAndBinaryMap $assignAndBinaryMap; public function __construct(AssignAndBinaryMap $assignAndBinaryMap) { $this->assignAndBinaryMap = $assignAndBinaryMap; @@ -117,9 +116,7 @@ final class BinaryOpManipulator if (\is_callable($condition)) { return $condition; } - return static function (Node $node) use($condition) : bool { - return $node instanceof $condition; - }; + return static fn(Node $node): bool => $node instanceof $condition; } /** * @return class-string|null diff --git a/src/NodeManipulator/ClassConstManipulator.php b/src/NodeManipulator/ClassConstManipulator.php index 5baebdd9ef7..39ccb4be434 100644 --- a/src/NodeManipulator/ClassConstManipulator.php +++ b/src/NodeManipulator/ClassConstManipulator.php @@ -15,19 +15,16 @@ final class ClassConstManipulator { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; public function __construct(BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver, AstResolver $astResolver) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/src/NodeManipulator/ClassDependencyManipulator.php b/src/NodeManipulator/ClassDependencyManipulator.php index 0aaaa401af8..ba5d23a4652 100644 --- a/src/NodeManipulator/ClassDependencyManipulator.php +++ b/src/NodeManipulator/ClassDependencyManipulator.php @@ -30,49 +30,40 @@ final class ClassDependencyManipulator { /** * @readonly - * @var \Rector\NodeManipulator\ClassInsertManipulator */ - private $classInsertManipulator; + private \Rector\NodeManipulator\ClassInsertManipulator $classInsertManipulator; /** * @readonly - * @var \Rector\NodeManipulator\ClassMethodAssignManipulator */ - private $classMethodAssignManipulator; + private \Rector\NodeManipulator\ClassMethodAssignManipulator $classMethodAssignManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \Rector\NodeManipulator\StmtsManipulator */ - private $stmtsManipulator; + private \Rector\NodeManipulator\StmtsManipulator $stmtsManipulator; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyPresenceChecker */ - private $propertyPresenceChecker; + private PropertyPresenceChecker $propertyPresenceChecker; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\AutowiredClassMethodOrPropertyAnalyzer */ - private $autowiredClassMethodOrPropertyAnalyzer; + private AutowiredClassMethodOrPropertyAnalyzer $autowiredClassMethodOrPropertyAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(\Rector\NodeManipulator\ClassInsertManipulator $classInsertManipulator, \Rector\NodeManipulator\ClassMethodAssignManipulator $classMethodAssignManipulator, NodeFactory $nodeFactory, \Rector\NodeManipulator\StmtsManipulator $stmtsManipulator, PhpVersionProvider $phpVersionProvider, PropertyPresenceChecker $propertyPresenceChecker, NodeNameResolver $nodeNameResolver, AutowiredClassMethodOrPropertyAnalyzer $autowiredClassMethodOrPropertyAnalyzer, ReflectionResolver $reflectionResolver) { $this->classInsertManipulator = $classInsertManipulator; diff --git a/src/NodeManipulator/ClassInsertManipulator.php b/src/NodeManipulator/ClassInsertManipulator.php index c669096d350..45249471e55 100644 --- a/src/NodeManipulator/ClassInsertManipulator.php +++ b/src/NodeManipulator/ClassInsertManipulator.php @@ -14,9 +14,8 @@ final class ClassInsertManipulator { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/src/NodeManipulator/ClassManipulator.php b/src/NodeManipulator/ClassManipulator.php index c3d0be1c144..02836377a86 100644 --- a/src/NodeManipulator/ClassManipulator.php +++ b/src/NodeManipulator/ClassManipulator.php @@ -11,14 +11,12 @@ final class ClassManipulator { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/src/NodeManipulator/ClassMethodAssignManipulator.php b/src/NodeManipulator/ClassMethodAssignManipulator.php index 71095bbc382..99472ff5ac4 100644 --- a/src/NodeManipulator/ClassMethodAssignManipulator.php +++ b/src/NodeManipulator/ClassMethodAssignManipulator.php @@ -13,18 +13,16 @@ final class ClassMethodAssignManipulator { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @var array */ - private $alreadyAddedClassMethodNames = []; + private array $alreadyAddedClassMethodNames = []; public function __construct(NodeFactory $nodeFactory, NodeNameResolver $nodeNameResolver) { $this->nodeFactory = $nodeFactory; diff --git a/src/NodeManipulator/ClassMethodManipulator.php b/src/NodeManipulator/ClassMethodManipulator.php index ed436f864a0..3dcc7452d0e 100644 --- a/src/NodeManipulator/ClassMethodManipulator.php +++ b/src/NodeManipulator/ClassMethodManipulator.php @@ -13,14 +13,12 @@ final class ClassMethodManipulator { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(NodeNameResolver $nodeNameResolver, ReflectionResolver $reflectionResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/src/NodeManipulator/ClassMethodPropertyFetchManipulator.php b/src/NodeManipulator/ClassMethodPropertyFetchManipulator.php index bcb079fd256..2386547c5f3 100644 --- a/src/NodeManipulator/ClassMethodPropertyFetchManipulator.php +++ b/src/NodeManipulator/ClassMethodPropertyFetchManipulator.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\NodeManipulator; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Assign; @@ -13,26 +14,22 @@ use PhpParser\Node\Expr\StaticPropertyFetch; use PhpParser\Node\Param; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; -use PhpParser\NodeTraverser; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; final class ClassMethodPropertyFetchManipulator { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeManipulator\FunctionLikeManipulator */ - private $functionLikeManipulator; + private \Rector\NodeManipulator\FunctionLikeManipulator $functionLikeManipulator; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver, \Rector\NodeManipulator\FunctionLikeManipulator $functionLikeManipulator) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; @@ -53,7 +50,7 @@ final class ClassMethodPropertyFetchManipulator $assignedParamName = null; $this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->stmts, function (Node $node) use($propertyName, &$assignedParamName) : ?int { if ($node instanceof Class_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$node instanceof Assign) { return null; @@ -68,7 +65,7 @@ final class ClassMethodPropertyFetchManipulator return null; } $assignedParamName = $this->nodeNameResolver->getName($node->expr); - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; }); /** @var string|null $assignedParamName */ if ($assignedParamName === null) { @@ -97,7 +94,7 @@ final class ClassMethodPropertyFetchManipulator $paramNames = $this->functionLikeManipulator->resolveParamNames($classMethod); $this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->stmts, function (Node $node) use($propertyName, &$assignExprs, $paramNames) : ?int { if ($node instanceof Class_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$node instanceof Assign) { return null; diff --git a/src/NodeManipulator/FuncCallManipulator.php b/src/NodeManipulator/FuncCallManipulator.php index 75b7e41bafd..23caff11bb3 100644 --- a/src/NodeManipulator/FuncCallManipulator.php +++ b/src/NodeManipulator/FuncCallManipulator.php @@ -10,9 +10,8 @@ final class FuncCallManipulator { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/src/NodeManipulator/FunctionLikeManipulator.php b/src/NodeManipulator/FunctionLikeManipulator.php index 06872e7a747..9e58cdde216 100644 --- a/src/NodeManipulator/FunctionLikeManipulator.php +++ b/src/NodeManipulator/FunctionLikeManipulator.php @@ -9,9 +9,8 @@ final class FunctionLikeManipulator { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/src/NodeManipulator/IfManipulator.php b/src/NodeManipulator/IfManipulator.php index 737044c82b0..4e8eee08bc4 100644 --- a/src/NodeManipulator/IfManipulator.php +++ b/src/NodeManipulator/IfManipulator.php @@ -21,24 +21,20 @@ final class IfManipulator { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeManipulator\StmtsManipulator */ - private $stmtsManipulator; + private \Rector\NodeManipulator\StmtsManipulator $stmtsManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; public function __construct(BetterNodeFinder $betterNodeFinder, \Rector\NodeManipulator\StmtsManipulator $stmtsManipulator, ValueResolver $valueResolver, NodeComparator $nodeComparator) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/src/NodeManipulator/PropertyFetchAssignManipulator.php b/src/NodeManipulator/PropertyFetchAssignManipulator.php index 847206defed..6b26749ce97 100644 --- a/src/NodeManipulator/PropertyFetchAssignManipulator.php +++ b/src/NodeManipulator/PropertyFetchAssignManipulator.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\NodeManipulator; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\AssignOp; @@ -10,7 +11,6 @@ use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Property; -use PhpParser\NodeTraverser; use Rector\NodeAnalyzer\PropertyFetchAnalyzer; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; @@ -19,19 +19,16 @@ final class PropertyFetchAssignManipulator { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver, PropertyFetchAnalyzer $propertyFetchAnalyzer) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; @@ -49,7 +46,7 @@ final class PropertyFetchAssignManipulator $this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->getStmts(), function (Node $node) use($propertyName, &$count) : ?int { // skip anonymous classes and inner function if ($node instanceof Class_ || $node instanceof Function_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$node instanceof Assign && !$node instanceof AssignOp) { return null; @@ -59,7 +56,7 @@ final class PropertyFetchAssignManipulator } ++$count; if ($count === 2) { - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } return null; }); diff --git a/src/NodeManipulator/PropertyManipulator.php b/src/NodeManipulator/PropertyManipulator.php index 819681c14d1..637d8e7a5bd 100644 --- a/src/NodeManipulator/PropertyManipulator.php +++ b/src/NodeManipulator/PropertyManipulator.php @@ -36,59 +36,48 @@ final class PropertyManipulator { /** * @readonly - * @var \Rector\NodeManipulator\AssignManipulator */ - private $assignManipulator; + private \Rector\NodeManipulator\AssignManipulator $assignManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\PhpParser\NodeFinder\PropertyFetchFinder */ - private $propertyFetchFinder; + private PropertyFetchFinder $propertyFetchFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PromotedPropertyResolver */ - private $promotedPropertyResolver; + private PromotedPropertyResolver $promotedPropertyResolver; /** * @readonly - * @var \Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector */ - private $constructorAssignDetector; + private ConstructorAssignDetector $constructorAssignDetector; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; /** * @var string[]|class-string[] */ @@ -179,9 +168,7 @@ final class PropertyManipulator if (!$classMethod instanceof ClassMethod) { return \false; } - $node = $this->betterNodeFinder->findFirst((array) $classMethod->stmts, static function (Node $subNode) use($propertyFetch) : bool { - return ($subNode instanceof PropertyFetch || $subNode instanceof StaticPropertyFetch) && $subNode === $propertyFetch; - }); + $node = $this->betterNodeFinder->findFirst((array) $classMethod->stmts, static fn(Node $subNode): bool => ($subNode instanceof PropertyFetch || $subNode instanceof StaticPropertyFetch) && $subNode === $propertyFetch); // there is property unset in Test class, so only check on __construct if (!$node instanceof Node) { return \false; diff --git a/src/NodeManipulator/StmtsManipulator.php b/src/NodeManipulator/StmtsManipulator.php index 2ec893d4043..93ecc2b5b01 100644 --- a/src/NodeManipulator/StmtsManipulator.php +++ b/src/NodeManipulator/StmtsManipulator.php @@ -4,12 +4,14 @@ declare (strict_types=1); namespace Rector\NodeManipulator; use PhpParser\Node; +use PhpParser\Node\Expr; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\DeadCode\NodeAnalyzer\ExprUsedInNodeAnalyzer; +use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; use Rector\PhpParser\Comparing\NodeComparator; use Rector\PhpParser\Node\BetterNodeFinder; @@ -17,24 +19,20 @@ final class StmtsManipulator { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; /** * @readonly - * @var \Rector\DeadCode\NodeAnalyzer\ExprUsedInNodeAnalyzer */ - private $exprUsedInNodeAnalyzer; + private ExprUsedInNodeAnalyzer $exprUsedInNodeAnalyzer; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, BetterNodeFinder $betterNodeFinder, NodeComparator $nodeComparator, ExprUsedInNodeAnalyzer $exprUsedInNodeAnalyzer) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; @@ -44,14 +42,17 @@ final class StmtsManipulator } /** * @param Stmt[] $stmts + * @return null|\PhpParser\Node\Expr|\PhpParser\Node\Stmt */ - public function getUnwrappedLastStmt(array $stmts) : ?Node + public function getUnwrappedLastStmt(array $stmts) { - \end($stmts); - $lastStmtKey = \key($stmts); - \reset($stmts); + if ($stmts === []) { + return null; + } + $lastStmtKey = \array_key_last($stmts); $lastStmt = $stmts[$lastStmtKey]; if ($lastStmt instanceof Expression) { + $lastStmt->expr->setAttribute(AttributeKey::COMMENTS, $lastStmt->getAttribute(AttributeKey::COMMENTS)); return $lastStmt->expr; } return $lastStmt; @@ -83,8 +84,6 @@ final class StmtsManipulator } $stmts = \array_slice($stmtsAware instanceof StmtsAwareInterface ? $stmtsAware->stmts : $stmtsAware, $jumpToKey, null, \true); $variable = new Variable($variableName); - return (bool) $this->betterNodeFinder->findFirst($stmts, function (Node $subNode) use($variable) : bool { - return $this->exprUsedInNodeAnalyzer->isUsed($subNode, $variable); - }); + return (bool) $this->betterNodeFinder->findFirst($stmts, fn(Node $subNode): bool => $this->exprUsedInNodeAnalyzer->isUsed($subNode, $variable)); } } diff --git a/src/NodeNameResolver/NodeNameResolver.php b/src/NodeNameResolver/NodeNameResolver.php index 39fbbe5c958..75a39b36098 100644 --- a/src/NodeNameResolver/NodeNameResolver.php +++ b/src/NodeNameResolver/NodeNameResolver.php @@ -18,7 +18,7 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Const_; use PhpParser\Node\Stmt\Interface_; use PhpParser\Node\Stmt\Property; -use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\Node\PropertyItem; use PhpParser\Node\Stmt\Trait_; use PHPStan\Analyser\Scope; use Rector\CodingStyle\Naming\ClassNaming; @@ -31,19 +31,17 @@ final class NodeNameResolver { /** * @readonly - * @var \Rector\CodingStyle\Naming\ClassNaming */ - private $classNaming; + private ClassNaming $classNaming; /** * @readonly - * @var \Rector\NodeAnalyzer\CallAnalyzer */ - private $callAnalyzer; + private CallAnalyzer $callAnalyzer; /** * @var NodeNameResolverInterface[] * @readonly */ - private $nodeNameResolvers = []; + private iterable $nodeNameResolvers = []; /** * Used to check if a string might contain a regex or fnmatch pattern */ @@ -51,7 +49,7 @@ final class NodeNameResolver /** * @var array */ - private $nodeNameResolversByClass = []; + private array $nodeNameResolversByClass = []; /** * @param NodeNameResolverInterface[] $nodeNameResolvers */ @@ -98,7 +96,7 @@ final class NodeNameResolver * @return ($node is Param ? string : * ($node is ClassMethod ? string : * ($node is Property ? string : - * ($node is PropertyProperty ? string : + * ($node is PropertyItem ? string : * ($node is Trait_ ? string : * ($node is Interface_ ? string : * ($node is Const_ ? string : diff --git a/src/NodeNameResolver/NodeNameResolver/FuncCallNameResolver.php b/src/NodeNameResolver/NodeNameResolver/FuncCallNameResolver.php index 318acb0b9d8..05b1fd8a661 100644 --- a/src/NodeNameResolver/NodeNameResolver/FuncCallNameResolver.php +++ b/src/NodeNameResolver/NodeNameResolver/FuncCallNameResolver.php @@ -18,9 +18,8 @@ final class FuncCallNameResolver implements NodeNameResolverInterface { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(ReflectionProvider $reflectionProvider) { $this->reflectionProvider = $reflectionProvider; diff --git a/src/NodeNameResolver/NodeNameResolver/FunctionNameResolver.php b/src/NodeNameResolver/NodeNameResolver/FunctionNameResolver.php index 3309fb3292e..4392590116f 100644 --- a/src/NodeNameResolver/NodeNameResolver/FunctionNameResolver.php +++ b/src/NodeNameResolver/NodeNameResolver/FunctionNameResolver.php @@ -19,7 +19,7 @@ final class FunctionNameResolver implements NodeNameResolverInterface /** * @param Function_ $node */ - public function resolve(Node $node, ?Scope $scope) : ?string + public function resolve(Node $node, ?Scope $scope) : string { $bareName = (string) $node->name; if (!$scope instanceof Scope) { diff --git a/src/NodeNameResolver/NodeNameResolver/NameNameResolver.php b/src/NodeNameResolver/NodeNameResolver/NameNameResolver.php index 19aeefa9220..0e636d244f7 100644 --- a/src/NodeNameResolver/NodeNameResolver/NameNameResolver.php +++ b/src/NodeNameResolver/NodeNameResolver/NameNameResolver.php @@ -19,7 +19,7 @@ final class NameNameResolver implements NodeNameResolverInterface /** * @param Name $node */ - public function resolve(Node $node, ?Scope $scope) : ?string + public function resolve(Node $node, ?Scope $scope) : string { return $node->toString(); } diff --git a/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php b/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php index ca551ad0689..7c823000849 100644 --- a/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php +++ b/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php @@ -41,9 +41,8 @@ in your included phpstan configuration. MESSAGE_ERROR; /** * @readonly - * @var \PHPStan\DependencyInjection\Container */ - private $container; + private Container $container; public function __construct() { $containerFactory = new ContainerFactory(\getcwd()); diff --git a/src/NodeTypeResolver/NodeScopeAndMetadataDecorator.php b/src/NodeTypeResolver/NodeScopeAndMetadataDecorator.php index 0c1e3392ae1..8b4b41e4e48 100644 --- a/src/NodeTypeResolver/NodeScopeAndMetadataDecorator.php +++ b/src/NodeTypeResolver/NodeScopeAndMetadataDecorator.php @@ -12,19 +12,16 @@ final class NodeScopeAndMetadataDecorator { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Scope\PHPStanNodeScopeResolver */ - private $phpStanNodeScopeResolver; + private PHPStanNodeScopeResolver $phpStanNodeScopeResolver; /** * @readonly - * @var \Rector\PhpParser\NodeTraverser\FileWithoutNamespaceNodeTraverser */ - private $fileWithoutNamespaceNodeTraverser; + private FileWithoutNamespaceNodeTraverser $fileWithoutNamespaceNodeTraverser; /** * @readonly - * @var \PhpParser\NodeTraverser */ - private $nodeTraverser; + private NodeTraverser $nodeTraverser; public function __construct(CloningVisitor $cloningVisitor, PHPStanNodeScopeResolver $phpStanNodeScopeResolver, FileWithoutNamespaceNodeTraverser $fileWithoutNamespaceNodeTraverser) { $this->phpStanNodeScopeResolver = $phpStanNodeScopeResolver; diff --git a/src/NodeTypeResolver/NodeTypeCorrector/GenericClassStringTypeCorrector.php b/src/NodeTypeResolver/NodeTypeCorrector/GenericClassStringTypeCorrector.php index 6a8821516a4..6d2cff70434 100644 --- a/src/NodeTypeResolver/NodeTypeCorrector/GenericClassStringTypeCorrector.php +++ b/src/NodeTypeResolver/NodeTypeCorrector/GenericClassStringTypeCorrector.php @@ -13,9 +13,8 @@ final class GenericClassStringTypeCorrector { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(ReflectionProvider $reflectionProvider) { $this->reflectionProvider = $reflectionProvider; diff --git a/src/NodeTypeResolver/NodeTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver.php index 5b7daa4e907..d86c74b01dc 100644 --- a/src/NodeTypeResolver/NodeTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver.php @@ -53,34 +53,28 @@ final class NodeTypeResolver { /** * @readonly - * @var \Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier */ - private $objectTypeSpecifier; + private ObjectTypeSpecifier $objectTypeSpecifier; /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeCorrector\GenericClassStringTypeCorrector */ - private $genericClassStringTypeCorrector; + private GenericClassStringTypeCorrector $genericClassStringTypeCorrector; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeCorrector\AccessoryNonEmptyStringTypeCorrector */ - private $accessoryNonEmptyStringTypeCorrector; + private AccessoryNonEmptyStringTypeCorrector $accessoryNonEmptyStringTypeCorrector; /** * @readonly - * @var \Rector\Configuration\RenamedClassesDataCollector */ - private $renamedClassesDataCollector; + private RenamedClassesDataCollector $renamedClassesDataCollector; /** * @var string */ @@ -88,7 +82,7 @@ final class NodeTypeResolver /** * @var array, NodeTypeResolverInterface> */ - private $nodeTypeResolvers = []; + private array $nodeTypeResolvers = []; /** * @param NodeTypeResolverInterface[] $nodeTypeResolvers */ diff --git a/src/NodeTypeResolver/NodeTypeResolver/ClassAndInterfaceTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver/ClassAndInterfaceTypeResolver.php index 44c681e0058..921a6229a13 100644 --- a/src/NodeTypeResolver/NodeTypeResolver/ClassAndInterfaceTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver/ClassAndInterfaceTypeResolver.php @@ -24,9 +24,8 @@ final class ClassAndInterfaceTypeResolver implements NodeTypeResolverInterface { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/src/NodeTypeResolver/NodeTypeResolver/NewTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver/NewTypeResolver.php index c3b8e536790..56c1267b937 100644 --- a/src/NodeTypeResolver/NodeTypeResolver/NewTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver/NewTypeResolver.php @@ -26,14 +26,12 @@ final class NewTypeResolver implements NodeTypeResolverInterface { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; public function __construct(NodeNameResolver $nodeNameResolver, ClassAnalyzer $classAnalyzer) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/src/NodeTypeResolver/NodeTypeResolver/ParamTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver/ParamTypeResolver.php index a12d1176ee4..7becd4b0ce7 100644 --- a/src/NodeTypeResolver/NodeTypeResolver/ParamTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver/ParamTypeResolver.php @@ -17,10 +17,7 @@ use Rector\NodeTypeResolver\NodeTypeResolver; */ final class ParamTypeResolver implements NodeTypeResolverInterface, NodeTypeResolverAwareInterface { - /** - * @var \Rector\NodeTypeResolver\NodeTypeResolver - */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function autowire(NodeTypeResolver $nodeTypeResolver) : void { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/src/NodeTypeResolver/NodeTypeResolver/PropertyFetchTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver/PropertyFetchTypeResolver.php index db70f679e55..f7cd4071bc5 100644 --- a/src/NodeTypeResolver/NodeTypeResolver/PropertyFetchTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver/PropertyFetchTypeResolver.php @@ -24,18 +24,13 @@ final class PropertyFetchTypeResolver implements NodeTypeResolverInterface, Node { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; - /** - * @var \Rector\NodeTypeResolver\NodeTypeResolver - */ - private $nodeTypeResolver; + private ReflectionProvider $reflectionProvider; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/src/NodeTypeResolver/NodeTypeResolver/PropertyTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver/PropertyTypeResolver.php index f5ac1da8f76..d6ea6940dd7 100644 --- a/src/NodeTypeResolver/NodeTypeResolver/PropertyTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver/PropertyTypeResolver.php @@ -19,9 +19,8 @@ final class PropertyTypeResolver implements NodeTypeResolverInterface { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver\PropertyFetchTypeResolver */ - private $propertyFetchTypeResolver; + private \Rector\NodeTypeResolver\NodeTypeResolver\PropertyFetchTypeResolver $propertyFetchTypeResolver; public function __construct(\Rector\NodeTypeResolver\NodeTypeResolver\PropertyFetchTypeResolver $propertyFetchTypeResolver) { $this->propertyFetchTypeResolver = $propertyFetchTypeResolver; diff --git a/src/NodeTypeResolver/NodeTypeResolver/ScalarTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver/ScalarTypeResolver.php index e0832396174..f026313562a 100644 --- a/src/NodeTypeResolver/NodeTypeResolver/ScalarTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver/ScalarTypeResolver.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace Rector\NodeTypeResolver\NodeTypeResolver; +use PhpParser\Node\Scalar\Float_; +use PhpParser\Node\Scalar\Int_; +use PhpParser\Node\Scalar\InterpolatedString; +use PhpParser\Node\InterpolatedStringPart; use PhpParser\Node; use PhpParser\Node\Scalar; -use PhpParser\Node\Scalar\DNumber; -use PhpParser\Node\Scalar\Encapsed; -use PhpParser\Node\Scalar\EncapsedStringPart; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\MagicConst; use PhpParser\Node\Scalar\String_; use PHPStan\Type\Constant\ConstantFloatType; @@ -32,22 +32,22 @@ final class ScalarTypeResolver implements NodeTypeResolverInterface } public function resolve(Node $node) : Type { - if ($node instanceof DNumber) { - return new ConstantFloatType((float) $node->value); + if ($node instanceof Float_) { + return new ConstantFloatType($node->value); } if ($node instanceof String_) { - return new ConstantStringType((string) $node->value); + return new ConstantStringType($node->value); } - if ($node instanceof LNumber) { - return new ConstantIntegerType((int) $node->value); + if ($node instanceof Int_) { + return new ConstantIntegerType($node->value); } if ($node instanceof MagicConst) { return new ConstantStringType($node->getName()); } - if ($node instanceof Encapsed) { + if ($node instanceof InterpolatedString) { return new StringType(); } - if ($node instanceof EncapsedStringPart) { + if ($node instanceof InterpolatedStringPart) { return new ConstantStringType($node->value); } throw new NotImplementedYetException(); diff --git a/src/NodeTypeResolver/NodeTypeResolver/StaticCallMethodCallTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver/StaticCallMethodCallTypeResolver.php index 4c6f0eef575..dbc4c61d050 100644 --- a/src/NodeTypeResolver/NodeTypeResolver/StaticCallMethodCallTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver/StaticCallMethodCallTypeResolver.php @@ -26,13 +26,9 @@ final class StaticCallMethodCallTypeResolver implements NodeTypeResolverInterfac { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; - /** - * @var \Rector\NodeTypeResolver\NodeTypeResolver - */ - private $nodeTypeResolver; + private NodeNameResolver $nodeNameResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/src/NodeTypeResolver/NodeTypeResolver/TraitTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver/TraitTypeResolver.php index 0dfff4cc837..ec235e12d30 100644 --- a/src/NodeTypeResolver/NodeTypeResolver/TraitTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver/TraitTypeResolver.php @@ -20,9 +20,8 @@ final class TraitTypeResolver implements NodeTypeResolverInterface { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(ReflectionProvider $reflectionProvider) { $this->reflectionProvider = $reflectionProvider; diff --git a/src/NodeTypeResolver/PHPStan/ObjectWithoutClassTypeWithParentTypes.php b/src/NodeTypeResolver/PHPStan/ObjectWithoutClassTypeWithParentTypes.php index 155afcfa29f..d46b9d5b20b 100644 --- a/src/NodeTypeResolver/PHPStan/ObjectWithoutClassTypeWithParentTypes.php +++ b/src/NodeTypeResolver/PHPStan/ObjectWithoutClassTypeWithParentTypes.php @@ -12,7 +12,7 @@ final class ObjectWithoutClassTypeWithParentTypes extends ObjectWithoutClassType * @var TypeWithClassName[] * @readonly */ - private $parentTypes; + private array $parentTypes; /** * @param TypeWithClassName[] $parentTypes */ diff --git a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ByRefReturnNodeVisitor.php b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ByRefReturnNodeVisitor.php index e1917ec753e..5e9d5f80202 100644 --- a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ByRefReturnNodeVisitor.php +++ b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ByRefReturnNodeVisitor.php @@ -3,11 +3,11 @@ declare (strict_types=1); namespace Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\FunctionLike; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\Return_; -use PhpParser\NodeTraverser; use PhpParser\NodeVisitorAbstract; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\NodeTypeResolver\PHPStan\Scope\Contract\NodeVisitor\ScopeResolverNodeVisitorInterface; @@ -16,9 +16,8 @@ final class ByRefReturnNodeVisitor extends NodeVisitorAbstract implements ScopeR { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; @@ -37,7 +36,7 @@ final class ByRefReturnNodeVisitor extends NodeVisitorAbstract implements ScopeR } $this->simpleCallableNodeTraverser->traverseNodesWithCallable($stmts, static function (Node $node) { if ($node instanceof Class_ || $node instanceof FunctionLike) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$node instanceof Return_) { return null; diff --git a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ByRefVariableNodeVisitor.php b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ByRefVariableNodeVisitor.php index e5c60eb719c..273ef50584b 100644 --- a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ByRefVariableNodeVisitor.php +++ b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ByRefVariableNodeVisitor.php @@ -17,9 +17,8 @@ final class ByRefVariableNodeVisitor extends NodeVisitorAbstract implements Scop { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; @@ -64,7 +63,9 @@ final class ByRefVariableNodeVisitor extends NodeVisitorAbstract implements Scop foreach ($functionLike->getParams() as $param) { if ($param->byRef && $param->var instanceof Variable && !$param->var->name instanceof Expr) { $param->var->setAttribute(AttributeKey::IS_BYREF_VAR, \true); - $byRefVariableNames[] = $param->var->name; + /** @var string $paramVarName */ + $paramVarName = $param->var->name; + $byRefVariableNames[] = $paramVarName; } } return $byRefVariableNames; @@ -81,7 +82,9 @@ final class ByRefVariableNodeVisitor extends NodeVisitorAbstract implements Scop foreach ($functionLike->uses as $closureUse) { if ($closureUse->byRef && !$closureUse->var->name instanceof Expr) { $closureUse->var->setAttribute(AttributeKey::IS_BYREF_VAR, \true); - $byRefVariableNames[] = $closureUse->var->name; + /** @var string $closureVarName */ + $closureVarName = $closureUse->var->name; + $byRefVariableNames[] = $closureVarName; } } return $byRefVariableNames; diff --git a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ContextNodeVisitor.php b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ContextNodeVisitor.php index 12495b1ead6..7e2673b01d1 100644 --- a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ContextNodeVisitor.php +++ b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ContextNodeVisitor.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Attribute; @@ -30,7 +31,6 @@ use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\Switch_; use PhpParser\Node\Stmt\Unset_; use PhpParser\Node\Stmt\While_; -use PhpParser\NodeTraverser; use PhpParser\NodeVisitorAbstract; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\NodeTypeResolver\PHPStan\Scope\Contract\NodeVisitor\ScopeResolverNodeVisitorInterface; @@ -39,9 +39,8 @@ final class ContextNodeVisitor extends NodeVisitorAbstract implements ScopeResol { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; @@ -139,7 +138,7 @@ final class ContextNodeVisitor extends NodeVisitorAbstract implements ScopeResol $stmts = $node instanceof Switch_ ? $node->cases : $node->stmts; $this->simpleCallableNodeTraverser->traverseNodesWithCallable($stmts, static function (Node $subNode) : ?int { if ($subNode instanceof Class_ || $subNode instanceof Function_ || $subNode instanceof Closure) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($subNode instanceof If_ || $subNode instanceof Break_) { $subNode->setAttribute(AttributeKey::IS_IN_LOOP, \true); diff --git a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/GlobalVariableNodeVisitor.php b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/GlobalVariableNodeVisitor.php index a8fc2c0f234..1f5fce52aef 100644 --- a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/GlobalVariableNodeVisitor.php +++ b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/GlobalVariableNodeVisitor.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\Global_; -use PhpParser\NodeTraverser; use PhpParser\NodeVisitorAbstract; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\NodeTypeResolver\Node\AttributeKey; @@ -19,9 +19,8 @@ final class GlobalVariableNodeVisitor extends NodeVisitorAbstract implements Sco { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; @@ -60,7 +59,7 @@ final class GlobalVariableNodeVisitor extends NodeVisitorAbstract implements Sco } $this->simpleCallableNodeTraverser->traverseNodesWithCallable($stmt, static function (Node $subNode) use($globalVariableNames) { if ($subNode instanceof Class_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$subNode instanceof Variable) { return null; diff --git a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ReprintNodeVisitor.php b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ReprintNodeVisitor.php new file mode 100644 index 00000000000..7f8b202c63c --- /dev/null +++ b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ReprintNodeVisitor.php @@ -0,0 +1,34 @@ +getAttribute(AttributeKey::ORIGINAL_NODE) instanceof Node) { + return null; + } + if ($node instanceof BinaryOp && !$node instanceof Coalesce) { + if ($node->left instanceof BinaryOp && $node->left->getAttribute(AttributeKey::ORIGINAL_NODE) instanceof Node) { + $node->left->setAttribute(AttributeKey::ORIGINAL_NODE, null); + } + if ($node->right instanceof BinaryOp && $node->right->getAttribute(AttributeKey::ORIGINAL_NODE) instanceof Node) { + $node->right->setAttribute(AttributeKey::ORIGINAL_NODE, null); + } + return $node; + } + if ($node instanceof BooleanNot && $node->expr instanceof BinaryOp && $node->expr->getAttribute(AttributeKey::ORIGINAL_NODE) instanceof Node) { + $node->expr->setAttribute(AttributeKey::WRAPPED_IN_PARENTHESES, \true); + } + return null; + } +} diff --git a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StaticVariableNodeVisitor.php b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StaticVariableNodeVisitor.php index 714e2517480..3d77f75b0de 100644 --- a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StaticVariableNodeVisitor.php +++ b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StaticVariableNodeVisitor.php @@ -3,13 +3,13 @@ declare (strict_types=1); namespace Rector\NodeTypeResolver\PHPStan\Scope\NodeVisitor; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\Static_; -use PhpParser\NodeTraverser; use PhpParser\NodeVisitorAbstract; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\NodeTypeResolver\Node\AttributeKey; @@ -19,9 +19,8 @@ final class StaticVariableNodeVisitor extends NodeVisitorAbstract implements Sco { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; @@ -60,7 +59,7 @@ final class StaticVariableNodeVisitor extends NodeVisitorAbstract implements Sco } $this->simpleCallableNodeTraverser->traverseNodesWithCallable($stmt, static function (Node $subNode) use($staticVariableNames) { if ($subNode instanceof Class_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$subNode instanceof Variable) { return null; diff --git a/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php b/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php index b56cd4c3265..500e1f73e77 100644 --- a/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php +++ b/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php @@ -3,11 +3,12 @@ declare (strict_types=1); namespace Rector\NodeTypeResolver\PHPStan\Scope; +use PHPStan\Parser\ParserErrorsException; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\AssignOp; @@ -18,6 +19,7 @@ use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\FuncCall; +use PhpParser\Node\Expr\List_; use PhpParser\Node\Expr\Match_; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\New_; @@ -78,43 +80,36 @@ final class PHPStanNodeScopeResolver { /** * @readonly - * @var \PHPStan\Analyser\NodeScopeResolver */ - private $nodeScopeResolver; + private NodeScopeResolver $nodeScopeResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Scope\ScopeFactory */ - private $scopeFactory; + private \Rector\NodeTypeResolver\PHPStan\Scope\ScopeFactory $scopeFactory; /** * @readonly - * @var \Rector\Util\Reflection\PrivatesAccessor */ - private $privatesAccessor; + private PrivatesAccessor $privatesAccessor; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @var string */ private const CONTEXT = 'context'; /** * @readonly - * @var \PhpParser\NodeTraverser */ - private $nodeTraverser; + private NodeTraverser $nodeTraverser; /** * @param ScopeResolverNodeVisitorInterface[] $nodeVisitors */ @@ -203,7 +198,7 @@ final class PHPStanNodeScopeResolver if ($node instanceof Foreach_) { // decorate value as well $node->valueVar->setAttribute(AttributeKey::SCOPE, $mutatingScope); - if ($node->valueVar instanceof Array_) { + if ($node->valueVar instanceof List_) { $this->processArray($node->valueVar, $mutatingScope); } return; @@ -294,7 +289,13 @@ final class PHPStanNodeScopeResolver { try { $this->nodeScopeResolver->processNodes($stmts, $mutatingScope, $nodeCallback); + } catch (ParserErrorsException $exception) { + // nothing we can do more precise here as error parsing from deep internal PHPStan service with service injection we cannot reset + // in the middle of process + // fallback to fill by found scope + \Rector\NodeTypeResolver\PHPStan\Scope\RectorNodeScopeResolver::processNodes($stmts, $mutatingScope); } catch (ShouldNotHappenException $exception) { + // internal PHPStan error } } private function processCallike(CallLike $callLike, MutatingScope $mutatingScope) : void @@ -319,7 +320,10 @@ final class PHPStanNodeScopeResolver $assign->var->setAttribute(AttributeKey::SCOPE, $mutatingScope); $assign->expr->setAttribute(AttributeKey::SCOPE, $mutatingScope); } - private function processArray(Array_ $array, MutatingScope $mutatingScope) : void + /** + * @param \PhpParser\Node\Expr\List_|\PhpParser\Node\Expr\Array_ $array + */ + private function processArray($array, MutatingScope $mutatingScope) : void { foreach ($array->items as $arrayItem) { if ($arrayItem instanceof ArrayItem) { @@ -362,9 +366,7 @@ final class PHPStanNodeScopeResolver private function processCatch(Catch_ $catch, string $filePath, MutatingScope $mutatingScope) : void { $varName = $catch->var instanceof Variable ? $this->nodeNameResolver->getName($catch->var) : null; - $type = TypeCombinator::union(...\array_map(static function (Name $name) : ObjectType { - return new ObjectType((string) $name); - }, $catch->types)); + $type = TypeCombinator::union(...\array_map(static fn(Name $name): ObjectType => new ObjectType((string) $name), $catch->types)); $catchMutatingScope = $mutatingScope->enterCatchType($type, $varName); $this->processNodes($catch->stmts, $filePath, $catchMutatingScope); } diff --git a/src/NodeTypeResolver/PHPStan/Scope/RectorNodeScopeResolver.php b/src/NodeTypeResolver/PHPStan/Scope/RectorNodeScopeResolver.php new file mode 100644 index 00000000000..f6bc889d159 --- /dev/null +++ b/src/NodeTypeResolver/PHPStan/Scope/RectorNodeScopeResolver.php @@ -0,0 +1,27 @@ +traverseNodesWithCallable($stmts, function (Node $node) use($mutatingScope) : void { + $node->setAttribute(AttributeKey::SCOPE, $mutatingScope); + }); + } +} diff --git a/src/NodeTypeResolver/PHPStan/Scope/ScopeFactory.php b/src/NodeTypeResolver/PHPStan/Scope/ScopeFactory.php index 3932a29ec39..62daa2e70d4 100644 --- a/src/NodeTypeResolver/PHPStan/Scope/ScopeFactory.php +++ b/src/NodeTypeResolver/PHPStan/Scope/ScopeFactory.php @@ -10,9 +10,8 @@ final class ScopeFactory { /** * @readonly - * @var PHPStanScopeFactory */ - private $phpStanScopeFactory; + private PHPStanScopeFactory $phpStanScopeFactory; public function __construct(PHPStanScopeFactory $phpStanScopeFactory) { $this->phpStanScopeFactory = $phpStanScopeFactory; diff --git a/src/NodeTypeResolver/PHPStan/Type/StaticTypeAnalyzer.php b/src/NodeTypeResolver/PHPStan/Type/StaticTypeAnalyzer.php index e91936e2b6c..d321edc6c46 100644 --- a/src/NodeTypeResolver/PHPStan/Type/StaticTypeAnalyzer.php +++ b/src/NodeTypeResolver/PHPStan/Type/StaticTypeAnalyzer.php @@ -15,9 +15,8 @@ final class StaticTypeAnalyzer { /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeAnalyzer */ - private $unionTypeAnalyzer; + private UnionTypeAnalyzer $unionTypeAnalyzer; public function __construct(UnionTypeAnalyzer $unionTypeAnalyzer) { $this->unionTypeAnalyzer = $unionTypeAnalyzer; diff --git a/src/NodeTypeResolver/PHPStan/Type/TypeFactory.php b/src/NodeTypeResolver/PHPStan/Type/TypeFactory.php index 225709d151d..4dd74d09481 100644 --- a/src/NodeTypeResolver/PHPStan/Type/TypeFactory.php +++ b/src/NodeTypeResolver/PHPStan/Type/TypeFactory.php @@ -23,9 +23,8 @@ final class TypeFactory { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\TypeHasher */ - private $typeHasher; + private TypeHasher $typeHasher; public function __construct(TypeHasher $typeHasher) { $this->typeHasher = $typeHasher; @@ -143,7 +142,17 @@ final class TypeFactory if (\count($types) === 1) { return $types[0]; } - return new UnionType($types); + $unionType = new UnionType($types); + if ($unionType->isFloat()->yes()) { + return new IntegerType(); + } + if ($unionType->isString()->yes()) { + return new StringType(); + } + if ($unionType->isInteger()->yes()) { + return new IntegerType(); + } + return $unionType; } private function removeValueFromConstantType(Type $type) : Type { diff --git a/src/NodeTypeResolver/PHPStan/TypeHasher.php b/src/NodeTypeResolver/PHPStan/TypeHasher.php index 905bcc07732..e25750f457d 100644 --- a/src/NodeTypeResolver/PHPStan/TypeHasher.php +++ b/src/NodeTypeResolver/PHPStan/TypeHasher.php @@ -4,7 +4,6 @@ declare (strict_types=1); namespace Rector\NodeTypeResolver\PHPStan; use PHPStan\Type\ArrayType; -use PHPStan\Type\ConstantType; use PHPStan\Type\Generic\GenericObjectType; use PHPStan\Type\MixedType; use PHPStan\Type\ObjectType; @@ -35,7 +34,7 @@ final class TypeHasher if ($type instanceof TypeWithClassName) { return $this->resolveUniqueTypeWithClassNameHash($type); } - if ($type instanceof ConstantType) { + if ($type->isConstantValue()->yes()) { return \get_class($type); } $type = $this->normalizeObjectType($type); diff --git a/src/NodeTypeResolver/PhpDoc/NodeAnalyzer/DocBlockClassRenamer.php b/src/NodeTypeResolver/PhpDoc/NodeAnalyzer/DocBlockClassRenamer.php index 8d8e6ad37ba..1855f70ed94 100644 --- a/src/NodeTypeResolver/PhpDoc/NodeAnalyzer/DocBlockClassRenamer.php +++ b/src/NodeTypeResolver/PhpDoc/NodeAnalyzer/DocBlockClassRenamer.php @@ -12,9 +12,8 @@ final class DocBlockClassRenamer { /** * @readonly - * @var \Rector\NodeTypeResolver\PhpDocNodeVisitor\ClassRenamePhpDocNodeVisitor */ - private $classRenamePhpDocNodeVisitor; + private ClassRenamePhpDocNodeVisitor $classRenamePhpDocNodeVisitor; public function __construct(ClassRenamePhpDocNodeVisitor $classRenamePhpDocNodeVisitor) { $this->classRenamePhpDocNodeVisitor = $classRenamePhpDocNodeVisitor; diff --git a/src/NodeTypeResolver/PhpDoc/NodeAnalyzer/DocBlockNameImporter.php b/src/NodeTypeResolver/PhpDoc/NodeAnalyzer/DocBlockNameImporter.php index 3e2b9369ac7..357b2648923 100644 --- a/src/NodeTypeResolver/PhpDoc/NodeAnalyzer/DocBlockNameImporter.php +++ b/src/NodeTypeResolver/PhpDoc/NodeAnalyzer/DocBlockNameImporter.php @@ -11,9 +11,8 @@ final class DocBlockNameImporter { /** * @readonly - * @var \Rector\NodeTypeResolver\PhpDocNodeVisitor\NameImportingPhpDocNodeVisitor */ - private $nameImportingPhpDocNodeVisitor; + private NameImportingPhpDocNodeVisitor $nameImportingPhpDocNodeVisitor; public function __construct(NameImportingPhpDocNodeVisitor $nameImportingPhpDocNodeVisitor) { $this->nameImportingPhpDocNodeVisitor = $nameImportingPhpDocNodeVisitor; diff --git a/src/NodeTypeResolver/PhpDoc/NodeAnalyzer/DocBlockTagReplacer.php b/src/NodeTypeResolver/PhpDoc/NodeAnalyzer/DocBlockTagReplacer.php index 9a27127b15c..2f3008dd941 100644 --- a/src/NodeTypeResolver/PhpDoc/NodeAnalyzer/DocBlockTagReplacer.php +++ b/src/NodeTypeResolver/PhpDoc/NodeAnalyzer/DocBlockTagReplacer.php @@ -11,9 +11,8 @@ final class DocBlockTagReplacer { /** * @readonly - * @var \Rector\BetterPhpDocParser\Annotation\AnnotationNaming */ - private $annotationNaming; + private AnnotationNaming $annotationNaming; public function __construct(AnnotationNaming $annotationNaming) { $this->annotationNaming = $annotationNaming; diff --git a/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php b/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php index bb8f212c72c..6cb022a7948 100644 --- a/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php +++ b/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php @@ -26,31 +26,22 @@ final class ClassRenamePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor { /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\Naming\Naming\UseImportsResolver */ - private $useImportsResolver; + private UseImportsResolver $useImportsResolver; /** * @readonly - * @var \Rector\Renaming\Collector\RenamedNameCollector */ - private $renamedNameCollector; + private RenamedNameCollector $renamedNameCollector; /** * @var OldToNewType[] */ - private $oldToNewTypes = []; - /** - * @var bool - */ - private $hasChanged = \false; - /** - * @var PhpNode|null - */ - private $currentPhpNode; + private array $oldToNewTypes = []; + private bool $hasChanged = \false; + private ?PhpNode $currentPhpNode = null; public function __construct(StaticTypeMapper $staticTypeMapper, UseImportsResolver $useImportsResolver, RenamedNameCollector $renamedNameCollector) { $this->staticTypeMapper = $staticTypeMapper; diff --git a/src/NodeTypeResolver/PhpDocNodeVisitor/NameImportingPhpDocNodeVisitor.php b/src/NodeTypeResolver/PhpDocNodeVisitor/NameImportingPhpDocNodeVisitor.php index 8d21fb3c9e4..cc4e6b67e83 100644 --- a/src/NodeTypeResolver/PhpDocNodeVisitor/NameImportingPhpDocNodeVisitor.php +++ b/src/NodeTypeResolver/PhpDocNodeVisitor/NameImportingPhpDocNodeVisitor.php @@ -28,37 +28,26 @@ final class NameImportingPhpDocNodeVisitor extends AbstractPhpDocNodeVisitor { /** * @readonly - * @var \Rector\CodingStyle\ClassNameImport\ClassNameImportSkipper */ - private $classNameImportSkipper; + private ClassNameImportSkipper $classNameImportSkipper; /** * @readonly - * @var \Rector\PostRector\Collector\UseNodesToAddCollector */ - private $useNodesToAddCollector; + private UseNodesToAddCollector $useNodesToAddCollector; /** * @readonly - * @var \Rector\Application\Provider\CurrentFileProvider */ - private $currentFileProvider; + private CurrentFileProvider $currentFileProvider; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpDocParser\IdentifierPhpDocTypeMapper */ - private $identifierPhpDocTypeMapper; - /** - * @var PhpParserNode|null - */ - private $currentPhpParserNode; - /** - * @var bool - */ - private $hasChanged = \false; + private IdentifierPhpDocTypeMapper $identifierPhpDocTypeMapper; + private ?PhpParserNode $currentPhpParserNode = null; + private bool $hasChanged = \false; public function __construct(ClassNameImportSkipper $classNameImportSkipper, UseNodesToAddCollector $useNodesToAddCollector, CurrentFileProvider $currentFileProvider, ReflectionProvider $reflectionProvider, IdentifierPhpDocTypeMapper $identifierPhpDocTypeMapper) { $this->classNameImportSkipper = $classNameImportSkipper; diff --git a/src/NodeTypeResolver/Reflection/BetterReflection/RectorBetterReflectionSourceLocatorFactory.php b/src/NodeTypeResolver/Reflection/BetterReflection/RectorBetterReflectionSourceLocatorFactory.php index 855efd94aaf..79d4bd269f0 100644 --- a/src/NodeTypeResolver/Reflection/BetterReflection/RectorBetterReflectionSourceLocatorFactory.php +++ b/src/NodeTypeResolver/Reflection/BetterReflection/RectorBetterReflectionSourceLocatorFactory.php @@ -14,14 +14,12 @@ final class RectorBetterReflectionSourceLocatorFactory { /** * @readonly - * @var \PHPStan\Reflection\BetterReflection\BetterReflectionSourceLocatorFactory */ - private $betterReflectionSourceLocatorFactory; + private BetterReflectionSourceLocatorFactory $betterReflectionSourceLocatorFactory; /** * @readonly - * @var \Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocator\IntermediateSourceLocator */ - private $intermediateSourceLocator; + private IntermediateSourceLocator $intermediateSourceLocator; public function __construct(BetterReflectionSourceLocatorFactory $betterReflectionSourceLocatorFactory, IntermediateSourceLocator $intermediateSourceLocator) { $this->betterReflectionSourceLocatorFactory = $betterReflectionSourceLocatorFactory; diff --git a/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocator/IntermediateSourceLocator.php b/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocator/IntermediateSourceLocator.php index 75436a44ec4..2b6bef8b4ae 100644 --- a/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocator/IntermediateSourceLocator.php +++ b/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocator/IntermediateSourceLocator.php @@ -14,9 +14,8 @@ final class IntermediateSourceLocator implements SourceLocator { /** * @readonly - * @var \Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider */ - private $dynamicSourceLocatorProvider; + private DynamicSourceLocatorProvider $dynamicSourceLocatorProvider; public function __construct(DynamicSourceLocatorProvider $dynamicSourceLocatorProvider) { $this->dynamicSourceLocatorProvider = $dynamicSourceLocatorProvider; diff --git a/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php b/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php index a8f465bf5c5..7511034b439 100644 --- a/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php +++ b/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php @@ -17,26 +17,21 @@ final class DynamicSourceLocatorProvider implements ResetableInterface { /** * @readonly - * @var \PHPStan\Reflection\BetterReflection\SourceLocator\FileNodesFetcher */ - private $fileNodesFetcher; + private FileNodesFetcher $fileNodesFetcher; /** * @readonly - * @var \PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedDirectorySourceLocatorFactory */ - private $optimizedDirectorySourceLocatorFactory; + private OptimizedDirectorySourceLocatorFactory $optimizedDirectorySourceLocatorFactory; /** * @var string[] */ - private $filePaths = []; + private array $filePaths = []; /** * @var string[] */ - private $directories = []; - /** - * @var \PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator|null - */ - private $aggregateSourceLocator; + private array $directories = []; + private ?AggregateSourceLocator $aggregateSourceLocator = null; public function __construct(FileNodesFetcher $fileNodesFetcher, OptimizedDirectorySourceLocatorFactory $optimizedDirectorySourceLocatorFactory) { $this->fileNodesFetcher = $fileNodesFetcher; diff --git a/src/NodeTypeResolver/TypeAnalyzer/ArrayTypeAnalyzer.php b/src/NodeTypeResolver/TypeAnalyzer/ArrayTypeAnalyzer.php index ec9d7178638..32387d560b0 100644 --- a/src/NodeTypeResolver/TypeAnalyzer/ArrayTypeAnalyzer.php +++ b/src/NodeTypeResolver/TypeAnalyzer/ArrayTypeAnalyzer.php @@ -9,9 +9,8 @@ final class ArrayTypeAnalyzer { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeTypeResolver $nodeTypeResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/src/NodeTypeResolver/TypeAnalyzer/StringTypeAnalyzer.php b/src/NodeTypeResolver/TypeAnalyzer/StringTypeAnalyzer.php index b429ffb9c37..2a8e4faedf7 100644 --- a/src/NodeTypeResolver/TypeAnalyzer/StringTypeAnalyzer.php +++ b/src/NodeTypeResolver/TypeAnalyzer/StringTypeAnalyzer.php @@ -9,9 +9,8 @@ final class StringTypeAnalyzer { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeTypeResolver $nodeTypeResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/src/NodeTypeResolver/TypeComparator/ArrayTypeComparator.php b/src/NodeTypeResolver/TypeComparator/ArrayTypeComparator.php index 365b904ee37..fffc17ee9ed 100644 --- a/src/NodeTypeResolver/TypeComparator/ArrayTypeComparator.php +++ b/src/NodeTypeResolver/TypeComparator/ArrayTypeComparator.php @@ -11,7 +11,11 @@ use PHPStan\Type\MixedType; */ final class ArrayTypeComparator { - public function isSubtype(ArrayType $checkedType, ArrayType $mainType) : bool + /** + * @param \PHPStan\Type\ArrayType|\PHPStan\Type\Constant\ConstantArrayType $checkedType + * @param \PHPStan\Type\ArrayType|\PHPStan\Type\Constant\ConstantArrayType $mainType + */ + public function isSubtype($checkedType, $mainType) : bool { if (!$checkedType instanceof ConstantArrayType && !$mainType instanceof ConstantArrayType) { return $mainType->isSuperTypeOf($checkedType)->yes(); diff --git a/src/NodeTypeResolver/TypeComparator/ScalarTypeComparator.php b/src/NodeTypeResolver/TypeComparator/ScalarTypeComparator.php index 604df690a0f..18152dd5737 100644 --- a/src/NodeTypeResolver/TypeComparator/ScalarTypeComparator.php +++ b/src/NodeTypeResolver/TypeComparator/ScalarTypeComparator.php @@ -52,7 +52,7 @@ final class ScalarTypeComparator if (!$firstType->isString()->yes()) { return \get_class($firstType) !== \get_class($secondType); } - if (!$secondType->isClassStringType()->yes()) { + if (!$secondType->isClassString()->yes()) { return \get_class($firstType) !== \get_class($secondType); } return \false; diff --git a/src/NodeTypeResolver/TypeComparator/TypeComparator.php b/src/NodeTypeResolver/TypeComparator/TypeComparator.php index 0d77bd010e5..b93b6deb04c 100644 --- a/src/NodeTypeResolver/TypeComparator/TypeComparator.php +++ b/src/NodeTypeResolver/TypeComparator/TypeComparator.php @@ -25,34 +25,28 @@ final class TypeComparator { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\TypeHasher */ - private $typeHasher; + private TypeHasher $typeHasher; /** * @readonly - * @var \Rector\TypeDeclaration\TypeNormalizer */ - private $typeNormalizer; + private TypeNormalizer $typeNormalizer; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\ArrayTypeComparator */ - private $arrayTypeComparator; + private \Rector\NodeTypeResolver\TypeComparator\ArrayTypeComparator $arrayTypeComparator; /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\ScalarTypeComparator */ - private $scalarTypeComparator; + private \Rector\NodeTypeResolver\TypeComparator\ScalarTypeComparator $scalarTypeComparator; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(TypeHasher $typeHasher, TypeNormalizer $typeNormalizer, StaticTypeMapper $staticTypeMapper, \Rector\NodeTypeResolver\TypeComparator\ArrayTypeComparator $arrayTypeComparator, \Rector\NodeTypeResolver\TypeComparator\ScalarTypeComparator $scalarTypeComparator, ReflectionResolver $reflectionResolver) { $this->typeHasher = $typeHasher; diff --git a/src/NodeTypeResolver/ValueObject/OldToNewType.php b/src/NodeTypeResolver/ValueObject/OldToNewType.php index c22f1040a14..e3fbaa1ab83 100644 --- a/src/NodeTypeResolver/ValueObject/OldToNewType.php +++ b/src/NodeTypeResolver/ValueObject/OldToNewType.php @@ -8,14 +8,12 @@ final class OldToNewType { /** * @readonly - * @var \PHPStan\Type\Type */ - private $oldType; + private Type $oldType; /** * @readonly - * @var \PHPStan\Type\Type */ - private $newType; + private Type $newType; public function __construct(Type $oldType, Type $newType) { $this->oldType = $oldType; diff --git a/src/PHPStan/NodeVisitor/UnreachableStatementNodeVisitor.php b/src/PHPStan/NodeVisitor/UnreachableStatementNodeVisitor.php index 80b9da486c0..3deb6714878 100644 --- a/src/PHPStan/NodeVisitor/UnreachableStatementNodeVisitor.php +++ b/src/PHPStan/NodeVisitor/UnreachableStatementNodeVisitor.php @@ -16,19 +16,16 @@ final class UnreachableStatementNodeVisitor extends NodeVisitorAbstract { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Scope\PHPStanNodeScopeResolver */ - private $phpStanNodeScopeResolver; + private PHPStanNodeScopeResolver $phpStanNodeScopeResolver; /** * @readonly - * @var string */ - private $filePath; + private string $filePath; /** * @readonly - * @var \PHPStan\Analyser\MutatingScope */ - private $mutatingScope; + private MutatingScope $mutatingScope; public function __construct(PHPStanNodeScopeResolver $phpStanNodeScopeResolver, string $filePath, MutatingScope $mutatingScope) { $this->phpStanNodeScopeResolver = $phpStanNodeScopeResolver; diff --git a/src/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php b/src/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php index 6088256a3fd..45a467d8c70 100644 --- a/src/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php @@ -18,7 +18,7 @@ final class PHPStanStaticTypeMapper * @var TypeMapperInterface[] * @readonly */ - private $typeMappers; + private array $typeMappers; /** * @param TypeMapperInterface[] $typeMappers */ diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryLiteralStringTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryLiteralStringTypeMapper.php index fc92df245df..8bd2118e9bc 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryLiteralStringTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryLiteralStringTypeMapper.php @@ -18,9 +18,8 @@ final class AccessoryLiteralStringTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryNonEmptyStringTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryNonEmptyStringTypeMapper.php index 669f72c5f78..250c6ee929d 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryNonEmptyStringTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryNonEmptyStringTypeMapper.php @@ -18,9 +18,8 @@ final class AccessoryNonEmptyStringTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryNonFalsyStringTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryNonFalsyStringTypeMapper.php index 1dc3ca3a96b..e537ff91605 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryNonFalsyStringTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryNonFalsyStringTypeMapper.php @@ -18,9 +18,8 @@ final class AccessoryNonFalsyStringTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryNumericStringTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryNumericStringTypeMapper.php index 562f3887d67..6bbfcfc4a1d 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryNumericStringTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/AccessoryNumericStringTypeMapper.php @@ -18,9 +18,8 @@ final class AccessoryNumericStringTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapper.php index a872ace4650..307a807fb12 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ArrayTypeMapper.php @@ -3,7 +3,7 @@ declare (strict_types=1); namespace Rector\PHPStanStaticTypeMapper\TypeMapper; -use PhpParser\Node; +use PHPStan\PhpDocParser\Ast\Node; use PhpParser\Node\Identifier; use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; @@ -32,22 +32,17 @@ final class ArrayTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\TypeDeclaration\TypeAnalyzer\GenericClassStringTypeNormalizer */ - private $genericClassStringTypeNormalizer; + private GenericClassStringTypeNormalizer $genericClassStringTypeNormalizer; /** * @readonly - * @var \Rector\TypeDeclaration\NodeTypeAnalyzer\DetailedTypeAnalyzer */ - private $detailedTypeAnalyzer; + private DetailedTypeAnalyzer $detailedTypeAnalyzer; /** * @var string */ public const HAS_GENERIC_TYPE_PARENT = 'has_generic_type_parent'; - /** - * @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper - */ - private $phpStanStaticTypeMapper; + private PHPStanStaticTypeMapper $phpStanStaticTypeMapper; public function __construct(GenericClassStringTypeNormalizer $genericClassStringTypeNormalizer, DetailedTypeAnalyzer $detailedTypeAnalyzer) { $this->genericClassStringTypeNormalizer = $genericClassStringTypeNormalizer; @@ -86,7 +81,7 @@ final class ArrayTypeMapper implements TypeMapperInterface /** * @param ArrayType $type */ - public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node + public function mapToPhpParserNode(Type $type, string $typeKind) : Identifier { return new Identifier('array'); } @@ -155,7 +150,7 @@ final class ArrayTypeMapper implements TypeMapperInterface } // @see https://github.com/phpstan/phpdoc-parser/blob/98a088b17966bdf6ee25c8a4b634df313d8aa531/tests/PHPStan/Parser/PhpDocParserTest.php#L2692-L2696 foreach ($genericTypes as $genericType) { - /** @var \PHPStan\PhpDocParser\Ast\Node $genericType */ + /** @var Node $genericType */ $genericType->setAttribute(self::HAS_GENERIC_TYPE_PARENT, $withKey); } $identifierTypeNode->setAttribute(self::HAS_GENERIC_TYPE_PARENT, $withKey); diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/BooleanTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/BooleanTypeMapper.php index ee390bedb9c..2bee8693b1c 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/BooleanTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/BooleanTypeMapper.php @@ -19,9 +19,8 @@ final class BooleanTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ClassStringTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ClassStringTypeMapper.php index 77b53b32a3e..ac7ea10c4cc 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/ClassStringTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ClassStringTypeMapper.php @@ -18,9 +18,8 @@ final class ClassStringTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ClosureTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ClosureTypeMapper.php index 57a901b31e6..20d023b7f5e 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/ClosureTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ClosureTypeMapper.php @@ -23,9 +23,8 @@ final class ClosureTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ConditionalTypeForParameterMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ConditionalTypeForParameterMapper.php index 64c2c7621e6..dd897113d66 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/ConditionalTypeForParameterMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ConditionalTypeForParameterMapper.php @@ -16,10 +16,7 @@ use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper; */ final class ConditionalTypeForParameterMapper implements TypeMapperInterface { - /** - * @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper - */ - private $phpStanStaticTypeMapper; + private PHPStanStaticTypeMapper $phpStanStaticTypeMapper; public function autowire(PHPStanStaticTypeMapper $phpStanStaticTypeMapper) : void { $this->phpStanStaticTypeMapper = $phpStanStaticTypeMapper; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ConditionalTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ConditionalTypeMapper.php index f9068539495..0f97099b676 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/ConditionalTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ConditionalTypeMapper.php @@ -20,10 +20,7 @@ use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper; */ final class ConditionalTypeMapper implements TypeMapperInterface { - /** - * @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper - */ - private $phpStanStaticTypeMapper; + private PHPStanStaticTypeMapper $phpStanStaticTypeMapper; public function autowire(PHPStanStaticTypeMapper $phpStanStaticTypeMapper) : void { $this->phpStanStaticTypeMapper = $phpStanStaticTypeMapper; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ConstantArrayTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ConstantArrayTypeMapper.php new file mode 100644 index 00000000000..5c8741f899c --- /dev/null +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ConstantArrayTypeMapper.php @@ -0,0 +1,45 @@ + + */ +final class ConstantArrayTypeMapper implements TypeMapperInterface +{ + /** + * @readonly + */ + private PhpVersionProvider $phpVersionProvider; + public function __construct(PhpVersionProvider $phpVersionProvider) + { + $this->phpVersionProvider = $phpVersionProvider; + } + public function getNodeClass() : string + { + return ConstantArrayType::class; + } + /** + * @param ConstantArrayType $type + */ + public function mapToPHPStanPhpDocTypeNode(Type $type) : TypeNode + { + return $type->toPhpDocNode(); + } + public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node + { + if (!$this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::SCALAR_TYPES)) { + return null; + } + return new Identifier('array'); + } +} diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/FloatTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/FloatTypeMapper.php index 739471c7c81..097523dd6cf 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/FloatTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/FloatTypeMapper.php @@ -18,9 +18,8 @@ final class FloatTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/GenericClassStringTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/GenericClassStringTypeMapper.php index 5cc8b1e8ee6..2127213f320 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/GenericClassStringTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/GenericClassStringTypeMapper.php @@ -18,9 +18,8 @@ final class GenericClassStringTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/HasMethodTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/HasMethodTypeMapper.php index 071a2e433a6..531db1dcddc 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/HasMethodTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/HasMethodTypeMapper.php @@ -15,9 +15,8 @@ final class HasMethodTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\TypeMapper\ObjectWithoutClassTypeMapper */ - private $objectWithoutClassTypeMapper; + private \Rector\PHPStanStaticTypeMapper\TypeMapper\ObjectWithoutClassTypeMapper $objectWithoutClassTypeMapper; public function __construct(\Rector\PHPStanStaticTypeMapper\TypeMapper\ObjectWithoutClassTypeMapper $objectWithoutClassTypeMapper) { $this->objectWithoutClassTypeMapper = $objectWithoutClassTypeMapper; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/HasOffsetTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/HasOffsetTypeMapper.php index c5bb9629863..7e1eb7e8b3d 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/HasOffsetTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/HasOffsetTypeMapper.php @@ -3,7 +3,6 @@ declare (strict_types=1); namespace Rector\PHPStanStaticTypeMapper\TypeMapper; -use PhpParser\Node; use PhpParser\Node\Identifier; use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\Accessory\HasOffsetType; @@ -28,7 +27,7 @@ final class HasOffsetTypeMapper implements TypeMapperInterface /** * @param HasOffsetType $type */ - public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node + public function mapToPhpParserNode(Type $type, string $typeKind) : Identifier { return new Identifier('array'); } diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/HasOffsetValueTypeTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/HasOffsetValueTypeTypeMapper.php index 3de7a670027..76d7ab7da1f 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/HasOffsetValueTypeTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/HasOffsetValueTypeTypeMapper.php @@ -3,7 +3,6 @@ declare (strict_types=1); namespace Rector\PHPStanStaticTypeMapper\TypeMapper; -use PhpParser\Node; use PhpParser\Node\Identifier; use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\Accessory\HasOffsetValueType; @@ -28,7 +27,7 @@ final class HasOffsetValueTypeTypeMapper implements TypeMapperInterface /** * @param HasOffsetValueType $type */ - public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node + public function mapToPhpParserNode(Type $type, string $typeKind) : Identifier { return new Identifier('array'); } diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/HasPropertyTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/HasPropertyTypeMapper.php index 8fcf7e7ddb8..500f3b19ea1 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/HasPropertyTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/HasPropertyTypeMapper.php @@ -15,9 +15,8 @@ final class HasPropertyTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\TypeMapper\ObjectWithoutClassTypeMapper */ - private $objectWithoutClassTypeMapper; + private \Rector\PHPStanStaticTypeMapper\TypeMapper\ObjectWithoutClassTypeMapper $objectWithoutClassTypeMapper; public function __construct(\Rector\PHPStanStaticTypeMapper\TypeMapper\ObjectWithoutClassTypeMapper $objectWithoutClassTypeMapper) { $this->objectWithoutClassTypeMapper = $objectWithoutClassTypeMapper; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/IntegerTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/IntegerTypeMapper.php index 57a77868a25..b6690f24b8e 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/IntegerTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/IntegerTypeMapper.php @@ -19,9 +19,8 @@ final class IntegerTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/IntersectionTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/IntersectionTypeMapper.php index 659854f7fa6..c6ffd81a7f2 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/IntersectionTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/IntersectionTypeMapper.php @@ -28,24 +28,20 @@ final class IntersectionTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\TypeMapper\ObjectWithoutClassTypeMapper */ - private $objectWithoutClassTypeMapper; + private \Rector\PHPStanStaticTypeMapper\TypeMapper\ObjectWithoutClassTypeMapper $objectWithoutClassTypeMapper; /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\TypeMapper\ObjectTypeMapper */ - private $objectTypeMapper; + private \Rector\PHPStanStaticTypeMapper\TypeMapper\ObjectTypeMapper $objectTypeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\Mapper\ScalarStringToTypeMapper */ - private $scalarStringToTypeMapper; + private ScalarStringToTypeMapper $scalarStringToTypeMapper; public function __construct(PhpVersionProvider $phpVersionProvider, \Rector\PHPStanStaticTypeMapper\TypeMapper\ObjectWithoutClassTypeMapper $objectWithoutClassTypeMapper, \Rector\PHPStanStaticTypeMapper\TypeMapper\ObjectTypeMapper $objectTypeMapper, ScalarStringToTypeMapper $scalarStringToTypeMapper) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/IterableTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/IterableTypeMapper.php index afa9aaa65d4..e7eaa16b3ee 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/IterableTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/IterableTypeMapper.php @@ -3,7 +3,6 @@ declare (strict_types=1); namespace Rector\PHPStanStaticTypeMapper\TypeMapper; -use PhpParser\Node; use PhpParser\Node\Identifier; use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\IterableType; @@ -28,7 +27,7 @@ final class IterableTypeMapper implements TypeMapperInterface /** * @param IterableType $type */ - public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node + public function mapToPhpParserNode(Type $type, string $typeKind) : Identifier { return new Identifier('iterable'); } diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/MixedTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/MixedTypeMapper.php index e446ba533dc..911aca472ce 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/MixedTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/MixedTypeMapper.php @@ -19,9 +19,8 @@ final class MixedTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/NonEmptyArrayTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/NonEmptyArrayTypeMapper.php index 9b4fed22ad5..848843cf88e 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/NonEmptyArrayTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/NonEmptyArrayTypeMapper.php @@ -3,7 +3,6 @@ declare (strict_types=1); namespace Rector\PHPStanStaticTypeMapper\TypeMapper; -use PhpParser\Node; use PhpParser\Node\Identifier; use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\Accessory\NonEmptyArrayType; @@ -28,7 +27,7 @@ final class NonEmptyArrayTypeMapper implements TypeMapperInterface /** * @param NonEmptyArrayType $type */ - public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node + public function mapToPhpParserNode(Type $type, string $typeKind) : Identifier { return new Identifier('array'); } diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/NullTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/NullTypeMapper.php index 69dd2aa1837..9ce86610244 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/NullTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/NullTypeMapper.php @@ -19,9 +19,8 @@ final class NullTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ObjectWithoutClassTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ObjectWithoutClassTypeMapper.php index a4764dd9bfc..2c2a01da056 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/ObjectWithoutClassTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ObjectWithoutClassTypeMapper.php @@ -20,9 +20,8 @@ final class ObjectWithoutClassTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/OversizedArrayTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/OversizedArrayTypeMapper.php index 4955a7f6d69..824c3817f2f 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/OversizedArrayTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/OversizedArrayTypeMapper.php @@ -3,7 +3,6 @@ declare (strict_types=1); namespace Rector\PHPStanStaticTypeMapper\TypeMapper; -use PhpParser\Node; use PhpParser\Node\Identifier; use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\Accessory\OversizedArrayType; @@ -30,7 +29,7 @@ final class OversizedArrayTypeMapper implements TypeMapperInterface * @param TypeKind::* $typeKind * @param OversizedArrayType $type */ - public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node + public function mapToPhpParserNode(Type $type, string $typeKind) : Identifier { return new Identifier('array'); } diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ParentStaticTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ParentStaticTypeMapper.php index b2e5348731a..09bcf428c71 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/ParentStaticTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ParentStaticTypeMapper.php @@ -3,7 +3,6 @@ declare (strict_types=1); namespace Rector\PHPStanStaticTypeMapper\TypeMapper; -use PhpParser\Node; use PhpParser\Node\Name; use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\Type; @@ -29,7 +28,7 @@ final class ParentStaticTypeMapper implements TypeMapperInterface /** * @param ParentStaticType $type */ - public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node + public function mapToPhpParserNode(Type $type, string $typeKind) : Name { return new Name(ObjectReference::PARENT); } diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/SelfObjectTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/SelfObjectTypeMapper.php index 081442d3cd2..c8940ffcb2c 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/SelfObjectTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/SelfObjectTypeMapper.php @@ -3,7 +3,6 @@ declare (strict_types=1); namespace Rector\PHPStanStaticTypeMapper\TypeMapper; -use PhpParser\Node; use PhpParser\Node\Name; use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\Type; @@ -28,7 +27,7 @@ final class SelfObjectTypeMapper implements TypeMapperInterface /** * @param SelfObjectType $type */ - public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node + public function mapToPhpParserNode(Type $type, string $typeKind) : Name { return new Name('self'); } diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/StaticTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/StaticTypeMapper.php index 1e3cb5a58fb..20211793def 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/StaticTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/StaticTypeMapper.php @@ -3,7 +3,6 @@ declare (strict_types=1); namespace Rector\PHPStanStaticTypeMapper\TypeMapper; -use PhpParser\Node; use PhpParser\Node\Name; use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\StaticType; @@ -24,9 +23,8 @@ final class StaticTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; @@ -45,7 +43,7 @@ final class StaticTypeMapper implements TypeMapperInterface /** * @param SimpleStaticType|StaticType $type */ - public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node + public function mapToPhpParserNode(Type $type, string $typeKind) : Name { if ($type instanceof SelfStaticType) { return new Name(ObjectReference::SELF); diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/StrictMixedTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/StrictMixedTypeMapper.php index 9539d083b82..de16059b0e3 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/StrictMixedTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/StrictMixedTypeMapper.php @@ -19,9 +19,8 @@ final class StrictMixedTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @var string */ diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/StringTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/StringTypeMapper.php index 52271bd92db..ef32b4cbb7b 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/StringTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/StringTypeMapper.php @@ -18,9 +18,8 @@ final class StringTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ThisTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ThisTypeMapper.php index fc4f16fa3d0..9ea3c46e337 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/ThisTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ThisTypeMapper.php @@ -28,7 +28,7 @@ final class ThisTypeMapper implements TypeMapperInterface /** * @param ThisType $type */ - public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node + public function mapToPhpParserNode(Type $type, string $typeKind) : Node { return new Name('self'); } diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/TypeWithClassNameTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/TypeWithClassNameTypeMapper.php index 1db83b2c67e..49e74b23471 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/TypeWithClassNameTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/TypeWithClassNameTypeMapper.php @@ -18,9 +18,8 @@ final class TypeWithClassNameTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php index 8f478b14bfa..f0a14cdd31e 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php @@ -29,13 +29,9 @@ final class UnionTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; - /** - * @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper - */ - private $phpStanStaticTypeMapper; + private PhpVersionProvider $phpVersionProvider; + private PHPStanStaticTypeMapper $phpStanStaticTypeMapper; public function __construct(PhpVersionProvider $phpVersionProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/VoidTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/VoidTypeMapper.php index e640706d9f0..02ef12ae6f2 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/VoidTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/VoidTypeMapper.php @@ -19,9 +19,8 @@ final class VoidTypeMapper implements TypeMapperInterface { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @var string */ diff --git a/src/Parallel/Application/ParallelFileProcessor.php b/src/Parallel/Application/ParallelFileProcessor.php index 325b196a0d3..943f5052df9 100644 --- a/src/Parallel/Application/ParallelFileProcessor.php +++ b/src/Parallel/Application/ParallelFileProcessor.php @@ -37,9 +37,8 @@ final class ParallelFileProcessor { /** * @readonly - * @var \Rector\Parallel\Command\WorkerCommandLineFactory */ - private $workerCommandLineFactory; + private WorkerCommandLineFactory $workerCommandLineFactory; /** * @var int */ diff --git a/src/Parallel/Command/WorkerCommandLineFactory.php b/src/Parallel/Command/WorkerCommandLineFactory.php index 971450bb57a..1445938624e 100644 --- a/src/Parallel/Command/WorkerCommandLineFactory.php +++ b/src/Parallel/Command/WorkerCommandLineFactory.php @@ -18,14 +18,12 @@ final class WorkerCommandLineFactory { /** * @readonly - * @var \Symplify\EasyParallel\Reflection\CommandFromReflectionFactory */ - private $commandFromReflectionFactory; + private CommandFromReflectionFactory $commandFromReflectionFactory; /** * @readonly - * @var \Rector\FileSystem\FilePathHelper */ - private $filePathHelper; + private FilePathHelper $filePathHelper; /** * @var string */ diff --git a/src/Php/PhpVersionResolver/ComposerJsonPhpVersionResolver.php b/src/Php/PhpVersionResolver/ComposerJsonPhpVersionResolver.php index 9537fd6f25b..ad1725353fd 100644 --- a/src/Php/PhpVersionResolver/ComposerJsonPhpVersionResolver.php +++ b/src/Php/PhpVersionResolver/ComposerJsonPhpVersionResolver.php @@ -16,7 +16,7 @@ final class ComposerJsonPhpVersionResolver /** * @var array */ - private static $cachedPhpVersions = []; + private static array $cachedPhpVersions = []; /** * @return PhpVersion::* */ diff --git a/src/Php/PolyfillPackagesProvider.php b/src/Php/PolyfillPackagesProvider.php index fc9d6459bd6..dfe29931c2c 100644 --- a/src/Php/PolyfillPackagesProvider.php +++ b/src/Php/PolyfillPackagesProvider.php @@ -43,8 +43,6 @@ final class PolyfillPackagesProvider */ private function filterPolyfillPackages(array $require) : array { - return \array_filter(\array_keys($require), static function (string $packageName) : bool { - return \strncmp($packageName, 'symfony/polyfill-', \strlen('symfony/polyfill-')) === 0; - }); + return \array_filter(\array_keys($require), static fn(string $packageName): bool => \strncmp($packageName, 'symfony/polyfill-', \strlen('symfony/polyfill-')) === 0); } } diff --git a/src/PhpAttribute/AnnotationToAttributeMapper.php b/src/PhpAttribute/AnnotationToAttributeMapper.php index af74828e676..235ff3cdcfd 100644 --- a/src/PhpAttribute/AnnotationToAttributeMapper.php +++ b/src/PhpAttribute/AnnotationToAttributeMapper.php @@ -22,7 +22,7 @@ final class AnnotationToAttributeMapper * @var AnnotationToAttributeMapperInterface[] * @readonly */ - private $annotationToAttributeMappers; + private array $annotationToAttributeMappers; /** * @param AnnotationToAttributeMapperInterface[] $annotationToAttributeMappers */ diff --git a/src/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php b/src/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php index 2c921f395ed..b2d656ba4bb 100644 --- a/src/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php +++ b/src/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php @@ -5,7 +5,7 @@ namespace Rector\PhpAttribute\AnnotationToAttributeMapper; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Name; use PhpParser\Node\Scalar\String_; @@ -21,13 +21,9 @@ final class ArrayAnnotationToAttributeMapper implements AnnotationToAttributeMap { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; - /** - * @var \Rector\PhpAttribute\AnnotationToAttributeMapper - */ - private $annotationToAttributeMapper; + private ValueResolver $valueResolver; + private AnnotationToAttributeMapper $annotationToAttributeMapper; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/src/PhpAttribute/AnnotationToAttributeMapper/ArrayItemNodeAnnotationToAttributeMapper.php b/src/PhpAttribute/AnnotationToAttributeMapper/ArrayItemNodeAnnotationToAttributeMapper.php index 57427365914..715ab1be3ef 100644 --- a/src/PhpAttribute/AnnotationToAttributeMapper/ArrayItemNodeAnnotationToAttributeMapper.php +++ b/src/PhpAttribute/AnnotationToAttributeMapper/ArrayItemNodeAnnotationToAttributeMapper.php @@ -4,7 +4,7 @@ declare (strict_types=1); namespace Rector\PhpAttribute\AnnotationToAttributeMapper; use PhpParser\Node\Expr; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Scalar\String_; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode; @@ -20,10 +20,7 @@ use RectorPrefix202411\Webmozart\Assert\InvalidArgumentException; */ final class ArrayItemNodeAnnotationToAttributeMapper implements AnnotationToAttributeMapperInterface { - /** - * @var \Rector\PhpAttribute\AnnotationToAttributeMapper - */ - private $annotationToAttributeMapper; + private AnnotationToAttributeMapper $annotationToAttributeMapper; /** * Avoid circular reference */ @@ -41,7 +38,7 @@ final class ArrayItemNodeAnnotationToAttributeMapper implements AnnotationToAttr /** * @param ArrayItemNode $arrayItemNode */ - public function map($arrayItemNode) : Expr + public function map($arrayItemNode) : ArrayItem { $valueExpr = $this->annotationToAttributeMapper->map($arrayItemNode->value); if ($valueExpr === DocTagNodeState::REMOVE_ARRAY) { diff --git a/src/PhpAttribute/AnnotationToAttributeMapper/ClassConstFetchAnnotationToAttributeMapper.php b/src/PhpAttribute/AnnotationToAttributeMapper/ClassConstFetchAnnotationToAttributeMapper.php index b3481fe7c0a..02230c6e73c 100644 --- a/src/PhpAttribute/AnnotationToAttributeMapper/ClassConstFetchAnnotationToAttributeMapper.php +++ b/src/PhpAttribute/AnnotationToAttributeMapper/ClassConstFetchAnnotationToAttributeMapper.php @@ -28,7 +28,7 @@ final class ClassConstFetchAnnotationToAttributeMapper implements AnnotationToAt /** * @param string $value */ - public function map($value) : \PhpParser\Node\Expr + public function map($value) : ClassConstFetch { [$class, $constant] = \explode('::', $value); return new ClassConstFetch(new Name($class), $constant); diff --git a/src/PhpAttribute/AnnotationToAttributeMapper/CurlyListNodeAnnotationToAttributeMapper.php b/src/PhpAttribute/AnnotationToAttributeMapper/CurlyListNodeAnnotationToAttributeMapper.php index 3c442f96a00..ba5f34de7ca 100644 --- a/src/PhpAttribute/AnnotationToAttributeMapper/CurlyListNodeAnnotationToAttributeMapper.php +++ b/src/PhpAttribute/AnnotationToAttributeMapper/CurlyListNodeAnnotationToAttributeMapper.php @@ -3,9 +3,9 @@ declare (strict_types=1); namespace Rector\PhpAttribute\AnnotationToAttributeMapper; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\ArrayItem; use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode; use Rector\PhpAttribute\AnnotationToAttributeMapper; use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface; @@ -16,10 +16,7 @@ use RectorPrefix202411\Webmozart\Assert\Assert; */ final class CurlyListNodeAnnotationToAttributeMapper implements AnnotationToAttributeMapperInterface { - /** - * @var \Rector\PhpAttribute\AnnotationToAttributeMapper - */ - private $annotationToAttributeMapper; + private AnnotationToAttributeMapper $annotationToAttributeMapper; /** * Avoid circular reference */ @@ -37,7 +34,7 @@ final class CurlyListNodeAnnotationToAttributeMapper implements AnnotationToAttr /** * @param CurlyListNode $value */ - public function map($value) : \PhpParser\Node\Expr + public function map($value) : Array_ { $arrayItems = []; $arrayItemNodes = $value->getValues(); @@ -59,7 +56,7 @@ final class CurlyListNodeAnnotationToAttributeMapper implements AnnotationToAttr $arrayItems[] = $valueExpr; continue; } - $valueExpr->key = new LNumber($arrayItemNodeKey); + $valueExpr->key = new Int_($arrayItemNodeKey); $arrayItems[] = $valueExpr; } return new Array_($arrayItems); diff --git a/src/PhpAttribute/AnnotationToAttributeMapper/DoctrineAnnotationAnnotationToAttributeMapper.php b/src/PhpAttribute/AnnotationToAttributeMapper/DoctrineAnnotationAnnotationToAttributeMapper.php index 32d51d845d7..2fdfe1fc296 100644 --- a/src/PhpAttribute/AnnotationToAttributeMapper/DoctrineAnnotationAnnotationToAttributeMapper.php +++ b/src/PhpAttribute/AnnotationToAttributeMapper/DoctrineAnnotationAnnotationToAttributeMapper.php @@ -20,18 +20,13 @@ final class DoctrineAnnotationAnnotationToAttributeMapper implements AnnotationT { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\PhpAttribute\AttributeArrayNameInliner */ - private $attributeArrayNameInliner; - /** - * @var \Rector\PhpAttribute\AnnotationToAttributeMapper - */ - private $annotationToAttributeMapper; + private AttributeArrayNameInliner $attributeArrayNameInliner; + private AnnotationToAttributeMapper $annotationToAttributeMapper; public function __construct(PhpVersionProvider $phpVersionProvider, AttributeArrayNameInliner $attributeArrayNameInliner) { $this->phpVersionProvider = $phpVersionProvider; @@ -57,7 +52,7 @@ final class DoctrineAnnotationAnnotationToAttributeMapper implements AnnotationT /** * @param DoctrineAnnotationTagValueNode $value */ - public function map($value) : \PhpParser\Node\Expr + public function map($value) : New_ { $annotationShortName = $this->resolveAnnotationName($value); $values = $value->getValues(); diff --git a/src/PhpAttribute/AnnotationToAttributeMapper/StringAnnotationToAttributeMapper.php b/src/PhpAttribute/AnnotationToAttributeMapper/StringAnnotationToAttributeMapper.php index 07a88f142fc..58770191dbb 100644 --- a/src/PhpAttribute/AnnotationToAttributeMapper/StringAnnotationToAttributeMapper.php +++ b/src/PhpAttribute/AnnotationToAttributeMapper/StringAnnotationToAttributeMapper.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace Rector\PhpAttribute\AnnotationToAttributeMapper; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface; @@ -38,7 +38,7 @@ final class StringAnnotationToAttributeMapper implements AnnotationToAttributeMa } // number as string to number if (\is_numeric($value) && \strlen((string) (int) $value) === \strlen($value)) { - return LNumber::fromString($value); + return Int_::fromString($value); } if (\strpos($value, "'") !== \false && \strpos($value, "\n") === \false) { $kind = String_::KIND_DOUBLE_QUOTED; diff --git a/src/PhpAttribute/AttributeArrayNameInliner.php b/src/PhpAttribute/AttributeArrayNameInliner.php index cb9fb8866f5..44f738bbb17 100644 --- a/src/PhpAttribute/AttributeArrayNameInliner.php +++ b/src/PhpAttribute/AttributeArrayNameInliner.php @@ -3,14 +3,13 @@ declare (strict_types=1); namespace Rector\PhpAttribute; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Arg; -use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Float_; use PhpParser\Node\Scalar\String_; -use Rector\Exception\NotImplementedYetException; use RectorPrefix202411\Webmozart\Assert\Assert; final class AttributeArrayNameInliner { @@ -52,27 +51,16 @@ final class AttributeArrayNameInliner private function inlineArray(array $args) : array { Assert::allIsAOf($args, Arg::class); - $newArgs = []; foreach ($args as $arg) { - // matching top root array key - if ($arg->value instanceof ArrayItem) { - $arrayItem = $arg->value; - if ($arrayItem->key instanceof LNumber) { - $newArgs[] = new Arg($arrayItem->value); - } elseif ($arrayItem->key instanceof String_) { - $arrayItemString = $arrayItem->key; - $newArgs[] = new Arg($arrayItem->value, \false, \false, [], new Identifier($arrayItemString->value)); - } elseif (!$arrayItem->key instanceof Expr) { - // silent key - $newArgs[] = new Arg($arrayItem->value); + if ($arg->value instanceof String_ && \is_numeric($arg->value->value)) { + // use equal over identical on purpose to verify if it is an integer + if ((float) $arg->value->value == (int) $arg->value->value) { + $arg->value = new Int_((int) $arg->value->value); } else { - throw new NotImplementedYetException(\get_debug_type($arrayItem->key)); + $arg->value = new Float_((float) $arg->value->value); } } } - if ($newArgs !== []) { - return $newArgs; - } return $args; } } diff --git a/src/PhpAttribute/Contract/AnnotationToAttributeMapperInterface.php b/src/PhpAttribute/Contract/AnnotationToAttributeMapperInterface.php index 6d337187c6e..77719c2af6c 100644 --- a/src/PhpAttribute/Contract/AnnotationToAttributeMapperInterface.php +++ b/src/PhpAttribute/Contract/AnnotationToAttributeMapperInterface.php @@ -3,7 +3,7 @@ declare (strict_types=1); namespace Rector\PhpAttribute\Contract; -use PhpParser\Node\Expr; +use PhpParser\Node; /** * @template T as mixed */ @@ -16,5 +16,5 @@ interface AnnotationToAttributeMapperInterface /** * @param T $value */ - public function map($value) : Expr; + public function map($value) : Node; } diff --git a/src/PhpAttribute/NodeFactory/AnnotationToAttributeIntegerValueCaster.php b/src/PhpAttribute/NodeFactory/AnnotationToAttributeIntegerValueCaster.php index b53092e76e0..4cf260d33e1 100644 --- a/src/PhpAttribute/NodeFactory/AnnotationToAttributeIntegerValueCaster.php +++ b/src/PhpAttribute/NodeFactory/AnnotationToAttributeIntegerValueCaster.php @@ -3,9 +3,10 @@ declare (strict_types=1); namespace Rector\PhpAttribute\NodeFactory; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Arg; -use PhpParser\Node\Expr\ArrayItem; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\ArrayItem; +use PhpParser\Node\Expr\Array_; use PhpParser\Node\Scalar\String_; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ParameterReflection; @@ -19,9 +20,8 @@ final class AnnotationToAttributeIntegerValueCaster { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(ReflectionProvider $reflectionProvider) { $this->reflectionProvider = $reflectionProvider; @@ -42,10 +42,13 @@ final class AnnotationToAttributeIntegerValueCaster $parameterReflections = $this->resolveConstructorParameterReflections($attributeClassReflection); foreach ($parameterReflections as $parameterReflection) { foreach ($args as $arg) { - if (!$arg->value instanceof ArrayItem) { + if (!$arg->value instanceof Array_) { + continue; + } + $arrayItem = \current($arg->value->items) ?: null; + if (!$arrayItem instanceof ArrayItem) { continue; } - $arrayItem = $arg->value; if (!$arrayItem->key instanceof String_) { continue; } @@ -64,7 +67,7 @@ final class AnnotationToAttributeIntegerValueCaster if (!\is_numeric($valueString->value)) { continue; } - $arrayItem->value = new LNumber((int) $valueString->value); + $arrayItem->value = new Int_((int) $valueString->value); } } } @@ -89,7 +92,7 @@ final class AnnotationToAttributeIntegerValueCaster private function resolveConstructorParameterReflections(ClassReflection $classReflection) : array { $extendedMethodReflection = $classReflection->getConstructor(); - $parametersAcceptorWithPhpDocs = ParametersAcceptorSelector::combineAcceptors($extendedMethodReflection->getVariants()); - return $parametersAcceptorWithPhpDocs->getParameters(); + $extendedParametersAcceptor = ParametersAcceptorSelector::combineAcceptors($extendedMethodReflection->getVariants()); + return $extendedParametersAcceptor->getParameters(); } } diff --git a/src/PhpAttribute/NodeFactory/AttributeNameFactory.php b/src/PhpAttribute/NodeFactory/AttributeNameFactory.php index e87ae41aa1d..cbfe6b8dbde 100644 --- a/src/PhpAttribute/NodeFactory/AttributeNameFactory.php +++ b/src/PhpAttribute/NodeFactory/AttributeNameFactory.php @@ -14,9 +14,8 @@ final class AttributeNameFactory { /** * @readonly - * @var \Rector\PhpAttribute\UseAliasNameMatcher */ - private $useAliasNameMatcher; + private UseAliasNameMatcher $useAliasNameMatcher; public function __construct(UseAliasNameMatcher $useAliasNameMatcher) { $this->useAliasNameMatcher = $useAliasNameMatcher; diff --git a/src/PhpAttribute/NodeFactory/NamedArgsFactory.php b/src/PhpAttribute/NodeFactory/NamedArgsFactory.php index 56be4debc84..4610418383a 100644 --- a/src/PhpAttribute/NodeFactory/NamedArgsFactory.php +++ b/src/PhpAttribute/NodeFactory/NamedArgsFactory.php @@ -3,24 +3,15 @@ declare (strict_types=1); namespace Rector\PhpAttribute\NodeFactory; -use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\BuilderHelpers; use PhpParser\Node\Arg; use PhpParser\Node\Expr; -use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; -use PhpParser\Node\Expr\ClassConstFetch; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Identifier; -use PhpParser\Node\Name; use PhpParser\Node\Scalar\String_; use Rector\NodeTypeResolver\Node\AttributeKey; final class NamedArgsFactory { - /** - * @see https://regex101.com/r/1bJR0J/1 - * @var string - */ - private const CLASS_CONST_REGEX = '#(?\\w+)::(?\\w+)#'; /** * @param array $values * @return Arg[] @@ -29,11 +20,16 @@ final class NamedArgsFactory { $args = []; foreach ($values as $key => $argValue) { - $expr = BuilderHelpers::normalizeValue($argValue); - $this->normalizeArrayWithConstFetchKey($expr); $name = null; + if ($argValue instanceof ArrayItem) { + if ($argValue->key instanceof String_) { + $name = new Identifier($argValue->key->value); + } + $argValue = $argValue->value; + } + $expr = BuilderHelpers::normalizeValue($argValue); // for named arguments - if (\is_string($key)) { + if (!$name instanceof Identifier && \is_string($key)) { $name = new Identifier($key); } $this->normalizeStringDoubleQuote($expr); @@ -55,28 +51,4 @@ final class NamedArgsFactory } $expr->setAttribute(AttributeKey::KIND, String_::KIND_DOUBLE_QUOTED); } - private function normalizeArrayWithConstFetchKey(Expr $expr) : void - { - if (!$expr instanceof Array_) { - return; - } - foreach ($expr->items as $arrayItem) { - if (!$arrayItem instanceof ArrayItem) { - continue; - } - if (!$arrayItem->key instanceof String_) { - continue; - } - $string = $arrayItem->key; - $match = Strings::match($string->value, self::CLASS_CONST_REGEX); - if ($match === null) { - continue; - } - /** @var string $class */ - $class = $match['class']; - /** @var string $constant */ - $constant = $match['constant']; - $arrayItem->key = new ClassConstFetch(new Name($class), $constant); - } - } } diff --git a/src/PhpAttribute/NodeFactory/PhpAttributeGroupFactory.php b/src/PhpAttribute/NodeFactory/PhpAttributeGroupFactory.php index 8539249b317..1dec2addd7d 100644 --- a/src/PhpAttribute/NodeFactory/PhpAttributeGroupFactory.php +++ b/src/PhpAttribute/NodeFactory/PhpAttributeGroupFactory.php @@ -8,7 +8,7 @@ use PhpParser\Node\Attribute; use PhpParser\Node\AttributeGroup; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Scalar\String_; @@ -27,36 +27,31 @@ final class PhpAttributeGroupFactory { /** * @readonly - * @var \Rector\PhpAttribute\AnnotationToAttributeMapper */ - private $annotationToAttributeMapper; + private AnnotationToAttributeMapper $annotationToAttributeMapper; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\AttributeNameFactory */ - private $attributeNameFactory; + private \Rector\PhpAttribute\NodeFactory\AttributeNameFactory $attributeNameFactory; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\NamedArgsFactory */ - private $namedArgsFactory; + private \Rector\PhpAttribute\NodeFactory\NamedArgsFactory $namedArgsFactory; /** * @readonly - * @var \Rector\PhpAttribute\AttributeArrayNameInliner */ - private $attributeArrayNameInliner; + private \Rector\PhpAttribute\NodeFactory\AnnotationToAttributeIntegerValueCaster $annotationToAttributeIntegerValueCaster; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\AnnotationToAttributeIntegerValueCaster */ - private $annotationToAttributeIntegerValueCaster; - public function __construct(AnnotationToAttributeMapper $annotationToAttributeMapper, \Rector\PhpAttribute\NodeFactory\AttributeNameFactory $attributeNameFactory, \Rector\PhpAttribute\NodeFactory\NamedArgsFactory $namedArgsFactory, AttributeArrayNameInliner $attributeArrayNameInliner, \Rector\PhpAttribute\NodeFactory\AnnotationToAttributeIntegerValueCaster $annotationToAttributeIntegerValueCaster) + private AttributeArrayNameInliner $attributeArrayNameInliner; + public function __construct(AnnotationToAttributeMapper $annotationToAttributeMapper, \Rector\PhpAttribute\NodeFactory\AttributeNameFactory $attributeNameFactory, \Rector\PhpAttribute\NodeFactory\NamedArgsFactory $namedArgsFactory, \Rector\PhpAttribute\NodeFactory\AnnotationToAttributeIntegerValueCaster $annotationToAttributeIntegerValueCaster, AttributeArrayNameInliner $attributeArrayNameInliner) { $this->annotationToAttributeMapper = $annotationToAttributeMapper; $this->attributeNameFactory = $attributeNameFactory; $this->namedArgsFactory = $namedArgsFactory; - $this->attributeArrayNameInliner = $attributeArrayNameInliner; $this->annotationToAttributeIntegerValueCaster = $annotationToAttributeIntegerValueCaster; + $this->attributeArrayNameInliner = $attributeArrayNameInliner; } public function createFromSimpleTag(AnnotationToAttribute $annotationToAttribute) : AttributeGroup { diff --git a/src/PhpAttribute/NodeFactory/PhpNestedAttributeGroupFactory.php b/src/PhpAttribute/NodeFactory/PhpNestedAttributeGroupFactory.php index 58ea15e9aed..311da7c6f4b 100644 --- a/src/PhpAttribute/NodeFactory/PhpNestedAttributeGroupFactory.php +++ b/src/PhpAttribute/NodeFactory/PhpNestedAttributeGroupFactory.php @@ -31,34 +31,28 @@ final class PhpNestedAttributeGroupFactory { /** * @readonly - * @var \Rector\PhpAttribute\AnnotationToAttributeMapper */ - private $annotationToAttributeMapper; + private AnnotationToAttributeMapper $annotationToAttributeMapper; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\AttributeNameFactory */ - private $attributeNameFactory; + private \Rector\PhpAttribute\NodeFactory\AttributeNameFactory $attributeNameFactory; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\NamedArgsFactory */ - private $namedArgsFactory; + private \Rector\PhpAttribute\NodeFactory\NamedArgsFactory $namedArgsFactory; /** * @readonly - * @var \Rector\PhpAttribute\AttributeArrayNameInliner */ - private $attributeArrayNameInliner; + private AttributeArrayNameInliner $attributeArrayNameInliner; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\TokenIteratorFactory */ - private $tokenIteratorFactory; + private TokenIteratorFactory $tokenIteratorFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser */ - private $staticDoctrineAnnotationParser; + private StaticDoctrineAnnotationParser $staticDoctrineAnnotationParser; public function __construct(AnnotationToAttributeMapper $annotationToAttributeMapper, \Rector\PhpAttribute\NodeFactory\AttributeNameFactory $attributeNameFactory, \Rector\PhpAttribute\NodeFactory\NamedArgsFactory $namedArgsFactory, AttributeArrayNameInliner $attributeArrayNameInliner, TokenIteratorFactory $tokenIteratorFactory, StaticDoctrineAnnotationParser $staticDoctrineAnnotationParser) { $this->annotationToAttributeMapper = $annotationToAttributeMapper; diff --git a/src/PhpAttribute/UseAliasNameMatcher.php b/src/PhpAttribute/UseAliasNameMatcher.php index c4de6845972..730d83b33df 100644 --- a/src/PhpAttribute/UseAliasNameMatcher.php +++ b/src/PhpAttribute/UseAliasNameMatcher.php @@ -3,9 +3,9 @@ declare (strict_types=1); namespace Rector\PhpAttribute; +use PhpParser\Node\UseItem; use PhpParser\Node\Identifier; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\Php80\Contract\ValueObject\AnnotationToAttributeInterface; use Rector\PhpAttribute\ValueObject\UseAliasMetadata; @@ -24,7 +24,7 @@ final class UseAliasNameMatcher foreach ($use->uses as $useUse) { // we need to use original use statement $originalUseUseNode = $useUse->getAttribute(AttributeKey::ORIGINAL_NODE); - if (!$originalUseUseNode instanceof UseUse) { + if (!$originalUseUseNode instanceof UseItem) { continue; } if (!$originalUseUseNode->alias instanceof Identifier) { diff --git a/src/PhpAttribute/ValueObject/UseAliasMetadata.php b/src/PhpAttribute/ValueObject/UseAliasMetadata.php index 8f020147c71..b8ca343e1e6 100644 --- a/src/PhpAttribute/ValueObject/UseAliasMetadata.php +++ b/src/PhpAttribute/ValueObject/UseAliasMetadata.php @@ -3,29 +3,26 @@ declare (strict_types=1); namespace Rector\PhpAttribute\ValueObject; -use PhpParser\Node\Stmt\UseUse; +use PhpParser\Node\UseItem; final class UseAliasMetadata { /** * @readonly - * @var string */ - private $shortAttributeName; + private string $shortAttributeName; /** * @readonly - * @var string */ - private $useImportName; + private string $useImportName; /** * @readonly - * @var \PhpParser\Node\Stmt\UseUse */ - private $useUse; - public function __construct(string $shortAttributeName, string $useImportName, UseUse $useUse) + private UseItem $useItem; + public function __construct(string $shortAttributeName, string $useImportName, UseItem $useItem) { $this->shortAttributeName = $shortAttributeName; $this->useImportName = $useImportName; - $this->useUse = $useUse; + $this->useItem = $useItem; } public function getShortAttributeName() : string { @@ -35,8 +32,8 @@ final class UseAliasMetadata { return $this->useImportName; } - public function getUseUse() : UseUse + public function getUseUse() : UseItem { - return $this->useUse; + return $this->useItem; } } diff --git a/src/PhpDocParser/NodeVisitor/CallableNodeVisitor.php b/src/PhpDocParser/NodeVisitor/CallableNodeVisitor.php index 826426a3b0b..5132d52436a 100644 --- a/src/PhpDocParser/NodeVisitor/CallableNodeVisitor.php +++ b/src/PhpDocParser/NodeVisitor/CallableNodeVisitor.php @@ -3,11 +3,11 @@ declare (strict_types=1); namespace Rector\PhpDocParser\NodeVisitor; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; -use PhpParser\NodeTraverser; use PhpParser\NodeVisitorAbstract; final class CallableNodeVisitor extends NodeVisitorAbstract { @@ -15,14 +15,11 @@ final class CallableNodeVisitor extends NodeVisitorAbstract * @var callable(Node): (int|Node|null|Node[]) */ private $callable; - /** - * @var int|null - */ - private $nodeIdToRemove; + private ?int $nodeIdToRemove = null; /** * @var array */ - private $nodesToReturn = []; + private array $nodesToReturn = []; /** * @param callable(Node $node): (int|Node|null|Node[]) $callable */ @@ -39,7 +36,7 @@ final class CallableNodeVisitor extends NodeVisitorAbstract $callable = $this->callable; /** @var int|Node|null|Node[] $newNode */ $newNode = $callable($node); - if ($newNode === NodeTraverser::REMOVE_NODE) { + if ($newNode === NodeVisitor::REMOVE_NODE) { $this->nodeIdToRemove = \spl_object_id($originalNode); return $originalNode; } @@ -60,7 +57,7 @@ final class CallableNodeVisitor extends NodeVisitorAbstract { if ($this->nodeIdToRemove !== null && $this->nodeIdToRemove === \spl_object_id($node)) { $this->nodeIdToRemove = null; - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } if ($this->nodesToReturn === []) { return $node; diff --git a/src/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php b/src/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php index 1d30c32997a..e9975f8432d 100644 --- a/src/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php +++ b/src/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php @@ -61,11 +61,11 @@ final class PhpDocNodeTraverser /** * @var bool Whether traversal should be stopped */ - private $stopTraversal = \false; + private bool $stopTraversal = \false; /** * @var PhpDocNodeVisitorInterface[] */ - private $phpDocNodeVisitors = []; + private array $phpDocNodeVisitors = []; public function addPhpDocNodeVisitor(PhpDocNodeVisitorInterface $phpDocNodeVisitor) : void { $this->phpDocNodeVisitors[] = $phpDocNodeVisitor; @@ -119,7 +119,7 @@ final class PhpDocNodeTraverser } elseif ($return === self::STOP_TRAVERSAL) { $this->stopTraversal = \true; } elseif ($return === self::NODE_REMOVE) { - $subNode = null; + unset($subNode); continue 2; } else { throw new InvalidTraverseException('enterNode() returned invalid value of type ' . \gettype($return)); diff --git a/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/CallablePhpDocNodeVisitor.php b/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/CallablePhpDocNodeVisitor.php index 751b87ca241..f87254ee38a 100644 --- a/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/CallablePhpDocNodeVisitor.php +++ b/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/CallablePhpDocNodeVisitor.php @@ -8,9 +8,8 @@ final class CallablePhpDocNodeVisitor extends \Rector\PhpDocParser\PhpDocParser\ { /** * @readonly - * @var string|null */ - private $docContent; + private ?string $docContent; /** * @var callable(Node, string|null): (int|null|Node) */ diff --git a/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/ParentConnectingPhpDocNodeVisitor.php b/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/ParentConnectingPhpDocNodeVisitor.php index 0c559fe15ca..4048b84bf42 100644 --- a/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/ParentConnectingPhpDocNodeVisitor.php +++ b/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/ParentConnectingPhpDocNodeVisitor.php @@ -17,7 +17,7 @@ final class ParentConnectingPhpDocNodeVisitor extends \Rector\PhpDocParser\PhpDo /** * @var Node[] */ - private $stack = []; + private array $stack = []; public function beforeTraverse(Node $node) : void { $this->stack = [$node]; diff --git a/src/PhpDocParser/PhpParser/SmartPhpParser.php b/src/PhpDocParser/PhpParser/SmartPhpParser.php index 35fe3b68b60..1741a98629d 100644 --- a/src/PhpDocParser/PhpParser/SmartPhpParser.php +++ b/src/PhpDocParser/PhpParser/SmartPhpParser.php @@ -14,9 +14,8 @@ final class SmartPhpParser { /** * @readonly - * @var \PHPStan\Parser\Parser */ - private $parser; + private Parser $parser; public function __construct(Parser $parser) { $this->parser = $parser; diff --git a/src/PhpDocParser/PhpParser/SmartPhpParserFactory.php b/src/PhpDocParser/PhpParser/SmartPhpParserFactory.php index afce3589a3e..f3e2314d3bb 100644 --- a/src/PhpDocParser/PhpParser/SmartPhpParserFactory.php +++ b/src/PhpDocParser/PhpParser/SmartPhpParserFactory.php @@ -3,12 +3,13 @@ declare (strict_types=1); namespace Rector\PhpDocParser\PhpParser; -use PhpParser\Lexer\Emulative; use PhpParser\NodeVisitor\NameResolver; use PhpParser\Parser; use PhpParser\ParserFactory; use PHPStan\Parser\CachedParser; use PHPStan\Parser\SimpleParser; +use PHPStan\Parser\VariadicFunctionsVisitor; +use PHPStan\Parser\VariadicMethodsVisitor; /** * Based on PHPStan-based PHP-Parser best practices: * @@ -29,13 +30,14 @@ final class SmartPhpParserFactory private function createNativePhpParser() : Parser { $parserFactory = new ParserFactory(); - $lexerEmulative = new Emulative(['usedAttributes' => ['comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos']]); - return $parserFactory->create(ParserFactory::PREFER_PHP7, $lexerEmulative); + return $parserFactory->createForNewestSupportedVersion(); } private function createPHPStanParser(Parser $parser) : CachedParser { $nameResolver = new NameResolver(); - $simpleParser = new SimpleParser($parser, $nameResolver); + $variadicMethodsVisitor = new VariadicMethodsVisitor(); + $variadicFunctionsVisitor = new VariadicFunctionsVisitor(); + $simpleParser = new SimpleParser($parser, $nameResolver, $variadicMethodsVisitor, $variadicFunctionsVisitor); return new CachedParser($simpleParser, 1024); } } diff --git a/src/PhpParser/AstResolver.php b/src/PhpParser/AstResolver.php index 6b5bea1d2d2..7ffb014d961 100644 --- a/src/PhpParser/AstResolver.php +++ b/src/PhpParser/AstResolver.php @@ -43,46 +43,39 @@ final class AstResolver { /** * @readonly - * @var \Rector\PhpDocParser\PhpParser\SmartPhpParser */ - private $smartPhpParser; + private SmartPhpParser $smartPhpParser; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeScopeAndMetadataDecorator */ - private $nodeScopeAndMetadataDecorator; + private NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\Reflection\MethodReflectionResolver */ - private $methodReflectionResolver; + private MethodReflectionResolver $methodReflectionResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * Parsing files is very heavy performance, so this will help to leverage it * The value can be also null, when no statements could be parsed from the file. * * @var array */ - private $parsedFileNodes = []; + private array $parsedFileNodes = []; public function __construct(SmartPhpParser $smartPhpParser, NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator, NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider, NodeTypeResolver $nodeTypeResolver, MethodReflectionResolver $methodReflectionResolver, BetterNodeFinder $betterNodeFinder) { $this->smartPhpParser = $smartPhpParser; diff --git a/src/PhpParser/Comparing/NodeComparator.php b/src/PhpParser/Comparing/NodeComparator.php index 40724ecb227..1a63f72c1bb 100644 --- a/src/PhpParser/Comparing/NodeComparator.php +++ b/src/PhpParser/Comparing/NodeComparator.php @@ -10,14 +10,12 @@ final class NodeComparator { /** * @readonly - * @var \Rector\Comments\CommentRemover */ - private $commentRemover; + private CommentRemover $commentRemover; /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; public function __construct(CommentRemover $commentRemover, BetterStandardPrinter $betterStandardPrinter) { $this->commentRemover = $commentRemover; diff --git a/src/PhpParser/Node/AssignAndBinaryMap.php b/src/PhpParser/Node/AssignAndBinaryMap.php index b9187050ca1..6bf96db4223 100644 --- a/src/PhpParser/Node/AssignAndBinaryMap.php +++ b/src/PhpParser/Node/AssignAndBinaryMap.php @@ -46,9 +46,8 @@ final class AssignAndBinaryMap { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @var array, class-string> */ @@ -60,7 +59,7 @@ final class AssignAndBinaryMap /** * @var array, class-string> */ - private $binaryOpToAssignClasses = []; + private array $binaryOpToAssignClasses = []; public function __construct(NodeTypeResolver $nodeTypeResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/src/PhpParser/Node/BetterNodeFinder.php b/src/PhpParser/Node/BetterNodeFinder.php index 33a4c5287ae..64bf730d1e7 100644 --- a/src/PhpParser/Node/BetterNodeFinder.php +++ b/src/PhpParser/Node/BetterNodeFinder.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\PhpParser\Node; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\Variable; @@ -15,7 +16,6 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Return_; use PhpParser\NodeFinder; -use PhpParser\NodeTraverser; use Rector\NodeAnalyzer\ClassAnalyzer; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; @@ -27,24 +27,20 @@ final class BetterNodeFinder { /** * @readonly - * @var \PhpParser\NodeFinder */ - private $nodeFinder; + private NodeFinder $nodeFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; public function __construct(NodeFinder $nodeFinder, NodeNameResolver $nodeNameResolver, ClassAnalyzer $classAnalyzer, SimpleCallableNodeTraverser $simpleCallableNodeTraverser) { $this->nodeFinder = $nodeFinder; @@ -147,9 +143,7 @@ final class BetterNodeFinder public function findFirstNonAnonymousClass(array $nodes) : ?Node { // skip anonymous classes - return $this->findFirst($nodes, function (Node $node) : bool { - return $node instanceof Class_ && !$this->classAnalyzer->isAnonymousClass($node); - }); + return $this->findFirst($nodes, fn(Node $node): bool => $node instanceof Class_ && !$this->classAnalyzer->isAnonymousClass($node)); } /** * @param Node|Node[] $nodes @@ -172,12 +166,12 @@ final class BetterNodeFinder $isFoundNode = \false; $this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $functionLike->stmts, static function (Node $subNode) use($types, &$isFoundNode) : ?int { if ($subNode instanceof Class_ || $subNode instanceof FunctionLike) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } foreach ($types as $type) { if ($subNode instanceof $type) { $isFoundNode = \true; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } } return null; @@ -193,18 +187,17 @@ final class BetterNodeFinder $returns = []; $this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $functionLike->stmts, function (Node $subNode) use(&$returns) : ?int { if ($subNode instanceof Class_ || $subNode instanceof FunctionLike) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($subNode instanceof Yield_ || $subNode instanceof YieldFrom) { $returns = []; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } if ($subNode instanceof Return_) { $returns[] = $subNode; } return null; }); - Assert::allIsInstanceOf($returns, Return_::class); return $returns; } /** @@ -228,7 +221,7 @@ final class BetterNodeFinder $foundNodes = []; $this->simpleCallableNodeTraverser->traverseNodesWithCallable($nodes, static function (Node $subNode) use($types, &$foundNodes) : ?int { if ($subNode instanceof Class_ || $subNode instanceof FunctionLike) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } foreach ($types as $type) { if ($subNode instanceof $type) { @@ -271,9 +264,9 @@ final class BetterNodeFinder if ($subNode instanceof Class_ || $subNode instanceof FunctionLike) { if ($foundNode instanceof $subNode && $subNode === $foundNode) { $scopedNode = $subNode; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$foundNode instanceof $subNode) { return null; @@ -283,7 +276,7 @@ final class BetterNodeFinder $scopedFoundNode = $this->findFirst($subNode, $filter); if ($scopedFoundNode === $subNode) { $scopedNode = $subNode; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } return null; }); @@ -297,8 +290,6 @@ final class BetterNodeFinder private function findInstanceOfName($nodes, string $type, string $name) : ?Node { Assert::isAOf($type, Node::class); - return $this->nodeFinder->findFirst($nodes, function (Node $node) use($type, $name) : bool { - return $node instanceof $type && $this->nodeNameResolver->isName($node, $name); - }); + return $this->nodeFinder->findFirst($nodes, fn(Node $node): bool => $node instanceof $type && $this->nodeNameResolver->isName($node, $name)); } } diff --git a/src/PhpParser/Node/CustomNode/FileWithoutNamespace.php b/src/PhpParser/Node/CustomNode/FileWithoutNamespace.php index 6690128d1a4..8669080c5b7 100644 --- a/src/PhpParser/Node/CustomNode/FileWithoutNamespace.php +++ b/src/PhpParser/Node/CustomNode/FileWithoutNamespace.php @@ -13,7 +13,7 @@ final class FileWithoutNamespace extends Stmt implements StmtsAwareInterface /** * @var Stmt[] */ - public $stmts; + public array $stmts; /** * @param Stmt[] $stmts */ diff --git a/src/PhpParser/Node/NodeFactory.php b/src/PhpParser/Node/NodeFactory.php index e6b5bbaab9e..df8a3398e4b 100644 --- a/src/PhpParser/Node/NodeFactory.php +++ b/src/PhpParser/Node/NodeFactory.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\PhpParser\Node; +use PhpParser\Modifiers; use PhpParser\Builder\Method; use PhpParser\Builder\Param as ParamBuilder; use PhpParser\Builder\Property as PropertyBuilder; @@ -12,7 +13,7 @@ use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\BinaryOp\BooleanAnd; use PhpParser\Node\Expr\BinaryOp\BooleanOr; @@ -34,7 +35,6 @@ use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Param; use PhpParser\Node\Scalar; use PhpParser\Node\Scalar\String_; -use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Property; use PHPStan\Type\Type; @@ -55,29 +55,24 @@ final class NodeFactory { /** * @readonly - * @var \PhpParser\BuilderFactory */ - private $builderFactory; + private BuilderFactory $builderFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\NodeDecorator\PropertyTypeDecorator */ - private $propertyTypeDecorator; + private PropertyTypeDecorator $propertyTypeDecorator; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @var string */ @@ -131,6 +126,11 @@ final class NodeFactory */ public function createArgs(array $values) : array { + foreach ($values as $key => $value) { + if ($value instanceof ArrayItem) { + $values[$key] = $value->value; + } + } return $this->builderFactory->args($values); } /** @@ -274,7 +274,7 @@ final class NodeFactory } $param = $paramBuilder->getNode(); $propertyFlags = $propertyMetadata->getFlags(); - $param->flags = $propertyFlags !== 0 ? $propertyFlags : Class_::MODIFIER_PRIVATE; + $param->flags = $propertyFlags !== 0 ? $propertyFlags : Modifiers::PRIVATE; return $param; } public function createFalse() : ConstFetch diff --git a/src/PhpParser/Node/Value/ValueResolver.php b/src/PhpParser/Node/Value/ValueResolver.php index b815a34eaba..b51e322a551 100644 --- a/src/PhpParser/Node/Value/ValueResolver.php +++ b/src/PhpParser/Node/Value/ValueResolver.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\PhpParser\Node\Value; +use PHPStan\Type\Type; use PhpParser\ConstExprEvaluationException; use PhpParser\ConstExprEvaluator; use PhpParser\Node\Arg; @@ -10,13 +11,15 @@ use PhpParser\Node\Expr; use PhpParser\Node\Expr\BinaryOp\Concat; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\ConstFetch; +use PhpParser\Node\InterpolatedStringPart; use PhpParser\Node\Name; +use PhpParser\Node\Scalar\MagicConst\Class_; use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\Constant\ConstantArrayType; +use PHPStan\Type\Constant\ConstantStringType; use PHPStan\Type\ConstantScalarType; -use PHPStan\Type\ConstantType; use Rector\Enum\ObjectReference; use Rector\Exception\ShouldNotHappenException; use Rector\NodeAnalyzer\ConstFetchAnalyzer; @@ -35,38 +38,29 @@ final class ValueResolver { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\ConstFetchAnalyzer */ - private $constFetchAnalyzer; + private ConstFetchAnalyzer $constFetchAnalyzer; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\Reflection\ClassReflectionAnalyzer */ - private $classReflectionAnalyzer; - /** - * @var \PhpParser\ConstExprEvaluator|null - */ - private $constExprEvaluator; + private ClassReflectionAnalyzer $classReflectionAnalyzer; + private ?ConstExprEvaluator $constExprEvaluator = null; public function __construct(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, ConstFetchAnalyzer $constFetchAnalyzer, ReflectionProvider $reflectionProvider, ReflectionResolver $reflectionResolver, ClassReflectionAnalyzer $classReflectionAnalyzer) { $this->nodeNameResolver = $nodeNameResolver; @@ -84,7 +78,7 @@ final class ValueResolver return $this->getValue($expr) === $value; } /** - * @param \PhpParser\Node\Arg|\PhpParser\Node\Expr $expr + * @param \PhpParser\Node\Arg|\PhpParser\Node\Expr|\PhpParser\Node\InterpolatedStringPart $expr * @return mixed */ public function getValue($expr, bool $resolvedClassReference = \false) @@ -115,10 +109,7 @@ final class ValueResolver return $this->nodeNameResolver->getName($expr); } $nodeStaticType = $this->nodeTypeResolver->getType($expr); - if ($nodeStaticType instanceof ConstantType) { - return $this->resolveConstantType($nodeStaticType); - } - return null; + return $this->resolveConstantType($nodeStaticType); } /** * @api symfony @@ -166,15 +157,25 @@ final class ValueResolver return \true; } /** + * @param \PhpParser\Node\Expr|\PhpParser\Node\InterpolatedStringPart $expr * @return mixed */ - private function resolveExprValueForConst(Expr $expr) + private function resolveExprValueForConst($expr) { try { $constExprEvaluator = $this->getConstExprEvaluator(); return $constExprEvaluator->evaluateDirectly($expr); } catch (ConstExprEvaluationException|TypeError $exception) { } + if ($expr instanceof Class_) { + $type = $this->nodeTypeResolver->getNativeType($expr); + if ($type instanceof ConstantStringType) { + return $type->getValue(); + } + } + if ($expr instanceof InterpolatedStringPart) { + return $expr->value; + } return null; } private function processConcat(Concat $concat, bool $resolvedClassReference) : string @@ -202,7 +203,6 @@ final class ValueResolver { $keys = []; foreach ($constantArrayType->getKeyTypes() as $i => $keyType) { - /** @var ConstantScalarType $keyType */ $keys[$i] = $keyType->getValue(); } $values = []; @@ -291,7 +291,7 @@ final class ValueResolver /** * @return mixed */ - private function resolveConstantType(ConstantType $constantType) + private function resolveConstantType(Type $constantType) { if ($constantType instanceof ConstantArrayType) { return $this->extractConstantArrayTypeValue($constantType); diff --git a/src/PhpParser/NodeFinder/LocalMethodCallFinder.php b/src/PhpParser/NodeFinder/LocalMethodCallFinder.php index 9a9768ce5bc..30c0eb6a3c3 100644 --- a/src/PhpParser/NodeFinder/LocalMethodCallFinder.php +++ b/src/PhpParser/NodeFinder/LocalMethodCallFinder.php @@ -16,19 +16,16 @@ final class LocalMethodCallFinder { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(BetterNodeFinder $betterNodeFinder, NodeTypeResolver $nodeTypeResolver, NodeNameResolver $nodeNameResolver) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/src/PhpParser/NodeFinder/PropertyFetchFinder.php b/src/PhpParser/NodeFinder/PropertyFetchFinder.php index 149d0afdf3f..dc24bbb5746 100644 --- a/src/PhpParser/NodeFinder/PropertyFetchFinder.php +++ b/src/PhpParser/NodeFinder/PropertyFetchFinder.php @@ -36,39 +36,32 @@ final class PropertyFetchFinder { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; public function __construct(BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver, ReflectionResolver $reflectionResolver, AstResolver $astResolver, NodeTypeResolver $nodeTypeResolver, PropertyFetchAnalyzer $propertyFetchAnalyzer, SimpleCallableNodeTraverser $simpleCallableNodeTraverser) { $this->betterNodeFinder = $betterNodeFinder; @@ -93,7 +86,7 @@ final class PropertyFetchFinder $nodes = [$class]; $nodesTrait = $this->astResolver->parseClassReflectionTraits($classReflection); $hasTrait = $nodesTrait !== []; - $nodes = \array_merge($nodes, $nodesTrait); + $nodes = [...$nodes, ...$nodesTrait]; return $this->findPropertyFetchesInClassLike($class, $nodes, $propertyName, $hasTrait, $scope); } /** diff --git a/src/PhpParser/NodeTransformer.php b/src/PhpParser/NodeTransformer.php index 97ae7cf39a7..e2f150b1c88 100644 --- a/src/PhpParser/NodeTransformer.php +++ b/src/PhpParser/NodeTransformer.php @@ -7,7 +7,7 @@ use PhpParser\BuilderHelpers; use PhpParser\Node\Arg; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\BinaryOp\Concat; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Yield_; @@ -64,9 +64,6 @@ final class NodeTransformer { $yields = []; foreach ($array->items as $arrayItem) { - if (!$arrayItem instanceof ArrayItem) { - continue; - } $yield = new Yield_($arrayItem->value, $arrayItem->key); $expression = new Expression($yield); $arrayItemComments = $arrayItem->getComments(); diff --git a/src/PhpParser/NodeTraverser/RectorNodeTraverser.php b/src/PhpParser/NodeTraverser/RectorNodeTraverser.php index cc55e4ed932..378410c5e1c 100644 --- a/src/PhpParser/NodeTraverser/RectorNodeTraverser.php +++ b/src/PhpParser/NodeTraverser/RectorNodeTraverser.php @@ -14,20 +14,16 @@ final class RectorNodeTraverser extends NodeTraverser /** * @var RectorInterface[] */ - private $rectors; + private array $rectors; /** * @readonly - * @var \Rector\VersionBonding\PhpVersionedFilter */ - private $phpVersionedFilter; - /** - * @var bool - */ - private $areNodeVisitorsPrepared = \false; + private PhpVersionedFilter $phpVersionedFilter; + private bool $areNodeVisitorsPrepared = \false; /** * @var array,RectorInterface[]> */ - private $visitorsPerNodeClass = []; + private array $visitorsPerNodeClass = []; /** * @param RectorInterface[] $rectors */ diff --git a/src/PhpParser/Parser/InlineCodeParser.php b/src/PhpParser/Parser/InlineCodeParser.php index 95c4e55dbf1..e39dcf51ec1 100644 --- a/src/PhpParser/Parser/InlineCodeParser.php +++ b/src/PhpParser/Parser/InlineCodeParser.php @@ -3,11 +3,11 @@ declare (strict_types=1); namespace Rector\PhpParser\Parser; +use PhpParser\Node\Scalar\InterpolatedString; use RectorPrefix202411\Nette\Utils\FileSystem; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\Node\Expr; use PhpParser\Node\Expr\BinaryOp\Concat; -use PhpParser\Node\Scalar\Encapsed; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt; use Rector\PhpParser\Node\Value\ValueResolver; @@ -17,19 +17,16 @@ final class InlineCodeParser { /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; /** * @readonly - * @var \Rector\PhpParser\Parser\SimplePhpParser */ - private $simplePhpParser; + private \Rector\PhpParser\Parser\SimplePhpParser $simplePhpParser; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var string * @see https://regex101.com/r/dwe4OW/1 @@ -92,15 +89,11 @@ final class InlineCodeParser { if ($expr instanceof String_) { if (!StringUtils::isMatch($expr->value, self::BACKREFERENCE_NO_QUOTE_REGEX)) { - return Strings::replace($expr->value, self::BACKREFERENCE_NO_DOUBLE_QUOTE_START_REGEX, static function (array $match) : string { - return '"' . $match['backreference'] . '"'; - }); + return Strings::replace($expr->value, self::BACKREFERENCE_NO_DOUBLE_QUOTE_START_REGEX, static fn(array $match): string => '"' . $match['backreference'] . '"'); } - return Strings::replace($expr->value, self::BACKREFERENCE_NO_QUOTE_REGEX, static function (array $match) : string { - return '"\\' . $match['backreference'] . '"'; - }); + return Strings::replace($expr->value, self::BACKREFERENCE_NO_QUOTE_REGEX, static fn(array $match): string => '"\\' . $match['backreference'] . '"'); } - if ($expr instanceof Encapsed) { + if ($expr instanceof InterpolatedString) { return $this->resolveEncapsedValue($expr); } if ($expr instanceof Concat) { @@ -118,11 +111,11 @@ final class InlineCodeParser $code = StringUtils::isMatch($code, self::ENDING_SEMI_COLON_REGEX) ? $code : $code . ';'; return $this->simplePhpParser->parseString($code); } - private function resolveEncapsedValue(Encapsed $encapsed) : string + private function resolveEncapsedValue(InterpolatedString $interpolatedString) : string { $value = ''; $isRequirePrint = \false; - foreach ($encapsed->parts as $part) { + foreach ($interpolatedString->parts as $part) { $partValue = (string) $this->valueResolver->getValue($part); if (\substr_compare($partValue, "'", -\strlen("'")) === 0) { $isRequirePrint = \true; @@ -130,7 +123,7 @@ final class InlineCodeParser } $value .= $partValue; } - $printedExpr = $isRequirePrint ? $this->betterStandardPrinter->print($encapsed) : $value; + $printedExpr = $isRequirePrint ? $this->betterStandardPrinter->print($interpolatedString) : $value; // remove " $printedExpr = \trim($printedExpr, '""'); // use \$ → $ @@ -147,8 +140,6 @@ final class InlineCodeParser $concat->right->value .= '.'; } $string = $this->stringify($concat->left) . $this->stringify($concat->right); - return Strings::replace($string, self::VARIABLE_IN_SINGLE_QUOTED_REGEX, static function (array $match) { - return $match['variable']; - }); + return Strings::replace($string, self::VARIABLE_IN_SINGLE_QUOTED_REGEX, static fn(array $match) => $match['variable']); } } diff --git a/src/PhpParser/Parser/ParserErrors.php b/src/PhpParser/Parser/ParserErrors.php index 47387ea8b0c..012146b0de6 100644 --- a/src/PhpParser/Parser/ParserErrors.php +++ b/src/PhpParser/Parser/ParserErrors.php @@ -8,14 +8,12 @@ final class ParserErrors { /** * @readonly - * @var string */ - private $message; + private string $message; /** * @readonly - * @var int */ - private $line; + private int $line; public function __construct(ParserErrorsException $parserErrorsException) { $this->message = $parserErrorsException->getMessage(); diff --git a/src/PhpParser/Parser/RectorParser.php b/src/PhpParser/Parser/RectorParser.php index f3296e9f34e..e6d03b33b16 100644 --- a/src/PhpParser/Parser/RectorParser.php +++ b/src/PhpParser/Parser/RectorParser.php @@ -3,26 +3,26 @@ declare (strict_types=1); namespace Rector\PhpParser\Parser; -use PhpParser\Lexer; use PhpParser\Node\Stmt; +use PhpParser\ParserFactory; +use PhpParser\PhpVersion; use PHPStan\Parser\Parser; use Rector\PhpParser\ValueObject\StmtsAndTokens; +use Rector\Util\Reflection\PrivatesAccessor; final class RectorParser { /** * @readonly - * @var \PhpParser\Lexer */ - private $lexer; + private Parser $parser; /** * @readonly - * @var \PHPStan\Parser\Parser */ - private $parser; - public function __construct(Lexer $lexer, Parser $parser) + private PrivatesAccessor $privatesAccessor; + public function __construct(Parser $parser, PrivatesAccessor $privatesAccessor) { - $this->lexer = $lexer; $this->parser = $parser; + $this->privatesAccessor = $privatesAccessor; } /** * @api used by rector-symfony @@ -40,10 +40,24 @@ final class RectorParser { return $this->parser->parseString($fileContent); } - public function parseFileContentToStmtsAndTokens(string $fileContent) : StmtsAndTokens + public function parseFileContentToStmtsAndTokens(string $fileContent, bool $forNewestSupportedVersion = \true) : StmtsAndTokens { - $stmts = $this->parser->parseString($fileContent); - $tokens = $this->lexer->getTokens(); + if (!$forNewestSupportedVersion) { + // don't directly change PHPStan Parser service + // to avoid reuse on next file + $phpstanParser = clone $this->parser; + $parserFactory = new ParserFactory(); + $parser = $parserFactory->createForVersion(PhpVersion::fromString('7.0')); + $this->privatesAccessor->setPrivateProperty($phpstanParser, 'parser', $parser); + return $this->resolveStmtsAndTokens($phpstanParser, $fileContent); + } + return $this->resolveStmtsAndTokens($this->parser, $fileContent); + } + private function resolveStmtsAndTokens(Parser $parser, string $fileContent) : StmtsAndTokens + { + $stmts = $parser->parseString($fileContent); + $innerParser = $this->privatesAccessor->getPrivateProperty($parser, 'parser'); + $tokens = $innerParser->getTokens(); return new StmtsAndTokens($stmts, $tokens); } } diff --git a/src/PhpParser/Parser/SimplePhpParser.php b/src/PhpParser/Parser/SimplePhpParser.php index b93aca50274..028db466515 100644 --- a/src/PhpParser/Parser/SimplePhpParser.php +++ b/src/PhpParser/Parser/SimplePhpParser.php @@ -15,18 +15,16 @@ final class SimplePhpParser { /** * @readonly - * @var \PhpParser\Parser */ - private $phpParser; + private Parser $phpParser; /** * @readonly - * @var \PhpParser\NodeTraverser */ - private $nodeTraverser; + private NodeTraverser $nodeTraverser; public function __construct() { $parserFactory = new ParserFactory(); - $this->phpParser = $parserFactory->create(ParserFactory::ONLY_PHP7); + $this->phpParser = $parserFactory->createForNewestSupportedVersion(); $this->nodeTraverser = new NodeTraverser(); $this->nodeTraverser->addVisitor(new AssignedToNodeVisitor()); } diff --git a/src/PhpParser/Printer/BetterStandardPrinter.php b/src/PhpParser/Printer/BetterStandardPrinter.php index e107e221bf9..182bf022ffc 100644 --- a/src/PhpParser/Printer/BetterStandardPrinter.php +++ b/src/PhpParser/Printer/BetterStandardPrinter.php @@ -3,6 +3,8 @@ declare (strict_types=1); namespace Rector\PhpParser\Printer; +use PhpParser\Node\Scalar\Float_; +use PhpParser\Node\Scalar\Int_; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\Comment; use PhpParser\Node; @@ -17,11 +19,8 @@ use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Expr\Yield_; use PhpParser\Node\Param; -use PhpParser\Node\Scalar\DNumber; -use PhpParser\Node\Scalar\EncapsedStringPart; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\InterpolatedString; use PhpParser\Node\Scalar\String_; -use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Declare_; use PhpParser\Node\Stmt\Nop; @@ -106,14 +105,14 @@ final class BetterStandardPrinter extends Standard */ public function pFileWithoutNamespace(FileWithoutNamespace $fileWithoutNamespace) : string { - return $this->pStmts($fileWithoutNamespace->stmts, \false); + return $this->pStmts($fileWithoutNamespace->stmts); } - protected function p(Node $node, $parentFormatPreserved = \false) : string + protected function p(Node $node, int $precedence = self::MAX_PRECEDENCE, int $lhsPrecedence = self::MAX_PRECEDENCE, bool $parentFormatPreserved = \false) : string { while ($node instanceof AlwaysRememberedExpr) { $node = $node->getExpr(); } - $content = parent::p($node, $parentFormatPreserved); + $content = parent::p($node, $precedence, $lhsPrecedence, $parentFormatPreserved); return $node->getAttribute(AttributeKey::WRAPPED_IN_PARENTHESES) === \true ? '(' . $content . ')' : $content; } protected function pAttributeGroup(AttributeGroup $attributeGroup) : string @@ -125,16 +124,16 @@ final class BetterStandardPrinter extends Standard } return $ret; } - protected function pExpr_ArrowFunction(ArrowFunction $arrowFunction) : string + protected function pExpr_ArrowFunction(ArrowFunction $arrowFunction, int $precedence, int $lhsPrecedence) : string { if (!$arrowFunction->hasAttribute(AttributeKey::COMMENT_CLOSURE_RETURN_MIRRORED)) { - return parent::pExpr_ArrowFunction($arrowFunction); + return parent::pExpr_ArrowFunction($arrowFunction, $precedence, $lhsPrecedence); } $expr = $arrowFunction->expr; /** @var Comment[] $comments */ $comments = $expr->getAttribute(AttributeKey::COMMENTS) ?? []; if ($comments === []) { - return parent::pExpr_ArrowFunction($arrowFunction); + return parent::pExpr_ArrowFunction($arrowFunction, $precedence, $lhsPrecedence); } $indent = $this->resolveIndentSpaces(); $text = "\n" . $indent; @@ -142,7 +141,7 @@ final class BetterStandardPrinter extends Standard $commentText = $key > 0 ? $indent . $comment->getText() : $comment->getText(); $text .= $commentText . "\n"; } - return $this->pAttrGroups($arrowFunction->attrGroups, \true) . ($arrowFunction->static ? 'static ' : '') . 'fn' . ($arrowFunction->byRef ? '&' : '') . '(' . $this->pCommaSeparated($arrowFunction->params) . ')' . ($arrowFunction->returnType instanceof Node ? ': ' . $this->p($arrowFunction->returnType) : '') . ' =>' . $text . $indent . $this->p($arrowFunction->expr); + return $this->pPrefixOp(ArrowFunction::class, $this->pAttrGroups($arrowFunction->attrGroups, \true) . $this->pStatic($arrowFunction->static) . 'fn' . ($arrowFunction->byRef ? '&' : '') . '(' . $this->pMaybeMultiline($arrowFunction->params, $this->phpVersion->supportsTrailingCommaInParamList()) . ')' . ($arrowFunction->returnType instanceof Node ? ': ' . $this->p($arrowFunction->returnType) : '') . ' =>' . $text . $indent, $arrowFunction->expr, $precedence, $lhsPrecedence); } /** * This allows to use both spaces and tabs vs. original space-only @@ -181,13 +180,12 @@ final class BetterStandardPrinter extends Standard /** * @param mixed[] $nodes * @param mixed[] $origNodes - * @param int|null $fixup */ - protected function pArray(array $nodes, array $origNodes, int &$pos, int $indentAdjustment, string $parentNodeType, string $subNodeName, $fixup) : ?string + protected function pArray(array $nodes, array $origNodes, int &$pos, int $indentAdjustment, string $parentNodeClass, string $subNodeName, ?int $fixup) : ?string { // reindex positions for printer $nodes = \array_values($nodes); - $content = parent::pArray($nodes, $origNodes, $pos, $indentAdjustment, $parentNodeType, $subNodeName, $fixup); + $content = parent::pArray($nodes, $origNodes, $pos, $indentAdjustment, $parentNodeClass, $subNodeName, $fixup); if ($content === null) { return $content; } @@ -212,12 +210,12 @@ final class BetterStandardPrinter extends Standard /** * Emulates 1_000 in PHP 7.3- version */ - protected function pScalar_DNumber(DNumber $dNumber) : string + protected function pScalar_Float(Float_ $float) : string { - if ($this->shouldPrintNewRawValue($dNumber)) { - return (string) $dNumber->getAttribute(AttributeKey::RAW_VALUE); + if ($this->shouldPrintNewRawValue($float)) { + return (string) $float->getAttribute(AttributeKey::RAW_VALUE); } - return parent::pScalar_DNumber($dNumber); + return parent::pScalar_Float($float); } /** * Add space: @@ -231,13 +229,13 @@ final class BetterStandardPrinter extends Standard if ($closure->uses === []) { return $closureContent; } - return \str_replace(' use(', ' use (', (string) $closureContent); + return \str_replace(' use(', ' use (', $closureContent); } /** * Do not add "()" on Expressions * @see https://github.com/rectorphp/rector/pull/401#discussion_r181487199 */ - protected function pExpr_Yield(Yield_ $yield) : string + protected function pExpr_Yield(Yield_ $yield, int $precedence, int $lhsPrecedence) : string { if (!$yield->value instanceof Expr) { return 'yield'; @@ -267,6 +265,12 @@ final class BetterStandardPrinter extends Standard */ protected function pScalar_String(String_ $string) : string { + if ($string->getAttribute(AttributeKey::DOC_INDENTATION) === '__REMOVED__') { + $content = parent::pScalar_String($string); + $lines = \explode("\n", $content); + $trimmedLines = \array_map('ltrim', $lines); + return \implode("\n", $trimmedLines); + } $isRegularPattern = (bool) $string->getAttribute(AttributeKey::IS_REGULAR_PATTERN, \false); if (!$isRegularPattern) { return parent::pScalar_String($string); @@ -302,19 +306,24 @@ final class BetterStandardPrinter extends Standard $declareString = parent::pStmt_Declare($declare); return Strings::replace($declareString, '#\\s+#'); } - protected function pExpr_Ternary(Ternary $ternary) : string + protected function pExpr_Ternary(Ternary $ternary, int $precedence, int $lhsPrecedence) : string { $kind = $ternary->getAttribute(AttributeKey::KIND); if ($kind === 'wrapped_with_brackets') { - $pExprTernary = parent::pExpr_Ternary($ternary); + $pExprTernary = parent::pExpr_Ternary($ternary, $precedence, $lhsPrecedence); return '(' . $pExprTernary . ')'; } - return parent::pExpr_Ternary($ternary); + return parent::pExpr_Ternary($ternary, $precedence, $lhsPrecedence); } - protected function pScalar_EncapsedStringPart(EncapsedStringPart $encapsedStringPart) : string + protected function pScalar_InterpolatedString(InterpolatedString $interpolatedString) : string { - // parent throws exception, but we need to compare string - return '`' . $encapsedStringPart->value . '`'; + $content = parent::pScalar_InterpolatedString($interpolatedString); + if ($interpolatedString->getAttribute(AttributeKey::DOC_INDENTATION) === '__REMOVED__') { + $lines = \explode("\n", $content); + $trimmedLines = \array_map('ltrim', $lines); + return \implode("\n", $trimmedLines); + } + return $content; } protected function pCommaSeparated(array $nodes) : string { @@ -328,33 +337,16 @@ final class BetterStandardPrinter extends Standard } return $result; } - /** - * Override parent pModifiers to set position of final and abstract modifier early, so instead of - * - * public final const MY_CONSTANT = "Hello world!"; - * - * it should be - * - * final public const MY_CONSTANT = "Hello world!"; - * - * @see https://github.com/rectorphp/rector/issues/6963 - * @see https://github.com/nikic/PHP-Parser/pull/826 - */ - protected function pModifiers(int $modifiers) : string - { - return (($modifiers & Class_::MODIFIER_FINAL) !== 0 ? 'final ' : '') . (($modifiers & Class_::MODIFIER_ABSTRACT) !== 0 ? 'abstract ' : '') . (($modifiers & Class_::MODIFIER_PUBLIC) !== 0 ? 'public ' : '') . (($modifiers & Class_::MODIFIER_PROTECTED) !== 0 ? 'protected ' : '') . (($modifiers & Class_::MODIFIER_PRIVATE) !== 0 ? 'private ' : '') . (($modifiers & Class_::MODIFIER_STATIC) !== 0 ? 'static ' : '') . (($modifiers & Class_::MODIFIER_READONLY) !== 0 ? 'readonly ' : ''); - } /** * Invoke re-print even if only raw value was changed. * That allows PHPStan to use int strict types, while changing the value with literal "_" - * @return int|string */ - protected function pScalar_LNumber(LNumber $lNumber) + protected function pScalar_Int(Int_ $int) : string { - if ($this->shouldPrintNewRawValue($lNumber)) { - return (string) $lNumber->getAttribute(AttributeKey::RAW_VALUE); + if ($this->shouldPrintNewRawValue($int)) { + return (string) $int->getAttribute(AttributeKey::RAW_VALUE); } - return parent::pScalar_LNumber($lNumber); + return parent::pScalar_Int($int); } protected function pExpr_MethodCall(MethodCall $methodCall) : string { @@ -392,7 +384,7 @@ final class BetterStandardPrinter extends Standard return SimpleParameterProvider::provideStringParameter(Option::INDENT_CHAR, ' '); } /** - * @param \PhpParser\Node\Scalar\LNumber|\PhpParser\Node\Scalar\DNumber $lNumber + * @param \PhpParser\Node\Scalar\Int_|\PhpParser\Node\Scalar\Float_ $lNumber */ private function shouldPrintNewRawValue($lNumber) : bool { diff --git a/src/PhpParser/ValueObject/StmtsAndTokens.php b/src/PhpParser/ValueObject/StmtsAndTokens.php index a8395e8d46e..de281d8ec49 100644 --- a/src/PhpParser/ValueObject/StmtsAndTokens.php +++ b/src/PhpParser/ValueObject/StmtsAndTokens.php @@ -10,12 +10,12 @@ final class StmtsAndTokens * @var Stmt[] * @readonly */ - private $stmts; + private array $stmts; /** * @var array * @readonly */ - private $tokens; + private array $tokens; /** * @param Stmt[] $stmts * @param array $tokens diff --git a/src/PostRector/Application/PostFileProcessor.php b/src/PostRector/Application/PostFileProcessor.php index bb3f6d76ac5..30919617399 100644 --- a/src/PostRector/Application/PostFileProcessor.php +++ b/src/PostRector/Application/PostFileProcessor.php @@ -22,43 +22,36 @@ final class PostFileProcessor implements ResetableInterface { /** * @readonly - * @var \Rector\Skipper\Skipper\Skipper */ - private $skipper; + private Skipper $skipper; /** * @readonly - * @var \Rector\PostRector\Rector\UseAddingPostRector */ - private $useAddingPostRector; + private UseAddingPostRector $useAddingPostRector; /** * @readonly - * @var \Rector\PostRector\Rector\NameImportingPostRector */ - private $nameImportingPostRector; + private NameImportingPostRector $nameImportingPostRector; /** * @readonly - * @var \Rector\PostRector\Rector\ClassRenamingPostRector */ - private $classRenamingPostRector; + private ClassRenamingPostRector $classRenamingPostRector; /** * @readonly - * @var \Rector\PostRector\Rector\DocblockNameImportingPostRector */ - private $docblockNameImportingPostRector; + private DocblockNameImportingPostRector $docblockNameImportingPostRector; /** * @readonly - * @var \Rector\PostRector\Rector\UnusedImportRemovingPostRector */ - private $unusedImportRemovingPostRector; + private UnusedImportRemovingPostRector $unusedImportRemovingPostRector; /** * @readonly - * @var \Rector\Configuration\RenamedClassesDataCollector */ - private $renamedClassesDataCollector; + private RenamedClassesDataCollector $renamedClassesDataCollector; /** * @var PostRectorInterface[] */ - private $postRectors = []; + private array $postRectors = []; public function __construct(Skipper $skipper, UseAddingPostRector $useAddingPostRector, NameImportingPostRector $nameImportingPostRector, ClassRenamingPostRector $classRenamingPostRector, DocblockNameImportingPostRector $docblockNameImportingPostRector, UnusedImportRemovingPostRector $unusedImportRemovingPostRector, RenamedClassesDataCollector $renamedClassesDataCollector) { $this->skipper = $skipper; diff --git a/src/PostRector/Collector/UseNodesToAddCollector.php b/src/PostRector/Collector/UseNodesToAddCollector.php index aed09556fd3..00a1e87c6c2 100644 --- a/src/PostRector/Collector/UseNodesToAddCollector.php +++ b/src/PostRector/Collector/UseNodesToAddCollector.php @@ -14,26 +14,24 @@ final class UseNodesToAddCollector { /** * @readonly - * @var \Rector\Application\Provider\CurrentFileProvider */ - private $currentFileProvider; + private CurrentFileProvider $currentFileProvider; /** * @readonly - * @var \Rector\Naming\Naming\UseImportsResolver */ - private $useImportsResolver; + private UseImportsResolver $useImportsResolver; /** * @var array */ - private $constantUseImportTypesInFilePath = []; + private array $constantUseImportTypesInFilePath = []; /** * @var array */ - private $functionUseImportTypesInFilePath = []; + private array $functionUseImportTypesInFilePath = []; /** * @var array */ - private $useImportTypesInFilePath = []; + private array $useImportTypesInFilePath = []; public function __construct(CurrentFileProvider $currentFileProvider, UseImportsResolver $useImportsResolver) { $this->currentFileProvider = $currentFileProvider; diff --git a/src/PostRector/Guard/AddUseStatementGuard.php b/src/PostRector/Guard/AddUseStatementGuard.php index b8a8aa41d92..aa2e2f0088d 100644 --- a/src/PostRector/Guard/AddUseStatementGuard.php +++ b/src/PostRector/Guard/AddUseStatementGuard.php @@ -11,13 +11,12 @@ final class AddUseStatementGuard { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @var array */ - private $shouldTraverseOnFiles = []; + private array $shouldTraverseOnFiles = []; public function __construct(BetterNodeFinder $betterNodeFinder) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/src/PostRector/Rector/ClassRenamingPostRector.php b/src/PostRector/Rector/ClassRenamingPostRector.php index 180b246dc9b..1360ee94f7b 100644 --- a/src/PostRector/Rector/ClassRenamingPostRector.php +++ b/src/PostRector/Rector/ClassRenamingPostRector.php @@ -21,24 +21,20 @@ final class ClassRenamingPostRector extends \Rector\PostRector\Rector\AbstractPo { /** * @readonly - * @var \Rector\Renaming\NodeManipulator\ClassRenamer */ - private $classRenamer; + private ClassRenamer $classRenamer; /** * @readonly - * @var \Rector\Configuration\RenamedClassesDataCollector */ - private $renamedClassesDataCollector; + private RenamedClassesDataCollector $renamedClassesDataCollector; /** * @readonly - * @var \Rector\CodingStyle\Application\UseImportsRemover */ - private $useImportsRemover; + private UseImportsRemover $useImportsRemover; /** * @readonly - * @var \Rector\Renaming\Collector\RenamedNameCollector */ - private $renamedNameCollector; + private RenamedNameCollector $renamedNameCollector; /** * @var \Rector\PhpParser\Node\CustomNode\FileWithoutNamespace|\PhpParser\Node\Stmt\Namespace_|null */ @@ -46,7 +42,7 @@ final class ClassRenamingPostRector extends \Rector\PostRector\Rector\AbstractPo /** * @var array */ - private $oldToNewClasses = []; + private array $oldToNewClasses = []; public function __construct(ClassRenamer $classRenamer, RenamedClassesDataCollector $renamedClassesDataCollector, UseImportsRemover $useImportsRemover, RenamedNameCollector $renamedNameCollector) { $this->classRenamer = $classRenamer; diff --git a/src/PostRector/Rector/DocblockNameImportingPostRector.php b/src/PostRector/Rector/DocblockNameImportingPostRector.php index 127139bb04a..82b6c265bab 100644 --- a/src/PostRector/Rector/DocblockNameImportingPostRector.php +++ b/src/PostRector/Rector/DocblockNameImportingPostRector.php @@ -15,24 +15,20 @@ final class DocblockNameImportingPostRector extends \Rector\PostRector\Rector\Ab { /** * @readonly - * @var \Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockNameImporter */ - private $docBlockNameImporter; + private DocBlockNameImporter $docBlockNameImporter; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\PostRector\Guard\AddUseStatementGuard */ - private $addUseStatementGuard; + private AddUseStatementGuard $addUseStatementGuard; public function __construct(DocBlockNameImporter $docBlockNameImporter, PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater, AddUseStatementGuard $addUseStatementGuard) { $this->docBlockNameImporter = $docBlockNameImporter; @@ -40,10 +36,7 @@ final class DocblockNameImportingPostRector extends \Rector\PostRector\Rector\Ab $this->docBlockUpdater = $docBlockUpdater; $this->addUseStatementGuard = $addUseStatementGuard; } - /** - * @return \PhpParser\Node|int|null - */ - public function enterNode(Node $node) + public function enterNode(Node $node) : ?\PhpParser\Node { if (!$node instanceof Stmt && !$node instanceof Param) { return null; diff --git a/src/PostRector/Rector/NameImportingPostRector.php b/src/PostRector/Rector/NameImportingPostRector.php index 04ae505865f..c13a0cc73e2 100644 --- a/src/PostRector/Rector/NameImportingPostRector.php +++ b/src/PostRector/Rector/NameImportingPostRector.php @@ -15,38 +15,35 @@ final class NameImportingPostRector extends \Rector\PostRector\Rector\AbstractPo { /** * @readonly - * @var \Rector\CodingStyle\Node\NameImporter */ - private $nameImporter; + private NameImporter $nameImporter; /** * @readonly - * @var \Rector\Naming\Naming\UseImportsResolver */ - private $useImportsResolver; + private UseImportsResolver $useImportsResolver; /** * @readonly - * @var \Rector\PostRector\Guard\AddUseStatementGuard */ - private $addUseStatementGuard; + private AddUseStatementGuard $addUseStatementGuard; /** * @var array */ - private $currentUses = []; + private array $currentUses = []; public function __construct(NameImporter $nameImporter, UseImportsResolver $useImportsResolver, AddUseStatementGuard $addUseStatementGuard) { $this->nameImporter = $nameImporter; $this->useImportsResolver = $useImportsResolver; $this->addUseStatementGuard = $addUseStatementGuard; } - public function beforeTraverse(array $nodes) + /** + * @return Stmt[] + */ + public function beforeTraverse(array $nodes) : array { $this->currentUses = $this->useImportsResolver->resolve(); return $nodes; } - /** - * @return \PhpParser\Node|int|null - */ - public function enterNode(Node $node) + public function enterNode(Node $node) : ?\PhpParser\Node { if (!$node instanceof FullyQualified) { return null; diff --git a/src/PostRector/Rector/UnusedImportRemovingPostRector.php b/src/PostRector/Rector/UnusedImportRemovingPostRector.php index ab568581388..35374d42ef2 100644 --- a/src/PostRector/Rector/UnusedImportRemovingPostRector.php +++ b/src/PostRector/Rector/UnusedImportRemovingPostRector.php @@ -3,6 +3,8 @@ declare (strict_types=1); namespace Rector\PostRector\Rector; +use PhpParser\Node\UseItem; +use PhpParser\NodeVisitor; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\Comment; use PhpParser\Comment\Doc; @@ -12,8 +14,6 @@ use PhpParser\Node\Name; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Stmt\Namespace_; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; -use PhpParser\NodeTraverser; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; @@ -22,14 +22,12 @@ final class UnusedImportRemovingPostRector extends \Rector\PostRector\Rector\Abs { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, PhpDocInfoFactory $phpDocInfoFactory) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; @@ -82,7 +80,7 @@ final class UnusedImportRemovingPostRector extends \Rector\PostRector\Rector\Abs $names = []; $this->simpleCallableNodeTraverser->traverseNodesWithCallable($namespace->stmts, static function (Node $node) use(&$names) { if ($node instanceof Use_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$node instanceof Name) { return null; @@ -112,9 +110,7 @@ final class UnusedImportRemovingPostRector extends \Rector\PostRector\Rector\Abs if ($comments === []) { return null; } - $docs = \array_filter($comments, static function (Comment $comment) : bool { - return $comment instanceof Doc; - }); + $docs = \array_filter($comments, static fn(Comment $comment): bool => $comment instanceof Doc); if ($docs === []) { return null; } @@ -150,9 +146,9 @@ final class UnusedImportRemovingPostRector extends \Rector\PostRector\Rector\Abs /** * @param string[] $names */ - private function isUseImportUsed(UseUse $useUse, bool $isCaseSensitive, array $names, ?string $namespaceName) : bool + private function isUseImportUsed(UseItem $useItem, bool $isCaseSensitive, array $names, ?string $namespaceName) : bool { - $comparedName = $useUse->alias instanceof Identifier ? $useUse->alias->toString() : $useUse->name->toString(); + $comparedName = $useItem->alias instanceof Identifier ? $useItem->alias->toString() : $useItem->name->toString(); if (!$isCaseSensitive) { $comparedName = \strtolower($comparedName); } diff --git a/src/PostRector/Rector/UseAddingPostRector.php b/src/PostRector/Rector/UseAddingPostRector.php index e7e6974f0c8..9562bba5a7a 100644 --- a/src/PostRector/Rector/UseAddingPostRector.php +++ b/src/PostRector/Rector/UseAddingPostRector.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace Rector\PostRector\Rector; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Namespace_; -use PhpParser\NodeTraverser; use Rector\CodingStyle\Application\UseImportsAdder; use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory; use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace; @@ -16,19 +16,16 @@ final class UseAddingPostRector extends \Rector\PostRector\Rector\AbstractPostRe { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\CodingStyle\Application\UseImportsAdder */ - private $useImportsAdder; + private UseImportsAdder $useImportsAdder; /** * @readonly - * @var \Rector\PostRector\Collector\UseNodesToAddCollector */ - private $useNodesToAddCollector; + private UseNodesToAddCollector $useNodesToAddCollector; public function __construct(TypeFactory $typeFactory, UseImportsAdder $useImportsAdder, UseNodesToAddCollector $useNodesToAddCollector) { $this->typeFactory = $typeFactory; @@ -72,7 +69,7 @@ final class UseAddingPostRector extends \Rector\PostRector\Rector\AbstractPostRe * visitor per execution, using stop traversal here is safe, * ref https://github.com/rectorphp/rector-src/blob/fc1e742fa4d9861ccdc5933f3b53613b8223438d/src/PostRector/Application/PostFileProcessor.php#L59-L61 */ - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } /** * @param Stmt[] $nodes diff --git a/src/PostRector/ValueObject/PropertyMetadata.php b/src/PostRector/ValueObject/PropertyMetadata.php index 5aee79a141f..8f9355c9105 100644 --- a/src/PostRector/ValueObject/PropertyMetadata.php +++ b/src/PostRector/ValueObject/PropertyMetadata.php @@ -3,26 +3,23 @@ declare (strict_types=1); namespace Rector\PostRector\ValueObject; -use PhpParser\Node\Stmt\Class_; +use PhpParser\Modifiers; use PHPStan\Type\Type; final class PropertyMetadata { /** * @readonly - * @var string */ - private $name; + private string $name; /** * @readonly - * @var \PHPStan\Type\Type|null */ - private $type; + private ?Type $type; /** * @readonly - * @var int */ - private $flags = Class_::MODIFIER_PRIVATE; - public function __construct(string $name, ?Type $type, int $flags = Class_::MODIFIER_PRIVATE) + private int $flags = Modifiers::PRIVATE; + public function __construct(string $name, ?Type $type, int $flags = Modifiers::PRIVATE) { $this->name = $name; $this->type = $type; diff --git a/src/Rector/AbstractRector.php b/src/Rector/AbstractRector.php index b3c14582916..c6b7d2437c3 100644 --- a/src/Rector/AbstractRector.php +++ b/src/Rector/AbstractRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Rector; +use PhpParser\NodeVisitor; use PhpParser\Node; use PhpParser\Node\Name; use PhpParser\Node\Stmt\ClassMethod; @@ -11,9 +12,8 @@ use PhpParser\Node\Stmt\InlineHTML; use PhpParser\Node\Stmt\Interface_; use PhpParser\Node\Stmt\Nop; use PhpParser\Node\Stmt\Property; -use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\Node\PropertyItem; use PhpParser\Node\Stmt\Trait_; -use PhpParser\NodeTraverser; use PhpParser\NodeVisitorAbstract; use PHPStan\Analyser\MutatingScope; use PHPStan\Type\ObjectType; @@ -48,56 +48,23 @@ A) Direct return null for no change: B) Remove the Node: - return NodeTraverser::REMOVE_NODE; + return \\PhpParser\\NodeVisitor::REMOVE_NODE; CODE_SAMPLE; - /** - * @var \Rector\NodeNameResolver\NodeNameResolver - */ - protected $nodeNameResolver; - /** - * @var \Rector\NodeTypeResolver\NodeTypeResolver - */ - protected $nodeTypeResolver; - /** - * @var \Rector\PhpParser\Node\NodeFactory - */ - protected $nodeFactory; - /** - * @var \Rector\PhpParser\Comparing\NodeComparator - */ - protected $nodeComparator; - /** - * @var \Rector\ValueObject\Application\File - */ - protected $file; - /** - * @var \Rector\Skipper\Skipper\Skipper - */ - protected $skipper; - /** - * @var \Rector\Application\ChangedNodeScopeRefresher - */ - private $changedNodeScopeRefresher; - /** - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser - */ - private $simpleCallableNodeTraverser; - /** - * @var \Rector\Application\Provider\CurrentFileProvider - */ - private $currentFileProvider; + protected NodeNameResolver $nodeNameResolver; + protected NodeTypeResolver $nodeTypeResolver; + protected NodeFactory $nodeFactory; + protected NodeComparator $nodeComparator; + protected File $file; + protected Skipper $skipper; + private ChangedNodeScopeRefresher $changedNodeScopeRefresher; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; + private CurrentFileProvider $currentFileProvider; /** * @var array */ - private $nodesToReturn = []; - /** - * @var \Rector\NodeDecorator\CreatedByRuleDecorator - */ - private $createdByRuleDecorator; - /** - * @var int|null - */ - private $toBeRemovedNodeId; + private array $nodesToReturn = []; + private CreatedByRuleDecorator $createdByRuleDecorator; + private ?int $toBeRemovedNodeId = null; public function autowire(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeFactory $nodeFactory, Skipper $skipper, NodeComparator $nodeComparator, CurrentFileProvider $currentFileProvider, CreatedByRuleDecorator $createdByRuleDecorator, ChangedNodeScopeRefresher $changedNodeScopeRefresher) : void { $this->nodeNameResolver = $nodeNameResolver; @@ -143,16 +110,16 @@ CODE_SAMPLE; $originalNode = $node->getAttribute(AttributeKey::ORIGINAL_NODE) ?? $node; $refactoredNode = $this->refactor($node); // @see NodeTraverser::* codes, e.g. removal of node of stopping the traversing - if ($refactoredNode === NodeTraverser::REMOVE_NODE) { + if ($refactoredNode === NodeVisitor::REMOVE_NODE) { $this->toBeRemovedNodeId = \spl_object_id($originalNode); // notify this rule changing code - $rectorWithLineChange = new RectorWithLineChange(static::class, $originalNode->getLine()); + $rectorWithLineChange = new RectorWithLineChange(static::class, $originalNode->getStartLine()); $this->file->addRectorClassWithLine($rectorWithLineChange); return $originalNode; } if (\is_int($refactoredNode)) { $this->createdByRuleDecorator->decorate($node, $originalNode, static::class); - if (!\in_array($refactoredNode, [NodeTraverser::DONT_TRAVERSE_CHILDREN, NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN], \true)) { + if (!\in_array($refactoredNode, [NodeVisitor::DONT_TRAVERSE_CHILDREN, NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN], \true)) { // notify this rule changing code $rectorWithLineChange = new RectorWithLineChange(static::class, $originalNode->getLine()); $this->file->addRectorClassWithLine($rectorWithLineChange); @@ -184,7 +151,7 @@ CODE_SAMPLE; $objectId = \spl_object_id($node); if ($this->toBeRemovedNodeId === $objectId) { $this->toBeRemovedNodeId = null; - return NodeTraverser::REMOVE_NODE; + return NodeVisitor::REMOVE_NODE; } return $this->nodesToReturn[$objectId] ?? $node; } @@ -206,7 +173,7 @@ CODE_SAMPLE; * @return ($node is Node\Param ? string : * ($node is ClassMethod ? string : * ($node is Property ? string : - * ($node is PropertyProperty ? string : + * ($node is PropertyItem ? string : * ($node is Trait_ ? string : * ($node is Interface_ ? string : * ($node is Const_ ? string : @@ -266,9 +233,7 @@ CODE_SAMPLE; // 1. registered in getNodesTypes() method // 2. different with current node type, as already decorated above // - $otherTypes = \array_filter($this->getNodeTypes(), static function (string $nodeType) use($node) : bool { - return $nodeType !== \get_class($node); - }); + $otherTypes = \array_filter($this->getNodeTypes(), static fn(string $nodeType): bool => $nodeType !== \get_class($node)); if ($otherTypes === []) { return; } @@ -286,7 +251,7 @@ CODE_SAMPLE; { /** @var non-empty-array|Node $refactoredNode */ $this->createdByRuleDecorator->decorate($refactoredNode, $originalNode, static::class); - $rectorWithLineChange = new RectorWithLineChange(static::class, $originalNode->getLine()); + $rectorWithLineChange = new RectorWithLineChange(static::class, $originalNode->getStartLine()); $this->file->addRectorClassWithLine($rectorWithLineChange); /** @var MutatingScope|null $currentScope */ $currentScope = $node->getAttribute(AttributeKey::SCOPE); diff --git a/src/Reflection/ClassModifierChecker.php b/src/Reflection/ClassModifierChecker.php index d2b39b81fb5..5c2349c4820 100644 --- a/src/Reflection/ClassModifierChecker.php +++ b/src/Reflection/ClassModifierChecker.php @@ -9,9 +9,8 @@ final class ClassModifierChecker { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private \Rector\Reflection\ReflectionResolver $reflectionResolver; public function __construct(\Rector\Reflection\ReflectionResolver $reflectionResolver) { $this->reflectionResolver = $reflectionResolver; diff --git a/src/Reflection/MethodReflectionResolver.php b/src/Reflection/MethodReflectionResolver.php index 1fafda84fc1..6d717c7157d 100644 --- a/src/Reflection/MethodReflectionResolver.php +++ b/src/Reflection/MethodReflectionResolver.php @@ -10,9 +10,8 @@ final class MethodReflectionResolver { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(ReflectionProvider $reflectionProvider) { $this->reflectionProvider = $reflectionProvider; diff --git a/src/Reflection/ReflectionResolver.php b/src/Reflection/ReflectionResolver.php index a09b40487af..2f18668dcbf 100644 --- a/src/Reflection/ReflectionResolver.php +++ b/src/Reflection/ReflectionResolver.php @@ -36,29 +36,24 @@ final class ReflectionResolver { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\Reflection\MethodReflectionResolver */ - private $methodReflectionResolver; + private \Rector\Reflection\MethodReflectionResolver $methodReflectionResolver; public function __construct(ReflectionProvider $reflectionProvider, NodeTypeResolver $nodeTypeResolver, NodeNameResolver $nodeNameResolver, ClassAnalyzer $classAnalyzer, \Rector\Reflection\MethodReflectionResolver $methodReflectionResolver) { $this->reflectionProvider = $reflectionProvider; diff --git a/src/Reporting/DeprecatedRulesReporter.php b/src/Reporting/DeprecatedRulesReporter.php index a5e4188cd7a..f1ac7634477 100644 --- a/src/Reporting/DeprecatedRulesReporter.php +++ b/src/Reporting/DeprecatedRulesReporter.php @@ -11,9 +11,8 @@ final class DeprecatedRulesReporter { /** * @readonly - * @var \Symfony\Component\Console\Style\SymfonyStyle */ - private $symfonyStyle; + private SymfonyStyle $symfonyStyle; public function __construct(SymfonyStyle $symfonyStyle) { $this->symfonyStyle = $symfonyStyle; diff --git a/src/Reporting/MissConfigurationReporter.php b/src/Reporting/MissConfigurationReporter.php index 904b6a89f74..48e11ab7652 100644 --- a/src/Reporting/MissConfigurationReporter.php +++ b/src/Reporting/MissConfigurationReporter.php @@ -12,14 +12,12 @@ final class MissConfigurationReporter { /** * @readonly - * @var \Symfony\Component\Console\Style\SymfonyStyle */ - private $symfonyStyle; + private SymfonyStyle $symfonyStyle; /** * @readonly - * @var \Rector\Configuration\VendorMissAnalyseGuard */ - private $vendorMissAnalyseGuard; + private VendorMissAnalyseGuard $vendorMissAnalyseGuard; public function __construct(SymfonyStyle $symfonyStyle, VendorMissAnalyseGuard $vendorMissAnalyseGuard) { $this->symfonyStyle = $symfonyStyle; diff --git a/src/Set/SetManager.php b/src/Set/SetManager.php index 5edada81dda..77a7e79482b 100644 --- a/src/Set/SetManager.php +++ b/src/Set/SetManager.php @@ -14,14 +14,12 @@ final class SetManager { /** * @readonly - * @var \Rector\Bridge\SetProviderCollector */ - private $setProviderCollector; + private SetProviderCollector $setProviderCollector; /** * @readonly - * @var \Rector\Composer\InstalledPackageResolver */ - private $installedPackageResolver; + private InstalledPackageResolver $installedPackageResolver; public function __construct(SetProviderCollector $setProviderCollector, InstalledPackageResolver $installedPackageResolver) { $this->setProviderCollector = $setProviderCollector; diff --git a/src/Set/ValueObject/ComposerTriggeredSet.php b/src/Set/ValueObject/ComposerTriggeredSet.php index 5a3c37289dd..db05a2e2e20 100644 --- a/src/Set/ValueObject/ComposerTriggeredSet.php +++ b/src/Set/ValueObject/ComposerTriggeredSet.php @@ -14,24 +14,20 @@ final class ComposerTriggeredSet implements SetInterface { /** * @readonly - * @var string */ - private $groupName; + private string $groupName; /** * @readonly - * @var string */ - private $packageName; + private string $packageName; /** * @readonly - * @var string */ - private $version; + private string $version; /** * @readonly - * @var string */ - private $setFilePath; + private string $setFilePath; /** * @var string * @see https://regex101.com/r/ioYomu/1 diff --git a/src/Set/ValueObject/Set.php b/src/Set/ValueObject/Set.php index f2672e5f170..2633a8caa73 100644 --- a/src/Set/ValueObject/Set.php +++ b/src/Set/ValueObject/Set.php @@ -12,19 +12,16 @@ final class Set implements SetInterface { /** * @readonly - * @var string */ - private $groupName; + private string $groupName; /** * @readonly - * @var string */ - private $setName; + private string $setName; /** * @readonly - * @var string */ - private $setFilePath; + private string $setFilePath; public function __construct(string $groupName, string $setName, string $setFilePath) { $this->groupName = $groupName; diff --git a/src/Skipper/Matcher/FileInfoMatcher.php b/src/Skipper/Matcher/FileInfoMatcher.php index 610a046a835..fc744c775bd 100644 --- a/src/Skipper/Matcher/FileInfoMatcher.php +++ b/src/Skipper/Matcher/FileInfoMatcher.php @@ -11,19 +11,16 @@ final class FileInfoMatcher { /** * @readonly - * @var \Rector\Skipper\FileSystem\FnMatchPathNormalizer */ - private $fnMatchPathNormalizer; + private FnMatchPathNormalizer $fnMatchPathNormalizer; /** * @readonly - * @var \Rector\Skipper\Fnmatcher */ - private $fnmatcher; + private Fnmatcher $fnmatcher; /** * @readonly - * @var \Rector\Skipper\RealpathMatcher */ - private $realpathMatcher; + private RealpathMatcher $realpathMatcher; public function __construct(FnMatchPathNormalizer $fnMatchPathNormalizer, Fnmatcher $fnmatcher, RealpathMatcher $realpathMatcher) { $this->fnMatchPathNormalizer = $fnMatchPathNormalizer; diff --git a/src/Skipper/SkipCriteriaResolver/SkippedPathsResolver.php b/src/Skipper/SkipCriteriaResolver/SkippedPathsResolver.php index 1b6327d155b..54fd7549f5d 100644 --- a/src/Skipper/SkipCriteriaResolver/SkippedPathsResolver.php +++ b/src/Skipper/SkipCriteriaResolver/SkippedPathsResolver.php @@ -14,9 +14,8 @@ final class SkippedPathsResolver { /** * @readonly - * @var \Rector\FileSystem\FilePathHelper */ - private $filePathHelper; + private FilePathHelper $filePathHelper; /** * @var null|string[] */ diff --git a/src/Skipper/SkipVoter/ClassSkipVoter.php b/src/Skipper/SkipVoter/ClassSkipVoter.php index 4ff051c0609..ed2572fda97 100644 --- a/src/Skipper/SkipVoter/ClassSkipVoter.php +++ b/src/Skipper/SkipVoter/ClassSkipVoter.php @@ -10,19 +10,16 @@ final class ClassSkipVoter { /** * @readonly - * @var \Rector\Skipper\Skipper\SkipSkipper */ - private $skipSkipper; + private SkipSkipper $skipSkipper; /** * @readonly - * @var \Rector\Skipper\SkipCriteriaResolver\SkippedClassResolver */ - private $skippedClassResolver; + private SkippedClassResolver $skippedClassResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(SkipSkipper $skipSkipper, SkippedClassResolver $skippedClassResolver, ReflectionProvider $reflectionProvider) { $this->skipSkipper = $skipSkipper; diff --git a/src/Skipper/Skipper/PathSkipper.php b/src/Skipper/Skipper/PathSkipper.php index 566ecf882b6..6e4b2485759 100644 --- a/src/Skipper/Skipper/PathSkipper.php +++ b/src/Skipper/Skipper/PathSkipper.php @@ -9,14 +9,12 @@ final class PathSkipper { /** * @readonly - * @var \Rector\Skipper\Matcher\FileInfoMatcher */ - private $fileInfoMatcher; + private FileInfoMatcher $fileInfoMatcher; /** * @readonly - * @var \Rector\Skipper\SkipCriteriaResolver\SkippedPathsResolver */ - private $skippedPathsResolver; + private SkippedPathsResolver $skippedPathsResolver; public function __construct(FileInfoMatcher $fileInfoMatcher, SkippedPathsResolver $skippedPathsResolver) { $this->fileInfoMatcher = $fileInfoMatcher; diff --git a/src/Skipper/Skipper/SkipSkipper.php b/src/Skipper/Skipper/SkipSkipper.php index 27358b2e30d..21408513f5f 100644 --- a/src/Skipper/Skipper/SkipSkipper.php +++ b/src/Skipper/Skipper/SkipSkipper.php @@ -8,9 +8,8 @@ final class SkipSkipper { /** * @readonly - * @var \Rector\Skipper\Matcher\FileInfoMatcher */ - private $fileInfoMatcher; + private FileInfoMatcher $fileInfoMatcher; public function __construct(FileInfoMatcher $fileInfoMatcher) { $this->fileInfoMatcher = $fileInfoMatcher; diff --git a/src/Skipper/Skipper/Skipper.php b/src/Skipper/Skipper/Skipper.php index 58a4d66c297..8f2a623cfa4 100644 --- a/src/Skipper/Skipper/Skipper.php +++ b/src/Skipper/Skipper/Skipper.php @@ -15,19 +15,16 @@ final class Skipper { /** * @readonly - * @var \Rector\ProcessAnalyzer\RectifiedAnalyzer */ - private $rectifiedAnalyzer; + private RectifiedAnalyzer $rectifiedAnalyzer; /** * @readonly - * @var \Rector\Skipper\Skipper\PathSkipper */ - private $pathSkipper; + private \Rector\Skipper\Skipper\PathSkipper $pathSkipper; /** * @readonly - * @var \Rector\Skipper\SkipVoter\ClassSkipVoter */ - private $classSkipVoter; + private ClassSkipVoter $classSkipVoter; public function __construct(RectifiedAnalyzer $rectifiedAnalyzer, \Rector\Skipper\Skipper\PathSkipper $pathSkipper, ClassSkipVoter $classSkipVoter) { $this->rectifiedAnalyzer = $rectifiedAnalyzer; diff --git a/src/StaticReflection/DynamicSourceLocatorDecorator.php b/src/StaticReflection/DynamicSourceLocatorDecorator.php index f23c9ad0beb..cd0d0fcb163 100644 --- a/src/StaticReflection/DynamicSourceLocatorDecorator.php +++ b/src/StaticReflection/DynamicSourceLocatorDecorator.php @@ -14,19 +14,16 @@ final class DynamicSourceLocatorDecorator { /** * @readonly - * @var \Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider */ - private $dynamicSourceLocatorProvider; + private DynamicSourceLocatorProvider $dynamicSourceLocatorProvider; /** * @readonly - * @var \Rector\FileSystem\FileAndDirectoryFilter */ - private $fileAndDirectoryFilter; + private FileAndDirectoryFilter $fileAndDirectoryFilter; /** * @readonly - * @var \Rector\FileSystem\FilesystemTweaker */ - private $filesystemTweaker; + private FilesystemTweaker $filesystemTweaker; public function __construct(DynamicSourceLocatorProvider $dynamicSourceLocatorProvider, FileAndDirectoryFilter $fileAndDirectoryFilter, FilesystemTweaker $filesystemTweaker) { $this->dynamicSourceLocatorProvider = $dynamicSourceLocatorProvider; diff --git a/src/StaticTypeMapper/Mapper/PhpParserNodeMapper.php b/src/StaticTypeMapper/Mapper/PhpParserNodeMapper.php index 75d7c2da9b6..ce10283254a 100644 --- a/src/StaticTypeMapper/Mapper/PhpParserNodeMapper.php +++ b/src/StaticTypeMapper/Mapper/PhpParserNodeMapper.php @@ -13,7 +13,7 @@ final class PhpParserNodeMapper * @var PhpParserNodeMapperInterface[] * @readonly */ - private $phpParserNodeMappers; + private iterable $phpParserNodeMappers; /** * @param PhpParserNodeMapperInterface[] $phpParserNodeMappers */ diff --git a/src/StaticTypeMapper/Naming/NameScopeFactory.php b/src/StaticTypeMapper/Naming/NameScopeFactory.php index 349fdae7d97..395c1e21ccc 100644 --- a/src/StaticTypeMapper/Naming/NameScopeFactory.php +++ b/src/StaticTypeMapper/Naming/NameScopeFactory.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace Rector\StaticTypeMapper\Naming; +use PhpParser\Node\UseItem; use PhpParser\Node; use PhpParser\Node\Stmt\GroupUse; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; use PHPStan\Analyser\NameScope; use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; @@ -19,9 +19,8 @@ final class NameScopeFactory { /** * @readonly - * @var \Rector\Naming\Naming\UseImportsResolver */ - private $useImportsResolver; + private UseImportsResolver $useImportsResolver; public function __construct(UseImportsResolver $useImportsResolver) { $this->useImportsResolver = $useImportsResolver; @@ -51,7 +50,7 @@ final class NameScopeFactory foreach ($useNodes as $useNode) { $prefix = $this->useImportsResolver->resolvePrefix($useNode); foreach ($useNode->uses as $useUse) { - /** @var UseUse $useUse */ + /** @var UseItem $useUse */ $aliasName = $useUse->getAlias()->name; // uses must be lowercase, as PHPStan lowercases it $lowercasedAliasName = \strtolower($aliasName); diff --git a/src/StaticTypeMapper/PhpDoc/PhpDocTypeMapper.php b/src/StaticTypeMapper/PhpDoc/PhpDocTypeMapper.php index 7975cb0a1d4..7707e024c20 100644 --- a/src/StaticTypeMapper/PhpDoc/PhpDocTypeMapper.php +++ b/src/StaticTypeMapper/PhpDoc/PhpDocTypeMapper.php @@ -19,12 +19,11 @@ final class PhpDocTypeMapper * @var PhpDocTypeMapperInterface[] * @readonly */ - private $phpDocTypeMappers; + private array $phpDocTypeMappers; /** * @readonly - * @var \PHPStan\PhpDoc\TypeNodeResolver */ - private $typeNodeResolver; + private TypeNodeResolver $typeNodeResolver; /** * @param PhpDocTypeMapperInterface[] $phpDocTypeMappers */ diff --git a/src/StaticTypeMapper/PhpDocParser/IdentifierPhpDocTypeMapper.php b/src/StaticTypeMapper/PhpDocParser/IdentifierPhpDocTypeMapper.php index 584d46739e5..51e57c0ce55 100644 --- a/src/StaticTypeMapper/PhpDocParser/IdentifierPhpDocTypeMapper.php +++ b/src/StaticTypeMapper/PhpDocParser/IdentifierPhpDocTypeMapper.php @@ -36,24 +36,20 @@ final class IdentifierPhpDocTypeMapper implements PhpDocTypeMapperInterface { /** * @readonly - * @var \Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier */ - private $objectTypeSpecifier; + private ObjectTypeSpecifier $objectTypeSpecifier; /** * @readonly - * @var \Rector\StaticTypeMapper\Mapper\ScalarStringToTypeMapper */ - private $scalarStringToTypeMapper; + private ScalarStringToTypeMapper $scalarStringToTypeMapper; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ObjectTypeSpecifier $objectTypeSpecifier, ScalarStringToTypeMapper $scalarStringToTypeMapper, ReflectionProvider $reflectionProvider, ReflectionResolver $reflectionResolver) { $this->objectTypeSpecifier = $objectTypeSpecifier; @@ -103,6 +99,7 @@ final class IdentifierPhpDocTypeMapper implements PhpDocTypeMapperInterface $scalarTypes = [new BooleanType(), new StringType(), new IntegerType(), new FloatType()]; return new UnionType($scalarTypes); } + $identifierTypeNode->name = \ltrim($identifierTypeNode->name, '@'); $objectType = new ObjectType($identifierTypeNode->name); } $scope = $node->getAttribute(AttributeKey::SCOPE); diff --git a/src/StaticTypeMapper/PhpDocParser/IntersectionPhpDocTypeMapper.php b/src/StaticTypeMapper/PhpDocParser/IntersectionPhpDocTypeMapper.php index fe5928fe940..45b526b985b 100644 --- a/src/StaticTypeMapper/PhpDocParser/IntersectionPhpDocTypeMapper.php +++ b/src/StaticTypeMapper/PhpDocParser/IntersectionPhpDocTypeMapper.php @@ -19,9 +19,8 @@ final class IntersectionPhpDocTypeMapper implements PhpDocTypeMapperInterface { /** * @readonly - * @var \Rector\StaticTypeMapper\PhpDocParser\IdentifierPhpDocTypeMapper */ - private $identifierPhpDocTypeMapper; + private \Rector\StaticTypeMapper\PhpDocParser\IdentifierPhpDocTypeMapper $identifierPhpDocTypeMapper; public function __construct(\Rector\StaticTypeMapper\PhpDocParser\IdentifierPhpDocTypeMapper $identifierPhpDocTypeMapper) { $this->identifierPhpDocTypeMapper = $identifierPhpDocTypeMapper; diff --git a/src/StaticTypeMapper/PhpDocParser/NullablePhpDocTypeMapper.php b/src/StaticTypeMapper/PhpDocParser/NullablePhpDocTypeMapper.php index 705e9bec902..5175d469448 100644 --- a/src/StaticTypeMapper/PhpDocParser/NullablePhpDocTypeMapper.php +++ b/src/StaticTypeMapper/PhpDocParser/NullablePhpDocTypeMapper.php @@ -20,14 +20,12 @@ final class NullablePhpDocTypeMapper implements PhpDocTypeMapperInterface { /** * @readonly - * @var \Rector\StaticTypeMapper\PhpDocParser\IdentifierPhpDocTypeMapper */ - private $identifierPhpDocTypeMapper; + private \Rector\StaticTypeMapper\PhpDocParser\IdentifierPhpDocTypeMapper $identifierPhpDocTypeMapper; /** * @readonly - * @var \PHPStan\PhpDoc\TypeNodeResolver */ - private $typeNodeResolver; + private TypeNodeResolver $typeNodeResolver; public function __construct(\Rector\StaticTypeMapper\PhpDocParser\IdentifierPhpDocTypeMapper $identifierPhpDocTypeMapper, TypeNodeResolver $typeNodeResolver) { $this->identifierPhpDocTypeMapper = $identifierPhpDocTypeMapper; diff --git a/src/StaticTypeMapper/PhpDocParser/UnionPhpDocTypeMapper.php b/src/StaticTypeMapper/PhpDocParser/UnionPhpDocTypeMapper.php index cfdcc848c37..fe030b74caf 100644 --- a/src/StaticTypeMapper/PhpDocParser/UnionPhpDocTypeMapper.php +++ b/src/StaticTypeMapper/PhpDocParser/UnionPhpDocTypeMapper.php @@ -20,24 +20,20 @@ final class UnionPhpDocTypeMapper implements PhpDocTypeMapperInterface { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpDocParser\IdentifierPhpDocTypeMapper */ - private $identifierPhpDocTypeMapper; + private \Rector\StaticTypeMapper\PhpDocParser\IdentifierPhpDocTypeMapper $identifierPhpDocTypeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpDocParser\IntersectionPhpDocTypeMapper */ - private $intersectionPhpDocTypeMapper; + private \Rector\StaticTypeMapper\PhpDocParser\IntersectionPhpDocTypeMapper $intersectionPhpDocTypeMapper; /** * @readonly - * @var \PHPStan\PhpDoc\TypeNodeResolver */ - private $typeNodeResolver; + private TypeNodeResolver $typeNodeResolver; public function __construct(TypeFactory $typeFactory, \Rector\StaticTypeMapper\PhpDocParser\IdentifierPhpDocTypeMapper $identifierPhpDocTypeMapper, \Rector\StaticTypeMapper\PhpDocParser\IntersectionPhpDocTypeMapper $intersectionPhpDocTypeMapper, TypeNodeResolver $typeNodeResolver) { $this->typeFactory = $typeFactory; diff --git a/src/StaticTypeMapper/PhpParser/IdentifierNodeMapper.php b/src/StaticTypeMapper/PhpParser/IdentifierNodeMapper.php index a753c58920e..f9a9e2fb6c5 100644 --- a/src/StaticTypeMapper/PhpParser/IdentifierNodeMapper.php +++ b/src/StaticTypeMapper/PhpParser/IdentifierNodeMapper.php @@ -15,9 +15,8 @@ final class IdentifierNodeMapper implements PhpParserNodeMapperInterface { /** * @readonly - * @var \Rector\StaticTypeMapper\Mapper\ScalarStringToTypeMapper */ - private $scalarStringToTypeMapper; + private ScalarStringToTypeMapper $scalarStringToTypeMapper; public function __construct(ScalarStringToTypeMapper $scalarStringToTypeMapper) { $this->scalarStringToTypeMapper = $scalarStringToTypeMapper; diff --git a/src/StaticTypeMapper/PhpParser/IntersectionTypeNodeMapper.php b/src/StaticTypeMapper/PhpParser/IntersectionTypeNodeMapper.php index b15e86359fe..f307fdedb01 100644 --- a/src/StaticTypeMapper/PhpParser/IntersectionTypeNodeMapper.php +++ b/src/StaticTypeMapper/PhpParser/IntersectionTypeNodeMapper.php @@ -16,19 +16,16 @@ final class IntersectionTypeNodeMapper implements PhpParserNodeMapperInterface { /** * @readonly - * @var \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper */ - private $fullyQualifiedNodeMapper; + private \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper $fullyQualifiedNodeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpParser\NameNodeMapper */ - private $nameNodeMapper; + private \Rector\StaticTypeMapper\PhpParser\NameNodeMapper $nameNodeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpParser\IdentifierNodeMapper */ - private $identifierNodeMapper; + private \Rector\StaticTypeMapper\PhpParser\IdentifierNodeMapper $identifierNodeMapper; public function __construct(\Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper $fullyQualifiedNodeMapper, \Rector\StaticTypeMapper\PhpParser\NameNodeMapper $nameNodeMapper, \Rector\StaticTypeMapper\PhpParser\IdentifierNodeMapper $identifierNodeMapper) { $this->fullyQualifiedNodeMapper = $fullyQualifiedNodeMapper; diff --git a/src/StaticTypeMapper/PhpParser/NameNodeMapper.php b/src/StaticTypeMapper/PhpParser/NameNodeMapper.php index 1a6a8a81e72..8121e19a314 100644 --- a/src/StaticTypeMapper/PhpParser/NameNodeMapper.php +++ b/src/StaticTypeMapper/PhpParser/NameNodeMapper.php @@ -25,14 +25,12 @@ final class NameNodeMapper implements PhpParserNodeMapperInterface { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper */ - private $fullyQualifiedNodeMapper; + private \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper $fullyQualifiedNodeMapper; public function __construct(ReflectionResolver $reflectionResolver, \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper $fullyQualifiedNodeMapper) { $this->reflectionResolver = $reflectionResolver; diff --git a/src/StaticTypeMapper/PhpParser/NullableTypeNodeMapper.php b/src/StaticTypeMapper/PhpParser/NullableTypeNodeMapper.php index f0e6a277d35..068b82c7859 100644 --- a/src/StaticTypeMapper/PhpParser/NullableTypeNodeMapper.php +++ b/src/StaticTypeMapper/PhpParser/NullableTypeNodeMapper.php @@ -18,24 +18,20 @@ final class NullableTypeNodeMapper implements PhpParserNodeMapperInterface { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper */ - private $fullyQualifiedNodeMapper; + private \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper $fullyQualifiedNodeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpParser\NameNodeMapper */ - private $nameNodeMapper; + private \Rector\StaticTypeMapper\PhpParser\NameNodeMapper $nameNodeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpParser\IdentifierNodeMapper */ - private $identifierNodeMapper; + private \Rector\StaticTypeMapper\PhpParser\IdentifierNodeMapper $identifierNodeMapper; public function __construct(TypeFactory $typeFactory, \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper $fullyQualifiedNodeMapper, \Rector\StaticTypeMapper\PhpParser\NameNodeMapper $nameNodeMapper, \Rector\StaticTypeMapper\PhpParser\IdentifierNodeMapper $identifierNodeMapper) { $this->typeFactory = $typeFactory; diff --git a/src/StaticTypeMapper/PhpParser/UnionTypeNodeMapper.php b/src/StaticTypeMapper/PhpParser/UnionTypeNodeMapper.php index d8479b22048..d0257c73ce1 100644 --- a/src/StaticTypeMapper/PhpParser/UnionTypeNodeMapper.php +++ b/src/StaticTypeMapper/PhpParser/UnionTypeNodeMapper.php @@ -18,29 +18,24 @@ final class UnionTypeNodeMapper implements PhpParserNodeMapperInterface { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper */ - private $fullyQualifiedNodeMapper; + private \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper $fullyQualifiedNodeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpParser\NameNodeMapper */ - private $nameNodeMapper; + private \Rector\StaticTypeMapper\PhpParser\NameNodeMapper $nameNodeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpParser\IdentifierNodeMapper */ - private $identifierNodeMapper; + private \Rector\StaticTypeMapper\PhpParser\IdentifierNodeMapper $identifierNodeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpParser\IntersectionTypeNodeMapper */ - private $intersectionTypeNodeMapper; + private \Rector\StaticTypeMapper\PhpParser\IntersectionTypeNodeMapper $intersectionTypeNodeMapper; public function __construct(TypeFactory $typeFactory, \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper $fullyQualifiedNodeMapper, \Rector\StaticTypeMapper\PhpParser\NameNodeMapper $nameNodeMapper, \Rector\StaticTypeMapper\PhpParser\IdentifierNodeMapper $identifierNodeMapper, \Rector\StaticTypeMapper\PhpParser\IntersectionTypeNodeMapper $intersectionTypeNodeMapper) { $this->typeFactory = $typeFactory; diff --git a/src/StaticTypeMapper/StaticTypeMapper.php b/src/StaticTypeMapper/StaticTypeMapper.php index 626b91c5277..6139913ab3f 100644 --- a/src/StaticTypeMapper/StaticTypeMapper.php +++ b/src/StaticTypeMapper/StaticTypeMapper.php @@ -30,24 +30,20 @@ final class StaticTypeMapper { /** * @readonly - * @var \Rector\StaticTypeMapper\Naming\NameScopeFactory */ - private $nameScopeFactory; + private NameScopeFactory $nameScopeFactory; /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper */ - private $phpStanStaticTypeMapper; + private PHPStanStaticTypeMapper $phpStanStaticTypeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\PhpDoc\PhpDocTypeMapper */ - private $phpDocTypeMapper; + private PhpDocTypeMapper $phpDocTypeMapper; /** * @readonly - * @var \Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper */ - private $phpParserNodeMapper; + private PhpParserNodeMapper $phpParserNodeMapper; public function __construct(NameScopeFactory $nameScopeFactory, PHPStanStaticTypeMapper $phpStanStaticTypeMapper, PhpDocTypeMapper $phpDocTypeMapper, PhpParserNodeMapper $phpParserNodeMapper) { $this->nameScopeFactory = $nameScopeFactory; diff --git a/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php b/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php index af9f44076a8..f04954f4736 100644 --- a/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php @@ -3,9 +3,9 @@ declare (strict_types=1); namespace Rector\StaticTypeMapper\ValueObject\Type; +use PhpParser\Node\UseItem; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use Rector\StaticTypeMapper\Resolver\ClassNameFromObjectTypeResolver; @@ -16,9 +16,8 @@ final class AliasedObjectType extends ObjectType { /** * @readonly - * @var string */ - private $fullyQualifiedClass; + private string $fullyQualifiedClass; public function __construct(string $alias, string $fullyQualifiedClass) { $this->fullyQualifiedClass = $fullyQualifiedClass; @@ -34,8 +33,8 @@ final class AliasedObjectType extends ObjectType public function getUseNode(int $useType) : Use_ { $name = new Name($this->fullyQualifiedClass); - $useUse = new UseUse($name, $this->getClassName()); - $use = new Use_([$useUse]); + $useItem = new UseItem($name, $this->getClassName()); + $use = new Use_([$useItem]); $use->type = $useType; return $use; } diff --git a/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php b/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php index 21e6bdd9bbb..14595b68076 100644 --- a/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace Rector\StaticTypeMapper\ValueObject\Type; +use PhpParser\Node\UseItem; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; use PHPStan\Type\ObjectType; use Rector\NodeTypeResolver\Node\AttributeKey; /** @@ -46,8 +46,8 @@ final class FullyQualifiedObjectType extends ObjectType public function getUseNode(int $useType) : Use_ { $name = new Name($this->getClassName()); - $useUse = new UseUse($name); - $use = new Use_([$useUse]); + $useItem = new UseItem($name); + $use = new Use_([$useItem]); $use->type = $useType; return $use; } diff --git a/src/StaticTypeMapper/ValueObject/Type/ShortenedGenericObjectType.php b/src/StaticTypeMapper/ValueObject/Type/ShortenedGenericObjectType.php index 88dee113e7b..47d63edb7d4 100644 --- a/src/StaticTypeMapper/ValueObject/Type/ShortenedGenericObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/ShortenedGenericObjectType.php @@ -3,7 +3,7 @@ declare (strict_types=1); namespace Rector\StaticTypeMapper\ValueObject\Type; -use PHPStan\TrinaryLogic; +use PHPStan\Type\IsSuperTypeOfResult; use PHPStan\Type\Generic\GenericObjectType; use PHPStan\Type\Type; /** @@ -15,7 +15,7 @@ final class ShortenedGenericObjectType extends GenericObjectType * @var class-string * @readonly */ - private $fullyQualifiedName; + private string $fullyQualifiedName; /** * @param class-string $fullyQualifiedName */ @@ -24,7 +24,7 @@ final class ShortenedGenericObjectType extends GenericObjectType $this->fullyQualifiedName = $fullyQualifiedName; parent::__construct($shortName, $types); } - public function isSuperTypeOf(Type $type) : TrinaryLogic + public function isSuperTypeOf(Type $type) : IsSuperTypeOfResult { $genericObjectType = new GenericObjectType($this->fullyQualifiedName, $this->getTypes()); return $genericObjectType->isSuperTypeOf($type); diff --git a/src/StaticTypeMapper/ValueObject/Type/ShortenedObjectType.php b/src/StaticTypeMapper/ValueObject/Type/ShortenedObjectType.php index 66626aa4dda..768176f5315 100644 --- a/src/StaticTypeMapper/ValueObject/Type/ShortenedObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/ShortenedObjectType.php @@ -3,7 +3,7 @@ declare (strict_types=1); namespace Rector\StaticTypeMapper\ValueObject\Type; -use PHPStan\TrinaryLogic; +use PHPStan\Type\IsSuperTypeOfResult; use PHPStan\Type\ObjectType; use PHPStan\Type\Type; /** @@ -15,7 +15,7 @@ final class ShortenedObjectType extends ObjectType * @var class-string * @readonly */ - private $fullyQualifiedName; + private string $fullyQualifiedName; /** * @param class-string $fullyQualifiedName */ @@ -24,7 +24,7 @@ final class ShortenedObjectType extends ObjectType $this->fullyQualifiedName = $fullyQualifiedName; parent::__construct($shortName); } - public function isSuperTypeOf(Type $type) : TrinaryLogic + public function isSuperTypeOf(Type $type) : IsSuperTypeOfResult { $fullyQualifiedObjectType = new ObjectType($this->fullyQualifiedName); return $fullyQualifiedObjectType->isSuperTypeOf($type); diff --git a/src/StaticTypeMapper/ValueObject/Type/SimpleStaticType.php b/src/StaticTypeMapper/ValueObject/Type/SimpleStaticType.php index f6b934369a7..661adb53176 100644 --- a/src/StaticTypeMapper/ValueObject/Type/SimpleStaticType.php +++ b/src/StaticTypeMapper/ValueObject/Type/SimpleStaticType.php @@ -8,9 +8,8 @@ final class SimpleStaticType extends StaticType { /** * @readonly - * @var string */ - private $className; + private string $className; public function __construct(string $className) { $this->className = $className; diff --git a/src/Testing/PHPUnit/AbstractLazyTestCase.php b/src/Testing/PHPUnit/AbstractLazyTestCase.php index 9a7d10c49f4..f2465accc72 100644 --- a/src/Testing/PHPUnit/AbstractLazyTestCase.php +++ b/src/Testing/PHPUnit/AbstractLazyTestCase.php @@ -8,10 +8,7 @@ use Rector\Config\RectorConfig; use Rector\DependencyInjection\LazyContainerFactory; abstract class AbstractLazyTestCase extends TestCase { - /** - * @var \Rector\Config\RectorConfig|null - */ - protected static $rectorConfig; + protected static ?RectorConfig $rectorConfig = null; /** * @api * @param string[] $configFiles diff --git a/src/Testing/PHPUnit/AbstractRectorTestCase.php b/src/Testing/PHPUnit/AbstractRectorTestCase.php index 1c0390887dd..70e664ec6a0 100644 --- a/src/Testing/PHPUnit/AbstractRectorTestCase.php +++ b/src/Testing/PHPUnit/AbstractRectorTestCase.php @@ -32,22 +32,13 @@ use Rector\Util\Reflection\PrivatesAccessor; */ abstract class AbstractRectorTestCase extends \Rector\Testing\PHPUnit\AbstractLazyTestCase implements RectorTestInterface { - /** - * @var \Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider - */ - private $dynamicSourceLocatorProvider; - /** - * @var \Rector\Application\ApplicationFileProcessor - */ - private $applicationFileProcessor; - /** - * @var string|null - */ - private $inputFilePath; + private DynamicSourceLocatorProvider $dynamicSourceLocatorProvider; + private ApplicationFileProcessor $applicationFileProcessor; + private ?string $inputFilePath = null; /** * @var array */ - private static $cacheByRuleAndConfig = []; + private static array $cacheByRuleAndConfig = []; /** * Restore default parameters */ diff --git a/src/Testing/PHPUnit/ValueObject/RectorTestResult.php b/src/Testing/PHPUnit/ValueObject/RectorTestResult.php index 4d5623b6e94..c4ba3c55a19 100644 --- a/src/Testing/PHPUnit/ValueObject/RectorTestResult.php +++ b/src/Testing/PHPUnit/ValueObject/RectorTestResult.php @@ -12,14 +12,12 @@ final class RectorTestResult { /** * @readonly - * @var string */ - private $changedContents; + private string $changedContents; /** * @readonly - * @var \Rector\ValueObject\ProcessResult */ - private $processResult; + private ProcessResult $processResult; public function __construct(string $changedContents, ProcessResult $processResult) { $this->changedContents = $changedContents; diff --git a/src/Testing/TestingParser/TestingParser.php b/src/Testing/TestingParser/TestingParser.php index d69ef0f3895..00ad6410eda 100644 --- a/src/Testing/TestingParser/TestingParser.php +++ b/src/Testing/TestingParser/TestingParser.php @@ -17,24 +17,20 @@ final class TestingParser { /** * @readonly - * @var \Rector\PhpParser\Parser\RectorParser */ - private $rectorParser; + private RectorParser $rectorParser; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeScopeAndMetadataDecorator */ - private $nodeScopeAndMetadataDecorator; + private NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator; /** * @readonly - * @var \Rector\Application\Provider\CurrentFileProvider */ - private $currentFileProvider; + private CurrentFileProvider $currentFileProvider; /** * @readonly - * @var \Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider */ - private $dynamicSourceLocatorProvider; + private DynamicSourceLocatorProvider $dynamicSourceLocatorProvider; public function __construct(RectorParser $rectorParser, NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator, CurrentFileProvider $currentFileProvider, DynamicSourceLocatorProvider $dynamicSourceLocatorProvider) { $this->rectorParser = $rectorParser; diff --git a/src/Util/ArrayParametersMerger.php b/src/Util/ArrayParametersMerger.php index ba1ef547eed..7cd427fdc99 100644 --- a/src/Util/ArrayParametersMerger.php +++ b/src/Util/ArrayParametersMerger.php @@ -17,9 +17,7 @@ final class ArrayParametersMerger public function merge($left, $right) { if (\is_array($left) && \is_array($right)) { - return $this->mergeLeftToRightWithCallable($left, $right, function ($leftValue, $rightValue) { - return $this->merge($leftValue, $rightValue); - }); + return $this->mergeLeftToRightWithCallable($left, $right, fn($leftValue, $rightValue) => $this->merge($leftValue, $rightValue)); } if ($left !== null) { return $left; diff --git a/src/Util/NodePrinter.php b/src/Util/NodePrinter.php index d2c5cb61836..5ff8eefa130 100644 --- a/src/Util/NodePrinter.php +++ b/src/Util/NodePrinter.php @@ -11,9 +11,8 @@ final class NodePrinter { /** * @readonly - * @var \Symfony\Component\Console\Style\SymfonyStyle */ - private $symfonyStyle; + private SymfonyStyle $symfonyStyle; /** * @var string * @see https://regex101.com/r/Fe8n73/1 @@ -42,12 +41,8 @@ final class NodePrinter private function addConsoleColors(string $contents) : string { // decorate class names - $colorContents = Strings::replace($contents, self::CLASS_NAME_REGEX, static function (array $match) : string { - return '' . $match['class_name'] . '('; - }); + $colorContents = Strings::replace($contents, self::CLASS_NAME_REGEX, static fn(array $match): string => '' . $match['class_name'] . '('); // decorate keys - return Strings::replace($colorContents, self::PROPERTY_KEY_REGEX, static function (array $match) : string { - return '' . $match['key'] . ':'; - }); + return Strings::replace($colorContents, self::PROPERTY_KEY_REGEX, static fn(array $match): string => '' . $match['key'] . ':'); } } diff --git a/src/ValueObject/Application/File.php b/src/ValueObject/Application/File.php index 594bf233ff8..10b02a1a0e4 100644 --- a/src/ValueObject/Application/File.php +++ b/src/ValueObject/Application/File.php @@ -7,6 +7,7 @@ use PhpParser\Node; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\InlineHTML; use PhpParser\NodeFinder; +use PhpParser\Token; use Rector\ChangesReporting\ValueObject\RectorWithLineChange; use Rector\Exception\ShouldNotHappenException; use Rector\ValueObject\Reporting\FileDiff; @@ -14,47 +15,35 @@ final class File { /** * @readonly - * @var string */ - private $filePath; - /** - * @var string - */ - private $fileContent; - /** - * @var bool - */ - private $hasChanged = \false; + private string $filePath; + private string $fileContent; + private bool $hasChanged = \false; /** * @readonly - * @var string */ - private $originalFileContent; - /** - * @var \Rector\ValueObject\Reporting\FileDiff|null - */ - private $fileDiff; + private string $originalFileContent; + private ?FileDiff $fileDiff = null; /** * @var Node[] */ - private $oldStmts = []; + private array $oldStmts = []; /** * @var Node[] */ - private $newStmts = []; + private array $newStmts = []; /** - * @var array + * @var array */ - private $oldTokens = []; + private array $oldTokens = []; /** * @var RectorWithLineChange[] */ - private $rectorWithLineChanges = []; + private array $rectorWithLineChanges = []; /** * Cached result per file - * @var bool|null */ - private $containsHtml; + private ?bool $containsHtml = null; public function __construct(string $filePath, string $fileContent) { $this->filePath = $filePath; @@ -100,7 +89,7 @@ final class File /** * @param Stmt[] $newStmts * @param Stmt[] $oldStmts - * @param array $oldTokens + * @param array $oldTokens */ public function hydrateStmtsAndTokens(array $newStmts, array $oldStmts, array $oldTokens) : void { @@ -126,7 +115,7 @@ final class File return $this->newStmts; } /** - * @return array + * @return array */ public function getOldTokens() : array { diff --git a/src/ValueObject/Bootstrap/BootstrapConfigs.php b/src/ValueObject/Bootstrap/BootstrapConfigs.php index 4d7e91b5c57..1d44c1c5c2d 100644 --- a/src/ValueObject/Bootstrap/BootstrapConfigs.php +++ b/src/ValueObject/Bootstrap/BootstrapConfigs.php @@ -7,14 +7,13 @@ final class BootstrapConfigs { /** * @readonly - * @var string|null */ - private $mainConfigFile; + private ?string $mainConfigFile; /** * @var string[] * @readonly */ - private $setConfigFiles; + private array $setConfigFiles; /** * @param string[] $setConfigFiles */ diff --git a/src/ValueObject/Configuration.php b/src/ValueObject/Configuration.php index 87c333e00f7..c57f881220b 100644 --- a/src/ValueObject/Configuration.php +++ b/src/ValueObject/Configuration.php @@ -9,39 +9,34 @@ final class Configuration { /** * @readonly - * @var bool */ - private $isDryRun = \false; + private bool $isDryRun = \false; /** * @readonly - * @var bool */ - private $showProgressBar = \true; + private bool $showProgressBar = \true; /** * @readonly - * @var bool */ - private $shouldClearCache = \false; + private bool $shouldClearCache = \false; /** * @readonly - * @var string */ - private $outputFormat = ConsoleOutputFormatter::NAME; + private string $outputFormat = ConsoleOutputFormatter::NAME; /** * @var string[] * @readonly */ - private $fileExtensions = ['php']; + private array $fileExtensions = ['php']; /** * @var string[] * @readonly */ - private $paths = []; + private array $paths = []; /** * @readonly - * @var bool */ - private $showDiffs = \true; + private bool $showDiffs = \true; /** * @readonly * @var string|null @@ -54,9 +49,8 @@ final class Configuration private $parallelIdentifier = null; /** * @readonly - * @var bool */ - private $isParallel = \false; + private bool $isParallel = \false; /** * @readonly * @var string|null @@ -64,14 +58,12 @@ final class Configuration private $memoryLimit = null; /** * @readonly - * @var bool */ - private $isDebug = \false; + private bool $isDebug = \false; /** * @readonly - * @var bool */ - private $reportingWithRealPath = \false; + private bool $reportingWithRealPath = \false; /** * @param string[] $fileExtensions * @param string[] $paths diff --git a/src/ValueObject/Error/SystemError.php b/src/ValueObject/Error/SystemError.php index 1472ac2f6bc..885c8df7073 100644 --- a/src/ValueObject/Error/SystemError.php +++ b/src/ValueObject/Error/SystemError.php @@ -9,9 +9,8 @@ final class SystemError implements SerializableInterface { /** * @readonly - * @var string */ - private $message; + private string $message; /** * @readonly * @var string|null @@ -68,9 +67,8 @@ final class SystemError implements SerializableInterface } /** * @param mixed[] $json - * @return $this */ - public static function decode(array $json) : \RectorPrefix202411\Symplify\EasyParallel\Contract\SerializableInterface + public static function decode(array $json) : self { return new self($json[BridgeItem::MESSAGE], $json[BridgeItem::RELATIVE_FILE_PATH], $json[BridgeItem::LINE], $json[BridgeItem::RECTOR_CLASS]); } diff --git a/src/ValueObject/FileProcessResult.php b/src/ValueObject/FileProcessResult.php index 0ad0a13c2b5..c5b8287d68d 100644 --- a/src/ValueObject/FileProcessResult.php +++ b/src/ValueObject/FileProcessResult.php @@ -12,12 +12,11 @@ final class FileProcessResult * @var SystemError[] * @readonly */ - private $systemErrors; + private array $systemErrors; /** * @readonly - * @var \Rector\ValueObject\Reporting\FileDiff|null */ - private $fileDiff; + private ?FileDiff $fileDiff; /** * @param SystemError[] $systemErrors */ diff --git a/src/ValueObject/FuncCallAndExpr.php b/src/ValueObject/FuncCallAndExpr.php index 2bdb1ea8a10..c345748ad98 100644 --- a/src/ValueObject/FuncCallAndExpr.php +++ b/src/ValueObject/FuncCallAndExpr.php @@ -9,14 +9,12 @@ final class FuncCallAndExpr { /** * @readonly - * @var \PhpParser\Node\Expr\FuncCall */ - private $funcCall; + private FuncCall $funcCall; /** * @readonly - * @var \PhpParser\Node\Expr */ - private $expr; + private Expr $expr; public function __construct(FuncCall $funcCall, Expr $expr) { $this->funcCall = $funcCall; diff --git a/src/ValueObject/ProcessResult.php b/src/ValueObject/ProcessResult.php index 234bd9a289d..b79b7973b65 100644 --- a/src/ValueObject/ProcessResult.php +++ b/src/ValueObject/ProcessResult.php @@ -11,12 +11,12 @@ final class ProcessResult /** * @var SystemError[] */ - private $systemErrors; + private array $systemErrors; /** * @var FileDiff[] * @readonly */ - private $fileDiffs; + private array $fileDiffs; /** * @param SystemError[] $systemErrors * @param FileDiff[] $fileDiffs diff --git a/src/ValueObject/Reporting/FileDiff.php b/src/ValueObject/Reporting/FileDiff.php index 75a1c02dd65..e4485396d74 100644 --- a/src/ValueObject/Reporting/FileDiff.php +++ b/src/ValueObject/Reporting/FileDiff.php @@ -13,24 +13,21 @@ final class FileDiff implements SerializableInterface { /** * @readonly - * @var string */ - private $relativeFilePath; + private string $relativeFilePath; /** * @readonly - * @var string */ - private $diff; + private string $diff; /** * @readonly - * @var string */ - private $diffConsoleFormatted; + private string $diffConsoleFormatted; /** * @var RectorWithLineChange[] * @readonly */ - private $rectorsWithLineChanges = []; + private array $rectorsWithLineChanges = []; /** * @var string * @se https://regex101.com/r/AUPIX4/1 @@ -114,9 +111,8 @@ final class FileDiff implements SerializableInterface } /** * @param array $json - * @return $this */ - public static function decode(array $json) : \RectorPrefix202411\Symplify\EasyParallel\Contract\SerializableInterface + public static function decode(array $json) : self { $rectorWithLineChanges = []; foreach ($json[BridgeItem::RECTORS_WITH_LINE_CHANGES] as $rectorWithLineChangesJson) { diff --git a/src/ValueObject/SprintfStringAndArgs.php b/src/ValueObject/SprintfStringAndArgs.php index 0e2c54657fb..d3562f399a5 100644 --- a/src/ValueObject/SprintfStringAndArgs.php +++ b/src/ValueObject/SprintfStringAndArgs.php @@ -9,14 +9,13 @@ final class SprintfStringAndArgs { /** * @readonly - * @var \PhpParser\Node\Scalar\String_ */ - private $string; + private String_ $string; /** * @var Expr[] * @readonly */ - private $arrayItems; + private array $arrayItems; /** * @param Expr[] $arrayItems */ diff --git a/src/ValueObject/Visibility.php b/src/ValueObject/Visibility.php index c8f7aa9b3f0..a3fb27e7ed1 100644 --- a/src/ValueObject/Visibility.php +++ b/src/ValueObject/Visibility.php @@ -3,35 +3,35 @@ declare (strict_types=1); namespace Rector\ValueObject; -use PhpParser\Node\Stmt\Class_; +use PhpParser\Modifiers; final class Visibility { /** * @var int */ - public const PUBLIC = Class_::MODIFIER_PUBLIC; + public const PUBLIC = Modifiers::PUBLIC; /** * @var int */ - public const PROTECTED = Class_::MODIFIER_PROTECTED; + public const PROTECTED = Modifiers::PROTECTED; /** * @var int */ - public const PRIVATE = Class_::MODIFIER_PRIVATE; + public const PRIVATE = Modifiers::PRIVATE; /** * @var int */ - public const STATIC = Class_::MODIFIER_STATIC; + public const STATIC = Modifiers::STATIC; /** * @var int */ - public const ABSTRACT = Class_::MODIFIER_ABSTRACT; + public const ABSTRACT = Modifiers::ABSTRACT; /** * @var int */ - public const FINAL = Class_::MODIFIER_FINAL; + public const FINAL = Modifiers::FINAL; /** * @var int */ - public const READONLY = Class_::MODIFIER_READONLY; + public const READONLY = Modifiers::READONLY; } diff --git a/src/VendorLocker/NodeVendorLocker/ClassMethodParamVendorLockResolver.php b/src/VendorLocker/NodeVendorLocker/ClassMethodParamVendorLockResolver.php index 548124e5eef..01e1b48a2f4 100644 --- a/src/VendorLocker/NodeVendorLocker/ClassMethodParamVendorLockResolver.php +++ b/src/VendorLocker/NodeVendorLocker/ClassMethodParamVendorLockResolver.php @@ -12,19 +12,16 @@ final class ClassMethodParamVendorLockResolver { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\FileSystem\FilePathHelper */ - private $filePathHelper; + private FilePathHelper $filePathHelper; public function __construct(NodeNameResolver $nodeNameResolver, ReflectionResolver $reflectionResolver, FilePathHelper $filePathHelper) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/src/VendorLocker/NodeVendorLocker/ClassMethodReturnTypeOverrideGuard.php b/src/VendorLocker/NodeVendorLocker/ClassMethodReturnTypeOverrideGuard.php index 1b2e515d978..7c70f83bd43 100644 --- a/src/VendorLocker/NodeVendorLocker/ClassMethodReturnTypeOverrideGuard.php +++ b/src/VendorLocker/NodeVendorLocker/ClassMethodReturnTypeOverrideGuard.php @@ -6,7 +6,7 @@ namespace Rector\VendorLocker\NodeVendorLocker; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; -use PHPStan\Reflection\FunctionVariantWithPhpDocs; +use PHPStan\Reflection\ExtendedFunctionVariant; use PHPStan\Reflection\MethodReflection; use PHPStan\Type\MixedType; use Rector\FileSystem\FilePathHelper; @@ -18,24 +18,20 @@ final class ClassMethodReturnTypeOverrideGuard { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\VendorLocker\ParentClassMethodTypeOverrideGuard */ - private $parentClassMethodTypeOverrideGuard; + private ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard; /** * @readonly - * @var \Rector\FileSystem\FilePathHelper */ - private $filePathHelper; + private FilePathHelper $filePathHelper; /** * @readonly - * @var \Rector\NodeAnalyzer\MagicClassMethodAnalyzer */ - private $magicClassMethodAnalyzer; + private MagicClassMethodAnalyzer $magicClassMethodAnalyzer; public function __construct(ReflectionResolver $reflectionResolver, ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard, FilePathHelper $filePathHelper, MagicClassMethodAnalyzer $magicClassMethodAnalyzer) { $this->reflectionResolver = $reflectionResolver; @@ -73,7 +69,7 @@ final class ClassMethodReturnTypeOverrideGuard return !$this->parentClassMethodTypeOverrideGuard->hasParentClassMethod($classMethod); } $parametersAcceptor = ParametersAcceptorSelectorVariantsWrapper::select($parentClassMethodReflection, $classMethod, $scope); - if ($parametersAcceptor instanceof FunctionVariantWithPhpDocs && !$parametersAcceptor->getNativeReturnType() instanceof MixedType) { + if ($parametersAcceptor instanceof ExtendedFunctionVariant && !$parametersAcceptor->getNativeReturnType() instanceof MixedType) { return \false; } $classReflection = $parentClassMethodReflection->getDeclaringClass(); diff --git a/src/VendorLocker/NodeVendorLocker/ClassMethodReturnVendorLockResolver.php b/src/VendorLocker/NodeVendorLocker/ClassMethodReturnVendorLockResolver.php index 4e96aefa65a..83bafd1b715 100644 --- a/src/VendorLocker/NodeVendorLocker/ClassMethodReturnVendorLockResolver.php +++ b/src/VendorLocker/NodeVendorLocker/ClassMethodReturnVendorLockResolver.php @@ -5,7 +5,7 @@ namespace Rector\VendorLocker\NodeVendorLocker; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\Reflection\ClassReflection; -use PHPStan\Reflection\FunctionVariantWithPhpDocs; +use PHPStan\Reflection\ExtendedFunctionVariant; use PHPStan\Type\MixedType; use Rector\NodeAnalyzer\MagicClassMethodAnalyzer; use Rector\NodeNameResolver\NodeNameResolver; @@ -14,19 +14,16 @@ final class ClassMethodReturnVendorLockResolver { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\MagicClassMethodAnalyzer */ - private $magicClassMethodAnalyzer; + private MagicClassMethodAnalyzer $magicClassMethodAnalyzer; public function __construct(NodeNameResolver $nodeNameResolver, ReflectionResolver $reflectionResolver, MagicClassMethodAnalyzer $magicClassMethodAnalyzer) { $this->nodeNameResolver = $nodeNameResolver; @@ -64,7 +61,7 @@ final class ClassMethodReturnVendorLockResolver } $parentClassMethodReflection = $ancestorClassReflections->getNativeMethod($methodName); $parametersAcceptor = $parentClassMethodReflection->getVariants()[0]; - if (!$parametersAcceptor instanceof FunctionVariantWithPhpDocs) { + if (!$parametersAcceptor instanceof ExtendedFunctionVariant) { continue; } // here we count only on strict types, not on docs diff --git a/src/VendorLocker/ParentClassMethodTypeOverrideGuard.php b/src/VendorLocker/ParentClassMethodTypeOverrideGuard.php index 552c892071f..63cf264a169 100644 --- a/src/VendorLocker/ParentClassMethodTypeOverrideGuard.php +++ b/src/VendorLocker/ParentClassMethodTypeOverrideGuard.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\VendorLocker; +use PhpParser\Node; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\MethodReflection; @@ -17,29 +18,24 @@ final class ParentClassMethodTypeOverrideGuard { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator */ - private $typeComparator; + private TypeComparator $typeComparator; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\Reflection\ClassReflectionAnalyzer */ - private $classReflectionAnalyzer; + private ClassReflectionAnalyzer $classReflectionAnalyzer; public function __construct(NodeNameResolver $nodeNameResolver, ReflectionResolver $reflectionResolver, TypeComparator $typeComparator, StaticTypeMapper $staticTypeMapper, ClassReflectionAnalyzer $classReflectionAnalyzer) { $this->nodeNameResolver = $nodeNameResolver; @@ -75,7 +71,7 @@ final class ParentClassMethodTypeOverrideGuard } public function shouldSkipReturnTypeChange(ClassMethod $classMethod, Type $parentType) : bool { - if ($classMethod->returnType === null) { + if (!$classMethod->returnType instanceof Node) { return \false; } $currentReturnType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($classMethod->returnType); diff --git a/src/VersionBonding/PhpVersionedFilter.php b/src/VersionBonding/PhpVersionedFilter.php index fbf24fff4ca..742bafa10cf 100644 --- a/src/VersionBonding/PhpVersionedFilter.php +++ b/src/VersionBonding/PhpVersionedFilter.php @@ -12,14 +12,12 @@ final class PhpVersionedFilter { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\Php\PolyfillPackagesProvider */ - private $polyfillPackagesProvider; + private PolyfillPackagesProvider $polyfillPackagesProvider; public function __construct(PhpVersionProvider $phpVersionProvider, PolyfillPackagesProvider $polyfillPackagesProvider) { $this->phpVersionProvider = $phpVersionProvider; diff --git a/vendor/autoload.php b/vendor/autoload.php index cf96b452472..2f95a4719ea 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) { require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit274d85655bbeae08896bd1a845bbbd57::getLoader(); +return ComposerAutoloaderInitc12d7e0a7ec6f5f877903ca571cd9ab7::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 9b98eb2aa22..4734abe4658 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -20,7 +20,6 @@ return array( 'PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprTrueNode' => $vendorDir . '/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprTrueNode.php', 'PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstFetchNode' => $vendorDir . '/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstFetchNode.php', 'PHPStan\\PhpDocParser\\Ast\\ConstExpr\\DoctrineConstExprStringNode' => $vendorDir . '/phpstan/phpdoc-parser/src/Ast/ConstExpr/DoctrineConstExprStringNode.php', - 'PHPStan\\PhpDocParser\\Ast\\ConstExpr\\QuoteAwareConstExprStringNode' => $vendorDir . '/phpstan/phpdoc-parser/src/Ast/ConstExpr/QuoteAwareConstExprStringNode.php', 'PHPStan\\PhpDocParser\\Ast\\Node' => $vendorDir . '/phpstan/phpdoc-parser/src/Ast/Node.php', 'PHPStan\\PhpDocParser\\Ast\\NodeAttributes' => $vendorDir . '/phpstan/phpdoc-parser/src/Ast/NodeAttributes.php', 'PHPStan\\PhpDocParser\\Ast\\NodeTraverser' => $vendorDir . '/phpstan/phpdoc-parser/src/Ast/NodeTraverser.php', @@ -86,6 +85,7 @@ return array( 'PHPStan\\PhpDocParser\\Ast\\Type\\TypeNode' => $vendorDir . '/phpstan/phpdoc-parser/src/Ast/Type/TypeNode.php', 'PHPStan\\PhpDocParser\\Ast\\Type\\UnionTypeNode' => $vendorDir . '/phpstan/phpdoc-parser/src/Ast/Type/UnionTypeNode.php', 'PHPStan\\PhpDocParser\\Lexer\\Lexer' => $vendorDir . '/phpstan/phpdoc-parser/src/Lexer/Lexer.php', + 'PHPStan\\PhpDocParser\\ParserConfig' => $vendorDir . '/phpstan/phpdoc-parser/src/ParserConfig.php', 'PHPStan\\PhpDocParser\\Parser\\ConstExprParser' => $vendorDir . '/phpstan/phpdoc-parser/src/Parser/ConstExprParser.php', 'PHPStan\\PhpDocParser\\Parser\\ParserException' => $vendorDir . '/phpstan/phpdoc-parser/src/Parser/ParserException.php', 'PHPStan\\PhpDocParser\\Parser\\PhpDocParser' => $vendorDir . '/phpstan/phpdoc-parser/src/Parser/PhpDocParser.php', @@ -125,24 +125,24 @@ return array( 'PhpParser\\Internal\\DiffElem' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php', 'PhpParser\\Internal\\Differ' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Internal/Differ.php', 'PhpParser\\Internal\\PrintableNewAnonClassNode' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php', + 'PhpParser\\Internal\\TokenPolyfill' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php', 'PhpParser\\Internal\\TokenStream' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php', 'PhpParser\\JsonDecoder' => $vendorDir . '/nikic/php-parser/lib/PhpParser/JsonDecoder.php', 'PhpParser\\Lexer' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer.php', 'PhpParser\\Lexer\\Emulative' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php', + 'PhpParser\\Lexer\\TokenEmulator\\AsymmetricVisibilityTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AsymmetricVisibilityTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\AttributeEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php', - 'PhpParser\\Lexer\\TokenEmulator\\CoaleseEqualTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\EnumTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\ExplicitOctalEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php', - 'PhpParser\\Lexer\\TokenEmulator\\FlexibleDocStringEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php', - 'PhpParser\\Lexer\\TokenEmulator\\FnTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\KeywordEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\MatchTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\NullsafeTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php', - 'PhpParser\\Lexer\\TokenEmulator\\NumericLiteralSeparatorEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\PropertyTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/PropertyTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\ReadonlyFunctionTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\ReadonlyTokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\ReverseEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\TokenEmulator' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php', + 'PhpParser\\Modifiers' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Modifiers.php', 'PhpParser\\NameContext' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NameContext.php', 'PhpParser\\Node' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node.php', 'PhpParser\\NodeAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeAbstract.php', @@ -153,19 +153,22 @@ return array( 'PhpParser\\NodeVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor.php', 'PhpParser\\NodeVisitorAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php', 'PhpParser\\NodeVisitor\\CloningVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php', + 'PhpParser\\NodeVisitor\\CommentAnnotatingVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php', 'PhpParser\\NodeVisitor\\FindingVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php', 'PhpParser\\NodeVisitor\\FirstFindingVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php', 'PhpParser\\NodeVisitor\\NameResolver' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php', 'PhpParser\\NodeVisitor\\NodeConnectingVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php', 'PhpParser\\NodeVisitor\\ParentConnectingVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php', 'PhpParser\\Node\\Arg' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Arg.php', + 'PhpParser\\Node\\ArrayItem' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php', 'PhpParser\\Node\\Attribute' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Attribute.php', 'PhpParser\\Node\\AttributeGroup' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php', + 'PhpParser\\Node\\ClosureUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php', 'PhpParser\\Node\\ComplexType' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/ComplexType.php', 'PhpParser\\Node\\Const_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Const_.php', + 'PhpParser\\Node\\DeclareItem' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php', 'PhpParser\\Node\\Expr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr.php', 'PhpParser\\Node\\Expr\\ArrayDimFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php', - 'PhpParser\\Node\\Expr\\ArrayItem' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php', 'PhpParser\\Node\\Expr\\Array_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php', 'PhpParser\\Node\\Expr\\ArrowFunction' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php', 'PhpParser\\Node\\Expr\\Assign' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php', @@ -226,7 +229,6 @@ return array( 'PhpParser\\Node\\Expr\\ClassConstFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php', 'PhpParser\\Node\\Expr\\Clone_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php', 'PhpParser\\Node\\Expr\\Closure' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php', - 'PhpParser\\Node\\Expr\\ClosureUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php', 'PhpParser\\Node\\Expr\\ConstFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php', 'PhpParser\\Node\\Expr\\Empty_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php', 'PhpParser\\Node\\Expr\\Error' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php', @@ -261,6 +263,7 @@ return array( 'PhpParser\\Node\\Expr\\Yield_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php', 'PhpParser\\Node\\FunctionLike' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php', 'PhpParser\\Node\\Identifier' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Identifier.php', + 'PhpParser\\Node\\InterpolatedStringPart' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php', 'PhpParser\\Node\\IntersectionType' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php', 'PhpParser\\Node\\MatchArm' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/MatchArm.php', 'PhpParser\\Node\\Name' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Name.php', @@ -268,11 +271,12 @@ return array( 'PhpParser\\Node\\Name\\Relative' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php', 'PhpParser\\Node\\NullableType' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/NullableType.php', 'PhpParser\\Node\\Param' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Param.php', + 'PhpParser\\Node\\PropertyHook' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/PropertyHook.php', + 'PhpParser\\Node\\PropertyItem' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php', 'PhpParser\\Node\\Scalar' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar.php', - 'PhpParser\\Node\\Scalar\\DNumber' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php', - 'PhpParser\\Node\\Scalar\\Encapsed' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php', - 'PhpParser\\Node\\Scalar\\EncapsedStringPart' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php', - 'PhpParser\\Node\\Scalar\\LNumber' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php', + 'PhpParser\\Node\\Scalar\\Float_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php', + 'PhpParser\\Node\\Scalar\\Int_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php', + 'PhpParser\\Node\\Scalar\\InterpolatedString' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php', 'PhpParser\\Node\\Scalar\\MagicConst' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php', 'PhpParser\\Node\\Scalar\\MagicConst\\Class_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php', 'PhpParser\\Node\\Scalar\\MagicConst\\Dir' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php', @@ -281,9 +285,12 @@ return array( 'PhpParser\\Node\\Scalar\\MagicConst\\Line' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php', 'PhpParser\\Node\\Scalar\\MagicConst\\Method' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php', 'PhpParser\\Node\\Scalar\\MagicConst\\Namespace_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Property' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Property.php', 'PhpParser\\Node\\Scalar\\MagicConst\\Trait_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php', 'PhpParser\\Node\\Scalar\\String_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php', + 'PhpParser\\Node\\StaticVar' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/StaticVar.php', 'PhpParser\\Node\\Stmt' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt.php', + 'PhpParser\\Node\\Stmt\\Block' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php', 'PhpParser\\Node\\Stmt\\Break_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php', 'PhpParser\\Node\\Stmt\\Case_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php', 'PhpParser\\Node\\Stmt\\Catch_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php', @@ -293,7 +300,6 @@ return array( 'PhpParser\\Node\\Stmt\\Class_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php', 'PhpParser\\Node\\Stmt\\Const_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php', 'PhpParser\\Node\\Stmt\\Continue_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php', - 'PhpParser\\Node\\Stmt\\DeclareDeclare' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php', 'PhpParser\\Node\\Stmt\\Declare_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php', 'PhpParser\\Node\\Stmt\\Do_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php', 'PhpParser\\Node\\Stmt\\Echo_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php', @@ -317,12 +323,9 @@ return array( 'PhpParser\\Node\\Stmt\\Namespace_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php', 'PhpParser\\Node\\Stmt\\Nop' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php', 'PhpParser\\Node\\Stmt\\Property' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php', - 'PhpParser\\Node\\Stmt\\PropertyProperty' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php', 'PhpParser\\Node\\Stmt\\Return_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php', - 'PhpParser\\Node\\Stmt\\StaticVar' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php', 'PhpParser\\Node\\Stmt\\Static_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php', 'PhpParser\\Node\\Stmt\\Switch_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php', - 'PhpParser\\Node\\Stmt\\Throw_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php', 'PhpParser\\Node\\Stmt\\TraitUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php', 'PhpParser\\Node\\Stmt\\TraitUseAdaptation' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php', 'PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Alias' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php', @@ -330,21 +333,22 @@ return array( 'PhpParser\\Node\\Stmt\\Trait_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php', 'PhpParser\\Node\\Stmt\\TryCatch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php', 'PhpParser\\Node\\Stmt\\Unset_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php', - 'PhpParser\\Node\\Stmt\\UseUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php', 'PhpParser\\Node\\Stmt\\Use_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php', 'PhpParser\\Node\\Stmt\\While_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php', 'PhpParser\\Node\\UnionType' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/UnionType.php', + 'PhpParser\\Node\\UseItem' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/UseItem.php', 'PhpParser\\Node\\VarLikeIdentifier' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php', 'PhpParser\\Node\\VariadicPlaceholder' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php', 'PhpParser\\Parser' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser.php', 'PhpParser\\ParserAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ParserAbstract.php', 'PhpParser\\ParserFactory' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ParserFactory.php', - 'PhpParser\\Parser\\Multiple' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Multiple.php', - 'PhpParser\\Parser\\Php5' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Php5.php', 'PhpParser\\Parser\\Php7' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Php7.php', - 'PhpParser\\Parser\\Tokens' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Tokens.php', + 'PhpParser\\Parser\\Php8' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Php8.php', + 'PhpParser\\PhpVersion' => $vendorDir . '/nikic/php-parser/lib/PhpParser/PhpVersion.php', + 'PhpParser\\PrettyPrinter' => $vendorDir . '/nikic/php-parser/lib/PhpParser/PrettyPrinter.php', 'PhpParser\\PrettyPrinterAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php', 'PhpParser\\PrettyPrinter\\Standard' => $vendorDir . '/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php', + 'PhpParser\\Token' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Token.php', 'RectorPrefix202411\\Clue\\React\\NDJson\\Decoder' => $vendorDir . '/clue/ndjson-react/src/Decoder.php', 'RectorPrefix202411\\Clue\\React\\NDJson\\Encoder' => $vendorDir . '/clue/ndjson-react/src/Encoder.php', 'RectorPrefix202411\\Composer\\Pcre\\MatchAllResult' => $vendorDir . '/composer/pcre/src/MatchAllResult.php', @@ -1668,9 +1672,11 @@ return array( 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\NodeVisitor\\ContextNodeVisitor' => $baseDir . '/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ContextNodeVisitor.php', 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\NodeVisitor\\GlobalVariableNodeVisitor' => $baseDir . '/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/GlobalVariableNodeVisitor.php', 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\NodeVisitor\\NameNodeVisitor' => $baseDir . '/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/NameNodeVisitor.php', + 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\NodeVisitor\\ReprintNodeVisitor' => $baseDir . '/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ReprintNodeVisitor.php', 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\NodeVisitor\\StaticVariableNodeVisitor' => $baseDir . '/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StaticVariableNodeVisitor.php', 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\NodeVisitor\\StmtKeyNodeVisitor' => $baseDir . '/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StmtKeyNodeVisitor.php', 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\PHPStanNodeScopeResolver' => $baseDir . '/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php', + 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\RectorNodeScopeResolver' => $baseDir . '/src/NodeTypeResolver/PHPStan/Scope/RectorNodeScopeResolver.php', 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\ScopeFactory' => $baseDir . '/src/NodeTypeResolver/PHPStan/Scope/ScopeFactory.php', 'Rector\\NodeTypeResolver\\PHPStan\\TypeHasher' => $baseDir . '/src/NodeTypeResolver/PHPStan/TypeHasher.php', 'Rector\\NodeTypeResolver\\PHPStan\\Type\\StaticTypeAnalyzer' => $baseDir . '/src/NodeTypeResolver/PHPStan/Type/StaticTypeAnalyzer.php', @@ -1705,6 +1711,7 @@ return array( 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\ClosureTypeMapper' => $baseDir . '/src/PHPStanStaticTypeMapper/TypeMapper/ClosureTypeMapper.php', 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\ConditionalTypeForParameterMapper' => $baseDir . '/src/PHPStanStaticTypeMapper/TypeMapper/ConditionalTypeForParameterMapper.php', 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\ConditionalTypeMapper' => $baseDir . '/src/PHPStanStaticTypeMapper/TypeMapper/ConditionalTypeMapper.php', + 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\ConstantArrayTypeMapper' => $baseDir . '/src/PHPStanStaticTypeMapper/TypeMapper/ConstantArrayTypeMapper.php', 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\FloatTypeMapper' => $baseDir . '/src/PHPStanStaticTypeMapper/TypeMapper/FloatTypeMapper.php', 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\GenericClassStringTypeMapper' => $baseDir . '/src/PHPStanStaticTypeMapper/TypeMapper/GenericClassStringTypeMapper.php', 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\HasMethodTypeMapper' => $baseDir . '/src/PHPStanStaticTypeMapper/TypeMapper/HasMethodTypeMapper.php', diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 67e9350e7f5..455fd63031e 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit274d85655bbeae08896bd1a845bbbd57 +class ComposerAutoloaderInitc12d7e0a7ec6f5f877903ca571cd9ab7 { private static $loader; @@ -22,17 +22,17 @@ class ComposerAutoloaderInit274d85655bbeae08896bd1a845bbbd57 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit274d85655bbeae08896bd1a845bbbd57', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitc12d7e0a7ec6f5f877903ca571cd9ab7', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit274d85655bbeae08896bd1a845bbbd57', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitc12d7e0a7ec6f5f877903ca571cd9ab7', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit274d85655bbeae08896bd1a845bbbd57::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitc12d7e0a7ec6f5f877903ca571cd9ab7::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit274d85655bbeae08896bd1a845bbbd57::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInitc12d7e0a7ec6f5f877903ca571cd9ab7::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 119915a73aa..f75582cec33 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 +class ComposerStaticInitc12d7e0a7ec6f5f877903ca571cd9ab7 { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -239,7 +239,6 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprTrueNode' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprTrueNode.php', 'PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstFetchNode' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstFetchNode.php', 'PHPStan\\PhpDocParser\\Ast\\ConstExpr\\DoctrineConstExprStringNode' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Ast/ConstExpr/DoctrineConstExprStringNode.php', - 'PHPStan\\PhpDocParser\\Ast\\ConstExpr\\QuoteAwareConstExprStringNode' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Ast/ConstExpr/QuoteAwareConstExprStringNode.php', 'PHPStan\\PhpDocParser\\Ast\\Node' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Ast/Node.php', 'PHPStan\\PhpDocParser\\Ast\\NodeAttributes' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Ast/NodeAttributes.php', 'PHPStan\\PhpDocParser\\Ast\\NodeTraverser' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Ast/NodeTraverser.php', @@ -305,6 +304,7 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'PHPStan\\PhpDocParser\\Ast\\Type\\TypeNode' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Ast/Type/TypeNode.php', 'PHPStan\\PhpDocParser\\Ast\\Type\\UnionTypeNode' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Ast/Type/UnionTypeNode.php', 'PHPStan\\PhpDocParser\\Lexer\\Lexer' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Lexer/Lexer.php', + 'PHPStan\\PhpDocParser\\ParserConfig' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/ParserConfig.php', 'PHPStan\\PhpDocParser\\Parser\\ConstExprParser' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Parser/ConstExprParser.php', 'PHPStan\\PhpDocParser\\Parser\\ParserException' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Parser/ParserException.php', 'PHPStan\\PhpDocParser\\Parser\\PhpDocParser' => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src/Parser/PhpDocParser.php', @@ -344,24 +344,24 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'PhpParser\\Internal\\DiffElem' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php', 'PhpParser\\Internal\\Differ' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Internal/Differ.php', 'PhpParser\\Internal\\PrintableNewAnonClassNode' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php', + 'PhpParser\\Internal\\TokenPolyfill' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php', 'PhpParser\\Internal\\TokenStream' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php', 'PhpParser\\JsonDecoder' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/JsonDecoder.php', 'PhpParser\\Lexer' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer.php', 'PhpParser\\Lexer\\Emulative' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php', + 'PhpParser\\Lexer\\TokenEmulator\\AsymmetricVisibilityTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AsymmetricVisibilityTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\AttributeEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php', - 'PhpParser\\Lexer\\TokenEmulator\\CoaleseEqualTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\EnumTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\ExplicitOctalEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php', - 'PhpParser\\Lexer\\TokenEmulator\\FlexibleDocStringEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php', - 'PhpParser\\Lexer\\TokenEmulator\\FnTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\KeywordEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\MatchTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\NullsafeTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php', - 'PhpParser\\Lexer\\TokenEmulator\\NumericLiteralSeparatorEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php', + 'PhpParser\\Lexer\\TokenEmulator\\PropertyTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/PropertyTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\ReadonlyFunctionTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\ReadonlyTokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\ReverseEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php', 'PhpParser\\Lexer\\TokenEmulator\\TokenEmulator' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php', + 'PhpParser\\Modifiers' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Modifiers.php', 'PhpParser\\NameContext' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NameContext.php', 'PhpParser\\Node' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node.php', 'PhpParser\\NodeAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeAbstract.php', @@ -372,19 +372,22 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'PhpParser\\NodeVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor.php', 'PhpParser\\NodeVisitorAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php', 'PhpParser\\NodeVisitor\\CloningVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php', + 'PhpParser\\NodeVisitor\\CommentAnnotatingVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php', 'PhpParser\\NodeVisitor\\FindingVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php', 'PhpParser\\NodeVisitor\\FirstFindingVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php', 'PhpParser\\NodeVisitor\\NameResolver' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php', 'PhpParser\\NodeVisitor\\NodeConnectingVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php', 'PhpParser\\NodeVisitor\\ParentConnectingVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php', 'PhpParser\\Node\\Arg' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Arg.php', + 'PhpParser\\Node\\ArrayItem' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php', 'PhpParser\\Node\\Attribute' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Attribute.php', 'PhpParser\\Node\\AttributeGroup' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php', + 'PhpParser\\Node\\ClosureUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php', 'PhpParser\\Node\\ComplexType' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/ComplexType.php', 'PhpParser\\Node\\Const_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Const_.php', + 'PhpParser\\Node\\DeclareItem' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php', 'PhpParser\\Node\\Expr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr.php', 'PhpParser\\Node\\Expr\\ArrayDimFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php', - 'PhpParser\\Node\\Expr\\ArrayItem' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php', 'PhpParser\\Node\\Expr\\Array_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php', 'PhpParser\\Node\\Expr\\ArrowFunction' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php', 'PhpParser\\Node\\Expr\\Assign' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php', @@ -445,7 +448,6 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'PhpParser\\Node\\Expr\\ClassConstFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php', 'PhpParser\\Node\\Expr\\Clone_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php', 'PhpParser\\Node\\Expr\\Closure' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php', - 'PhpParser\\Node\\Expr\\ClosureUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php', 'PhpParser\\Node\\Expr\\ConstFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php', 'PhpParser\\Node\\Expr\\Empty_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php', 'PhpParser\\Node\\Expr\\Error' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php', @@ -480,6 +482,7 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'PhpParser\\Node\\Expr\\Yield_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php', 'PhpParser\\Node\\FunctionLike' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php', 'PhpParser\\Node\\Identifier' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Identifier.php', + 'PhpParser\\Node\\InterpolatedStringPart' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php', 'PhpParser\\Node\\IntersectionType' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php', 'PhpParser\\Node\\MatchArm' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/MatchArm.php', 'PhpParser\\Node\\Name' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Name.php', @@ -487,11 +490,12 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'PhpParser\\Node\\Name\\Relative' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php', 'PhpParser\\Node\\NullableType' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/NullableType.php', 'PhpParser\\Node\\Param' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Param.php', + 'PhpParser\\Node\\PropertyHook' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/PropertyHook.php', + 'PhpParser\\Node\\PropertyItem' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php', 'PhpParser\\Node\\Scalar' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar.php', - 'PhpParser\\Node\\Scalar\\DNumber' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php', - 'PhpParser\\Node\\Scalar\\Encapsed' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php', - 'PhpParser\\Node\\Scalar\\EncapsedStringPart' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php', - 'PhpParser\\Node\\Scalar\\LNumber' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php', + 'PhpParser\\Node\\Scalar\\Float_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php', + 'PhpParser\\Node\\Scalar\\Int_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php', + 'PhpParser\\Node\\Scalar\\InterpolatedString' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php', 'PhpParser\\Node\\Scalar\\MagicConst' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php', 'PhpParser\\Node\\Scalar\\MagicConst\\Class_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php', 'PhpParser\\Node\\Scalar\\MagicConst\\Dir' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php', @@ -500,9 +504,12 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'PhpParser\\Node\\Scalar\\MagicConst\\Line' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php', 'PhpParser\\Node\\Scalar\\MagicConst\\Method' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php', 'PhpParser\\Node\\Scalar\\MagicConst\\Namespace_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php', + 'PhpParser\\Node\\Scalar\\MagicConst\\Property' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Property.php', 'PhpParser\\Node\\Scalar\\MagicConst\\Trait_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php', 'PhpParser\\Node\\Scalar\\String_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php', + 'PhpParser\\Node\\StaticVar' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/StaticVar.php', 'PhpParser\\Node\\Stmt' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt.php', + 'PhpParser\\Node\\Stmt\\Block' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php', 'PhpParser\\Node\\Stmt\\Break_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php', 'PhpParser\\Node\\Stmt\\Case_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php', 'PhpParser\\Node\\Stmt\\Catch_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php', @@ -512,7 +519,6 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'PhpParser\\Node\\Stmt\\Class_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php', 'PhpParser\\Node\\Stmt\\Const_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php', 'PhpParser\\Node\\Stmt\\Continue_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php', - 'PhpParser\\Node\\Stmt\\DeclareDeclare' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php', 'PhpParser\\Node\\Stmt\\Declare_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php', 'PhpParser\\Node\\Stmt\\Do_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php', 'PhpParser\\Node\\Stmt\\Echo_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php', @@ -536,12 +542,9 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'PhpParser\\Node\\Stmt\\Namespace_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php', 'PhpParser\\Node\\Stmt\\Nop' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php', 'PhpParser\\Node\\Stmt\\Property' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php', - 'PhpParser\\Node\\Stmt\\PropertyProperty' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php', 'PhpParser\\Node\\Stmt\\Return_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php', - 'PhpParser\\Node\\Stmt\\StaticVar' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php', 'PhpParser\\Node\\Stmt\\Static_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php', 'PhpParser\\Node\\Stmt\\Switch_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php', - 'PhpParser\\Node\\Stmt\\Throw_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php', 'PhpParser\\Node\\Stmt\\TraitUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php', 'PhpParser\\Node\\Stmt\\TraitUseAdaptation' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php', 'PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Alias' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php', @@ -549,21 +552,22 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'PhpParser\\Node\\Stmt\\Trait_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php', 'PhpParser\\Node\\Stmt\\TryCatch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php', 'PhpParser\\Node\\Stmt\\Unset_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php', - 'PhpParser\\Node\\Stmt\\UseUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php', 'PhpParser\\Node\\Stmt\\Use_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php', 'PhpParser\\Node\\Stmt\\While_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php', 'PhpParser\\Node\\UnionType' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/UnionType.php', + 'PhpParser\\Node\\UseItem' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/UseItem.php', 'PhpParser\\Node\\VarLikeIdentifier' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php', 'PhpParser\\Node\\VariadicPlaceholder' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php', 'PhpParser\\Parser' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser.php', 'PhpParser\\ParserAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ParserAbstract.php', 'PhpParser\\ParserFactory' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ParserFactory.php', - 'PhpParser\\Parser\\Multiple' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Multiple.php', - 'PhpParser\\Parser\\Php5' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Php5.php', 'PhpParser\\Parser\\Php7' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Php7.php', - 'PhpParser\\Parser\\Tokens' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Tokens.php', + 'PhpParser\\Parser\\Php8' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Php8.php', + 'PhpParser\\PhpVersion' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/PhpVersion.php', + 'PhpParser\\PrettyPrinter' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/PrettyPrinter.php', 'PhpParser\\PrettyPrinterAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php', 'PhpParser\\PrettyPrinter\\Standard' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php', + 'PhpParser\\Token' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Token.php', 'RectorPrefix202411\\Clue\\React\\NDJson\\Decoder' => __DIR__ . '/..' . '/clue/ndjson-react/src/Decoder.php', 'RectorPrefix202411\\Clue\\React\\NDJson\\Encoder' => __DIR__ . '/..' . '/clue/ndjson-react/src/Encoder.php', 'RectorPrefix202411\\Composer\\Pcre\\MatchAllResult' => __DIR__ . '/..' . '/composer/pcre/src/MatchAllResult.php', @@ -1887,9 +1891,11 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\NodeVisitor\\ContextNodeVisitor' => __DIR__ . '/../..' . '/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ContextNodeVisitor.php', 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\NodeVisitor\\GlobalVariableNodeVisitor' => __DIR__ . '/../..' . '/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/GlobalVariableNodeVisitor.php', 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\NodeVisitor\\NameNodeVisitor' => __DIR__ . '/../..' . '/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/NameNodeVisitor.php', + 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\NodeVisitor\\ReprintNodeVisitor' => __DIR__ . '/../..' . '/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ReprintNodeVisitor.php', 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\NodeVisitor\\StaticVariableNodeVisitor' => __DIR__ . '/../..' . '/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StaticVariableNodeVisitor.php', 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\NodeVisitor\\StmtKeyNodeVisitor' => __DIR__ . '/../..' . '/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StmtKeyNodeVisitor.php', 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\PHPStanNodeScopeResolver' => __DIR__ . '/../..' . '/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php', + 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\RectorNodeScopeResolver' => __DIR__ . '/../..' . '/src/NodeTypeResolver/PHPStan/Scope/RectorNodeScopeResolver.php', 'Rector\\NodeTypeResolver\\PHPStan\\Scope\\ScopeFactory' => __DIR__ . '/../..' . '/src/NodeTypeResolver/PHPStan/Scope/ScopeFactory.php', 'Rector\\NodeTypeResolver\\PHPStan\\TypeHasher' => __DIR__ . '/../..' . '/src/NodeTypeResolver/PHPStan/TypeHasher.php', 'Rector\\NodeTypeResolver\\PHPStan\\Type\\StaticTypeAnalyzer' => __DIR__ . '/../..' . '/src/NodeTypeResolver/PHPStan/Type/StaticTypeAnalyzer.php', @@ -1924,6 +1930,7 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\ClosureTypeMapper' => __DIR__ . '/../..' . '/src/PHPStanStaticTypeMapper/TypeMapper/ClosureTypeMapper.php', 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\ConditionalTypeForParameterMapper' => __DIR__ . '/../..' . '/src/PHPStanStaticTypeMapper/TypeMapper/ConditionalTypeForParameterMapper.php', 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\ConditionalTypeMapper' => __DIR__ . '/../..' . '/src/PHPStanStaticTypeMapper/TypeMapper/ConditionalTypeMapper.php', + 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\ConstantArrayTypeMapper' => __DIR__ . '/../..' . '/src/PHPStanStaticTypeMapper/TypeMapper/ConstantArrayTypeMapper.php', 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\FloatTypeMapper' => __DIR__ . '/../..' . '/src/PHPStanStaticTypeMapper/TypeMapper/FloatTypeMapper.php', 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\GenericClassStringTypeMapper' => __DIR__ . '/../..' . '/src/PHPStanStaticTypeMapper/TypeMapper/GenericClassStringTypeMapper.php', 'Rector\\PHPStanStaticTypeMapper\\TypeMapper\\HasMethodTypeMapper' => __DIR__ . '/../..' . '/src/PHPStanStaticTypeMapper/TypeMapper/HasMethodTypeMapper.php', @@ -2821,9 +2828,9 @@ class ComposerStaticInit274d85655bbeae08896bd1a845bbbd57 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit274d85655bbeae08896bd1a845bbbd57::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit274d85655bbeae08896bd1a845bbbd57::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit274d85655bbeae08896bd1a845bbbd57::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitc12d7e0a7ec6f5f877903ca571cd9ab7::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitc12d7e0a7ec6f5f877903ca571cd9ab7::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitc12d7e0a7ec6f5f877903ca571cd9ab7::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index cad5cbca797..5539b258159 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -512,8 +512,8 @@ }, { "name": "illuminate\/container", - "version": "v11.32.0", - "version_normalized": "11.32.0.0", + "version": "v11.33.2", + "version_normalized": "11.33.2.0", "source": { "type": "git", "url": "https:\/\/github.com\/illuminate\/container.git", @@ -569,8 +569,8 @@ }, { "name": "illuminate\/contracts", - "version": "v11.32.0", - "version_normalized": "11.32.0.0", + "version": "v11.33.2", + "version_normalized": "11.33.2.0", "source": { "type": "git", "url": "https:\/\/github.com\/illuminate\/contracts.git", @@ -709,35 +709,37 @@ }, { "name": "nikic\/php-parser", - "version": "v4.19.4", - "version_normalized": "4.19.4.0", + "version": "v5.3.1", + "version_normalized": "5.3.1.0", "source": { "type": "git", "url": "https:\/\/github.com\/nikic\/PHP-Parser.git", - "reference": "715f4d25e225bc47b293a8b997fe6ce99bf987d2" + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" }, "dist": { "type": "zip", - "url": "https:\/\/api.github.com\/repos\/nikic\/PHP-Parser\/zipball\/715f4d25e225bc47b293a8b997fe6ce99bf987d2", - "reference": "715f4d25e225bc47b293a8b997fe6ce99bf987d2", + "url": "https:\/\/api.github.com\/repos\/nikic\/PHP-Parser\/zipball\/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.1" + "php": ">=7.4" }, "require-dev": { "ircmaxell\/php-yacc": "^0.0.7", - "phpunit\/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit\/phpunit": "^9.0" }, - "time": "2024-09-29T15:01:53+00:00", + "time": "2024-10-08T18:51:32+00:00", "bin": [ "bin\/php-parse" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" }, "patches_applied": [ "https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/nikic-php-parser-lib-phpparser-node-expr-closure-php.patch", @@ -780,7 +782,7 @@ ], "support": { "issues": "https:\/\/github.com\/nikic\/PHP-Parser\/issues", - "source": "https:\/\/github.com\/nikic\/PHP-Parser\/tree\/v4.19.4" + "source": "https:\/\/github.com\/nikic\/PHP-Parser\/tree\/v5.3.1" }, "install-path": "..\/nikic\/php-parser" }, @@ -867,34 +869,34 @@ }, { "name": "phpstan\/phpdoc-parser", - "version": "1.33.0", - "version_normalized": "1.33.0.0", + "version": "2.0.0", + "version_normalized": "2.0.0.0", "source": { "type": "git", "url": "https:\/\/github.com\/phpstan\/phpdoc-parser.git", - "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140" + "reference": "c00d78fb6b29658347f9d37ebe104bffadf36299" }, "dist": { "type": "zip", - "url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/82a311fd3690fb2bf7b64d5c98f912b3dd746140", - "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140", + "url": "https:\/\/api.github.com\/repos\/phpstan\/phpdoc-parser\/zipball\/c00d78fb6b29658347f9d37ebe104bffadf36299", + "reference": "c00d78fb6b29658347f9d37ebe104bffadf36299", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "doctrine\/annotations": "^2.0", - "nikic\/php-parser": "^4.15", + "nikic\/php-parser": "^5.3.0", "php-parallel-lint\/php-parallel-lint": "^1.2", "phpstan\/extension-installer": "^1.0", - "phpstan\/phpstan": "^1.5", - "phpstan\/phpstan-phpunit": "^1.1", - "phpstan\/phpstan-strict-rules": "^1.0", - "phpunit\/phpunit": "^9.5", + "phpstan\/phpstan": "^2.0", + "phpstan\/phpstan-phpunit": "^2.0", + "phpstan\/phpstan-strict-rules": "^2.0", + "phpunit\/phpunit": "^9.6", "symfony\/process": "^5.2" }, - "time": "2024-10-13T11:25:22+00:00", + "time": "2024-10-13T11:29:49+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -911,7 +913,7 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https:\/\/github.com\/phpstan\/phpdoc-parser\/issues", - "source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/1.33.0" + "source": "https:\/\/github.com\/phpstan\/phpdoc-parser\/tree\/2.0.0" }, "install-path": "..\/phpstan\/phpdoc-parser" }, @@ -1689,12 +1691,12 @@ "source": { "type": "git", "url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git", - "reference": "9cfbe48b2f15983a13d1995bb7577e538db710cd" + "reference": "02ae401ff4e578a5dcdc0a68e5451628aaab2639" }, "dist": { "type": "zip", - "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/9cfbe48b2f15983a13d1995bb7577e538db710cd", - "reference": "9cfbe48b2f15983a13d1995bb7577e538db710cd", + "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/02ae401ff4e578a5dcdc0a68e5451628aaab2639", + "reference": "02ae401ff4e578a5dcdc0a68e5451628aaab2639", "shasum": "" }, "require": { @@ -1705,21 +1707,17 @@ "doctrine\/doctrine-bundle": "^2.12", "doctrine\/orm": "^2.19", "phpstan\/extension-installer": "^1.4", - "phpstan\/phpstan": "^1.11", - "phpstan\/phpstan-deprecation-rules": "^1.2", - "phpstan\/phpstan-webmozart-assert": "^1.2", + "phpstan\/phpstan": "^2.0", + "phpstan\/phpstan-deprecation-rules": "^2.0", + "phpstan\/phpstan-webmozart-assert": "^2.0", "phpunit\/phpunit": "^10.5", "rector\/rector-src": "dev-main", - "rector\/type-perfect": "^1.0", "symplify\/easy-coding-standard": "^12.3", - "symplify\/phpstan-extensions": "^11.4", - "symplify\/phpstan-rules": "^13.0", "symplify\/vendor-patches": "^11.3", "tomasvotruba\/class-leak": "^1.1", - "tomasvotruba\/unused-public": "^1.0", "tracy\/tracy": "^2.10" }, - "time": "2024-11-13T00:32:00+00:00", + "time": "2024-11-20T15:34:08+00:00", "default-branch": true, "type": "rector-extension", "extra": { @@ -1752,12 +1750,12 @@ "source": { "type": "git", "url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git", - "reference": "eb03bfe946f00757fcd36b47590f77ba6957d4d9" + "reference": "829f969479fbeadf307253281db11f731684c844" }, "dist": { "type": "zip", - "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/eb03bfe946f00757fcd36b47590f77ba6957d4d9", - "reference": "eb03bfe946f00757fcd36b47590f77ba6957d4d9", + "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/829f969479fbeadf307253281db11f731684c844", + "reference": "829f969479fbeadf307253281db11f731684c844", "shasum": "" }, "require": { @@ -1765,20 +1763,17 @@ }, "require-dev": { "phpstan\/extension-installer": "^1.3", - "phpstan\/phpstan": "^1.10", - "phpstan\/phpstan-webmozart-assert": "^1.2", + "phpstan\/phpstan": "^2.0", + "phpstan\/phpstan-webmozart-assert": "^2.0", "phpunit\/phpunit": "^10.5", "rector\/rector-src": "dev-main", - "rector\/type-perfect": "^1.0", "symplify\/easy-coding-standard": "^12.3", - "symplify\/phpstan-extensions": "^11.4", - "symplify\/phpstan-rules": "^13.0", "symplify\/rule-doc-generator": "^12.2", "symplify\/vendor-patches": "^11.3", "tomasvotruba\/class-leak": "^1.0", "tracy\/tracy": "^2.10" }, - "time": "2024-11-13T01:09:46+00:00", + "time": "2024-11-20T15:55:56+00:00", "default-branch": true, "type": "rector-extension", "extra": { @@ -1811,12 +1806,12 @@ "source": { "type": "git", "url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git", - "reference": "b75c030178ee6960b0c9f1d6c3e1942127c08807" + "reference": "a506b2c8befb25aca43fe29fbc863b3126266916" }, "dist": { "type": "zip", - "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/b75c030178ee6960b0c9f1d6c3e1942127c08807", - "reference": "b75c030178ee6960b0c9f1d6c3e1942127c08807", + "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/a506b2c8befb25aca43fe29fbc863b3126266916", + "reference": "a506b2c8befb25aca43fe29fbc863b3126266916", "shasum": "" }, "require": { @@ -1827,20 +1822,17 @@ }, "require-dev": { "phpstan\/extension-installer": "^1.4", - "phpstan\/phpstan": "^1.12", - "phpstan\/phpstan-webmozart-assert": "^1.2", + "phpstan\/phpstan": "^2.0", + "phpstan\/phpstan-webmozart-assert": "^2.0", "phpunit\/phpunit": "^10.5", "rector\/rector-src": "dev-main", "rector\/swiss-knife": "^1.0", - "rector\/type-perfect": "^1.0", "symplify\/easy-coding-standard": "^12.3", - "symplify\/phpstan-extensions": "^11.4", - "symplify\/phpstan-rules": "^13.0", "symplify\/vendor-patches": "^11.3", "tomasvotruba\/class-leak": "^1.2", "tracy\/tracy": "^2.10" }, - "time": "2024-11-19T13:57:33+00:00", + "time": "2024-11-20T15:46:46+00:00", "default-branch": true, "type": "rector-extension", "extra": { @@ -1876,12 +1868,12 @@ "source": { "type": "git", "url": "https:\/\/github.com\/rectorphp\/rector-symfony.git", - "reference": "d0f8cf22c023ed352311758d53c06731ba660865" + "reference": "89fa7a45ed99e4c38980cfe1fec914be7c4fc344" }, "dist": { "type": "zip", - "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/d0f8cf22c023ed352311758d53c06731ba660865", - "reference": "d0f8cf22c023ed352311758d53c06731ba660865", + "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/89fa7a45ed99e4c38980cfe1fec914be7c4fc344", + "reference": "89fa7a45ed99e4c38980cfe1fec914be7c4fc344", "shasum": "" }, "require": { @@ -1890,11 +1882,10 @@ }, "require-dev": { "phpstan\/extension-installer": "^1.4", - "phpstan\/phpstan": "^1.11", - "phpstan\/phpstan-webmozart-assert": "^1.2", + "phpstan\/phpstan": "^2.0", + "phpstan\/phpstan-webmozart-assert": "^2.0", "phpunit\/phpunit": "^10.5", "rector\/rector-src": "dev-main", - "rector\/type-perfect": "^1.0", "symfony\/config": "^6.4", "symfony\/dependency-injection": "^6.4", "symfony\/http-kernel": "~6.3", @@ -1903,14 +1894,11 @@ "symfony\/security-http": "^6.4", "symfony\/validator": "^6.4", "symplify\/easy-coding-standard": "^12.3", - "symplify\/phpstan-extensions": "^11.4", - "symplify\/phpstan-rules": "^13.0", "symplify\/vendor-patches": "^11.3", "tomasvotruba\/class-leak": "^1.0", - "tomasvotruba\/unused-public": "^1.0", "tracy\/tracy": "^2.10" }, - "time": "2024-11-14T16:50:28+00:00", + "time": "2024-11-20T15:27:48+00:00", "default-branch": true, "type": "rector-extension", "extra": { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 572b4f6b0f1..ee1b66aeddc 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -2,4 +2,4 @@ namespace RectorPrefix202411; -return array('root' => array('name' => 'rector/rector-src', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \false), 'versions' => array('clue/ndjson-react' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '392dc165fce93b5bb5c637b67e59619223c931b0', 'type' => 'library', 'install_path' => __DIR__ . '/../clue/ndjson-react', 'aliases' => array(), 'dev_requirement' => \false), 'composer/pcre' => array('pretty_version' => '3.3.2', 'version' => '3.3.2.0', 'reference' => 'b2bed4734f0cc156ee1fe9c0da2550420d99a21e', 'type' => 'library', 'install_path' => __DIR__ . '/./pcre', 'aliases' => array(), 'dev_requirement' => \false), 'composer/semver' => array('pretty_version' => '3.4.3', 'version' => '3.4.3.0', 'reference' => '4313d26ada5e0c4edfbd1dc481a92ff7bff91f12', 'type' => 'library', 'install_path' => __DIR__ . '/./semver', 'aliases' => array(), 'dev_requirement' => \false), 'composer/xdebug-handler' => array('pretty_version' => '3.0.5', 'version' => '3.0.5.0', 'reference' => '6c1925561632e83d60a44492e0b344cf48ab85ef', 'type' => 'library', 'install_path' => __DIR__ . '/./xdebug-handler', 'aliases' => array(), 'dev_requirement' => \false), 'doctrine/inflector' => array('pretty_version' => '2.0.10', 'version' => '2.0.10.0', 'reference' => '5817d0659c5b50c9b950feb9af7b9668e2c436bc', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/inflector', 'aliases' => array(), 'dev_requirement' => \false), 'evenement/evenement' => array('pretty_version' => 'v3.0.2', 'version' => '3.0.2.0', 'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc', 'type' => 'library', 'install_path' => __DIR__ . '/../evenement/evenement', 'aliases' => array(), 'dev_requirement' => \false), 'fidry/cpu-core-counter' => array('pretty_version' => '1.2.0', 'version' => '1.2.0.0', 'reference' => '8520451a140d3f46ac33042715115e290cf5785f', 'type' => 'library', 'install_path' => __DIR__ . '/../fidry/cpu-core-counter', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/container' => array('pretty_version' => 'v11.32.0', 'version' => '11.32.0.0', 'reference' => '6e31eb49e9c9e68356a55cd8f18fb8830b8158cd', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/container', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/contracts' => array('pretty_version' => 'v11.32.0', 'version' => '11.32.0.0', 'reference' => '44c15aec6ea0d997e0885aa5b04876fe8a141433', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/contracts', 'aliases' => array(), 'dev_requirement' => \false), 'nette/utils' => array('pretty_version' => 'v4.0.5', 'version' => '4.0.5.0', 'reference' => '736c567e257dbe0fcf6ce81b4d6dbe05c6899f96', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/utils', 'aliases' => array(), 'dev_requirement' => \false), 'nikic/php-parser' => array('pretty_version' => 'v4.19.4', 'version' => '4.19.4.0', 'reference' => '715f4d25e225bc47b293a8b997fe6ce99bf987d2', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), 'dev_requirement' => \false), 'ondram/ci-detector' => array('pretty_version' => '4.2.0', 'version' => '4.2.0.0', 'reference' => '8b0223b5ed235fd377c75fdd1bfcad05c0f168b8', 'type' => 'library', 'install_path' => __DIR__ . '/../ondram/ci-detector', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpdoc-parser' => array('pretty_version' => '1.33.0', 'version' => '1.33.0.0', 'reference' => '82a311fd3690fb2bf7b64d5c98f912b3dd746140', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpdoc-parser', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpstan' => array('dev_requirement' => \false, 'replaced' => array(0 => '1.12.11')), 'psr/container' => array('pretty_version' => '2.0.2', 'version' => '2.0.2.0', 'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/container', 'aliases' => array(), 'dev_requirement' => \false), 'psr/container-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.1|2.0')), 'psr/log' => array('pretty_version' => '3.0.2', 'version' => '3.0.2.0', 'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), 'dev_requirement' => \false), 'psr/log-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0|2.0|3.0')), 'psr/simple-cache' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/simple-cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/cache' => array('pretty_version' => 'v1.2.0', 'version' => '1.2.0.0', 'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b', 'type' => 'library', 'install_path' => __DIR__ . '/../react/cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/child-process' => array('pretty_version' => 'v0.6.5', 'version' => '0.6.5.0', 'reference' => 'e71eb1aa55f057c7a4a0d08d06b0b0a484bead43', 'type' => 'library', 'install_path' => __DIR__ . '/../react/child-process', 'aliases' => array(), 'dev_requirement' => \false), 'react/dns' => array('pretty_version' => 'v1.13.0', 'version' => '1.13.0.0', 'reference' => 'eb8ae001b5a455665c89c1df97f6fb682f8fb0f5', 'type' => 'library', 'install_path' => __DIR__ . '/../react/dns', 'aliases' => array(), 'dev_requirement' => \false), 'react/event-loop' => array('pretty_version' => 'v1.5.0', 'version' => '1.5.0.0', 'reference' => 'bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354', 'type' => 'library', 'install_path' => __DIR__ . '/../react/event-loop', 'aliases' => array(), 'dev_requirement' => \false), 'react/promise' => array('pretty_version' => 'v3.2.0', 'version' => '3.2.0.0', 'reference' => '8a164643313c71354582dc850b42b33fa12a4b63', 'type' => 'library', 'install_path' => __DIR__ . '/../react/promise', 'aliases' => array(), 'dev_requirement' => \false), 'react/socket' => array('pretty_version' => 'v1.16.0', 'version' => '1.16.0.0', 'reference' => '23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1', 'type' => 'library', 'install_path' => __DIR__ . '/../react/socket', 'aliases' => array(), 'dev_requirement' => \false), 'react/stream' => array('pretty_version' => 'v1.4.0', 'version' => '1.4.0.0', 'reference' => '1e5b0acb8fe55143b5b426817155190eb6f5b18d', 'type' => 'library', 'install_path' => __DIR__ . '/../react/stream', 'aliases' => array(), 'dev_requirement' => \false), 'rector/extension-installer' => array('pretty_version' => '0.11.2', 'version' => '0.11.2.0', 'reference' => '05544e9b195863b8571ae2a3b903cbec7fa062e0', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../rector/extension-installer', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector' => array('dev_requirement' => \false, 'replaced' => array(0 => 'dev-main')), 'rector/rector-doctrine' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '9cfbe48b2f15983a13d1995bb7577e538db710cd', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-doctrine', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-downgrade-php' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'eb03bfe946f00757fcd36b47590f77ba6957d4d9', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-downgrade-php', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-phpunit' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'b75c030178ee6960b0c9f1d6c3e1942127c08807', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-phpunit', 'aliases' => array(0 => '0.11.x-dev'), 'dev_requirement' => \false), 'rector/rector-src' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector-symfony' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'd0f8cf22c023ed352311758d53c06731ba660865', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-symfony', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'sebastian/diff' => array('pretty_version' => '5.1.1', 'version' => '5.1.1.0', 'reference' => 'c41e007b4b62af48218231d6c2275e4c9b975b2e', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/console' => array('pretty_version' => 'v6.4.15', 'version' => '6.4.15.0', 'reference' => 'f1fc6f47283e27336e7cebb9e8946c8de7bff9bd', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/deprecation-contracts' => array('pretty_version' => 'v3.5.0', 'version' => '3.5.0.0', 'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/filesystem' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => '4856c9cf585d5a0313d8d35afd681a526f038dd3', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/filesystem', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/finder' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => 'daea9eca0b08d0ed1dc9ab702a46128fd1be4958', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/finder', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/polyfill-ctype' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-intl-grapheme' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-mbstring' => array('pretty_version' => 'v1.31.0', 'version' => '1.31.0.0', 'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/process' => array('pretty_version' => 'v6.4.15', 'version' => '6.4.15.0', 'reference' => '3cb242f059c14ae08591c5c4087d1fe443564392', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/service-contracts' => array('pretty_version' => 'v3.5.0', 'version' => '3.5.0.0', 'reference' => 'bd1d9e59a81d8fa4acdcea3f617c581f7475a80f', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/service-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/string' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/yaml' => array('pretty_version' => 'v7.1.6', 'version' => '7.1.6.0', 'reference' => '3ced3f29e4f0d6bce2170ff26719f1fe9aacc671', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/yaml', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/easy-parallel' => array('pretty_version' => '11.2.2', 'version' => '11.2.2.0', 'reference' => '8586c18bb8efb31cd192a4e5cc94ae7813f72ed9', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/easy-parallel', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/rule-doc-generator-contracts' => array('pretty_version' => '11.2.0', 'version' => '11.2.0.0', 'reference' => '479cfcfd46047f80624aba931d9789e50475b5c6', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/rule-doc-generator-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'webmozart/assert' => array('pretty_version' => '1.11.0', 'version' => '1.11.0.0', 'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991', 'type' => 'library', 'install_path' => __DIR__ . '/../webmozart/assert', 'aliases' => array(), 'dev_requirement' => \false))); +return array('root' => array('name' => 'rector/rector-src', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \false), 'versions' => array('clue/ndjson-react' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '392dc165fce93b5bb5c637b67e59619223c931b0', 'type' => 'library', 'install_path' => __DIR__ . '/../clue/ndjson-react', 'aliases' => array(), 'dev_requirement' => \false), 'composer/pcre' => array('pretty_version' => '3.3.2', 'version' => '3.3.2.0', 'reference' => 'b2bed4734f0cc156ee1fe9c0da2550420d99a21e', 'type' => 'library', 'install_path' => __DIR__ . '/./pcre', 'aliases' => array(), 'dev_requirement' => \false), 'composer/semver' => array('pretty_version' => '3.4.3', 'version' => '3.4.3.0', 'reference' => '4313d26ada5e0c4edfbd1dc481a92ff7bff91f12', 'type' => 'library', 'install_path' => __DIR__ . '/./semver', 'aliases' => array(), 'dev_requirement' => \false), 'composer/xdebug-handler' => array('pretty_version' => '3.0.5', 'version' => '3.0.5.0', 'reference' => '6c1925561632e83d60a44492e0b344cf48ab85ef', 'type' => 'library', 'install_path' => __DIR__ . '/./xdebug-handler', 'aliases' => array(), 'dev_requirement' => \false), 'doctrine/inflector' => array('pretty_version' => '2.0.10', 'version' => '2.0.10.0', 'reference' => '5817d0659c5b50c9b950feb9af7b9668e2c436bc', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/inflector', 'aliases' => array(), 'dev_requirement' => \false), 'evenement/evenement' => array('pretty_version' => 'v3.0.2', 'version' => '3.0.2.0', 'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc', 'type' => 'library', 'install_path' => __DIR__ . '/../evenement/evenement', 'aliases' => array(), 'dev_requirement' => \false), 'fidry/cpu-core-counter' => array('pretty_version' => '1.2.0', 'version' => '1.2.0.0', 'reference' => '8520451a140d3f46ac33042715115e290cf5785f', 'type' => 'library', 'install_path' => __DIR__ . '/../fidry/cpu-core-counter', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/container' => array('pretty_version' => 'v11.33.2', 'version' => '11.33.2.0', 'reference' => '6e31eb49e9c9e68356a55cd8f18fb8830b8158cd', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/container', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/contracts' => array('pretty_version' => 'v11.33.2', 'version' => '11.33.2.0', 'reference' => '44c15aec6ea0d997e0885aa5b04876fe8a141433', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/contracts', 'aliases' => array(), 'dev_requirement' => \false), 'nette/utils' => array('pretty_version' => 'v4.0.5', 'version' => '4.0.5.0', 'reference' => '736c567e257dbe0fcf6ce81b4d6dbe05c6899f96', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/utils', 'aliases' => array(), 'dev_requirement' => \false), 'nikic/php-parser' => array('pretty_version' => 'v5.3.1', 'version' => '5.3.1.0', 'reference' => '8eea230464783aa9671db8eea6f8c6ac5285794b', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), 'dev_requirement' => \false), 'ondram/ci-detector' => array('pretty_version' => '4.2.0', 'version' => '4.2.0.0', 'reference' => '8b0223b5ed235fd377c75fdd1bfcad05c0f168b8', 'type' => 'library', 'install_path' => __DIR__ . '/../ondram/ci-detector', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpdoc-parser' => array('pretty_version' => '2.0.0', 'version' => '2.0.0.0', 'reference' => 'c00d78fb6b29658347f9d37ebe104bffadf36299', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpdoc-parser', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpstan' => array('dev_requirement' => \false, 'replaced' => array(0 => '2.0.2')), 'psr/container' => array('pretty_version' => '2.0.2', 'version' => '2.0.2.0', 'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/container', 'aliases' => array(), 'dev_requirement' => \false), 'psr/container-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.1|2.0')), 'psr/log' => array('pretty_version' => '3.0.2', 'version' => '3.0.2.0', 'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), 'dev_requirement' => \false), 'psr/log-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0|2.0|3.0')), 'psr/simple-cache' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/simple-cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/cache' => array('pretty_version' => 'v1.2.0', 'version' => '1.2.0.0', 'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b', 'type' => 'library', 'install_path' => __DIR__ . '/../react/cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/child-process' => array('pretty_version' => 'v0.6.5', 'version' => '0.6.5.0', 'reference' => 'e71eb1aa55f057c7a4a0d08d06b0b0a484bead43', 'type' => 'library', 'install_path' => __DIR__ . '/../react/child-process', 'aliases' => array(), 'dev_requirement' => \false), 'react/dns' => array('pretty_version' => 'v1.13.0', 'version' => '1.13.0.0', 'reference' => 'eb8ae001b5a455665c89c1df97f6fb682f8fb0f5', 'type' => 'library', 'install_path' => __DIR__ . '/../react/dns', 'aliases' => array(), 'dev_requirement' => \false), 'react/event-loop' => array('pretty_version' => 'v1.5.0', 'version' => '1.5.0.0', 'reference' => 'bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354', 'type' => 'library', 'install_path' => __DIR__ . '/../react/event-loop', 'aliases' => array(), 'dev_requirement' => \false), 'react/promise' => array('pretty_version' => 'v3.2.0', 'version' => '3.2.0.0', 'reference' => '8a164643313c71354582dc850b42b33fa12a4b63', 'type' => 'library', 'install_path' => __DIR__ . '/../react/promise', 'aliases' => array(), 'dev_requirement' => \false), 'react/socket' => array('pretty_version' => 'v1.16.0', 'version' => '1.16.0.0', 'reference' => '23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1', 'type' => 'library', 'install_path' => __DIR__ . '/../react/socket', 'aliases' => array(), 'dev_requirement' => \false), 'react/stream' => array('pretty_version' => 'v1.4.0', 'version' => '1.4.0.0', 'reference' => '1e5b0acb8fe55143b5b426817155190eb6f5b18d', 'type' => 'library', 'install_path' => __DIR__ . '/../react/stream', 'aliases' => array(), 'dev_requirement' => \false), 'rector/extension-installer' => array('pretty_version' => '0.11.2', 'version' => '0.11.2.0', 'reference' => '05544e9b195863b8571ae2a3b903cbec7fa062e0', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../rector/extension-installer', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector' => array('dev_requirement' => \false, 'replaced' => array(0 => 'dev-main')), 'rector/rector-doctrine' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '02ae401ff4e578a5dcdc0a68e5451628aaab2639', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-doctrine', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-downgrade-php' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '829f969479fbeadf307253281db11f731684c844', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-downgrade-php', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-phpunit' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'a506b2c8befb25aca43fe29fbc863b3126266916', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-phpunit', 'aliases' => array(0 => '0.11.x-dev'), 'dev_requirement' => \false), 'rector/rector-src' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector-symfony' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '89fa7a45ed99e4c38980cfe1fec914be7c4fc344', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-symfony', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'sebastian/diff' => array('pretty_version' => '5.1.1', 'version' => '5.1.1.0', 'reference' => 'c41e007b4b62af48218231d6c2275e4c9b975b2e', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/console' => array('pretty_version' => 'v6.4.15', 'version' => '6.4.15.0', 'reference' => 'f1fc6f47283e27336e7cebb9e8946c8de7bff9bd', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/deprecation-contracts' => array('pretty_version' => 'v3.5.0', 'version' => '3.5.0.0', 'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/filesystem' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => '4856c9cf585d5a0313d8d35afd681a526f038dd3', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/filesystem', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/finder' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => 'daea9eca0b08d0ed1dc9ab702a46128fd1be4958', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/finder', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/polyfill-ctype' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-intl-grapheme' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-mbstring' => array('pretty_version' => 'v1.31.0', 'version' => '1.31.0.0', 'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/process' => array('pretty_version' => 'v6.4.15', 'version' => '6.4.15.0', 'reference' => '3cb242f059c14ae08591c5c4087d1fe443564392', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/service-contracts' => array('pretty_version' => 'v3.5.0', 'version' => '3.5.0.0', 'reference' => 'bd1d9e59a81d8fa4acdcea3f617c581f7475a80f', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/service-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/string' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/yaml' => array('pretty_version' => 'v7.1.6', 'version' => '7.1.6.0', 'reference' => '3ced3f29e4f0d6bce2170ff26719f1fe9aacc671', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/yaml', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/easy-parallel' => array('pretty_version' => '11.2.2', 'version' => '11.2.2.0', 'reference' => '8586c18bb8efb31cd192a4e5cc94ae7813f72ed9', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/easy-parallel', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/rule-doc-generator-contracts' => array('pretty_version' => '11.2.0', 'version' => '11.2.0.0', 'reference' => '479cfcfd46047f80624aba931d9789e50475b5c6', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/rule-doc-generator-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'webmozart/assert' => array('pretty_version' => '1.11.0', 'version' => '1.11.0.0', 'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991', 'type' => 'library', 'install_path' => __DIR__ . '/../webmozart/assert', 'aliases' => array(), 'dev_requirement' => \false))); diff --git a/vendor/composer/xdebug-handler/src/XdebugHandler.php b/vendor/composer/xdebug-handler/src/XdebugHandler.php index cb200c8c034..bbb633a61ee 100644 --- a/vendor/composer/xdebug-handler/src/XdebugHandler.php +++ b/vendor/composer/xdebug-handler/src/XdebugHandler.php @@ -239,7 +239,7 @@ class XdebugHandler } $this->tryEnableSignals(); $this->notify(Status::RESTARTING, $displayCmd); - $process = \proc_open(\is_array($cmd) ? \implode(' ', \array_map('escapeshellarg', $cmd)) : $cmd, [], $pipes); + $process = \proc_open($cmd, [], $pipes); if (\is_resource($process)) { $exitCode = \proc_close($process); } diff --git a/vendor/illuminate/container/Attributes/Auth.php b/vendor/illuminate/container/Attributes/Auth.php index 525d53ea18d..5b68cc04cab 100644 --- a/vendor/illuminate/container/Attributes/Auth.php +++ b/vendor/illuminate/container/Attributes/Auth.php @@ -8,10 +8,7 @@ use RectorPrefix202411\Illuminate\Contracts\Container\ContextualAttribute; #[Attribute(Attribute::TARGET_PARAMETER)] class Auth implements ContextualAttribute { - /** - * @var string|null - */ - public $guard; + public ?string $guard = null; /** * Create a new class instance. */ diff --git a/vendor/illuminate/container/Attributes/Authenticated.php b/vendor/illuminate/container/Attributes/Authenticated.php index 1d4b1e2659d..de466c302e4 100644 --- a/vendor/illuminate/container/Attributes/Authenticated.php +++ b/vendor/illuminate/container/Attributes/Authenticated.php @@ -8,10 +8,7 @@ use RectorPrefix202411\Illuminate\Contracts\Container\ContextualAttribute; #[Attribute(Attribute::TARGET_PARAMETER)] class Authenticated implements ContextualAttribute { - /** - * @var string|null - */ - public $guard; + public ?string $guard = null; /** * Create a new class instance. */ diff --git a/vendor/illuminate/container/Attributes/Cache.php b/vendor/illuminate/container/Attributes/Cache.php index c8c224a8b75..de9e5efab51 100644 --- a/vendor/illuminate/container/Attributes/Cache.php +++ b/vendor/illuminate/container/Attributes/Cache.php @@ -8,10 +8,7 @@ use RectorPrefix202411\Illuminate\Contracts\Container\ContextualAttribute; #[Attribute(Attribute::TARGET_PARAMETER)] class Cache implements ContextualAttribute { - /** - * @var string|null - */ - public $store; + public ?string $store = null; /** * Create a new class instance. */ diff --git a/vendor/illuminate/container/Attributes/Config.php b/vendor/illuminate/container/Attributes/Config.php index 7a4969a6b0e..9fdc0803e48 100644 --- a/vendor/illuminate/container/Attributes/Config.php +++ b/vendor/illuminate/container/Attributes/Config.php @@ -8,10 +8,7 @@ use RectorPrefix202411\Illuminate\Contracts\Container\ContextualAttribute; #[Attribute(Attribute::TARGET_PARAMETER)] class Config implements ContextualAttribute { - /** - * @var string - */ - public $key; + public string $key; /** * @var mixed */ diff --git a/vendor/illuminate/container/Attributes/Database.php b/vendor/illuminate/container/Attributes/Database.php index 18548a98ff4..883f98711e4 100644 --- a/vendor/illuminate/container/Attributes/Database.php +++ b/vendor/illuminate/container/Attributes/Database.php @@ -8,10 +8,7 @@ use RectorPrefix202411\Illuminate\Contracts\Container\ContextualAttribute; #[Attribute(Attribute::TARGET_PARAMETER)] class Database implements ContextualAttribute { - /** - * @var string|null - */ - public $connection; + public ?string $connection = null; /** * Create a new class instance. */ diff --git a/vendor/illuminate/container/Attributes/Log.php b/vendor/illuminate/container/Attributes/Log.php index 16d13df4c85..4816bd89e78 100644 --- a/vendor/illuminate/container/Attributes/Log.php +++ b/vendor/illuminate/container/Attributes/Log.php @@ -8,10 +8,7 @@ use RectorPrefix202411\Illuminate\Contracts\Container\ContextualAttribute; #[Attribute(Attribute::TARGET_PARAMETER)] class Log implements ContextualAttribute { - /** - * @var string|null - */ - public $channel; + public ?string $channel = null; /** * Create a new class instance. */ diff --git a/vendor/illuminate/container/Attributes/RouteParameter.php b/vendor/illuminate/container/Attributes/RouteParameter.php index 42b57fc47b2..7c8452bd4de 100644 --- a/vendor/illuminate/container/Attributes/RouteParameter.php +++ b/vendor/illuminate/container/Attributes/RouteParameter.php @@ -8,10 +8,7 @@ use RectorPrefix202411\Illuminate\Contracts\Container\ContextualAttribute; #[Attribute(Attribute::TARGET_PARAMETER)] class RouteParameter implements ContextualAttribute { - /** - * @var string - */ - public $parameter; + public string $parameter; /** * Create a new class instance. */ diff --git a/vendor/illuminate/container/Attributes/Storage.php b/vendor/illuminate/container/Attributes/Storage.php index 10f1b7bdf22..587f4e13c35 100644 --- a/vendor/illuminate/container/Attributes/Storage.php +++ b/vendor/illuminate/container/Attributes/Storage.php @@ -8,10 +8,7 @@ use RectorPrefix202411\Illuminate\Contracts\Container\ContextualAttribute; #[Attribute(Attribute::TARGET_PARAMETER)] class Storage implements ContextualAttribute { - /** - * @var string|null - */ - public $disk; + public ?string $disk = null; /** * Create a new class instance. */ diff --git a/vendor/illuminate/container/Attributes/Tag.php b/vendor/illuminate/container/Attributes/Tag.php index 65e41121995..d1100d640d4 100644 --- a/vendor/illuminate/container/Attributes/Tag.php +++ b/vendor/illuminate/container/Attributes/Tag.php @@ -9,10 +9,7 @@ use RectorPrefix202411\Illuminate\Contracts\Container\ContextualAttribute; #[Attribute(Attribute::TARGET_PARAMETER)] final class Tag implements ContextualAttribute { - /** - * @var string - */ - public $tag; + public string $tag; public function __construct(string $tag) { $this->tag = $tag; diff --git a/vendor/illuminate/container/Container.php b/vendor/illuminate/container/Container.php index f5e292fc946..dddf8560bc4 100755 --- a/vendor/illuminate/container/Container.php +++ b/vendor/illuminate/container/Container.php @@ -574,9 +574,7 @@ class Container implements ArrayAccess, ContainerContract */ public function wrap(Closure $callback, array $parameters = []) { - return function () use($callback, $parameters) { - return $this->call($callback, $parameters); - }; + return fn() => $this->call($callback, $parameters); } /** * Call the given Closure / class@method and inject its dependencies. @@ -622,9 +620,7 @@ class Container implements ArrayAccess, ContainerContract */ public function factory($abstract) { - return function () use($abstract) { - return $this->make($abstract); - }; + return fn() => $this->make($abstract); } /** * An alias function name for make(). @@ -871,7 +867,7 @@ class Container implements ArrayAccess, ContainerContract // If the class is null, it means the dependency is a string or some other // primitive type which we can not resolve since it is not a class and // we will just bomb out with an error since we have no-where to go. - $result = $result ?? (\is_null(Util::getParameterClassName($dependency)) ? $this->resolvePrimitive($dependency) : $this->resolveClass($dependency)); + $result ??= \is_null(Util::getParameterClassName($dependency)) ? $this->resolvePrimitive($dependency) : $this->resolveClass($dependency); $this->fireAfterResolvingAttributeCallbacks(\method_exists($dependency, 'getAttributes') ? $dependency->getAttributes() : [], $result); if ($dependency->isVariadic()) { $results = \array_merge($results, $result); @@ -971,9 +967,7 @@ class Container implements ArrayAccess, ContainerContract if (!\is_array($concrete = $this->getContextualConcrete($abstract))) { return $this->make($className); } - return \array_map(function ($abstract) { - return $this->resolve($abstract); - }, $concrete); + return \array_map(fn($abstract) => $this->resolve($abstract), $concrete); } /** * Resolve a dependency based on an attribute. @@ -1297,7 +1291,7 @@ class Container implements ArrayAccess, ContainerContract */ public static function getInstance() { - return static::$instance = static::$instance ?? new static(); + return static::$instance ??= new static(); } /** * Set the shared instance of the container. @@ -1339,9 +1333,7 @@ class Container implements ArrayAccess, ContainerContract */ public function offsetSet($key, $value) : void { - $this->bind($key, $value instanceof Closure ? $value : function () use($value) { - return $value; - }); + $this->bind($key, $value instanceof Closure ? $value : fn() => $value); } /** * Unset the value at a given offset. diff --git a/vendor/illuminate/container/ContextualBindingBuilder.php b/vendor/illuminate/container/ContextualBindingBuilder.php index 08ff86ae6b5..3b7fedc0ddd 100644 --- a/vendor/illuminate/container/ContextualBindingBuilder.php +++ b/vendor/illuminate/container/ContextualBindingBuilder.php @@ -81,8 +81,6 @@ class ContextualBindingBuilder implements ContextualBindingBuilderContract */ public function giveConfig($key, $default = null) { - $this->give(function ($container) use($key, $default) { - return $container->get('config')->get($key, $default); - }); + $this->give(fn($container) => $container->get('config')->get($key, $default)); } } diff --git a/vendor/nette/utils/src/Iterators/CachingIterator.php b/vendor/nette/utils/src/Iterators/CachingIterator.php index 1194ea55ede..6a06c874101 100644 --- a/vendor/nette/utils/src/Iterators/CachingIterator.php +++ b/vendor/nette/utils/src/Iterators/CachingIterator.php @@ -23,10 +23,7 @@ use RectorPrefix202411\Nette; class CachingIterator extends \CachingIterator implements \Countable { use Nette\SmartObject; - /** - * @var int - */ - private $counter = 0; + private int $counter = 0; /** * @param iterable|\stdClass $iterable */ diff --git a/vendor/nette/utils/src/Utils/ArrayList.php b/vendor/nette/utils/src/Utils/ArrayList.php index fa90a4e6b03..536ffb58bf9 100644 --- a/vendor/nette/utils/src/Utils/ArrayList.php +++ b/vendor/nette/utils/src/Utils/ArrayList.php @@ -17,10 +17,7 @@ use RectorPrefix202411\Nette; class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate { use Nette\SmartObject; - /** - * @var mixed[] - */ - private $list = []; + private array $list = []; /** * Transforms array to ArrayList. * @param list $array diff --git a/vendor/nette/utils/src/Utils/Arrays.php b/vendor/nette/utils/src/Utils/Arrays.php index c6f489ae704..8dd3946b68d 100644 --- a/vendor/nette/utils/src/Utils/Arrays.php +++ b/vendor/nette/utils/src/Utils/Arrays.php @@ -138,8 +138,7 @@ class Arrays public static function firstKey(array $array, ?callable $predicate = null) { if (!$predicate) { - \reset($array); - return \key($array); + return \array_key_first($array); } foreach ($array as $k => $v) { if ($predicate($v, $k, $array)) { @@ -158,8 +157,7 @@ class Arrays */ public static function lastKey(array $array, ?callable $predicate = null) { - \end($array); - return $predicate ? self::firstKey(\array_reverse($array, \true), $predicate) : \key($array); + return $predicate ? self::firstKey(\array_reverse($array, \true), $predicate) : \array_key_last($array); } /** * Inserts the contents of the $inserted array into the $array immediately after the $key. diff --git a/vendor/nette/utils/src/Utils/FileInfo.php b/vendor/nette/utils/src/Utils/FileInfo.php index 4194f745ec6..19c2f5f32f8 100644 --- a/vendor/nette/utils/src/Utils/FileInfo.php +++ b/vendor/nette/utils/src/Utils/FileInfo.php @@ -14,10 +14,7 @@ use RectorPrefix202411\Nette; */ final class FileInfo extends \SplFileInfo { - /** - * @var string - */ - private $relativePath; + private string $relativePath; public function __construct(string $file, string $relativePath = '') { parent::__construct($file); diff --git a/vendor/nette/utils/src/Utils/Finder.php b/vendor/nette/utils/src/Utils/Finder.php index 0294aef1c6b..ca5c642b85f 100644 --- a/vendor/nette/utils/src/Utils/Finder.php +++ b/vendor/nette/utils/src/Utils/Finder.php @@ -22,29 +22,20 @@ class Finder implements \IteratorAggregate { use Nette\SmartObject; /** @var array */ - private $find = []; + private array $find = []; /** @var string[] */ - private $in = []; + private array $in = []; /** @var \Closure[] */ - private $filters = []; + private array $filters = []; /** @var \Closure[] */ - private $descentFilters = []; + private array $descentFilters = []; /** @var array */ - private $appends = []; - /** - * @var bool - */ - private $childFirst = \false; + private array $appends = []; + private bool $childFirst = \false; /** @var ?callable */ private $sort; - /** - * @var int - */ - private $maxDepth = -1; - /** - * @var bool - */ - private $ignoreUnreadableDirs = \true; + private int $maxDepth = -1; + private bool $ignoreUnreadableDirs = \true; /** * Begins search for files and directories matching mask. * @param string|mixed[] $masks @@ -184,9 +175,7 @@ class Finder implements \IteratorAggregate */ public function sortByName() { - $this->sort = function (FileInfo $a, FileInfo $b) : int { - return \strnatcmp($a->getBasename(), $b->getBasename()); - }; + $this->sort = fn(FileInfo $a, FileInfo $b): int => \strnatcmp($a->getBasename(), $b->getBasename()); return $this; } /** @@ -219,9 +208,7 @@ class Finder implements \IteratorAggregate } $end = $m[3]; $re = $this->buildPattern($m[2]); - $filter = function (FileInfo $file) use($end, $re) : bool { - return $end && !$file->isDir() || !\preg_match($re, FileSystem::unixSlashes($file->getRelativePathname())); - }; + $filter = fn(FileInfo $file): bool => $end && !$file->isDir() || !\preg_match($re, FileSystem::unixSlashes($file->getRelativePathname())); $this->descentFilter($filter); if ($end !== '/*') { $this->filter($filter); @@ -274,9 +261,7 @@ class Finder implements \IteratorAggregate $size *= $units[\strtolower($unit)]; $operator = $operator ?: '='; } - return $this->filter(function (FileInfo $file) use($operator, $size) : bool { - return !$file->isFile() || Helpers::compare($file->getSize(), $operator, $size); - }); + return $this->filter(fn(FileInfo $file): bool => !$file->isFile() || Helpers::compare($file->getSize(), $operator, $size)); } /** * Restricts the search by modified time. $operator accepts "[operator] [date]" example: >1978-01-23 @@ -294,9 +279,7 @@ class Finder implements \IteratorAggregate $operator = $operator ?: '='; } $date = DateTime::from($date)->format('U'); - return $this->filter(function (FileInfo $file) use($operator, $date) : bool { - return !$file->isFile() || Helpers::compare($file->getMTime(), $operator, $date); - }); + return $this->filter(fn(FileInfo $file): bool => !$file->isFile() || Helpers::compare($file->getMTime(), $operator, $date)); } /********************* iterator generator ****************d*g**/ /** @@ -388,7 +371,7 @@ class Finder implements \IteratorAggregate { foreach ($filters as $filter) { $res =& $cache[\spl_object_id($filter)]; - $res = $res ?? $filter($file); + $res ??= $filter($file); if (!$res) { return \false; } @@ -415,7 +398,7 @@ class Finder implements \IteratorAggregate } foreach ($splits as [$base, $rest, $recursive]) { $base = $base === '' ? '.' : $base; - $dirs = $dirCache[$base] = $dirCache[$base] ?? (\strpbrk($base, '*?[') ? \glob($base, \GLOB_NOSORT | \GLOB_ONLYDIR | \GLOB_NOESCAPE) : [\strtr($base, ['[[]' => '[', '[]]' => ']'])]); + $dirs = $dirCache[$base] ??= \strpbrk($base, '*?[') ? \glob($base, \GLOB_NOSORT | \GLOB_ONLYDIR | \GLOB_NOESCAPE) : [\strtr($base, ['[[]' => '[', '[]]' => ']'])]; // unescape [ and ] if (!$dirs) { throw new Nette\InvalidStateException(\sprintf("Directory '%s' does not exist.", \rtrim($base, '/\\'))); diff --git a/vendor/nette/utils/src/Utils/Html.php b/vendor/nette/utils/src/Utils/Html.php index 165c90efbab..4ba9ec2dd5c 100644 --- a/vendor/nette/utils/src/Utils/Html.php +++ b/vendor/nette/utils/src/Utils/Html.php @@ -236,13 +236,9 @@ class Html implements \ArrayAccess, \Countable, \IteratorAggregate, HtmlStringab public static $emptyElements = ['img' => 1, 'hr' => 1, 'br' => 1, 'input' => 1, 'meta' => 1, 'area' => 1, 'embed' => 1, 'keygen' => 1, 'source' => 1, 'base' => 1, 'col' => 1, 'link' => 1, 'param' => 1, 'basefont' => 1, 'frame' => 1, 'isindex' => 1, 'wbr' => 1, 'command' => 1, 'track' => 1]; /** @var array nodes */ protected $children = []; - /** element's name - * @var string */ - private $name = ''; - /** - * @var bool - */ - private $isEmpty = \false; + /** element's name */ + private string $name = ''; + private bool $isEmpty = \false; /** * Constructs new HTML element. * @param array|string $attrs element's attributes or plain text content diff --git a/vendor/nette/utils/src/Utils/Image.php b/vendor/nette/utils/src/Utils/Image.php index 8f04fa38a49..8dfc920df99 100644 --- a/vendor/nette/utils/src/Utils/Image.php +++ b/vendor/nette/utils/src/Utils/Image.php @@ -113,10 +113,7 @@ class Image public const JPEG = ImageType::JPEG, PNG = ImageType::PNG, GIF = ImageType::GIF, WEBP = ImageType::WEBP, AVIF = ImageType::AVIF, BMP = ImageType::BMP; public const EmptyGIF = "GIF89a\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00!\xf9\x04\x01\x00\x00\x00\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;"; private const Formats = [ImageType::JPEG => 'jpeg', ImageType::PNG => 'png', ImageType::GIF => 'gif', ImageType::WEBP => 'webp', ImageType::AVIF => 'avif', ImageType::BMP => 'bmp']; - /** - * @var \GdImage - */ - private $image; + private \GdImage $image; /** * Returns RGB color (0..255) and transparency (0..127). * @deprecated use ImageColor::rgb() @@ -551,7 +548,7 @@ class Image */ public function save(string $file, ?int $quality = null, ?int $type = null) : void { - $type = $type ?? self::extensionToType(\pathinfo($file, \PATHINFO_EXTENSION)); + $type ??= self::extensionToType(\pathinfo($file, \PATHINFO_EXTENSION)); $this->output($type, $quality, $file); } /** diff --git a/vendor/nette/utils/src/Utils/ImageColor.php b/vendor/nette/utils/src/Utils/ImageColor.php index 85d582a35e0..86417e01141 100644 --- a/vendor/nette/utils/src/Utils/ImageColor.php +++ b/vendor/nette/utils/src/Utils/ImageColor.php @@ -13,22 +13,10 @@ use RectorPrefix202411\Nette; */ class ImageColor { - /** - * @var int - */ - public $red; - /** - * @var int - */ - public $green; - /** - * @var int - */ - public $blue; - /** - * @var float - */ - public $opacity = 1; + public int $red; + public int $green; + public int $blue; + public float $opacity = 1; public static function rgb(int $red, int $green, int $blue, float $opacity = 1) : self { return new self($red, $green, $blue, $opacity); diff --git a/vendor/nette/utils/src/Utils/Iterables.php b/vendor/nette/utils/src/Utils/Iterables.php index 1873d3e2862..79f3b156b6f 100644 --- a/vendor/nette/utils/src/Utils/Iterables.php +++ b/vendor/nette/utils/src/Utils/Iterables.php @@ -168,14 +168,8 @@ final class Iterables { return new class(self::toIterator($iterable)) implements \IteratorAggregate { - /** - * @var \Iterator - */ - private $iterator; - /** - * @var mixed[] - */ - private $cache = []; + private \Iterator $iterator; + private array $cache = []; public function __construct(\Iterator $iterator, array $cache = []) { $this->iterator = $iterator; diff --git a/vendor/nette/utils/src/Utils/ObjectHelpers.php b/vendor/nette/utils/src/Utils/ObjectHelpers.php index 5106097169c..2bc71ce2150 100644 --- a/vendor/nette/utils/src/Utils/ObjectHelpers.php +++ b/vendor/nette/utils/src/Utils/ObjectHelpers.php @@ -23,9 +23,7 @@ final class ObjectHelpers public static function strictGet(string $class, string $name) : void { $rc = new \ReflectionClass($class); - $hint = self::getSuggestion(\array_merge(\array_filter($rc->getProperties(\ReflectionProperty::IS_PUBLIC), function ($p) { - return !$p->isStatic(); - }), self::parseFullDoc($rc, '~^[ \\t*]*@property(?:-read)?[ \\t]+(?:\\S+[ \\t]+)??\\$(\\w+)~m')), $name); + $hint = self::getSuggestion(\array_merge(\array_filter($rc->getProperties(\ReflectionProperty::IS_PUBLIC), fn($p) => !$p->isStatic()), self::parseFullDoc($rc, '~^[ \\t*]*@property(?:-read)?[ \\t]+(?:\\S+[ \\t]+)??\\$(\\w+)~m')), $name); throw new MemberAccessException("Cannot read an undeclared property {$class}::\${$name}" . ($hint ? ", did you mean \${$hint}?" : '.')); } /** @@ -35,9 +33,7 @@ final class ObjectHelpers public static function strictSet(string $class, string $name) : void { $rc = new \ReflectionClass($class); - $hint = self::getSuggestion(\array_merge(\array_filter($rc->getProperties(\ReflectionProperty::IS_PUBLIC), function ($p) { - return !$p->isStatic(); - }), self::parseFullDoc($rc, '~^[ \\t*]*@property(?:-write)?[ \\t]+(?:\\S+[ \\t]+)??\\$(\\w+)~m')), $name); + $hint = self::getSuggestion(\array_merge(\array_filter($rc->getProperties(\ReflectionProperty::IS_PUBLIC), fn($p) => !$p->isStatic()), self::parseFullDoc($rc, '~^[ \\t*]*@property(?:-write)?[ \\t]+(?:\\S+[ \\t]+)??\\$(\\w+)~m')), $name); throw new MemberAccessException("Cannot write to an undeclared property {$class}::\${$name}" . ($hint ? ", did you mean \${$hint}?" : '.')); } /** @@ -82,9 +78,7 @@ final class ObjectHelpers $visibility = $rm->isPrivate() ? 'private ' : ($rm->isProtected() ? 'protected ' : ''); throw new MemberAccessException("Call to {$visibility}method {$class}::{$method}() from " . ($context ? "scope {$context}." : 'global scope.')); } else { - $hint = self::getSuggestion(\array_filter((new \ReflectionClass($class))->getMethods(\ReflectionMethod::IS_PUBLIC), function ($m) { - return $m->isStatic(); - }), $method); + $hint = self::getSuggestion(\array_filter((new \ReflectionClass($class))->getMethods(\ReflectionMethod::IS_PUBLIC), fn($m) => $m->isStatic()), $method); throw new MemberAccessException("Call to undefined static method {$class}::{$method}()" . ($hint ? ", did you mean {$hint}()?" : '.')); } } diff --git a/vendor/nette/utils/src/Utils/Paginator.php b/vendor/nette/utils/src/Utils/Paginator.php index 009d9ba3f9a..2952fe343db 100644 --- a/vendor/nette/utils/src/Utils/Paginator.php +++ b/vendor/nette/utils/src/Utils/Paginator.php @@ -29,18 +29,12 @@ use RectorPrefix202411\Nette; class Paginator { use Nette\SmartObject; - /** - * @var int - */ - private $base = 1; + private int $base = 1; /** @var positive-int */ - private $itemsPerPage = 1; - /** - * @var int - */ - private $page = 1; + private int $itemsPerPage = 1; + private int $page = 1; /** @var int<0, max>|null */ - private $itemCount; + private ?int $itemCount = null; /** * Sets current page number. * @return static diff --git a/vendor/nette/utils/src/Utils/Random.php b/vendor/nette/utils/src/Utils/Random.php index cc5fb5473a9..e79b5301ced 100644 --- a/vendor/nette/utils/src/Utils/Random.php +++ b/vendor/nette/utils/src/Utils/Random.php @@ -21,9 +21,7 @@ final class Random */ public static function generate(int $length = 10, string $charlist = '0-9a-z') : string { - $charlist = \preg_replace_callback('#.-.#', function (array $m) : string { - return \implode('', \range($m[0][0], $m[0][2])); - }, $charlist); + $charlist = \preg_replace_callback('#.-.#', fn(array $m): string => \implode('', \range($m[0][0], $m[0][2])), $charlist); $charlist = \count_chars($charlist, 3); $chLen = \strlen($charlist); if ($length < 1) { diff --git a/vendor/nette/utils/src/Utils/ReflectionMethod.php b/vendor/nette/utils/src/Utils/ReflectionMethod.php index 8bac37f2c60..8b3546e9d73 100644 --- a/vendor/nette/utils/src/Utils/ReflectionMethod.php +++ b/vendor/nette/utils/src/Utils/ReflectionMethod.php @@ -13,10 +13,7 @@ namespace RectorPrefix202411\Nette\Utils; */ final class ReflectionMethod extends \ReflectionMethod { - /** - * @var \ReflectionClass - */ - private $originalClass; + private \ReflectionClass $originalClass; /** * @param object|string $objectOrMethod */ diff --git a/vendor/nette/utils/src/Utils/Strings.php b/vendor/nette/utils/src/Utils/Strings.php index c9be76b36ce..bcdc0844bae 100644 --- a/vendor/nette/utils/src/Utils/Strings.php +++ b/vendor/nette/utils/src/Utils/Strings.php @@ -514,9 +514,7 @@ class Strings while ($offset <= strlen($subject) - ($counter ? 1 : 0) && self::pcre('preg_match', [$pattern, $subject, &$m, $flags, $offset])) { $offset = $m[0][1] + \max(1, strlen($m[0][0])); if (!$captureOffset) { - $m = \array_map(function ($item) { - return $item[0]; - }, $m); + $m = \array_map(fn($item) => $item[0], $m); } elseif ($utf8) { $m = self::bytesToChars($subject, [$m])[0]; } @@ -557,9 +555,7 @@ class Strings if ($utf8) { $pattern .= 'u'; if ($captureOffset) { - $replacement = function ($m) use($replacement, $subject) { - return $replacement(self::bytesToChars($subject, [$m])[0]); - }; + $replacement = fn($m) => $replacement(self::bytesToChars($subject, [$m])[0]); } } if (PHP_VERSION_ID < 70400) { @@ -572,9 +568,7 @@ return self::pcre('preg_replace_callback', [$pattern, $replacement, $subject, $l $pattern = \array_keys($pattern); } if ($utf8) { - $pattern = \array_map(function ($item) { - return $item . 'u'; - }, (array) $pattern); + $pattern = \array_map(fn($item) => $item . 'u', (array) $pattern); } return self::pcre('preg_replace', [$pattern, $replacement, $subject, $limit]); } diff --git a/vendor/nette/utils/src/Utils/Type.php b/vendor/nette/utils/src/Utils/Type.php index 690b226638b..3d59c520b17 100644 --- a/vendor/nette/utils/src/Utils/Type.php +++ b/vendor/nette/utils/src/Utils/Type.php @@ -14,15 +14,9 @@ use RectorPrefix202411\Nette; final class Type { /** @var array */ - private $types; - /** - * @var bool - */ - private $simple; - /** - * @var string - */ - private $kind; + private array $types; + private bool $simple; + private string $kind; // | & /** * Creates a Type object based on reflection. Resolves self, static and parent to the actual class name. @@ -43,9 +37,7 @@ final class Type $name = self::resolve($type->getName(), $of); return $asObject ? new self($type->allowsNull() && $name !== 'mixed' ? [$name, 'null'] : [$name]) : $name; } elseif ($type instanceof \ReflectionUnionType || $type instanceof \ReflectionIntersectionType) { - return new self(\array_map(function ($t) use($of) { - return self::fromReflectionType($t, $of, \false); - }, $type->getTypes()), $type instanceof \ReflectionUnionType ? '|' : '&'); + return new self(\array_map(fn($t) => self::fromReflectionType($t, $of, \false), $type->getTypes()), $type instanceof \ReflectionUnionType ? '|' : '&'); } else { throw new Nette\InvalidStateException('Unexpected type of ' . Reflection::toString($of)); } @@ -117,9 +109,7 @@ final class Type */ public function getNames() : array { - return \array_map(function ($t) { - return $t instanceof self ? $t->getNames() : $t; - }, $this->types); + return \array_map(fn($t) => $t instanceof self ? $t->getNames() : $t, $this->types); } /** * Returns the array of subtypes that make up the compound type as Type objects: @@ -127,9 +117,7 @@ final class Type */ public function getTypes() : array { - return \array_map(function ($t) { - return $t instanceof self ? $t : new self([$t]); - }, $this->types); + return \array_map(fn($t) => $t instanceof self ? $t : new self([$t]), $this->types); } /** * Returns the type name for simple types, otherwise null. @@ -194,22 +182,14 @@ final class Type return \true; } $subtype = self::fromString($subtype); - return $subtype->isUnion() ? Arrays::every($subtype->types, function ($t) { - return $this->allows2($t instanceof self ? $t->types : [$t]); - }) : $this->allows2($subtype->types); + return $subtype->isUnion() ? Arrays::every($subtype->types, fn($t) => $this->allows2($t instanceof self ? $t->types : [$t])) : $this->allows2($subtype->types); } private function allows2(array $subtypes) : bool { - return $this->isUnion() ? Arrays::some($this->types, function ($t) use($subtypes) { - return $this->allows3($t instanceof self ? $t->types : [$t], $subtypes); - }) : $this->allows3($this->types, $subtypes); + return $this->isUnion() ? Arrays::some($this->types, fn($t) => $this->allows3($t instanceof self ? $t->types : [$t], $subtypes)) : $this->allows3($this->types, $subtypes); } private function allows3(array $types, array $subtypes) : bool { - return Arrays::every($types, function ($type) use($subtypes) { - return Arrays::some($subtypes, function ($subtype) use($type) { - return Validators::isBuiltinType($type) ? \strcasecmp($type, $subtype) === 0 : \is_a($subtype, $type, \true); - }); - }); + return Arrays::every($types, fn($type) => Arrays::some($subtypes, fn($subtype) => Validators::isBuiltinType($type) ? \strcasecmp($type, $subtype) === 0 : \is_a($subtype, $type, \true))); } } diff --git a/vendor/nikic/php-parser/README.md b/vendor/nikic/php-parser/README.md index 3bca288b92f..edb3ed32f32 100644 --- a/vendor/nikic/php-parser/README.md +++ b/vendor/nikic/php-parser/README.md @@ -3,24 +3,24 @@ PHP Parser [![Coverage Status](https://coveralls.io/repos/github/nikic/PHP-Parser/badge.svg?branch=master)](https://coveralls.io/github/nikic/PHP-Parser?branch=master) -This is a PHP 5.2 to PHP 8.2 parser written in PHP. Its purpose is to simplify static code analysis and +This is a PHP parser written in PHP. Its purpose is to simplify static code analysis and manipulation. -[**Documentation for version 4.x**][doc_4_x] (stable; for running on PHP >= 7.1; for parsing PHP 5.2 to PHP 8.2). +[**Documentation for version 5.x**][doc_master] (current; for running on PHP >= 7.4; for parsing PHP 7.0 to PHP 8.4, with limited support for parsing PHP 5.x). -[Documentation for version 3.x][doc_3_x] (unsupported; for running on PHP >= 5.5; for parsing PHP 5.2 to PHP 7.2). +[Documentation for version 4.x][doc_4_x] (supported; for running on PHP >= 7.0; for parsing PHP 5.2 to PHP 8.3). Features -------- The main features provided by this library are: - * Parsing PHP 5, PHP 7, and PHP 8 code into an abstract syntax tree (AST). + * Parsing PHP 7, and PHP 8 code into an abstract syntax tree (AST). * Invalid code can be parsed into a partial AST. * The AST contains accurate location information. * Dumping the AST in human-readable form. * Converting an AST back to PHP code. - * Experimental: Formatting can be preserved for partially changed ASTs. + * Formatting can be preserved for partially changed ASTs. * Infrastructure to traverse and modify ASTs. * Resolution of namespaced names. * Evaluation of constant expressions. @@ -51,7 +51,7 @@ function test($foo) } CODE; -$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); +$parser = (new ParserFactory())->createForNewestSupportedVersion(); try { $ast = $parser->parse($code); } catch (Error $error) { @@ -68,12 +68,17 @@ This dumps an AST looking something like this: ``` array( 0: Stmt_Function( + attrGroups: array( + ) byRef: false name: Identifier( name: test ) params: array( 0: Param( + attrGroups: array( + ) + flags: 0 type: null byRef: false variadic: false @@ -88,12 +93,11 @@ array( 0: Stmt_Expression( expr: Expr_FuncCall( name: Name( - parts: array( - 0: var_dump - ) + name: var_dump ) args: array( 0: Arg( + name: null value: Expr_Variable( name: foo ) @@ -135,12 +139,16 @@ This gives us an AST where the `Function_::$stmts` are empty: ``` array( 0: Stmt_Function( + attrGroups: array( + ) byRef: false name: Identifier( name: test ) params: array( 0: Param( + attrGroups: array( + ) type: null byRef: false variadic: false @@ -203,9 +211,8 @@ Component documentation: * [AST builders](doc/component/AST_builders.markdown) * Fluent builders for AST nodes * [Lexer](doc/component/Lexer.markdown) - * Lexer options - * Token and file positions for nodes - * Custom attributes + * Emulation + * Tokens, positions and attributes * [Error handling](doc/component/Error_handling.markdown) * Column information for errors * Error recovery (parsing of syntactically incorrect code) @@ -223,3 +230,4 @@ Component documentation: [doc_3_x]: https://github.com/nikic/PHP-Parser/tree/3.x/doc [doc_4_x]: https://github.com/nikic/PHP-Parser/tree/4.x/doc + [doc_master]: https://github.com/nikic/PHP-Parser/tree/master/doc diff --git a/vendor/nikic/php-parser/bin/php-parse b/vendor/nikic/php-parser/bin/php-parse index 88b566cb85e..c82c00ab0d4 100755 --- a/vendor/nikic/php-parser/bin/php-parse +++ b/vendor/nikic/php-parser/bin/php-parse @@ -21,23 +21,27 @@ if (empty($operations)) { if (empty($files)) { showHelp("Must specify at least one file."); } -$lexer = new \PhpParser\Lexer\Emulative(['usedAttributes' => ['startLine', 'endLine', 'startFilePos', 'endFilePos', 'comments']]); -$parser = (new \PhpParser\ParserFactory())->create(\PhpParser\ParserFactory::PREFER_PHP7, $lexer); +$parser = (new \PhpParser\ParserFactory())->createForVersion($attributes['version']); $dumper = new \PhpParser\NodeDumper(['dumpComments' => \true, 'dumpPositions' => $attributes['with-positions']]); $prettyPrinter = new \PhpParser\PrettyPrinter\Standard(); $traverser = new \PhpParser\NodeTraverser(); $traverser->addVisitor(new \PhpParser\NodeVisitor\NameResolver()); foreach ($files as $file) { - if (\strpos($file, ' Code {$code}\n"); + if ($file === '-') { + $code = \file_get_contents('php://stdin'); + \fwrite(\STDERR, "====> Stdin:\n"); } else { - if (!\file_exists($file)) { - \fwrite(\STDERR, "File {$file} does not exist.\n"); - exit(1); + if (\strpos($file, ' Code {$code}\n"); + } else { + if (!\file_exists($file)) { + \fwrite(\STDERR, "File {$file} does not exist.\n"); + exit(1); + } + $code = \file_get_contents($file); + \fwrite(\STDERR, "====> File {$file}:\n"); } - $code = \file_get_contents($file); - \fwrite(\STDERR, "====> File {$file}:\n"); } if ($attributes['with-recovery']) { $errorHandler = new \PhpParser\ErrorHandler\Collecting(); @@ -90,7 +94,7 @@ function showHelp($error = '') if ($error) { \fwrite(\STDERR, $error . "\n\n"); } - \fwrite($error ? \STDERR : \STDOUT, << \false, 'with-positions' => \false, 'with-recovery' => \false]; + $attributes = ['with-column-info' => \false, 'with-positions' => \false, 'with-recovery' => \false, 'version' => \PhpParser\PhpVersion::getNewestSupported()]; \array_shift($args); $parseOptions = \true; foreach ($args as $arg) { @@ -169,7 +174,9 @@ function parseArgs($args) $parseOptions = \false; break; default: - if ($arg[0] === '-') { + if (\preg_match('/^--version=(.*)$/', $arg, $matches)) { + $attributes['version'] = \PhpParser\PhpVersion::fromString($matches[1]); + } elseif ($arg[0] === '-' && \strlen($arg[0]) > 1) { showHelp("Invalid operation {$arg}."); } else { $files[] = $arg; diff --git a/vendor/nikic/php-parser/composer.json b/vendor/nikic/php-parser/composer.json index 04688e2d75c..5e839e3368f 100644 --- a/vendor/nikic/php-parser/composer.json +++ b/vendor/nikic/php-parser/composer.json @@ -13,16 +13,18 @@ } ], "require": { - "php": ">=7.1", - "ext-tokenizer": "*" + "php": ">=7.4", + "ext-tokenizer": "*", + "ext-json": "*", + "ext-ctype": "*" }, "require-dev": { - "phpunit\/phpunit": "^7.0 || ^8.0 || ^9.0", + "phpunit\/phpunit": "^9.0", "ircmaxell\/php-yacc": "^0.0.7" }, "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php index 07b353d1c69..2bd3152c153 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php @@ -5,23 +5,26 @@ namespace PhpParser\Builder; use PhpParser; use PhpParser\BuilderHelpers; +use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\Const_; use PhpParser\Node\Identifier; use PhpParser\Node\Stmt; class ClassConst implements PhpParser\Builder { - protected $flags = 0; - protected $attributes = []; - protected $constants = []; - /** @var Node\AttributeGroup[] */ - protected $attributeGroups = []; - /** @var Identifier|Node\Name|Node\ComplexType */ - protected $type; + protected int $flags = 0; + /** @var array */ + protected array $attributes = []; + /** @var list */ + protected array $constants = []; + /** @var list */ + protected array $attributeGroups = []; + /** @var Identifier|Node\Name|Node\ComplexType|null */ + protected ?Node $type = null; /** * Creates a class constant builder * - * @param string|Identifier $name Name + * @param string|Identifier $name Name * @param Node\Expr|bool|null|int|float|string|array|\UnitEnum $value Value */ public function __construct($name, $value) @@ -31,7 +34,7 @@ class ClassConst implements PhpParser\Builder /** * Add another constant to const group * - * @param string|Identifier $name Name + * @param string|Identifier $name Name * @param Node\Expr|bool|null|int|float|string|array|\UnitEnum $value Value * * @return $this The builder instance (for fluid interface) @@ -48,7 +51,7 @@ class ClassConst implements PhpParser\Builder */ public function makePublic() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PUBLIC); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PUBLIC); return $this; } /** @@ -58,7 +61,7 @@ class ClassConst implements PhpParser\Builder */ public function makeProtected() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PROTECTED); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PROTECTED); return $this; } /** @@ -68,7 +71,7 @@ class ClassConst implements PhpParser\Builder */ public function makePrivate() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PRIVATE); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PRIVATE); return $this; } /** @@ -78,7 +81,7 @@ class ClassConst implements PhpParser\Builder */ public function makeFinal() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_FINAL); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::FINAL); return $this; } /** diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php index 444b266e504..61b8a8886a7 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php @@ -5,21 +5,27 @@ namespace PhpParser\Builder; use PhpParser; use PhpParser\BuilderHelpers; +use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\Name; use PhpParser\Node\Stmt; class Class_ extends \PhpParser\Builder\Declaration { - protected $name; - protected $extends = null; - protected $implements = []; - protected $flags = 0; - protected $uses = []; - protected $constants = []; - protected $properties = []; - protected $methods = []; - /** @var Node\AttributeGroup[] */ - protected $attributeGroups = []; + protected string $name; + protected ?Name $extends = null; + /** @var list */ + protected array $implements = []; + protected int $flags = 0; + /** @var list */ + protected array $uses = []; + /** @var list */ + protected array $constants = []; + /** @var list */ + protected array $properties = []; + /** @var list */ + protected array $methods = []; + /** @var list */ + protected array $attributeGroups = []; /** * Creates a class builder. * @@ -62,7 +68,7 @@ class Class_ extends \PhpParser\Builder\Declaration */ public function makeAbstract() { - $this->flags = BuilderHelpers::addClassModifier($this->flags, Stmt\Class_::MODIFIER_ABSTRACT); + $this->flags = BuilderHelpers::addClassModifier($this->flags, Modifiers::ABSTRACT); return $this; } /** @@ -72,12 +78,17 @@ class Class_ extends \PhpParser\Builder\Declaration */ public function makeFinal() { - $this->flags = BuilderHelpers::addClassModifier($this->flags, Stmt\Class_::MODIFIER_FINAL); + $this->flags = BuilderHelpers::addClassModifier($this->flags, Modifiers::FINAL); return $this; } + /** + * Makes the class readonly. + * + * @return $this The builder instance (for fluid interface) + */ public function makeReadonly() { - $this->flags = BuilderHelpers::addClassModifier($this->flags, Stmt\Class_::MODIFIER_READONLY); + $this->flags = BuilderHelpers::addClassModifier($this->flags, Modifiers::READONLY); return $this; } /** @@ -90,12 +101,17 @@ class Class_ extends \PhpParser\Builder\Declaration public function addStmt($stmt) { $stmt = BuilderHelpers::normalizeNode($stmt); - $targets = [Stmt\TraitUse::class => &$this->uses, Stmt\ClassConst::class => &$this->constants, Stmt\Property::class => &$this->properties, Stmt\ClassMethod::class => &$this->methods]; - $class = \get_class($stmt); - if (!isset($targets[$class])) { + if ($stmt instanceof Stmt\Property) { + $this->properties[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassMethod) { + $this->methods[] = $stmt; + } elseif ($stmt instanceof Stmt\TraitUse) { + $this->uses[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassConst) { + $this->constants[] = $stmt; + } else { throw new \LogicException(\sprintf('Unexpected node of type "%s"', $stmt->getType())); } - $targets[$class][] = $stmt; return $this; } /** diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php index d44671423ec..b9c5d8278e5 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php @@ -7,12 +7,20 @@ use PhpParser; use PhpParser\BuilderHelpers; abstract class Declaration implements PhpParser\Builder { - protected $attributes = []; + /** @var array */ + protected array $attributes = []; + /** + * Adds a statement. + * + * @param PhpParser\Node\Stmt|PhpParser\Builder $stmt The statement to add + * + * @return $this The builder instance (for fluid interface) + */ public abstract function addStmt($stmt); /** * Adds multiple statements. * - * @param array $stmts The statements to add + * @param (PhpParser\Node\Stmt|PhpParser\Builder)[] $stmts The statements to add * * @return $this The builder instance (for fluid interface) */ diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php index 83f3a46cdae..ca4a67983f9 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php @@ -10,15 +10,17 @@ use PhpParser\Node\Identifier; use PhpParser\Node\Stmt; class EnumCase implements PhpParser\Builder { + /** @var Identifier|string */ protected $name; - protected $value = null; - protected $attributes = []; - /** @var Node\AttributeGroup[] */ - protected $attributeGroups = []; + protected ?Node\Expr $value = null; + /** @var array */ + protected array $attributes = []; + /** @var list */ + protected array $attributeGroups = []; /** * Creates an enum case builder. * - * @param string|Identifier $name Name + * @param string|Identifier $name Name */ public function __construct($name) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php index c89ff7ee6ea..a0c31a5c104 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php @@ -11,15 +11,20 @@ use PhpParser\Node\Name; use PhpParser\Node\Stmt; class Enum_ extends \PhpParser\Builder\Declaration { - protected $name; - protected $scalarType = null; - protected $implements = []; - protected $uses = []; - protected $enumCases = []; - protected $constants = []; - protected $methods = []; - /** @var Node\AttributeGroup[] */ - protected $attributeGroups = []; + protected string $name; + protected ?Identifier $scalarType = null; + /** @var list */ + protected array $implements = []; + /** @var list */ + protected array $uses = []; + /** @var list */ + protected array $enumCases = []; + /** @var list */ + protected array $constants = []; + /** @var list */ + protected array $methods = []; + /** @var list */ + protected array $attributeGroups = []; /** * Creates an enum builder. * @@ -32,7 +37,7 @@ class Enum_ extends \PhpParser\Builder\Declaration /** * Sets the scalar type. * - * @param string|Identifier $type + * @param string|Identifier $scalarType * * @return $this */ @@ -65,12 +70,17 @@ class Enum_ extends \PhpParser\Builder\Declaration public function addStmt($stmt) { $stmt = BuilderHelpers::normalizeNode($stmt); - $targets = [Stmt\TraitUse::class => &$this->uses, Stmt\EnumCase::class => &$this->enumCases, Stmt\ClassConst::class => &$this->constants, Stmt\ClassMethod::class => &$this->methods]; - $class = \get_class($stmt); - if (!isset($targets[$class])) { + if ($stmt instanceof Stmt\EnumCase) { + $this->enumCases[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassMethod) { + $this->methods[] = $stmt; + } elseif ($stmt instanceof Stmt\TraitUse) { + $this->uses[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassConst) { + $this->constants[] = $stmt; + } else { throw new \LogicException(\sprintf('Unexpected node of type "%s"', $stmt->getType())); } - $targets[$class][] = $stmt; return $this; } /** diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php index 6dfd36a77c1..1a7733a068f 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php @@ -7,10 +7,11 @@ use PhpParser\BuilderHelpers; use PhpParser\Node; abstract class FunctionLike extends \PhpParser\Builder\Declaration { - protected $returnByRef = \false; - protected $params = []; - /** @var string|Node\Name|Node\NullableType|null */ - protected $returnType = null; + protected bool $returnByRef = \false; + /** @var Node\Param[] */ + protected array $params = []; + /** @var Node\Identifier|Node\Name|Node\ComplexType|null */ + protected ?Node $returnType = null; /** * Make the function return by reference. * @@ -40,7 +41,7 @@ abstract class FunctionLike extends \PhpParser\Builder\Declaration /** * Adds multiple parameters. * - * @param array $params The parameters to add + * @param (Node\Param|Param)[] $params The parameters to add * * @return $this The builder instance (for fluid interface) */ diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php index f3c3ca3d54f..bf10852e1d5 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php @@ -9,10 +9,11 @@ use PhpParser\Node; use PhpParser\Node\Stmt; class Function_ extends \PhpParser\Builder\FunctionLike { - protected $name; - protected $stmts = []; - /** @var Node\AttributeGroup[] */ - protected $attributeGroups = []; + protected string $name; + /** @var list */ + protected array $stmts = []; + /** @var list */ + protected array $attributeGroups = []; /** * Creates a function builder. * diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php index fcaa3e80918..5d5edff8321 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php @@ -10,12 +10,15 @@ use PhpParser\Node\Name; use PhpParser\Node\Stmt; class Interface_ extends \PhpParser\Builder\Declaration { - protected $name; - protected $extends = []; - protected $constants = []; - protected $methods = []; - /** @var Node\AttributeGroup[] */ - protected $attributeGroups = []; + protected string $name; + /** @var list */ + protected array $extends = []; + /** @var list */ + protected array $constants = []; + /** @var list */ + protected array $methods = []; + /** @var list */ + protected array $attributeGroups = []; /** * Creates an interface builder. * diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php index 97050de1a27..a47cd9c884a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php @@ -5,16 +5,17 @@ namespace PhpParser\Builder; use PhpParser; use PhpParser\BuilderHelpers; +use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\Stmt; class Method extends \PhpParser\Builder\FunctionLike { - protected $name; - protected $flags = 0; - /** @var array|null */ - protected $stmts = []; - /** @var Node\AttributeGroup[] */ - protected $attributeGroups = []; + protected string $name; + protected int $flags = 0; + /** @var list|null */ + protected ?array $stmts = []; + /** @var list */ + protected array $attributeGroups = []; /** * Creates a method builder. * @@ -31,7 +32,7 @@ class Method extends \PhpParser\Builder\FunctionLike */ public function makePublic() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PUBLIC); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PUBLIC); return $this; } /** @@ -41,7 +42,7 @@ class Method extends \PhpParser\Builder\FunctionLike */ public function makeProtected() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PROTECTED); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PROTECTED); return $this; } /** @@ -51,7 +52,7 @@ class Method extends \PhpParser\Builder\FunctionLike */ public function makePrivate() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PRIVATE); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PRIVATE); return $this; } /** @@ -61,7 +62,7 @@ class Method extends \PhpParser\Builder\FunctionLike */ public function makeStatic() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_STATIC); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::STATIC); return $this; } /** @@ -74,7 +75,7 @@ class Method extends \PhpParser\Builder\FunctionLike if (!empty($this->stmts)) { throw new \LogicException('Cannot make method with statements abstract'); } - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_ABSTRACT); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::ABSTRACT); $this->stmts = null; // abstract methods don't have statements return $this; @@ -86,7 +87,7 @@ class Method extends \PhpParser\Builder\FunctionLike */ public function makeFinal() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_FINAL); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::FINAL); return $this; } /** diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php index 5c76282a0ac..f58fea85680 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php @@ -9,8 +9,9 @@ use PhpParser\Node; use PhpParser\Node\Stmt; class Namespace_ extends \PhpParser\Builder\Declaration { - private $name; - private $stmts = []; + private ?Node\Name $name; + /** @var Stmt[] */ + private array $stmts = []; /** * Creates a namespace builder. * diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php index 10dd9f4fae9..3aa4a2280fd 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php @@ -5,18 +5,19 @@ namespace PhpParser\Builder; use PhpParser; use PhpParser\BuilderHelpers; +use PhpParser\Modifiers; use PhpParser\Node; class Param implements PhpParser\Builder { - protected $name; - protected $default = null; - /** @var Node\Identifier|Node\Name|Node\NullableType|null */ - protected $type = null; - protected $byRef = \false; - protected $variadic = \false; - protected $flags = 0; - /** @var Node\AttributeGroup[] */ - protected $attributeGroups = []; + protected string $name; + protected ?Node\Expr $default = null; + /** @var Node\Identifier|Node\Name|Node\ComplexType|null */ + protected ?Node $type = null; + protected bool $byRef = \false; + protected int $flags = 0; + protected bool $variadic = \false; + /** @var list */ + protected array $attributeGroups = []; /** * Creates a parameter builder. * @@ -53,19 +54,6 @@ class Param implements PhpParser\Builder } return $this; } - /** - * Sets type for the parameter. - * - * @param string|Node\Name|Node\Identifier|Node\ComplexType $type Parameter type - * - * @return $this The builder instance (for fluid interface) - * - * @deprecated Use setType() instead - */ - public function setTypeHint($type) - { - return $this->setType($type); - } /** * Make the parameter accept the value by reference. * @@ -93,7 +81,7 @@ class Param implements PhpParser\Builder */ public function makePublic() { - $this->flags = BuilderHelpers::addModifier($this->flags, Node\Stmt\Class_::MODIFIER_PUBLIC); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PUBLIC); return $this; } /** @@ -103,7 +91,7 @@ class Param implements PhpParser\Builder */ public function makeProtected() { - $this->flags = BuilderHelpers::addModifier($this->flags, Node\Stmt\Class_::MODIFIER_PROTECTED); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PROTECTED); return $this; } /** @@ -113,7 +101,7 @@ class Param implements PhpParser\Builder */ public function makePrivate() { - $this->flags = BuilderHelpers::addModifier($this->flags, Node\Stmt\Class_::MODIFIER_PRIVATE); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PRIVATE); return $this; } /** @@ -123,7 +111,27 @@ class Param implements PhpParser\Builder */ public function makeReadonly() { - $this->flags = BuilderHelpers::addModifier($this->flags, Node\Stmt\Class_::MODIFIER_READONLY); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::READONLY); + return $this; + } + /** + * Gives the promoted property private(set) visibility. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePrivateSet() + { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PRIVATE_SET); + return $this; + } + /** + * Gives the promoted property protected(set) visibility. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeProtectedSet() + { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PROTECTED_SET); return $this; } /** diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php index 7a985e7c498..496a748b852 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php @@ -5,6 +5,7 @@ namespace PhpParser\Builder; use PhpParser; use PhpParser\BuilderHelpers; +use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\Identifier; use PhpParser\Node\Name; @@ -12,14 +13,17 @@ use PhpParser\Node\Stmt; use PhpParser\Node\ComplexType; class Property implements PhpParser\Builder { - protected $name; - protected $flags = 0; - protected $default = null; - protected $attributes = []; - /** @var null|Identifier|Name|NullableType */ - protected $type; - /** @var Node\AttributeGroup[] */ - protected $attributeGroups = []; + protected string $name; + protected int $flags = 0; + protected ?Node\Expr $default = null; + /** @var array */ + protected array $attributes = []; + /** @var null|Identifier|Name|ComplexType */ + protected ?Node $type = null; + /** @var list */ + protected array $attributeGroups = []; + /** @var list */ + protected array $hooks = []; /** * Creates a property builder. * @@ -36,7 +40,7 @@ class Property implements PhpParser\Builder */ public function makePublic() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PUBLIC); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PUBLIC); return $this; } /** @@ -46,7 +50,7 @@ class Property implements PhpParser\Builder */ public function makeProtected() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PROTECTED); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PROTECTED); return $this; } /** @@ -56,7 +60,7 @@ class Property implements PhpParser\Builder */ public function makePrivate() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PRIVATE); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PRIVATE); return $this; } /** @@ -66,7 +70,7 @@ class Property implements PhpParser\Builder */ public function makeStatic() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_STATIC); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::STATIC); return $this; } /** @@ -76,7 +80,47 @@ class Property implements PhpParser\Builder */ public function makeReadonly() { - $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_READONLY); + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::READONLY); + return $this; + } + /** + * Makes the property abstract. Requires at least one property hook to be specified as well. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeAbstract() + { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::ABSTRACT); + return $this; + } + /** + * Makes the property final. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeFinal() + { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::FINAL); + return $this; + } + /** + * Gives the property private(set) visibility. + * + * @return $this The builder instance (for fluid interface) + */ + public function makePrivateSet() + { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PRIVATE_SET); + return $this; + } + /** + * Gives the property protected(set) visibility. + * + * @return $this The builder instance (for fluid interface) + */ + public function makeProtectedSet() + { + $this->flags = BuilderHelpers::addModifier($this->flags, Modifiers::PROTECTED_SET); return $this; } /** @@ -127,6 +171,16 @@ class Property implements PhpParser\Builder $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute); return $this; } + /** + * Adds a property hook. + * + * @return $this The builder instance (for fluid interface) + */ + public function addHook(Node\PropertyHook $hook) + { + $this->hooks[] = $hook; + return $this; + } /** * Returns the built class node. * @@ -134,6 +188,9 @@ class Property implements PhpParser\Builder */ public function getNode() : PhpParser\Node { - return new Stmt\Property($this->flags !== 0 ? $this->flags : Stmt\Class_::MODIFIER_PUBLIC, [new Stmt\PropertyProperty($this->name, $this->default)], $this->attributes, $this->type, $this->attributeGroups); + if ($this->flags & Modifiers::ABSTRACT && !$this->hooks) { + throw new PhpParser\Error('Only hooked properties may be declared abstract'); + } + return new Stmt\Property($this->flags !== 0 ? $this->flags : Modifiers::PUBLIC, [new Node\PropertyItem($this->name, $this->default)], $this->attributes, $this->type, $this->attributeGroups, $this->hooks); } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php index 0c68467ca68..dd8ad4265b0 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php @@ -9,8 +9,10 @@ use PhpParser\Node; use PhpParser\Node\Stmt; class TraitUse implements Builder { - protected $traits = []; - protected $adaptations = []; + /** @var Node\Name[] */ + protected array $traits = []; + /** @var Stmt\TraitUseAdaptation[] */ + protected array $adaptations = []; /** * Creates a trait use builder. * diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php index 094a0c975d7..354fd468bf1 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php @@ -5,25 +5,26 @@ namespace PhpParser\Builder; use PhpParser\Builder; use PhpParser\BuilderHelpers; +use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\Stmt; class TraitUseAdaptation implements Builder { - const TYPE_UNDEFINED = 0; - const TYPE_ALIAS = 1; - const TYPE_PRECEDENCE = 2; - /** @var int Type of building adaptation */ - protected $type; - protected $trait; - protected $method; - protected $modifier = null; - protected $alias = null; - protected $insteadof = []; + private const TYPE_UNDEFINED = 0; + private const TYPE_ALIAS = 1; + private const TYPE_PRECEDENCE = 2; + protected int $type; + protected ?Node\Name $trait; + protected Node\Identifier $method; + protected ?int $modifier = null; + protected ?Node\Identifier $alias = null; + /** @var Node\Name[] */ + protected array $insteadof = []; /** * Creates a trait use adaptation builder. * - * @param Node\Name|string|null $trait Name of adaptated trait - * @param Node\Identifier|string $method Name of adaptated method + * @param Node\Name|string|null $trait Name of adapted trait + * @param Node\Identifier|string $method Name of adapted method */ public function __construct($trait, $method) { @@ -34,7 +35,7 @@ class TraitUseAdaptation implements Builder /** * Sets alias of method. * - * @param Node\Identifier|string $alias Alias for adaptated method + * @param Node\Identifier|string $alias Alias for adapted method * * @return $this The builder instance (for fluid interface) */ @@ -46,37 +47,37 @@ class TraitUseAdaptation implements Builder if ($this->type !== self::TYPE_ALIAS) { throw new \LogicException('Cannot set alias for not alias adaptation buider'); } - $this->alias = $alias; + $this->alias = BuilderHelpers::normalizeIdentifier($alias); return $this; } /** - * Sets adaptated method public. + * Sets adapted method public. * * @return $this The builder instance (for fluid interface) */ public function makePublic() { - $this->setModifier(Stmt\Class_::MODIFIER_PUBLIC); + $this->setModifier(Modifiers::PUBLIC); return $this; } /** - * Sets adaptated method protected. + * Sets adapted method protected. * * @return $this The builder instance (for fluid interface) */ public function makeProtected() { - $this->setModifier(Stmt\Class_::MODIFIER_PROTECTED); + $this->setModifier(Modifiers::PROTECTED); return $this; } /** - * Sets adaptated method private. + * Sets adapted method private. * * @return $this The builder instance (for fluid interface) */ public function makePrivate() { - $this->setModifier(Stmt\Class_::MODIFIER_PRIVATE); + $this->setModifier(Modifiers::PRIVATE); return $this; } /** @@ -102,7 +103,7 @@ class TraitUseAdaptation implements Builder } return $this; } - protected function setModifier(int $modifier) + protected function setModifier(int $modifier) : void { if ($this->type === self::TYPE_UNDEFINED) { $this->type = self::TYPE_ALIAS; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php index fe26aec5d6b..6b344288940 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php @@ -9,12 +9,17 @@ use PhpParser\Node; use PhpParser\Node\Stmt; class Trait_ extends \PhpParser\Builder\Declaration { - protected $name; - protected $uses = []; - protected $properties = []; - protected $methods = []; - /** @var Node\AttributeGroup[] */ - protected $attributeGroups = []; + protected string $name; + /** @var list */ + protected array $uses = []; + /** @var list */ + protected array $constants = []; + /** @var list */ + protected array $properties = []; + /** @var list */ + protected array $methods = []; + /** @var list */ + protected array $attributeGroups = []; /** * Creates an interface builder. * @@ -40,6 +45,8 @@ class Trait_ extends \PhpParser\Builder\Declaration $this->methods[] = $stmt; } elseif ($stmt instanceof Stmt\TraitUse) { $this->uses[] = $stmt; + } elseif ($stmt instanceof Stmt\ClassConst) { + $this->constants[] = $stmt; } else { throw new \LogicException(\sprintf('Unexpected node of type "%s"', $stmt->getType())); } @@ -64,6 +71,6 @@ class Trait_ extends \PhpParser\Builder\Declaration */ public function getNode() : PhpParser\Node { - return new Stmt\Trait_($this->name, ['stmts' => \array_merge($this->uses, $this->properties, $this->methods), 'attrGroups' => $this->attributeGroups], $this->attributes); + return new Stmt\Trait_($this->name, ['stmts' => \array_merge($this->uses, $this->constants, $this->properties, $this->methods), 'attrGroups' => $this->attributeGroups], $this->attributes); } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php index 58da5234555..ad40a553bfe 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php @@ -9,14 +9,15 @@ use PhpParser\Node; use PhpParser\Node\Stmt; class Use_ implements Builder { - protected $name; - protected $type; - protected $alias = null; + protected Node\Name $name; + /** @var Stmt\Use_::TYPE_* */ + protected int $type; + protected ?string $alias = null; /** * Creates a name use (alias) builder. * * @param Node\Name|string $name Name of the entity (namespace, class, function, constant) to alias - * @param int $type One of the Stmt\Use_::TYPE_* constants + * @param Stmt\Use_::TYPE_* $type One of the Stmt\Use_::TYPE_* constants */ public function __construct($name, int $type) { @@ -42,6 +43,6 @@ class Use_ implements Builder */ public function getNode() : Node { - return new Stmt\Use_([new Stmt\UseUse($this->name, $this->alias)], $this->type); + return new Stmt\Use_([new Node\UseItem($this->name, $this->alias)], $this->type); } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php b/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php index 936e7e0faf1..f056e2e3e00 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php +++ b/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php @@ -16,9 +16,7 @@ class BuilderFactory * Creates an attribute node. * * @param string|Name $name Name of the attribute - * @param array $args Attribute named arguments - * - * @return Node\Attribute + * @param array $args Attribute named arguments */ public function attribute($name, array $args = []) : \PhpParser\Node\Attribute { @@ -84,7 +82,7 @@ class BuilderFactory * * @param Node\Name|string ...$traits Trait names * - * @return Builder\TraitUse The create trait use builder + * @return Builder\TraitUse The created trait use builder */ public function useTrait(...$traits) : \PhpParser\Builder\TraitUse { @@ -93,10 +91,10 @@ class BuilderFactory /** * Creates a trait use adaptation builder. * - * @param Node\Name|string|null $trait Trait name + * @param Node\Name|string|null $trait Trait name * @param Node\Identifier|string $method Method name * - * @return Builder\TraitUseAdaptation The create trait use adaptation builder + * @return Builder\TraitUseAdaptation The created trait use adaptation builder */ public function traitUseAdaptation($trait, $method = null) : \PhpParser\Builder\TraitUseAdaptation { @@ -186,7 +184,7 @@ class BuilderFactory /** * Creates a class constant builder. * - * @param string|Identifier $name Name + * @param string|Identifier $name Name * @param Node\Expr|bool|null|int|float|string|array $value Value * * @return Builder\ClassConst The created use const builder @@ -198,7 +196,7 @@ class BuilderFactory /** * Creates an enum case builder. * - * @param string|Identifier $name Name + * @param string|Identifier $name Name * * @return Builder\EnumCase The created use const builder */ @@ -210,8 +208,6 @@ class BuilderFactory * Creates node a for a literal value. * * @param Expr|bool|null|int|float|string|array|\UnitEnum $value $value - * - * @return Expr */ public function val($value) : Expr { @@ -221,8 +217,6 @@ class BuilderFactory * Creates variable node. * * @param string|Expr $name Name - * - * @return Expr\Variable */ public function var($name) : Expr\Variable { @@ -238,7 +232,7 @@ class BuilderFactory * * @param array $args List of arguments to normalize * - * @return Arg[] + * @return list */ public function args(array $args) : array { @@ -258,9 +252,7 @@ class BuilderFactory * Creates a function call node. * * @param string|Name|Expr $name Function name - * @param array $args Function arguments - * - * @return Expr\FuncCall + * @param array $args Function arguments */ public function funcCall($name, array $args = []) : Expr\FuncCall { @@ -269,11 +261,9 @@ class BuilderFactory /** * Creates a method call node. * - * @param Expr $var Variable the method is called on + * @param Expr $var Variable the method is called on * @param string|Identifier|Expr $name Method name - * @param array $args Method arguments - * - * @return Expr\MethodCall + * @param array $args Method arguments */ public function methodCall(Expr $var, $name, array $args = []) : Expr\MethodCall { @@ -282,11 +272,9 @@ class BuilderFactory /** * Creates a static method call node. * - * @param string|Name|Expr $class Class name - * @param string|Identifier|Expr $name Method name - * @param array $args Method arguments - * - * @return Expr\StaticCall + * @param string|Name|Expr $class Class name + * @param string|Identifier|Expr $name Method name + * @param array $args Method arguments */ public function staticCall($class, $name, array $args = []) : Expr\StaticCall { @@ -296,9 +284,7 @@ class BuilderFactory * Creates an object creation node. * * @param string|Name|Expr $class Class name - * @param array $args Constructor arguments - * - * @return Expr\New_ + * @param array $args Constructor arguments */ public function new($class, array $args = []) : Expr\New_ { @@ -308,8 +294,6 @@ class BuilderFactory * Creates a constant fetch node. * * @param string|Name $name Constant name - * - * @return Expr\ConstFetch */ public function constFetch($name) : Expr\ConstFetch { @@ -318,10 +302,8 @@ class BuilderFactory /** * Creates a property fetch node. * - * @param Expr $var Variable holding object + * @param Expr $var Variable holding object * @param string|Identifier|Expr $name Property name - * - * @return Expr\PropertyFetch */ public function propertyFetch(Expr $var, $name) : Expr\PropertyFetch { @@ -331,9 +313,7 @@ class BuilderFactory * Creates a class constant fetch node. * * @param string|Name|Expr $class Class name - * @param string|Identifier|Expr $name Constant name - * - * @return Expr\ClassConstFetch + * @param string|Identifier|Expr $name Constant name */ public function classConstFetch($class, $name) : Expr\ClassConstFetch { @@ -343,8 +323,6 @@ class BuilderFactory * Creates nested Concat nodes from a list of expressions. * * @param Expr|string ...$exprs Expressions or literal strings - * - * @return Concat */ public function concat(...$exprs) : Concat { @@ -360,7 +338,6 @@ class BuilderFactory } /** * @param string|Expr $expr - * @return Expr */ private function normalizeStringExpr($expr) : Expr { diff --git a/vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php b/vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php index 4671e84b6f8..6ffb989abfc 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php +++ b/vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php @@ -188,10 +188,10 @@ final class BuilderHelpers return new Expr\ConstFetch(new Name($value ? 'true' : 'false')); } if (\is_int($value)) { - return new Scalar\LNumber($value); + return new Scalar\Int_($value); } if (\is_float($value)) { - return new Scalar\DNumber($value); + return new Scalar\Float_($value); } if (\is_string($value)) { return new Scalar\String_($value); @@ -202,10 +202,10 @@ final class BuilderHelpers foreach ($value as $itemKey => $itemValue) { // for consecutive, numeric keys don't generate keys if (null !== $lastKey && ++$lastKey === $itemKey) { - $items[] = new Expr\ArrayItem(self::normalizeValue($itemValue)); + $items[] = new \PhpParser\Node\ArrayItem(self::normalizeValue($itemValue)); } else { $lastKey = null; - $items[] = new Expr\ArrayItem(self::normalizeValue($itemValue), self::normalizeValue($itemKey)); + $items[] = new \PhpParser\Node\ArrayItem(self::normalizeValue($itemValue), self::normalizeValue($itemKey)); } } return new Expr\Array_($items); @@ -253,13 +253,13 @@ final class BuilderHelpers * Adds a modifier and returns new modifier bitmask. * * @param int $modifiers Existing modifiers - * @param int $modifier Modifier to set + * @param int $modifier Modifier to set * * @return int New modifiers */ public static function addModifier(int $modifiers, int $modifier) : int { - Stmt\Class_::verifyModifier($modifiers, $modifier); + \PhpParser\Modifiers::verifyModifier($modifiers, $modifier); return $modifiers | $modifier; } /** @@ -268,7 +268,7 @@ final class BuilderHelpers */ public static function addClassModifier(int $existingModifiers, int $modifierToSet) : int { - Stmt\Class_::verifyClassModifier($existingModifiers, $modifierToSet); + \PhpParser\Modifiers::verifyClassModifier($existingModifiers, $modifierToSet); return $existingModifiers | $modifierToSet; } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Comment.php b/vendor/nikic/php-parser/lib/PhpParser/Comment.php index 8e3aa00ab65..2f5728179c7 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Comment.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Comment.php @@ -5,20 +5,20 @@ namespace PhpParser; class Comment implements \JsonSerializable { - protected $text; - protected $startLine; - protected $startFilePos; - protected $startTokenPos; - protected $endLine; - protected $endFilePos; - protected $endTokenPos; + protected string $text; + protected int $startLine; + protected int $startFilePos; + protected int $startTokenPos; + protected int $endLine; + protected int $endFilePos; + protected int $endTokenPos; /** * Constructs a comment node. * - * @param string $text Comment text (including comment delimiters like /*) - * @param int $startLine Line number the comment started on - * @param int $startFilePos File offset the comment started on - * @param int $startTokenPos Token offset the comment started on + * @param string $text Comment text (including comment delimiters like /*) + * @param int $startLine Line number the comment started on + * @param int $startFilePos File offset the comment started on + * @param int $startTokenPos Token offset the comment started on */ public function __construct(string $text, int $startLine = -1, int $startFilePos = -1, int $startTokenPos = -1, int $endLine = -1, int $endFilePos = -1, int $endTokenPos = -1) { @@ -43,6 +43,7 @@ class Comment implements \JsonSerializable * Gets the line number the comment started on. * * @return int Line number (or -1 if not available) + * @phpstan-return -1|positive-int */ public function getStartLine() : int { @@ -70,6 +71,7 @@ class Comment implements \JsonSerializable * Gets the line number the comment ends on. * * @return int Line number (or -1 if not available) + * @phpstan-return -1|positive-int */ public function getEndLine() : int { @@ -93,39 +95,6 @@ class Comment implements \JsonSerializable { return $this->endTokenPos; } - /** - * Gets the line number the comment started on. - * - * @deprecated Use getStartLine() instead - * - * @return int Line number - */ - public function getLine() : int - { - return $this->startLine; - } - /** - * Gets the file offset the comment started on. - * - * @deprecated Use getStartFilePos() instead - * - * @return int File offset - */ - public function getFilePos() : int - { - return $this->startFilePos; - } - /** - * Gets the token offset the comment started on. - * - * @deprecated Use getStartTokenPos() instead - * - * @return int Token offset - */ - public function getTokenPos() : int - { - return $this->startTokenPos; - } /** * Gets the comment text. * @@ -140,19 +109,20 @@ class Comment implements \JsonSerializable * * "Reformatted" here means that we try to clean up the whitespace at the * starts of the lines. This is necessary because we receive the comments - * without trailing whitespace on the first line, but with trailing whitespace + * without leading whitespace on the first line, but with leading whitespace * on all subsequent lines. * - * @return mixed|string + * Additionally, this normalizes CRLF newlines to LF newlines. */ - public function getReformattedText() + public function getReformattedText() : string { - $text = \trim($this->text); + $text = \str_replace("\r\n", "\n", $this->text); $newlinePos = \strpos($text, "\n"); if (\false === $newlinePos) { // Single line comments don't need further processing return $text; - } elseif (\preg_match('((*BSR_ANYCRLF)(*ANYCRLF)^.*(?:\\R\\s+\\*.*)+$)', $text)) { + } + if (\preg_match('(^.*(?:\\n\\s+\\*.*)+$)', $text)) { // Multi line comment of the type // // /* @@ -161,8 +131,9 @@ class Comment implements \JsonSerializable // */ // // is handled by replacing the whitespace sequences before the * by a single space - return \preg_replace('(^\\s+\\*)m', ' *', $this->text); - } elseif (\preg_match('(^/\\*\\*?\\s*[\\r\\n])', $text) && \preg_match('(\\n(\\s*)\\*/$)', $text, $matches)) { + return \preg_replace('(^\\s+\\*)m', ' *', $text); + } + if (\preg_match('(^/\\*\\*?\\s*\\n)', $text) && \preg_match('(\\n(\\s*)\\*/$)', $text, $matches)) { // Multi line comment of the type // // /* @@ -174,7 +145,8 @@ class Comment implements \JsonSerializable // */ on all lines. So if the last line is " */", then " " is removed at the // start of all lines. return \preg_replace('(^' . \preg_quote($matches[1]) . ')m', '', $text); - } elseif (\preg_match('(^/\\*\\*?\\s*(?!\\s))', $text, $matches)) { + } + if (\preg_match('(^/\\*\\*?\\s*(?!\\s))', $text, $matches)) { // Multi line comment of the type // // /* Some text. @@ -202,7 +174,7 @@ class Comment implements \JsonSerializable private function getShortestWhitespacePrefixLen(string $str) : int { $lines = \explode("\n", $str); - $shortestPrefixLen = \INF; + $shortestPrefixLen = \PHP_INT_MAX; foreach ($lines as $line) { \preg_match('(^\\s*)', $line, $matches); $prefixLen = \strlen($matches[0]); @@ -213,8 +185,7 @@ class Comment implements \JsonSerializable return $shortestPrefixLen; } /** - * @return array - * @psalm-return array{nodeType:string, text:mixed, line:mixed, filePos:mixed} + * @return array{nodeType:string, text:mixed, line:mixed, filePos:mixed} */ public function jsonSerialize() : array { diff --git a/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php b/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php index e5af08c36a1..4194c740a42 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php +++ b/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php @@ -1,5 +1,6 @@ evaluate($expr); } + /** @return mixed */ private function evaluate(Expr $expr) { - if ($expr instanceof Scalar\LNumber || $expr instanceof Scalar\DNumber || $expr instanceof Scalar\String_) { + if ($expr instanceof Scalar\Int_ || $expr instanceof Scalar\Float_ || $expr instanceof Scalar\String_) { return $expr->value; } if ($expr instanceof Expr\Array_) { @@ -130,7 +133,7 @@ class ConstExprEvaluator } return ($this->fallbackEvaluator)($expr); } - private function evaluateArray(Expr\Array_ $expr) + private function evaluateArray(Expr\Array_ $expr) : array { $array = []; foreach ($expr->items as $item) { @@ -144,6 +147,7 @@ class ConstExprEvaluator } return $array; } + /** @return mixed */ private function evaluateTernary(Expr\Ternary $expr) { if (null === $expr->if) { @@ -151,6 +155,7 @@ class ConstExprEvaluator } return $this->evaluate($expr->cond) ? $this->evaluate($expr->if) : $this->evaluate($expr->else); } + /** @return mixed */ private function evaluateBinaryOp(Expr\BinaryOp $expr) { if ($expr instanceof Expr\BinaryOp\Coalesce && $expr->left instanceof Expr\ArrayDimFetch) { @@ -219,6 +224,7 @@ class ConstExprEvaluator } throw new \Exception('Should not happen'); } + /** @return mixed */ private function evaluateConstFetch(Expr\ConstFetch $expr) { $name = $expr->name->toLowerString(); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Error.php b/vendor/nikic/php-parser/lib/PhpParser/Error.php index 421892b801a..70bc5da3a79 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Error.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Error.php @@ -5,23 +5,19 @@ namespace PhpParser; class Error extends \RuntimeException { - protected $rawMessage; - protected $attributes; + protected string $rawMessage; + /** @var array */ + protected array $attributes; /** * Creates an Exception signifying a parse error. * - * @param string $message Error message - * @param array|int $attributes Attributes of node/token where error occurred - * (or start line of error -- deprecated) + * @param string $message Error message + * @param array $attributes Attributes of node/token where error occurred */ - public function __construct(string $message, $attributes = []) + public function __construct(string $message, array $attributes = []) { $this->rawMessage = $message; - if (\is_array($attributes)) { - $this->attributes = $attributes; - } else { - $this->attributes = ['startLine' => $attributes]; - } + $this->attributes = $attributes; $this->updateMessage(); } /** @@ -37,6 +33,7 @@ class Error extends \RuntimeException * Gets the line the error starts in. * * @return int Error start line + * @phpstan-return -1|positive-int */ public function getStartLine() : int { @@ -46,6 +43,7 @@ class Error extends \RuntimeException * Gets the line the error ends in. * * @return int Error end line + * @phpstan-return -1|positive-int */ public function getEndLine() : int { @@ -54,7 +52,7 @@ class Error extends \RuntimeException /** * Gets the attributes of the node/token the error occurred at. * - * @return array + * @return array */ public function getAttributes() : array { @@ -63,9 +61,9 @@ class Error extends \RuntimeException /** * Sets the attributes of the node/token the error occurred at. * - * @param array $attributes + * @param array $attributes */ - public function setAttributes(array $attributes) + public function setAttributes(array $attributes) : void { $this->attributes = $attributes; $this->updateMessage(); @@ -75,7 +73,7 @@ class Error extends \RuntimeException * * @param string $message Error message */ - public function setRawMessage(string $message) + public function setRawMessage(string $message) : void { $this->rawMessage = $message; $this->updateMessage(); @@ -85,7 +83,7 @@ class Error extends \RuntimeException * * @param int $line Error start line */ - public function setStartLine(int $line) + public function setStartLine(int $line) : void { $this->attributes['startLine'] = $line; $this->updateMessage(); @@ -94,8 +92,6 @@ class Error extends \RuntimeException * Returns whether the error has start and end column information. * * For column information enable the startFilePos and endFilePos in the lexer options. - * - * @return bool */ public function hasColumnInfo() : bool { @@ -105,7 +101,6 @@ class Error extends \RuntimeException * Gets the start column (1-based) into the line where the error started. * * @param string $code Source code of the file - * @return int */ public function getStartColumn(string $code) : int { @@ -118,7 +113,6 @@ class Error extends \RuntimeException * Gets the end column (1-based) into the line where the error ended. * * @param string $code Source code of the file - * @return int */ public function getEndColumn(string $code) : int { @@ -142,7 +136,7 @@ class Error extends \RuntimeException * Converts a file offset into a column. * * @param string $code Source code that $pos indexes into - * @param int $pos 0-based position in $code + * @param int $pos 0-based position in $code * * @return int 1-based column (relative to start of line) */ @@ -160,7 +154,7 @@ class Error extends \RuntimeException /** * Updates the exception message after a change to rawMessage or rawLine. */ - protected function updateMessage() + protected function updateMessage() : void { $this->message = $this->rawMessage; if (-1 === $this->getStartLine()) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler.php b/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler.php index b561f352797..ad5951ce491 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler.php +++ b/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler.php @@ -10,5 +10,5 @@ interface ErrorHandler * * @param Error $error The error that needs to be handled */ - public function handleError(\PhpParser\Error $error); + public function handleError(\PhpParser\Error $error) : void; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php b/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php index 536fc0bf5d0..6e832da3272 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php +++ b/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php @@ -13,8 +13,8 @@ use PhpParser\ErrorHandler; class Collecting implements ErrorHandler { /** @var Error[] Collected errors */ - private $errors = []; - public function handleError(Error $error) + private array $errors = []; + public function handleError(Error $error) : void { $this->errors[] = $error; } @@ -29,8 +29,6 @@ class Collecting implements ErrorHandler } /** * Check whether there are any errors. - * - * @return bool */ public function hasErrors() : bool { @@ -39,7 +37,7 @@ class Collecting implements ErrorHandler /** * Reset/clear collected errors. */ - public function clearErrors() + public function clearErrors() : void { $this->errors = []; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php b/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php index 7308184f715..c2dd3b7c79e 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php +++ b/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php @@ -12,7 +12,7 @@ use PhpParser\ErrorHandler; */ class Throwing implements ErrorHandler { - public function handleError(Error $error) + public function handleError(Error $error) : void { throw $error; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php b/vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php index d020940ddc4..1ca00a0697a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php @@ -8,16 +8,21 @@ namespace PhpParser\Internal; */ class DiffElem { - const TYPE_KEEP = 0; - const TYPE_REMOVE = 1; - const TYPE_ADD = 2; - const TYPE_REPLACE = 3; + public const TYPE_KEEP = 0; + public const TYPE_REMOVE = 1; + public const TYPE_ADD = 2; + public const TYPE_REPLACE = 3; /** @var int One of the TYPE_* constants */ - public $type; + public int $type; /** @var mixed Is null for add operations */ public $old; /** @var mixed Is null for remove operations */ public $new; + /** + * @param int $type One of the TYPE_* constants + * @param mixed $old Is null for add operations + * @param mixed $new Is null for remove operations + */ public function __construct(int $type, $old, $new) { $this->type = $type; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php b/vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php index 893ec6f048e..37ee89fb8ff 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php @@ -9,15 +9,17 @@ namespace PhpParser\Internal; * Myers, Eugene W. "An O (ND) difference algorithm and its variations." * Algorithmica 1.1 (1986): 251-266. * + * @template T * @internal */ class Differ { + /** @var callable(T, T): bool */ private $isEqual; /** * Create differ over the given equality relation. * - * @param callable $isEqual Equality relation with signature function($a, $b) : bool + * @param callable(T, T): bool $isEqual Equality relation */ public function __construct(callable $isEqual) { @@ -26,13 +28,15 @@ class Differ /** * Calculate diff (edit script) from $old to $new. * - * @param array $old Original array - * @param array $new New array + * @param T[] $old Original array + * @param T[] $new New array * * @return DiffElem[] Diff (edit script) */ - public function diff(array $old, array $new) + public function diff(array $old, array $new) : array { + $old = \array_values($old); + $new = \array_values($new); list($trace, $x, $y) = $this->calculateTrace($old, $new); return $this->extractDiff($trace, $x, $y, $old, $new); } @@ -42,19 +46,24 @@ class Differ * If a sequence of remove operations is followed by the same number of add operations, these * will be coalesced into replace operations. * - * @param array $old Original array - * @param array $new New array + * @param T[] $old Original array + * @param T[] $new New array * * @return DiffElem[] Diff (edit script), including replace operations */ - public function diffWithReplacements(array $old, array $new) + public function diffWithReplacements(array $old, array $new) : array { return $this->coalesceReplacements($this->diff($old, $new)); } - private function calculateTrace(array $a, array $b) + /** + * @param T[] $old + * @param T[] $new + * @return array{array>, int, int} + */ + private function calculateTrace(array $old, array $new) : array { - $n = \count($a); - $m = \count($b); + $n = \count($old); + $m = \count($new); $max = $n + $m; $v = [1 => 0]; $trace = []; @@ -67,7 +76,7 @@ class Differ $x = $v[$k - 1] + 1; } $y = $x - $k; - while ($x < $n && $y < $m && ($this->isEqual)($a[$x], $b[$y])) { + while ($x < $n && $y < $m && ($this->isEqual)($old[$x], $new[$y])) { $x++; $y++; } @@ -79,7 +88,13 @@ class Differ } throw new \Exception('Should not happen'); } - private function extractDiff(array $trace, int $x, int $y, array $a, array $b) + /** + * @param array> $trace + * @param T[] $old + * @param T[] $new + * @return DiffElem[] + */ + private function extractDiff(array $trace, int $x, int $y, array $old, array $new) : array { $result = []; for ($d = \count($trace) - 1; $d >= 0; $d--) { @@ -93,7 +108,7 @@ class Differ $prevX = $v[$prevK]; $prevY = $prevX - $prevK; while ($x > $prevX && $y > $prevY) { - $result[] = new \PhpParser\Internal\DiffElem(\PhpParser\Internal\DiffElem::TYPE_KEEP, $a[$x - 1], $b[$y - 1]); + $result[] = new \PhpParser\Internal\DiffElem(\PhpParser\Internal\DiffElem::TYPE_KEEP, $old[$x - 1], $new[$y - 1]); $x--; $y--; } @@ -101,11 +116,11 @@ class Differ break; } while ($x > $prevX) { - $result[] = new \PhpParser\Internal\DiffElem(\PhpParser\Internal\DiffElem::TYPE_REMOVE, $a[$x - 1], null); + $result[] = new \PhpParser\Internal\DiffElem(\PhpParser\Internal\DiffElem::TYPE_REMOVE, $old[$x - 1], null); $x--; } while ($y > $prevY) { - $result[] = new \PhpParser\Internal\DiffElem(\PhpParser\Internal\DiffElem::TYPE_ADD, null, $b[$y - 1]); + $result[] = new \PhpParser\Internal\DiffElem(\PhpParser\Internal\DiffElem::TYPE_ADD, null, $new[$y - 1]); $y--; } } @@ -117,7 +132,7 @@ class Differ * @param DiffElem[] $diff * @return DiffElem[] */ - private function coalesceReplacements(array $diff) + private function coalesceReplacements(array $diff) : array { $newDiff = []; $c = \count($diff); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php b/vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php index f01ca2e2e20..1a4bd7fa2a1 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php @@ -18,17 +18,25 @@ use PhpParser\Node\Expr; class PrintableNewAnonClassNode extends Expr { /** @var Node\AttributeGroup[] PHP attribute groups */ - public $attrGroups; + public array $attrGroups; /** @var int Modifiers */ - public $flags; - /** @var Node\Arg[] Arguments */ - public $args; + public int $flags; + /** @var (Node\Arg|Node\VariadicPlaceholder)[] Arguments */ + public array $args; /** @var null|Node\Name Name of extended class */ - public $extends; + public ?Node\Name $extends; /** @var Node\Name[] Names of implemented interfaces */ - public $implements; + public array $implements; /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; + /** + * @param Node\AttributeGroup[] $attrGroups PHP attribute groups + * @param (Node\Arg|Node\VariadicPlaceholder)[] $args Arguments + * @param Node\Name|null $extends Name of extended class + * @param Node\Name[] $implements Names of implemented interfaces + * @param Node\Stmt[] $stmts Statements + * @param array $attributes Attributes + */ public function __construct(array $attrGroups, int $flags, array $args, ?Node\Name $extends, array $implements, array $stmts, array $attributes) { parent::__construct($attributes); @@ -39,7 +47,7 @@ class PrintableNewAnonClassNode extends Expr $this->implements = $implements; $this->stmts = $stmts; } - public static function fromNewNode(Expr\New_ $newNode) + public static function fromNewNode(Expr\New_ $newNode) : self { $class = $newNode->class; \assert($class instanceof Node\Stmt\Class_); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php b/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php new file mode 100644 index 00000000000..f694a00060b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php @@ -0,0 +1,208 @@ += 80000) { + class TokenPolyfill extends \PhpToken + { + } + return; +} +/** + * This is a polyfill for the PhpToken class introduced in PHP 8.0. We do not actually polyfill + * PhpToken, because composer might end up picking a different polyfill implementation, which does + * not meet our requirements. + * + * @internal + */ +class TokenPolyfill +{ + /** @var int The ID of the token. Either a T_* constant of a character code < 256. */ + public int $id; + /** @var string The textual content of the token. */ + public string $text; + /** @var int The 1-based starting line of the token (or -1 if unknown). */ + public int $line; + /** @var int The 0-based starting position of the token (or -1 if unknown). */ + public int $pos; + /** @var array Tokens ignored by the PHP parser. */ + private const IGNORABLE_TOKENS = [\T_WHITESPACE => \true, \T_COMMENT => \true, \T_DOC_COMMENT => \true, \T_OPEN_TAG => \true]; + /** @var array Tokens that may be part of a T_NAME_* identifier. */ + private static array $identifierTokens; + /** + * Create a Token with the given ID and text, as well optional line and position information. + */ + public final function __construct(int $id, string $text, int $line = -1, int $pos = -1) + { + $this->id = $id; + $this->text = $text; + $this->line = $line; + $this->pos = $pos; + } + /** + * Get the name of the token. For single-char tokens this will be the token character. + * Otherwise it will be a T_* style name, or null if the token ID is unknown. + */ + public function getTokenName() : ?string + { + if ($this->id < 256) { + return \chr($this->id); + } + $name = \token_name($this->id); + return $name === 'UNKNOWN' ? null : $name; + } + /** + * Check whether the token is of the given kind. The kind may be either an integer that matches + * the token ID, a string that matches the token text, or an array of integers/strings. In the + * latter case, the function returns true if any of the kinds in the array match. + * + * @param int|string|(int|string)[] $kind + */ + public function is($kind) : bool + { + if (\is_int($kind)) { + return $this->id === $kind; + } + if (\is_string($kind)) { + return $this->text === $kind; + } + if (\is_array($kind)) { + foreach ($kind as $entry) { + if (\is_int($entry)) { + if ($this->id === $entry) { + return \true; + } + } elseif (\is_string($entry)) { + if ($this->text === $entry) { + return \true; + } + } else { + throw new \TypeError('Argument #1 ($kind) must only have elements of type string|int, ' . \gettype($entry) . ' given'); + } + } + return \false; + } + throw new \TypeError('Argument #1 ($kind) must be of type string|int|array, ' . \gettype($kind) . ' given'); + } + /** + * Check whether this token would be ignored by the PHP parser. Returns true for T_WHITESPACE, + * T_COMMENT, T_DOC_COMMENT and T_OPEN_TAG, and false for everything else. + */ + public function isIgnorable() : bool + { + return isset(self::IGNORABLE_TOKENS[$this->id]); + } + /** + * Return the textual content of the token. + */ + public function __toString() : string + { + return $this->text; + } + /** + * Tokenize the given source code and return an array of tokens. + * + * This performs certain canonicalizations to match the PHP 8.0 token format: + * * Bad characters are represented using T_BAD_CHARACTER rather than omitted. + * * T_COMMENT does not include trailing newlines, instead the newline is part of a following + * T_WHITESPACE token. + * * Namespaced names are represented using T_NAME_* tokens. + * + * @return static[] + */ + public static function tokenize(string $code, int $flags = 0) : array + { + self::init(); + $tokens = []; + $line = 1; + $pos = 0; + $origTokens = \token_get_all($code, $flags); + $numTokens = \count($origTokens); + for ($i = 0; $i < $numTokens; $i++) { + $token = $origTokens[$i]; + if (\is_string($token)) { + if (\strlen($token) === 2) { + // b" and B" are tokenized as single-char tokens, even though they aren't. + $tokens[] = new static(\ord('"'), $token, $line, $pos); + $pos += 2; + } else { + $tokens[] = new static(\ord($token), $token, $line, $pos); + $pos++; + } + } else { + $id = $token[0]; + $text = $token[1]; + // Emulate PHP 8.0 comment format, which does not include trailing whitespace anymore. + if ($id === \T_COMMENT && \substr($text, 0, 2) !== '/*' && \preg_match('/(\\r\\n|\\n|\\r)$/D', $text, $matches)) { + $trailingNewline = $matches[0]; + $text = \substr($text, 0, -\strlen($trailingNewline)); + $tokens[] = new static($id, $text, $line, $pos); + $pos += \strlen($text); + if ($i + 1 < $numTokens && $origTokens[$i + 1][0] === \T_WHITESPACE) { + // Move trailing newline into following T_WHITESPACE token, if it already exists. + $origTokens[$i + 1][1] = $trailingNewline . $origTokens[$i + 1][1]; + $origTokens[$i + 1][2]--; + } else { + // Otherwise, we need to create a new T_WHITESPACE token. + $tokens[] = new static(\T_WHITESPACE, $trailingNewline, $line, $pos); + $line++; + $pos += \strlen($trailingNewline); + } + continue; + } + // Emulate PHP 8.0 T_NAME_* tokens, by combining sequences of T_NS_SEPARATOR and + // T_STRING into a single token. + if ($id === \T_NS_SEPARATOR || isset(self::$identifierTokens[$id])) { + $newText = $text; + $lastWasSeparator = $id === \T_NS_SEPARATOR; + for ($j = $i + 1; $j < $numTokens; $j++) { + if ($lastWasSeparator) { + if (!isset(self::$identifierTokens[$origTokens[$j][0]])) { + break; + } + $lastWasSeparator = \false; + } else { + if ($origTokens[$j][0] !== \T_NS_SEPARATOR) { + break; + } + $lastWasSeparator = \true; + } + $newText .= $origTokens[$j][1]; + } + if ($lastWasSeparator) { + // Trailing separator is not part of the name. + $j--; + $newText = \substr($newText, 0, -1); + } + if ($j > $i + 1) { + if ($id === \T_NS_SEPARATOR) { + $id = \T_NAME_FULLY_QUALIFIED; + } elseif ($id === \T_NAMESPACE) { + $id = \T_NAME_RELATIVE; + } else { + $id = \T_NAME_QUALIFIED; + } + $tokens[] = new static($id, $newText, $line, $pos); + $pos += \strlen($newText); + $i = $j - 1; + continue; + } + } + $tokens[] = new static($id, $text, $line, $pos); + $line += \substr_count($text, "\n"); + $pos += \strlen($text); + } + } + return $tokens; + } + /** Initialize private static state needed by tokenize(). */ + private static function init() : void + { + if (isset(self::$identifierTokens)) { + return; + } + // Based on semi_reserved production. + self::$identifierTokens = \array_fill_keys([\T_STRING, \T_STATIC, \T_ABSTRACT, \T_FINAL, \T_PRIVATE, \T_PROTECTED, \T_PUBLIC, \T_READONLY, \T_INCLUDE, \T_INCLUDE_ONCE, \T_EVAL, \T_REQUIRE, \T_REQUIRE_ONCE, \T_LOGICAL_OR, \T_LOGICAL_XOR, \T_LOGICAL_AND, \T_INSTANCEOF, \T_NEW, \T_CLONE, \T_EXIT, \T_IF, \T_ELSEIF, \T_ELSE, \T_ENDIF, \T_ECHO, \T_DO, \T_WHILE, \T_ENDWHILE, \T_FOR, \T_ENDFOR, \T_FOREACH, \T_ENDFOREACH, \T_DECLARE, \T_ENDDECLARE, \T_AS, \T_TRY, \T_CATCH, \T_FINALLY, \T_THROW, \T_USE, \T_INSTEADOF, \T_GLOBAL, \T_VAR, \T_UNSET, \T_ISSET, \T_EMPTY, \T_CONTINUE, \T_GOTO, \T_FUNCTION, \T_CONST, \T_RETURN, \T_PRINT, \T_YIELD, \T_LIST, \T_SWITCH, \T_ENDSWITCH, \T_CASE, \T_DEFAULT, \T_BREAK, \T_ARRAY, \T_CALLABLE, \T_EXTENDS, \T_IMPLEMENTS, \T_NAMESPACE, \T_TRAIT, \T_INTERFACE, \T_CLASS, \T_CLASS_C, \T_TRAIT_C, \T_FUNC_C, \T_METHOD_C, \T_LINE, \T_FILE, \T_DIR, \T_NS_C, \T_HALT_COMPILER, \T_FN, \T_MATCH], \true); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php b/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php index b95496d5149..899e4a14e3e 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace PhpParser\Internal; +use PhpParser\Token; /** * Provides operations on token streams, for use by pretty printer. * @@ -10,27 +11,25 @@ namespace PhpParser\Internal; */ class TokenStream { - /** @var array Tokens (in token_get_all format) */ - private $tokens; + /** @var Token[] Tokens (in PhpToken::tokenize() format) */ + private array $tokens; /** @var int[] Map from position to indentation */ - private $indentMap; + private array $indentMap; /** * Create token stream instance. * - * @param array $tokens Tokens in token_get_all() format + * @param Token[] $tokens Tokens in PhpToken::tokenize() format */ - public function __construct(array $tokens) + public function __construct(array $tokens, int $tabWidth) { $this->tokens = $tokens; - $this->indentMap = $this->calcIndentMap(); + $this->indentMap = $this->calcIndentMap($tabWidth); } /** * Whether the given position is immediately surrounded by parenthesis. * * @param int $startPos Start position - * @param int $endPos End position - * - * @return bool + * @param int $endPos End position */ public function haveParens(int $startPos, int $endPos) : bool { @@ -40,9 +39,7 @@ class TokenStream * Whether the given position is immediately surrounded by braces. * * @param int $startPos Start position - * @param int $endPos End position - * - * @return bool + * @param int $endPos End position */ public function haveBraces(int $startPos, int $endPos) : bool { @@ -53,7 +50,7 @@ class TokenStream * * During this check whitespace and comments are skipped. * - * @param int $pos Position before which the token should occur + * @param int $pos Position before which the token should occur * @param int|string $expectedTokenType Token to check for * * @return bool Whether the expected token was found @@ -63,11 +60,11 @@ class TokenStream $tokens = $this->tokens; $pos--; for (; $pos >= 0; $pos--) { - $tokenType = $tokens[$pos][0]; - if ($tokenType === $expectedTokenType) { + $token = $tokens[$pos]; + if ($token->is($expectedTokenType)) { return \true; } - if ($tokenType !== \T_WHITESPACE && $tokenType !== \T_COMMENT && $tokenType !== \T_DOC_COMMENT) { + if (!$token->isIgnorable()) { break; } } @@ -78,7 +75,7 @@ class TokenStream * * During this check whitespace and comments are skipped. * - * @param int $pos Position after which the token should occur + * @param int $pos Position after which the token should occur * @param int|string $expectedTokenType Token to check for * * @return bool Whether the expected token was found @@ -87,39 +84,41 @@ class TokenStream { $tokens = $this->tokens; $pos++; - for (; $pos < \count($tokens); $pos++) { - $tokenType = $tokens[$pos][0]; - if ($tokenType === $expectedTokenType) { + for ($c = \count($tokens); $pos < $c; $pos++) { + $token = $tokens[$pos]; + if ($token->is($expectedTokenType)) { return \true; } - if ($tokenType !== \T_WHITESPACE && $tokenType !== \T_COMMENT && $tokenType !== \T_DOC_COMMENT) { + if (!$token->isIgnorable()) { break; } } return \false; } - public function skipLeft(int $pos, $skipTokenType) + /** @param int|string|(int|string)[] $skipTokenType */ + public function skipLeft(int $pos, $skipTokenType) : int { $tokens = $this->tokens; $pos = $this->skipLeftWhitespace($pos); if ($skipTokenType === \T_WHITESPACE) { return $pos; } - if ($tokens[$pos][0] !== $skipTokenType) { + if (!$tokens[$pos]->is($skipTokenType)) { // Shouldn't happen. The skip token MUST be there throw new \Exception('Encountered unexpected token'); } $pos--; return $this->skipLeftWhitespace($pos); } - public function skipRight(int $pos, $skipTokenType) + /** @param int|string|(int|string)[] $skipTokenType */ + public function skipRight(int $pos, $skipTokenType) : int { $tokens = $this->tokens; $pos = $this->skipRightWhitespace($pos); if ($skipTokenType === \T_WHITESPACE) { return $pos; } - if ($tokens[$pos][0] !== $skipTokenType) { + if (!$tokens[$pos]->is($skipTokenType)) { // Shouldn't happen. The skip token MUST be there throw new \Exception('Encountered unexpected token'); } @@ -132,12 +131,11 @@ class TokenStream * @param int $pos Token position * @return int Non-whitespace token position */ - public function skipLeftWhitespace(int $pos) + public function skipLeftWhitespace(int $pos) : int { $tokens = $this->tokens; for (; $pos >= 0; $pos--) { - $type = $tokens[$pos][0]; - if ($type !== \T_WHITESPACE && $type !== \T_COMMENT && $type !== \T_DOC_COMMENT) { + if (!$tokens[$pos]->isIgnorable()) { break; } } @@ -149,23 +147,22 @@ class TokenStream * @param int $pos Token position * @return int Non-whitespace token position */ - public function skipRightWhitespace(int $pos) + public function skipRightWhitespace(int $pos) : int { $tokens = $this->tokens; for ($count = \count($tokens); $pos < $count; $pos++) { - $type = $tokens[$pos][0]; - if ($type !== \T_WHITESPACE && $type !== \T_COMMENT && $type !== \T_DOC_COMMENT) { + if (!$tokens[$pos]->isIgnorable()) { break; } } return $pos; } - public function findRight(int $pos, $findTokenType) + /** @param int|string|(int|string)[] $findTokenType */ + public function findRight(int $pos, $findTokenType) : int { $tokens = $this->tokens; for ($count = \count($tokens); $pos < $count; $pos++) { - $type = $tokens[$pos][0]; - if ($type === $findTokenType) { + if ($tokens[$pos]->is($findTokenType)) { return $pos; } } @@ -179,20 +176,16 @@ class TokenStream * @param int|string $tokenType Token type to look for * @return bool Whether the token occurs in the given range */ - public function haveTokenInRange(int $startPos, int $endPos, $tokenType) + public function haveTokenInRange(int $startPos, int $endPos, $tokenType) : bool { $tokens = $this->tokens; for ($pos = $startPos; $pos < $endPos; $pos++) { - if ($tokens[$pos][0] === $tokenType) { + if ($tokens[$pos]->is($tokenType)) { return \true; } } return \false; } - public function haveBracesInRange(int $startPos, int $endPos) - { - return $this->haveTokenInRange($startPos, $endPos, '{') || $this->haveTokenInRange($startPos, $endPos, \T_CURLY_OPEN) || $this->haveTokenInRange($startPos, $endPos, '}'); - } public function haveTagInRange(int $startPos, int $endPos) : bool { return $this->haveTokenInRange($startPos, $endPos, \T_OPEN_TAG) || $this->haveTokenInRange($startPos, $endPos, \T_CLOSE_TAG); @@ -211,8 +204,8 @@ class TokenStream /** * Get the code corresponding to a token offset range, optionally adjusted for indentation. * - * @param int $from Token start position (inclusive) - * @param int $to Token end position (exclusive) + * @param int $from Token start position (inclusive) + * @param int $to Token end position (exclusive) * @param int $indent By how much the code should be indented (can be negative as well) * * @return string Code corresponding to token range, adjusted for indentation @@ -223,23 +216,19 @@ class TokenStream $result = ''; for ($pos = $from; $pos < $to; $pos++) { $token = $tokens[$pos]; - if (\is_array($token)) { - $type = $token[0]; - $content = $token[1]; - if ($type === \T_CONSTANT_ENCAPSED_STRING || $type === \T_ENCAPSED_AND_WHITESPACE) { - $result .= $content; - } else { - // TODO Handle non-space indentation - if ($indent < 0) { - $result .= \str_replace("\n" . \str_repeat(" ", -$indent), "\n", $content); - } elseif ($indent > 0) { - $result .= \str_replace("\n", "\n" . \str_repeat(" ", $indent), $content); - } else { - $result .= $content; - } - } + $id = \is_array($token) ? $token[0] : $token; + $text = \is_array($token) ? $token[1] : $token; + if ($id === \T_CONSTANT_ENCAPSED_STRING || $id === \T_ENCAPSED_AND_WHITESPACE) { + $result .= $text; } else { - $result .= $token; + // TODO Handle non-space indentation + if ($indent < 0) { + $result .= \str_replace("\n" . \str_repeat(" ", -$indent), "\n", $text); + } elseif ($indent > 0) { + $result .= \str_replace("\n", "\n" . \str_repeat(" ", $indent), $text); + } else { + $result .= $text; + } } } return $result; @@ -249,17 +238,20 @@ class TokenStream * * @return int[] Token position to indentation map */ - private function calcIndentMap() + private function calcIndentMap(int $tabWidth) : array { $indentMap = []; $indent = 0; - foreach ($this->tokens as $token) { + foreach ($this->tokens as $i => $token) { $indentMap[] = $indent; - if ($token[0] === \T_WHITESPACE) { - $content = $token[1]; + if ((\is_array($token) ? $token[0] : $token) === \T_WHITESPACE) { + $content = \is_array($token) ? $token[1] : $token; $newlinePos = \strrpos($content, "\n"); if (\false !== $newlinePos) { - $indent = \strlen($content) - $newlinePos - 1; + $indent = $this->getIndent(\substr($content, $newlinePos + 1), $tabWidth); + } elseif ($i === 1 && (\is_array($this->tokens[0]) ? $this->tokens[0][0] : $this->tokens[0]) === \T_OPEN_TAG && (\is_array($this->tokens[0]) ? $this->tokens[0][1] : $this->tokens[0])[\strlen(\is_array($this->tokens[0]) ? $this->tokens[0][1] : $this->tokens[0]) - 1] === "\n") { + // Special case: Newline at the end of opening tag followed by whitespace. + $indent = $this->getIndent($content, $tabWidth); } } } @@ -267,4 +259,11 @@ class TokenStream $indentMap[] = $indent; return $indentMap; } + private function getIndent(string $ws, int $tabWidth) : int + { + $spaces = \substr_count($ws, " "); + $tabs = \substr_count($ws, "\t"); + \assert(\strlen($ws) === $spaces + $tabs); + return $spaces + $tabs * $tabWidth; + } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/JsonDecoder.php b/vendor/nikic/php-parser/lib/PhpParser/JsonDecoder.php index e509418b9cf..7bd83120a1b 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/JsonDecoder.php +++ b/vendor/nikic/php-parser/lib/PhpParser/JsonDecoder.php @@ -5,8 +5,9 @@ namespace PhpParser; class JsonDecoder { - /** @var \ReflectionClass[] Node type to reflection class map */ - private $reflectionClassCache; + /** @var \ReflectionClass[] Node type to reflection class map */ + private array $reflectionClassCache; + /** @return mixed */ public function decode(string $json) { $value = \json_decode($json, \true); @@ -15,6 +16,10 @@ class JsonDecoder } return $this->decodeRecursive($value); } + /** + * @param mixed $value + * @return mixed + */ private function decodeRecursive($value) { if (\is_array($value)) { @@ -43,7 +48,6 @@ class JsonDecoder throw new \RuntimeException('Node type must be a string'); } $reflectionClass = $this->reflectionClassFromNodeType($nodeType); - /** @var Node $node */ $node = $reflectionClass->newInstanceWithoutConstructor(); if (isset($value['attributes'])) { if (!\is_array($value['attributes'])) { @@ -67,6 +71,7 @@ class JsonDecoder } return new $className($value['text'], $value['line'] ?? -1, $value['filePos'] ?? -1, $value['tokenPos'] ?? -1, $value['endLine'] ?? -1, $value['endFilePos'] ?? -1, $value['endTokenPos'] ?? -1); } + /** @return \ReflectionClass */ private function reflectionClassFromNodeType(string $nodeType) : \ReflectionClass { if (!isset($this->reflectionClassCache[$nodeType])) { @@ -75,6 +80,7 @@ class JsonDecoder } return $this->reflectionClassCache[$nodeType]; } + /** @return class-string */ private function classNameFromNodeType(string $nodeType) : string { $className = 'PhpParser\\Node\\' . \strtr($nodeType, '_', '\\'); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer.php index da74bed241c..7767ae61a75 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Lexer.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer.php @@ -3,463 +3,89 @@ declare (strict_types=1); namespace PhpParser; -use PhpParser\Parser\Tokens; +require __DIR__ . '/compatibility_tokens.php'; class Lexer { - protected $code; - protected $tokens; - protected $pos; - protected $line; - protected $filePos; - protected $prevCloseTagHasNewline; - protected $tokenMap; - protected $dropTokens; - protected $identifierTokens; - private $attributeStartLineUsed; - private $attributeEndLineUsed; - private $attributeStartTokenPosUsed; - private $attributeEndTokenPosUsed; - private $attributeStartFilePosUsed; - private $attributeEndFilePosUsed; - private $attributeCommentsUsed; /** - * Creates a Lexer. + * Tokenize the provided source code. * - * @param array $options Options array. Currently only the 'usedAttributes' option is supported, - * which is an array of attributes to add to the AST nodes. Possible - * attributes are: 'comments', 'startLine', 'endLine', 'startTokenPos', - * 'endTokenPos', 'startFilePos', 'endFilePos'. The option defaults to the - * first three. For more info see getNextToken() docs. - */ - public function __construct(array $options = []) - { - // Create Map from internal tokens to PhpParser tokens. - $this->defineCompatibilityTokens(); - $this->tokenMap = $this->createTokenMap(); - $this->identifierTokens = $this->createIdentifierTokenMap(); - // map of tokens to drop while lexing (the map is only used for isset lookup, - // that's why the value is simply set to 1; the value is never actually used.) - $this->dropTokens = \array_fill_keys([\T_WHITESPACE, \T_OPEN_TAG, \T_COMMENT, \T_DOC_COMMENT, \T_BAD_CHARACTER], 1); - $defaultAttributes = ['comments', 'startLine', 'endLine']; - $usedAttributes = \array_fill_keys($options['usedAttributes'] ?? $defaultAttributes, \true); - // Create individual boolean properties to make these checks faster. - $this->attributeStartLineUsed = isset($usedAttributes['startLine']); - $this->attributeEndLineUsed = isset($usedAttributes['endLine']); - $this->attributeStartTokenPosUsed = isset($usedAttributes['startTokenPos']); - $this->attributeEndTokenPosUsed = isset($usedAttributes['endTokenPos']); - $this->attributeStartFilePosUsed = isset($usedAttributes['startFilePos']); - $this->attributeEndFilePosUsed = isset($usedAttributes['endFilePos']); - $this->attributeCommentsUsed = isset($usedAttributes['comments']); - } - /** - * Initializes the lexer for lexing the provided source code. + * The token array is in the same format as provided by the PhpToken::tokenize() method in + * PHP 8.0. The tokens are instances of PhpParser\Token, to abstract over a polyfill + * implementation in earlier PHP version. * - * This function does not throw if lexing errors occur. Instead, errors may be retrieved using - * the getErrors() method. + * The token array is terminated by a sentinel token with token ID 0. + * The token array does not discard any tokens (i.e. whitespace and comments are included). + * The token position attributes are against this token array. * - * @param string $code The source code to lex + * @param string $code The source code to tokenize. * @param ErrorHandler|null $errorHandler Error handler to use for lexing errors. Defaults to - * ErrorHandler\Throwing + * ErrorHandler\Throwing. + * @return Token[] Tokens */ - public function startLexing(string $code, ?\PhpParser\ErrorHandler $errorHandler = null) + public function tokenize(string $code, ?\PhpParser\ErrorHandler $errorHandler = null) : array { if (null === $errorHandler) { $errorHandler = new \PhpParser\ErrorHandler\Throwing(); } - $this->code = $code; - // keep the code around for __halt_compiler() handling - $this->pos = -1; - $this->line = 1; - $this->filePos = 0; - // If inline HTML occurs without preceding code, treat it as if it had a leading newline. - // This ensures proper composability, because having a newline is the "safe" assumption. - $this->prevCloseTagHasNewline = \true; $scream = \ini_set('xdebug.scream', '0'); - $this->tokens = @\token_get_all($code); - $this->postprocessTokens($errorHandler); + $tokens = @\token_get_all($code); + $this->postprocessTokens($tokens, $errorHandler); if (\false !== $scream) { \ini_set('xdebug.scream', $scream); } - } - private function handleInvalidCharacterRange($start, $end, $line, \PhpParser\ErrorHandler $errorHandler) - { - $tokens = []; - for ($i = $start; $i < $end; $i++) { - $chr = $this->code[$i]; - if ($chr === "\x00") { - // PHP cuts error message after null byte, so need special case - $errorMsg = 'Unexpected null byte'; - } else { - $errorMsg = \sprintf('Unexpected character "%s" (ASCII %d)', $chr, \ord($chr)); - } - $tokens[] = [\T_BAD_CHARACTER, $chr, $line]; - $errorHandler->handleError(new \PhpParser\Error($errorMsg, ['startLine' => $line, 'endLine' => $line, 'startFilePos' => $i, 'endFilePos' => $i])); - } return $tokens; } - /** - * Check whether comment token is unterminated. - * - * @return bool - */ - private function isUnterminatedComment($token) : bool + private function handleInvalidCharacter(\PhpParser\Token $token, \PhpParser\ErrorHandler $errorHandler) : void { - return ($token[0] === \T_COMMENT || $token[0] === \T_DOC_COMMENT) && \substr($token[1], 0, 2) === '/*' && \substr($token[1], -2) !== '*/'; + $chr = \is_array($token) ? $token[1] : $token; + if ($chr === "\x00") { + // PHP cuts error message after null byte, so need special case + $errorMsg = 'Unexpected null byte'; + } else { + $errorMsg = \sprintf('Unexpected character "%s" (ASCII %d)', $chr, \ord($chr)); + } + $errorHandler->handleError(new \PhpParser\Error($errorMsg, ['startLine' => $token->line, 'endLine' => $token->line, 'startFilePos' => $token->pos, 'endFilePos' => $token->pos])); } - protected function postprocessTokens(\PhpParser\ErrorHandler $errorHandler) + private function isUnterminatedComment(\PhpParser\Token $token) : bool { - // PHP's error handling for token_get_all() is rather bad, so if we want detailed - // error information we need to compute it ourselves. Invalid character errors are - // detected by finding "gaps" in the token array. Unterminated comments are detected - // by checking if a trailing comment has a "*/" at the end. - // - // Additionally, we perform a number of canonicalizations here: - // * Use the PHP 8.0 comment format, which does not include trailing whitespace anymore. - // * Use PHP 8.0 T_NAME_* tokens. + return $token->is([\T_COMMENT, \T_DOC_COMMENT]) && \substr(\is_array($token) ? $token[1] : $token, 0, 2) === '/*' && \substr(\is_array($token) ? $token[1] : $token, -2) !== '*/'; + } + /** + * @param list $tokens + */ + protected function postprocessTokens(array &$tokens, \PhpParser\ErrorHandler $errorHandler) : void + { + // This function reports errors (bad characters and unterminated comments) in the token + // array, and performs certain canonicalizations: // * Use PHP 8.1 T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG and // T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG tokens used to disambiguate intersection types. - $filePos = 0; - $line = 1; - $numTokens = \count($this->tokens); + // * Add a sentinel token with ID 0. + $numTokens = \count($tokens); + if ($numTokens === 0) { + // Empty input edge case: Just add the sentinel token. + $tokens[] = new \PhpParser\Token(0, "\x00", 1, 0); + return; + } for ($i = 0; $i < $numTokens; $i++) { - $token = $this->tokens[$i]; - // Since PHP 7.4 invalid characters are represented by a T_BAD_CHARACTER token. - // In this case we only need to emit an error. - if ($token[0] === \T_BAD_CHARACTER) { - $this->handleInvalidCharacterRange($filePos, $filePos + 1, $line, $errorHandler); + $token = $tokens[$i]; + if ((\is_array($token) ? $token[0] : $token) === \T_BAD_CHARACTER) { + $this->handleInvalidCharacter($token, $errorHandler); } - if ($token[0] === \T_COMMENT && \substr($token[1], 0, 2) !== '/*' && \preg_match('/(\\r\\n|\\n|\\r)$/D', $token[1], $matches)) { - $trailingNewline = $matches[0]; - $token[1] = \substr($token[1], 0, -\strlen($trailingNewline)); - $this->tokens[$i] = $token; - if (isset($this->tokens[$i + 1]) && $this->tokens[$i + 1][0] === \T_WHITESPACE) { - // Move trailing newline into following T_WHITESPACE token, if it already exists. - $this->tokens[$i + 1][1] = $trailingNewline . $this->tokens[$i + 1][1]; - $this->tokens[$i + 1][2]--; - } else { - // Otherwise, we need to create a new T_WHITESPACE token. - \array_splice($this->tokens, $i + 1, 0, [[\T_WHITESPACE, $trailingNewline, $line]]); - $numTokens++; - } - } - // Emulate PHP 8 T_NAME_* tokens, by combining sequences of T_NS_SEPARATOR and T_STRING - // into a single token. - if (\is_array($token) && ($token[0] === \T_NS_SEPARATOR || isset($this->identifierTokens[$token[0]]))) { - $lastWasSeparator = $token[0] === \T_NS_SEPARATOR; - $text = $token[1]; - for ($j = $i + 1; isset($this->tokens[$j]); $j++) { - if ($lastWasSeparator) { - if (!isset($this->identifierTokens[$this->tokens[$j][0]])) { - break; - } - $lastWasSeparator = \false; - } else { - if ($this->tokens[$j][0] !== \T_NS_SEPARATOR) { - break; - } - $lastWasSeparator = \true; - } - $text .= $this->tokens[$j][1]; - } - if ($lastWasSeparator) { - // Trailing separator is not part of the name. - $j--; - $text = \substr($text, 0, -1); - } - if ($j > $i + 1) { - if ($token[0] === \T_NS_SEPARATOR) { - $type = \T_NAME_FULLY_QUALIFIED; - } else { - if ($token[0] === \T_NAMESPACE) { - $type = \T_NAME_RELATIVE; - } else { - $type = \T_NAME_QUALIFIED; - } - } - $token = [$type, $text, $line]; - \array_splice($this->tokens, $i, $j - $i, [$token]); - $numTokens -= $j - $i - 1; - } - } - if ($token === '&') { + if ((\is_array($token) ? $token[0] : $token) === \ord('&')) { $next = $i + 1; - while (isset($this->tokens[$next]) && $this->tokens[$next][0] === \T_WHITESPACE) { + while (isset($tokens[$next]) && (\is_array($tokens[$next]) ? $tokens[$next][0] : $tokens[$next]) === \T_WHITESPACE) { $next++; } - $followedByVarOrVarArg = isset($this->tokens[$next]) && ($this->tokens[$next][0] === \T_VARIABLE || $this->tokens[$next][0] === \T_ELLIPSIS); - $this->tokens[$i] = $token = [$followedByVarOrVarArg ? \T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG : \T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG, '&', $line]; - } - $tokenValue = \is_string($token) ? $token : $token[1]; - $tokenLen = \strlen($tokenValue); - if (\substr($this->code, $filePos, $tokenLen) !== $tokenValue) { - // Something is missing, must be an invalid character - $nextFilePos = \strpos($this->code, $tokenValue, $filePos); - $badCharTokens = $this->handleInvalidCharacterRange($filePos, $nextFilePos, $line, $errorHandler); - $filePos = (int) $nextFilePos; - \array_splice($this->tokens, $i, 0, $badCharTokens); - $numTokens += \count($badCharTokens); - $i += \count($badCharTokens); - } - $filePos += $tokenLen; - $line += \substr_count($tokenValue, "\n"); - } - if ($filePos !== \strlen($this->code)) { - if (\substr($this->code, $filePos, 2) === '/*') { - // Unlike PHP, HHVM will drop unterminated comments entirely - $comment = \substr($this->code, $filePos); - $errorHandler->handleError(new \PhpParser\Error('Unterminated comment', ['startLine' => $line, 'endLine' => $line + \substr_count($comment, "\n"), 'startFilePos' => $filePos, 'endFilePos' => $filePos + \strlen($comment)])); - // Emulate the PHP behavior - $isDocComment = isset($comment[3]) && $comment[3] === '*'; - $this->tokens[] = [$isDocComment ? \T_DOC_COMMENT : \T_COMMENT, $comment, $line]; - } else { - // Invalid characters at the end of the input - $badCharTokens = $this->handleInvalidCharacterRange($filePos, \strlen($this->code), $line, $errorHandler); - $this->tokens = \array_merge($this->tokens, $badCharTokens); - } - return; - } - if (\count($this->tokens) > 0) { - // Check for unterminated comment - $lastToken = $this->tokens[\count($this->tokens) - 1]; - if ($this->isUnterminatedComment($lastToken)) { - $errorHandler->handleError(new \PhpParser\Error('Unterminated comment', ['startLine' => $line - \substr_count($lastToken[1], "\n"), 'endLine' => $line, 'startFilePos' => $filePos - \strlen($lastToken[1]), 'endFilePos' => $filePos])); + $followedByVarOrVarArg = isset($tokens[$next]) && $tokens[$next]->is([\T_VARIABLE, \T_ELLIPSIS]); + \is_array($token) ? $token[0] : ($token = $followedByVarOrVarArg ? \T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG : \T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG); } } - } - /** - * Fetches the next token. - * - * The available attributes are determined by the 'usedAttributes' option, which can - * be specified in the constructor. The following attributes are supported: - * - * * 'comments' => Array of PhpParser\Comment or PhpParser\Comment\Doc instances, - * representing all comments that occurred between the previous - * non-discarded token and the current one. - * * 'startLine' => Line in which the node starts. - * * 'endLine' => Line in which the node ends. - * * 'startTokenPos' => Offset into the token array of the first token in the node. - * * 'endTokenPos' => Offset into the token array of the last token in the node. - * * 'startFilePos' => Offset into the code string of the first character that is part of the node. - * * 'endFilePos' => Offset into the code string of the last character that is part of the node. - * - * @param mixed $value Variable to store token content in - * @param mixed $startAttributes Variable to store start attributes in - * @param mixed $endAttributes Variable to store end attributes in - * - * @return int Token id - */ - public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) : int - { - $startAttributes = []; - $endAttributes = []; - while (1) { - if (isset($this->tokens[++$this->pos])) { - $token = $this->tokens[$this->pos]; - } else { - // EOF token with ID 0 - $token = "\x00"; - } - if ($this->attributeStartLineUsed) { - $startAttributes['startLine'] = $this->line; - } - if ($this->attributeStartTokenPosUsed) { - $startAttributes['startTokenPos'] = $this->pos; - } - if ($this->attributeStartFilePosUsed) { - $startAttributes['startFilePos'] = $this->filePos; - } - if (\is_string($token)) { - $value = $token; - if (isset($token[1])) { - // bug in token_get_all - $this->filePos += 2; - $id = \ord('"'); - } else { - $this->filePos += 1; - $id = \ord($token); - } - } elseif (!isset($this->dropTokens[$token[0]])) { - $value = $token[1]; - $id = $this->tokenMap[$token[0]]; - if (\T_CLOSE_TAG === $token[0]) { - $this->prevCloseTagHasNewline = \false !== \strpos($token[1], "\n") || \false !== \strpos($token[1], "\r"); - } elseif (\T_INLINE_HTML === $token[0]) { - $startAttributes['hasLeadingNewline'] = $this->prevCloseTagHasNewline; - } - $this->line += \substr_count($value, "\n"); - $this->filePos += \strlen($value); - } else { - $origLine = $this->line; - $origFilePos = $this->filePos; - $this->line += \substr_count($token[1], "\n"); - $this->filePos += \strlen($token[1]); - if (\T_COMMENT === $token[0] || \T_DOC_COMMENT === $token[0]) { - if ($this->attributeCommentsUsed) { - $comment = \T_DOC_COMMENT === $token[0] ? new \PhpParser\Comment\Doc($token[1], $origLine, $origFilePos, $this->pos, $this->line, $this->filePos - 1, $this->pos) : new \PhpParser\Comment($token[1], $origLine, $origFilePos, $this->pos, $this->line, $this->filePos - 1, $this->pos); - $startAttributes['comments'][] = $comment; - } - } - continue; - } - if ($this->attributeEndLineUsed) { - $endAttributes['endLine'] = $this->line; - } - if ($this->attributeEndTokenPosUsed) { - $endAttributes['endTokenPos'] = $this->pos; - } - if ($this->attributeEndFilePosUsed) { - $endAttributes['endFilePos'] = $this->filePos - 1; - } - return $id; + // Check for unterminated comment + $lastToken = $tokens[$numTokens - 1]; + if ($this->isUnterminatedComment($lastToken)) { + $errorHandler->handleError(new \PhpParser\Error('Unterminated comment', ['startLine' => $lastToken->line, 'endLine' => $lastToken->getEndLine(), 'startFilePos' => $lastToken->pos, 'endFilePos' => $lastToken->getEndPos()])); } - throw new \RuntimeException('Reached end of lexer loop'); - } - /** - * Returns the token array for current code. - * - * The token array is in the same format as provided by the - * token_get_all() function and does not discard tokens (i.e. - * whitespace and comments are included). The token position - * attributes are against this token array. - * - * @return array Array of tokens in token_get_all() format - */ - public function getTokens() : array - { - return $this->tokens; - } - /** - * Handles __halt_compiler() by returning the text after it. - * - * @return string Remaining text - */ - public function handleHaltCompiler() : string - { - // text after T_HALT_COMPILER, still including (); - $textAfter = \substr($this->code, $this->filePos); - // ensure that it is followed by (); - // this simplifies the situation, by not allowing any comments - // in between of the tokens. - if (!\preg_match('~^\\s*\\(\\s*\\)\\s*(?:;|\\?>\\r?\\n?)~', $textAfter, $matches)) { - throw new \PhpParser\Error('__HALT_COMPILER must be followed by "();"'); - } - // prevent the lexer from returning any further tokens - $this->pos = \count($this->tokens); - // return with (); removed - return \substr($textAfter, \strlen($matches[0])); - } - private function defineCompatibilityTokens() - { - static $compatTokensDefined = \false; - if ($compatTokensDefined) { - return; - } - $compatTokens = [ - // PHP 7.4 - 'T_BAD_CHARACTER', - 'T_FN', - 'T_COALESCE_EQUAL', - // PHP 8.0 - 'T_NAME_QUALIFIED', - 'T_NAME_FULLY_QUALIFIED', - 'T_NAME_RELATIVE', - 'T_MATCH', - 'T_NULLSAFE_OBJECT_OPERATOR', - 'T_ATTRIBUTE', - // PHP 8.1 - 'T_ENUM', - 'T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG', - 'T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG', - 'T_READONLY', - ]; - // PHP-Parser might be used together with another library that also emulates some or all - // of these tokens. Perform a sanity-check that all already defined tokens have been - // assigned a unique ID. - $usedTokenIds = []; - foreach ($compatTokens as $token) { - if (\defined($token)) { - $tokenId = \constant($token); - $clashingToken = $usedTokenIds[$tokenId] ?? null; - if ($clashingToken !== null) { - throw new \Error(\sprintf('Token %s has same ID as token %s, ' . 'you may be using a library with broken token emulation', $token, $clashingToken)); - } - $usedTokenIds[$tokenId] = $token; - } - } - // Now define any tokens that have not yet been emulated. Try to assign IDs from -1 - // downwards, but skip any IDs that may already be in use. - $newTokenId = -1; - foreach ($compatTokens as $token) { - if (!\defined($token)) { - while (isset($usedTokenIds[$newTokenId])) { - $newTokenId--; - } - \define($token, $newTokenId); - $newTokenId--; - } - } - $compatTokensDefined = \true; - } - /** - * Creates the token map. - * - * The token map maps the PHP internal token identifiers - * to the identifiers used by the Parser. Additionally it - * maps T_OPEN_TAG_WITH_ECHO to T_ECHO and T_CLOSE_TAG to ';'. - * - * @return array The token map - */ - protected function createTokenMap() : array - { - $tokenMap = []; - // 256 is the minimum possible token number, as everything below - // it is an ASCII value - for ($i = 256; $i < 1000; ++$i) { - if (\T_DOUBLE_COLON === $i) { - // T_DOUBLE_COLON is equivalent to T_PAAMAYIM_NEKUDOTAYIM - $tokenMap[$i] = Tokens::T_PAAMAYIM_NEKUDOTAYIM; - } elseif (\T_OPEN_TAG_WITH_ECHO === $i) { - // T_OPEN_TAG_WITH_ECHO with dropped T_OPEN_TAG results in T_ECHO - $tokenMap[$i] = Tokens::T_ECHO; - } elseif (\T_CLOSE_TAG === $i) { - // T_CLOSE_TAG is equivalent to ';' - $tokenMap[$i] = \ord(';'); - } elseif ('UNKNOWN' !== ($name = \token_name($i))) { - if ('T_HASHBANG' === $name) { - // HHVM uses a special token for #! hashbang lines - $tokenMap[$i] = Tokens::T_INLINE_HTML; - } elseif (\defined($name = Tokens::class . '::' . $name)) { - // Other tokens can be mapped directly - $tokenMap[$i] = \constant($name); - } - } - } - // HHVM uses a special token for numbers that overflow to double - if (\defined('T_ONUMBER')) { - $tokenMap[\T_ONUMBER] = Tokens::T_DNUMBER; - } - // HHVM also has a separate token for the __COMPILER_HALT_OFFSET__ constant - if (\defined('T_COMPILER_HALT_OFFSET')) { - $tokenMap[\T_COMPILER_HALT_OFFSET] = Tokens::T_STRING; - } - // Assign tokens for which we define compatibility constants, as token_name() does not know them. - $tokenMap[\T_FN] = Tokens::T_FN; - $tokenMap[\T_COALESCE_EQUAL] = Tokens::T_COALESCE_EQUAL; - $tokenMap[\T_NAME_QUALIFIED] = Tokens::T_NAME_QUALIFIED; - $tokenMap[\T_NAME_FULLY_QUALIFIED] = Tokens::T_NAME_FULLY_QUALIFIED; - $tokenMap[\T_NAME_RELATIVE] = Tokens::T_NAME_RELATIVE; - $tokenMap[\T_MATCH] = Tokens::T_MATCH; - $tokenMap[\T_NULLSAFE_OBJECT_OPERATOR] = Tokens::T_NULLSAFE_OBJECT_OPERATOR; - $tokenMap[\T_ATTRIBUTE] = Tokens::T_ATTRIBUTE; - $tokenMap[\T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG] = Tokens::T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG; - $tokenMap[\T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG] = Tokens::T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG; - $tokenMap[\T_ENUM] = Tokens::T_ENUM; - $tokenMap[\T_READONLY] = Tokens::T_READONLY; - return $tokenMap; - } - private function createIdentifierTokenMap() : array - { - // Based on semi_reserved production. - return \array_fill_keys([\T_STRING, \T_STATIC, \T_ABSTRACT, \T_FINAL, \T_PRIVATE, \T_PROTECTED, \T_PUBLIC, \T_READONLY, \T_INCLUDE, \T_INCLUDE_ONCE, \T_EVAL, \T_REQUIRE, \T_REQUIRE_ONCE, \T_LOGICAL_OR, \T_LOGICAL_XOR, \T_LOGICAL_AND, \T_INSTANCEOF, \T_NEW, \T_CLONE, \T_EXIT, \T_IF, \T_ELSEIF, \T_ELSE, \T_ENDIF, \T_ECHO, \T_DO, \T_WHILE, \T_ENDWHILE, \T_FOR, \T_ENDFOR, \T_FOREACH, \T_ENDFOREACH, \T_DECLARE, \T_ENDDECLARE, \T_AS, \T_TRY, \T_CATCH, \T_FINALLY, \T_THROW, \T_USE, \T_INSTEADOF, \T_GLOBAL, \T_VAR, \T_UNSET, \T_ISSET, \T_EMPTY, \T_CONTINUE, \T_GOTO, \T_FUNCTION, \T_CONST, \T_RETURN, \T_PRINT, \T_YIELD, \T_LIST, \T_SWITCH, \T_ENDSWITCH, \T_CASE, \T_DEFAULT, \T_BREAK, \T_ARRAY, \T_CALLABLE, \T_EXTENDS, \T_IMPLEMENTS, \T_NAMESPACE, \T_TRAIT, \T_INTERFACE, \T_CLASS, \T_CLASS_C, \T_TRAIT_C, \T_FUNC_C, \T_METHOD_C, \T_LINE, \T_FILE, \T_DIR, \T_NS_C, \T_HALT_COMPILER, \T_FN, \T_MATCH], \true); + // Add sentinel token. + $tokens[] = new \PhpParser\Token(0, "\x00", $lastToken->getEndLine(), $lastToken->getEndPos()); } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php index 013674a89e3..70b46270451 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php @@ -6,74 +6,66 @@ namespace PhpParser\Lexer; use PhpParser\Error; use PhpParser\ErrorHandler; use PhpParser\Lexer; +use PhpParser\Lexer\TokenEmulator\AsymmetricVisibilityTokenEmulator; use PhpParser\Lexer\TokenEmulator\AttributeEmulator; use PhpParser\Lexer\TokenEmulator\EnumTokenEmulator; -use PhpParser\Lexer\TokenEmulator\CoaleseEqualTokenEmulator; use PhpParser\Lexer\TokenEmulator\ExplicitOctalEmulator; -use PhpParser\Lexer\TokenEmulator\FlexibleDocStringEmulator; -use PhpParser\Lexer\TokenEmulator\FnTokenEmulator; use PhpParser\Lexer\TokenEmulator\MatchTokenEmulator; use PhpParser\Lexer\TokenEmulator\NullsafeTokenEmulator; -use PhpParser\Lexer\TokenEmulator\NumericLiteralSeparatorEmulator; +use PhpParser\Lexer\TokenEmulator\PropertyTokenEmulator; use PhpParser\Lexer\TokenEmulator\ReadonlyFunctionTokenEmulator; use PhpParser\Lexer\TokenEmulator\ReadonlyTokenEmulator; use PhpParser\Lexer\TokenEmulator\ReverseEmulator; use PhpParser\Lexer\TokenEmulator\TokenEmulator; +use PhpParser\PhpVersion; +use PhpParser\Token; class Emulative extends Lexer { - const PHP_7_3 = '7.3dev'; - const PHP_7_4 = '7.4dev'; - const PHP_8_0 = '8.0dev'; - const PHP_8_1 = '8.1dev'; - const PHP_8_2 = '8.2dev'; - /** @var mixed[] Patches used to reverse changes introduced in the code */ - private $patches = []; - /** @var TokenEmulator[] */ - private $emulators = []; - /** @var string */ - private $targetPhpVersion; + /** @var array{int, string, string}[] Patches used to reverse changes introduced in the code */ + private array $patches = []; + /** @var list */ + private array $emulators = []; + private PhpVersion $targetPhpVersion; + private PhpVersion $hostPhpVersion; /** - * @param mixed[] $options Lexer options. In addition to the usual options, - * accepts a 'phpVersion' string that specifies the - * version to emulate. Defaults to newest supported. + * @param PhpVersion|null $phpVersion PHP version to emulate. Defaults to newest supported. */ - public function __construct(array $options = []) + public function __construct(?PhpVersion $phpVersion = null) { - $this->targetPhpVersion = $options['phpVersion'] ?? \PhpParser\Lexer\Emulative::PHP_8_2; - unset($options['phpVersion']); - parent::__construct($options); - $emulators = [new FlexibleDocStringEmulator(), new FnTokenEmulator(), new MatchTokenEmulator(), new CoaleseEqualTokenEmulator(), new NumericLiteralSeparatorEmulator(), new NullsafeTokenEmulator(), new AttributeEmulator(), new EnumTokenEmulator(), new ReadonlyTokenEmulator(), new ExplicitOctalEmulator(), new ReadonlyFunctionTokenEmulator()]; + $this->targetPhpVersion = $phpVersion ?? PhpVersion::getNewestSupported(); + $this->hostPhpVersion = PhpVersion::getHostVersion(); + $emulators = [new MatchTokenEmulator(), new NullsafeTokenEmulator(), new AttributeEmulator(), new EnumTokenEmulator(), new ReadonlyTokenEmulator(), new ExplicitOctalEmulator(), new ReadonlyFunctionTokenEmulator(), new PropertyTokenEmulator(), new AsymmetricVisibilityTokenEmulator()]; // Collect emulators that are relevant for the PHP version we're running // and the PHP version we're targeting for emulation. foreach ($emulators as $emulator) { $emulatorPhpVersion = $emulator->getPhpVersion(); if ($this->isForwardEmulationNeeded($emulatorPhpVersion)) { $this->emulators[] = $emulator; - } else { - if ($this->isReverseEmulationNeeded($emulatorPhpVersion)) { - $this->emulators[] = new ReverseEmulator($emulator); - } + } elseif ($this->isReverseEmulationNeeded($emulatorPhpVersion)) { + $this->emulators[] = new ReverseEmulator($emulator); } } } - public function startLexing(string $code, ?ErrorHandler $errorHandler = null) + public function tokenize(string $code, ?ErrorHandler $errorHandler = null) : array { $emulators = \array_filter($this->emulators, function ($emulator) use($code) { return $emulator->isEmulationNeeded($code); }); if (empty($emulators)) { // Nothing to emulate, yay - parent::startLexing($code, $errorHandler); - return; + return parent::tokenize($code, $errorHandler); + } + if ($errorHandler === null) { + $errorHandler = new ErrorHandler\Throwing(); } $this->patches = []; foreach ($emulators as $emulator) { $code = $emulator->preprocessCode($code, $this->patches); } $collector = new ErrorHandler\Collecting(); - parent::startLexing($code, $collector); + $tokens = parent::tokenize($code, $collector); $this->sortPatches(); - $this->fixupTokens(); + $tokens = $this->fixupTokens($tokens); $errors = $collector->getErrors(); if (!empty($errors)) { $this->fixupErrors($errors); @@ -82,18 +74,19 @@ class Emulative extends Lexer } } foreach ($emulators as $emulator) { - $this->tokens = $emulator->emulate($code, $this->tokens); + $tokens = $emulator->emulate($code, $tokens); } + return $tokens; } - private function isForwardEmulationNeeded(string $emulatorPhpVersion) : bool + private function isForwardEmulationNeeded(PhpVersion $emulatorPhpVersion) : bool { - return \version_compare(\PHP_VERSION, $emulatorPhpVersion, '<') && \version_compare($this->targetPhpVersion, $emulatorPhpVersion, '>='); + return $this->hostPhpVersion->older($emulatorPhpVersion) && $this->targetPhpVersion->newerOrEqual($emulatorPhpVersion); } - private function isReverseEmulationNeeded(string $emulatorPhpVersion) : bool + private function isReverseEmulationNeeded(PhpVersion $emulatorPhpVersion) : bool { - return \version_compare(\PHP_VERSION, $emulatorPhpVersion, '>=') && \version_compare($this->targetPhpVersion, $emulatorPhpVersion, '<'); + return $this->hostPhpVersion->newerOrEqual($emulatorPhpVersion) && $this->targetPhpVersion->older($emulatorPhpVersion); } - private function sortPatches() + private function sortPatches() : void { // Patches may be contributed by different emulators. // Make sure they are sorted by increasing patch position. @@ -101,83 +94,72 @@ class Emulative extends Lexer return $p1[0] <=> $p2[0]; }); } - private function fixupTokens() + /** + * @param list $tokens + * @return list + */ + private function fixupTokens(array $tokens) : array { if (\count($this->patches) === 0) { - return; + return $tokens; } // Load first patch $patchIdx = 0; list($patchPos, $patchType, $patchText) = $this->patches[$patchIdx]; // We use a manual loop over the tokens, because we modify the array on the fly - $pos = 0; - for ($i = 0, $c = \count($this->tokens); $i < $c; $i++) { - $token = $this->tokens[$i]; - if (\is_string($token)) { - if ($patchPos === $pos) { - // Only support replacement for string tokens. - \assert($patchType === 'replace'); - $this->tokens[$i] = $patchText; - // Fetch the next patch - $patchIdx++; - if ($patchIdx >= \count($this->patches)) { - // No more patches, we're done - return; - } - list($patchPos, $patchType, $patchText) = $this->patches[$patchIdx]; - } - $pos += \strlen($token); - continue; - } - $len = \strlen($token[1]); - $posDelta = 0; + $posDelta = 0; + $lineDelta = 0; + for ($i = 0, $c = \count($tokens); $i < $c; $i++) { + $token = $tokens[$i]; + $pos = $token->pos; + $token->pos += $posDelta; + $token->line += $lineDelta; + $localPosDelta = 0; + $len = \strlen(\is_array($token) ? $token[1] : $token); while ($patchPos >= $pos && $patchPos < $pos + $len) { $patchTextLen = \strlen($patchText); if ($patchType === 'remove') { if ($patchPos === $pos && $patchTextLen === $len) { // Remove token entirely - \array_splice($this->tokens, $i, 1, []); + \array_splice($tokens, $i, 1, []); $i--; $c--; } else { // Remove from token string - $this->tokens[$i][1] = \substr_replace($token[1], '', $patchPos - $pos + $posDelta, $patchTextLen); - $posDelta -= $patchTextLen; + \is_array($token) ? $token[1] : ($token = \substr_replace(\is_array($token) ? $token[1] : $token, '', $patchPos - $pos + $localPosDelta, $patchTextLen)); + $localPosDelta -= $patchTextLen; } + $lineDelta -= \substr_count($patchText, "\n"); } elseif ($patchType === 'add') { // Insert into the token string - $this->tokens[$i][1] = \substr_replace($token[1], $patchText, $patchPos - $pos + $posDelta, 0); - $posDelta += $patchTextLen; + \is_array($token) ? $token[1] : ($token = \substr_replace(\is_array($token) ? $token[1] : $token, $patchText, $patchPos - $pos + $localPosDelta, 0)); + $localPosDelta += $patchTextLen; + $lineDelta += \substr_count($patchText, "\n"); + } elseif ($patchType === 'replace') { + // Replace inside the token string + \is_array($token) ? $token[1] : ($token = \substr_replace(\is_array($token) ? $token[1] : $token, $patchText, $patchPos - $pos + $localPosDelta, $patchTextLen)); } else { - if ($patchType === 'replace') { - // Replace inside the token string - $this->tokens[$i][1] = \substr_replace($token[1], $patchText, $patchPos - $pos + $posDelta, $patchTextLen); - } else { - \assert(\false); - } + \assert(\false); } // Fetch the next patch $patchIdx++; if ($patchIdx >= \count($this->patches)) { - // No more patches, we're done - return; + // No more patches. However, we still need to adjust position. + $patchPos = \PHP_INT_MAX; + break; } list($patchPos, $patchType, $patchText) = $this->patches[$patchIdx]; - // Multiple patches may apply to the same token. Reload the current one to check - // If the new patch applies - $token = $this->tokens[$i]; } - $pos += $len; + $posDelta += $localPosDelta; } - // A patch did not apply - \assert(\false); + return $tokens; } /** * Fixup line and position information in errors. * * @param Error[] $errors */ - private function fixupErrors(array $errors) + private function fixupErrors(array $errors) : void { foreach ($errors as $error) { $attrs = $error->getAttributes(); @@ -192,11 +174,9 @@ class Emulative extends Lexer if ($patchType === 'add') { $posDelta += \strlen($patchText); $lineDelta += \substr_count($patchText, "\n"); - } else { - if ($patchType === 'remove') { - $posDelta -= \strlen($patchText); - $lineDelta -= \substr_count($patchText, "\n"); - } + } elseif ($patchType === 'remove') { + $posDelta -= \strlen($patchText); + $lineDelta -= \substr_count($patchText, "\n"); } } $attrs['startFilePos'] += $posDelta; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AsymmetricVisibilityTokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AsymmetricVisibilityTokenEmulator.php new file mode 100644 index 00000000000..92415fe43a1 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AsymmetricVisibilityTokenEmulator.php @@ -0,0 +1,66 @@ + \T_PUBLIC_SET, \T_PROTECTED => \T_PROTECTED_SET, \T_PRIVATE => \T_PRIVATE_SET]; + for ($i = 0, $c = \count($tokens); $i < $c; ++$i) { + $token = $tokens[$i]; + if (isset($map[\is_array($token) ? $token[0] : $token]) && $i + 3 < $c && (\is_array($tokens[$i + 1]) ? $tokens[$i + 1][1] : $tokens[$i + 1]) === '(' && (\is_array($tokens[$i + 2]) ? $tokens[$i + 2][0] : $tokens[$i + 2]) === \T_STRING && \strtolower(\is_array($tokens[$i + 2]) ? $tokens[$i + 2][1] : $tokens[$i + 2]) === 'set' && (\is_array($tokens[$i + 3]) ? $tokens[$i + 3][1] : $tokens[$i + 3]) === ')' && $this->isKeywordContext($tokens, $i)) { + \array_splice($tokens, $i, 4, [new Token($map[\is_array($token) ? $token[0] : $token], (\is_array($token) ? $token[1] : $token) . '(' . (\is_array($tokens[$i + 2]) ? $tokens[$i + 2][1] : $tokens[$i + 2]) . ')', $token->line, $token->pos)]); + $c -= 3; + } + } + return $tokens; + } + public function reverseEmulate(string $code, array $tokens) : array + { + $reverseMap = [\T_PUBLIC_SET => \T_PUBLIC, \T_PROTECTED_SET => \T_PROTECTED, \T_PRIVATE_SET => \T_PRIVATE]; + for ($i = 0, $c = \count($tokens); $i < $c; ++$i) { + $token = $tokens[$i]; + if (isset($reverseMap[\is_array($token) ? $token[0] : $token]) && \preg_match('/(public|protected|private)\\((set)\\)/i', \is_array($token) ? $token[1] : $token, $matches)) { + [, $modifier, $set] = $matches; + $modifierLen = \strlen($modifier); + \array_splice($tokens, $i, 1, [new Token($reverseMap[\is_array($token) ? $token[0] : $token], $modifier, $token->line, $token->pos), new Token(\ord('('), '(', $token->line, $token->pos + $modifierLen), new Token(\T_STRING, $set, $token->line, $token->pos + $modifierLen + 1), new Token(\ord(')'), ')', $token->line, $token->pos + $modifierLen + 4)]); + $i += 3; + $c += 3; + } + } + return $tokens; + } + /** @param Token[] $tokens */ + protected function isKeywordContext(array $tokens, int $pos) : bool + { + $prevToken = $this->getPreviousNonSpaceToken($tokens, $pos); + if ($prevToken === null) { + return \false; + } + return (\is_array($prevToken) ? $prevToken[0] : $prevToken) !== \T_OBJECT_OPERATOR && (\is_array($prevToken) ? $prevToken[0] : $prevToken) !== \T_NULLSAFE_OBJECT_OPERATOR; + } + /** @param Token[] $tokens */ + private function getPreviousNonSpaceToken(array $tokens, int $start) : ?Token + { + for ($i = $start - 1; $i >= 0; --$i) { + if ((\is_array($tokens[$i]) ? $tokens[$i][0] : $tokens[$i]) === \T_WHITESPACE) { + continue; + } + return $tokens[$i]; + } + return null; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php index 7481f2598d0..bb1e58cd90f 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php @@ -3,12 +3,13 @@ declare (strict_types=1); namespace PhpParser\Lexer\TokenEmulator; -use PhpParser\Lexer\Emulative; +use PhpParser\PhpVersion; +use PhpParser\Token; final class AttributeEmulator extends \PhpParser\Lexer\TokenEmulator\TokenEmulator { - public function getPhpVersion() : string + public function getPhpVersion() : PhpVersion { - return Emulative::PHP_8_0; + return PhpVersion::fromComponents(8, 0); } public function isEmulationNeeded(string $code) : bool { @@ -18,16 +19,13 @@ final class AttributeEmulator extends \PhpParser\Lexer\TokenEmulator\TokenEmulat { // We need to manually iterate and manage a count because we'll change // the tokens array on the way. - $line = 1; for ($i = 0, $c = \count($tokens); $i < $c; ++$i) { - if ($tokens[$i] === '#' && isset($tokens[$i + 1]) && $tokens[$i + 1] === '[') { - \array_splice($tokens, $i, 2, [[\T_ATTRIBUTE, '#[', $line]]); + $token = $tokens[$i]; + if ((\is_array($token) ? $token[1] : $token) === '#' && isset($tokens[$i + 1]) && (\is_array($tokens[$i + 1]) ? $tokens[$i + 1][1] : $tokens[$i + 1]) === '[') { + \array_splice($tokens, $i, 2, [new Token(\T_ATTRIBUTE, '#[', $token->line, $token->pos)]); $c--; continue; } - if (\is_array($tokens[$i])) { - $line += \substr_count($tokens[$i][1], "\n"); - } } return $tokens; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php deleted file mode 100644 index 2b9f54df02b..00000000000 --- a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php +++ /dev/null @@ -1,41 +0,0 @@ -resolveIntegerOrFloatToken($tokens[$i + 1][1]); - \array_splice($tokens, $i, 2, [[$tokenKind, '0' . $tokens[$i + 1][1], $tokens[$i][2]]]); + $token = $tokens[$i]; + if ((\is_array($token) ? $token[0] : $token) == \T_LNUMBER && (\is_array($token) ? $token[1] : $token) === '0' && isset($tokens[$i + 1]) && (\is_array($tokens[$i + 1]) ? $tokens[$i + 1][0] : $tokens[$i + 1]) == \T_STRING && \preg_match('/[oO][0-7]+(?:_[0-7]+)*/', \is_array($tokens[$i + 1]) ? $tokens[$i + 1][1] : $tokens[$i + 1])) { + $tokenKind = $this->resolveIntegerOrFloatToken(\is_array($tokens[$i + 1]) ? $tokens[$i + 1][1] : $tokens[$i + 1]); + \array_splice($tokens, $i, 2, [new Token($tokenKind, '0' . (\is_array($tokens[$i + 1]) ? $tokens[$i + 1][1] : $tokens[$i + 1]), $token->line, $token->pos)]); $c--; } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php deleted file mode 100644 index eb4ff0484e2..00000000000 --- a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php +++ /dev/null @@ -1,66 +0,0 @@ -\h*)\2(?![a-zA-Z0-9_\x80-\xff])(?(?:;?[\r\n])?)/x -REGEX; - public function getPhpVersion() : string - { - return Emulative::PHP_7_3; - } - public function isEmulationNeeded(string $code) : bool - { - return \strpos($code, '<<<') !== \false; - } - public function emulate(string $code, array $tokens) : array - { - // Handled by preprocessing + fixup. - return $tokens; - } - public function reverseEmulate(string $code, array $tokens) : array - { - // Not supported. - return $tokens; - } - public function preprocessCode(string $code, array &$patches) : string - { - if (!\preg_match_all(self::FLEXIBLE_DOC_STRING_REGEX, $code, $matches, \PREG_SET_ORDER | \PREG_OFFSET_CAPTURE)) { - // No heredoc/nowdoc found - return $code; - } - // Keep track of how much we need to adjust string offsets due to the modifications we - // already made - $posDelta = 0; - foreach ($matches as $match) { - $indentation = $match['indentation'][0]; - $indentationStart = $match['indentation'][1]; - $separator = $match['separator'][0]; - $separatorStart = $match['separator'][1]; - if ($indentation === '' && $separator !== '') { - // Ordinary heredoc/nowdoc - continue; - } - if ($indentation !== '') { - // Remove indentation - $indentationLen = \strlen($indentation); - $code = \substr_replace($code, '', $indentationStart + $posDelta, $indentationLen); - $patches[] = [$indentationStart + $posDelta, 'add', $indentation]; - $posDelta -= $indentationLen; - } - if ($separator === '') { - // Insert newline as separator - $code = \substr_replace($code, "\n", $separatorStart + $posDelta, 0); - $patches[] = [$separatorStart + $posDelta, 'remove', "\n"]; - $posDelta += 1; - } - } - return $code; - } -} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php deleted file mode 100644 index c2403414076..00000000000 --- a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php +++ /dev/null @@ -1,21 +0,0 @@ -getKeywordString()) !== \false; } + /** @param Token[] $tokens */ protected function isKeywordContext(array $tokens, int $pos) : bool { - $previousNonSpaceToken = $this->getPreviousNonSpaceToken($tokens, $pos); - return $previousNonSpaceToken === null || $previousNonSpaceToken[0] !== \T_OBJECT_OPERATOR; + $prevToken = $this->getPreviousNonSpaceToken($tokens, $pos); + if ($prevToken === null) { + return \false; + } + return (\is_array($prevToken) ? $prevToken[0] : $prevToken) !== \T_OBJECT_OPERATOR && (\is_array($prevToken) ? $prevToken[0] : $prevToken) !== \T_NULLSAFE_OBJECT_OPERATOR; } public function emulate(string $code, array $tokens) : array { $keywordString = $this->getKeywordString(); foreach ($tokens as $i => $token) { - if ($token[0] === \T_STRING && \strtolower($token[1]) === $keywordString && $this->isKeywordContext($tokens, $i)) { - $tokens[$i][0] = $this->getKeywordToken(); + if ((\is_array($token) ? $token[0] : $token) === \T_STRING && \strtolower(\is_array($token) ? $token[1] : $token) === $keywordString && $this->isKeywordContext($tokens, $i)) { + \is_array($token) ? $token[0] : ($token = $this->getKeywordToken()); } } return $tokens; } - /** - * @param mixed[] $tokens - * @return array|string|null - */ - private function getPreviousNonSpaceToken(array $tokens, int $start) + /** @param Token[] $tokens */ + private function getPreviousNonSpaceToken(array $tokens, int $start) : ?Token { for ($i = $start - 1; $i >= 0; --$i) { - if ($tokens[$i][0] === \T_WHITESPACE) { + if ((\is_array($tokens[$i]) ? $tokens[$i][0] : $tokens[$i]) === \T_WHITESPACE) { continue; } return $tokens[$i]; @@ -43,9 +45,9 @@ abstract class KeywordEmulator extends \PhpParser\Lexer\TokenEmulator\TokenEmula public function reverseEmulate(string $code, array $tokens) : array { $keywordToken = $this->getKeywordToken(); - foreach ($tokens as $i => $token) { - if ($token[0] === $keywordToken) { - $tokens[$i][0] = \T_STRING; + foreach ($tokens as $token) { + if ((\is_array($token) ? $token[0] : $token) === $keywordToken) { + \is_array($token) ? $token[0] : ($token = \T_STRING); } } return $tokens; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php index 93892930d99..732f859fa09 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace PhpParser\Lexer\TokenEmulator; -use PhpParser\Lexer\Emulative; +use PhpParser\PhpVersion; final class MatchTokenEmulator extends \PhpParser\Lexer\TokenEmulator\KeywordEmulator { - public function getPhpVersion() : string + public function getPhpVersion() : PhpVersion { - return Emulative::PHP_8_0; + return PhpVersion::fromComponents(8, 0); } public function getKeywordString() : string { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php index 83c5c4d0b7b..30cdc15b5b8 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php @@ -3,12 +3,13 @@ declare (strict_types=1); namespace PhpParser\Lexer\TokenEmulator; -use PhpParser\Lexer\Emulative; +use PhpParser\PhpVersion; +use PhpParser\Token; final class NullsafeTokenEmulator extends \PhpParser\Lexer\TokenEmulator\TokenEmulator { - public function getPhpVersion() : string + public function getPhpVersion() : PhpVersion { - return Emulative::PHP_8_0; + return PhpVersion::fromComponents(8, 0); } public function isEmulationNeeded(string $code) : bool { @@ -18,26 +19,24 @@ final class NullsafeTokenEmulator extends \PhpParser\Lexer\TokenEmulator\TokenEm { // We need to manually iterate and manage a count because we'll change // the tokens array on the way - $line = 1; for ($i = 0, $c = \count($tokens); $i < $c; ++$i) { - if ($tokens[$i] === '?' && isset($tokens[$i + 1]) && $tokens[$i + 1][0] === \T_OBJECT_OPERATOR) { - \array_splice($tokens, $i, 2, [[\T_NULLSAFE_OBJECT_OPERATOR, '?->', $line]]); + $token = $tokens[$i]; + if ((\is_array($token) ? $token[1] : $token) === '?' && isset($tokens[$i + 1]) && (\is_array($tokens[$i + 1]) ? $tokens[$i + 1][0] : $tokens[$i + 1]) === \T_OBJECT_OPERATOR) { + \array_splice($tokens, $i, 2, [new Token(\T_NULLSAFE_OBJECT_OPERATOR, '?->', $token->line, $token->pos)]); $c--; continue; } // Handle ?-> inside encapsed string. - if ($tokens[$i][0] === \T_ENCAPSED_AND_WHITESPACE && isset($tokens[$i - 1]) && $tokens[$i - 1][0] === \T_VARIABLE && \preg_match('/^\\?->([a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*)/', $tokens[$i][1], $matches)) { - $replacement = [[\T_NULLSAFE_OBJECT_OPERATOR, '?->', $line], [\T_STRING, $matches[1], $line]]; - if (\strlen($matches[0]) !== \strlen($tokens[$i][1])) { - $replacement[] = [\T_ENCAPSED_AND_WHITESPACE, \substr($tokens[$i][1], \strlen($matches[0])), $line]; + if ((\is_array($token) ? $token[0] : $token) === \T_ENCAPSED_AND_WHITESPACE && isset($tokens[$i - 1]) && (\is_array($tokens[$i - 1]) ? $tokens[$i - 1][0] : $tokens[$i - 1]) === \T_VARIABLE && \preg_match('/^\\?->([a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*)/', \is_array($token) ? $token[1] : $token, $matches)) { + $replacement = [new Token(\T_NULLSAFE_OBJECT_OPERATOR, '?->', $token->line, $token->pos), new Token(\T_STRING, $matches[1], $token->line, $token->pos + 3)]; + $matchLen = \strlen($matches[0]); + if ($matchLen !== \strlen(\is_array($token) ? $token[1] : $token)) { + $replacement[] = new Token(\T_ENCAPSED_AND_WHITESPACE, \substr(\is_array($token) ? $token[1] : $token, $matchLen), $token->line, $token->pos + $matchLen); } \array_splice($tokens, $i, 1, $replacement); $c += \count($replacement) - 1; continue; } - if (\is_array($tokens[$i])) { - $line += \substr_count($tokens[$i][1], "\n"); - } } return $tokens; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php deleted file mode 100644 index 3de1690d34d..00000000000 --- a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php +++ /dev/null @@ -1,88 +0,0 @@ -resolveIntegerOrFloatToken($match); - $newTokens = [[$tokenKind, $match, $token[2]]]; - $numTokens = 1; - $len = $tokenLen; - while ($matchLen > $len) { - $nextToken = $tokens[$i + $numTokens]; - $nextTokenText = \is_array($nextToken) ? $nextToken[1] : $nextToken; - $nextTokenLen = \strlen($nextTokenText); - $numTokens++; - if ($matchLen < $len + $nextTokenLen) { - // Split trailing characters into a partial token. - \assert(\is_array($nextToken), "Partial token should be an array token"); - $partialText = \substr($nextTokenText, $matchLen - $len); - $newTokens[] = [$nextToken[0], $partialText, $nextToken[2]]; - break; - } - $len += $nextTokenLen; - } - \array_splice($tokens, $i, $numTokens, $newTokens); - $c -= $numTokens - \count($newTokens); - $codeOffset += $matchLen; - } - return $tokens; - } - private function resolveIntegerOrFloatToken(string $str) : int - { - $str = \str_replace('_', '', $str); - if (\stripos($str, '0b') === 0) { - $num = \bindec($str); - } elseif (\stripos($str, '0x') === 0) { - $num = \hexdec($str); - } elseif (\stripos($str, '0') === 0 && \ctype_digit($str)) { - $num = \octdec($str); - } else { - $num = +$str; - } - return \is_float($num) ? \T_DNUMBER : \T_LNUMBER; - } - public function reverseEmulate(string $code, array $tokens) : array - { - // Numeric separators were not legal code previously, don't bother. - return $tokens; - } -} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/PropertyTokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/PropertyTokenEmulator.php new file mode 100644 index 00000000000..3c24e2318a8 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/PropertyTokenEmulator.php @@ -0,0 +1,21 @@ +emulator = $emulator; } - public function getPhpVersion() : string + public function getPhpVersion() : PhpVersion { return $this->emulator->getPhpVersion(); } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php index 0de52716fa6..3159c3fde53 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php @@ -3,19 +3,24 @@ declare (strict_types=1); namespace PhpParser\Lexer\TokenEmulator; +use PhpParser\PhpVersion; +use PhpParser\Token; /** @internal */ abstract class TokenEmulator { - public abstract function getPhpVersion() : string; + public abstract function getPhpVersion() : PhpVersion; public abstract function isEmulationNeeded(string $code) : bool; /** - * @return array Modified Tokens + * @param Token[] $tokens Original tokens + * @return Token[] Modified Tokens */ public abstract function emulate(string $code, array $tokens) : array; /** - * @return array Modified Tokens + * @param Token[] $tokens Original tokens + * @return Token[] Modified Tokens */ public abstract function reverseEmulate(string $code, array $tokens) : array; + /** @param array{int, string, string}[] $patches */ public function preprocessCode(string $code, array &$patches) : string { return $code; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Modifiers.php b/vendor/nikic/php-parser/lib/PhpParser/Modifiers.php new file mode 100644 index 00000000000..3824b74d7d5 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Modifiers.php @@ -0,0 +1,66 @@ + 'public', self::PROTECTED => 'protected', self::PRIVATE => 'private', self::STATIC => 'static', self::ABSTRACT => 'abstract', self::FINAL => 'final', self::READONLY => 'readonly', self::PUBLIC_SET => 'public(set)', self::PROTECTED_SET => 'protected(set)', self::PRIVATE_SET => 'private(set)']; + public static function toString(int $modifier) : string + { + if (!isset(self::TO_STRING_MAP[$modifier])) { + throw new \InvalidArgumentException("Unknown modifier {$modifier}"); + } + return self::TO_STRING_MAP[$modifier]; + } + private static function isValidModifier(int $modifier) : bool + { + $isPow2 = ($modifier & $modifier - 1) == 0 && $modifier != 0; + return $isPow2 && $modifier <= self::PRIVATE_SET; + } + /** + * @internal + */ + public static function verifyClassModifier(int $a, int $b) : void + { + \assert(self::isValidModifier($b)); + if (($a & $b) != 0) { + throw new \PhpParser\Error('Multiple ' . self::toString($b) . ' modifiers are not allowed'); + } + if ($a & 48 && $b & 48) { + throw new \PhpParser\Error('Cannot use the final modifier on an abstract class'); + } + } + /** + * @internal + */ + public static function verifyModifier(int $a, int $b) : void + { + \assert(self::isValidModifier($b)); + if ($a & \PhpParser\Modifiers::VISIBILITY_MASK && $b & \PhpParser\Modifiers::VISIBILITY_MASK || $a & \PhpParser\Modifiers::VISIBILITY_SET_MASK && $b & \PhpParser\Modifiers::VISIBILITY_SET_MASK) { + throw new \PhpParser\Error('Multiple access type modifiers are not allowed'); + } + if (($a & $b) != 0) { + throw new \PhpParser\Error('Multiple ' . self::toString($b) . ' modifiers are not allowed'); + } + if ($a & 48 && $b & 48) { + throw new \PhpParser\Error('Cannot use the final modifier on an abstract class member'); + } + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NameContext.php b/vendor/nikic/php-parser/lib/PhpParser/NameContext.php index 534b4160009..c377653bcd6 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NameContext.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NameContext.php @@ -9,13 +9,13 @@ use PhpParser\Node\Stmt; class NameContext { /** @var null|Name Current namespace */ - protected $namespace; + protected ?Name $namespace; /** @var Name[][] Map of format [aliasType => [aliasName => originalName]] */ - protected $aliases = []; + protected array $aliases = []; /** @var Name[][] Same as $aliases but preserving original case */ - protected $origAliases = []; + protected array $origAliases = []; /** @var ErrorHandler Error handler */ - protected $errorHandler; + protected \PhpParser\ErrorHandler $errorHandler; /** * Create a name context. * @@ -32,7 +32,7 @@ class NameContext * * @param Name|null $namespace Null is the global namespace */ - public function startNamespace(?Name $namespace = null) + public function startNamespace(?Name $namespace = null) : void { $this->namespace = $namespace; $this->origAliases = $this->aliases = [Stmt\Use_::TYPE_NORMAL => [], Stmt\Use_::TYPE_FUNCTION => [], Stmt\Use_::TYPE_CONSTANT => []]; @@ -40,12 +40,12 @@ class NameContext /** * Add an alias / import. * - * @param Name $name Original name - * @param string $aliasName Aliased name - * @param int $type One of Stmt\Use_::TYPE_* - * @param array $errorAttrs Attributes to use to report an error + * @param Name $name Original name + * @param string $aliasName Aliased name + * @param Stmt\Use_::TYPE_* $type One of Stmt\Use_::TYPE_* + * @param array $errorAttrs Attributes to use to report an error */ - public function addAlias(Name $name, string $aliasName, int $type, array $errorAttrs = []) + public function addAlias(Name $name, string $aliasName, int $type, array $errorAttrs = []) : void { // Constant names are case sensitive, everything else case insensitive if ($type === Stmt\Use_::TYPE_CONSTANT) { @@ -66,7 +66,7 @@ class NameContext * * @return null|Name Namespace (or null if global namespace) */ - public function getNamespace() + public function getNamespace() : ?Name { return $this->namespace; } @@ -74,11 +74,11 @@ class NameContext * Get resolved name. * * @param Name $name Name to resolve - * @param int $type One of Stmt\Use_::TYPE_{FUNCTION|CONSTANT} + * @param Stmt\Use_::TYPE_* $type One of Stmt\Use_::TYPE_{FUNCTION|CONSTANT} * * @return null|Name Resolved name, or null if static resolution is not possible */ - public function getResolvedName(Name $name, int $type) + public function getResolvedName(Name $name, int $type) : ?Name { // don't resolve special class names if ($type === Stmt\Use_::TYPE_NORMAL && $name->isSpecialClassName()) { @@ -121,7 +121,7 @@ class NameContext * Get possible ways of writing a fully qualified name (e.g., by making use of aliases). * * @param string $name Fully-qualified name (without leading namespace separator) - * @param int $type One of Stmt\Use_::TYPE_* + * @param Stmt\Use_::TYPE_* $type One of Stmt\Use_::TYPE_* * * @return Name[] Possible representations of the name */ @@ -153,7 +153,7 @@ class NameContext // Check for relevant type-specific use statements foreach ($this->origAliases[$type] as $alias => $orig) { if ($type === Stmt\Use_::TYPE_CONSTANT) { - // Constants are are complicated-sensitive + // Constants are complicated-sensitive $normalizedOrig = $this->normalizeConstName($orig->toString()); if ($normalizedOrig === $this->normalizeConstName($name)) { $possibleNames[] = new Name($alias); @@ -171,7 +171,7 @@ class NameContext * Get shortest representation of this fully-qualified name. * * @param string $name Fully-qualified name (without leading namespace separator) - * @param int $type One of Stmt\Use_::TYPE_* + * @param Stmt\Use_::TYPE_* $type One of Stmt\Use_::TYPE_* * * @return Name Shortest representation */ @@ -190,7 +190,7 @@ class NameContext } return $shortestName; } - private function resolveAlias(Name $name, $type) + private function resolveAlias(Name $name, int $type) : ?FullyQualified { $firstPart = $name->getFirst(); if ($name->isQualified()) { @@ -211,7 +211,7 @@ class NameContext // No applicable aliases return null; } - private function getNamespaceRelativeName(string $name, string $lcName, int $type) + private function getNamespaceRelativeName(string $name, string $lcName, int $type) : ?Name { if (null === $this->namespace) { return new Name($name); @@ -229,7 +229,7 @@ class NameContext } return null; } - private function normalizeConstName(string $name) + private function normalizeConstName(string $name) : string { $nsSep = \strrpos($name, '\\'); if (\false === $nsSep) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node.php b/vendor/nikic/php-parser/lib/PhpParser/Node.php index 9aabdedfb7c..18e68e7fb7a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node.php @@ -8,19 +8,23 @@ interface Node /** * Gets the type of the node. * + * @psalm-return non-empty-string * @return string Type of the node */ public function getType() : string; /** * Gets the names of the sub nodes. * - * @return array Names of sub nodes + * @return string[] Names of sub nodes */ public function getSubNodeNames() : array; /** * Gets line the node started in (alias of getStartLine). * * @return int Start line (or -1 if not available) + * @phpstan-return -1|positive-int + * + * @deprecated Use getStartLine() instead */ public function getLine() : int; /** @@ -29,6 +33,7 @@ interface Node * Requires the 'startLine' attribute to be enabled in the lexer (enabled by default). * * @return int Start line (or -1 if not available) + * @phpstan-return -1|positive-int */ public function getStartLine() : int; /** @@ -37,6 +42,7 @@ interface Node * Requires the 'endLine' attribute to be enabled in the lexer (enabled by default). * * @return int End line (or -1 if not available) + * @phpstan-return -1|positive-int */ public function getEndLine() : int; /** @@ -88,7 +94,7 @@ interface Node * * @return null|Comment\Doc Doc comment object or null */ - public function getDocComment(); + public function getDocComment() : ?\PhpParser\Comment\Doc; /** * Sets the doc comment of the node. * @@ -96,27 +102,21 @@ interface Node * * @param Comment\Doc $docComment Doc comment to set */ - public function setDocComment(\PhpParser\Comment\Doc $docComment); + public function setDocComment(\PhpParser\Comment\Doc $docComment) : void; /** * Sets an attribute on a node. * - * @param string $key - * @param mixed $value + * @param mixed $value */ - public function setAttribute(string $key, $value); + public function setAttribute(string $key, $value) : void; /** * Returns whether an attribute exists. - * - * @param string $key - * - * @return bool */ public function hasAttribute(string $key) : bool; /** * Returns the value of an attribute. * - * @param string $key - * @param mixed $default + * @param mixed $default * * @return mixed */ @@ -124,13 +124,13 @@ interface Node /** * Returns all the attributes of this node. * - * @return array + * @return array */ public function getAttributes() : array; /** * Replaces all the attributes of this node. * - * @param array $attributes + * @param array $attributes */ - public function setAttributes(array $attributes); + public function setAttributes(array $attributes) : void; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php index 389923700d0..d2b00348aa8 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php @@ -3,25 +3,24 @@ declare (strict_types=1); namespace PhpParser\Node; -use PhpParser\Node\VariadicPlaceholder; use PhpParser\NodeAbstract; class Arg extends NodeAbstract { /** @var Identifier|null Parameter name (for named parameters) */ - public $name; + public ?\PhpParser\Node\Identifier $name; /** @var Expr Value to pass */ - public $value; + public \PhpParser\Node\Expr $value; /** @var bool Whether to pass by ref */ - public $byRef; + public bool $byRef; /** @var bool Whether to unpack the argument */ - public $unpack; + public bool $unpack; /** * Constructs a function call argument node. * - * @param Expr $value Value to pass - * @param bool $byRef Whether to pass by ref - * @param bool $unpack Whether to unpack the argument - * @param array $attributes Additional attributes + * @param Expr $value Value to pass + * @param bool $byRef Whether to pass by ref + * @param bool $unpack Whether to unpack the argument + * @param array $attributes Additional attributes * @param Identifier|null $name Parameter name (for named parameters) */ public function __construct(\PhpParser\Node\Expr $value, bool $byRef = \false, bool $unpack = \false, array $attributes = [], ?\PhpParser\Node\Identifier $name = null) diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php b/vendor/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php new file mode 100644 index 00000000000..e02afda958f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php @@ -0,0 +1,43 @@ + $attributes Additional attributes + */ + public function __construct(\PhpParser\Node\Expr $value, ?\PhpParser\Node\Expr $key = null, bool $byRef = \false, array $attributes = [], bool $unpack = \false) + { + $this->attributes = $attributes; + $this->key = $key; + $this->value = $value; + $this->byRef = $byRef; + $this->unpack = $unpack; + } + public function getSubNodeNames() : array + { + return ['key', 'value', 'byRef', 'unpack']; + } + public function getType() : string + { + return 'ArrayItem'; + } +} +// @deprecated compatibility alias +\class_alias(\PhpParser\Node\ArrayItem::class, \PhpParser\Node\Expr\ArrayItem::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Attribute.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Attribute.php index eaef6eba4c0..c0317f6df0a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Attribute.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Attribute.php @@ -8,13 +8,13 @@ use PhpParser\NodeAbstract; class Attribute extends NodeAbstract { /** @var Name Attribute name */ - public $name; - /** @var Arg[] Attribute arguments */ - public $args; + public \PhpParser\Node\Name $name; + /** @var list Attribute arguments */ + public array $args; /** - * @param Node\Name $name Attribute name - * @param Arg[] $args Attribute arguments - * @param array $attributes Additional node attributes + * @param Node\Name $name Attribute name + * @param list $args Attribute arguments + * @param array $attributes Additional node attributes */ public function __construct(\PhpParser\Node\Name $name, array $args = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php b/vendor/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php index 2033a9fc442..6418285e097 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php @@ -3,15 +3,14 @@ declare (strict_types=1); namespace PhpParser\Node; -use PhpParser\Node; use PhpParser\NodeAbstract; class AttributeGroup extends NodeAbstract { /** @var Attribute[] Attributes */ - public $attrs; + public array $attrs; /** * @param Attribute[] $attrs PHP attributes - * @param array $attributes Additional node attributes + * @param array $attributes Additional node attributes */ public function __construct(array $attrs, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php b/vendor/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php new file mode 100644 index 00000000000..9763c7faa5e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php @@ -0,0 +1,36 @@ + $attributes Additional attributes + */ + public function __construct(\PhpParser\Node\Expr\Variable $var, bool $byRef = \false, array $attributes = []) + { + $this->attributes = $attributes; + $this->var = $var; + $this->byRef = $byRef; + } + public function getSubNodeNames() : array + { + return ['var', 'byRef']; + } + public function getType() : string + { + return 'ClosureUse'; + } +} +// @deprecated compatibility alias +\class_alias(\PhpParser\Node\ClosureUse::class, \PhpParser\Node\Expr\ClosureUse::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php index a6602239b6f..ed8916fb133 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php @@ -7,17 +7,17 @@ use PhpParser\NodeAbstract; class Const_ extends NodeAbstract { /** @var Identifier Name */ - public $name; + public \PhpParser\Node\Identifier $name; /** @var Expr Value */ - public $value; + public \PhpParser\Node\Expr $value; /** @var Name|null Namespaced name (if using NameResolver) */ - public $namespacedName; + public ?\PhpParser\Node\Name $namespacedName; /** * Constructs a const node for use in class const and const statements. * - * @param string|Identifier $name Name - * @param Expr $value Value - * @param array $attributes Additional attributes + * @param string|Identifier $name Name + * @param Expr $value Value + * @param array $attributes Additional attributes */ public function __construct($name, \PhpParser\Node\Expr $value, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php b/vendor/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php new file mode 100644 index 00000000000..9e85e86a445 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php @@ -0,0 +1,37 @@ +value pair node. + * + * @param string|Node\Identifier $key Key + * @param Node\Expr $value Value + * @param array $attributes Additional attributes + */ + public function __construct($key, Node\Expr $value, array $attributes = []) + { + $this->attributes = $attributes; + $this->key = \is_string($key) ? new Node\Identifier($key) : $key; + $this->value = $value; + } + public function getSubNodeNames() : array + { + return ['key', 'value']; + } + public function getType() : string + { + return 'DeclareItem'; + } +} +// @deprecated compatibility alias +\class_alias(\PhpParser\Node\DeclareItem::class, \PhpParser\Node\Stmt\DeclareDeclare::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php index 0447434a58b..796b6e6a3f9 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php @@ -7,15 +7,15 @@ use PhpParser\Node\Expr; class ArrayDimFetch extends Expr { /** @var Expr Variable */ - public $var; + public Expr $var; /** @var null|Expr Array index / dim */ - public $dim; + public ?Expr $dim; /** * Constructs an array index fetch node. * - * @param Expr $var Variable - * @param null|Expr $dim Array index / dim - * @param array $attributes Additional attributes + * @param Expr $var Variable + * @param null|Expr $dim Array index / dim + * @param array $attributes Additional attributes */ public function __construct(Expr $var, ?Expr $dim = null, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php index 37d54057b98..560127c0fdc 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php @@ -1,41 +1,6 @@ attributes = $attributes; - $this->key = $key; - $this->value = $value; - $this->byRef = $byRef; - $this->unpack = $unpack; - } - public function getSubNodeNames() : array - { - return ['key', 'value', 'byRef', 'unpack']; - } - public function getType() : string - { - return 'Expr_ArrayItem'; - } -} +require __DIR__ . '/../ArrayItem.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php index a728e79143b..ca1e83f13f5 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php @@ -3,21 +3,22 @@ declare (strict_types=1); namespace PhpParser\Node\Expr; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; class Array_ extends Expr { // For use in "kind" attribute - const KIND_LONG = 1; + public const KIND_LONG = 1; // array() syntax - const KIND_SHORT = 2; + public const KIND_SHORT = 2; // [] syntax - /** @var (ArrayItem|null)[] Items */ - public $items; + /** @var ArrayItem[] Items */ + public array $items; /** * Constructs an array node. * - * @param (ArrayItem|null)[] $items Items of the array - * @param array $attributes Additional attributes + * @param ArrayItem[] $items Items of the array + * @param array $attributes Additional attributes */ public function __construct(array $items = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php index 31fd306ac25..10c02093b7d 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php @@ -8,36 +8,42 @@ use PhpParser\Node\Expr; use PhpParser\Node\FunctionLike; class ArrowFunction extends Expr implements FunctionLike { - /** @var bool */ - public $static; - /** @var bool */ - public $byRef; + /** @var bool Whether the closure is static */ + public bool $static; + /** @var bool Whether to return by reference */ + public bool $byRef; /** @var Node\Param[] */ - public $params = []; + public array $params = []; /** @var null|Node\Identifier|Node\Name|Node\ComplexType */ - public $returnType; - /** @var Expr */ - public $expr; + public ?Node $returnType; + /** @var Expr Expression body */ + public Expr $expr; /** @var Node\AttributeGroup[] */ - public $attrGroups; + public array $attrGroups; /** - * @param array $subNodes Array of the following optional subnodes: - * 'static' => false : Whether the closure is static - * 'byRef' => false : Whether to return by reference - * 'params' => array() : Parameters - * 'returnType' => null : Return type - * 'expr' => Expr : Expression body - * 'attrGroups' => array() : PHP attribute groups - * @param array $attributes Additional attributes + * @param array{ + * expr: Expr, + * static?: bool, + * byRef?: bool, + * params?: Node\Param[], + * returnType?: null|Node\Identifier|Node\Name|Node\ComplexType, + * attrGroups?: Node\AttributeGroup[] + * } $subNodes Array of the following subnodes: + * 'expr' : Expression body + * 'static' => false : Whether the closure is static + * 'byRef' => false : Whether to return by reference + * 'params' => array() : Parameters + * 'returnType' => null : Return type + * 'attrGroups' => array() : PHP attribute groups + * @param array $attributes Additional attributes */ - public function __construct(array $subNodes = [], array $attributes = []) + public function __construct(array $subNodes, array $attributes = []) { $this->attributes = $attributes; $this->static = $subNodes['static'] ?? \false; $this->byRef = $subNodes['byRef'] ?? \false; $this->params = $subNodes['params'] ?? []; - $returnType = $subNodes['returnType'] ?? null; - $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType; + $this->returnType = $subNodes['returnType'] ?? null; $this->expr = $subNodes['expr']; $this->attrGroups = $subNodes['attrGroups'] ?? []; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php index 1fa7a37c05d..38ceb4cdc26 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php @@ -7,15 +7,15 @@ use PhpParser\Node\Expr; class Assign extends Expr { /** @var Expr Variable */ - public $var; + public Expr $var; /** @var Expr Expression */ - public $expr; + public Expr $expr; /** * Constructs an assignment node. * - * @param Expr $var Variable - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $var Variable + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $var, Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php index 762e6c42f9c..69d61bf9dd0 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php @@ -7,15 +7,15 @@ use PhpParser\Node\Expr; abstract class AssignOp extends Expr { /** @var Expr Variable */ - public $var; + public Expr $var; /** @var Expr Expression */ - public $expr; + public Expr $expr; /** * Constructs a compound assignment operation node. * - * @param Expr $var Variable - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $var Variable + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $var, Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php index 258fef8d01f..029e51a4e3f 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php @@ -7,15 +7,15 @@ use PhpParser\Node\Expr; class AssignRef extends Expr { /** @var Expr Variable reference is assigned to */ - public $var; + public Expr $var; /** @var Expr Variable which is referenced */ - public $expr; + public Expr $expr; /** * Constructs an assignment node. * - * @param Expr $var Variable - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $var Variable + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $var, Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php index 2139c510807..058bbe86b29 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php @@ -7,15 +7,15 @@ use PhpParser\Node\Expr; abstract class BinaryOp extends Expr { /** @var Expr The left hand side expression */ - public $left; + public Expr $left; /** @var Expr The right hand side expression */ - public $right; + public Expr $right; /** * Constructs a binary operator node. * - * @param Expr $left The left hand side expression - * @param Expr $right The right hand side expression - * @param array $attributes Additional attributes + * @param Expr $left The left hand side expression + * @param Expr $right The right hand side expression + * @param array $attributes Additional attributes */ public function __construct(Expr $left, Expr $right, array $attributes = []) { @@ -32,8 +32,6 @@ abstract class BinaryOp extends Expr * * In the case there are multiple possible sigils for an operator, this method does not * necessarily return the one used in the parsed code. - * - * @return string */ public abstract function getOperatorSigil() : string; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php index fa39ab5eef6..fb6f7ceeb1c 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class BitwiseNot extends Expr { /** @var Expr Expression */ - public $expr; + public Expr $expr; /** * Constructs a bitwise not node. * - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php index 5277b5a32e3..ae314305266 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class BooleanNot extends Expr { /** @var Expr Expression */ - public $expr; + public Expr $expr; /** * Constructs a boolean not node. * - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php index bf9ad36bc1a..7928b5ec039 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php @@ -20,12 +20,8 @@ abstract class CallLike extends Expr */ public function isFirstClassCallable() : bool { - foreach ($this->getRawArgs() as $arg) { - if ($arg instanceof VariadicPlaceholder) { - return \true; - } - } - return \false; + $rawArgs = $this->getRawArgs(); + return \count($rawArgs) === 1 && \current($rawArgs) instanceof VariadicPlaceholder; } /** * Assert that this is not a first-class callable and return only ordinary Args. diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php index a27bd7dce80..d81df2326e4 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; abstract class Cast extends Expr { /** @var Expr Expression */ - public $expr; + public Expr $expr; /** * Constructs a cast node. * - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php index 1b0cc9ef8c5..fe82044c47a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php @@ -7,11 +7,11 @@ use PhpParser\Node\Expr\Cast; class Double extends Cast { // For use in "kind" attribute - const KIND_DOUBLE = 1; + public const KIND_DOUBLE = 1; // "double" syntax - const KIND_FLOAT = 2; + public const KIND_FLOAT = 2; // "float" syntax - const KIND_REAL = 3; + public const KIND_REAL = 3; // "real" syntax public function getType() : string { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php index b69262d16b4..ef2f118c56f 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php @@ -3,23 +3,24 @@ declare (strict_types=1); namespace PhpParser\Node\Expr; +use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Identifier; use PhpParser\Node\Name; class ClassConstFetch extends Expr { /** @var Name|Expr Class name */ - public $class; + public Node $class; /** @var Identifier|Expr|Error Constant name */ - public $name; + public Node $name; /** * Constructs a class const fetch node. * - * @param Name|Expr $class Class name - * @param string|Identifier|Expr|Error $name Constant name - * @param array $attributes Additional attributes + * @param Name|Expr $class Class name + * @param string|Identifier|Expr|Error $name Constant name + * @param array $attributes Additional attributes */ - public function __construct($class, $name, array $attributes = []) + public function __construct(Node $class, $name, array $attributes = []) { $this->attributes = $attributes; $this->class = $class; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php index 801bd008189..43cfa94fed5 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class Clone_ extends Expr { /** @var Expr Expression */ - public $expr; + public Expr $expr; /** * Constructs a clone node. * - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php index 40ebccfbd55..8ce8385650f 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php @@ -4,37 +4,46 @@ declare (strict_types=1); namespace PhpParser\Node\Expr; use PhpParser\Node; +use PhpParser\Node\ClosureUse; use PhpParser\Node\Expr; use PhpParser\Node\FunctionLike; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; class Closure extends Expr implements FunctionLike, StmtsAwareInterface { /** @var bool Whether the closure is static */ - public $static; + public bool $static; /** @var bool Whether to return by reference */ - public $byRef; + public bool $byRef; /** @var Node\Param[] Parameters */ - public $params; + public array $params; /** @var ClosureUse[] use()s */ - public $uses; + public array $uses; /** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */ - public $returnType; + public ?Node $returnType; /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** @var Node\AttributeGroup[] PHP attribute groups */ - public $attrGroups; + public array $attrGroups; /** * Constructs a lambda function node. * - * @param array $subNodes Array of the following optional subnodes: - * 'static' => false : Whether the closure is static - * 'byRef' => false : Whether to return by reference - * 'params' => array(): Parameters - * 'uses' => array(): use()s - * 'returnType' => null : Return type - * 'stmts' => array(): Statements - * 'attrGroups' => array(): PHP attributes groups - * @param array $attributes Additional attributes + * @param array{ + * static?: bool, + * byRef?: bool, + * params?: Node\Param[], + * uses?: ClosureUse[], + * returnType?: null|Node\Identifier|Node\Name|Node\ComplexType, + * stmts?: Node\Stmt[], + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'static' => false : Whether the closure is static + * 'byRef' => false : Whether to return by reference + * 'params' => array(): Parameters + * 'uses' => array(): use()s + * 'returnType' => null : Return type + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attributes groups + * @param array $attributes Additional attributes */ public function __construct(array $subNodes = [], array $attributes = []) { @@ -43,8 +52,7 @@ class Closure extends Expr implements FunctionLike, StmtsAwareInterface $this->byRef = $subNodes['byRef'] ?? \false; $this->params = $subNodes['params'] ?? []; $this->uses = $subNodes['uses'] ?? []; - $returnType = $subNodes['returnType'] ?? null; - $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType; + $this->returnType = $subNodes['returnType'] ?? null; $this->stmts = $subNodes['stmts'] ?? []; $this->attrGroups = $subNodes['attrGroups'] ?? []; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php index 4d57956282a..f547f509521 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php @@ -1,34 +1,6 @@ attributes = $attributes; - $this->var = $var; - $this->byRef = $byRef; - } - public function getSubNodeNames() : array - { - return ['var', 'byRef']; - } - public function getType() : string - { - return 'Expr_ClosureUse'; - } -} +require __DIR__ . '/../ClosureUse.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php index 50c1a8a028c..6f902d93379 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php @@ -8,12 +8,12 @@ use PhpParser\Node\Name; class ConstFetch extends Expr { /** @var Name Constant name */ - public $name; + public Name $name; /** * Constructs a const fetch node. * - * @param Name $name Constant name - * @param array $attributes Additional attributes + * @param Name $name Constant name + * @param array $attributes Additional attributes */ public function __construct(Name $name, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php index 220efdbbd63..25f94847994 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class Empty_ extends Expr { /** @var Expr Expression */ - public $expr; + public Expr $expr; /** * Constructs an empty() node. * - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php index f9e673fb122..a3e2bccc188 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php @@ -15,7 +15,7 @@ class Error extends Expr /** * Constructs an error node. * - * @param array $attributes Additional attributes + * @param array $attributes Additional attributes */ public function __construct(array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php index e13c96da861..9b8de6e0767 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class ErrorSuppress extends Expr { /** @var Expr Expression */ - public $expr; + public Expr $expr; /** * Constructs an error suppress node. * - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php index 27989b47238..38caa0b184a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class Eval_ extends Expr { /** @var Expr Expression */ - public $expr; + public Expr $expr; /** * Constructs an eval() node. * - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php index 302c431e455..31093955c65 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php @@ -7,15 +7,15 @@ use PhpParser\Node\Expr; class Exit_ extends Expr { /* For use in "kind" attribute */ - const KIND_EXIT = 1; - const KIND_DIE = 2; + public const KIND_EXIT = 1; + public const KIND_DIE = 2; /** @var null|Expr Expression */ - public $expr; + public ?Expr $expr; /** * Constructs an exit() node. * - * @param null|Expr $expr Expression - * @param array $attributes Additional attributes + * @param null|Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(?Expr $expr = null, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php index 871bd84f1b6..c3249cb4f30 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php @@ -8,17 +8,17 @@ use PhpParser\Node\Expr; class FuncCall extends \PhpParser\Node\Expr\CallLike { /** @var Node\Name|Expr Function name */ - public $name; + public Node $name; /** @var array Arguments */ - public $args; + public array $args; /** * Constructs a function call node. * - * @param Node\Name|Expr $name Function name - * @param array $args Arguments - * @param array $attributes Additional attributes + * @param Node\Name|Expr $name Function name + * @param array $args Arguments + * @param array $attributes Additional attributes */ - public function __construct($name, array $args = [], array $attributes = []) + public function __construct(Node $name, array $args = [], array $attributes = []) { $this->attributes = $attributes; $this->name = $name; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php index 000f87a1a4b..0fbc0659e26 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php @@ -6,20 +6,20 @@ namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; class Include_ extends Expr { - const TYPE_INCLUDE = 1; - const TYPE_INCLUDE_ONCE = 2; - const TYPE_REQUIRE = 3; - const TYPE_REQUIRE_ONCE = 4; + public const TYPE_INCLUDE = 1; + public const TYPE_INCLUDE_ONCE = 2; + public const TYPE_REQUIRE = 3; + public const TYPE_REQUIRE_ONCE = 4; /** @var Expr Expression */ - public $expr; + public Expr $expr; /** @var int Type of include */ - public $type; + public int $type; /** * Constructs an include node. * - * @param Expr $expr Expression - * @param int $type Type of include - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param int $type Type of include + * @param array $attributes Additional attributes */ public function __construct(Expr $expr, int $type, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php index 651e481658c..81a3f1ec920 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php @@ -3,22 +3,23 @@ declare (strict_types=1); namespace PhpParser\Node\Expr; +use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Name; class Instanceof_ extends Expr { /** @var Expr Expression */ - public $expr; + public Expr $expr; /** @var Name|Expr Class name */ - public $class; + public Node $class; /** * Constructs an instanceof check node. * - * @param Expr $expr Expression - * @param Name|Expr $class Class name - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param Name|Expr $class Class name + * @param array $attributes Additional attributes */ - public function __construct(Expr $expr, $class, array $attributes = []) + public function __construct(Expr $expr, Node $class, array $attributes = []) { $this->attributes = $attributes; $this->expr = $expr; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php index f6205e7c455..ed345ea656a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class Isset_ extends Expr { /** @var Expr[] Variables */ - public $vars; + public array $vars; /** * Constructs an array node. * - * @param Expr[] $vars Variables - * @param array $attributes Additional attributes + * @param Expr[] $vars Variables + * @param array $attributes Additional attributes */ public function __construct(array $vars, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php index dfa5a3ade28..51e723c5732 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php @@ -3,16 +3,22 @@ declare (strict_types=1); namespace PhpParser\Node\Expr; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; class List_ extends Expr { + // For use in "kind" attribute + public const KIND_LIST = 1; + // list() syntax + public const KIND_ARRAY = 2; + // [] syntax /** @var (ArrayItem|null)[] List of items to assign to */ - public $items; + public array $items; /** * Constructs a list() destructuring node. * - * @param (ArrayItem|null)[] $items List of items to assign to - * @param array $attributes Additional attributes + * @param (ArrayItem|null)[] $items List of items to assign to + * @param array $attributes Additional attributes */ public function __construct(array $items, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php index c302f171fab..7ad84ee7f07 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php @@ -7,12 +7,14 @@ use PhpParser\Node; use PhpParser\Node\MatchArm; class Match_ extends Node\Expr { - /** @var Node\Expr */ - public $cond; + /** @var Node\Expr Condition */ + public Node\Expr $cond; /** @var MatchArm[] */ - public $arms; + public array $arms; /** + * @param Node\Expr $cond Condition * @param MatchArm[] $arms + * @param array $attributes Additional attributes */ public function __construct(Node\Expr $cond, array $arms = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php index 235181855ef..2e154208eae 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace PhpParser\Node\Expr; +use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; use PhpParser\Node\Identifier; @@ -10,18 +11,18 @@ use PhpParser\Node\VariadicPlaceholder; class MethodCall extends \PhpParser\Node\Expr\CallLike { /** @var Expr Variable holding object */ - public $var; + public Expr $var; /** @var Identifier|Expr Method name */ - public $name; + public Node $name; /** @var array Arguments */ - public $args; + public array $args; /** * Constructs a function call node. * - * @param Expr $var Variable holding object - * @param string|Identifier|Expr $name Method name - * @param array $args Arguments - * @param array $attributes Additional attributes + * @param Expr $var Variable holding object + * @param string|Identifier|Expr $name Method name + * @param array $args Arguments + * @param array $attributes Additional attributes */ public function __construct(Expr $var, $name, array $args = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php index ca1f00462c4..994270de4ea 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php @@ -10,17 +10,17 @@ use PhpParser\Node\VariadicPlaceholder; class New_ extends \PhpParser\Node\Expr\CallLike { /** @var Node\Name|Expr|Node\Stmt\Class_ Class name */ - public $class; + public Node $class; /** @var array Arguments */ - public $args; + public array $args; /** * Constructs a function call node. * - * @param Node\Name|Expr|Node\Stmt\Class_ $class Class name (or class node for anonymous classes) - * @param array $args Arguments - * @param array $attributes Additional attributes + * @param Node\Name|Expr|Node\Stmt\Class_ $class Class name (or class node for anonymous classes) + * @param array $args Arguments + * @param array $attributes Additional attributes */ - public function __construct($class, array $args = [], array $attributes = []) + public function __construct(Node $class, array $args = [], array $attributes = []) { $this->attributes = $attributes; $this->class = $class; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php index fb33349cd59..60946e5b6f6 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace PhpParser\Node\Expr; +use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; use PhpParser\Node\Identifier; @@ -10,18 +11,18 @@ use PhpParser\Node\VariadicPlaceholder; class NullsafeMethodCall extends \PhpParser\Node\Expr\CallLike { /** @var Expr Variable holding object */ - public $var; + public Expr $var; /** @var Identifier|Expr Method name */ - public $name; + public Node $name; /** @var array Arguments */ - public $args; + public array $args; /** * Constructs a nullsafe method call node. * - * @param Expr $var Variable holding object - * @param string|Identifier|Expr $name Method name - * @param array $args Arguments - * @param array $attributes Additional attributes + * @param Expr $var Variable holding object + * @param string|Identifier|Expr $name Method name + * @param array $args Arguments + * @param array $attributes Additional attributes */ public function __construct(Expr $var, $name, array $args = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php index 060834c001f..c2000e8a39d 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php @@ -3,20 +3,21 @@ declare (strict_types=1); namespace PhpParser\Node\Expr; +use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Identifier; class NullsafePropertyFetch extends Expr { /** @var Expr Variable holding object */ - public $var; + public Expr $var; /** @var Identifier|Expr Property name */ - public $name; + public Node $name; /** * Constructs a nullsafe property fetch node. * - * @param Expr $var Variable holding object - * @param string|Identifier|Expr $name Property name - * @param array $attributes Additional attributes + * @param Expr $var Variable holding object + * @param string|Identifier|Expr $name Property name + * @param array $attributes Additional attributes */ public function __construct(Expr $var, $name, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php index e0ab3cbc4ab..07701ba6755 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class PostDec extends Expr { /** @var Expr Variable */ - public $var; + public Expr $var; /** * Constructs a post decrement node. * - * @param Expr $var Variable - * @param array $attributes Additional attributes + * @param Expr $var Variable + * @param array $attributes Additional attributes */ public function __construct(Expr $var, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php index 02576c8839b..7bc25043467 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class PostInc extends Expr { /** @var Expr Variable */ - public $var; + public Expr $var; /** * Constructs a post increment node. * - * @param Expr $var Variable - * @param array $attributes Additional attributes + * @param Expr $var Variable + * @param array $attributes Additional attributes */ public function __construct(Expr $var, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php index a945d1ffee9..efcb1c77e3b 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class PreDec extends Expr { /** @var Expr Variable */ - public $var; + public Expr $var; /** * Constructs a pre decrement node. * - * @param Expr $var Variable - * @param array $attributes Additional attributes + * @param Expr $var Variable + * @param array $attributes Additional attributes */ public function __construct(Expr $var, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php index b02faaa404f..df6212f0b4a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class PreInc extends Expr { /** @var Expr Variable */ - public $var; + public Expr $var; /** * Constructs a pre increment node. * - * @param Expr $var Variable - * @param array $attributes Additional attributes + * @param Expr $var Variable + * @param array $attributes Additional attributes */ public function __construct(Expr $var, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php index d03c390edfc..40e0b902b94 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class Print_ extends Expr { /** @var Expr Expression */ - public $expr; + public Expr $expr; /** * Constructs an print() node. * - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php index 6deb62032f9..41a7dd144d8 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php @@ -3,20 +3,21 @@ declare (strict_types=1); namespace PhpParser\Node\Expr; +use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Identifier; class PropertyFetch extends Expr { /** @var Expr Variable holding object */ - public $var; + public Expr $var; /** @var Identifier|Expr Property name */ - public $name; + public Node $name; /** * Constructs a function call node. * - * @param Expr $var Variable holding object - * @param string|Identifier|Expr $name Property name - * @param array $attributes Additional attributes + * @param Expr $var Variable holding object + * @param string|Identifier|Expr $name Property name + * @param array $attributes Additional attributes */ public function __construct(Expr $var, $name, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php index b7f711edb0a..82ae963d533 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php @@ -4,15 +4,16 @@ declare (strict_types=1); namespace PhpParser\Node\Expr; use PhpParser\Node\Expr; +use PhpParser\Node\InterpolatedStringPart; class ShellExec extends Expr { - /** @var array Encapsed string array */ - public $parts; + /** @var (Expr|InterpolatedStringPart)[] Interpolated string array */ + public array $parts; /** * Constructs a shell exec (backtick) node. * - * @param array $parts Encapsed string array - * @param array $attributes Additional attributes + * @param (Expr|InterpolatedStringPart)[] $parts Interpolated string array + * @param array $attributes Additional attributes */ public function __construct(array $parts, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php index a3675b60fa8..104d511684a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php @@ -11,20 +11,20 @@ use PhpParser\Node\VariadicPlaceholder; class StaticCall extends \PhpParser\Node\Expr\CallLike { /** @var Node\Name|Expr Class name */ - public $class; + public Node $class; /** @var Identifier|Expr Method name */ - public $name; + public Node $name; /** @var array Arguments */ - public $args; + public array $args; /** * Constructs a static method call node. * - * @param Node\Name|Expr $class Class name - * @param string|Identifier|Expr $name Method name - * @param array $args Arguments - * @param array $attributes Additional attributes + * @param Node\Name|Expr $class Class name + * @param string|Identifier|Expr $name Method name + * @param array $args Arguments + * @param array $attributes Additional attributes */ - public function __construct($class, $name, array $args = [], array $attributes = []) + public function __construct(Node $class, $name, array $args = [], array $attributes = []) { $this->attributes = $attributes; $this->class = $class; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php index 86f34304441..aea09556154 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php @@ -3,23 +3,24 @@ declare (strict_types=1); namespace PhpParser\Node\Expr; +use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Name; use PhpParser\Node\VarLikeIdentifier; class StaticPropertyFetch extends Expr { /** @var Name|Expr Class name */ - public $class; + public Node $class; /** @var VarLikeIdentifier|Expr Property name */ - public $name; + public Node $name; /** * Constructs a static property fetch node. * - * @param Name|Expr $class Class name - * @param string|VarLikeIdentifier|Expr $name Property name - * @param array $attributes Additional attributes + * @param Name|Expr $class Class name + * @param string|VarLikeIdentifier|Expr $name Property name + * @param array $attributes Additional attributes */ - public function __construct($class, $name, array $attributes = []) + public function __construct(Node $class, $name, array $attributes = []) { $this->attributes = $attributes; $this->class = $class; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php index 426ba105c06..372650d4b2f 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php @@ -7,20 +7,20 @@ use PhpParser\Node\Expr; class Ternary extends Expr { /** @var Expr Condition */ - public $cond; + public Expr $cond; /** @var null|Expr Expression for true */ - public $if; + public ?Expr $if; /** @var Expr Expression for false */ - public $else; + public Expr $else; /** * Constructs a ternary operator node. * - * @param Expr $cond Condition - * @param null|Expr $if Expression for true - * @param Expr $else Expression for false - * @param array $attributes Additional attributes + * @param Expr $cond Condition + * @param null|Expr $if Expression for true + * @param Expr $else Expression for false + * @param array $attributes Additional attributes */ - public function __construct(Expr $cond, $if, Expr $else, array $attributes = []) + public function __construct(Expr $cond, ?Expr $if, Expr $else, array $attributes = []) { $this->attributes = $attributes; $this->cond = $cond; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php index 6f7c91edabf..c43ce56f65c 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php @@ -7,12 +7,12 @@ use PhpParser\Node; class Throw_ extends Node\Expr { /** @var Node\Expr Expression */ - public $expr; + public Node\Expr $expr; /** * Constructs a throw expression node. * - * @param Node\Expr $expr Expression - * @param array $attributes Additional attributes + * @param Node\Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Node\Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php index b933fdd8213..bcf32ae3ad6 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class UnaryMinus extends Expr { /** @var Expr Expression */ - public $expr; + public Expr $expr; /** * Constructs a unary minus node. * - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php index 916f50a8ca3..92e555db509 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class UnaryPlus extends Expr { /** @var Expr Expression */ - public $expr; + public Expr $expr; /** * Constructs a unary plus node. * - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php index 97d884e06b7..6903b812eea 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php @@ -11,8 +11,8 @@ class Variable extends Expr /** * Constructs a variable node. * - * @param string|Expr $name Name - * @param array $attributes Additional attributes + * @param string|Expr $name Name + * @param array $attributes Additional attributes */ public function __construct($name, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php index 8149a09db0c..a92fcbe9df9 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php @@ -7,12 +7,12 @@ use PhpParser\Node\Expr; class YieldFrom extends Expr { /** @var Expr Expression to yield from */ - public $expr; + public Expr $expr; /** * Constructs an "yield from" node. * - * @param Expr $expr Expression - * @param array $attributes Additional attributes + * @param Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php index ced4c68b47e..86a96420003 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php @@ -7,15 +7,15 @@ use PhpParser\Node\Expr; class Yield_ extends Expr { /** @var null|Expr Key expression */ - public $key; + public ?Expr $key; /** @var null|Expr Value expression */ - public $value; + public ?Expr $value; /** * Constructs a yield expression node. * - * @param null|Expr $value Value expression - * @param null|Expr $key Key expression - * @param array $attributes Additional attributes + * @param null|Expr $value Value expression + * @param null|Expr $key Key expression + * @param array $attributes Additional attributes */ public function __construct(?Expr $value = null, ?Expr $key = null, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php b/vendor/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php index 74554375d48..81c7431b9f3 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php @@ -8,8 +8,6 @@ interface FunctionLike extends Node { /** * Whether to return by reference - * - * @return bool */ public function returnsByRef() : bool; /** @@ -29,7 +27,7 @@ interface FunctionLike extends Node * * @return Stmt[]|null */ - public function getStmts(); + public function getStmts() : ?array; /** * Get PHP attribute groups. * diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php index 54245ba5d0e..eaf36619a98 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php @@ -9,17 +9,24 @@ use PhpParser\NodeAbstract; */ class Identifier extends NodeAbstract { - /** @var string Identifier as string */ - public $name; - private static $specialClassNames = ['self' => \true, 'parent' => \true, 'static' => \true]; + /** + * @psalm-var non-empty-string + * @var string Identifier as string + */ + public string $name; + /** @var array */ + private static array $specialClassNames = ['self' => \true, 'parent' => \true, 'static' => \true]; /** * Constructs an identifier node. * - * @param string $name Identifier as string - * @param array $attributes Additional attributes + * @param string $name Identifier as string + * @param array $attributes Additional attributes */ public function __construct(string $name, array $attributes = []) { + if ($name === '') { + throw new \InvalidArgumentException('Identifier name cannot be empty'); + } $this->attributes = $attributes; $this->name = $name; } @@ -30,6 +37,7 @@ class Identifier extends NodeAbstract /** * Get identifier as string. * + * @psalm-return non-empty-string * @return string Identifier as string. */ public function toString() : string @@ -39,6 +47,7 @@ class Identifier extends NodeAbstract /** * Get lowercased identifier as string. * + * @psalm-return non-empty-string * @return string Lowercased identifier as string */ public function toLowerString() : string @@ -57,6 +66,7 @@ class Identifier extends NodeAbstract /** * Get identifier as string. * + * @psalm-return non-empty-string * @return string Identifier as string */ public function __toString() : string diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php b/vendor/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php new file mode 100644 index 00000000000..7596b15f60d --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php @@ -0,0 +1,32 @@ + $attributes Additional attributes + */ + public function __construct(string $value, array $attributes = []) + { + $this->attributes = $attributes; + $this->value = $value; + } + public function getSubNodeNames() : array + { + return ['value']; + } + public function getType() : string + { + return 'InterpolatedStringPart'; + } +} +// @deprecated compatibility alias +\class_alias(\PhpParser\Node\InterpolatedStringPart::class, \PhpParser\Node\Scalar\EncapsedStringPart::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php b/vendor/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php index 3912fb79846..d0625df034a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php @@ -3,16 +3,15 @@ declare (strict_types=1); namespace PhpParser\Node; -use PhpParser\NodeAbstract; class IntersectionType extends \PhpParser\Node\ComplexType { /** @var (Identifier|Name)[] Types */ - public $types; + public array $types; /** * Constructs an intersection type. * - * @param (Identifier|Name)[] $types Types - * @param array $attributes Additional attributes + * @param (Identifier|Name)[] $types Types + * @param array $attributes Additional attributes */ public function __construct(array $types, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/MatchArm.php b/vendor/nikic/php-parser/lib/PhpParser/Node/MatchArm.php index 7ad2f398e79..1685fe39663 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/MatchArm.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/MatchArm.php @@ -7,14 +7,14 @@ use PhpParser\Node; use PhpParser\NodeAbstract; class MatchArm extends NodeAbstract { - /** @var null|Node\Expr[] */ - public $conds; + /** @var null|list */ + public ?array $conds; /** @var Node\Expr */ - public $body; + public \PhpParser\Node\Expr $body; /** - * @param null|Node\Expr[] $conds + * @param null|list $conds */ - public function __construct($conds, Node\Expr $body, array $attributes = []) + public function __construct(?array $conds, Node\Expr $body, array $attributes = []) { $this->conds = $conds; $this->body = $body; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php index 30f95099ea4..c86e9618ab4 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php @@ -7,34 +7,36 @@ use PhpParser\NodeAbstract; class Name extends NodeAbstract { /** - * @var string[] Parts of the name - * @deprecated Use getParts() instead + * @psalm-var non-empty-string + * @var string Name as string */ - public $parts; - private static $specialClassNames = ['self' => \true, 'parent' => \true, 'static' => \true]; + public string $name; + /** @var array */ + private static array $specialClassNames = ['self' => \true, 'parent' => \true, 'static' => \true]; /** * Constructs a name node. * - * @param string|string[]|self $name Name as string, part array or Name instance (copy ctor) - * @param array $attributes Additional attributes + * @param string|string[]|self $name Name as string, part array or Name instance (copy ctor) + * @param array $attributes Additional attributes */ - public function __construct($name, array $attributes = []) + public final function __construct($name, array $attributes = []) { $this->attributes = $attributes; - $this->parts = self::prepareName($name); + $this->name = self::prepareName($name); } public function getSubNodeNames() : array { - return ['parts']; + return ['name']; } /** * Get parts of name (split by the namespace separator). * + * @psalm-return non-empty-list * @return string[] Parts of name */ public function getParts() : array { - return $this->parts; + return \explode('\\', $this->name); } /** * Gets the first part of the name, i.e. everything before the first namespace separator. @@ -43,7 +45,10 @@ class Name extends NodeAbstract */ public function getFirst() : string { - return $this->parts[0]; + if (\false !== ($pos = \strpos($this->name, '\\'))) { + return \substr($this->name, 0, $pos); + } + return $this->name; } /** * Gets the last part of the name, i.e. everything after the last namespace separator. @@ -52,7 +57,10 @@ class Name extends NodeAbstract */ public function getLast() : string { - return $this->parts[\count($this->parts) - 1]; + if (\false !== ($pos = \strrpos($this->name, '\\'))) { + return \substr($this->name, $pos + 1); + } + return $this->name; } /** * Checks whether the name is unqualified. (E.g. Name) @@ -61,7 +69,7 @@ class Name extends NodeAbstract */ public function isUnqualified() : bool { - return 1 === \count($this->parts); + return \false === \strpos($this->name, '\\'); } /** * Checks whether the name is qualified. (E.g. Name\Name) @@ -70,7 +78,7 @@ class Name extends NodeAbstract */ public function isQualified() : bool { - return 1 < \count($this->parts); + return \false !== \strpos($this->name, '\\'); } /** * Checks whether the name is fully qualified. (E.g. \Name) @@ -94,16 +102,18 @@ class Name extends NodeAbstract * Returns a string representation of the name itself, without taking the name type into * account (e.g., not including a leading backslash for fully qualified names). * + * @psalm-return non-empty-string * @return string String representation */ public function toString() : string { - return \implode('\\', $this->parts); + return $this->name; } /** * Returns a string representation of the name as it would occur in code (e.g., including * leading backslash for fully qualified names. * + * @psalm-return non-empty-string * @return string String representation */ public function toCodeString() : string @@ -114,11 +124,12 @@ class Name extends NodeAbstract * Returns lowercased string representation of the name, without taking the name type into * account (e.g., no leading backslash for fully qualified names). * + * @psalm-return non-empty-string * @return string Lowercased string representation */ public function toLowerString() : string { - return \strtolower(\implode('\\', $this->parts)); + return \strtolower($this->name); } /** * Checks whether the identifier is a special class name (self, parent or static). @@ -127,17 +138,18 @@ class Name extends NodeAbstract */ public function isSpecialClassName() : bool { - return \count($this->parts) === 1 && isset(self::$specialClassNames[\strtolower($this->parts[0])]); + return isset(self::$specialClassNames[\strtolower($this->name)]); } /** * Returns a string representation of the name by imploding the namespace parts with the * namespace separator. * + * @psalm-return non-empty-string * @return string String representation */ public function __toString() : string { - return \implode('\\', $this->parts); + return $this->name; } /** * Gets a slice of a name (similar to array_slice). @@ -150,14 +162,22 @@ class Name extends NodeAbstract * * Offset and length have the same meaning as in array_slice(). * - * @param int $offset Offset to start the slice at (may be negative) + * @param int $offset Offset to start the slice at (may be negative) * @param int|null $length Length of the slice (may be negative) * * @return static|null Sliced name */ public function slice(int $offset, ?int $length = null) { - $numParts = \count($this->parts); + if ($offset === 1 && $length === null) { + // Short-circuit the common case. + if (\false !== ($pos = \strpos($this->name, '\\'))) { + return new static(\substr($this->name, $pos + 1)); + } + return null; + } + $parts = \explode('\\', $this->name); + $numParts = \count($parts); $realOffset = $offset < 0 ? $offset + $numParts : $offset; if ($realOffset < 0 || $realOffset > $numParts) { throw new \OutOfBoundsException(\sprintf('Offset %d is out of bounds', $offset)); @@ -174,7 +194,7 @@ class Name extends NodeAbstract // Empty slice is represented as null return null; } - return new static(\array_slice($this->parts, $realOffset, $realLength), $this->attributes); + return new static(\array_slice($parts, $realOffset, $realLength), $this->attributes); } /** * Concatenate two names, yielding a new Name instance. @@ -187,9 +207,9 @@ class Name extends NodeAbstract * Name::concat($namespace, $shortName) * where $namespace is a Name node or null will work as expected. * - * @param string|string[]|self|null $name1 The first name - * @param string|string[]|self|null $name2 The second name - * @param array $attributes Attributes to assign to concatenated name + * @param string|string[]|self|null $name1 The first name + * @param string|string[]|self|null $name2 The second name + * @param array $attributes Attributes to assign to concatenated name * * @return static|null Concatenated name */ @@ -197,36 +217,41 @@ class Name extends NodeAbstract { if (null === $name1 && null === $name2) { return null; - } elseif (null === $name1) { - return new static(self::prepareName($name2), $attributes); - } elseif (null === $name2) { - return new static(self::prepareName($name1), $attributes); + } + if (null === $name1) { + return new static($name2, $attributes); + } + if (null === $name2) { + return new static($name1, $attributes); } else { - return new static(\array_merge(self::prepareName($name1), self::prepareName($name2)), $attributes); + return new static(self::prepareName($name1) . '\\' . self::prepareName($name2), $attributes); } } /** * Prepares a (string, array or Name node) name for use in name changing methods by converting - * it to an array. + * it to a string. * * @param string|string[]|self $name Name to prepare * - * @return string[] Prepared name + * @psalm-return non-empty-string + * @return string Prepared name */ - private static function prepareName($name) : array + private static function prepareName($name) : string { if (\is_string($name)) { if ('' === $name) { throw new \InvalidArgumentException('Name cannot be empty'); } - return \explode('\\', $name); - } elseif (\is_array($name)) { + return $name; + } + if (\is_array($name)) { if (empty($name)) { throw new \InvalidArgumentException('Name cannot be empty'); } - return $name; - } elseif ($name instanceof self) { - return $name->parts; + return \implode('\\', $name); + } + if ($name instanceof self) { + return $name->name; } throw new \InvalidArgumentException('Expected string, array of parts or Name instance'); } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php b/vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php index 0fa0d59fbe4..dda5f6bfedd 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php @@ -3,20 +3,21 @@ declare (strict_types=1); namespace PhpParser\Node; +use PhpParser\Node; class NullableType extends \PhpParser\Node\ComplexType { /** @var Identifier|Name Type */ - public $type; + public Node $type; /** * Constructs a nullable type (wrapping another type). * - * @param string|Identifier|Name $type Type - * @param array $attributes Additional attributes + * @param Identifier|Name $type Type + * @param array $attributes Additional attributes */ - public function __construct($type, array $attributes = []) + public function __construct(Node $type, array $attributes = []) { $this->attributes = $attributes; - $this->type = \is_string($type) ? new \PhpParser\Node\Identifier($type) : $type; + $this->type = $type; } public function getSubNodeNames() : array { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php index 4718e9b3d86..0b7b256161f 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php @@ -3,52 +3,102 @@ declare (strict_types=1); namespace PhpParser\Node; +use PhpParser\Modifiers; +use PhpParser\Node; use PhpParser\NodeAbstract; class Param extends NodeAbstract { /** @var null|Identifier|Name|ComplexType Type declaration */ - public $type; + public ?Node $type; /** @var bool Whether parameter is passed by reference */ - public $byRef; + public bool $byRef; /** @var bool Whether this is a variadic argument */ - public $variadic; + public bool $variadic; /** @var Expr\Variable|Expr\Error Parameter variable */ - public $var; + public \PhpParser\Node\Expr $var; /** @var null|Expr Default value */ - public $default; - /** @var int */ - public $flags; + public ?\PhpParser\Node\Expr $default; + /** @var int Optional visibility flags */ + public int $flags; /** @var AttributeGroup[] PHP attribute groups */ - public $attrGroups; + public array $attrGroups; + /** @var PropertyHook[] Property hooks for promoted properties */ + public array $hooks; /** * Constructs a parameter node. * - * @param Expr\Variable|Expr\Error $var Parameter variable - * @param null|Expr $default Default value - * @param null|string|Identifier|Name|ComplexType $type Type declaration - * @param bool $byRef Whether is passed by reference - * @param bool $variadic Whether this is a variadic argument - * @param array $attributes Additional attributes - * @param int $flags Optional visibility flags - * @param AttributeGroup[] $attrGroups PHP attribute groups + * @param Expr\Variable|Expr\Error $var Parameter variable + * @param null|Expr $default Default value + * @param null|Identifier|Name|ComplexType $type Type declaration + * @param bool $byRef Whether is passed by reference + * @param bool $variadic Whether this is a variadic argument + * @param array $attributes Additional attributes + * @param int $flags Optional visibility flags + * @param list $attrGroups PHP attribute groups + * @param PropertyHook[] $hooks Property hooks for promoted properties */ - public function __construct($var, ?\PhpParser\Node\Expr $default = null, $type = null, bool $byRef = \false, bool $variadic = \false, array $attributes = [], int $flags = 0, array $attrGroups = []) + public function __construct(\PhpParser\Node\Expr $var, ?\PhpParser\Node\Expr $default = null, ?Node $type = null, bool $byRef = \false, bool $variadic = \false, array $attributes = [], int $flags = 0, array $attrGroups = [], array $hooks = []) { $this->attributes = $attributes; - $this->type = \is_string($type) ? new \PhpParser\Node\Identifier($type) : $type; + $this->type = $type; $this->byRef = $byRef; $this->variadic = $variadic; $this->var = $var; $this->default = $default; $this->flags = $flags; $this->attrGroups = $attrGroups; + $this->hooks = $hooks; } public function getSubNodeNames() : array { - return ['attrGroups', 'flags', 'type', 'byRef', 'variadic', 'var', 'default']; + return ['attrGroups', 'flags', 'type', 'byRef', 'variadic', 'var', 'default', 'hooks']; } public function getType() : string { return 'Param'; } + /** + * Whether this parameter uses constructor property promotion. + */ + public function isPromoted() : bool + { + return $this->flags !== 0; + } + public function isPublic() : bool + { + return (bool) ($this->flags & Modifiers::PUBLIC); + } + public function isProtected() : bool + { + return (bool) ($this->flags & Modifiers::PROTECTED); + } + public function isPrivate() : bool + { + return (bool) ($this->flags & Modifiers::PRIVATE); + } + public function isReadonly() : bool + { + return (bool) ($this->flags & Modifiers::READONLY); + } + /** + * Whether the promoted property has explicit public(set) visibility. + */ + public function isPublicSet() : bool + { + return (bool) ($this->flags & Modifiers::PUBLIC_SET); + } + /** + * Whether the promoted property has explicit protected(set) visibility. + */ + public function isProtectedSet() : bool + { + return (bool) ($this->flags & Modifiers::PROTECTED_SET); + } + /** + * Whether the promoted property has explicit private(set) visibility. + */ + public function isPrivateSet() : bool + { + return (bool) ($this->flags & Modifiers::PRIVATE_SET); + } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyHook.php b/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyHook.php new file mode 100644 index 00000000000..780ee870e30 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyHook.php @@ -0,0 +1,79 @@ + false : Whether hook returns by reference + * 'params' => array(): Parameters + * 'attrGroups' => array(): PHP attribute groups + * @param array $attributes Additional attributes + */ + public function __construct($name, $body, array $subNodes = [], array $attributes = []) + { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new \PhpParser\Node\Identifier($name) : $name; + $this->body = $body; + $this->flags = $subNodes['flags'] ?? 0; + $this->byRef = $subNodes['byRef'] ?? \false; + $this->params = $subNodes['params'] ?? []; + $this->attrGroups = $subNodes['attrGroups'] ?? []; + } + public function returnsByRef() : bool + { + return $this->byRef; + } + public function getParams() : array + { + return $this->params; + } + public function getReturnType() + { + return null; + } + public function getStmts() : ?array + { + if ($this->body instanceof \PhpParser\Node\Expr) { + return [new Return_($this->body)]; + } + return $this->body; + } + public function getAttrGroups() : array + { + return $this->attrGroups; + } + public function getType() : string + { + return 'PropertyHook'; + } + public function getSubNodeNames() : array + { + return ['attrGroups', 'flags', 'byRef', 'name', 'params', 'body']; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php b/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php new file mode 100644 index 00000000000..c26e2642258 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php @@ -0,0 +1,37 @@ + $attributes Additional attributes + */ + public function __construct($name, ?Node\Expr $default = null, array $attributes = []) + { + $this->attributes = $attributes; + $this->name = \is_string($name) ? new Node\VarLikeIdentifier($name) : $name; + $this->default = $default; + } + public function getSubNodeNames() : array + { + return ['name', 'default']; + } + public function getType() : string + { + return 'PropertyItem'; + } +} +// @deprecated compatibility alias +\class_alias(\PhpParser\Node\PropertyItem::class, \PhpParser\Node\Stmt\PropertyProperty::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php index 1fb87574ad8..5d0612a9bad 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php @@ -1,71 +1,6 @@ attributes = $attributes; - $this->value = $value; - } - public function getSubNodeNames() : array - { - return ['value']; - } - /** - * @param mixed[] $attributes - */ - public static function fromString(string $str, array $attributes = []) : \PhpParser\Node\Scalar\DNumber - { - $attributes['rawValue'] = $str; - $float = self::parse($str); - return new \PhpParser\Node\Scalar\DNumber($float, $attributes); - } - /** - * @internal - * - * Parses a DNUMBER token like PHP would. - * - * @param string $str A string number - * - * @return float The parsed number - */ - public static function parse(string $str) : float - { - $str = \str_replace('_', '', $str); - // Check whether this is one of the special integer notations. - if ('0' === $str[0]) { - // hex - if ('x' === $str[1] || 'X' === $str[1]) { - return \hexdec($str); - } - // bin - if ('b' === $str[1] || 'B' === $str[1]) { - return \bindec($str); - } - // oct, but only if the string does not contain any of '.eE'. - if (\false === \strpbrk($str, '.eE')) { - // substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit - // (8 or 9) so that only the digits before that are used. - return \octdec(\substr($str, 0, \strcspn($str, '89'))); - } - } - // dec - return (float) $str; - } - public function getType() : string - { - return 'Scalar_DNumber'; - } -} +require __DIR__ . '/Float_.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php index 6e28cd7d7d9..3c8e0fde0ad 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php @@ -1,31 +1,6 @@ attributes = $attributes; - $this->parts = $parts; - } - public function getSubNodeNames() : array - { - return ['parts']; - } - public function getType() : string - { - return 'Scalar_Encapsed'; - } -} +require __DIR__ . '/InterpolatedString.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php index 3f066aad910..d44b5ea185a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php @@ -1,30 +1,6 @@ attributes = $attributes; - $this->value = $value; - } - public function getSubNodeNames() : array - { - return ['value']; - } - public function getType() : string - { - return 'Scalar_EncapsedStringPart'; - } -} +require __DIR__ . '/../InterpolatedStringPart.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php new file mode 100644 index 00000000000..ea964187275 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php @@ -0,0 +1,73 @@ + $attributes Additional attributes + */ + public function __construct(float $value, array $attributes = []) + { + $this->attributes = $attributes; + $this->value = $value; + } + public function getSubNodeNames() : array + { + return ['value']; + } + /** + * @param mixed[] $attributes + */ + public static function fromString(string $str, array $attributes = []) : \PhpParser\Node\Scalar\Float_ + { + $attributes['rawValue'] = $str; + $float = self::parse($str); + return new \PhpParser\Node\Scalar\Float_($float, $attributes); + } + /** + * @internal + * + * Parses a DNUMBER token like PHP would. + * + * @param string $str A string number + * + * @return float The parsed number + */ + public static function parse(string $str) : float + { + $str = \str_replace('_', '', $str); + // Check whether this is one of the special integer notations. + if ('0' === $str[0]) { + // hex + if ('x' === $str[1] || 'X' === $str[1]) { + return \hexdec($str); + } + // bin + if ('b' === $str[1] || 'B' === $str[1]) { + return \bindec($str); + } + // oct, but only if the string does not contain any of '.eE'. + if (\false === \strpbrk($str, '.eE')) { + // substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit + // (8 or 9) so that only the digits before that are used. + return \octdec(\substr($str, 0, \strcspn($str, '89'))); + } + } + // dec + return (float) $str; + } + public function getType() : string + { + return 'Scalar_Float'; + } +} +// @deprecated compatibility alias +\class_alias(\PhpParser\Node\Scalar\Float_::class, \PhpParser\Node\Scalar\DNumber::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php new file mode 100644 index 00000000000..4010d5a08a2 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php @@ -0,0 +1,74 @@ + $attributes Additional attributes + */ + public function __construct(int $value, array $attributes = []) + { + $this->attributes = $attributes; + $this->value = $value; + } + public function getSubNodeNames() : array + { + return ['value']; + } + /** + * Constructs an Int node from a string number literal. + * + * @param string $str String number literal (decimal, octal, hex or binary) + * @param array $attributes Additional attributes + * @param bool $allowInvalidOctal Whether to allow invalid octal numbers (PHP 5) + * + * @return Int_ The constructed LNumber, including kind attribute + */ + public static function fromString(string $str, array $attributes = [], bool $allowInvalidOctal = \false) : \PhpParser\Node\Scalar\Int_ + { + $attributes['rawValue'] = $str; + $str = \str_replace('_', '', $str); + if ('0' !== $str[0] || '0' === $str) { + $attributes['kind'] = \PhpParser\Node\Scalar\Int_::KIND_DEC; + return new \PhpParser\Node\Scalar\Int_((int) $str, $attributes); + } + if ('x' === $str[1] || 'X' === $str[1]) { + $attributes['kind'] = \PhpParser\Node\Scalar\Int_::KIND_HEX; + return new \PhpParser\Node\Scalar\Int_(\hexdec($str), $attributes); + } + if ('b' === $str[1] || 'B' === $str[1]) { + $attributes['kind'] = \PhpParser\Node\Scalar\Int_::KIND_BIN; + return new \PhpParser\Node\Scalar\Int_(\bindec($str), $attributes); + } + if (!$allowInvalidOctal && \strpbrk($str, '89')) { + throw new Error('Invalid numeric literal', $attributes); + } + // Strip optional explicit octal prefix. + if ('o' === $str[1] || 'O' === $str[1]) { + $str = \substr($str, 2); + } + // use intval instead of octdec to get proper cutting behavior with malformed numbers + $attributes['kind'] = \PhpParser\Node\Scalar\Int_::KIND_OCT; + return new \PhpParser\Node\Scalar\Int_(\intval($str, 8), $attributes); + } + public function getType() : string + { + return 'Scalar_Int'; + } +} +// @deprecated compatibility alias +\class_alias(\PhpParser\Node\Scalar\Int_::class, \PhpParser\Node\Scalar\LNumber::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php new file mode 100644 index 00000000000..beb65bc3953 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php @@ -0,0 +1,34 @@ + $attributes Additional attributes + */ + public function __construct(array $parts, array $attributes = []) + { + $this->attributes = $attributes; + $this->parts = $parts; + } + public function getSubNodeNames() : array + { + return ['parts']; + } + public function getType() : string + { + return 'Scalar_InterpolatedString'; + } +} +// @deprecated compatibility alias +\class_alias(\PhpParser\Node\Scalar\InterpolatedString::class, \PhpParser\Node\Scalar\Encapsed::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php index 5c257595094..6f579089de7 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php @@ -1,72 +1,6 @@ attributes = $attributes; - $this->value = $value; - } - public function getSubNodeNames() : array - { - return ['value']; - } - /** - * Constructs an LNumber node from a string number literal. - * - * @param string $str String number literal (decimal, octal, hex or binary) - * @param array $attributes Additional attributes - * @param bool $allowInvalidOctal Whether to allow invalid octal numbers (PHP 5) - * - * @return LNumber The constructed LNumber, including kind attribute - */ - public static function fromString(string $str, array $attributes = [], bool $allowInvalidOctal = \false) : \PhpParser\Node\Scalar\LNumber - { - $attributes['rawValue'] = $str; - $str = \str_replace('_', '', $str); - if ('0' !== $str[0] || '0' === $str) { - $attributes['kind'] = \PhpParser\Node\Scalar\LNumber::KIND_DEC; - return new \PhpParser\Node\Scalar\LNumber((int) $str, $attributes); - } - if ('x' === $str[1] || 'X' === $str[1]) { - $attributes['kind'] = \PhpParser\Node\Scalar\LNumber::KIND_HEX; - return new \PhpParser\Node\Scalar\LNumber(\hexdec($str), $attributes); - } - if ('b' === $str[1] || 'B' === $str[1]) { - $attributes['kind'] = \PhpParser\Node\Scalar\LNumber::KIND_BIN; - return new \PhpParser\Node\Scalar\LNumber(\bindec($str), $attributes); - } - if (!$allowInvalidOctal && \strpbrk($str, '89')) { - throw new Error('Invalid numeric literal', $attributes); - } - // Strip optional explicit octal prefix. - if ('o' === $str[1] || 'O' === $str[1]) { - $str = \substr($str, 2); - } - // use intval instead of octdec to get proper cutting behavior with malformed numbers - $attributes['kind'] = \PhpParser\Node\Scalar\LNumber::KIND_OCT; - return new \PhpParser\Node\Scalar\LNumber(\intval($str, 8), $attributes); - } - public function getType() : string - { - return 'Scalar_LNumber'; - } -} +require __DIR__ . '/Int_.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php index c254461a1fa..e9e131e1e7b 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php @@ -9,7 +9,7 @@ abstract class MagicConst extends Scalar /** * Constructs a magic constant node. * - * @param array $attributes Additional attributes + * @param array $attributes Additional attributes */ public function __construct(array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Property.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Property.php new file mode 100644 index 00000000000..69f78f1bba6 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Property.php @@ -0,0 +1,17 @@ + '\\', '$' => '$', 'n' => "\n", 'r' => "\r", 't' => "\t", 'f' => "\f", 'v' => "\v", 'e' => "\x1b"]; + public string $value; + /** @var array Escaped character to its decoded value */ + protected static array $replacements = ['\\' => '\\', '$' => '$', 'n' => "\n", 'r' => "\r", 't' => "\t", 'f' => "\f", 'v' => "\v", 'e' => "\x1b"]; /** * Constructs a string scalar node. * - * @param string $value Value of the string - * @param array $attributes Additional attributes + * @param string $value Value of the string + * @param array $attributes Additional attributes */ public function __construct(string $value, array $attributes = []) { @@ -31,6 +32,7 @@ class String_ extends Scalar return ['value']; } /** + * @param array $attributes * @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes */ public static function fromString(string $str, array $attributes = [], bool $parseUnicodeEscape = \true) : self @@ -67,13 +69,13 @@ class String_ extends Scalar * * Parses escape sequences in strings (all string types apart from single quoted). * - * @param string $str String without quotes + * @param string $str String without quotes * @param null|string $quote Quote type * @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes * * @return string String with escape sequences parsed */ - public static function parseEscapeSequences(string $str, $quote, bool $parseUnicodeEscape = \true) : string + public static function parseEscapeSequences(string $str, ?string $quote, bool $parseUnicodeEscape = \true) : string { if (null !== $quote) { $str = \str_replace('\\' . $quote, $quote, $str); @@ -86,10 +88,14 @@ class String_ extends Scalar $str = $matches[1]; if (isset(self::$replacements[$str])) { return self::$replacements[$str]; - } elseif ('x' === $str[0] || 'X' === $str[0]) { + } + if ('x' === $str[0] || 'X' === $str[0]) { return \chr(\hexdec(\substr($str, 1))); - } elseif ('u' === $str[0]) { - return self::codePointToUtf8(\hexdec($matches[2])); + } + if ('u' === $str[0]) { + $dec = \hexdec($matches[2]); + // If it overflowed to float, treat as INT_MAX, it will throw an error anyway. + return self::codePointToUtf8(\is_int($dec) ? $dec : \PHP_INT_MAX); } else { return \chr(\octdec($str)); } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/StaticVar.php b/vendor/nikic/php-parser/lib/PhpParser/Node/StaticVar.php new file mode 100644 index 00000000000..f90b36a172a --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/StaticVar.php @@ -0,0 +1,37 @@ + $attributes Additional attributes + */ + public function __construct(\PhpParser\Node\Expr\Variable $var, ?Node\Expr $default = null, array $attributes = []) + { + $this->attributes = $attributes; + $this->var = $var; + $this->default = $default; + } + public function getSubNodeNames() : array + { + return ['var', 'default']; + } + public function getType() : string + { + return 'StaticVar'; + } +} +// @deprecated compatibility alias +\class_alias(\PhpParser\Node\StaticVar::class, \PhpParser\Node\Stmt\StaticVar::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php new file mode 100644 index 00000000000..dfa99d289a3 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php @@ -0,0 +1,30 @@ + $attributes Additional attributes + */ + public function __construct(array $stmts, array $attributes = []) + { + $this->attributes = $attributes; + $this->stmts = $stmts; + } + public function getType() : string + { + return 'Stmt_Block'; + } + public function getSubNodeNames() : array + { + return ['stmts']; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php index 4a8ad5b0b24..5fda910ed4b 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php @@ -7,12 +7,12 @@ use PhpParser\Node; class Break_ extends Node\Stmt { /** @var null|Node\Expr Number of loops to break */ - public $num; + public ?Node\Expr $num; /** * Constructs a break node. * - * @param null|Node\Expr $num Number of loops to break - * @param array $attributes Additional attributes + * @param null|Node\Expr $num Number of loops to break + * @param array $attributes Additional attributes */ public function __construct(?Node\Expr $num = null, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php index b0dc4dc7cbe..84da7bb39f3 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php @@ -4,20 +4,21 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Case_ extends Node\Stmt implements \Rector\Contract\PhpParser\Node\StmtsAwareInterface +use Rector\Contract\PhpParser\Node\StmtsAwareInterface; +class Case_ extends Node\Stmt implements StmtsAwareInterface { /** @var null|Node\Expr Condition (null for default) */ - public $cond; + public ?Node\Expr $cond; /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** * Constructs a case node. * - * @param null|Node\Expr $cond Condition (null for default) - * @param Node\Stmt[] $stmts Statements - * @param array $attributes Additional attributes + * @param null|Node\Expr $cond Condition (null for default) + * @param Node\Stmt[] $stmts Statements + * @param array $attributes Additional attributes */ - public function __construct($cond, array $stmts = [], array $attributes = []) + public function __construct(?Node\Expr $cond, array $stmts = [], array $attributes = []) { $this->attributes = $attributes; $this->cond = $cond; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php index 7b7087713a8..162eb740e2d 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php @@ -9,18 +9,18 @@ use Rector\Contract\PhpParser\Node\StmtsAwareInterface; class Catch_ extends Node\Stmt implements StmtsAwareInterface { /** @var Node\Name[] Types of exceptions to catch */ - public $types; + public array $types; /** @var Expr\Variable|null Variable for exception */ - public $var; + public ?Expr\Variable $var; /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** * Constructs a catch node. * - * @param Node\Name[] $types Types of exceptions to catch - * @param Expr\Variable|null $var Variable for exception - * @param Node\Stmt[] $stmts Statements - * @param array $attributes Additional attributes + * @param Node\Name[] $types Types of exceptions to catch + * @param Expr\Variable|null $var Variable for exception + * @param Node\Stmt[] $stmts Statements + * @param array $attributes Additional attributes */ public function __construct(array $types, ?Expr\Variable $var = null, array $stmts = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php index b29972827f8..d0591983483 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php @@ -3,33 +3,34 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; +use PhpParser\Modifiers; use PhpParser\Node; class ClassConst extends Node\Stmt { /** @var int Modifiers */ - public $flags; + public int $flags; /** @var Node\Const_[] Constant declarations */ - public $consts; + public array $consts; /** @var Node\AttributeGroup[] PHP attribute groups */ - public $attrGroups; + public array $attrGroups; /** @var Node\Identifier|Node\Name|Node\ComplexType|null Type declaration */ - public $type; + public ?Node $type; /** * Constructs a class const list node. * - * @param Node\Const_[] $consts Constant declarations - * @param int $flags Modifiers - * @param array $attributes Additional attributes - * @param Node\AttributeGroup[] $attrGroups PHP attribute groups - * @param null|string|Node\Identifier|Node\Name|Node\ComplexType $type Type declaration + * @param Node\Const_[] $consts Constant declarations + * @param int $flags Modifiers + * @param array $attributes Additional attributes + * @param list $attrGroups PHP attribute groups + * @param null|Node\Identifier|Node\Name|Node\ComplexType $type Type declaration */ - public function __construct(array $consts, int $flags = 0, array $attributes = [], array $attrGroups = [], $type = null) + public function __construct(array $consts, int $flags = 0, array $attributes = [], array $attrGroups = [], ?Node $type = null) { $this->attributes = $attributes; $this->flags = $flags; $this->consts = $consts; $this->attrGroups = $attrGroups; - $this->type = \is_string($type) ? new Node\Identifier($type) : $type; + $this->type = $type; } public function getSubNodeNames() : array { @@ -37,39 +38,31 @@ class ClassConst extends Node\Stmt } /** * Whether constant is explicitly or implicitly public. - * - * @return bool */ public function isPublic() : bool { - return ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_PUBLIC) !== 0 || ($this->flags & \PhpParser\Node\Stmt\Class_::VISIBILITY_MODIFIER_MASK) === 0; + return ($this->flags & Modifiers::PUBLIC) !== 0 || ($this->flags & Modifiers::VISIBILITY_MASK) === 0; } /** * Whether constant is protected. - * - * @return bool */ public function isProtected() : bool { - return (bool) ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_PROTECTED); + return (bool) ($this->flags & Modifiers::PROTECTED); } /** * Whether constant is private. - * - * @return bool */ public function isPrivate() : bool { - return (bool) ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_PRIVATE); + return (bool) ($this->flags & Modifiers::PRIVATE); } /** * Whether constant is final. - * - * @return bool */ public function isFinal() : bool { - return (bool) ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_FINAL); + return (bool) ($this->flags & Modifiers::FINAL); } public function getType() : string { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php index d64a6a66bf4..b7a20c7c480 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php @@ -4,16 +4,17 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; use PhpParser\Node; +use PhpParser\Node\PropertyItem; abstract class ClassLike extends Node\Stmt { /** @var Node\Identifier|null Name */ - public $name; + public ?Node\Identifier $name; /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** @var Node\AttributeGroup[] PHP attribute groups */ - public $attrGroups; + public array $attrGroups; /** @var Node\Name|null Namespaced name (if using NameResolver) */ - public $namespacedName; + public ?Node\Name $namespacedName; /** * @return TraitUse[] */ @@ -60,12 +61,12 @@ abstract class ClassLike extends Node\Stmt * * @return Property|null Property node or null if the property does not exist */ - public function getProperty(string $name) + public function getProperty(string $name) : ?\PhpParser\Node\Stmt\Property { foreach ($this->stmts as $stmt) { if ($stmt instanceof \PhpParser\Node\Stmt\Property) { foreach ($stmt->props as $prop) { - if ($prop instanceof \PhpParser\Node\Stmt\PropertyProperty && $name === $prop->name->toString()) { + if ($prop instanceof PropertyItem && $name === $prop->name->toString()) { return $stmt; } } @@ -95,7 +96,7 @@ abstract class ClassLike extends Node\Stmt * * @return ClassMethod|null Method node or null if the method does not exist */ - public function getMethod(string $name) + public function getMethod(string $name) : ?\PhpParser\Node\Stmt\ClassMethod { $lowerName = \strtolower($name); foreach ($this->stmts as $stmt) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php index ef64021ebac..e15473ff715 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php @@ -3,38 +3,47 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; +use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\FunctionLike; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; class ClassMethod extends Node\Stmt implements FunctionLike, StmtsAwareInterface { /** @var int Flags */ - public $flags; + public int $flags; /** @var bool Whether to return by reference */ - public $byRef; + public bool $byRef; /** @var Node\Identifier Name */ - public $name; + public Node\Identifier $name; /** @var Node\Param[] Parameters */ - public $params; + public array $params; /** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */ - public $returnType; + public ?Node $returnType; /** @var Node\Stmt[]|null Statements */ - public $stmts; + public ?array $stmts; /** @var Node\AttributeGroup[] PHP attribute groups */ - public $attrGroups; - private static $magicNames = ['__construct' => \true, '__destruct' => \true, '__call' => \true, '__callstatic' => \true, '__get' => \true, '__set' => \true, '__isset' => \true, '__unset' => \true, '__sleep' => \true, '__wakeup' => \true, '__tostring' => \true, '__set_state' => \true, '__clone' => \true, '__invoke' => \true, '__debuginfo' => \true, '__serialize' => \true, '__unserialize' => \true]; + public array $attrGroups; + /** @var array */ + private static array $magicNames = ['__construct' => \true, '__destruct' => \true, '__call' => \true, '__callstatic' => \true, '__get' => \true, '__set' => \true, '__isset' => \true, '__unset' => \true, '__sleep' => \true, '__wakeup' => \true, '__tostring' => \true, '__set_state' => \true, '__clone' => \true, '__invoke' => \true, '__debuginfo' => \true, '__serialize' => \true, '__unserialize' => \true]; /** * Constructs a class method node. * * @param string|Node\Identifier $name Name - * @param array $subNodes Array of the following optional subnodes: - * 'flags => MODIFIER_PUBLIC: Flags - * 'byRef' => false : Whether to return by reference - * 'params' => array() : Parameters - * 'returnType' => null : Return type - * 'stmts' => array() : Statements - * 'attrGroups' => array() : PHP attribute groups - * @param array $attributes Additional attributes + * @param array{ + * flags?: int, + * byRef?: bool, + * params?: Node\Param[], + * returnType?: null|Node\Identifier|Node\Name|Node\ComplexType, + * stmts?: Node\Stmt[]|null, + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'flags => 0 : Flags + * 'byRef' => false : Whether to return by reference + * 'params' => array() : Parameters + * 'returnType' => null : Return type + * 'stmts' => array() : Statements + * 'attrGroups' => array() : PHP attribute groups + * @param array $attributes Additional attributes */ public function __construct($name, array $subNodes = [], array $attributes = []) { @@ -43,8 +52,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike, StmtsAwareInterface $this->byRef = $subNodes['byRef'] ?? \false; $this->name = \is_string($name) ? new Node\Identifier($name) : $name; $this->params = $subNodes['params'] ?? []; - $returnType = $subNodes['returnType'] ?? null; - $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType; + $this->returnType = $subNodes['returnType'] ?? null; $this->stmts = \array_key_exists('stmts', $subNodes) ? $subNodes['stmts'] : []; $this->attrGroups = $subNodes['attrGroups'] ?? []; } @@ -64,7 +72,7 @@ class ClassMethod extends Node\Stmt implements FunctionLike, StmtsAwareInterface { return $this->returnType; } - public function getStmts() + public function getStmts() : ?array { return $this->stmts; } @@ -74,62 +82,48 @@ class ClassMethod extends Node\Stmt implements FunctionLike, StmtsAwareInterface } /** * Whether the method is explicitly or implicitly public. - * - * @return bool */ public function isPublic() : bool { - return ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_PUBLIC) !== 0 || ($this->flags & \PhpParser\Node\Stmt\Class_::VISIBILITY_MODIFIER_MASK) === 0; + return ($this->flags & Modifiers::PUBLIC) !== 0 || ($this->flags & Modifiers::VISIBILITY_MASK) === 0; } /** * Whether the method is protected. - * - * @return bool */ public function isProtected() : bool { - return (bool) ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_PROTECTED); + return (bool) ($this->flags & Modifiers::PROTECTED); } /** * Whether the method is private. - * - * @return bool */ public function isPrivate() : bool { - return (bool) ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_PRIVATE); + return (bool) ($this->flags & Modifiers::PRIVATE); } /** * Whether the method is abstract. - * - * @return bool */ public function isAbstract() : bool { - return (bool) ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_ABSTRACT); + return (bool) ($this->flags & Modifiers::ABSTRACT); } /** * Whether the method is final. - * - * @return bool */ public function isFinal() : bool { - return (bool) ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_FINAL); + return (bool) ($this->flags & Modifiers::FINAL); } /** * Whether the method is static. - * - * @return bool */ public function isStatic() : bool { - return (bool) ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_STATIC); + return (bool) ($this->flags & Modifiers::STATIC); } /** * Whether the method is magic. - * - * @return bool */ public function isMagic() : bool { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php index db2dee3e207..4f317ea6faf 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php @@ -3,36 +3,50 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; -use PhpParser\Error; +use PhpParser\Modifiers; use PhpParser\Node; class Class_ extends \PhpParser\Node\Stmt\ClassLike { - const MODIFIER_PUBLIC = 1; - const MODIFIER_PROTECTED = 2; - const MODIFIER_PRIVATE = 4; - const MODIFIER_STATIC = 8; - const MODIFIER_ABSTRACT = 16; - const MODIFIER_FINAL = 32; - const MODIFIER_READONLY = 64; - const VISIBILITY_MODIFIER_MASK = 7; + /** @deprecated Use Modifiers::PUBLIC instead */ + public const MODIFIER_PUBLIC = 1; + /** @deprecated Use Modifiers::PROTECTED instead */ + public const MODIFIER_PROTECTED = 2; + /** @deprecated Use Modifiers::PRIVATE instead */ + public const MODIFIER_PRIVATE = 4; + /** @deprecated Use Modifiers::STATIC instead */ + public const MODIFIER_STATIC = 8; + /** @deprecated Use Modifiers::ABSTRACT instead */ + public const MODIFIER_ABSTRACT = 16; + /** @deprecated Use Modifiers::FINAL instead */ + public const MODIFIER_FINAL = 32; + /** @deprecated Use Modifiers::READONLY instead */ + public const MODIFIER_READONLY = 64; + /** @deprecated Use Modifiers::VISIBILITY_MASK instead */ + public const VISIBILITY_MODIFIER_MASK = 7; // 1 | 2 | 4 - /** @var int Type */ - public $flags; + /** @var int Modifiers */ + public int $flags; /** @var null|Node\Name Name of extended class */ - public $extends; + public ?Node\Name $extends; /** @var Node\Name[] Names of implemented interfaces */ - public $implements; + public array $implements; /** * Constructs a class node. * * @param string|Node\Identifier|null $name Name - * @param array $subNodes Array of the following optional subnodes: - * 'flags' => 0 : Flags - * 'extends' => null : Name of extended class - * 'implements' => array(): Names of implemented interfaces - * 'stmts' => array(): Statements - * 'attrGroups' => array(): PHP attribute groups - * @param array $attributes Additional attributes + * @param array{ + * flags?: int, + * extends?: Node\Name|null, + * implements?: Node\Name[], + * stmts?: Node\Stmt[], + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'flags' => 0 : Flags + * 'extends' => null : Name of extended class + * 'implements' => array(): Names of implemented interfaces + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attribute groups + * @param array $attributes Additional attributes */ public function __construct($name, array $subNodes = [], array $attributes = []) { @@ -50,77 +64,29 @@ class Class_ extends \PhpParser\Node\Stmt\ClassLike } /** * Whether the class is explicitly abstract. - * - * @return bool */ public function isAbstract() : bool { - return (bool) ($this->flags & self::MODIFIER_ABSTRACT); + return (bool) ($this->flags & Modifiers::ABSTRACT); } /** * Whether the class is final. - * - * @return bool */ public function isFinal() : bool { - return (bool) ($this->flags & self::MODIFIER_FINAL); + return (bool) ($this->flags & Modifiers::FINAL); } public function isReadonly() : bool { - return (bool) ($this->flags & self::MODIFIER_READONLY); + return (bool) ($this->flags & Modifiers::READONLY); } /** * Whether the class is anonymous. - * - * @return bool */ public function isAnonymous() : bool { return null === $this->name; } - /** - * @internal - */ - public static function verifyClassModifier($a, $b) - { - if ($a & self::MODIFIER_ABSTRACT && $b & self::MODIFIER_ABSTRACT) { - throw new Error('Multiple abstract modifiers are not allowed'); - } - if ($a & self::MODIFIER_FINAL && $b & self::MODIFIER_FINAL) { - throw new Error('Multiple final modifiers are not allowed'); - } - if ($a & self::MODIFIER_READONLY && $b & self::MODIFIER_READONLY) { - throw new Error('Multiple readonly modifiers are not allowed'); - } - if ($a & 48 && $b & 48) { - throw new Error('Cannot use the final modifier on an abstract class'); - } - } - /** - * @internal - */ - public static function verifyModifier($a, $b) - { - if ($a & self::VISIBILITY_MODIFIER_MASK && $b & self::VISIBILITY_MODIFIER_MASK) { - throw new Error('Multiple access type modifiers are not allowed'); - } - if ($a & self::MODIFIER_ABSTRACT && $b & self::MODIFIER_ABSTRACT) { - throw new Error('Multiple abstract modifiers are not allowed'); - } - if ($a & self::MODIFIER_STATIC && $b & self::MODIFIER_STATIC) { - throw new Error('Multiple static modifiers are not allowed'); - } - if ($a & self::MODIFIER_FINAL && $b & self::MODIFIER_FINAL) { - throw new Error('Multiple final modifiers are not allowed'); - } - if ($a & self::MODIFIER_READONLY && $b & self::MODIFIER_READONLY) { - throw new Error('Multiple readonly modifiers are not allowed'); - } - if ($a & 48 && $b & 48) { - throw new Error('Cannot use the final modifier on an abstract class member'); - } - } public function getType() : string { return 'Stmt_Class'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php index aff84aa0815..0b63e1bf95e 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php @@ -7,12 +7,12 @@ use PhpParser\Node; class Const_ extends Node\Stmt { /** @var Node\Const_[] Constant declarations */ - public $consts; + public array $consts; /** * Constructs a const list node. * - * @param Node\Const_[] $consts Constant declarations - * @param array $attributes Additional attributes + * @param Node\Const_[] $consts Constant declarations + * @param array $attributes Additional attributes */ public function __construct(array $consts, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php index 331a3ae55a7..942cf67df2c 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php @@ -7,12 +7,12 @@ use PhpParser\Node; class Continue_ extends Node\Stmt { /** @var null|Node\Expr Number of loops to continue */ - public $num; + public ?Node\Expr $num; /** * Constructs a continue node. * - * @param null|Node\Expr $num Number of loops to continue - * @param array $attributes Additional attributes + * @param null|Node\Expr $num Number of loops to continue + * @param array $attributes Additional attributes */ public function __construct(?Node\Expr $num = null, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php index 4fde5c280ab..6b92755a2a1 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php @@ -1,34 +1,6 @@ value pair node. - * - * @param string|Node\Identifier $key Key - * @param Node\Expr $value Value - * @param array $attributes Additional attributes - */ - public function __construct($key, Node\Expr $value, array $attributes = []) - { - $this->attributes = $attributes; - $this->key = \is_string($key) ? new Node\Identifier($key) : $key; - $this->value = $value; - } - public function getSubNodeNames() : array - { - return ['key', 'value']; - } - public function getType() : string - { - return 'Stmt_DeclareDeclare'; - } -} +require __DIR__ . '/../DeclareItem.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php index b57ad947c46..7d66ad74e8f 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php @@ -4,18 +4,19 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; use PhpParser\Node; +use PhpParser\Node\DeclareItem; class Declare_ extends Node\Stmt { - /** @var DeclareDeclare[] List of declares */ - public $declares; + /** @var DeclareItem[] List of declares */ + public array $declares; /** @var Node\Stmt[]|null Statements */ - public $stmts; + public ?array $stmts; /** * Constructs a declare node. * - * @param DeclareDeclare[] $declares List of declares - * @param Node\Stmt[]|null $stmts Statements - * @param array $attributes Additional attributes + * @param DeclareItem[] $declares List of declares + * @param Node\Stmt[]|null $stmts Statements + * @param array $attributes Additional attributes */ public function __construct(array $declares, ?array $stmts = null, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php index a343b6bb75e..0d1d0542c57 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php @@ -4,18 +4,19 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Do_ extends Node\Stmt implements \Rector\Contract\PhpParser\Node\StmtsAwareInterface +use Rector\Contract\PhpParser\Node\StmtsAwareInterface; +class Do_ extends Node\Stmt implements StmtsAwareInterface { /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** @var Node\Expr Condition */ - public $cond; + public Node\Expr $cond; /** * Constructs a do while node. * - * @param Node\Expr $cond Condition - * @param Node\Stmt[] $stmts Statements - * @param array $attributes Additional attributes + * @param Node\Expr $cond Condition + * @param Node\Stmt[] $stmts Statements + * @param array $attributes Additional attributes */ public function __construct(Node\Expr $cond, array $stmts = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php index c5090535487..70a18eb351c 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php @@ -7,12 +7,12 @@ use PhpParser\Node; class Echo_ extends Node\Stmt { /** @var Node\Expr[] Expressions */ - public $exprs; + public array $exprs; /** * Constructs an echo node. * - * @param Node\Expr[] $exprs Expressions - * @param array $attributes Additional attributes + * @param Node\Expr[] $exprs Expressions + * @param array $attributes Additional attributes */ public function __construct(array $exprs, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php index 4b0e31a48d6..6938033e922 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php @@ -4,18 +4,19 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; use PhpParser\Node; -class ElseIf_ extends Node\Stmt implements \Rector\Contract\PhpParser\Node\StmtsAwareInterface +use Rector\Contract\PhpParser\Node\StmtsAwareInterface; +class ElseIf_ extends Node\Stmt implements StmtsAwareInterface { /** @var Node\Expr Condition */ - public $cond; + public Node\Expr $cond; /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** * Constructs an elseif node. * - * @param Node\Expr $cond Condition - * @param Node\Stmt[] $stmts Statements - * @param array $attributes Additional attributes + * @param Node\Expr $cond Condition + * @param Node\Stmt[] $stmts Statements + * @param array $attributes Additional attributes */ public function __construct(Node\Expr $cond, array $stmts = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php index 20c998b3298..757e762cbd4 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php @@ -4,15 +4,16 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Else_ extends Node\Stmt implements \Rector\Contract\PhpParser\Node\StmtsAwareInterface +use Rector\Contract\PhpParser\Node\StmtsAwareInterface; +class Else_ extends Node\Stmt implements StmtsAwareInterface { /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** * Constructs an else node. * - * @param Node\Stmt[] $stmts Statements - * @param array $attributes Additional attributes + * @param Node\Stmt[] $stmts Statements + * @param array $attributes Additional attributes */ public function __construct(array $stmts = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php index df41143df30..73d1785f2c0 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php @@ -8,16 +8,16 @@ use PhpParser\Node\AttributeGroup; class EnumCase extends Node\Stmt { /** @var Node\Identifier Enum case name */ - public $name; + public Node\Identifier $name; /** @var Node\Expr|null Enum case expression */ - public $expr; + public ?Node\Expr $expr; /** @var Node\AttributeGroup[] PHP attribute groups */ - public $attrGroups; + public array $attrGroups; /** - * @param string|Node\Identifier $name Enum case name - * @param Node\Expr|null $expr Enum case expression - * @param AttributeGroup[] $attrGroups PHP attribute groups - * @param array $attributes Additional attributes + * @param string|Node\Identifier $name Enum case name + * @param Node\Expr|null $expr Enum case expression + * @param list $attrGroups PHP attribute groups + * @param array $attributes Additional attributes */ public function __construct($name, ?Node\Expr $expr = null, array $attrGroups = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php index 48cf8d69a17..e636e57d8f4 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php @@ -7,17 +7,22 @@ use PhpParser\Node; class Enum_ extends \PhpParser\Node\Stmt\ClassLike { /** @var null|Node\Identifier Scalar Type */ - public $scalarType; + public ?Node $scalarType; /** @var Node\Name[] Names of implemented interfaces */ - public $implements; + public array $implements; /** - * @param string|Node\Identifier|null $name Name - * @param array $subNodes Array of the following optional subnodes: - * 'scalarType' => null : Scalar type - * 'implements' => array() : Names of implemented interfaces - * 'stmts' => array() : Statements - * 'attrGroups' => array() : PHP attribute groups - * @param array $attributes Additional attributes + * @param string|Node\Identifier|null $name Name + * @param array{ + * scalarType?: Node\Identifier|null, + * implements?: Node\Name[], + * stmts?: Node\Stmt[], + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'scalarType' => null : Scalar type + * 'implements' => array() : Names of implemented interfaces + * 'stmts' => array() : Statements + * 'attrGroups' => array() : PHP attribute groups + * @param array $attributes Additional attributes */ public function __construct($name, array $subNodes = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php index 4971d2f6296..77408f2845e 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php @@ -10,12 +10,12 @@ use PhpParser\Node; class Expression extends Node\Stmt { /** @var Node\Expr Expression */ - public $expr; + public Node\Expr $expr; /** * Constructs an expression statement. * - * @param Node\Expr $expr Expression - * @param array $attributes Additional attributes + * @param Node\Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(Node\Expr $expr, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php index 01200cc3d45..5e3809de17a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php @@ -4,15 +4,16 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Finally_ extends Node\Stmt implements \Rector\Contract\PhpParser\Node\StmtsAwareInterface +use Rector\Contract\PhpParser\Node\StmtsAwareInterface; +class Finally_ extends Node\Stmt implements StmtsAwareInterface { /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** * Constructs a finally node. * - * @param Node\Stmt[] $stmts Statements - * @param array $attributes Additional attributes + * @param Node\Stmt[] $stmts Statements + * @param array $attributes Additional attributes */ public function __construct(array $stmts = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php index c7119a24022..30f81b25587 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php @@ -4,25 +4,31 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; use PhpParser\Node; -class For_ extends Node\Stmt implements \Rector\Contract\PhpParser\Node\StmtsAwareInterface +use Rector\Contract\PhpParser\Node\StmtsAwareInterface; +class For_ extends Node\Stmt implements StmtsAwareInterface { /** @var Node\Expr[] Init expressions */ - public $init; + public array $init; /** @var Node\Expr[] Loop conditions */ - public $cond; + public array $cond; /** @var Node\Expr[] Loop expressions */ - public $loop; + public array $loop; /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** * Constructs a for loop node. * - * @param array $subNodes Array of the following optional subnodes: - * 'init' => array(): Init expressions - * 'cond' => array(): Loop conditions - * 'loop' => array(): Loop expressions - * 'stmts' => array(): Statements - * @param array $attributes Additional attributes + * @param array{ + * init?: Node\Expr[], + * cond?: Node\Expr[], + * loop?: Node\Expr[], + * stmts?: Node\Stmt[], + * } $subNodes Array of the following optional subnodes: + * 'init' => array(): Init expressions + * 'cond' => array(): Loop conditions + * 'loop' => array(): Loop expressions + * 'stmts' => array(): Statements + * @param array $attributes Additional attributes */ public function __construct(array $subNodes = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php index 23060580aaf..9d232e9dbda 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php @@ -4,28 +4,33 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; use PhpParser\Node; -class Foreach_ extends Node\Stmt implements \Rector\Contract\PhpParser\Node\StmtsAwareInterface +use Rector\Contract\PhpParser\Node\StmtsAwareInterface; +class Foreach_ extends Node\Stmt implements StmtsAwareInterface { /** @var Node\Expr Expression to iterate */ - public $expr; + public Node\Expr $expr; /** @var null|Node\Expr Variable to assign key to */ - public $keyVar; + public ?Node\Expr $keyVar; /** @var bool Whether to assign value by reference */ - public $byRef; + public bool $byRef; /** @var Node\Expr Variable to assign value to */ - public $valueVar; + public Node\Expr $valueVar; /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** * Constructs a foreach node. * - * @param Node\Expr $expr Expression to iterate - * @param Node\Expr $valueVar Variable to assign value to - * @param array $subNodes Array of the following optional subnodes: - * 'keyVar' => null : Variable to assign key to - * 'byRef' => false : Whether to assign value by reference - * 'stmts' => array(): Statements - * @param array $attributes Additional attributes + * @param Node\Expr $expr Expression to iterate + * @param Node\Expr $valueVar Variable to assign value to + * @param array{ + * keyVar?: Node\Expr|null, + * byRef?: bool, + * stmts?: Node\Stmt[], + * } $subNodes Array of the following optional subnodes: + * 'keyVar' => null : Variable to assign key to + * 'byRef' => false : Whether to assign value by reference + * 'stmts' => array(): Statements + * @param array $attributes Additional attributes */ public function __construct(Node\Expr $expr, Node\Expr $valueVar, array $subNodes = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php index 698b1be7c57..85298e85a6c 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php @@ -9,30 +9,36 @@ use Rector\Contract\PhpParser\Node\StmtsAwareInterface; class Function_ extends Node\Stmt implements FunctionLike, StmtsAwareInterface { /** @var bool Whether function returns by reference */ - public $byRef; + public bool $byRef; /** @var Node\Identifier Name */ - public $name; + public Node\Identifier $name; /** @var Node\Param[] Parameters */ - public $params; + public array $params; /** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */ - public $returnType; + public ?Node $returnType; /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** @var Node\AttributeGroup[] PHP attribute groups */ - public $attrGroups; + public array $attrGroups; /** @var Node\Name|null Namespaced name (if using NameResolver) */ - public $namespacedName; + public ?Node\Name $namespacedName; /** * Constructs a function node. * * @param string|Node\Identifier $name Name - * @param array $subNodes Array of the following optional subnodes: - * 'byRef' => false : Whether to return by reference - * 'params' => array(): Parameters - * 'returnType' => null : Return type - * 'stmts' => array(): Statements - * 'attrGroups' => array(): PHP attribute groups - * @param array $attributes Additional attributes + * @param array{ + * byRef?: bool, + * params?: Node\Param[], + * returnType?: null|Node\Identifier|Node\Name|Node\ComplexType, + * stmts?: Node\Stmt[], + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'byRef' => false : Whether to return by reference + * 'params' => array(): Parameters + * 'returnType' => null : Return type + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attribute groups + * @param array $attributes Additional attributes */ public function __construct($name, array $subNodes = [], array $attributes = []) { @@ -40,8 +46,7 @@ class Function_ extends Node\Stmt implements FunctionLike, StmtsAwareInterface $this->byRef = $subNodes['byRef'] ?? \false; $this->name = \is_string($name) ? new Node\Identifier($name) : $name; $this->params = $subNodes['params'] ?? []; - $returnType = $subNodes['returnType'] ?? null; - $this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType; + $this->returnType = $subNodes['returnType'] ?? null; $this->stmts = $subNodes['stmts'] ?? []; $this->attrGroups = $subNodes['attrGroups'] ?? []; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php index 600c6788847..e6df97e6575 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php @@ -7,12 +7,12 @@ use PhpParser\Node; class Global_ extends Node\Stmt { /** @var Node\Expr[] Variables */ - public $vars; + public array $vars; /** * Constructs a global variables list node. * - * @param Node\Expr[] $vars Variables to unset - * @param array $attributes Additional attributes + * @param Node\Expr[] $vars Variables to unset + * @param array $attributes Additional attributes */ public function __construct(array $vars, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php index 0edfd25aa14..f8d5f7bf332 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php @@ -8,12 +8,12 @@ use PhpParser\Node\Stmt; class Goto_ extends Stmt { /** @var Identifier Name of label to jump to */ - public $name; + public Identifier $name; /** * Constructs a goto node. * - * @param string|Identifier $name Name of label to jump to - * @param array $attributes Additional attributes + * @param string|Identifier $name Name of label to jump to + * @param array $attributes Additional attributes */ public function __construct($name, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php index f43407dcdd5..4843478174d 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php @@ -5,21 +5,24 @@ namespace PhpParser\Node\Stmt; use PhpParser\Node\Name; use PhpParser\Node\Stmt; +use PhpParser\Node\UseItem; class GroupUse extends Stmt { - /** @var int Type of group use */ - public $type; + /** + * @var Use_::TYPE_* Type of group use + */ + public int $type; /** @var Name Prefix for uses */ - public $prefix; - /** @var UseUse[] Uses */ - public $uses; + public Name $prefix; + /** @var UseItem[] Uses */ + public array $uses; /** * Constructs a group use node. * - * @param Name $prefix Prefix for uses - * @param UseUse[] $uses Uses - * @param int $type Type of group use - * @param array $attributes Additional attributes + * @param Name $prefix Prefix for uses + * @param UseItem[] $uses Uses + * @param Use_::TYPE_* $type Type of group use + * @param array $attributes Additional attributes */ public function __construct(Name $prefix, array $uses, int $type = \PhpParser\Node\Stmt\Use_::TYPE_NORMAL, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php index ebc9654e5a3..c1c829fc8cc 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php @@ -7,12 +7,12 @@ use PhpParser\Node\Stmt; class HaltCompiler extends Stmt { /** @var string Remaining text after halt compiler statement. */ - public $remaining; + public string $remaining; /** * Constructs a __halt_compiler node. * - * @param string $remaining Remaining text after halt compiler statement. - * @param array $attributes Additional attributes + * @param string $remaining Remaining text after halt compiler statement. + * @param array $attributes Additional attributes */ public function __construct(string $remaining, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php index 1be355cb865..4cafe23d751 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php @@ -4,25 +4,30 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; use PhpParser\Node; -class If_ extends Node\Stmt implements \Rector\Contract\PhpParser\Node\StmtsAwareInterface +use Rector\Contract\PhpParser\Node\StmtsAwareInterface; +class If_ extends Node\Stmt implements StmtsAwareInterface { /** @var Node\Expr Condition expression */ - public $cond; + public Node\Expr $cond; /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** @var ElseIf_[] Elseif clauses */ - public $elseifs; + public array $elseifs; /** @var null|Else_ Else clause */ - public $else; + public ?\PhpParser\Node\Stmt\Else_ $else; /** * Constructs an if node. * - * @param Node\Expr $cond Condition - * @param array $subNodes Array of the following optional subnodes: - * 'stmts' => array(): Statements - * 'elseifs' => array(): Elseif clauses - * 'else' => null : Else clause - * @param array $attributes Additional attributes + * @param Node\Expr $cond Condition + * @param array{ + * stmts?: Node\Stmt[], + * elseifs?: ElseIf_[], + * else?: Else_|null, + * } $subNodes Array of the following optional subnodes: + * 'stmts' => array(): Statements + * 'elseifs' => array(): Elseif clauses + * 'else' => null : Else clause + * @param array $attributes Additional attributes */ public function __construct(Node\Expr $cond, array $subNodes = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php index 8643d5c7b5a..33ead2efdfa 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php @@ -7,12 +7,12 @@ use PhpParser\Node\Stmt; class InlineHTML extends Stmt { /** @var string String */ - public $value; + public string $value; /** * Constructs an inline HTML node. * - * @param string $value String - * @param array $attributes Additional attributes + * @param string $value String + * @param array $attributes Additional attributes */ public function __construct(string $value, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php index ceae98b3c7f..9a1da332e4e 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php @@ -7,16 +7,20 @@ use PhpParser\Node; class Interface_ extends \PhpParser\Node\Stmt\ClassLike { /** @var Node\Name[] Extended interfaces */ - public $extends; + public array $extends; /** * Constructs a class node. * * @param string|Node\Identifier $name Name - * @param array $subNodes Array of the following optional subnodes: - * 'extends' => array(): Name of extended interfaces - * 'stmts' => array(): Statements - * 'attrGroups' => array(): PHP attribute groups - * @param array $attributes Additional attributes + * @param array{ + * extends?: Node\Name[], + * stmts?: Node\Stmt[], + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'extends' => array(): Name of extended interfaces + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attribute groups + * @param array $attributes Additional attributes */ public function __construct($name, array $subNodes = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php index fa8563152e1..f3374e4bea4 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php @@ -8,12 +8,12 @@ use PhpParser\Node\Stmt; class Label extends Stmt { /** @var Identifier Name */ - public $name; + public Identifier $name; /** * Constructs a label node. * - * @param string|Identifier $name Name - * @param array $attributes Additional attributes + * @param string|Identifier $name Name + * @param array $attributes Additional attributes */ public function __construct($name, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php index cd96768d771..719b01ed0b5 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php @@ -8,20 +8,20 @@ use Rector\Contract\PhpParser\Node\StmtsAwareInterface; class Namespace_ extends Node\Stmt implements StmtsAwareInterface { /* For use in the "kind" attribute */ - const KIND_SEMICOLON = 1; - const KIND_BRACED = 2; + public const KIND_SEMICOLON = 1; + public const KIND_BRACED = 2; /** @var null|Node\Name Name */ - public $name; + public ?Node\Name $name; /** @var Node\Stmt[] Statements */ public $stmts; /** * Constructs a namespace node. * - * @param null|Node\Name $name Name - * @param null|Node\Stmt[] $stmts Statements - * @param array $attributes Additional attributes + * @param null|Node\Name $name Name + * @param null|Node\Stmt[] $stmts Statements + * @param array $attributes Additional attributes */ - public function __construct(?Node\Name $name = null, $stmts = [], array $attributes = []) + public function __construct(?Node\Name $name = null, ?array $stmts = [], array $attributes = []) { $this->attributes = $attributes; $this->name = $name; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php index c57ef5688a9..3e5b2053d5c 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php @@ -3,85 +3,102 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; +use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\ComplexType; use PhpParser\Node\Identifier; use PhpParser\Node\Name; +use PhpParser\Node\PropertyItem; class Property extends Node\Stmt { /** @var int Modifiers */ - public $flags; - /** @var PropertyProperty[] Properties */ - public $props; + public int $flags; + /** @var PropertyItem[] Properties */ + public array $props; /** @var null|Identifier|Name|ComplexType Type declaration */ - public $type; + public ?Node $type; /** @var Node\AttributeGroup[] PHP attribute groups */ - public $attrGroups; + public array $attrGroups; + /** @var Node\PropertyHook[] Property hooks */ + public array $hooks; /** * Constructs a class property list node. * - * @param int $flags Modifiers - * @param PropertyProperty[] $props Properties - * @param array $attributes Additional attributes - * @param null|string|Identifier|Name|ComplexType $type Type declaration - * @param Node\AttributeGroup[] $attrGroups PHP attribute groups + * @param int $flags Modifiers + * @param PropertyItem[] $props Properties + * @param array $attributes Additional attributes + * @param null|Identifier|Name|ComplexType $type Type declaration + * @param Node\AttributeGroup[] $attrGroups PHP attribute groups + * @param Node\PropertyHook[] $hooks Property hooks */ - public function __construct(int $flags, array $props, array $attributes = [], $type = null, array $attrGroups = []) + public function __construct(int $flags, array $props, array $attributes = [], ?Node $type = null, array $attrGroups = [], array $hooks = []) { $this->attributes = $attributes; $this->flags = $flags; $this->props = $props; - $this->type = \is_string($type) ? new Identifier($type) : $type; + $this->type = $type; $this->attrGroups = $attrGroups; + $this->hooks = $hooks; } public function getSubNodeNames() : array { - return ['attrGroups', 'flags', 'type', 'props']; + return ['attrGroups', 'flags', 'type', 'props', 'hooks']; } /** * Whether the property is explicitly or implicitly public. - * - * @return bool */ public function isPublic() : bool { - return ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_PUBLIC) !== 0 || ($this->flags & \PhpParser\Node\Stmt\Class_::VISIBILITY_MODIFIER_MASK) === 0; + return ($this->flags & Modifiers::PUBLIC) !== 0 || ($this->flags & Modifiers::VISIBILITY_MASK) === 0; } /** * Whether the property is protected. - * - * @return bool */ public function isProtected() : bool { - return (bool) ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_PROTECTED); + return (bool) ($this->flags & Modifiers::PROTECTED); } /** * Whether the property is private. - * - * @return bool */ public function isPrivate() : bool { - return (bool) ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_PRIVATE); + return (bool) ($this->flags & Modifiers::PRIVATE); } /** * Whether the property is static. - * - * @return bool */ public function isStatic() : bool { - return (bool) ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_STATIC); + return (bool) ($this->flags & Modifiers::STATIC); } /** * Whether the property is readonly. - * - * @return bool */ public function isReadonly() : bool { - return (bool) ($this->flags & \PhpParser\Node\Stmt\Class_::MODIFIER_READONLY); + return (bool) ($this->flags & Modifiers::READONLY); + } + /** + * Whether the property has explicit public(set) visibility. + */ + public function isPublicSet() : bool + { + return (bool) ($this->flags & Modifiers::PUBLIC_SET); + } + /** + * Whether the property has explicit protected(set) visibility. + */ + public function isProtectedSet() : bool + { + return (bool) ($this->flags & Modifiers::PROTECTED_SET); + } + /** + * Whether the property has explicit private(set) visibility. + */ + public function isPrivateSet() : bool + { + return (bool) ($this->flags & Modifiers::PRIVATE_SET); } public function getType() : string { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php index d3292a5c0f9..50d4c18ece5 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php @@ -1,34 +1,6 @@ attributes = $attributes; - $this->name = \is_string($name) ? new Node\VarLikeIdentifier($name) : $name; - $this->default = $default; - } - public function getSubNodeNames() : array - { - return ['name', 'default']; - } - public function getType() : string - { - return 'Stmt_PropertyProperty'; - } -} +require __DIR__ . '/../PropertyItem.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php index 157597cc36a..86810a1d504 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php @@ -7,12 +7,12 @@ use PhpParser\Node; class Return_ extends Node\Stmt { /** @var null|Node\Expr Expression */ - public $expr; + public ?Node\Expr $expr; /** * Constructs a return node. * - * @param null|Node\Expr $expr Expression - * @param array $attributes Additional attributes + * @param null|Node\Expr $expr Expression + * @param array $attributes Additional attributes */ public function __construct(?Node\Expr $expr = null, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php index a014cb69b25..17f363941e8 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php @@ -1,35 +1,6 @@ attributes = $attributes; - $this->var = $var; - $this->default = $default; - } - public function getSubNodeNames() : array - { - return ['var', 'default']; - } - public function getType() : string - { - return 'Stmt_StaticVar'; - } -} +require __DIR__ . '/../StaticVar.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php index 7a0a347a791..eed2eebc867 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php @@ -3,16 +3,17 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; +use PhpParser\Node\StaticVar; use PhpParser\Node\Stmt; class Static_ extends Stmt { /** @var StaticVar[] Variable definitions */ - public $vars; + public array $vars; /** * Constructs a static variables list node. * - * @param StaticVar[] $vars Variable definitions - * @param array $attributes Additional attributes + * @param StaticVar[] $vars Variable definitions + * @param array $attributes Additional attributes */ public function __construct(array $vars, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php index 0edbd2dfda1..13493f15f8e 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php @@ -7,15 +7,15 @@ use PhpParser\Node; class Switch_ extends Node\Stmt { /** @var Node\Expr Condition */ - public $cond; + public Node\Expr $cond; /** @var Case_[] Case list */ - public $cases; + public array $cases; /** * Constructs a case node. * - * @param Node\Expr $cond Condition - * @param Case_[] $cases Case list - * @param array $attributes Additional attributes + * @param Node\Expr $cond Condition + * @param Case_[] $cases Case list + * @param array $attributes Additional attributes */ public function __construct(Node\Expr $cond, array $cases, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php deleted file mode 100644 index fd38ef1ff21..00000000000 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php +++ /dev/null @@ -1,30 +0,0 @@ -attributes = $attributes; - $this->expr = $expr; - } - public function getSubNodeNames() : array - { - return ['expr']; - } - public function getType() : string - { - return 'Stmt_Throw'; - } -} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php index 98d9e70e326..780b1b380e5 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php @@ -7,15 +7,15 @@ use PhpParser\Node; class TraitUse extends Node\Stmt { /** @var Node\Name[] Traits */ - public $traits; + public array $traits; /** @var TraitUseAdaptation[] Adaptations */ - public $adaptations; + public array $adaptations; /** * Constructs a trait use node. * - * @param Node\Name[] $traits Traits + * @param Node\Name[] $traits Traits * @param TraitUseAdaptation[] $adaptations Adaptations - * @param array $attributes Additional attributes + * @param array $attributes Additional attributes */ public function __construct(array $traits, array $adaptations = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php index 02f9f066998..d1a50f6f64d 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php @@ -7,7 +7,7 @@ use PhpParser\Node; abstract class TraitUseAdaptation extends Node\Stmt { /** @var Node\Name|null Trait name */ - public $trait; + public ?Node\Name $trait; /** @var Node\Identifier Method name */ - public $method; + public Node\Identifier $method; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php index 32c226642e3..304704d7bf0 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php @@ -7,19 +7,19 @@ use PhpParser\Node; class Alias extends Node\Stmt\TraitUseAdaptation { /** @var null|int New modifier */ - public $newModifier; + public ?int $newModifier; /** @var null|Node\Identifier New name */ - public $newName; + public ?Node\Identifier $newName; /** * Constructs a trait use precedence adaptation node. * - * @param null|Node\Name $trait Trait name - * @param string|Node\Identifier $method Method name - * @param null|int $newModifier New modifier - * @param null|string|Node\Identifier $newName New name - * @param array $attributes Additional attributes + * @param null|Node\Name $trait Trait name + * @param string|Node\Identifier $method Method name + * @param null|int $newModifier New modifier + * @param null|string|Node\Identifier $newName New name + * @param array $attributes Additional attributes */ - public function __construct($trait, $method, $newModifier, $newName, array $attributes = []) + public function __construct(?Node\Name $trait, $method, ?int $newModifier, $newName, array $attributes = []) { $this->attributes = $attributes; $this->trait = $trait; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php index 486a17289fc..f01b0c4dc7f 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php @@ -7,14 +7,14 @@ use PhpParser\Node; class Precedence extends Node\Stmt\TraitUseAdaptation { /** @var Node\Name[] Overwritten traits */ - public $insteadof; + public array $insteadof; /** * Constructs a trait use precedence adaptation node. * - * @param Node\Name $trait Trait name - * @param string|Node\Identifier $method Method name - * @param Node\Name[] $insteadof Overwritten traits - * @param array $attributes Additional attributes + * @param Node\Name $trait Trait name + * @param string|Node\Identifier $method Method name + * @param Node\Name[] $insteadof Overwritten traits + * @param array $attributes Additional attributes */ public function __construct(Node\Name $trait, $method, array $insteadof, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php index 017bca351c3..d1981400d95 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php @@ -10,10 +10,13 @@ class Trait_ extends \PhpParser\Node\Stmt\ClassLike * Constructs a trait node. * * @param string|Node\Identifier $name Name - * @param array $subNodes Array of the following optional subnodes: - * 'stmts' => array(): Statements - * 'attrGroups' => array(): PHP attribute groups - * @param array $attributes Additional attributes + * @param array{ + * stmts?: Node\Stmt[], + * attrGroups?: Node\AttributeGroup[], + * } $subNodes Array of the following optional subnodes: + * 'stmts' => array(): Statements + * 'attrGroups' => array(): PHP attribute groups + * @param array $attributes Additional attributes */ public function __construct($name, array $subNodes = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php index 337224a10f1..aa596924a31 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php @@ -8,18 +8,18 @@ use Rector\Contract\PhpParser\Node\StmtsAwareInterface; class TryCatch extends Node\Stmt implements StmtsAwareInterface { /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** @var Catch_[] Catches */ - public $catches; + public array $catches; /** @var null|Finally_ Optional finally node */ - public $finally; + public ?\PhpParser\Node\Stmt\Finally_ $finally; /** * Constructs a try catch node. * - * @param Node\Stmt[] $stmts Statements - * @param Catch_[] $catches Catches - * @param null|Finally_ $finally Optional finally node - * @param array $attributes Additional attributes + * @param Node\Stmt[] $stmts Statements + * @param Catch_[] $catches Catches + * @param null|Finally_ $finally Optional finally node + * @param array $attributes Additional attributes */ public function __construct(array $stmts, array $catches, ?\PhpParser\Node\Stmt\Finally_ $finally = null, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php index c5a24f7187f..5c2c608d261 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php @@ -7,12 +7,12 @@ use PhpParser\Node; class Unset_ extends Node\Stmt { /** @var Node\Expr[] Variables to unset */ - public $vars; + public array $vars; /** * Constructs an unset node. * - * @param Node\Expr[] $vars Variables to unset - * @param array $attributes Additional attributes + * @param Node\Expr[] $vars Variables to unset + * @param array $attributes Additional attributes */ public function __construct(array $vars, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php index a56f4faf6e5..351cf6acdf9 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php @@ -1,51 +1,6 @@ attributes = $attributes; - $this->type = $type; - $this->name = $name; - $this->alias = \is_string($alias) ? new Identifier($alias) : $alias; - } - public function getSubNodeNames() : array - { - return ['type', 'name', 'alias']; - } - /** - * Get alias. If not explicitly given this is the last component of the used name. - * - * @return Identifier - */ - public function getAlias() : Identifier - { - if (null !== $this->alias) { - return $this->alias; - } - return new Identifier($this->name->getLast()); - } - public function getType() : string - { - return 'Stmt_UseUse'; - } -} +require __DIR__ . '/../UseItem.php'; diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php index 6702649cd1f..e69165c7f0f 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php @@ -4,6 +4,7 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; use PhpParser\Node\Stmt; +use PhpParser\Node\UseItem; class Use_ extends Stmt { /** @@ -11,23 +12,23 @@ class Use_ extends Stmt * TYPE_UNKNOWN while the other has one of the three other possible types. For normal use statements the type on the * Stmt\UseUse is unknown. It's only the other way around for mixed group use declarations. */ - const TYPE_UNKNOWN = 0; + public const TYPE_UNKNOWN = 0; /** Class or namespace import */ - const TYPE_NORMAL = 1; + public const TYPE_NORMAL = 1; /** Function import */ - const TYPE_FUNCTION = 2; + public const TYPE_FUNCTION = 2; /** Constant import */ - const TYPE_CONSTANT = 3; - /** @var int Type of alias */ - public $type; - /** @var UseUse[] Aliases */ - public $uses; + public const TYPE_CONSTANT = 3; + /** @var self::TYPE_* Type of alias */ + public int $type; + /** @var UseItem[] Aliases */ + public array $uses; /** * Constructs an alias (use) list node. * - * @param UseUse[] $uses Aliases - * @param int $type Type of alias - * @param array $attributes Additional attributes + * @param UseItem[] $uses Aliases + * @param Stmt\Use_::TYPE_* $type Type of alias + * @param array $attributes Additional attributes */ public function __construct(array $uses, int $type = self::TYPE_NORMAL, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php index 36ed0fe2226..1167c22be59 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php @@ -4,18 +4,19 @@ declare (strict_types=1); namespace PhpParser\Node\Stmt; use PhpParser\Node; -class While_ extends Node\Stmt implements \Rector\Contract\PhpParser\Node\StmtsAwareInterface +use Rector\Contract\PhpParser\Node\StmtsAwareInterface; +class While_ extends Node\Stmt implements StmtsAwareInterface { /** @var Node\Expr Condition */ - public $cond; + public Node\Expr $cond; /** @var Node\Stmt[] Statements */ - public $stmts; + public array $stmts; /** * Constructs a while node. * - * @param Node\Expr $cond Condition - * @param Node\Stmt[] $stmts Statements - * @param array $attributes Additional attributes + * @param Node\Expr $cond Condition + * @param Node\Stmt[] $stmts Statements + * @param array $attributes Additional attributes */ public function __construct(Node\Expr $cond, array $stmts = [], array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php b/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php index 18f8e521e81..d6a7ecbbbfc 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php @@ -6,12 +6,12 @@ namespace PhpParser\Node; class UnionType extends \PhpParser\Node\ComplexType { /** @var (Identifier|Name|IntersectionType)[] Types */ - public $types; + public array $types; /** * Constructs a union type. * - * @param (Identifier|Name|IntersectionType)[] $types Types - * @param array $attributes Additional attributes + * @param (Identifier|Name|IntersectionType)[] $types Types + * @param array $attributes Additional attributes */ public function __construct(array $types, array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/UseItem.php b/vendor/nikic/php-parser/lib/PhpParser/Node/UseItem.php new file mode 100644 index 00000000000..13dfbb3fc5a --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/UseItem.php @@ -0,0 +1,54 @@ + $attributes Additional attributes + */ + public function __construct(Node\Name $name, $alias = null, int $type = Use_::TYPE_UNKNOWN, array $attributes = []) + { + $this->attributes = $attributes; + $this->type = $type; + $this->name = $name; + $this->alias = \is_string($alias) ? new \PhpParser\Node\Identifier($alias) : $alias; + } + public function getSubNodeNames() : array + { + return ['type', 'name', 'alias']; + } + /** + * Get alias. If not explicitly given this is the last component of the used name. + */ + public function getAlias() : \PhpParser\Node\Identifier + { + if (null !== $this->alias) { + return $this->alias; + } + return new \PhpParser\Node\Identifier($this->name->getLast()); + } + public function getType() : string + { + return 'UseItem'; + } +} +// @deprecated compatibility alias +\class_alias(\PhpParser\Node\UseItem::class, \PhpParser\Node\Stmt\UseUse::class); diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php b/vendor/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php index 63a0951daf7..ac098cd93cf 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php @@ -12,7 +12,7 @@ class VariadicPlaceholder extends NodeAbstract /** * Create a variadic argument placeholder (first-class callable syntax). * - * @param array $attributes Additional attributes + * @param array $attributes Additional attributes */ public function __construct(array $attributes = []) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php b/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php index 389cb0c3548..6901a6424c5 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php @@ -5,11 +5,12 @@ namespace PhpParser; abstract class NodeAbstract implements \PhpParser\Node, \JsonSerializable { - protected $attributes; + /** @var array Attributes */ + protected array $attributes; /** * Creates a Node. * - * @param array $attributes Array of attributes + * @param array $attributes Array of attributes */ public function __construct(array $attributes = []) { @@ -19,6 +20,7 @@ abstract class NodeAbstract implements \PhpParser\Node, \JsonSerializable * Gets line the node started in (alias of getStartLine). * * @return int Start line (or -1 if not available) + * @phpstan-return -1|positive-int */ public function getLine() : int { @@ -30,6 +32,7 @@ abstract class NodeAbstract implements \PhpParser\Node, \JsonSerializable * Requires the 'startLine' attribute to be enabled in the lexer (enabled by default). * * @return int Start line (or -1 if not available) + * @phpstan-return -1|positive-int */ public function getStartLine() : int { @@ -41,6 +44,7 @@ abstract class NodeAbstract implements \PhpParser\Node, \JsonSerializable * Requires the 'endLine' attribute to be enabled in the lexer (enabled by default). * * @return int End line (or -1 if not available) + * @phpstan-return -1|positive-int */ public function getEndLine() : int { @@ -110,7 +114,7 @@ abstract class NodeAbstract implements \PhpParser\Node, \JsonSerializable * * @return null|Comment\Doc Doc comment object or null */ - public function getDocComment() + public function getDocComment() : ?\PhpParser\Comment\Doc { $comments = $this->getComments(); for ($i = \count($comments) - 1; $i >= 0; $i--) { @@ -128,7 +132,7 @@ abstract class NodeAbstract implements \PhpParser\Node, \JsonSerializable * * @param Comment\Doc $docComment Doc comment to set */ - public function setDocComment(\PhpParser\Comment\Doc $docComment) + public function setDocComment(\PhpParser\Comment\Doc $docComment) : void { $comments = $this->getComments(); for ($i = \count($comments) - 1; $i >= 0; $i--) { @@ -143,7 +147,7 @@ abstract class NodeAbstract implements \PhpParser\Node, \JsonSerializable $comments[] = $docComment; $this->setAttribute('comments', $comments); } - public function setAttribute(string $key, $value) + public function setAttribute(string $key, $value) : void { $this->attributes[$key] = $value; } @@ -162,12 +166,12 @@ abstract class NodeAbstract implements \PhpParser\Node, \JsonSerializable { return $this->attributes; } - public function setAttributes(array $attributes) + public function setAttributes(array $attributes) : void { $this->attributes = $attributes; } /** - * @return array + * @return array */ public function jsonSerialize() : array { diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php b/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php index 6629d42b0fa..54a890a616a 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php @@ -3,16 +3,24 @@ declare (strict_types=1); namespace PhpParser; +use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\Include_; -use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Expr\List_; +use PhpParser\Node\Scalar\Int_; +use PhpParser\Node\Scalar\InterpolatedString; +use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\GroupUse; use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; +use PhpParser\Node\UseItem; class NodeDumper { - private $dumpComments; - private $dumpPositions; - private $code; + private bool $dumpComments; + private bool $dumpPositions; + private bool $dumpOtherAttributes; + private ?string $code; + private string $res; + private string $nl; + private const IGNORE_ATTRIBUTES = ['comments' => \true, 'startLine' => \true, 'endLine' => \true, 'startFilePos' => \true, 'endFilePos' => \true, 'startTokenPos' => \true, 'endTokenPos' => \true]; /** * Constructs a NodeDumper. * @@ -20,6 +28,7 @@ class NodeDumper * * bool dumpComments: Whether comments should be dumped. * * bool dumpPositions: Whether line/offset information should be dumped. To dump offset * information, the code needs to be passed to dump(). + * * bool dumpOtherAttributes: Whether non-comment, non-position attributes should be dumped. * * @param array $options Options (see description) */ @@ -27,11 +36,12 @@ class NodeDumper { $this->dumpComments = !empty($options['dumpComments']); $this->dumpPositions = !empty($options['dumpPositions']); + $this->dumpOtherAttributes = !empty($options['dumpOtherAttributes']); } /** * Dumps a node or array. * - * @param array|Node $node Node or array to dump + * @param array|Node $node Node or array to dump * @param string|null $code Code corresponding to dumped AST. This only needs to be passed if * the dumpPositions option is enabled and the dumping of node offsets * is desired. @@ -41,110 +51,172 @@ class NodeDumper public function dump($node, ?string $code = null) : string { $this->code = $code; - return $this->dumpRecursive($node); + $this->res = ''; + $this->nl = "\n"; + $this->dumpRecursive($node, \false); + return $this->res; } - protected function dumpRecursive($node) + /** @param mixed $node */ + protected function dumpRecursive($node, bool $indent = \true) : void { + if ($indent) { + $this->nl .= " "; + } if ($node instanceof \PhpParser\Node) { - $r = $node->getType(); + $this->res .= $node->getType(); if ($this->dumpPositions && null !== ($p = $this->dumpPosition($node))) { - $r .= $p; + $this->res .= $p; } - $r .= '('; + $this->res .= '('; foreach ($node->getSubNodeNames() as $key) { - $r .= "\n " . $key . ': '; + $this->res .= "{$this->nl} " . $key . ': '; $value = $node->{$key}; - if (null === $value) { - $r .= 'null'; - } elseif (\false === $value) { - $r .= 'false'; - } elseif (\true === $value) { - $r .= 'true'; - } elseif (\is_scalar($value)) { + if (\is_int($value)) { if ('flags' === $key || 'newModifier' === $key) { - $r .= $this->dumpFlags($value); - } elseif ('type' === $key && $node instanceof Include_) { - $r .= $this->dumpIncludeType($value); - } elseif ('type' === $key && ($node instanceof Use_ || $node instanceof UseUse || $node instanceof GroupUse)) { - $r .= $this->dumpUseType($value); - } else { - $r .= $value; + $this->res .= $this->dumpFlags($value); + continue; + } + if ('type' === $key && $node instanceof Include_) { + $this->res .= $this->dumpIncludeType($value); + continue; + } + if ('type' === $key && ($node instanceof Use_ || $node instanceof UseItem || $node instanceof GroupUse)) { + $this->res .= $this->dumpUseType($value); + continue; } - } else { - $r .= \str_replace("\n", "\n ", $this->dumpRecursive($value)); } + $this->dumpRecursive($value); } if ($this->dumpComments && ($comments = $node->getComments())) { - $r .= "\n comments: " . \str_replace("\n", "\n ", $this->dumpRecursive($comments)); + $this->res .= "{$this->nl} comments: "; + $this->dumpRecursive($comments); } - } elseif (\is_array($node)) { - $r = 'array('; - foreach ($node as $key => $value) { - $r .= "\n " . $key . ': '; - if (null === $value) { - $r .= 'null'; - } elseif (\false === $value) { - $r .= 'false'; - } elseif (\true === $value) { - $r .= 'true'; - } elseif (\is_scalar($value)) { - $r .= $value; - } else { - $r .= \str_replace("\n", "\n ", $this->dumpRecursive($value)); + if ($this->dumpOtherAttributes) { + foreach ($node->getAttributes() as $key => $value) { + if (isset(self::IGNORE_ATTRIBUTES[$key])) { + continue; + } + $this->res .= "{$this->nl} {$key}: "; + if (\is_int($value)) { + if ('kind' === $key) { + if ($node instanceof Int_) { + $this->res .= $this->dumpIntKind($value); + continue; + } + if ($node instanceof String_ || $node instanceof InterpolatedString) { + $this->res .= $this->dumpStringKind($value); + continue; + } + if ($node instanceof Array_) { + $this->res .= $this->dumpArrayKind($value); + continue; + } + if ($node instanceof List_) { + $this->res .= $this->dumpListKind($value); + continue; + } + } + } + $this->dumpRecursive($value); } } + $this->res .= "{$this->nl})"; + } elseif (\is_array($node)) { + $this->res .= 'array('; + foreach ($node as $key => $value) { + $this->res .= "{$this->nl} " . $key . ': '; + $this->dumpRecursive($value); + } + $this->res .= "{$this->nl})"; } elseif ($node instanceof \PhpParser\Comment) { - return $node->getReformattedText(); + $this->res .= \str_replace("\n", $this->nl, $node->getReformattedText()); + } elseif (\is_string($node)) { + $this->res .= \str_replace("\n", $this->nl, (string) $node); + } elseif (\is_int($node) || \is_float($node)) { + $this->res .= $node; + } elseif (null === $node) { + $this->res .= 'null'; + } elseif (\false === $node) { + $this->res .= 'false'; + } elseif (\true === $node) { + $this->res .= 'true'; } else { throw new \InvalidArgumentException('Can only dump nodes and arrays.'); } - return $r . "\n)"; + if ($indent) { + $this->nl = \substr($this->nl, 0, -4); + } } - protected function dumpFlags($flags) + protected function dumpFlags(int $flags) : string { $strs = []; - if ($flags & Class_::MODIFIER_PUBLIC) { - $strs[] = 'MODIFIER_PUBLIC'; + if ($flags & \PhpParser\Modifiers::PUBLIC) { + $strs[] = 'PUBLIC'; } - if ($flags & Class_::MODIFIER_PROTECTED) { - $strs[] = 'MODIFIER_PROTECTED'; + if ($flags & \PhpParser\Modifiers::PROTECTED) { + $strs[] = 'PROTECTED'; } - if ($flags & Class_::MODIFIER_PRIVATE) { - $strs[] = 'MODIFIER_PRIVATE'; + if ($flags & \PhpParser\Modifiers::PRIVATE) { + $strs[] = 'PRIVATE'; } - if ($flags & Class_::MODIFIER_ABSTRACT) { - $strs[] = 'MODIFIER_ABSTRACT'; + if ($flags & \PhpParser\Modifiers::ABSTRACT) { + $strs[] = 'ABSTRACT'; } - if ($flags & Class_::MODIFIER_STATIC) { - $strs[] = 'MODIFIER_STATIC'; + if ($flags & \PhpParser\Modifiers::STATIC) { + $strs[] = 'STATIC'; } - if ($flags & Class_::MODIFIER_FINAL) { - $strs[] = 'MODIFIER_FINAL'; + if ($flags & \PhpParser\Modifiers::FINAL) { + $strs[] = 'FINAL'; } - if ($flags & Class_::MODIFIER_READONLY) { - $strs[] = 'MODIFIER_READONLY'; + if ($flags & \PhpParser\Modifiers::READONLY) { + $strs[] = 'READONLY'; + } + if ($flags & \PhpParser\Modifiers::PUBLIC_SET) { + $strs[] = 'PUBLIC_SET'; + } + if ($flags & \PhpParser\Modifiers::PROTECTED_SET) { + $strs[] = 'PROTECTED_SET'; + } + if ($flags & \PhpParser\Modifiers::PRIVATE_SET) { + $strs[] = 'PRIVATE_SET'; } if ($strs) { return \implode(' | ', $strs) . ' (' . $flags . ')'; } else { - return $flags; + return (string) $flags; } } - protected function dumpIncludeType($type) + /** @param array $map */ + private function dumpEnum(int $value, array $map) : string { - $map = [Include_::TYPE_INCLUDE => 'TYPE_INCLUDE', Include_::TYPE_INCLUDE_ONCE => 'TYPE_INCLUDE_ONCE', Include_::TYPE_REQUIRE => 'TYPE_REQUIRE', Include_::TYPE_REQUIRE_ONCE => 'TYPE_REQUIRE_ONCE']; - if (!isset($map[$type])) { - return $type; + if (!isset($map[$value])) { + return (string) $value; } - return $map[$type] . ' (' . $type . ')'; + return $map[$value] . ' (' . $value . ')'; } - protected function dumpUseType($type) + private function dumpIncludeType(int $type) : string { - $map = [Use_::TYPE_UNKNOWN => 'TYPE_UNKNOWN', Use_::TYPE_NORMAL => 'TYPE_NORMAL', Use_::TYPE_FUNCTION => 'TYPE_FUNCTION', Use_::TYPE_CONSTANT => 'TYPE_CONSTANT']; - if (!isset($map[$type])) { - return $type; - } - return $map[$type] . ' (' . $type . ')'; + return $this->dumpEnum($type, [Include_::TYPE_INCLUDE => 'TYPE_INCLUDE', Include_::TYPE_INCLUDE_ONCE => 'TYPE_INCLUDE_ONCE', Include_::TYPE_REQUIRE => 'TYPE_REQUIRE', Include_::TYPE_REQUIRE_ONCE => 'TYPE_REQUIRE_ONCE']); + } + private function dumpUseType(int $type) : string + { + return $this->dumpEnum($type, [Use_::TYPE_UNKNOWN => 'TYPE_UNKNOWN', Use_::TYPE_NORMAL => 'TYPE_NORMAL', Use_::TYPE_FUNCTION => 'TYPE_FUNCTION', Use_::TYPE_CONSTANT => 'TYPE_CONSTANT']); + } + private function dumpIntKind(int $kind) : string + { + return $this->dumpEnum($kind, [Int_::KIND_BIN => 'KIND_BIN', Int_::KIND_OCT => 'KIND_OCT', Int_::KIND_DEC => 'KIND_DEC', Int_::KIND_HEX => 'KIND_HEX']); + } + private function dumpStringKind(int $kind) : string + { + return $this->dumpEnum($kind, [String_::KIND_SINGLE_QUOTED => 'KIND_SINGLE_QUOTED', String_::KIND_DOUBLE_QUOTED => 'KIND_DOUBLE_QUOTED', String_::KIND_HEREDOC => 'KIND_HEREDOC', String_::KIND_NOWDOC => 'KIND_NOWDOC']); + } + private function dumpArrayKind(int $kind) : string + { + return $this->dumpEnum($kind, [Array_::KIND_LONG => 'KIND_LONG', Array_::KIND_SHORT => 'KIND_SHORT']); + } + private function dumpListKind(int $kind) : string + { + return $this->dumpEnum($kind, [List_::KIND_LIST => 'KIND_LIST', List_::KIND_ARRAY => 'KIND_ARRAY']); } /** * Dump node position, if possible. @@ -153,7 +225,7 @@ class NodeDumper * * @return string|null Dump of position, or null if position information not available */ - protected function dumpPosition(\PhpParser\Node $node) + protected function dumpPosition(\PhpParser\Node $node) : ?string { if (!$node->hasAttribute('startLine') || !$node->hasAttribute('endLine')) { return null; @@ -167,7 +239,7 @@ class NodeDumper return "[{$start} - {$end}]"; } // Copied from Error class - private function toColumn($code, $pos) + private function toColumn(string $code, int $pos) : int { if ($pos > \strlen($code)) { throw new \RuntimeException('Invalid position information'); diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php b/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php index 335f6ecb0eb..acc03077ed7 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php @@ -10,29 +10,32 @@ class NodeFinder /** * Find all nodes satisfying a filter callback. * - * @param Node|Node[] $nodes Single node or array of nodes to search in - * @param callable $filter Filter callback: function(Node $node) : bool + * @param Node|Node[] $nodes Single node or array of nodes to search in + * @param callable $filter Filter callback: function(Node $node) : bool * * @return Node[] Found nodes satisfying the filter callback */ public function find($nodes, callable $filter) : array { + if ($nodes === []) { + return []; + } if (!\is_array($nodes)) { $nodes = [$nodes]; } $visitor = new FindingVisitor($filter); - $traverser = new \PhpParser\NodeTraverser(); - $traverser->addVisitor($visitor); + $traverser = new \PhpParser\NodeTraverser($visitor); $traverser->traverse($nodes); return $visitor->getFoundNodes(); } /** * Find all nodes that are instances of a certain class. + * @template TNode as Node * * @param Node|Node[] $nodes Single node or array of nodes to search in - * @param string $class Class name + * @param class-string $class Class name * - * @return Node[] Found nodes (all instances of $class) + * @return TNode[] Found nodes (all instances of $class) */ public function findInstanceOf($nodes, string $class) : array { @@ -43,31 +46,35 @@ class NodeFinder /** * Find first node satisfying a filter callback. * - * @param Node|Node[] $nodes Single node or array of nodes to search in - * @param callable $filter Filter callback: function(Node $node) : bool + * @param Node|Node[] $nodes Single node or array of nodes to search in + * @param callable $filter Filter callback: function(Node $node) : bool * * @return null|Node Found node (or null if none found) */ - public function findFirst($nodes, callable $filter) + public function findFirst($nodes, callable $filter) : ?\PhpParser\Node { + if ($nodes === []) { + return null; + } if (!\is_array($nodes)) { $nodes = [$nodes]; } $visitor = new FirstFindingVisitor($filter); - $traverser = new \PhpParser\NodeTraverser(); - $traverser->addVisitor($visitor); + $traverser = new \PhpParser\NodeTraverser($visitor); $traverser->traverse($nodes); return $visitor->getFoundNode(); } /** * Find first node that is an instance of a certain class. * - * @param Node|Node[] $nodes Single node or array of nodes to search in - * @param string $class Class name + * @template TNode as Node * - * @return null|Node Found node, which is an instance of $class (or null if none found) + * @param Node|Node[] $nodes Single node or array of nodes to search in + * @param class-string $class Class name + * + * @return null|TNode Found node, which is an instance of $class (or null if none found) */ - public function findFirstInstanceOf($nodes, string $class) + public function findFirstInstanceOf($nodes, string $class) : ?\PhpParser\Node { return $this->findFirst($nodes, function ($node) use($class) { return $node instanceof $class; diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php b/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php index 56d22cccb26..7712c76360d 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php @@ -6,65 +6,51 @@ namespace PhpParser; class NodeTraverser implements \PhpParser\NodeTraverserInterface { /** - * If NodeVisitor::enterNode() returns DONT_TRAVERSE_CHILDREN, child nodes - * of the current node will not be traversed for any visitors. - * - * For subsequent visitors enterNode() will still be called on the current - * node and leaveNode() will also be invoked for the current node. + * @deprecated Use NodeVisitor::DONT_TRAVERSE_CHILDREN instead. */ - const DONT_TRAVERSE_CHILDREN = 1; + public const DONT_TRAVERSE_CHILDREN = \PhpParser\NodeVisitor::DONT_TRAVERSE_CHILDREN; /** - * If NodeVisitor::enterNode() or NodeVisitor::leaveNode() returns - * STOP_TRAVERSAL, traversal is aborted. - * - * The afterTraverse() method will still be invoked. + * @deprecated Use NodeVisitor::STOP_TRAVERSAL instead. */ - const STOP_TRAVERSAL = 2; + public const STOP_TRAVERSAL = \PhpParser\NodeVisitor::STOP_TRAVERSAL; /** - * If NodeVisitor::leaveNode() returns REMOVE_NODE for a node that occurs - * in an array, it will be removed from the array. - * - * For subsequent visitors leaveNode() will still be invoked for the - * removed node. + * @deprecated Use NodeVisitor::REMOVE_NODE instead. */ - const REMOVE_NODE = 3; + public const REMOVE_NODE = \PhpParser\NodeVisitor::REMOVE_NODE; /** - * If NodeVisitor::enterNode() returns DONT_TRAVERSE_CURRENT_AND_CHILDREN, child nodes - * of the current node will not be traversed for any visitors. - * - * For subsequent visitors enterNode() will not be called as well. - * leaveNode() will be invoked for visitors that has enterNode() method invoked. + * @deprecated Use NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN instead. */ - const DONT_TRAVERSE_CURRENT_AND_CHILDREN = 4; - /** @var NodeVisitor[] Visitors */ - protected $visitors = []; + public const DONT_TRAVERSE_CURRENT_AND_CHILDREN = \PhpParser\NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + /** @var list Visitors */ + protected array $visitors = []; /** @var bool Whether traversal should be stopped */ - protected $stopTraversal; - public function __construct() + protected bool $stopTraversal; + /** + * Create a traverser with the given visitors. + * + * @param NodeVisitor ...$visitors Node visitors + */ + public function __construct(\PhpParser\NodeVisitor ...$visitors) { - // for BC + $this->visitors = $visitors; } /** * Adds a visitor. * * @param NodeVisitor $visitor Visitor to add */ - public function addVisitor(\PhpParser\NodeVisitor $visitor) + public function addVisitor(\PhpParser\NodeVisitor $visitor) : void { $this->visitors[] = $visitor; } /** * Removes an added visitor. - * - * @param NodeVisitor $visitor */ - public function removeVisitor(\PhpParser\NodeVisitor $visitor) + public function removeVisitor(\PhpParser\NodeVisitor $visitor) : void { - foreach ($this->visitors as $index => $storedVisitor) { - if ($storedVisitor === $visitor) { - unset($this->visitors[$index]); - break; - } + $index = \array_search($visitor, $this->visitors); + if ($index !== \false) { + \array_splice($this->visitors, $index, 1, []); } } /** @@ -83,7 +69,8 @@ class NodeTraverser implements \PhpParser\NodeTraverserInterface } } $nodes = $this->traverseArray($nodes); - foreach ($this->visitors as $visitor) { + for ($i = \count($this->visitors) - 1; $i >= 0; --$i) { + $visitor = $this->visitors[$i]; if (null !== ($return = $visitor->afterTraverse($nodes))) { $nodes = $return; } @@ -94,70 +81,70 @@ class NodeTraverser implements \PhpParser\NodeTraverserInterface * Recursively traverse a node. * * @param Node $node Node to traverse. - * - * @return Node Result of traversal (may be original node or new one) */ - protected function traverseNode(\PhpParser\Node $node) : \PhpParser\Node + protected function traverseNode(\PhpParser\Node $node) : void { foreach ($node->getSubNodeNames() as $name) { - $subNode =& $node->{$name}; + $subNode = $node->{$name}; if (\is_array($subNode)) { - $subNode = $this->traverseArray($subNode); + $node->{$name} = $this->traverseArray($subNode); if ($this->stopTraversal) { break; } } elseif ($subNode instanceof \PhpParser\Node) { $traverseChildren = \true; - $breakVisitorIndex = null; + $visitorIndex = -1; $visitors = $this->getVisitorsForNode($subNode); foreach ($visitors as $visitorIndex => $visitor) { $return = $visitor->enterNode($subNode); if (null !== $return) { if ($return instanceof \PhpParser\Node) { $this->ensureReplacementReasonable($subNode, $return); - $subNode = $return; - } elseif (self::DONT_TRAVERSE_CHILDREN === $return) { + $subNode = $node->{$name} = $return; + } elseif (\PhpParser\NodeVisitor::DONT_TRAVERSE_CHILDREN === $return) { $traverseChildren = \false; - } elseif (self::DONT_TRAVERSE_CURRENT_AND_CHILDREN === $return) { + } elseif (\PhpParser\NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN === $return) { $traverseChildren = \false; - $breakVisitorIndex = $visitorIndex; break; - } elseif (self::STOP_TRAVERSAL === $return) { + } elseif (\PhpParser\NodeVisitor::STOP_TRAVERSAL === $return) { $this->stopTraversal = \true; break 2; + } elseif (\PhpParser\NodeVisitor::REPLACE_WITH_NULL === $return) { + $node->{$name} = null; + continue 2; } else { throw new \LogicException('enterNode() returned invalid value of type ' . \gettype($return)); } } } if ($traverseChildren) { - $subNode = $this->traverseNode($subNode); + $this->traverseNode($subNode); if ($this->stopTraversal) { break; } } - foreach ($visitors as $visitorIndex => $visitor) { + for (; $visitorIndex >= 0; --$visitorIndex) { + $visitor = $visitors[$visitorIndex]; $return = $visitor->leaveNode($subNode); if (null !== $return) { if ($return instanceof \PhpParser\Node) { $this->ensureReplacementReasonable($subNode, $return); - $subNode = $return; - } elseif (self::STOP_TRAVERSAL === $return) { + $subNode = $node->{$name} = $return; + } elseif (\PhpParser\NodeVisitor::STOP_TRAVERSAL === $return) { $this->stopTraversal = \true; break 2; + } elseif (\PhpParser\NodeVisitor::REPLACE_WITH_NULL === $return) { + $node->{$name} = null; + break; } elseif (\is_array($return)) { throw new \LogicException('leaveNode() may only return an array ' . 'if the parent structure is an array'); } else { throw new \LogicException('leaveNode() returned invalid value of type ' . \gettype($return)); } } - if ($breakVisitorIndex === $visitorIndex) { - break; - } } } } - return $node; } /** * Recursively traverse array (usually of nodes). @@ -169,61 +156,66 @@ class NodeTraverser implements \PhpParser\NodeTraverserInterface protected function traverseArray(array $nodes) : array { $doNodes = []; - foreach ($nodes as $i => &$node) { + foreach ($nodes as $i => $node) { if ($node instanceof \PhpParser\Node) { $traverseChildren = \true; - $breakVisitorIndex = null; + $visitorIndex = -1; $visitors = $this->getVisitorsForNode($node); foreach ($visitors as $visitorIndex => $visitor) { $return = $visitor->enterNode($node); if (null !== $return) { if ($return instanceof \PhpParser\Node) { $this->ensureReplacementReasonable($node, $return); - $node = $return; - } elseif (self::DONT_TRAVERSE_CHILDREN === $return) { + $nodes[$i] = $node = $return; + } elseif (\is_array($return)) { + $doNodes[] = [$i, $return]; + continue 2; + } elseif (\PhpParser\NodeVisitor::REMOVE_NODE === $return) { + $doNodes[] = [$i, []]; + continue 2; + } elseif (\PhpParser\NodeVisitor::DONT_TRAVERSE_CHILDREN === $return) { $traverseChildren = \false; - } elseif (self::DONT_TRAVERSE_CURRENT_AND_CHILDREN === $return) { + } elseif (\PhpParser\NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN === $return) { $traverseChildren = \false; - $breakVisitorIndex = $visitorIndex; break; - } elseif (self::STOP_TRAVERSAL === $return) { + } elseif (\PhpParser\NodeVisitor::STOP_TRAVERSAL === $return) { $this->stopTraversal = \true; break 2; + } elseif (\PhpParser\NodeVisitor::REPLACE_WITH_NULL === $return) { + throw new \LogicException('REPLACE_WITH_NULL can not be used if the parent structure is an array'); } else { throw new \LogicException('enterNode() returned invalid value of type ' . \gettype($return)); } } } if ($traverseChildren) { - $node = $this->traverseNode($node); + $this->traverseNode($node); if ($this->stopTraversal) { break; } } - foreach ($visitors as $visitorIndex => $visitor) { + for (; $visitorIndex >= 0; --$visitorIndex) { + $visitor = $visitors[$visitorIndex]; $return = $visitor->leaveNode($node); if (null !== $return) { if ($return instanceof \PhpParser\Node) { $this->ensureReplacementReasonable($node, $return); - $node = $return; + $nodes[$i] = $node = $return; } elseif (\is_array($return)) { $doNodes[] = [$i, $return]; break; - } elseif (self::REMOVE_NODE === $return) { + } elseif (\PhpParser\NodeVisitor::REMOVE_NODE === $return) { $doNodes[] = [$i, []]; break; - } elseif (self::STOP_TRAVERSAL === $return) { + } elseif (\PhpParser\NodeVisitor::STOP_TRAVERSAL === $return) { $this->stopTraversal = \true; break 2; - } elseif (\false === $return) { - throw new \LogicException('bool(false) return from leaveNode() no longer supported. ' . 'Return NodeTraverser::REMOVE_NODE instead'); + } elseif (\PhpParser\NodeVisitor::REPLACE_WITH_NULL === $return) { + throw new \LogicException('REPLACE_WITH_NULL can not be used if the parent structure is an array'); } else { throw new \LogicException('leaveNode() returned invalid value of type ' . \gettype($return)); } } - if ($breakVisitorIndex === $visitorIndex) { - break; - } } } elseif (\is_array($node)) { throw new \LogicException('Invalid node structure: Contains nested arrays'); @@ -243,7 +235,7 @@ class NodeTraverser implements \PhpParser\NodeTraverserInterface { return $this->visitors; } - private function ensureReplacementReasonable($old, $new) + private function ensureReplacementReasonable(\PhpParser\Node $old, \PhpParser\Node $new) : void { if ($old instanceof \PhpParser\Node\Stmt && $new instanceof \PhpParser\Node\Expr) { throw new \LogicException("Trying to replace statement ({$old->getType()}) " . "with expression ({$new->getType()}). Are you missing a " . "Stmt_Expression wrapper?"); diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php b/vendor/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php index 959330c89ef..b0127d74ea9 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php @@ -10,13 +10,11 @@ interface NodeTraverserInterface * * @param NodeVisitor $visitor Visitor to add */ - public function addVisitor(\PhpParser\NodeVisitor $visitor); + public function addVisitor(\PhpParser\NodeVisitor $visitor) : void; /** * Removes an added visitor. - * - * @param NodeVisitor $visitor */ - public function removeVisitor(\PhpParser\NodeVisitor $visitor); + public function removeVisitor(\PhpParser\NodeVisitor $visitor) : void; /** * Traverses an array of nodes using the registered visitors. * diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php index 0da77047d8c..605ece98c94 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php @@ -5,6 +5,43 @@ namespace PhpParser; interface NodeVisitor { + /** + * If NodeVisitor::enterNode() returns DONT_TRAVERSE_CHILDREN, child nodes + * of the current node will not be traversed for any visitors. + * + * For subsequent visitors enterNode() will still be called on the current + * node and leaveNode() will also be invoked for the current node. + */ + public const DONT_TRAVERSE_CHILDREN = 1; + /** + * If NodeVisitor::enterNode() or NodeVisitor::leaveNode() returns + * STOP_TRAVERSAL, traversal is aborted. + * + * The afterTraverse() method will still be invoked. + */ + public const STOP_TRAVERSAL = 2; + /** + * If NodeVisitor::leaveNode() returns REMOVE_NODE for a node that occurs + * in an array, it will be removed from the array. + * + * For subsequent visitors leaveNode() will still be invoked for the + * removed node. + */ + public const REMOVE_NODE = 3; + /** + * If NodeVisitor::enterNode() returns DONT_TRAVERSE_CURRENT_AND_CHILDREN, child nodes + * of the current node will not be traversed for any visitors. + * + * For subsequent visitors enterNode() will not be called as well. + * leaveNode() will be invoked for visitors that has enterNode() method invoked. + */ + public const DONT_TRAVERSE_CURRENT_AND_CHILDREN = 4; + /** + * If NodeVisitor::enterNode() or NodeVisitor::leaveNode() returns REPLACE_WITH_NULL, + * the node will be replaced with null. This is not a legal return value if the node is part + * of an array, rather than another node. + */ + public const REPLACE_WITH_NULL = 5; /** * Called once before traversal. * @@ -23,16 +60,25 @@ interface NodeVisitor * Return value semantics: * * null * => $node stays as-is - * * NodeTraverser::DONT_TRAVERSE_CHILDREN + * * array (of Nodes) + * => The return value is merged into the parent array (at the position of the $node) + * * NodeVisitor::REMOVE_NODE + * => $node is removed from the parent array + * * NodeVisitor::REPLACE_WITH_NULL + * => $node is replaced with null + * * NodeVisitor::DONT_TRAVERSE_CHILDREN * => Children of $node are not traversed. $node stays as-is - * * NodeTraverser::STOP_TRAVERSAL + * * NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN + * => Further visitors for the current node are skipped, and its children are not + * traversed. $node stays as-is. + * * NodeVisitor::STOP_TRAVERSAL * => Traversal is aborted. $node stays as-is * * otherwise * => $node is set to the return value * * @param Node $node Node * - * @return null|int|Node Replacement node (or special return value) + * @return null|int|Node|Node[] Replacement node (or special return value) */ public function enterNode(\PhpParser\Node $node); /** @@ -41,9 +87,11 @@ interface NodeVisitor * Return value semantics: * * null * => $node stays as-is - * * NodeTraverser::REMOVE_NODE + * * NodeVisitor::REMOVE_NODE * => $node is removed from the parent array - * * NodeTraverser::STOP_TRAVERSAL + * * NodeVisitor::REPLACE_WITH_NULL + * => $node is replaced with null + * * NodeVisitor::STOP_TRAVERSAL * => Traversal is aborted. $node stays as-is * * array (of Nodes) * => The return value is merged into the parent array (at the position of the $node) diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php new file mode 100644 index 00000000000..3e1cb38a585 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php @@ -0,0 +1,74 @@ + Token positions of comments */ + private array $commentPositions = []; + /** + * Create a comment annotation visitor. + * + * @param Token[] $tokens Token array + */ + public function __construct(array $tokens) + { + $this->tokens = $tokens; + // Collect positions of comments. We use this to avoid traversing parts of the AST where + // there are no comments. + foreach ($tokens as $i => $token) { + if ((\is_array($token) ? $token[0] : $token) === \T_COMMENT || (\is_array($token) ? $token[0] : $token) === \T_DOC_COMMENT) { + $this->commentPositions[] = $i; + } + } + } + public function enterNode(Node $node) + { + $nextCommentPos = \current($this->commentPositions); + if ($nextCommentPos === \false) { + // No more comments. + return self::STOP_TRAVERSAL; + } + $oldPos = $this->pos; + $this->pos = $pos = $node->getStartTokenPos(); + if ($nextCommentPos > $oldPos && $nextCommentPos < $pos) { + $comments = []; + while (--$pos >= $oldPos) { + $token = $this->tokens[$pos]; + if ((\is_array($token) ? $token[0] : $token) === \T_DOC_COMMENT) { + $comments[] = new Comment\Doc(\is_array($token) ? $token[1] : $token, $token->line, $token->pos, $pos, $token->getEndLine(), $token->getEndPos() - 1, $pos); + continue; + } + if ((\is_array($token) ? $token[0] : $token) === \T_COMMENT) { + $comments[] = new Comment(\is_array($token) ? $token[1] : $token, $token->line, $token->pos, $pos, $token->getEndLine(), $token->getEndPos() - 1, $pos); + continue; + } + if ((\is_array($token) ? $token[0] : $token) !== \T_WHITESPACE) { + break; + } + } + if (!empty($comments)) { + $node->setAttribute('comments', \array_reverse($comments)); + } + do { + $nextCommentPos = \next($this->commentPositions); + } while ($nextCommentPos !== \false && $nextCommentPos < $this->pos); + } + $endPos = $node->getEndTokenPos(); + if ($nextCommentPos > $endPos) { + // Skip children if there are no comments located inside this node. + $this->pos = $endPos; + return self::DONT_TRAVERSE_CHILDREN; + } + return null; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php index 6da6af2cccb..b9249026029 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php @@ -14,7 +14,7 @@ class FindingVisitor extends NodeVisitorAbstract /** @var callable Filter callback */ protected $filterCallback; /** @var Node[] Found nodes */ - protected $foundNodes; + protected array $foundNodes; public function __construct(callable $filterCallback) { $this->filterCallback = $filterCallback; @@ -30,7 +30,7 @@ class FindingVisitor extends NodeVisitorAbstract { return $this->foundNodes; } - public function beforeTraverse(array $nodes) + public function beforeTraverse(array $nodes) : ?array { $this->foundNodes = []; return null; diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php index b19f20f2f6b..f05eeff50ab 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php @@ -4,7 +4,7 @@ declare (strict_types=1); namespace PhpParser\NodeVisitor; use PhpParser\Node; -use PhpParser\NodeTraverser; +use PhpParser\NodeVisitor; use PhpParser\NodeVisitorAbstract; /** * This visitor can be used to find the first node satisfying some criterion determined by @@ -15,7 +15,7 @@ class FirstFindingVisitor extends NodeVisitorAbstract /** @var callable Filter callback */ protected $filterCallback; /** @var null|Node Found node */ - protected $foundNode; + protected ?Node $foundNode; public function __construct(callable $filterCallback) { $this->filterCallback = $filterCallback; @@ -27,11 +27,11 @@ class FirstFindingVisitor extends NodeVisitorAbstract * * @return null|Node Found node (or null if not found) */ - public function getFoundNode() + public function getFoundNode() : ?Node { return $this->foundNode; } - public function beforeTraverse(array $nodes) + public function beforeTraverse(array $nodes) : ?array { $this->foundNode = null; return null; @@ -41,7 +41,7 @@ class FirstFindingVisitor extends NodeVisitorAbstract $filterCallback = $this->filterCallback; if ($filterCallback($node)) { $this->foundNode = $node; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } return null; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php index e0f8f5bd224..753c03554ce 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php @@ -14,11 +14,11 @@ use PhpParser\NodeVisitorAbstract; class NameResolver extends NodeVisitorAbstract { /** @var NameContext Naming context */ - protected $nameContext; + protected NameContext $nameContext; /** @var bool Whether to preserve original names */ - protected $preserveOriginalNames; + protected bool $preserveOriginalNames; /** @var bool Whether to replace resolved nodes in place, or to add resolvedNode attributes */ - protected $replaceNodes; + protected bool $replaceNodes; /** * Constructs a name resolution visitor. * @@ -30,7 +30,7 @@ class NameResolver extends NodeVisitorAbstract * namespacedName attribute, as usual.) * * @param ErrorHandler|null $errorHandler Error handler - * @param array $options Options + * @param array{preserveOriginalNames?: bool, replaceNodes?: bool} $options Options */ public function __construct(?ErrorHandler $errorHandler = null, array $options = []) { @@ -40,14 +40,12 @@ class NameResolver extends NodeVisitorAbstract } /** * Get name resolution context. - * - * @return NameContext */ public function getNameContext() : NameContext { return $this->nameContext; } - public function beforeTraverse(array $nodes) + public function beforeTraverse(array $nodes) : ?array { $this->nameContext->startNamespace(); return null; @@ -74,6 +72,8 @@ class NameResolver extends NodeVisitorAbstract $this->resolveAttrGroups($node); if (null !== $node->name) { $this->addNamespacedName($node); + } else { + $node->namespacedName = null; } } elseif ($node instanceof Stmt\Interface_) { foreach ($node->extends as &$interface) { @@ -86,9 +86,7 @@ class NameResolver extends NodeVisitorAbstract $interface = $this->resolveClassName($interface); } $this->resolveAttrGroups($node); - if (null !== $node->name) { - $this->addNamespacedName($node); - } + $this->addNamespacedName($node); } elseif ($node instanceof Stmt\Trait_) { $this->resolveAttrGroups($node); $this->addNamespacedName($node); @@ -104,53 +102,56 @@ class NameResolver extends NodeVisitorAbstract $node->type = $this->resolveType($node->type); } $this->resolveAttrGroups($node); + } elseif ($node instanceof Node\PropertyHook) { + foreach ($node->params as $param) { + $param->type = $this->resolveType($param->type); + $this->resolveAttrGroups($param); + } + $this->resolveAttrGroups($node); } elseif ($node instanceof Stmt\Const_) { foreach ($node->consts as $const) { $this->addNamespacedName($const); } - } else { - if ($node instanceof Stmt\ClassConst) { - if (null !== $node->type) { - $node->type = $this->resolveType($node->type); + } elseif ($node instanceof Stmt\ClassConst) { + if (null !== $node->type) { + $node->type = $this->resolveType($node->type); + } + $this->resolveAttrGroups($node); + } elseif ($node instanceof Stmt\EnumCase) { + $this->resolveAttrGroups($node); + } elseif ($node instanceof Expr\StaticCall || $node instanceof Expr\StaticPropertyFetch || $node instanceof Expr\ClassConstFetch || $node instanceof Expr\New_ || $node instanceof Expr\Instanceof_) { + if ($node->class instanceof Name) { + $node->class = $this->resolveClassName($node->class); + } + } elseif ($node instanceof Stmt\Catch_) { + foreach ($node->types as &$type) { + $type = $this->resolveClassName($type); + } + } elseif ($node instanceof Expr\FuncCall) { + if ($node->name instanceof Name) { + $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_FUNCTION); + } + } elseif ($node instanceof Expr\ConstFetch) { + $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_CONSTANT); + } elseif ($node instanceof Stmt\TraitUse) { + foreach ($node->traits as &$trait) { + $trait = $this->resolveClassName($trait); + } + foreach ($node->adaptations as $adaptation) { + if (null !== $adaptation->trait) { + $adaptation->trait = $this->resolveClassName($adaptation->trait); } - $this->resolveAttrGroups($node); - } else { - if ($node instanceof Stmt\EnumCase) { - $this->resolveAttrGroups($node); - } elseif ($node instanceof Expr\StaticCall || $node instanceof Expr\StaticPropertyFetch || $node instanceof Expr\ClassConstFetch || $node instanceof Expr\New_ || $node instanceof Expr\Instanceof_) { - if ($node->class instanceof Name) { - $node->class = $this->resolveClassName($node->class); - } - } elseif ($node instanceof Stmt\Catch_) { - foreach ($node->types as &$type) { - $type = $this->resolveClassName($type); - } - } elseif ($node instanceof Expr\FuncCall) { - if ($node->name instanceof Name) { - $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_FUNCTION); - } - } elseif ($node instanceof Expr\ConstFetch) { - $node->name = $this->resolveName($node->name, Stmt\Use_::TYPE_CONSTANT); - } elseif ($node instanceof Stmt\TraitUse) { - foreach ($node->traits as &$trait) { - $trait = $this->resolveClassName($trait); - } - foreach ($node->adaptations as $adaptation) { - if (null !== $adaptation->trait) { - $adaptation->trait = $this->resolveClassName($adaptation->trait); - } - if ($adaptation instanceof Stmt\TraitUseAdaptation\Precedence) { - foreach ($adaptation->insteadof as &$insteadof) { - $insteadof = $this->resolveClassName($insteadof); - } - } + if ($adaptation instanceof Stmt\TraitUseAdaptation\Precedence) { + foreach ($adaptation->insteadof as &$insteadof) { + $insteadof = $this->resolveClassName($insteadof); } } } } return null; } - private function addAlias(Stmt\UseUse $use, int $type, ?Name $prefix = null) + /** @param Stmt\Use_::TYPE_* $type */ + private function addAlias(Node\UseItem $use, int $type, ?Name $prefix = null) : void { // Add prefix for group uses $name = $prefix ? Name::concat($prefix, $use->name) : $use->name; @@ -158,8 +159,8 @@ class NameResolver extends NodeVisitorAbstract $type |= $use->type; $this->nameContext->addAlias($name, (string) $use->getAlias(), $type, $use->getAttributes()); } - /** @param Stmt\Function_|Stmt\ClassMethod|Expr\Closure $node */ - private function resolveSignature($node) + /** @param Stmt\Function_|Stmt\ClassMethod|Expr\Closure|Expr\ArrowFunction $node */ + private function resolveSignature($node) : void { foreach ($node->params as $param) { $param->type = $this->resolveType($param->type); @@ -167,7 +168,12 @@ class NameResolver extends NodeVisitorAbstract } $node->returnType = $this->resolveType($node->returnType); } - private function resolveType($node) + /** + * @template T of Node\Identifier|Name|Node\ComplexType|null + * @param T $node + * @return T + */ + private function resolveType(?Node $node) : ?Node { if ($node instanceof Name) { return $this->resolveClassName($node); @@ -188,7 +194,7 @@ class NameResolver extends NodeVisitorAbstract * Resolve name, according to name resolver options. * * @param Name $name Function or constant name to resolve - * @param int $type One of Stmt\Use_::TYPE_* + * @param Stmt\Use_::TYPE_* $type One of Stmt\Use_::TYPE_* * * @return Name Resolved name, or original name with attribute */ @@ -218,15 +224,15 @@ class NameResolver extends NodeVisitorAbstract $name->setAttribute('namespacedName', FullyQualified::concat($this->nameContext->getNamespace(), $name, $name->getAttributes())); return $name; } - protected function resolveClassName(Name $name) + protected function resolveClassName(Name $name) : Name { return $this->resolveName($name, Stmt\Use_::TYPE_NORMAL); } - protected function addNamespacedName(Node $node) + protected function addNamespacedName(Node $node) : void { $node->namespacedName = Name::concat($this->nameContext->getNamespace(), (string) $node->name); } - protected function resolveAttrGroups(Node $node) + protected function resolveAttrGroups(Node $node) : void { foreach ($node->attrGroups as $attrGroup) { foreach ($attrGroup->attrs as $attr) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php index 9a96210ce93..bdd773674ee 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php @@ -19,7 +19,7 @@ final class NodeConnectingVisitor extends NodeVisitorAbstract /** * @var Node[] */ - private $stack = []; + private array $stack = []; /** * @var ?Node */ diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php index b27ca88a335..3cf01811351 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace PhpParser\NodeVisitor; -use function array_pop; -use function count; use PhpParser\Node; use PhpParser\NodeVisitorAbstract; +use function array_pop; +use function count; /** * Visitor that connects a child node to its parent node. * @@ -18,7 +18,7 @@ final class ParentConnectingVisitor extends NodeVisitorAbstract /** * @var Node[] */ - private $stack = []; + private array $stack = []; public function beforeTraverse(array $nodes) { $this->stack = []; diff --git a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php index 7c2e66c64f5..41889087bbf 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php @@ -6,7 +6,7 @@ namespace PhpParser; /** * @codeCoverageIgnore */ -class NodeVisitorAbstract implements \PhpParser\NodeVisitor +abstract class NodeVisitorAbstract implements \PhpParser\NodeVisitor { public function beforeTraverse(array $nodes) { diff --git a/vendor/nikic/php-parser/lib/PhpParser/Parser.php b/vendor/nikic/php-parser/lib/PhpParser/Parser.php index 321e01d2d9d..3f3d7ed8a8b 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Parser.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Parser.php @@ -15,5 +15,11 @@ interface Parser * @return Node\Stmt[]|null Array of statements (or null non-throwing error handler is used and * the parser was unable to recover from an error). */ - public function parse(string $code, ?\PhpParser\ErrorHandler $errorHandler = null); + public function parse(string $code, ?\PhpParser\ErrorHandler $errorHandler = null) : ?array; + /** + * Return tokens for the last parse. + * + * @return Token[] + */ + public function getTokens() : array; } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php b/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php deleted file mode 100644 index 52659927044..00000000000 --- a/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php +++ /dev/null @@ -1,53 +0,0 @@ -parsers = $parsers; - } - public function parse(string $code, ?ErrorHandler $errorHandler = null) - { - if (null === $errorHandler) { - $errorHandler = new ErrorHandler\Throwing(); - } - list($firstStmts, $firstError) = $this->tryParse($this->parsers[0], $errorHandler, $code); - if ($firstError === null) { - return $firstStmts; - } - for ($i = 1, $c = \count($this->parsers); $i < $c; ++$i) { - list($stmts, $error) = $this->tryParse($this->parsers[$i], $errorHandler, $code); - if ($error === null) { - return $stmts; - } - } - throw $firstError; - } - private function tryParse(Parser $parser, ErrorHandler $errorHandler, $code) - { - $stmts = null; - $error = null; - try { - $stmts = $parser->parse($code, $errorHandler); - } catch (Error $error) { - } - return [$stmts, $error]; - } -} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php deleted file mode 100644 index 187660dd3ef..00000000000 --- a/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php +++ /dev/null @@ -1,1320 +0,0 @@ -'", "T_IS_GREATER_OR_EQUAL", "T_SL", "T_SR", "'+'", "'-'", "'.'", "'*'", "'/'", "'%'", "'!'", "T_INSTANCEOF", "'~'", "T_INC", "T_DEC", "T_INT_CAST", "T_DOUBLE_CAST", "T_STRING_CAST", "T_ARRAY_CAST", "T_OBJECT_CAST", "T_BOOL_CAST", "T_UNSET_CAST", "'@'", "T_POW", "'['", "T_NEW", "T_CLONE", "T_EXIT", "T_IF", "T_ELSEIF", "T_ELSE", "T_ENDIF", "T_LNUMBER", "T_DNUMBER", "T_STRING", "T_STRING_VARNAME", "T_VARIABLE", "T_NUM_STRING", "T_INLINE_HTML", "T_ENCAPSED_AND_WHITESPACE", "T_CONSTANT_ENCAPSED_STRING", "T_ECHO", "T_DO", "T_WHILE", "T_ENDWHILE", "T_FOR", "T_ENDFOR", "T_FOREACH", "T_ENDFOREACH", "T_DECLARE", "T_ENDDECLARE", "T_AS", "T_SWITCH", "T_MATCH", "T_ENDSWITCH", "T_CASE", "T_DEFAULT", "T_BREAK", "T_CONTINUE", "T_GOTO", "T_FUNCTION", "T_FN", "T_CONST", "T_RETURN", "T_TRY", "T_CATCH", "T_FINALLY", "T_USE", "T_INSTEADOF", "T_GLOBAL", "T_STATIC", "T_ABSTRACT", "T_FINAL", "T_PRIVATE", "T_PROTECTED", "T_PUBLIC", "T_READONLY", "T_VAR", "T_UNSET", "T_ISSET", "T_EMPTY", "T_HALT_COMPILER", "T_CLASS", "T_TRAIT", "T_INTERFACE", "T_EXTENDS", "T_IMPLEMENTS", "T_OBJECT_OPERATOR", "T_LIST", "T_ARRAY", "T_CALLABLE", "T_CLASS_C", "T_TRAIT_C", "T_METHOD_C", "T_FUNC_C", "T_LINE", "T_FILE", "T_START_HEREDOC", "T_END_HEREDOC", "T_DOLLAR_OPEN_CURLY_BRACES", "T_CURLY_OPEN", "T_PAAMAYIM_NEKUDOTAYIM", "T_NAMESPACE", "T_NS_C", "T_DIR", "T_NS_SEPARATOR", "T_ELLIPSIS", "T_NAME_FULLY_QUALIFIED", "T_NAME_QUALIFIED", "T_NAME_RELATIVE", "';'", "'{'", "'}'", "'('", "')'", "'\$'", "'`'", "']'", "'\"'", "T_ENUM", "T_NULLSAFE_OBJECT_OPERATOR", "T_ATTRIBUTE"); - protected $tokenToSymbol = array(0, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 56, 164, 168, 161, 55, 168, 168, 159, 160, 53, 50, 8, 51, 52, 54, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 31, 156, 44, 16, 46, 30, 68, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 70, 168, 163, 36, 168, 162, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 157, 35, 158, 58, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43, 45, 47, 48, 49, 57, 59, 60, 61, 62, 63, 64, 65, 66, 67, 69, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 165, 131, 132, 133, 166, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 167); - protected $action = array(701, 671, 672, 673, 674, 675, 286, 676, 677, 678, 714, 715, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 0, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32767, -32767, -32767, -32767, 245, 246, 242, 243, 244, -32766, -32766, 679, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, 1230, 245, 246, 1231, 680, 681, 682, 683, 684, 685, 686, 900, 901, 748, -32766, -32766, -32766, -32766, -32766, -32766, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 717, 740, 718, 719, 720, 721, 709, 710, 711, 739, 712, 713, 698, 699, 700, 702, 703, 704, 742, 743, 744, 745, 746, 747, 876, 705, 706, 707, 708, 738, 729, 727, 728, 724, 725, 1047, 716, 722, 723, 730, 731, 733, 732, 734, 735, 55, 56, 425, 57, 58, 726, 737, 736, 756, 59, 60, -226, 61, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, 337, -32767, -32767, -32767, -32767, 29, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 621, -32766, -32766, -32766, -32766, 62, 63, 1047, -32766, -32766, -32766, 64, 419, 65, 294, 295, 66, 67, 68, 69, 70, 71, 72, 73, 824, 25, 302, 74, 418, 985, 987, 670, 669, 1101, 1102, 1079, 756, 756, 768, 1221, 769, 470, -32766, -32766, -32766, 341, 750, 825, 54, -32767, -32767, -32767, -32767, 98, 99, 100, 101, 102, 220, 221, 222, 362, 877, -32766, 27, -32766, -32766, -32766, -32766, -32766, 1047, 492, 126, 1081, 1080, 1082, 370, 1069, 931, 207, 478, 479, 953, 954, 955, 952, 951, 950, 128, 480, 481, 804, 1107, 1108, 1109, 1110, 1104, 1105, 319, 32, 297, 10, 211, -515, 1111, 1106, 670, 669, 1081, 1080, 1082, 220, 221, 222, 41, 364, 341, 334, 421, 336, 426, -128, -128, -128, 313, 1047, 469, -4, 825, 54, 813, 597, 207, 40, 21, 427, -128, 471, -128, 472, -128, 473, -128, 1047, 428, 220, 221, 222, -32766, 33, 34, 429, 361, 327, 52, 35, 474, -32766, -32766, -32766, 342, 357, 358, 475, 476, 48, 207, 249, 670, 669, 477, 443, 300, 796, 847, 430, 431, 28, -32766, 815, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32767, -32767, -32767, -32767, -32767, 953, 954, 955, 952, 951, 950, 422, 756, 424, 426, 827, 635, -128, -32766, -32766, 469, 825, 54, 288, 813, 1152, 756, 40, 21, 427, 317, 471, 345, 472, 129, 473, 9, 1187, 428, 612, 360, 324, 906, 33, 34, 429, 361, 1047, 415, 35, 474, 945, 1069, 315, 125, 357, 358, 475, 476, -32766, -32766, -32766, 927, 302, 477, 121, 1069, 760, 847, 430, 431, 670, 669, 423, 756, 1153, 810, 1047, 480, 767, -32766, 806, -32766, -32766, -32766, -32766, -261, 127, 347, 436, 842, 341, 1079, 1201, 426, 446, 827, 635, -4, 808, 469, 825, 54, 436, 813, 341, 756, 40, 21, 427, 444, 471, 130, 472, 1069, 473, 346, 768, 428, 769, -211, -211, -211, 33, 34, 429, 361, 308, 1077, 35, 474, -32766, -32766, -32766, 1047, 357, 358, 475, 476, -32766, -32766, -32766, 907, 120, 477, 538, 1069, 796, 847, 430, 431, 436, -32766, 341, -32766, -32766, -32766, 1047, 480, 811, -32766, 926, -32766, -32766, 755, 1081, 1080, 1082, 49, -32766, -32766, -32766, 750, 752, 426, 1202, 827, 635, -211, 30, 469, 670, 669, 436, 813, 341, 75, 40, 21, 427, -32766, 471, 1065, 472, 124, 473, 670, 669, 428, 212, -210, -210, -210, 33, 34, 429, 361, 51, 1187, 35, 474, 756, -32766, -32766, -32766, 357, 358, 475, 476, 213, 825, 54, 221, 222, 477, 20, 580, 796, 847, 430, 431, 220, 221, 222, 756, 222, 247, 78, 79, 80, 81, 341, 207, 516, 103, 104, 105, 753, 307, 131, 638, 1069, 207, 341, 207, 122, 827, 635, -210, 36, 106, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 1113, 307, 346, 436, 214, 341, 825, 54, 426, 123, 250, 129, 134, 106, 469, -32766, 571, 1113, 813, 245, 246, 40, 21, 427, 251, 471, 252, 472, 341, 473, 453, 22, 428, 207, 900, 901, 639, 33, 34, 429, 825, 54, -86, 35, 474, 220, 221, 222, 314, 357, 358, 100, 101, 102, 239, 240, 241, 646, 477, -230, 458, 588, 135, 374, 595, 596, 207, 761, 641, 649, 643, 942, 655, 930, 663, 823, 133, 307, 838, 426, -32766, 106, 750, 43, 44, 469, 45, 442, 46, 813, 827, 635, 40, 21, 427, 47, 471, 50, 472, 53, 473, 132, 608, 428, 302, 604, -280, -32766, 33, 34, 429, 825, 54, 426, 35, 474, 756, 958, -84, 469, 357, 358, 520, 813, 629, 363, 40, 21, 427, 477, 471, 574, 472, -515, 473, 848, 617, 428, -423, -32766, 11, 647, 33, 34, 429, 825, 54, 445, 35, 474, 462, 285, 577, 1112, 357, 358, 592, 369, 849, 593, 290, 827, 635, 477, 0, 0, 531, 0, 0, 325, 0, 0, 0, 0, 0, 652, 0, 0, 0, 322, 326, 0, 0, 0, 426, 0, 0, 0, 0, 323, 469, 316, 318, -516, 813, 863, 635, 40, 21, 427, 0, 471, 0, 472, 0, 473, 1159, 0, 428, 0, -414, 6, 7, 33, 34, 429, 825, 54, 426, 35, 474, 12, 14, 373, 469, 357, 358, -424, 813, 562, 755, 40, 21, 427, 477, 471, 248, 472, 840, 473, 38, 39, 428, 658, 659, 814, 822, 33, 34, 429, 801, 816, 879, 35, 474, 215, 216, 870, 871, 357, 358, 217, 771, 218, 799, 864, 827, 635, 477, 770, 861, 859, 937, 938, 935, 209, 821, 805, 807, 809, 812, 934, 764, 1101, 1102, 765, 936, 24, 78, 426, 335, 1103, 359, 636, 640, 469, 642, 644, 645, 813, 827, 635, 40, 21, 427, 648, 471, 650, 472, 651, 473, 653, 654, 428, 637, 26, 660, 797, 33, 34, 429, 215, 216, 1227, 35, 474, 1229, 217, 763, 218, 357, 358, 846, 762, 845, 1228, 844, 1061, 832, 477, 558, 209, 1107, 1108, 1109, 1110, 1104, 1105, 398, 1101, 1102, 1049, 843, 1050, 1111, 1106, 830, 1103, 943, 868, 869, 457, 1226, 1158, 219, 1195, 1193, 1178, 1191, 1092, 918, 827, 635, 31, 1199, 1189, 1056, 37, 42, 76, 77, 210, 287, 292, 293, 308, 309, 310, 311, 339, 356, 416, 0, -227, -226, 16, 17, 18, 393, 454, 461, 463, 467, 552, 626, 1052, 558, 1055, 1107, 1108, 1109, 1110, 1104, 1105, 398, 908, 1117, 1051, 1027, 563, 1111, 1106, 1026, 1094, 1058, 0, -433, 1045, 0, 1057, 219, 1060, 1059, 1076, 0, 1192, 1177, 1173, 1190, 1091, 1224, 1118, 1172, 600); - protected $actionCheck = array(2, 3, 4, 5, 6, 7, 14, 9, 10, 11, 12, 13, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 0, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 9, 10, 11, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 69, 70, 53, 54, 55, 9, 10, 57, 30, 116, 32, 33, 34, 35, 36, 37, 38, 80, 69, 70, 83, 71, 72, 73, 74, 75, 76, 77, 135, 136, 80, 33, 34, 35, 36, 37, 38, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 31, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 13, 134, 135, 136, 137, 138, 139, 140, 141, 142, 3, 4, 5, 6, 7, 148, 149, 150, 82, 12, 13, 160, 15, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 8, 44, 45, 46, 47, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 80, 33, 34, 35, 36, 50, 51, 13, 9, 10, 11, 56, 128, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 1, 70, 71, 72, 73, 59, 60, 37, 38, 78, 79, 80, 82, 82, 106, 85, 108, 86, 9, 10, 11, 161, 80, 1, 2, 44, 45, 46, 47, 48, 49, 50, 51, 52, 9, 10, 11, 106, 156, 30, 8, 32, 33, 34, 35, 36, 13, 116, 8, 153, 154, 155, 8, 122, 158, 30, 125, 126, 116, 117, 118, 119, 120, 121, 31, 134, 135, 156, 137, 138, 139, 140, 141, 142, 143, 145, 146, 8, 8, 133, 149, 150, 37, 38, 153, 154, 155, 9, 10, 11, 159, 8, 161, 162, 8, 164, 74, 75, 76, 77, 8, 13, 80, 0, 1, 2, 84, 158, 30, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 13, 98, 9, 10, 11, 9, 103, 104, 105, 106, 8, 70, 109, 110, 9, 10, 11, 8, 115, 116, 117, 118, 70, 30, 31, 37, 38, 124, 31, 8, 127, 128, 129, 130, 8, 30, 156, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 116, 117, 118, 119, 120, 121, 8, 82, 8, 74, 156, 157, 158, 33, 34, 80, 1, 2, 8, 84, 163, 82, 87, 88, 89, 133, 91, 70, 93, 152, 95, 108, 82, 98, 158, 8, 113, 160, 103, 104, 105, 106, 13, 108, 109, 110, 123, 122, 113, 157, 115, 116, 117, 118, 9, 10, 11, 156, 71, 124, 157, 122, 127, 128, 129, 130, 37, 38, 8, 82, 160, 156, 13, 134, 156, 30, 156, 32, 33, 34, 35, 158, 157, 148, 159, 122, 161, 80, 1, 74, 133, 156, 157, 158, 156, 80, 1, 2, 159, 84, 161, 82, 87, 88, 89, 157, 91, 157, 93, 122, 95, 161, 106, 98, 108, 100, 101, 102, 103, 104, 105, 106, 159, 116, 109, 110, 9, 10, 11, 13, 115, 116, 117, 118, 9, 10, 11, 160, 16, 124, 81, 122, 127, 128, 129, 130, 159, 30, 161, 32, 33, 34, 13, 134, 156, 30, 156, 32, 33, 153, 153, 154, 155, 70, 9, 10, 11, 80, 80, 74, 160, 156, 157, 158, 14, 80, 37, 38, 159, 84, 161, 152, 87, 88, 89, 30, 91, 160, 93, 14, 95, 37, 38, 98, 16, 100, 101, 102, 103, 104, 105, 106, 70, 82, 109, 110, 82, 33, 34, 35, 115, 116, 117, 118, 16, 1, 2, 10, 11, 124, 160, 85, 127, 128, 129, 130, 9, 10, 11, 82, 11, 14, 157, 9, 10, 11, 161, 30, 85, 53, 54, 55, 154, 57, 157, 31, 122, 30, 161, 30, 157, 156, 157, 158, 30, 69, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 144, 57, 161, 159, 16, 161, 1, 2, 74, 157, 16, 152, 157, 69, 80, 116, 161, 144, 84, 69, 70, 87, 88, 89, 16, 91, 16, 93, 161, 95, 75, 76, 98, 30, 135, 136, 31, 103, 104, 105, 1, 2, 31, 109, 110, 9, 10, 11, 31, 115, 116, 50, 51, 52, 50, 51, 52, 31, 124, 160, 75, 76, 101, 102, 111, 112, 30, 156, 157, 31, 31, 156, 157, 156, 157, 31, 31, 57, 38, 74, 33, 69, 80, 70, 70, 80, 70, 89, 70, 84, 156, 157, 87, 88, 89, 70, 91, 70, 93, 70, 95, 70, 96, 98, 71, 77, 82, 85, 103, 104, 105, 1, 2, 74, 109, 110, 82, 82, 97, 80, 115, 116, 85, 84, 92, 106, 87, 88, 89, 124, 91, 90, 93, 133, 95, 128, 94, 98, 147, 116, 97, 31, 103, 104, 105, 1, 2, 97, 109, 110, 97, 97, 100, 144, 115, 116, 100, 106, 128, 113, 161, 156, 157, 124, -1, -1, 151, -1, -1, 114, -1, -1, -1, -1, -1, 31, -1, -1, -1, 131, 131, -1, -1, -1, 74, -1, -1, -1, -1, 132, 80, 133, 133, 133, 84, 156, 157, 87, 88, 89, -1, 91, -1, 93, -1, 95, 144, -1, 98, -1, 147, 147, 147, 103, 104, 105, 1, 2, 74, 109, 110, 147, 147, 147, 80, 115, 116, 147, 84, 151, 153, 87, 88, 89, 124, 91, 31, 93, 152, 95, 156, 156, 98, 156, 156, 156, 156, 103, 104, 105, 156, 156, 156, 109, 110, 50, 51, 156, 156, 115, 116, 56, 156, 58, 156, 156, 156, 157, 124, 156, 156, 156, 156, 156, 156, 70, 156, 156, 156, 156, 156, 156, 156, 78, 79, 156, 156, 159, 157, 74, 157, 86, 157, 157, 157, 80, 157, 157, 157, 84, 156, 157, 87, 88, 89, 157, 91, 157, 93, 157, 95, 157, 157, 98, 157, 159, 158, 158, 103, 104, 105, 50, 51, 158, 109, 110, 158, 56, 158, 58, 115, 116, 158, 158, 158, 158, 158, 158, 158, 124, 135, 70, 137, 138, 139, 140, 141, 142, 143, 78, 79, 158, 158, 158, 149, 150, 158, 86, 158, 158, 158, 158, 158, 164, 159, 158, 158, 158, 158, 158, 158, 156, 157, 159, 158, 158, 163, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, -1, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 135, 160, 137, 138, 139, 140, 141, 142, 143, 160, 160, 160, 160, 160, 149, 150, 160, 160, 163, -1, 162, 162, -1, 163, 159, 163, 163, 163, -1, 163, 163, 163, 163, 163, 163, 163, 163, 163); - protected $actionBase = array(0, 229, 310, 390, 470, 103, 325, 325, 785, -2, -2, 149, -2, -2, -2, 660, 765, 799, 765, 589, 694, 870, 870, 870, 252, 404, 404, 404, 514, 177, 177, 918, 434, 118, 295, 313, 240, 491, 491, 491, 491, 138, 138, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 89, 206, 775, 550, 535, 776, 777, 778, 912, 709, 913, 859, 862, 700, 863, 864, 865, 866, 867, 858, 871, 935, 872, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 322, 592, 285, 319, 232, 44, 691, 691, 691, 691, 691, 691, 691, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 582, 530, 530, 530, 594, 860, 658, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 926, 500, -21, -21, 492, 702, 420, 355, 216, 549, 151, 26, 26, 331, 331, 331, 331, 331, 46, 46, 5, 5, 5, 5, 153, 188, 188, 188, 188, 121, 121, 121, 121, 314, 314, 394, 394, 362, 300, 298, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 67, 656, 656, 659, 659, 522, 554, 554, 554, 554, 679, -59, -59, 381, 462, 462, 462, 528, 717, 854, 382, 382, 382, 382, 382, 382, 561, 561, 561, -3, -3, -3, 692, 115, 137, 115, 137, 678, 732, 450, 732, 338, 677, -15, 510, 812, 468, 707, 856, 711, 857, 572, 735, 267, 529, 654, 674, 463, 529, 529, 529, 529, 654, 610, 640, 608, 463, 529, 463, 718, 323, 496, 89, 570, 507, 675, 779, 293, 670, 781, 290, 373, 332, 566, 278, 435, 733, 784, 914, 917, 385, 715, 675, 675, 675, 352, 511, 278, -8, 605, 605, 605, 605, 156, 605, 605, 605, 605, 251, 276, 375, 402, 780, 657, 657, 690, 869, 783, 783, 657, 689, 657, 690, 874, 874, 874, 874, 657, 657, 657, 657, 783, 783, 783, 688, 783, 239, 703, 704, 704, 874, 742, 743, 657, 657, 712, 783, 783, 783, 712, 695, 874, 701, 741, 277, 783, 874, 672, 689, 672, 657, 701, 672, 689, 689, 672, 22, 666, 668, 873, 875, 887, 791, 662, 685, 879, 880, 876, 878, 811, 699, 744, 497, 669, 671, 673, 680, 719, 682, 713, 674, 667, 667, 667, 655, 720, 655, 667, 667, 667, 667, 667, 667, 667, 667, 868, 646, 731, 714, 653, 745, 553, 573, 792, 664, 814, 900, 893, 919, 920, 881, 898, 655, 916, 739, 247, 643, 882, 813, 788, 655, 883, 655, 794, 655, 902, 820, 686, 823, 825, 667, 910, 921, 923, 924, 925, 927, 928, 929, 930, 684, 931, 749, 696, 894, 299, 877, 718, 729, 705, 790, 750, 829, 328, 932, 830, 655, 655, 795, 786, 655, 796, 751, 740, 890, 756, 895, 933, 664, 708, 896, 655, 706, 831, 934, 328, 681, 683, 888, 661, 757, 886, 911, 885, 803, 761, 649, 663, 832, 833, 834, 693, 763, 891, 892, 889, 764, 805, 665, 807, 768, 697, 835, 809, 884, 769, 848, 849, 899, 676, 730, 710, 698, 687, 810, 850, 897, 770, 771, 772, 853, 773, 855, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 138, 138, 138, -2, -2, -2, -2, 0, 0, -2, 0, 0, 0, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 0, 0, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 599, -21, -21, -21, -21, 599, -21, -21, -21, -21, -21, -21, -21, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, -21, 599, 599, 599, -21, 382, -21, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 599, 0, 0, 599, -21, 599, -21, 599, -21, -21, 599, 599, 599, 599, 599, 599, 599, -21, -21, -21, -21, -21, -21, 0, 561, 561, 561, 561, -21, -21, -21, -21, 382, 382, 382, 382, 382, 382, 259, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 561, 561, -3, -3, 382, 382, 382, 382, 382, 259, 382, 382, 463, 689, 689, 689, 137, 137, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 137, 463, 0, 463, 0, 382, 463, 689, 463, 657, 137, 689, 689, 463, 783, 616, 616, 616, 616, 328, 278, 0, 0, 689, 689, 0, 0, 0, 0, 0, 689, 0, 0, 0, 0, 0, 0, 783, 0, 0, 0, 0, 0, 667, 247, 0, 705, 335, 0, 0, 0, 0, 0, 0, 705, 335, 347, 347, 0, 684, 667, 667, 667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 328); - protected $actionDefault = array(3, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 544, 544, 499, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 299, 299, 299, 32767, 32767, 32767, 532, 532, 532, 532, 532, 532, 532, 532, 532, 532, 532, 32767, 32767, 32767, 32767, 32767, 32767, 383, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 389, 549, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 364, 365, 367, 368, 298, 552, 533, 247, 390, 548, 297, 249, 327, 503, 32767, 32767, 32767, 329, 122, 258, 203, 502, 125, 296, 234, 382, 384, 328, 303, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 302, 458, 361, 360, 359, 460, 32767, 459, 496, 496, 499, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 325, 487, 486, 326, 456, 330, 457, 333, 461, 464, 331, 332, 349, 350, 347, 348, 351, 462, 463, 480, 481, 478, 479, 301, 352, 353, 354, 355, 482, 483, 484, 485, 32767, 32767, 543, 543, 32767, 32767, 282, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 340, 341, 471, 472, 32767, 238, 238, 238, 238, 283, 238, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 335, 336, 334, 466, 467, 465, 432, 32767, 32767, 32767, 434, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 504, 32767, 32767, 32767, 32767, 32767, 517, 421, 171, 32767, 413, 32767, 171, 171, 171, 171, 32767, 222, 224, 167, 32767, 171, 32767, 490, 32767, 32767, 32767, 32767, 522, 345, 32767, 32767, 116, 32767, 32767, 32767, 559, 32767, 517, 32767, 116, 32767, 32767, 32767, 32767, 358, 337, 338, 339, 32767, 32767, 521, 515, 474, 475, 476, 477, 32767, 468, 469, 470, 473, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 429, 435, 435, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 520, 519, 32767, 414, 498, 188, 186, 186, 32767, 208, 208, 32767, 32767, 190, 491, 510, 32767, 190, 173, 32767, 400, 175, 498, 32767, 32767, 240, 32767, 240, 32767, 400, 240, 32767, 32767, 240, 32767, 415, 439, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 379, 380, 493, 506, 32767, 507, 32767, 413, 343, 344, 346, 322, 32767, 324, 369, 370, 371, 372, 373, 374, 375, 377, 32767, 419, 32767, 422, 32767, 32767, 32767, 257, 32767, 557, 32767, 32767, 306, 557, 32767, 32767, 32767, 551, 32767, 32767, 300, 32767, 32767, 32767, 32767, 253, 32767, 169, 32767, 541, 32767, 558, 32767, 515, 32767, 342, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 516, 32767, 32767, 32767, 32767, 229, 32767, 452, 32767, 116, 32767, 32767, 32767, 189, 32767, 32767, 304, 248, 32767, 32767, 550, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 114, 32767, 170, 32767, 32767, 32767, 191, 32767, 32767, 515, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 295, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 515, 32767, 32767, 233, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 415, 32767, 276, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 127, 127, 3, 127, 127, 260, 3, 260, 127, 260, 260, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 216, 219, 208, 208, 164, 127, 127, 268); - protected $goto = array(166, 140, 140, 140, 166, 187, 168, 144, 147, 141, 142, 143, 149, 163, 163, 163, 163, 144, 144, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 138, 159, 160, 161, 162, 184, 139, 185, 493, 494, 377, 495, 499, 500, 501, 502, 503, 504, 505, 506, 971, 164, 145, 146, 148, 171, 176, 186, 203, 253, 256, 258, 260, 263, 264, 265, 266, 267, 268, 269, 277, 278, 279, 280, 303, 304, 328, 329, 330, 394, 395, 396, 542, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 150, 151, 152, 167, 153, 169, 154, 204, 170, 155, 156, 157, 205, 158, 136, 622, 560, 758, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1114, 630, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 759, 519, 530, 508, 657, 555, 1184, 350, 508, 591, 787, 1184, 889, 613, 614, 885, 618, 619, 625, 627, 632, 634, 751, 856, 856, 856, 856, 851, 857, 174, 892, 892, 1206, 1206, 177, 178, 179, 401, 402, 403, 404, 173, 202, 206, 208, 257, 259, 261, 262, 270, 271, 272, 273, 274, 275, 281, 282, 283, 284, 305, 306, 331, 332, 333, 406, 407, 408, 409, 175, 180, 254, 255, 181, 182, 183, 497, 497, 497, 497, 497, 497, 818, 497, 497, 497, 497, 497, 497, 497, 497, 497, 497, 509, 585, 862, 601, 602, 509, 544, 545, 546, 547, 548, 549, 550, 551, 553, 586, 338, 559, 321, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, 400, 607, 536, 536, 568, 532, 537, 534, 534, 496, 498, 524, 540, 569, 572, 583, 590, 298, 296, 296, 296, 298, 289, 299, 611, 1210, 510, 615, 910, 948, 375, 510, 437, 437, 437, 437, 437, 437, 594, 437, 437, 437, 437, 437, 437, 437, 437, 437, 437, 1078, 949, 388, 1176, 561, 1078, 899, 899, 899, 899, 378, 899, 899, 1218, 1218, 1164, 754, 351, 352, 757, 1078, 1078, 1078, 1078, 1078, 1078, 1070, 384, 384, 384, 606, 1218, 878, 860, 858, 860, 656, 466, 511, 887, 882, 754, 384, 754, 384, 969, 384, 391, 385, 587, 353, 414, 384, 1232, 1203, 541, 1198, 1198, 1198, 567, 1095, 386, 386, 386, 1020, 916, 514, 1030, 19, 15, 372, 776, 916, 941, 448, 450, 633, 896, 1217, 1217, 1115, 616, 939, 841, 554, 905, 386, 340, 1071, 1074, 1075, 399, 1070, 1183, 914, 23, 1217, 774, 1183, 543, 603, 389, 1220, 1072, 1175, 1072, 518, 1200, 1200, 1200, 575, 605, 1073, 343, 522, 533, 518, 518, 773, 1090, 1089, 13, 578, 582, 628, 3, 4, 783, 1067, 772, 514, 1062, 1182, 784, 661, 919, 451, 866, 573, 957, 1161, 464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 513, 528, 0, 0, 0, 0, 513, 0, 528, 0, 0, 0, 0, 610, 512, 515, 439, 440, 1068, 620, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 781, 1225, 0, 0, 0, 0, 0, 523, 0, 0, 0, 0, 0, 0, 0, 0, 0, 779, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 301, 301); - protected $gotoCheck = array(43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 57, 69, 15, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 128, 9, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 16, 102, 32, 69, 32, 32, 120, 72, 69, 32, 29, 120, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 6, 69, 69, 69, 69, 69, 69, 27, 77, 77, 77, 77, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 119, 119, 119, 119, 119, 119, 50, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 67, 33, 67, 67, 119, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 127, 57, 127, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 51, 51, 51, 51, 51, 51, 110, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 5, 5, 5, 5, 5, 5, 5, 63, 142, 124, 63, 84, 98, 63, 124, 57, 57, 57, 57, 57, 57, 129, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 98, 12, 82, 12, 57, 57, 57, 57, 57, 46, 57, 57, 144, 144, 133, 11, 72, 72, 14, 57, 57, 57, 57, 57, 57, 82, 13, 13, 13, 49, 144, 14, 14, 14, 14, 14, 57, 14, 14, 14, 11, 13, 11, 13, 102, 13, 48, 11, 70, 70, 70, 13, 13, 140, 2, 9, 9, 9, 2, 34, 125, 125, 125, 103, 13, 13, 34, 34, 34, 34, 25, 13, 8, 8, 8, 8, 79, 143, 143, 8, 8, 8, 9, 34, 81, 125, 18, 82, 82, 82, 125, 82, 121, 85, 34, 143, 24, 121, 47, 34, 17, 143, 82, 82, 82, 47, 121, 121, 121, 40, 40, 82, 58, 58, 58, 47, 47, 23, 126, 126, 58, 62, 62, 62, 30, 30, 23, 116, 23, 13, 114, 121, 26, 74, 86, 65, 71, 66, 100, 132, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 9, -1, -1, -1, -1, 9, -1, 9, -1, -1, -1, -1, 13, 9, 9, 9, 9, 13, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 9, -1, -1, -1, -1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 5); - protected $gotoBase = array(0, 0, -173, 0, 0, 353, 216, 0, 477, 149, 0, 110, 71, 117, 426, 112, 203, 170, 181, 0, 0, 0, 0, 168, 164, 143, 121, 27, 0, 205, -127, 0, -429, 279, 51, 0, 0, 0, 0, 0, 481, 0, 0, -24, 0, 0, 379, 484, 163, 153, 268, 75, 0, 0, 0, 0, 0, 107, 161, 0, 0, 0, 222, -77, 0, 104, 96, -344, 0, -94, 135, 123, -232, 0, 169, 0, 0, -50, 0, 173, 0, 180, 64, 0, 360, 139, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 98, 0, 124, 0, 165, 166, 0, 0, 0, 0, 0, 87, 340, 259, 0, 0, 120, 0, 177, 0, 0, -5, -91, 200, 0, 0, 84, 154, 211, -21, -48, 188, 0, 0, 93, 213, 0, 0, 0, 0, 0, 0, 175, 0, 358, 167, 102, 0, 0); - protected $gotoDefault = array(-32768, 468, 665, 2, 666, 836, 741, 749, 598, 482, 631, 581, 380, 1194, 793, 794, 795, 381, 368, 766, 379, 410, 405, 782, 775, 777, 785, 172, 411, 788, 1, 790, 517, 826, 1021, 365, 798, 366, 589, 800, 526, 802, 803, 137, 382, 383, 527, 483, 390, 576, 817, 276, 387, 819, 367, 820, 829, 371, 465, 455, 460, 529, 556, 609, 432, 447, 570, 564, 535, 1087, 565, 865, 349, 873, 662, 881, 884, 484, 557, 895, 452, 903, 1100, 397, 909, 915, 920, 291, 923, 417, 412, 584, 928, 929, 5, 933, 623, 624, 8, 312, 956, 599, 970, 420, 1040, 1042, 485, 486, 521, 459, 507, 525, 487, 1063, 441, 413, 1066, 433, 488, 489, 434, 435, 1084, 355, 1169, 354, 449, 320, 1156, 579, 1119, 456, 1209, 1165, 348, 490, 491, 376, 1188, 392, 1204, 438, 1211, 1219, 344, 539, 566); - protected $ruleToNonTerminal = array(0, 1, 3, 3, 2, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 10, 11, 11, 12, 12, 13, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 18, 18, 19, 19, 21, 21, 17, 17, 22, 22, 23, 23, 24, 24, 25, 25, 20, 20, 26, 28, 28, 29, 30, 30, 32, 31, 31, 31, 31, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 14, 14, 54, 54, 56, 55, 55, 48, 48, 58, 58, 59, 59, 60, 60, 61, 61, 15, 16, 16, 16, 64, 64, 64, 65, 65, 68, 68, 66, 66, 70, 70, 41, 41, 50, 50, 53, 53, 53, 52, 52, 71, 42, 42, 42, 42, 72, 72, 73, 73, 74, 74, 39, 39, 35, 35, 75, 37, 37, 76, 36, 36, 38, 38, 49, 49, 49, 62, 62, 78, 78, 79, 79, 81, 81, 81, 80, 80, 63, 63, 82, 82, 82, 83, 83, 84, 84, 84, 44, 44, 85, 85, 85, 45, 45, 86, 86, 87, 87, 67, 88, 88, 88, 88, 93, 93, 94, 94, 95, 95, 95, 95, 95, 96, 97, 97, 92, 92, 89, 89, 91, 91, 99, 99, 98, 98, 98, 98, 98, 98, 90, 90, 101, 100, 100, 46, 46, 40, 40, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 34, 34, 47, 47, 106, 106, 107, 107, 107, 107, 113, 102, 102, 109, 109, 115, 115, 116, 117, 118, 118, 118, 118, 118, 118, 118, 69, 69, 57, 57, 57, 57, 103, 103, 122, 122, 119, 119, 123, 123, 123, 123, 104, 104, 104, 108, 108, 108, 114, 114, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 27, 27, 27, 27, 27, 27, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 112, 112, 105, 105, 105, 105, 129, 129, 132, 132, 131, 131, 133, 133, 51, 51, 51, 51, 135, 135, 134, 134, 134, 134, 134, 136, 136, 121, 121, 124, 124, 120, 120, 138, 137, 137, 137, 137, 125, 125, 125, 125, 111, 111, 126, 126, 126, 126, 77, 139, 139, 140, 140, 140, 110, 110, 141, 141, 142, 142, 142, 142, 142, 127, 127, 127, 127, 144, 145, 143, 143, 143, 143, 143, 143, 143, 146, 146, 146); - protected $ruleToLength = array(1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 4, 3, 4, 1, 3, 1, 1, 8, 7, 3, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1, 2, 3, 1, 3, 3, 1, 3, 2, 0, 1, 1, 1, 1, 1, 3, 5, 8, 3, 5, 9, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 1, 2, 2, 5, 7, 9, 5, 6, 3, 3, 2, 2, 1, 1, 1, 0, 2, 8, 0, 4, 1, 3, 0, 1, 0, 1, 0, 1, 1, 1, 10, 7, 6, 5, 1, 2, 2, 0, 2, 0, 2, 0, 2, 1, 3, 1, 4, 1, 4, 1, 1, 4, 1, 3, 3, 3, 4, 4, 5, 0, 2, 4, 3, 1, 1, 1, 4, 0, 2, 3, 0, 2, 4, 0, 2, 0, 3, 1, 2, 1, 1, 0, 1, 3, 4, 6, 1, 1, 1, 0, 1, 0, 2, 2, 3, 3, 1, 3, 1, 2, 2, 3, 1, 1, 2, 4, 3, 1, 1, 3, 2, 0, 1, 3, 3, 9, 3, 1, 3, 0, 2, 4, 5, 4, 4, 4, 3, 1, 1, 1, 3, 1, 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 3, 3, 1, 0, 1, 1, 3, 3, 4, 4, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 5, 4, 3, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 3, 2, 1, 2, 10, 11, 3, 3, 2, 4, 4, 3, 4, 4, 4, 4, 7, 3, 2, 0, 4, 1, 3, 2, 1, 2, 2, 4, 6, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 4, 4, 0, 2, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 1, 3, 1, 4, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, 1, 3, 1, 1, 3, 3, 0, 2, 0, 1, 3, 1, 3, 1, 1, 1, 1, 1, 6, 4, 3, 4, 2, 4, 4, 1, 3, 1, 2, 1, 1, 4, 1, 1, 3, 6, 4, 4, 4, 4, 1, 4, 0, 1, 1, 3, 1, 1, 4, 3, 1, 1, 1, 0, 0, 2, 3, 1, 3, 1, 4, 2, 2, 2, 2, 1, 2, 1, 1, 1, 4, 3, 3, 3, 6, 3, 1, 1, 1); - protected function initReduceCallbacks() - { - $this->reduceCallbacks = [0 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 1 => function ($stackPos) { - $this->semValue = $this->handleNamespaces($this->semStack[$stackPos - (1 - 1)]); - }, 2 => function ($stackPos) { - if (\is_array($this->semStack[$stackPos - (2 - 2)])) { - $this->semValue = \array_merge($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); - } else { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - } - }, 3 => function ($stackPos) { - $this->semValue = array(); - }, 4 => function ($stackPos) { - $startAttributes = $this->lookaheadStartAttributes; - if (isset($startAttributes['comments'])) { - $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); - } else { - $nop = null; - } - if ($nop !== null) { - $this->semStack[$stackPos - (1 - 1)][] = $nop; - } - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 5 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 6 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 7 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 8 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 9 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 10 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 11 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 12 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 13 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 14 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 15 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 16 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 17 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 18 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 19 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 20 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 21 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 22 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 23 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 24 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 25 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 26 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 27 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 28 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 29 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 30 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 31 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 32 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 33 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 34 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 35 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 36 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 37 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 38 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 39 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 40 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 41 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 42 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 43 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 44 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 45 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 46 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 47 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 48 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 49 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 50 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 51 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 52 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 53 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 54 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 55 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 56 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 57 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 58 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 59 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 60 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 61 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 62 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 63 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 64 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 65 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 66 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 67 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 68 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 69 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 70 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 71 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 72 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 73 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 74 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 75 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 76 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 77 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 78 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 79 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 80 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 81 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 82 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 83 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 84 => function ($stackPos) { - $this->semValue = new Node\Identifier($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 85 => function ($stackPos) { - $this->semValue = new Node\Identifier($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 86 => function ($stackPos) { - $this->semValue = new Node\Identifier($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 87 => function ($stackPos) { - $this->semValue = new Node\Identifier($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 88 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 89 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 90 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 91 => function ($stackPos) { - $this->semValue = new Name(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 92 => function ($stackPos) { - $this->semValue = new Expr\Variable(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 93 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 94 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 95 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 96 => function ($stackPos) { - $this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 97 => function ($stackPos) { - $this->semValue = new Stmt\Namespace_($this->semStack[$stackPos - (3 - 2)], null, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - $this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_SEMICOLON); - $this->checkNamespace($this->semValue); - }, 98 => function ($stackPos) { - $this->semValue = new Stmt\Namespace_($this->semStack[$stackPos - (5 - 2)], $this->semStack[$stackPos - (5 - 4)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - $this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); - $this->checkNamespace($this->semValue); - }, 99 => function ($stackPos) { - $this->semValue = new Stmt\Namespace_(null, $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - $this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); - $this->checkNamespace($this->semValue); - }, 100 => function ($stackPos) { - $this->semValue = new Stmt\Use_($this->semStack[$stackPos - (3 - 2)], Stmt\Use_::TYPE_NORMAL, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 101 => function ($stackPos) { - $this->semValue = new Stmt\Use_($this->semStack[$stackPos - (4 - 3)], $this->semStack[$stackPos - (4 - 2)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 102 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 103 => function ($stackPos) { - $this->semValue = new Stmt\Const_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 104 => function ($stackPos) { - $this->semValue = Stmt\Use_::TYPE_FUNCTION; - }, 105 => function ($stackPos) { - $this->semValue = Stmt\Use_::TYPE_CONSTANT; - }, 106 => function ($stackPos) { - $this->semValue = new Stmt\GroupUse($this->semStack[$stackPos - (8 - 3)], $this->semStack[$stackPos - (8 - 6)], $this->semStack[$stackPos - (8 - 2)], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes); - }, 107 => function ($stackPos) { - $this->semValue = new Stmt\GroupUse($this->semStack[$stackPos - (7 - 2)], $this->semStack[$stackPos - (7 - 5)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); - }, 108 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 109 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 110 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 111 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 112 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 113 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 114 => function ($stackPos) { - $this->semValue = new Stmt\UseUse($this->semStack[$stackPos - (1 - 1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - $this->checkUseUse($this->semValue, $stackPos - (1 - 1)); - }, 115 => function ($stackPos) { - $this->semValue = new Stmt\UseUse($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - $this->checkUseUse($this->semValue, $stackPos - (3 - 3)); - }, 116 => function ($stackPos) { - $this->semValue = new Stmt\UseUse($this->semStack[$stackPos - (1 - 1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - $this->checkUseUse($this->semValue, $stackPos - (1 - 1)); - }, 117 => function ($stackPos) { - $this->semValue = new Stmt\UseUse($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - $this->checkUseUse($this->semValue, $stackPos - (3 - 3)); - }, 118 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - $this->semValue->type = Stmt\Use_::TYPE_NORMAL; - }, 119 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue->type = $this->semStack[$stackPos - (2 - 1)]; - }, 120 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 121 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 122 => function ($stackPos) { - $this->semValue = new Node\Const_($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 123 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 124 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 125 => function ($stackPos) { - $this->semValue = new Node\Const_($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 126 => function ($stackPos) { - if (\is_array($this->semStack[$stackPos - (2 - 2)])) { - $this->semValue = \array_merge($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); - } else { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - } - }, 127 => function ($stackPos) { - $this->semValue = array(); - }, 128 => function ($stackPos) { - $startAttributes = $this->lookaheadStartAttributes; - if (isset($startAttributes['comments'])) { - $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); - } else { - $nop = null; - } - if ($nop !== null) { - $this->semStack[$stackPos - (1 - 1)][] = $nop; - } - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 129 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 130 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 131 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 132 => function ($stackPos) { - throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 133 => function ($stackPos) { - if ($this->semStack[$stackPos - (3 - 2)]) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - $attrs = $this->startAttributeStack[$stackPos - (3 - 1)]; - $stmts = $this->semValue; - if (!empty($attrs['comments'])) { - $stmts[0]->setAttribute('comments', \array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); - } - } else { - $startAttributes = $this->startAttributeStack[$stackPos - (3 - 1)]; - if (isset($startAttributes['comments'])) { - $this->semValue = new Stmt\Nop($startAttributes + $this->endAttributes); - } else { - $this->semValue = null; - } - if (null === $this->semValue) { - $this->semValue = array(); - } - } - }, 134 => function ($stackPos) { - $this->semValue = new Stmt\If_($this->semStack[$stackPos - (5 - 2)], ['stmts' => \is_array($this->semStack[$stackPos - (5 - 3)]) ? $this->semStack[$stackPos - (5 - 3)] : array($this->semStack[$stackPos - (5 - 3)]), 'elseifs' => $this->semStack[$stackPos - (5 - 4)], 'else' => $this->semStack[$stackPos - (5 - 5)]], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 135 => function ($stackPos) { - $this->semValue = new Stmt\If_($this->semStack[$stackPos - (8 - 2)], ['stmts' => $this->semStack[$stackPos - (8 - 4)], 'elseifs' => $this->semStack[$stackPos - (8 - 5)], 'else' => $this->semStack[$stackPos - (8 - 6)]], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes); - }, 136 => function ($stackPos) { - $this->semValue = new Stmt\While_($this->semStack[$stackPos - (3 - 2)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 137 => function ($stackPos) { - $this->semValue = new Stmt\Do_($this->semStack[$stackPos - (5 - 4)], \is_array($this->semStack[$stackPos - (5 - 2)]) ? $this->semStack[$stackPos - (5 - 2)] : array($this->semStack[$stackPos - (5 - 2)]), $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 138 => function ($stackPos) { - $this->semValue = new Stmt\For_(['init' => $this->semStack[$stackPos - (9 - 3)], 'cond' => $this->semStack[$stackPos - (9 - 5)], 'loop' => $this->semStack[$stackPos - (9 - 7)], 'stmts' => $this->semStack[$stackPos - (9 - 9)]], $this->startAttributeStack[$stackPos - (9 - 1)] + $this->endAttributes); - }, 139 => function ($stackPos) { - $this->semValue = new Stmt\Switch_($this->semStack[$stackPos - (3 - 2)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 140 => function ($stackPos) { - $this->semValue = new Stmt\Break_(null, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 141 => function ($stackPos) { - $this->semValue = new Stmt\Break_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 142 => function ($stackPos) { - $this->semValue = new Stmt\Continue_(null, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 143 => function ($stackPos) { - $this->semValue = new Stmt\Continue_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 144 => function ($stackPos) { - $this->semValue = new Stmt\Return_(null, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 145 => function ($stackPos) { - $this->semValue = new Stmt\Return_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 146 => function ($stackPos) { - $this->semValue = new Stmt\Global_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 147 => function ($stackPos) { - $this->semValue = new Stmt\Static_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 148 => function ($stackPos) { - $this->semValue = new Stmt\Echo_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 149 => function ($stackPos) { - $this->semValue = new Stmt\InlineHTML($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 150 => function ($stackPos) { - $this->semValue = new Stmt\Expression($this->semStack[$stackPos - (2 - 1)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 151 => function ($stackPos) { - $this->semValue = new Stmt\Expression($this->semStack[$stackPos - (2 - 1)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 152 => function ($stackPos) { - $this->semValue = new Stmt\Unset_($this->semStack[$stackPos - (5 - 3)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 153 => function ($stackPos) { - $this->semValue = new Stmt\Foreach_($this->semStack[$stackPos - (7 - 3)], $this->semStack[$stackPos - (7 - 5)][0], ['keyVar' => null, 'byRef' => $this->semStack[$stackPos - (7 - 5)][1], 'stmts' => $this->semStack[$stackPos - (7 - 7)]], $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); - }, 154 => function ($stackPos) { - $this->semValue = new Stmt\Foreach_($this->semStack[$stackPos - (9 - 3)], $this->semStack[$stackPos - (9 - 7)][0], ['keyVar' => $this->semStack[$stackPos - (9 - 5)], 'byRef' => $this->semStack[$stackPos - (9 - 7)][1], 'stmts' => $this->semStack[$stackPos - (9 - 9)]], $this->startAttributeStack[$stackPos - (9 - 1)] + $this->endAttributes); - }, 155 => function ($stackPos) { - $this->semValue = new Stmt\Declare_($this->semStack[$stackPos - (5 - 3)], $this->semStack[$stackPos - (5 - 5)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 156 => function ($stackPos) { - $this->semValue = new Stmt\TryCatch($this->semStack[$stackPos - (6 - 3)], $this->semStack[$stackPos - (6 - 5)], $this->semStack[$stackPos - (6 - 6)], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes); - $this->checkTryCatch($this->semValue); - }, 157 => function ($stackPos) { - $this->semValue = new Stmt\Throw_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 158 => function ($stackPos) { - $this->semValue = new Stmt\Goto_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 159 => function ($stackPos) { - $this->semValue = new Stmt\Label($this->semStack[$stackPos - (2 - 1)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 160 => function ($stackPos) { - $this->semValue = new Stmt\Expression($this->semStack[$stackPos - (2 - 1)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 161 => function ($stackPos) { - $this->semValue = array(); - /* means: no statement */ - }, 162 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 163 => function ($stackPos) { - $startAttributes = $this->startAttributeStack[$stackPos - (1 - 1)]; - if (isset($startAttributes['comments'])) { - $this->semValue = new Stmt\Nop($startAttributes + $this->endAttributes); - } else { - $this->semValue = null; - } - if ($this->semValue === null) { - $this->semValue = array(); - } - /* means: no statement */ - }, 164 => function ($stackPos) { - $this->semValue = array(); - }, 165 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 166 => function ($stackPos) { - $this->semValue = new Stmt\Catch_(array($this->semStack[$stackPos - (8 - 3)]), $this->semStack[$stackPos - (8 - 4)], $this->semStack[$stackPos - (8 - 7)], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes); - }, 167 => function ($stackPos) { - $this->semValue = null; - }, 168 => function ($stackPos) { - $this->semValue = new Stmt\Finally_($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 169 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 170 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 171 => function ($stackPos) { - $this->semValue = \false; - }, 172 => function ($stackPos) { - $this->semValue = \true; - }, 173 => function ($stackPos) { - $this->semValue = \false; - }, 174 => function ($stackPos) { - $this->semValue = \true; - }, 175 => function ($stackPos) { - $this->semValue = \false; - }, 176 => function ($stackPos) { - $this->semValue = \true; - }, 177 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 178 => function ($stackPos) { - $this->semValue = new Node\Identifier($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 179 => function ($stackPos) { - $this->semValue = new Stmt\Function_($this->semStack[$stackPos - (10 - 3)], ['byRef' => $this->semStack[$stackPos - (10 - 2)], 'params' => $this->semStack[$stackPos - (10 - 5)], 'returnType' => $this->semStack[$stackPos - (10 - 7)], 'stmts' => $this->semStack[$stackPos - (10 - 9)]], $this->startAttributeStack[$stackPos - (10 - 1)] + $this->endAttributes); - }, 180 => function ($stackPos) { - $this->semValue = new Stmt\Class_($this->semStack[$stackPos - (7 - 2)], ['type' => $this->semStack[$stackPos - (7 - 1)], 'extends' => $this->semStack[$stackPos - (7 - 3)], 'implements' => $this->semStack[$stackPos - (7 - 4)], 'stmts' => $this->semStack[$stackPos - (7 - 6)]], $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); - $this->checkClass($this->semValue, $stackPos - (7 - 2)); - }, 181 => function ($stackPos) { - $this->semValue = new Stmt\Interface_($this->semStack[$stackPos - (6 - 2)], ['extends' => $this->semStack[$stackPos - (6 - 3)], 'stmts' => $this->semStack[$stackPos - (6 - 5)]], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes); - $this->checkInterface($this->semValue, $stackPos - (6 - 2)); - }, 182 => function ($stackPos) { - $this->semValue = new Stmt\Trait_($this->semStack[$stackPos - (5 - 2)], ['stmts' => $this->semStack[$stackPos - (5 - 4)]], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 183 => function ($stackPos) { - $this->semValue = 0; - }, 184 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; - }, 185 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; - }, 186 => function ($stackPos) { - $this->semValue = null; - }, 187 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 2)]; - }, 188 => function ($stackPos) { - $this->semValue = array(); - }, 189 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 2)]; - }, 190 => function ($stackPos) { - $this->semValue = array(); - }, 191 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 2)]; - }, 192 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 193 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 194 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); - }, 195 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 2)]; - }, 196 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); - }, 197 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 2)]; - }, 198 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); - }, 199 => function ($stackPos) { - $this->semValue = null; - }, 200 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 2)]; - }, 201 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 202 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 203 => function ($stackPos) { - $this->semValue = new Stmt\DeclareDeclare($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 204 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 205 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 3)]; - }, 206 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 2)]; - }, 207 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (5 - 3)]; - }, 208 => function ($stackPos) { - $this->semValue = array(); - }, 209 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 210 => function ($stackPos) { - $this->semValue = new Stmt\Case_($this->semStack[$stackPos - (4 - 2)], $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 211 => function ($stackPos) { - $this->semValue = new Stmt\Case_(null, $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 212 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 213 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 214 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); - }, 215 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 2)]; - }, 216 => function ($stackPos) { - $this->semValue = array(); - }, 217 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 218 => function ($stackPos) { - $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos - (3 - 2)], \is_array($this->semStack[$stackPos - (3 - 3)]) ? $this->semStack[$stackPos - (3 - 3)] : array($this->semStack[$stackPos - (3 - 3)]), $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 219 => function ($stackPos) { - $this->semValue = array(); - }, 220 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 221 => function ($stackPos) { - $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos - (4 - 2)], $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 222 => function ($stackPos) { - $this->semValue = null; - }, 223 => function ($stackPos) { - $this->semValue = new Stmt\Else_(\is_array($this->semStack[$stackPos - (2 - 2)]) ? $this->semStack[$stackPos - (2 - 2)] : array($this->semStack[$stackPos - (2 - 2)]), $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 224 => function ($stackPos) { - $this->semValue = null; - }, 225 => function ($stackPos) { - $this->semValue = new Stmt\Else_($this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 226 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)], \false); - }, 227 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (2 - 2)], \true); - }, 228 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)], \false); - }, 229 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 230 => function ($stackPos) { - $this->semValue = array(); - }, 231 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 232 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 233 => function ($stackPos) { - $this->semValue = new Node\Param($this->semStack[$stackPos - (4 - 4)], null, $this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 2)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - $this->checkParam($this->semValue); - }, 234 => function ($stackPos) { - $this->semValue = new Node\Param($this->semStack[$stackPos - (6 - 4)], $this->semStack[$stackPos - (6 - 6)], $this->semStack[$stackPos - (6 - 1)], $this->semStack[$stackPos - (6 - 2)], $this->semStack[$stackPos - (6 - 3)], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes); - $this->checkParam($this->semValue); - }, 235 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 236 => function ($stackPos) { - $this->semValue = new Node\Identifier('array', $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 237 => function ($stackPos) { - $this->semValue = new Node\Identifier('callable', $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 238 => function ($stackPos) { - $this->semValue = null; - }, 239 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 240 => function ($stackPos) { - $this->semValue = null; - }, 241 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 2)]; - }, 242 => function ($stackPos) { - $this->semValue = array(); - }, 243 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 244 => function ($stackPos) { - $this->semValue = array(new Node\Arg($this->semStack[$stackPos - (3 - 2)], \false, \false, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes)); - }, 245 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 246 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 247 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos - (1 - 1)], \false, \false, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 248 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos - (2 - 2)], \true, \false, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 249 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos - (2 - 2)], \false, \true, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 250 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 251 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 252 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 253 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 254 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 255 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 256 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 257 => function ($stackPos) { - $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos - (1 - 1)], null, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 258 => function ($stackPos) { - $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 259 => function ($stackPos) { - if ($this->semStack[$stackPos - (2 - 2)] !== null) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - } else { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - } - }, 260 => function ($stackPos) { - $this->semValue = array(); - }, 261 => function ($stackPos) { - $startAttributes = $this->lookaheadStartAttributes; - if (isset($startAttributes['comments'])) { - $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); - } else { - $nop = null; - } - if ($nop !== null) { - $this->semStack[$stackPos - (1 - 1)][] = $nop; - } - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 262 => function ($stackPos) { - $this->semValue = new Stmt\Property($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - $this->checkProperty($this->semValue, $stackPos - (3 - 1)); - }, 263 => function ($stackPos) { - $this->semValue = new Stmt\ClassConst($this->semStack[$stackPos - (3 - 2)], 0, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 264 => function ($stackPos) { - $this->semValue = new Stmt\ClassMethod($this->semStack[$stackPos - (9 - 4)], ['type' => $this->semStack[$stackPos - (9 - 1)], 'byRef' => $this->semStack[$stackPos - (9 - 3)], 'params' => $this->semStack[$stackPos - (9 - 6)], 'returnType' => $this->semStack[$stackPos - (9 - 8)], 'stmts' => $this->semStack[$stackPos - (9 - 9)]], $this->startAttributeStack[$stackPos - (9 - 1)] + $this->endAttributes); - $this->checkClassMethod($this->semValue, $stackPos - (9 - 1)); - }, 265 => function ($stackPos) { - $this->semValue = new Stmt\TraitUse($this->semStack[$stackPos - (3 - 2)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 266 => function ($stackPos) { - $this->semValue = array(); - }, 267 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 268 => function ($stackPos) { - $this->semValue = array(); - }, 269 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 270 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$stackPos - (4 - 1)][0], $this->semStack[$stackPos - (4 - 1)][1], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 271 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos - (5 - 1)][0], $this->semStack[$stackPos - (5 - 1)][1], $this->semStack[$stackPos - (5 - 3)], $this->semStack[$stackPos - (5 - 4)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 272 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos - (4 - 1)][0], $this->semStack[$stackPos - (4 - 1)][1], $this->semStack[$stackPos - (4 - 3)], null, $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 273 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos - (4 - 1)][0], $this->semStack[$stackPos - (4 - 1)][1], null, $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 274 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos - (4 - 1)][0], $this->semStack[$stackPos - (4 - 1)][1], null, $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 275 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)]); - }, 276 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 277 => function ($stackPos) { - $this->semValue = array(null, $this->semStack[$stackPos - (1 - 1)]); - }, 278 => function ($stackPos) { - $this->semValue = null; - }, 279 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 280 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 281 => function ($stackPos) { - $this->semValue = 0; - }, 282 => function ($stackPos) { - $this->semValue = 0; - }, 283 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 284 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 285 => function ($stackPos) { - $this->checkModifier($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $stackPos - (2 - 2)); - $this->semValue = $this->semStack[$stackPos - (2 - 1)] | $this->semStack[$stackPos - (2 - 2)]; - }, 286 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; - }, 287 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; - }, 288 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; - }, 289 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_STATIC; - }, 290 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; - }, 291 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; - }, 292 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 293 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 294 => function ($stackPos) { - $this->semValue = new Node\VarLikeIdentifier(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 295 => function ($stackPos) { - $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos - (1 - 1)], null, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 296 => function ($stackPos) { - $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 297 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 298 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 299 => function ($stackPos) { - $this->semValue = array(); - }, 300 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 301 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 302 => function ($stackPos) { - $this->semValue = new Expr\Assign($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 303 => function ($stackPos) { - $this->semValue = new Expr\Assign($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 304 => function ($stackPos) { - $this->semValue = new Expr\AssignRef($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 305 => function ($stackPos) { - $this->semValue = new Expr\AssignRef($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 306 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 307 => function ($stackPos) { - $this->semValue = new Expr\Clone_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 308 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Plus($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 309 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Minus($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 310 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Mul($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 311 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Div($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 312 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Concat($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 313 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Mod($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 314 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 315 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 316 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 317 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 318 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 319 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Pow($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 320 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Coalesce($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 321 => function ($stackPos) { - $this->semValue = new Expr\PostInc($this->semStack[$stackPos - (2 - 1)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 322 => function ($stackPos) { - $this->semValue = new Expr\PreInc($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 323 => function ($stackPos) { - $this->semValue = new Expr\PostDec($this->semStack[$stackPos - (2 - 1)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 324 => function ($stackPos) { - $this->semValue = new Expr\PreDec($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 325 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 326 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 327 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 328 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 329 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 330 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 331 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 332 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 333 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 334 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 335 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 336 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 337 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 338 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Div($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 339 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 340 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 341 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 342 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 343 => function ($stackPos) { - $this->semValue = new Expr\UnaryPlus($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 344 => function ($stackPos) { - $this->semValue = new Expr\UnaryMinus($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 345 => function ($stackPos) { - $this->semValue = new Expr\BooleanNot($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 346 => function ($stackPos) { - $this->semValue = new Expr\BitwiseNot($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 347 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 348 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 349 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 350 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 351 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 352 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 353 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 354 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 355 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 356 => function ($stackPos) { - $this->semValue = new Expr\Instanceof_($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 357 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 358 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 359 => function ($stackPos) { - $this->semValue = new Expr\Ternary($this->semStack[$stackPos - (5 - 1)], $this->semStack[$stackPos - (5 - 3)], $this->semStack[$stackPos - (5 - 5)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 360 => function ($stackPos) { - $this->semValue = new Expr\Ternary($this->semStack[$stackPos - (4 - 1)], null, $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 361 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 362 => function ($stackPos) { - $this->semValue = new Expr\Isset_($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 363 => function ($stackPos) { - $this->semValue = new Expr\Empty_($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 364 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 365 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 366 => function ($stackPos) { - $this->semValue = new Expr\Eval_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 367 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 368 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 369 => function ($stackPos) { - $this->semValue = new Expr\Cast\Int_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 370 => function ($stackPos) { - $attrs = $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes; - $attrs['kind'] = $this->getFloatCastKind($this->semStack[$stackPos - (2 - 1)]); - $this->semValue = new Expr\Cast\Double($this->semStack[$stackPos - (2 - 2)], $attrs); - }, 371 => function ($stackPos) { - $this->semValue = new Expr\Cast\String_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 372 => function ($stackPos) { - $this->semValue = new Expr\Cast\Array_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 373 => function ($stackPos) { - $this->semValue = new Expr\Cast\Object_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 374 => function ($stackPos) { - $this->semValue = new Expr\Cast\Bool_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 375 => function ($stackPos) { - $this->semValue = new Expr\Cast\Unset_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 376 => function ($stackPos) { - $attrs = $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes; - $attrs['kind'] = \strtolower($this->semStack[$stackPos - (2 - 1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; - $this->semValue = new Expr\Exit_($this->semStack[$stackPos - (2 - 2)], $attrs); - }, 377 => function ($stackPos) { - $this->semValue = new Expr\ErrorSuppress($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 378 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 379 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 380 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 381 => function ($stackPos) { - $this->semValue = new Expr\ShellExec($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 382 => function ($stackPos) { - $this->semValue = new Expr\Print_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 383 => function ($stackPos) { - $this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 384 => function ($stackPos) { - $this->semValue = new Expr\YieldFrom($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 385 => function ($stackPos) { - $this->semValue = new Expr\Closure(['static' => \false, 'byRef' => $this->semStack[$stackPos - (10 - 2)], 'params' => $this->semStack[$stackPos - (10 - 4)], 'uses' => $this->semStack[$stackPos - (10 - 6)], 'returnType' => $this->semStack[$stackPos - (10 - 7)], 'stmts' => $this->semStack[$stackPos - (10 - 9)]], $this->startAttributeStack[$stackPos - (10 - 1)] + $this->endAttributes); - }, 386 => function ($stackPos) { - $this->semValue = new Expr\Closure(['static' => \true, 'byRef' => $this->semStack[$stackPos - (11 - 3)], 'params' => $this->semStack[$stackPos - (11 - 5)], 'uses' => $this->semStack[$stackPos - (11 - 7)], 'returnType' => $this->semStack[$stackPos - (11 - 8)], 'stmts' => $this->semStack[$stackPos - (11 - 10)]], $this->startAttributeStack[$stackPos - (11 - 1)] + $this->endAttributes); - }, 387 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 388 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 389 => function ($stackPos) { - $this->semValue = new Expr\Yield_($this->semStack[$stackPos - (2 - 2)], null, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 390 => function ($stackPos) { - $this->semValue = new Expr\Yield_($this->semStack[$stackPos - (4 - 4)], $this->semStack[$stackPos - (4 - 2)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 391 => function ($stackPos) { - $attrs = $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes; - $attrs['kind'] = Expr\Array_::KIND_LONG; - $this->semValue = new Expr\Array_($this->semStack[$stackPos - (4 - 3)], $attrs); - }, 392 => function ($stackPos) { - $attrs = $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes; - $attrs['kind'] = Expr\Array_::KIND_SHORT; - $this->semValue = new Expr\Array_($this->semStack[$stackPos - (3 - 2)], $attrs); - }, 393 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 394 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch(Scalar\String_::fromString($this->semStack[$stackPos - (4 - 1)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes), $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 395 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 396 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 397 => function ($stackPos) { - $this->semValue = array(new Stmt\Class_(null, ['type' => 0, 'extends' => $this->semStack[$stackPos - (7 - 3)], 'implements' => $this->semStack[$stackPos - (7 - 4)], 'stmts' => $this->semStack[$stackPos - (7 - 6)]], $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes), $this->semStack[$stackPos - (7 - 2)]); - $this->checkClass($this->semValue[0], -1); - }, 398 => function ($stackPos) { - $this->semValue = new Expr\New_($this->semStack[$stackPos - (3 - 2)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 399 => function ($stackPos) { - list($class, $ctorArgs) = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 400 => function ($stackPos) { - $this->semValue = array(); - }, 401 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 3)]; - }, 402 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 403 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 404 => function ($stackPos) { - $this->semValue = new Expr\ClosureUse($this->semStack[$stackPos - (2 - 2)], $this->semStack[$stackPos - (2 - 1)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 405 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 406 => function ($stackPos) { - $this->semValue = new Expr\FuncCall($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 407 => function ($stackPos) { - $this->semValue = new Expr\FuncCall($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 408 => function ($stackPos) { - $this->semValue = new Expr\StaticCall($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 409 => function ($stackPos) { - $this->semValue = new Expr\StaticCall($this->semStack[$stackPos - (6 - 1)], $this->semStack[$stackPos - (6 - 4)], $this->semStack[$stackPos - (6 - 6)], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes); - }, 410 => function ($stackPos) { - $this->semValue = $this->fixupPhp5StaticPropCall($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 411 => function ($stackPos) { - $this->semValue = new Expr\FuncCall($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 412 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 413 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 414 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 415 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 416 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 417 => function ($stackPos) { - $this->semValue = new Name\FullyQualified(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 418 => function ($stackPos) { - $this->semValue = new Name\Relative(\substr($this->semStack[$stackPos - (1 - 1)], 10), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 419 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 420 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 421 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 422 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 423 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 424 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 425 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 426 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 427 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 428 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 429 => function ($stackPos) { - $this->semValue = null; - }, 430 => function ($stackPos) { - $this->semValue = null; - }, 431 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 432 => function ($stackPos) { - $this->semValue = array(); - }, 433 => function ($stackPos) { - $this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$stackPos - (1 - 1)], '`', \false), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes)); - }, 434 => function ($stackPos) { - foreach ($this->semStack[$stackPos - (1 - 1)] as $s) { - if ($s instanceof Node\Scalar\EncapsedStringPart) { - $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', \false); - } - } - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 435 => function ($stackPos) { - $this->semValue = array(); - }, 436 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 437 => function ($stackPos) { - $this->semValue = $this->parseLNumber($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes, \true); - }, 438 => function ($stackPos) { - $this->semValue = Scalar\DNumber::fromString($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 439 => function ($stackPos) { - $this->semValue = Scalar\String_::fromString($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes, \false); - }, 440 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 441 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 442 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 443 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 444 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 445 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 446 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 447 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 448 => function ($stackPos) { - $this->semValue = $this->parseDocString($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 2)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes, $this->startAttributeStack[$stackPos - (3 - 3)] + $this->endAttributeStack[$stackPos - (3 - 3)], \false); - }, 449 => function ($stackPos) { - $this->semValue = $this->parseDocString($this->semStack[$stackPos - (2 - 1)], '', $this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes, $this->startAttributeStack[$stackPos - (2 - 2)] + $this->endAttributeStack[$stackPos - (2 - 2)], \false); - }, 450 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 451 => function ($stackPos) { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 452 => function ($stackPos) { - $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 453 => function ($stackPos) { - $this->semValue = new Expr\Array_($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 454 => function ($stackPos) { - $this->semValue = new Expr\Array_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 455 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 456 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 457 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 458 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 459 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 460 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 461 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 462 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 463 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 464 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 465 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 466 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 467 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 468 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 469 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Div($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 470 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 471 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 472 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 473 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 474 => function ($stackPos) { - $this->semValue = new Expr\UnaryPlus($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 475 => function ($stackPos) { - $this->semValue = new Expr\UnaryMinus($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 476 => function ($stackPos) { - $this->semValue = new Expr\BooleanNot($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 477 => function ($stackPos) { - $this->semValue = new Expr\BitwiseNot($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 478 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 479 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 480 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 481 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 482 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 483 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 484 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 485 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 486 => function ($stackPos) { - $this->semValue = new Expr\Ternary($this->semStack[$stackPos - (5 - 1)], $this->semStack[$stackPos - (5 - 3)], $this->semStack[$stackPos - (5 - 5)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 487 => function ($stackPos) { - $this->semValue = new Expr\Ternary($this->semStack[$stackPos - (4 - 1)], null, $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 488 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 489 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 490 => function ($stackPos) { - $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 491 => function ($stackPos) { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 492 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 493 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 494 => function ($stackPos) { - $attrs = $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes; - $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; - foreach ($this->semStack[$stackPos - (3 - 2)] as $s) { - if ($s instanceof Node\Scalar\EncapsedStringPart) { - $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', \true); - } - } - $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos - (3 - 2)], $attrs); - }, 495 => function ($stackPos) { - $this->semValue = $this->parseDocString($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 2)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes, $this->startAttributeStack[$stackPos - (3 - 3)] + $this->endAttributeStack[$stackPos - (3 - 3)], \true); - }, 496 => function ($stackPos) { - $this->semValue = array(); - }, 497 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 498 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 499 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 500 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 501 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 502 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (3 - 3)], $this->semStack[$stackPos - (3 - 1)], \false, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 503 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (1 - 1)], null, \false, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 504 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 505 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 506 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 507 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 508 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (6 - 2)], $this->semStack[$stackPos - (6 - 5)], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes); - }, 509 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 510 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 511 => function ($stackPos) { - $this->semValue = new Expr\MethodCall($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 512 => function ($stackPos) { - $this->semValue = new Expr\FuncCall($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 513 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 514 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 515 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 516 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 517 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 518 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 519 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 520 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 521 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 522 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 523 => function ($stackPos) { - $var = \substr($this->semStack[$stackPos - (1 - 1)], 1); - $this->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes) : $var; - }, 524 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 525 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos - (6 - 1)], $this->semStack[$stackPos - (6 - 5)], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes); - }, 526 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 527 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 528 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 529 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 530 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 531 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 532 => function ($stackPos) { - $this->semValue = null; - }, 533 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 534 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 535 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 536 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 537 => function ($stackPos) { - $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - $this->errorState = 2; - }, 538 => function ($stackPos) { - $this->semValue = new Expr\List_($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 539 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 540 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 541 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (1 - 1)], null, \false, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 542 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (1 - 1)], null, \false, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 543 => function ($stackPos) { - $this->semValue = null; - }, 544 => function ($stackPos) { - $this->semValue = array(); - }, 545 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 546 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 547 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 548 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (3 - 3)], $this->semStack[$stackPos - (3 - 1)], \false, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 549 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (1 - 1)], null, \false, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 550 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (4 - 4)], $this->semStack[$stackPos - (4 - 1)], \true, $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 551 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (2 - 2)], null, \true, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 552 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (2 - 2)], null, \false, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes, \true); - }, 553 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 554 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 555 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 556 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); - }, 557 => function ($stackPos) { - $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 558 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 559 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 560 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 561 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 562 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 563 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 564 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (6 - 2)], $this->semStack[$stackPos - (6 - 4)], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes); - }, 565 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 566 => function ($stackPos) { - $this->semValue = new Scalar\String_($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 567 => function ($stackPos) { - $this->semValue = $this->parseNumString($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 568 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }]; - } -} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php index 1619488fdc7..08efae9ce1c 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php @@ -1,8 +1,10 @@ '", "T_IS_GREATER_OR_EQUAL", "T_SL", "T_SR", "'+'", "'-'", "'.'", "'*'", "'/'", "'%'", "'!'", "T_INSTANCEOF", "'~'", "T_INC", "T_DEC", "T_INT_CAST", "T_DOUBLE_CAST", "T_STRING_CAST", "T_ARRAY_CAST", "T_OBJECT_CAST", "T_BOOL_CAST", "T_UNSET_CAST", "'@'", "T_POW", "'['", "T_NEW", "T_CLONE", "T_EXIT", "T_IF", "T_ELSEIF", "T_ELSE", "T_ENDIF", "T_LNUMBER", "T_DNUMBER", "T_STRING", "T_STRING_VARNAME", "T_VARIABLE", "T_NUM_STRING", "T_INLINE_HTML", "T_ENCAPSED_AND_WHITESPACE", "T_CONSTANT_ENCAPSED_STRING", "T_ECHO", "T_DO", "T_WHILE", "T_ENDWHILE", "T_FOR", "T_ENDFOR", "T_FOREACH", "T_ENDFOREACH", "T_DECLARE", "T_ENDDECLARE", "T_AS", "T_SWITCH", "T_MATCH", "T_ENDSWITCH", "T_CASE", "T_DEFAULT", "T_BREAK", "T_CONTINUE", "T_GOTO", "T_FUNCTION", "T_FN", "T_CONST", "T_RETURN", "T_TRY", "T_CATCH", "T_FINALLY", "T_USE", "T_INSTEADOF", "T_GLOBAL", "T_STATIC", "T_ABSTRACT", "T_FINAL", "T_PRIVATE", "T_PROTECTED", "T_PUBLIC", "T_READONLY", "T_VAR", "T_UNSET", "T_ISSET", "T_EMPTY", "T_HALT_COMPILER", "T_CLASS", "T_TRAIT", "T_INTERFACE", "T_ENUM", "T_EXTENDS", "T_IMPLEMENTS", "T_OBJECT_OPERATOR", "T_NULLSAFE_OBJECT_OPERATOR", "T_LIST", "T_ARRAY", "T_CALLABLE", "T_CLASS_C", "T_TRAIT_C", "T_METHOD_C", "T_FUNC_C", "T_LINE", "T_FILE", "T_START_HEREDOC", "T_END_HEREDOC", "T_DOLLAR_OPEN_CURLY_BRACES", "T_CURLY_OPEN", "T_PAAMAYIM_NEKUDOTAYIM", "T_NAMESPACE", "T_NS_C", "T_DIR", "T_NS_SEPARATOR", "T_ELLIPSIS", "T_NAME_FULLY_QUALIFIED", "T_NAME_QUALIFIED", "T_NAME_RELATIVE", "T_ATTRIBUTE", "';'", "']'", "'{'", "'}'", "'('", "')'", "'`'", "'\"'", "'\$'"); - protected $tokenToSymbol = array(0, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 56, 166, 168, 167, 55, 168, 168, 163, 164, 53, 50, 8, 51, 52, 54, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 31, 159, 44, 16, 46, 30, 68, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 70, 168, 160, 36, 168, 165, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 161, 35, 162, 58, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43, 45, 47, 48, 49, 57, 59, 60, 61, 62, 63, 64, 65, 66, 67, 69, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158); - protected $action = array(133, 134, 135, 580, 136, 137, 0, 749, 750, 751, 138, 38, 327, -32766, -32766, -32766, -32766, -32766, -32766, -32767, -32767, -32767, -32767, 102, 103, 104, 105, 106, 1110, 1111, 1112, 1109, 1108, 1107, 1113, 743, 742, -32766, 1233, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32767, -32767, -32767, -32767, -32767, 2, 107, 108, 109, 752, 274, 381, 380, -32766, -32766, -32766, -32766, 104, 105, 106, 1025, 423, 110, 265, 139, 402, 756, 757, 758, 759, 467, 468, 429, 939, 291, -32766, 287, -32766, -32766, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 790, 581, 791, 792, 793, 794, 782, 783, 344, 345, 785, 786, 771, 772, 773, 775, 776, 777, 355, 817, 818, 819, 820, 821, 582, 778, 779, 583, 584, 811, 802, 800, 801, 814, 797, 798, 688, -545, 585, 586, 796, 587, 588, 589, 590, 591, 592, -328, -593, -367, 1235, -367, 799, 593, 594, -593, 140, -32766, -32766, -32766, 133, 134, 135, 580, 136, 137, 1058, 749, 750, 751, 138, 38, 689, 1021, 1020, 1019, 1022, 390, -32766, 7, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, 379, 380, 1034, 690, 691, 743, 742, -32766, -32766, -32766, 423, -545, -545, -590, -32766, -32766, -32766, 1033, -32766, 127, -590, 1237, 1236, 1238, 1319, 752, -545, 290, -32766, 283, -32766, -32766, -32766, -32766, -32766, 1237, 1236, 1238, -545, 265, 139, 402, 756, 757, 758, 759, 16, 482, 429, 459, 460, 461, 298, 723, 35, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 790, 581, 791, 792, 793, 794, 782, 783, 344, 345, 785, 786, 771, 772, 773, 775, 776, 777, 355, 817, 818, 819, 820, 821, 582, 778, 779, 583, 584, 811, 802, 800, 801, 814, 797, 798, 129, 825, 585, 586, 796, 587, 588, 589, 590, 591, 592, -328, 83, 84, 85, -593, 799, 593, 594, -593, 149, 774, 744, 745, 746, 747, 748, 825, 749, 750, 751, 787, 788, 37, 145, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 291, 274, 836, 254, 1110, 1111, 1112, 1109, 1108, 1107, 1113, -590, 861, 110, 862, -590, 483, 752, -32766, -32766, -32766, -32766, -32766, 142, 604, 1086, 743, 742, 1263, 326, 988, 753, 754, 755, 756, 757, 758, 759, 309, -32766, 823, -32766, -32766, -32766, -32766, 242, 554, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 790, 813, 791, 792, 793, 794, 782, 783, 784, 812, 785, 786, 771, 772, 773, 775, 776, 777, 816, 817, 818, 819, 820, 821, 822, 778, 779, 780, 781, 811, 802, 800, 801, 814, 797, 798, 311, 941, 789, 795, 796, 803, 804, 806, 805, 807, 808, 323, 610, 1275, 1034, 834, 799, 810, 809, 50, 51, 52, 513, 53, 54, 861, 241, 862, 919, 55, 56, -111, 57, -32766, -32766, -32766, -111, 827, -111, 290, 1303, 1348, 356, 305, 1349, 339, -111, -111, -111, -111, -111, -111, -111, -111, -32766, -194, -32766, -32766, -32766, -193, 957, 958, 830, -86, 989, 959, 835, 58, 59, 340, 429, 953, -544, 60, 833, 61, 247, 248, 62, 63, 64, 65, 66, 67, 68, 69, 1242, 28, 267, 70, 445, 514, -342, -32766, 141, 1269, 1270, 515, 919, 834, 326, -272, 919, 1267, 42, 25, 516, 941, 517, 14, 518, 909, 519, 829, 369, 520, 521, 373, 710, 1034, 44, 45, 446, 376, 375, 388, 46, 522, 713, -86, 441, 1102, 367, 338, -543, 442, -544, -544, 831, 1228, 443, 524, 525, 526, 290, 1237, 1236, 1238, 361, 1031, 444, -544, 1088, 527, 528, 840, 1256, 1257, 1258, 1259, 1253, 1254, 297, -544, 151, -550, -584, 834, 1260, 1255, -584, 1034, 1237, 1236, 1238, 298, -154, -154, -154, 152, 71, 909, 321, 322, 326, 909, 921, 1031, 708, 834, 154, -154, 1338, -154, 155, -154, 283, -154, -543, -543, 82, 1233, 1087, 1323, 735, 156, 326, 374, 158, 1034, 1322, -194, -79, -543, -88, -193, 743, 742, 957, 958, 654, 26, -32766, 523, -51, -543, 33, -549, 895, 953, -111, -111, -111, 32, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, -59, 75, 28, 673, 674, 326, -58, 36, 250, 921, 124, 708, 125, 921, 834, 708, -154, 130, 1267, 131, -32766, -547, 144, -542, 150, 406, 1235, 377, 378, 1147, 1149, 382, 383, -32766, -32766, -32766, -85, -32766, 1057, -32766, -542, -32766, 645, 646, -32766, 159, 160, 161, 1233, -32766, -32766, -32766, 162, -79, 1228, -32766, -32766, 743, 742, 163, -302, -32766, 420, -75, -4, 919, -73, 287, 527, 528, -32766, 1256, 1257, 1258, 1259, 1253, 1254, -72, -71, -70, -69, -68, -67, 1260, 1255, -547, -547, -542, -542, 743, 742, -66, -47, -18, -32766, 73, 148, 919, 322, 326, 1235, 273, -542, 284, -542, -542, 724, -32766, -32766, -32766, 727, -32766, -547, -32766, -542, -32766, 918, 147, -32766, -542, 288, 289, -298, -32766, -32766, -32766, -32766, 714, 279, -32766, -32766, -542, 1235, 280, 285, -32766, 420, 48, 286, -32766, -32766, -32766, 332, -32766, -32766, -32766, 292, -32766, 909, 293, -32766, 935, 274, 1031, 919, -32766, -32766, -32766, 110, 683, 132, -32766, -32766, 834, 146, -32766, 560, -32766, 420, 660, 374, 825, 436, 1350, 74, 1034, -32766, 296, 655, 1117, 909, 957, 958, 306, 715, 699, 523, 556, 303, 13, 310, 853, 953, -111, -111, -111, 701, 464, 493, 954, 283, 299, 300, -32766, 49, 676, 919, 304, 661, 1235, 677, 937, 1274, -32766, 10, 1264, -32766, -32766, -32766, 643, -32766, 919, -32766, 921, -32766, 708, -4, -32766, 126, 34, 919, 566, -32766, -32766, -32766, -32766, 0, 909, -32766, -32766, 0, 1235, 919, 0, -32766, 420, 0, 0, -32766, -32766, -32766, 718, -32766, -32766, -32766, 921, -32766, 708, 1034, -32766, 725, 1276, 0, 488, -32766, -32766, -32766, -32766, 301, 302, -32766, -32766, -507, 1235, 572, -497, -32766, 420, 608, 8, -32766, -32766, -32766, 372, -32766, -32766, -32766, 17, -32766, 909, 371, -32766, 833, 298, 320, 128, -32766, -32766, -32766, 40, 370, 41, -32766, -32766, 909, -250, -250, -250, -32766, 420, 732, 374, 974, 909, 708, 733, 900, -32766, 998, 975, 405, 982, 957, 958, 972, 909, 983, 523, 898, 970, 1091, 1094, 895, 953, -111, -111, -111, 28, 1095, 1092, 1093, -249, -249, -249, 1242, 1099, 709, 374, 845, 834, 1289, 1307, 1341, 1267, 648, 1268, 712, 716, 957, 958, 717, 1242, 719, 523, 921, 720, 708, -250, 895, 953, -111, -111, -111, 721, -16, 722, 726, 711, -511, 921, 409, 708, -578, 1233, 729, 896, 1345, 1347, 921, 1228, 708, -577, 856, 855, 947, 990, 1346, 946, 944, 945, 921, 948, 708, -249, 528, 1219, 1256, 1257, 1258, 1259, 1253, 1254, 928, 938, 926, 980, 981, 632, 1260, 1255, 1344, 1301, -32766, 1290, 1308, 834, 1317, -275, 1235, -576, 73, -550, -549, 322, 326, -32766, -32766, -32766, -548, -32766, -491, -32766, 834, -32766, 1, 29, -32766, 30, 39, 43, 47, -32766, -32766, -32766, 72, 76, 77, -32766, -32766, 1233, -111, -111, 78, -32766, 420, -111, 79, 80, 81, 143, 153, -111, -32766, 157, 246, 328, 1233, -111, -111, 356, -32766, 357, -111, 358, 359, 360, 361, 362, -111, 363, 364, 365, 366, 368, 437, 0, -273, -32766, -272, 19, 20, 298, 21, 22, 24, 404, 75, 1204, 484, 485, 326, 492, 0, 495, 496, 497, 498, 502, 298, 503, 504, 511, 694, 75, 0, 1246, 1187, 326, 1265, 1060, 1059, 1040, 1223, 1036, -277, -103, 18, 23, 27, 295, 403, 601, 605, 634, 700, 1191, 1241, 1188, 1320, 0, 0, 0, 326); - protected $actionCheck = array(2, 3, 4, 5, 6, 7, 0, 9, 10, 11, 12, 13, 70, 9, 10, 11, 9, 10, 11, 44, 45, 46, 47, 48, 49, 50, 51, 52, 116, 117, 118, 119, 120, 121, 122, 37, 38, 30, 116, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 8, 53, 54, 55, 57, 57, 106, 107, 137, 9, 10, 11, 50, 51, 52, 1, 116, 69, 71, 72, 73, 74, 75, 76, 77, 134, 135, 80, 1, 30, 30, 30, 32, 33, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 80, 70, 136, 137, 138, 139, 140, 141, 142, 143, 144, 8, 1, 106, 80, 108, 150, 151, 152, 8, 154, 9, 10, 11, 2, 3, 4, 5, 6, 7, 164, 9, 10, 11, 12, 13, 116, 119, 120, 121, 122, 106, 30, 108, 32, 33, 34, 35, 36, 37, 38, 9, 10, 11, 106, 107, 138, 137, 138, 37, 38, 9, 10, 11, 116, 134, 135, 1, 9, 10, 11, 137, 30, 14, 8, 155, 156, 157, 1, 57, 149, 163, 30, 163, 32, 33, 34, 35, 36, 155, 156, 157, 161, 71, 72, 73, 74, 75, 76, 77, 8, 31, 80, 129, 130, 131, 158, 161, 8, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 8, 80, 136, 137, 138, 139, 140, 141, 142, 143, 144, 164, 9, 10, 11, 160, 150, 151, 152, 164, 154, 2, 3, 4, 5, 6, 7, 80, 9, 10, 11, 12, 13, 30, 8, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 30, 57, 1, 8, 116, 117, 118, 119, 120, 121, 122, 160, 106, 69, 108, 164, 161, 57, 9, 10, 11, 9, 10, 161, 1, 1, 37, 38, 1, 167, 31, 71, 72, 73, 74, 75, 76, 77, 8, 30, 80, 32, 33, 34, 35, 14, 85, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 8, 122, 136, 137, 138, 139, 140, 141, 142, 143, 144, 8, 51, 146, 138, 82, 150, 151, 152, 2, 3, 4, 5, 6, 7, 106, 97, 108, 1, 12, 13, 101, 15, 9, 10, 11, 106, 80, 108, 163, 1, 80, 163, 113, 83, 8, 116, 117, 118, 119, 120, 121, 122, 123, 30, 8, 32, 33, 34, 8, 117, 118, 80, 31, 159, 122, 159, 50, 51, 8, 80, 128, 70, 56, 155, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 1, 70, 71, 72, 73, 74, 162, 9, 161, 78, 79, 80, 1, 82, 167, 164, 1, 86, 87, 88, 89, 122, 91, 101, 93, 84, 95, 156, 8, 98, 99, 8, 161, 138, 103, 104, 105, 106, 107, 8, 109, 110, 31, 97, 8, 123, 115, 116, 70, 8, 134, 135, 156, 122, 8, 124, 125, 126, 163, 155, 156, 157, 163, 116, 8, 149, 162, 136, 137, 8, 139, 140, 141, 142, 143, 144, 145, 161, 14, 163, 160, 82, 151, 152, 164, 138, 155, 156, 157, 158, 75, 76, 77, 14, 163, 84, 165, 166, 167, 84, 159, 116, 161, 82, 14, 90, 85, 92, 14, 94, 163, 96, 134, 135, 161, 116, 159, 1, 161, 14, 167, 106, 14, 138, 8, 164, 16, 149, 31, 164, 37, 38, 117, 118, 75, 76, 137, 122, 31, 161, 14, 163, 127, 128, 129, 130, 131, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 16, 163, 70, 75, 76, 167, 16, 147, 148, 159, 16, 161, 16, 159, 82, 161, 162, 16, 86, 16, 74, 70, 16, 70, 101, 102, 80, 106, 107, 59, 60, 106, 107, 87, 88, 89, 31, 91, 1, 93, 70, 95, 111, 112, 98, 16, 16, 16, 116, 103, 104, 105, 16, 31, 122, 109, 110, 37, 38, 16, 35, 115, 116, 31, 0, 1, 31, 30, 136, 137, 124, 139, 140, 141, 142, 143, 144, 31, 31, 31, 31, 31, 31, 151, 152, 134, 135, 134, 135, 37, 38, 31, 31, 31, 74, 163, 31, 1, 166, 167, 80, 31, 149, 31, 134, 135, 31, 87, 88, 89, 31, 91, 161, 93, 161, 95, 31, 31, 98, 149, 37, 37, 35, 103, 104, 105, 74, 31, 35, 109, 110, 161, 80, 35, 35, 115, 116, 70, 35, 87, 88, 89, 35, 91, 124, 93, 37, 95, 84, 37, 98, 38, 57, 116, 1, 103, 104, 105, 69, 77, 31, 109, 110, 82, 70, 85, 89, 115, 116, 96, 106, 80, 108, 83, 154, 138, 124, 113, 90, 82, 84, 117, 118, 114, 31, 80, 122, 85, 132, 97, 132, 127, 128, 129, 130, 131, 92, 97, 97, 128, 163, 134, 135, 74, 70, 94, 1, 133, 100, 80, 100, 154, 146, 137, 150, 160, 87, 88, 89, 113, 91, 1, 93, 159, 95, 161, 162, 98, 161, 161, 1, 153, 103, 104, 105, 74, -1, 84, 109, 110, -1, 80, 1, -1, 115, 116, -1, -1, 87, 88, 89, 31, 91, 124, 93, 159, 95, 161, 138, 98, 31, 146, -1, 102, 103, 104, 105, 74, 134, 135, 109, 110, 149, 80, 81, 149, 115, 116, 153, 149, 87, 88, 89, 149, 91, 124, 93, 149, 95, 84, 149, 98, 155, 158, 161, 161, 103, 104, 105, 159, 161, 159, 109, 110, 84, 100, 101, 102, 115, 116, 159, 106, 159, 84, 161, 159, 159, 124, 159, 159, 162, 159, 117, 118, 159, 84, 159, 122, 159, 159, 159, 159, 127, 128, 129, 130, 131, 70, 159, 159, 159, 100, 101, 102, 1, 159, 161, 106, 160, 82, 160, 160, 160, 86, 160, 166, 161, 161, 117, 118, 161, 1, 161, 122, 159, 161, 161, 162, 127, 128, 129, 130, 131, 161, 31, 161, 161, 161, 165, 159, 162, 161, 163, 116, 162, 162, 162, 162, 159, 122, 161, 163, 162, 162, 162, 162, 162, 162, 162, 162, 159, 162, 161, 162, 137, 162, 139, 140, 141, 142, 143, 144, 162, 162, 162, 162, 162, 162, 151, 152, 162, 162, 74, 162, 162, 82, 162, 164, 80, 163, 163, 163, 163, 166, 167, 87, 88, 89, 163, 91, 163, 93, 82, 95, 163, 163, 98, 163, 163, 163, 163, 103, 104, 105, 163, 163, 163, 109, 110, 116, 117, 118, 163, 115, 116, 122, 163, 163, 163, 163, 163, 128, 124, 163, 163, 163, 116, 117, 118, 163, 137, 163, 122, 163, 163, 163, 163, 163, 128, 163, 163, 163, 163, 163, 163, -1, 164, 137, 164, 164, 164, 158, 164, 164, 164, 164, 163, 165, 164, 164, 167, 164, -1, 164, 164, 164, 164, 164, 158, 164, 164, 164, 164, 163, -1, 164, 164, 167, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, -1, -1, -1, 167); - protected $actionBase = array(0, -2, 154, 542, 752, 893, 929, 52, 374, 431, 398, 869, 793, 235, 307, 307, 793, 307, 784, 908, 908, 917, 908, 538, 841, 468, 468, 468, 708, 708, 708, 708, 740, 740, 849, 849, 881, 817, 634, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 1036, 348, 346, 370, 653, 1063, 1069, 1065, 1070, 1061, 1060, 1064, 1066, 1071, 946, 947, 774, 949, 950, 943, 952, 1067, 882, 1062, 1068, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 525, 191, 359, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 174, 174, 174, 620, 620, 51, 465, 356, 955, 955, 955, 955, 955, 955, 955, 955, 955, 955, 658, 184, 144, 144, 7, 7, 7, 7, 7, 1031, 371, 1048, -25, -25, -25, -25, 50, 725, 526, 449, 39, 317, 80, 474, 474, 13, 13, 512, 512, 422, 422, 512, 512, 512, 808, 808, 808, 808, 443, 505, 360, 308, -78, 209, 209, 209, 209, -78, -78, -78, -78, 803, 877, -78, -78, -78, 63, 641, 641, 822, -1, -1, -1, 641, 253, 790, 548, 253, 384, 548, 480, 402, 764, 759, -49, 447, 764, 639, 755, 198, 143, 825, 609, 825, 1059, 320, 768, 426, 749, 720, 874, 904, 1072, 796, 941, 798, 942, 106, -58, 710, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1058, 1073, 336, 1059, 423, 1073, 1073, 1073, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 619, 423, 586, 616, 423, 795, 336, 814, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 750, 202, 348, 348, 346, 78, 78, 348, 484, 65, 78, 78, 78, 78, 348, 348, 348, 348, 609, 783, 766, 613, 813, 492, 783, 783, 783, 473, 135, 378, 488, 713, 775, 67, 779, 779, 785, 969, 969, 779, 769, 779, 785, 975, 779, 779, 969, 969, 823, 280, 563, 478, 550, 568, 969, 377, 779, 779, 779, 779, 746, 573, 779, 342, 314, 779, 779, 746, 744, 760, 43, 762, 969, 969, 969, 746, 547, 762, 762, 762, 839, 844, 794, 758, 444, 433, 588, 232, 801, 758, 758, 779, 558, 794, 758, 794, 758, 745, 758, 758, 758, 794, 758, 769, 502, 758, 717, 583, 224, 758, 6, 979, 980, 624, 981, 973, 987, 1019, 991, 992, 873, 965, 999, 974, 993, 972, 970, 773, 682, 684, 818, 811, 963, 777, 777, 777, 956, 777, 777, 777, 777, 777, 777, 777, 777, 682, 743, 829, 765, 1006, 689, 691, 754, 911, 901, 1030, 1004, 1049, 994, 828, 694, 1028, 1008, 910, 821, 1009, 1010, 1029, 1050, 1052, 912, 782, 913, 918, 876, 1012, 883, 777, 979, 992, 693, 974, 993, 972, 970, 748, 739, 737, 738, 736, 735, 723, 734, 753, 1053, 954, 907, 878, 1011, 957, 682, 879, 1023, 756, 1032, 1033, 827, 788, 778, 880, 919, 1014, 1015, 1016, 884, 1054, 887, 830, 1024, 951, 1035, 789, 846, 1037, 1038, 1039, 1040, 889, 920, 892, 916, 900, 845, 776, 1020, 761, 921, 591, 787, 791, 800, 1018, 606, 1000, 902, 906, 922, 1041, 1043, 1044, 923, 924, 995, 847, 1026, 799, 1027, 1022, 848, 850, 617, 797, 1055, 781, 786, 772, 621, 632, 925, 927, 931, 998, 763, 770, 853, 855, 1056, 771, 1057, 938, 635, 857, 718, 939, 1046, 719, 724, 637, 678, 672, 731, 792, 903, 826, 757, 780, 1017, 724, 767, 858, 940, 859, 860, 867, 1045, 868, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 458, 458, 458, 458, 458, 458, 307, 307, 307, 307, 307, 307, 307, 0, 0, 307, 0, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 66, 66, 291, 291, 291, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 0, 291, 291, 291, 291, 291, 291, 291, 291, 66, 823, 66, -1, -1, -1, -1, 66, 66, 66, -88, -88, 66, 384, 66, 66, -1, -1, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 0, 0, 423, 548, 66, 769, 769, 769, 769, 66, 66, 66, 66, 548, 548, 66, 66, 66, 0, 0, 0, 0, 0, 0, 0, 0, 423, 548, 0, 423, 0, 0, 769, 769, 66, 384, 823, 643, 66, 0, 0, 0, 0, 423, 769, 423, 336, 779, 548, 779, 336, 336, 78, 348, 643, 611, 611, 611, 611, 0, 0, 609, 823, 823, 823, 823, 823, 823, 823, 823, 823, 823, 823, 769, 0, 823, 0, 769, 769, 769, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 769, 0, 969, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 975, 0, 0, 0, 0, 0, 0, 0, 0, 769, 0, 0, 0, 0, 0, 0, 0, 0, 0, 777, 788, 0, 788, 0, 777, 777, 777, 0, 0, 0, 0, 797, 771); - protected $actionDefault = array(3, 32767, 103, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 101, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 596, 596, 596, 596, 32767, 32767, 254, 103, 32767, 32767, 469, 387, 387, 387, 32767, 32767, 540, 540, 540, 540, 540, 540, 32767, 32767, 32767, 32767, 32767, 32767, 469, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 101, 32767, 32767, 32767, 37, 7, 8, 10, 11, 50, 17, 324, 32767, 32767, 32767, 32767, 103, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 589, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 473, 452, 453, 455, 456, 386, 541, 595, 327, 592, 385, 146, 339, 329, 242, 330, 258, 474, 259, 475, 478, 479, 215, 287, 382, 150, 151, 416, 470, 418, 468, 472, 417, 392, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 390, 391, 471, 449, 448, 447, 32767, 32767, 414, 415, 419, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 103, 32767, 389, 422, 420, 421, 438, 439, 436, 437, 440, 32767, 32767, 32767, 441, 442, 443, 444, 316, 32767, 32767, 366, 364, 316, 112, 32767, 32767, 429, 430, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 534, 446, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 103, 32767, 101, 536, 411, 413, 503, 424, 425, 423, 393, 32767, 510, 32767, 103, 32767, 512, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 535, 32767, 542, 542, 32767, 496, 101, 195, 32767, 32767, 32767, 195, 195, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 603, 496, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 32767, 195, 111, 32767, 32767, 32767, 101, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 190, 32767, 268, 270, 103, 557, 195, 515, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 508, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 496, 434, 139, 32767, 139, 542, 426, 427, 428, 498, 542, 542, 542, 312, 289, 32767, 32767, 32767, 32767, 513, 513, 101, 101, 101, 101, 508, 32767, 32767, 32767, 32767, 112, 100, 100, 100, 100, 100, 104, 102, 32767, 32767, 32767, 32767, 223, 100, 32767, 102, 102, 32767, 32767, 223, 225, 212, 102, 227, 32767, 561, 562, 223, 102, 227, 227, 227, 247, 247, 485, 318, 102, 100, 102, 102, 197, 318, 318, 32767, 102, 485, 318, 485, 318, 199, 318, 318, 318, 485, 318, 32767, 102, 318, 214, 100, 100, 318, 32767, 32767, 32767, 498, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 222, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 529, 32767, 546, 559, 432, 433, 435, 544, 457, 458, 459, 460, 461, 462, 463, 465, 591, 32767, 502, 32767, 32767, 32767, 338, 601, 32767, 601, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 602, 32767, 542, 32767, 32767, 32767, 32767, 431, 9, 76, 491, 43, 44, 52, 58, 519, 520, 521, 522, 516, 517, 523, 518, 32767, 32767, 524, 567, 32767, 32767, 543, 594, 32767, 32767, 32767, 32767, 32767, 32767, 139, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 529, 32767, 137, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 525, 32767, 32767, 32767, 542, 32767, 32767, 32767, 32767, 314, 311, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 542, 32767, 32767, 32767, 32767, 32767, 291, 32767, 308, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 286, 32767, 32767, 381, 498, 294, 296, 297, 32767, 32767, 32767, 32767, 360, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 153, 153, 3, 3, 341, 153, 153, 153, 341, 341, 153, 341, 341, 341, 153, 153, 153, 153, 153, 153, 280, 185, 262, 265, 247, 247, 153, 352, 153); - protected $goto = array(196, 196, 1032, 704, 695, 431, 659, 1063, 1335, 1335, 425, 313, 314, 335, 574, 319, 430, 336, 432, 636, 652, 653, 851, 670, 671, 672, 1335, 167, 167, 167, 167, 221, 197, 193, 193, 177, 179, 216, 193, 193, 193, 193, 193, 194, 194, 194, 194, 194, 194, 188, 189, 190, 191, 192, 218, 216, 219, 535, 536, 421, 537, 539, 540, 541, 542, 543, 544, 545, 546, 1133, 168, 169, 170, 195, 171, 172, 173, 166, 174, 175, 176, 178, 215, 217, 220, 238, 243, 244, 245, 257, 258, 259, 260, 261, 262, 263, 264, 268, 269, 270, 271, 281, 282, 316, 317, 318, 426, 427, 428, 579, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 180, 237, 181, 198, 199, 200, 239, 188, 189, 190, 191, 192, 218, 1133, 201, 182, 183, 184, 202, 198, 185, 240, 203, 201, 165, 204, 205, 186, 206, 207, 208, 187, 209, 210, 211, 212, 213, 214, 854, 619, 656, 278, 278, 278, 278, 852, 621, 621, 350, 419, 598, 1266, 1266, 1266, 1266, 1266, 1266, 1266, 1266, 1266, 1266, 1284, 1284, 832, 1105, 1106, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 353, 353, 353, 353, 826, 558, 551, 908, 903, 904, 917, 860, 905, 857, 906, 907, 858, 1035, 1035, 911, 864, 679, 950, 458, 863, 1027, 1043, 1044, 832, 885, 832, 1085, 1080, 1081, 1082, 341, 551, 558, 567, 568, 343, 577, 600, 614, 615, 547, 547, 547, 547, 973, 602, 15, 394, 397, 559, 599, 603, 1213, 942, 1234, 571, 1234, 1214, 1217, 943, 1218, 1032, 1032, 1234, 440, 912, 1032, 913, 1032, 1032, 1038, 1037, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1316, 1316, 1316, 1316, 1234, 476, 1309, 1310, 348, 1234, 1234, 1234, 1234, 407, 408, 1234, 1234, 1234, 668, 1324, 669, 354, 412, 413, 414, 867, 682, 466, 466, 415, 994, 354, 354, 346, 924, 424, 466, 609, 925, 5, 879, 6, 940, 866, 940, 354, 354, 1282, 1282, 354, 392, 1351, 1282, 1282, 1282, 1282, 1282, 1282, 1282, 1282, 1282, 1282, 553, 538, 538, 570, 354, 658, 538, 538, 538, 538, 538, 538, 538, 538, 538, 538, 549, 565, 549, 1041, 1042, 731, 635, 637, 850, 549, 657, 965, 410, 703, 681, 685, 1008, 693, 702, 1004, 252, 252, 997, 971, 971, 969, 971, 730, 1056, 550, 1006, 1001, 1182, 456, 847, 1295, 1334, 1334, 967, 967, 967, 967, 325, 308, 456, 961, 968, 249, 249, 249, 249, 251, 253, 438, 1334, 351, 352, 684, 680, 552, 562, 450, 450, 450, 552, 1306, 562, 1306, 479, 395, 462, 1337, 1311, 1312, 1306, 664, 481, 500, 337, 501, 844, 469, 578, 470, 471, 507, 847, 877, 553, 872, 1342, 1343, 1011, 1011, 575, 612, 324, 275, 324, 1318, 1318, 1318, 1318, 607, 622, 625, 626, 627, 628, 649, 650, 651, 706, 956, 401, 692, 875, 1229, 828, 869, 692, 629, 631, 633, 692, 433, 1302, 1225, 734, 613, 433, 880, 868, 1068, 1072, 1069, 1016, 477, 1039, 1039, 881, 0, 976, 663, 1050, 1046, 1047, 1073, 1116, 978, 0, 1227, 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, 929, 1121, 450, 966, 1071, 0, 0, 617, 1304, 1304, 1071, 1230, 1231, 1013, 0, 0, 0, 0, 0, 842, 0, 871, 0, 662, 992, 1114, 884, 597, 1098, 865, 707, 0, 0, 508, 698, 0, 1096, 1232, 1292, 1293, 0, 1224, 0, 847, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255); - protected $gotoCheck = array(42, 42, 72, 9, 72, 65, 65, 126, 181, 181, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 85, 85, 26, 85, 85, 85, 181, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 15, 55, 55, 23, 23, 23, 23, 27, 107, 107, 96, 43, 129, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 168, 168, 12, 143, 143, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 24, 24, 24, 24, 6, 75, 75, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 88, 88, 15, 15, 88, 88, 82, 15, 88, 88, 88, 12, 45, 12, 15, 15, 15, 15, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 106, 106, 106, 106, 49, 106, 75, 58, 58, 58, 58, 58, 78, 78, 72, 170, 72, 78, 78, 78, 78, 72, 72, 72, 82, 64, 72, 64, 72, 72, 117, 117, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 9, 9, 9, 9, 72, 174, 174, 174, 177, 72, 72, 72, 72, 81, 81, 72, 72, 72, 81, 179, 81, 14, 81, 81, 81, 35, 81, 148, 148, 81, 102, 14, 14, 81, 72, 13, 148, 13, 72, 46, 35, 46, 9, 35, 9, 14, 14, 169, 169, 14, 61, 14, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 14, 171, 171, 103, 14, 63, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 19, 48, 19, 118, 118, 48, 48, 48, 25, 19, 48, 92, 92, 92, 48, 48, 48, 48, 48, 48, 5, 5, 25, 25, 25, 25, 25, 25, 113, 25, 25, 25, 150, 19, 22, 14, 180, 180, 19, 19, 19, 19, 167, 167, 19, 19, 19, 5, 5, 5, 5, 5, 5, 112, 180, 96, 96, 14, 115, 9, 9, 23, 23, 23, 9, 129, 9, 129, 83, 9, 9, 180, 176, 176, 129, 119, 83, 154, 29, 154, 18, 9, 9, 9, 9, 154, 22, 9, 14, 39, 9, 9, 106, 106, 2, 2, 24, 24, 24, 129, 129, 129, 129, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 91, 28, 7, 9, 20, 7, 37, 7, 84, 84, 84, 7, 116, 129, 159, 98, 79, 116, 16, 16, 16, 16, 128, 109, 156, 116, 116, 41, -1, 16, 116, 116, 116, 116, 131, 146, 95, -1, 14, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 17, 17, 23, 16, 129, -1, -1, 17, 129, 129, 129, 20, 20, 17, -1, -1, -1, -1, -1, 20, -1, 17, -1, 17, 17, 16, 16, 8, 8, 17, 8, -1, -1, 8, 8, -1, 8, 20, 20, 20, -1, 17, -1, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 5); - protected $gotoBase = array(0, 0, -249, 0, 0, 386, 192, 475, 549, -10, 0, 0, -108, -13, 13, -184, 46, 65, 138, 102, 93, 0, 123, 163, 198, 371, 18, 166, 144, 149, 0, 0, 0, 0, 0, -56, 0, 147, 0, 133, 0, 66, -1, 162, 0, 214, -406, 0, -341, 226, 0, 0, 0, 0, 0, 124, 0, 0, 208, 0, 0, 297, 0, 114, 251, -236, 0, 0, 0, 0, 0, 0, -5, 0, 0, -138, 0, 0, -149, 153, 113, -189, -54, -34, 9, -696, 0, 0, -61, 0, 0, 151, 74, 0, 0, 73, -310, 0, 89, 0, 0, 0, 284, 311, 0, 0, 218, -70, 0, 134, 0, 0, 143, 122, 0, 142, 220, -3, 85, 152, 0, 0, 0, 0, 0, 0, 5, 0, 129, 167, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -86, 0, 0, 71, 0, 282, 0, 125, 0, 0, 0, -51, 0, 64, 0, 0, 126, 0, 0, 0, 0, 0, 0, 0, 88, -55, 95, 232, 111, 0, 0, -6, 0, 68, 267, 0, 277, 96, -299, 0, 0); - protected $gotoDefault = array(-32768, 512, 738, 4, 739, 933, 815, 824, 595, 529, 705, 347, 623, 422, 1300, 910, 1120, 576, 843, 1243, 1251, 457, 846, 330, 728, 892, 893, 894, 398, 385, 859, 396, 647, 624, 494, 878, 453, 870, 486, 873, 452, 882, 164, 418, 510, 886, 3, 889, 555, 920, 386, 897, 387, 675, 899, 561, 901, 902, 393, 399, 400, 1125, 569, 620, 914, 256, 563, 915, 384, 916, 923, 389, 391, 686, 465, 505, 499, 411, 1100, 564, 606, 644, 447, 473, 618, 630, 616, 480, 434, 416, 329, 955, 963, 487, 463, 977, 349, 985, 736, 1132, 638, 489, 993, 639, 1000, 1003, 530, 531, 478, 1015, 272, 1018, 490, 12, 665, 1029, 1030, 666, 640, 1052, 641, 667, 642, 1054, 472, 596, 1062, 454, 1070, 1288, 455, 1074, 266, 1077, 277, 417, 435, 1083, 1084, 9, 1090, 696, 697, 11, 276, 509, 1115, 687, 451, 1131, 439, 1201, 1203, 557, 491, 1221, 1220, 678, 506, 1226, 448, 1291, 449, 532, 474, 315, 533, 307, 333, 312, 548, 294, 334, 534, 475, 1297, 1305, 331, 31, 1325, 1336, 342, 573, 611); - protected $ruleToNonTerminal = array(0, 1, 3, 3, 2, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 10, 11, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 21, 21, 22, 23, 23, 24, 24, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 30, 30, 32, 34, 34, 28, 36, 36, 33, 38, 38, 35, 35, 37, 37, 39, 39, 31, 40, 40, 41, 43, 44, 44, 45, 45, 46, 46, 48, 47, 47, 47, 47, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 25, 25, 68, 68, 71, 71, 70, 69, 69, 62, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 26, 26, 27, 27, 27, 27, 27, 87, 87, 89, 89, 82, 82, 90, 90, 91, 91, 91, 83, 83, 86, 86, 84, 84, 92, 93, 93, 56, 56, 64, 64, 67, 67, 67, 66, 94, 94, 95, 57, 57, 57, 57, 96, 96, 97, 97, 98, 98, 99, 100, 100, 101, 101, 102, 102, 54, 54, 50, 50, 104, 52, 52, 105, 51, 51, 53, 53, 63, 63, 63, 63, 80, 80, 108, 108, 110, 110, 111, 111, 111, 111, 109, 109, 109, 113, 113, 113, 113, 88, 88, 116, 116, 116, 117, 117, 114, 114, 118, 118, 120, 120, 121, 121, 115, 122, 122, 119, 123, 123, 123, 123, 112, 112, 81, 81, 81, 20, 20, 20, 125, 124, 124, 126, 126, 126, 126, 59, 127, 127, 128, 60, 130, 130, 131, 131, 132, 132, 85, 133, 133, 133, 133, 133, 133, 133, 138, 138, 139, 139, 140, 140, 140, 140, 140, 141, 142, 142, 137, 137, 134, 134, 136, 136, 144, 144, 143, 143, 143, 143, 143, 143, 143, 135, 145, 145, 147, 146, 146, 61, 103, 148, 148, 55, 55, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 155, 149, 149, 154, 154, 157, 158, 158, 159, 160, 161, 161, 161, 161, 19, 19, 72, 72, 72, 72, 150, 150, 150, 150, 163, 163, 151, 151, 153, 153, 153, 156, 156, 168, 168, 168, 168, 168, 168, 168, 168, 168, 169, 169, 169, 107, 171, 171, 171, 171, 152, 152, 152, 152, 152, 152, 152, 152, 58, 58, 166, 166, 166, 166, 172, 172, 162, 162, 162, 173, 173, 173, 173, 173, 173, 73, 73, 65, 65, 65, 65, 129, 129, 129, 129, 176, 175, 165, 165, 165, 165, 165, 165, 165, 164, 164, 164, 174, 174, 174, 174, 106, 170, 178, 178, 177, 177, 179, 179, 179, 179, 179, 179, 179, 179, 167, 167, 167, 167, 181, 182, 180, 180, 180, 180, 180, 180, 180, 180, 183, 183, 183, 183); - protected $ruleToLength = array(1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 2, 1, 3, 4, 1, 2, 0, 1, 1, 1, 1, 1, 3, 5, 4, 3, 4, 1, 3, 1, 1, 8, 7, 2, 3, 1, 2, 3, 1, 2, 3, 1, 1, 3, 1, 3, 1, 2, 2, 3, 1, 3, 2, 3, 1, 3, 3, 2, 0, 1, 1, 1, 1, 1, 3, 7, 10, 5, 7, 9, 5, 3, 3, 3, 3, 3, 3, 1, 2, 5, 7, 9, 6, 5, 6, 3, 2, 1, 1, 1, 0, 2, 1, 3, 8, 0, 4, 2, 1, 3, 0, 1, 0, 1, 0, 1, 3, 1, 1, 1, 8, 9, 7, 8, 7, 6, 8, 0, 2, 0, 2, 1, 2, 1, 2, 1, 1, 1, 0, 2, 0, 2, 0, 2, 2, 1, 3, 1, 4, 1, 4, 1, 1, 4, 2, 1, 3, 3, 3, 4, 4, 5, 0, 2, 4, 3, 1, 1, 7, 0, 2, 1, 3, 3, 4, 1, 4, 0, 2, 5, 0, 2, 6, 0, 2, 0, 3, 1, 2, 1, 1, 2, 0, 1, 3, 0, 2, 1, 1, 1, 1, 6, 8, 6, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, 3, 1, 1, 2, 1, 1, 0, 1, 0, 2, 2, 2, 4, 3, 1, 1, 3, 1, 2, 2, 3, 2, 3, 1, 1, 2, 3, 1, 1, 3, 2, 0, 1, 5, 5, 6, 10, 3, 5, 1, 1, 3, 0, 2, 4, 5, 4, 4, 4, 3, 1, 1, 1, 1, 1, 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 3, 2, 2, 3, 1, 0, 1, 1, 3, 3, 3, 4, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 3, 4, 4, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 2, 1, 2, 4, 2, 2, 8, 9, 8, 9, 9, 10, 9, 10, 8, 3, 2, 0, 4, 2, 1, 3, 2, 1, 2, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 0, 3, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 3, 3, 4, 1, 1, 3, 1, 1, 1, 1, 1, 3, 2, 3, 0, 1, 1, 3, 1, 1, 1, 1, 1, 3, 1, 1, 4, 4, 1, 4, 4, 0, 1, 1, 1, 3, 3, 1, 4, 2, 2, 1, 3, 1, 4, 4, 3, 3, 3, 3, 1, 3, 1, 1, 3, 1, 1, 4, 1, 1, 1, 3, 1, 1, 2, 1, 3, 4, 3, 2, 0, 2, 2, 1, 2, 1, 1, 1, 4, 3, 3, 3, 3, 6, 3, 1, 1, 2, 1); - protected function initReduceCallbacks() + public const YYERRTOK = 256; + public const T_THROW = 257; + public const T_INCLUDE = 258; + public const T_INCLUDE_ONCE = 259; + public const T_EVAL = 260; + public const T_REQUIRE = 261; + public const T_REQUIRE_ONCE = 262; + public const T_LOGICAL_OR = 263; + public const T_LOGICAL_XOR = 264; + public const T_LOGICAL_AND = 265; + public const T_PRINT = 266; + public const T_YIELD = 267; + public const T_DOUBLE_ARROW = 268; + public const T_YIELD_FROM = 269; + public const T_PLUS_EQUAL = 270; + public const T_MINUS_EQUAL = 271; + public const T_MUL_EQUAL = 272; + public const T_DIV_EQUAL = 273; + public const T_CONCAT_EQUAL = 274; + public const T_MOD_EQUAL = 275; + public const T_AND_EQUAL = 276; + public const T_OR_EQUAL = 277; + public const T_XOR_EQUAL = 278; + public const T_SL_EQUAL = 279; + public const T_SR_EQUAL = 280; + public const T_POW_EQUAL = 281; + public const T_COALESCE_EQUAL = 282; + public const T_COALESCE = 283; + public const T_BOOLEAN_OR = 284; + public const T_BOOLEAN_AND = 285; + public const T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG = 286; + public const T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG = 287; + public const T_IS_EQUAL = 288; + public const T_IS_NOT_EQUAL = 289; + public const T_IS_IDENTICAL = 290; + public const T_IS_NOT_IDENTICAL = 291; + public const T_SPACESHIP = 292; + public const T_IS_SMALLER_OR_EQUAL = 293; + public const T_IS_GREATER_OR_EQUAL = 294; + public const T_SL = 295; + public const T_SR = 296; + public const T_INSTANCEOF = 297; + public const T_INC = 298; + public const T_DEC = 299; + public const T_INT_CAST = 300; + public const T_DOUBLE_CAST = 301; + public const T_STRING_CAST = 302; + public const T_ARRAY_CAST = 303; + public const T_OBJECT_CAST = 304; + public const T_BOOL_CAST = 305; + public const T_UNSET_CAST = 306; + public const T_POW = 307; + public const T_NEW = 308; + public const T_CLONE = 309; + public const T_EXIT = 310; + public const T_IF = 311; + public const T_ELSEIF = 312; + public const T_ELSE = 313; + public const T_ENDIF = 314; + public const T_LNUMBER = 315; + public const T_DNUMBER = 316; + public const T_STRING = 317; + public const T_STRING_VARNAME = 318; + public const T_VARIABLE = 319; + public const T_NUM_STRING = 320; + public const T_INLINE_HTML = 321; + public const T_ENCAPSED_AND_WHITESPACE = 322; + public const T_CONSTANT_ENCAPSED_STRING = 323; + public const T_ECHO = 324; + public const T_DO = 325; + public const T_WHILE = 326; + public const T_ENDWHILE = 327; + public const T_FOR = 328; + public const T_ENDFOR = 329; + public const T_FOREACH = 330; + public const T_ENDFOREACH = 331; + public const T_DECLARE = 332; + public const T_ENDDECLARE = 333; + public const T_AS = 334; + public const T_SWITCH = 335; + public const T_MATCH = 336; + public const T_ENDSWITCH = 337; + public const T_CASE = 338; + public const T_DEFAULT = 339; + public const T_BREAK = 340; + public const T_CONTINUE = 341; + public const T_GOTO = 342; + public const T_FUNCTION = 343; + public const T_FN = 344; + public const T_CONST = 345; + public const T_RETURN = 346; + public const T_TRY = 347; + public const T_CATCH = 348; + public const T_FINALLY = 349; + public const T_USE = 350; + public const T_INSTEADOF = 351; + public const T_GLOBAL = 352; + public const T_STATIC = 353; + public const T_ABSTRACT = 354; + public const T_FINAL = 355; + public const T_PRIVATE = 356; + public const T_PROTECTED = 357; + public const T_PUBLIC = 358; + public const T_READONLY = 359; + public const T_PUBLIC_SET = 360; + public const T_PROTECTED_SET = 361; + public const T_PRIVATE_SET = 362; + public const T_VAR = 363; + public const T_UNSET = 364; + public const T_ISSET = 365; + public const T_EMPTY = 366; + public const T_HALT_COMPILER = 367; + public const T_CLASS = 368; + public const T_TRAIT = 369; + public const T_INTERFACE = 370; + public const T_ENUM = 371; + public const T_EXTENDS = 372; + public const T_IMPLEMENTS = 373; + public const T_OBJECT_OPERATOR = 374; + public const T_NULLSAFE_OBJECT_OPERATOR = 375; + public const T_LIST = 376; + public const T_ARRAY = 377; + public const T_CALLABLE = 378; + public const T_CLASS_C = 379; + public const T_TRAIT_C = 380; + public const T_METHOD_C = 381; + public const T_FUNC_C = 382; + public const T_PROPERTY_C = 383; + public const T_LINE = 384; + public const T_FILE = 385; + public const T_START_HEREDOC = 386; + public const T_END_HEREDOC = 387; + public const T_DOLLAR_OPEN_CURLY_BRACES = 388; + public const T_CURLY_OPEN = 389; + public const T_PAAMAYIM_NEKUDOTAYIM = 390; + public const T_NAMESPACE = 391; + public const T_NS_C = 392; + public const T_DIR = 393; + public const T_NS_SEPARATOR = 394; + public const T_ELLIPSIS = 395; + public const T_NAME_FULLY_QUALIFIED = 396; + public const T_NAME_QUALIFIED = 397; + public const T_NAME_RELATIVE = 398; + public const T_ATTRIBUTE = 399; + protected int $tokenToSymbolMapSize = 400; + protected int $actionTableSize = 1286; + protected int $gotoTableSize = 646; + protected int $invalidSymbol = 172; + protected int $errorSymbol = 1; + protected int $defaultAction = -32766; + protected int $unexpectedTokenRule = 32767; + protected int $YY2TBLSTATE = 437; + protected int $numNonLeafStates = 742; + protected array $symbolToName = array("EOF", "error", "T_THROW", "T_INCLUDE", "T_INCLUDE_ONCE", "T_EVAL", "T_REQUIRE", "T_REQUIRE_ONCE", "','", "T_LOGICAL_OR", "T_LOGICAL_XOR", "T_LOGICAL_AND", "T_PRINT", "T_YIELD", "T_DOUBLE_ARROW", "T_YIELD_FROM", "'='", "T_PLUS_EQUAL", "T_MINUS_EQUAL", "T_MUL_EQUAL", "T_DIV_EQUAL", "T_CONCAT_EQUAL", "T_MOD_EQUAL", "T_AND_EQUAL", "T_OR_EQUAL", "T_XOR_EQUAL", "T_SL_EQUAL", "T_SR_EQUAL", "T_POW_EQUAL", "T_COALESCE_EQUAL", "'?'", "':'", "T_COALESCE", "T_BOOLEAN_OR", "T_BOOLEAN_AND", "'|'", "'^'", "T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG", "T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG", "T_IS_EQUAL", "T_IS_NOT_EQUAL", "T_IS_IDENTICAL", "T_IS_NOT_IDENTICAL", "T_SPACESHIP", "'<'", "T_IS_SMALLER_OR_EQUAL", "'>'", "T_IS_GREATER_OR_EQUAL", "T_SL", "T_SR", "'+'", "'-'", "'.'", "'*'", "'/'", "'%'", "'!'", "T_INSTANCEOF", "'~'", "T_INC", "T_DEC", "T_INT_CAST", "T_DOUBLE_CAST", "T_STRING_CAST", "T_ARRAY_CAST", "T_OBJECT_CAST", "T_BOOL_CAST", "T_UNSET_CAST", "'@'", "T_POW", "'['", "T_NEW", "T_CLONE", "T_EXIT", "T_IF", "T_ELSEIF", "T_ELSE", "T_ENDIF", "T_LNUMBER", "T_DNUMBER", "T_STRING", "T_STRING_VARNAME", "T_VARIABLE", "T_NUM_STRING", "T_INLINE_HTML", "T_ENCAPSED_AND_WHITESPACE", "T_CONSTANT_ENCAPSED_STRING", "T_ECHO", "T_DO", "T_WHILE", "T_ENDWHILE", "T_FOR", "T_ENDFOR", "T_FOREACH", "T_ENDFOREACH", "T_DECLARE", "T_ENDDECLARE", "T_AS", "T_SWITCH", "T_MATCH", "T_ENDSWITCH", "T_CASE", "T_DEFAULT", "T_BREAK", "T_CONTINUE", "T_GOTO", "T_FUNCTION", "T_FN", "T_CONST", "T_RETURN", "T_TRY", "T_CATCH", "T_FINALLY", "T_USE", "T_INSTEADOF", "T_GLOBAL", "T_STATIC", "T_ABSTRACT", "T_FINAL", "T_PRIVATE", "T_PROTECTED", "T_PUBLIC", "T_READONLY", "T_PUBLIC_SET", "T_PROTECTED_SET", "T_PRIVATE_SET", "T_VAR", "T_UNSET", "T_ISSET", "T_EMPTY", "T_HALT_COMPILER", "T_CLASS", "T_TRAIT", "T_INTERFACE", "T_ENUM", "T_EXTENDS", "T_IMPLEMENTS", "T_OBJECT_OPERATOR", "T_NULLSAFE_OBJECT_OPERATOR", "T_LIST", "T_ARRAY", "T_CALLABLE", "T_CLASS_C", "T_TRAIT_C", "T_METHOD_C", "T_FUNC_C", "T_PROPERTY_C", "T_LINE", "T_FILE", "T_START_HEREDOC", "T_END_HEREDOC", "T_DOLLAR_OPEN_CURLY_BRACES", "T_CURLY_OPEN", "T_PAAMAYIM_NEKUDOTAYIM", "T_NAMESPACE", "T_NS_C", "T_DIR", "T_NS_SEPARATOR", "T_ELLIPSIS", "T_NAME_FULLY_QUALIFIED", "T_NAME_QUALIFIED", "T_NAME_RELATIVE", "T_ATTRIBUTE", "';'", "']'", "'('", "')'", "'{'", "'}'", "'`'", "'\"'", "'\$'"); + protected array $tokenToSymbol = array(0, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 56, 170, 172, 171, 55, 172, 172, 165, 166, 53, 50, 8, 51, 52, 54, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 31, 163, 44, 16, 46, 30, 68, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 70, 172, 164, 36, 172, 169, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 167, 35, 168, 58, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43, 45, 47, 48, 49, 57, 59, 60, 61, 62, 63, 64, 65, 66, 67, 69, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162); + protected array $action = array(128, 129, 130, 565, 131, 132, 944, 754, 755, 756, 133, 38, 838, 485, 561, 1365, -32766, -32766, -32766, 0, 829, 1122, 1123, 1124, 1118, 1117, 1116, 1125, 1119, 1120, 1121, -32766, -32766, -32766, -332, 748, 747, -32766, 840, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32767, -32767, -32767, -32767, -32767, 24, -32766, 1034, -568, 757, 1122, 1123, 1124, 1118, 1117, 1116, 1125, 1119, 1120, 1121, 2, 381, 382, 265, 134, 384, 761, 762, 763, 764, 1111, 425, 426, 1300, 329, 36, 248, 26, 291, 818, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 794, 566, 795, 796, 797, 798, 786, 787, 346, 347, 789, 790, 775, 776, 777, 779, 780, 781, 357, 821, 822, 823, 824, 825, 567, -568, -568, 299, 782, 783, 568, 569, -194, 806, 804, 805, 817, 801, 802, 35, -193, 570, 571, 800, 572, 573, 574, 575, -32766, 576, 577, 471, 472, 486, 238, -568, 803, 578, 579, -371, 135, -371, 128, 129, 130, 565, 131, 132, 1067, 754, 755, 756, 133, 38, -32766, 136, 728, 1027, 1026, 1025, 1031, 1028, 1029, 1030, -32766, -32766, -32766, -32767, -32767, -32767, -32767, 101, 102, 103, 104, 105, -332, 748, 747, 1043, 923, -32766, -32766, -32766, 839, -32766, 145, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, 757, -32766, -32766, -32766, 611, -32766, 290, -32766, -32766, -32766, -32766, -32766, 834, 718, 265, 134, 384, 761, 762, 763, 764, -615, -32766, 426, -32766, -32766, -32766, -32766, -615, 251, 818, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 794, 566, 795, 796, 797, 798, 786, 787, 346, 347, 789, 790, 775, 776, 777, 779, 780, 781, 357, 821, 822, 823, 824, 825, 567, 913, 426, 310, 782, 783, 568, 569, -194, 806, 804, 805, 817, 801, 802, 1288, -193, 570, 571, 800, 572, 573, 574, 575, -273, 576, 577, 835, 82, 83, 84, -85, 803, 578, 579, 237, 148, 778, 749, 750, 751, 752, 753, 150, 754, 755, 756, 791, 792, 37, -32766, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 1043, 276, -32766, -32766, -32766, 925, 1263, 1262, 1264, 713, 831, 312, 393, 109, 7, 1097, 47, 757, -32766, -32766, -32766, 838, -85, -32766, 1095, -32766, -32766, -32766, 1268, -32766, -32766, 758, 759, 760, 761, 762, 763, 764, 994, -32766, 827, -32766, -32766, 923, -615, 324, -615, 818, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 794, 816, 795, 796, 797, 798, 786, 787, 788, 815, 789, 790, 775, 776, 777, 779, 780, 781, 820, 821, 822, 823, 824, 825, 826, 300, 301, 342, 782, 783, 784, 785, 833, 806, 804, 805, 817, 801, 802, 715, 1040, 793, 799, 800, 807, 808, 810, 809, 140, 811, 812, 838, 327, 343, -32766, 125, 803, 814, 813, 49, 50, 51, 517, 52, 53, 1043, -110, 371, 913, 54, 55, -110, 56, -110, -566, -32766, -32766, -32766, 306, 1043, 126, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -612, 1096, 106, 107, 108, 740, 276, -612, 963, 964, -32766, 290, 287, 965, 1330, 57, 58, -32766, 109, 375, 995, 59, 959, 60, 245, 246, 61, 62, 63, 64, 65, 66, 67, 68, -32766, 28, 267, 69, 441, 518, 391, -346, 74, 1294, 1295, 519, 443, 838, 327, -566, -566, 1292, 42, 20, 520, 925, 521, 923, 522, 713, 523, -564, 693, 524, 525, -566, 923, 444, 44, 45, 447, 378, 377, -78, 46, 526, 923, -572, 445, -566, 369, 341, 1346, 103, 104, 105, -563, 1254, 923, 383, 382, 446, 528, 529, 530, 865, 719, 866, 694, 425, 461, 462, 463, 844, 532, 533, 720, 1280, 1281, 1282, 1283, 1285, 1277, 1278, 298, 865, 151, 866, 723, 153, 1284, 1279, 695, 696, 1263, 1262, 1264, 299, -564, -564, 70, -153, -153, -153, 322, 323, 327, 154, -4, 923, 913, 1263, 1262, 1264, -564, 155, -153, 283, -153, 913, -153, 157, -153, -563, -563, 33, -571, 1350, -564, 913, -58, 829, 376, -612, 1349, -612, 748, 747, 837, -563, -606, 913, -606, 963, 964, -57, 748, 747, 527, 123, 81, -570, 1040, -563, 327, 617, 899, 959, -110, -110, -110, 32, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 124, -565, 1043, 947, 28, 268, 149, 408, 923, 1375, 829, 137, 1376, 138, 925, 144, 838, 913, 713, -153, 1292, 660, 21, 925, 679, 680, 283, 713, 158, 1170, 1172, 379, 380, 980, 385, 386, 159, 713, 730, 376, -562, 438, 1066, 141, 160, 925, 297, 327, 161, 713, 963, 964, 946, 651, 652, 527, 1254, -87, 162, -306, 748, 747, -84, 531, 959, -110, -110, -110, -565, -565, -78, 287, 1268, 532, 533, -73, 1280, 1281, 1282, 1283, 1285, 1277, 1278, -72, -565, -71, -70, 11, 1261, 1284, 1279, 913, -69, 748, 747, -68, 925, -32766, -565, 72, 713, -4, -16, 1261, 323, 327, -67, -562, -562, 291, -32766, -32766, -32766, -66, -32766, -65, -32766, -46, -32766, -18, 142, -32766, 275, -562, 1259, 284, -32766, -32766, -32766, 729, -32766, 732, -32766, -32766, 922, 147, 1261, -562, -32766, 422, 28, 267, -302, -32766, -32766, -32766, 279, -32766, 1042, -32766, -32766, -32766, 838, 838, -32766, 288, 1292, 1040, 280, -32766, -32766, -32766, 285, 286, 335, -32766, -32766, 1263, 1262, 1264, 925, -32766, 422, 289, 713, 28, 268, 292, 293, 276, 940, 73, 1043, -32766, 109, 689, 146, 838, -110, -110, -562, 1292, 1254, -110, 829, -32766, 1377, 704, 582, 10, 661, 838, -110, 1129, 706, 649, 283, 307, 960, -32766, 533, -32766, 1280, 1281, 1282, 1283, 1285, 1277, 1278, 682, 1043, 305, -50, 468, 1299, 1284, 1279, 1254, 666, -528, 496, 667, 304, 299, 683, 72, 74, 1301, 588, -32766, 323, 327, 327, -518, 290, 533, 40, 1280, 1281, 1282, 1283, 1285, 1277, 1278, 8, 139, 0, -562, -562, 27, 1284, 1279, -276, 407, 0, -32766, 0, 0, 0, 0, 72, 1261, 311, -562, 0, 323, 327, 0, -32766, -32766, -32766, 0, -32766, 373, -32766, 0, -32766, -562, 0, -32766, 0, 0, 615, 0, -32766, -32766, -32766, 923, -32766, 0, -32766, -32766, 942, 1289, 1261, 837, -32766, 422, 41, 299, 34, -32766, -32766, -32766, 737, -32766, 738, -32766, -32766, -32766, 923, 857, -32766, 904, 1004, 981, 988, -32766, -32766, -32766, 978, -32766, 989, -32766, -32766, 902, 976, 1261, 1100, -32766, 422, 48, 1103, 1104, -32766, -32766, -32766, 1101, -32766, 1102, -32766, -32766, -32766, 1108, -600, -32766, 849, 1316, 1334, 491, -32766, -32766, -32766, 1368, -32766, 654, -32766, -32766, -599, -598, 1261, 595, -32766, 422, -572, -571, 1268, -32766, -32766, -32766, 913, -32766, -570, -32766, -32766, -32766, -569, -512, -32766, -274, 1, 29, 30, -32766, -32766, -32766, -251, -251, -251, -32766, -32766, 39, 376, 913, 43, -32766, 422, 71, 302, 303, 75, 76, 77, 963, 964, 78, 79, -32766, 527, -250, -250, -250, -273, 80, 374, 376, 899, 959, -110, -110, -110, 143, 152, 156, 243, 331, 963, 964, 127, 358, 359, 527, 360, 361, 362, 363, 364, 365, 366, 899, 959, -110, -110, -110, -32766, 13, 367, 838, 368, 925, 1261, 14, 370, 713, -251, 439, 560, -32766, -32766, -32766, 15, -32766, 16, -32766, 18, -32766, 406, 487, -32766, 488, 495, 498, 925, -32766, -32766, -32766, 713, -250, 499, -32766, -32766, 500, -110, -110, 501, -32766, 422, -110, 505, 506, 507, 515, 593, 699, 1069, 1210, -110, -32766, 1290, 1068, 1049, 1249, 1045, -278, -102, -32766, 12, 17, 22, 296, 405, 607, 612, 640, 705, 1214, 1267, 1211, 1347, 0, 321, 372, 714, 717, 721, 722, 724, 299, 725, 726, 74, 727, 1227, 731, 716, 0, 327, 411, 1293, 734, 900, 1372, 1374, 860, 859, 953, 996, 1373, 952, 950, 951, 954, 1242, 933, 943, 931, 986, 987, 638, 1371, 1328, 1317, 1335, 1344, 0, 0, 0, 327); + protected array $actionCheck = array(2, 3, 4, 5, 6, 7, 1, 9, 10, 11, 12, 13, 82, 31, 85, 85, 9, 10, 11, 0, 80, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 9, 10, 11, 8, 37, 38, 30, 1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 101, 30, 1, 70, 57, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 8, 106, 107, 71, 72, 73, 74, 75, 76, 77, 126, 116, 80, 150, 70, 151, 152, 8, 30, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 137, 138, 162, 126, 127, 128, 129, 8, 131, 132, 133, 134, 135, 136, 8, 8, 139, 140, 141, 142, 143, 144, 145, 9, 147, 148, 137, 138, 167, 14, 167, 154, 155, 156, 106, 158, 108, 2, 3, 4, 5, 6, 7, 166, 9, 10, 11, 12, 13, 116, 8, 167, 119, 120, 121, 122, 123, 124, 125, 9, 10, 11, 44, 45, 46, 47, 48, 49, 50, 51, 52, 166, 37, 38, 141, 1, 9, 10, 11, 163, 30, 8, 32, 33, 34, 35, 36, 37, 38, 9, 10, 11, 57, 9, 10, 11, 1, 30, 165, 32, 33, 34, 35, 36, 80, 31, 71, 72, 73, 74, 75, 76, 77, 1, 30, 80, 32, 33, 34, 35, 8, 8, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 84, 80, 8, 126, 127, 128, 129, 166, 131, 132, 133, 134, 135, 136, 1, 166, 139, 140, 141, 142, 143, 144, 145, 166, 147, 148, 160, 9, 10, 11, 31, 154, 155, 156, 97, 158, 2, 3, 4, 5, 6, 7, 14, 9, 10, 11, 12, 13, 30, 116, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 141, 57, 9, 10, 11, 163, 159, 160, 161, 167, 80, 8, 106, 69, 108, 168, 70, 57, 9, 10, 11, 82, 97, 30, 1, 32, 33, 34, 1, 9, 10, 71, 72, 73, 74, 75, 76, 77, 31, 30, 80, 32, 33, 1, 164, 8, 166, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 137, 138, 8, 126, 127, 128, 129, 160, 131, 132, 133, 134, 135, 136, 167, 116, 139, 140, 141, 142, 143, 144, 145, 167, 147, 148, 82, 171, 8, 116, 167, 154, 155, 156, 2, 3, 4, 5, 6, 7, 141, 101, 8, 84, 12, 13, 106, 15, 108, 70, 9, 10, 11, 113, 141, 14, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 1, 163, 53, 54, 55, 167, 57, 8, 117, 118, 116, 165, 30, 122, 1, 50, 51, 140, 69, 8, 163, 56, 131, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 140, 70, 71, 72, 73, 74, 8, 168, 165, 78, 79, 80, 8, 82, 171, 137, 138, 86, 87, 88, 89, 163, 91, 1, 93, 167, 95, 70, 80, 98, 99, 153, 1, 8, 103, 104, 105, 106, 107, 16, 109, 110, 1, 165, 8, 167, 115, 116, 1, 50, 51, 52, 70, 122, 1, 106, 107, 8, 127, 128, 129, 106, 31, 108, 116, 116, 132, 133, 134, 8, 139, 140, 31, 142, 143, 144, 145, 146, 147, 148, 149, 106, 14, 108, 31, 14, 155, 156, 140, 141, 159, 160, 161, 162, 137, 138, 165, 75, 76, 77, 169, 170, 171, 14, 0, 1, 84, 159, 160, 161, 153, 14, 90, 165, 92, 84, 94, 14, 96, 137, 138, 14, 165, 1, 167, 84, 16, 80, 106, 164, 8, 166, 37, 38, 159, 153, 164, 84, 166, 117, 118, 16, 37, 38, 122, 16, 167, 165, 116, 167, 171, 51, 130, 131, 132, 133, 134, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 16, 70, 141, 73, 70, 71, 101, 102, 1, 80, 80, 16, 83, 16, 163, 16, 82, 84, 167, 168, 86, 75, 76, 163, 75, 76, 165, 167, 16, 59, 60, 106, 107, 163, 106, 107, 16, 167, 31, 106, 70, 108, 1, 167, 16, 163, 113, 171, 16, 167, 117, 118, 122, 111, 112, 122, 122, 31, 16, 35, 37, 38, 31, 130, 131, 132, 133, 134, 137, 138, 31, 30, 1, 139, 140, 31, 142, 143, 144, 145, 146, 147, 148, 31, 153, 31, 31, 154, 80, 155, 156, 84, 31, 37, 38, 31, 163, 74, 167, 165, 167, 168, 31, 80, 170, 171, 31, 137, 138, 30, 87, 88, 89, 31, 91, 31, 93, 31, 95, 31, 31, 98, 31, 153, 116, 31, 103, 104, 105, 31, 74, 31, 109, 110, 31, 31, 80, 167, 115, 116, 70, 71, 35, 87, 88, 89, 35, 91, 140, 93, 127, 95, 82, 82, 98, 37, 86, 116, 35, 103, 104, 105, 35, 35, 35, 109, 110, 159, 160, 161, 163, 115, 116, 37, 167, 70, 71, 37, 37, 57, 38, 158, 141, 127, 69, 77, 70, 82, 117, 118, 70, 86, 122, 122, 80, 116, 83, 80, 89, 97, 90, 82, 131, 82, 92, 113, 165, 114, 131, 85, 140, 140, 142, 143, 144, 145, 146, 147, 148, 94, 141, 136, 31, 97, 150, 155, 156, 122, 96, 153, 97, 100, 135, 162, 100, 165, 165, 150, 157, 140, 170, 171, 171, 153, 165, 140, 163, 142, 143, 144, 145, 146, 147, 148, 153, 31, -1, 137, 138, 153, 155, 156, 166, 168, -1, 74, -1, -1, -1, -1, 165, 80, 135, 153, -1, 170, 171, -1, 87, 88, 89, -1, 91, 153, 93, -1, 95, 167, -1, 98, -1, -1, 157, -1, 103, 104, 105, 1, 74, -1, 109, 110, 158, 164, 80, 159, 115, 116, 163, 162, 167, 87, 88, 89, 163, 91, 163, 93, 127, 95, 1, 163, 98, 163, 163, 163, 163, 103, 104, 105, 163, 74, 163, 109, 110, 163, 163, 80, 163, 115, 116, 70, 163, 163, 87, 88, 89, 163, 91, 163, 93, 127, 95, 163, 165, 98, 164, 164, 164, 102, 103, 104, 105, 164, 74, 164, 109, 110, 165, 165, 80, 81, 115, 116, 165, 165, 1, 87, 88, 89, 84, 91, 165, 93, 127, 95, 165, 165, 98, 166, 165, 165, 165, 103, 104, 105, 100, 101, 102, 109, 110, 165, 106, 84, 165, 115, 116, 165, 137, 138, 165, 165, 165, 117, 118, 165, 165, 127, 122, 100, 101, 102, 166, 165, 153, 106, 130, 131, 132, 133, 134, 165, 165, 165, 165, 165, 117, 118, 167, 165, 165, 122, 165, 165, 165, 165, 165, 165, 165, 130, 131, 132, 133, 134, 74, 166, 165, 82, 165, 163, 80, 166, 165, 167, 168, 165, 165, 87, 88, 89, 166, 91, 166, 93, 166, 95, 166, 166, 98, 166, 166, 166, 163, 103, 104, 105, 167, 168, 166, 109, 110, 166, 117, 118, 166, 115, 116, 122, 166, 166, 166, 166, 166, 166, 166, 166, 131, 127, 166, 166, 166, 166, 166, 166, 166, 140, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, -1, 167, 167, 167, 167, 167, 167, 167, 162, 167, 167, 165, 167, 169, 167, 167, -1, 171, 168, 170, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, -1, -1, -1, 171); + protected array $actionBase = array(0, -2, 156, 559, 641, 1004, 1027, 485, 292, 200, -60, 283, 568, 590, 590, 715, 590, 195, 578, 894, 395, 395, 395, 825, 313, 313, 825, 313, 731, 731, 731, 731, 764, 764, 965, 965, 998, 932, 899, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 37, 360, 216, 644, 1061, 1067, 1063, 1068, 1059, 1058, 1062, 1064, 1069, 1109, 1110, 812, 1111, 1112, 1108, 1113, 1065, 909, 1060, 1066, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 135, 477, 373, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 642, 642, 22, 22, 22, 362, 813, 778, 813, 813, 813, 813, 813, 813, 813, 813, 346, 205, 678, 188, 171, 171, 7, 7, 7, 7, 7, 376, 779, 54, 1083, 1083, 139, 139, 139, 139, -50, 49, 749, 380, 787, -39, 569, 569, 536, 536, 335, 335, 349, 349, 335, 335, 335, 212, 212, 212, 212, 415, 494, 519, 512, -71, 807, 584, 584, 584, 584, 807, 807, 807, 807, 795, 1086, 807, 807, 807, 639, 828, 828, 979, 452, 452, 452, 828, 492, -70, -70, 492, 394, -70, 516, 982, 637, 988, 397, 785, 486, 509, 397, -16, 299, 502, 233, 854, 633, 854, 1056, 832, 832, 794, 752, 898, 1085, 1070, 839, 1106, 842, 1107, 471, 10, 747, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1114, 632, 1056, 145, 1114, 1114, 1114, 632, 632, 632, 632, 632, 632, 632, 632, 796, 632, 632, 650, 145, 654, 657, 145, 837, 632, 798, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, -18, 37, 37, 360, 5, 5, 37, 341, 52, 5, 5, 5, 5, 37, 37, 37, 37, 633, 830, 789, 636, 278, 843, 128, 830, 830, 830, 26, 136, 120, 732, 815, 259, 822, 822, 829, 933, 933, 822, 827, 822, 829, 822, 822, 933, 933, 855, 933, 163, 541, 430, 514, 562, 933, 273, 822, 822, 822, 822, 845, 933, 58, 573, 822, 234, 194, 822, 822, 845, 805, 802, 793, 933, 933, 933, 845, 470, 793, 793, 793, 859, 861, 800, 799, 390, 356, 598, 127, 850, 799, 799, 822, 535, 800, 799, 800, 799, 852, 799, 799, 799, 800, 799, 827, 456, 799, 720, 728, 586, 75, 799, 19, 950, 953, 734, 954, 944, 955, 1008, 958, 959, 1073, 930, 977, 947, 966, 1009, 935, 934, 811, 666, 692, 809, 784, 929, 823, 823, 823, 917, 918, 823, 823, 823, 823, 823, 823, 823, 823, 666, 847, 838, 817, 983, 703, 705, 1044, 782, 1090, 1081, 982, 950, 959, 739, 947, 966, 935, 934, 792, 790, 772, 783, 769, 763, 760, 762, 797, 1046, 974, 791, 707, 1016, 985, 1089, 1071, 986, 987, 1018, 1047, 866, 1050, 1091, 824, 1092, 1093, 900, 989, 1074, 823, 912, 897, 901, 988, 925, 666, 902, 1051, 997, 851, 1019, 1021, 1072, 834, 821, 907, 1094, 990, 991, 999, 1075, 1076, 853, 1003, 804, 1022, 841, 803, 1023, 1030, 1033, 1036, 1077, 1095, 1079, 911, 1080, 868, 818, 931, 840, 1096, 307, 835, 836, 849, 1005, 605, 978, 1082, 1087, 1097, 1040, 1041, 1042, 1098, 1099, 975, 869, 1012, 833, 1014, 964, 870, 871, 608, 848, 1052, 819, 831, 844, 626, 634, 1100, 1101, 1102, 976, 806, 816, 875, 877, 1053, 826, 1054, 1103, 640, 880, 1104, 1045, 736, 740, 560, 662, 647, 750, 820, 1084, 814, 801, 810, 1001, 740, 808, 881, 1105, 883, 887, 888, 1043, 892, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 468, 468, 468, 468, 468, 468, 313, 313, 313, 313, 313, 468, 468, 468, 468, 468, 468, 468, 313, 468, 468, 468, 313, 0, 0, 313, 0, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 716, 716, 297, 297, 297, 297, 716, 716, 716, 716, 716, 716, 716, 716, 716, 716, 297, 297, 0, 297, 297, 297, 297, 297, 297, 297, 297, 855, 716, 716, 716, 716, 452, 452, 452, 452, -95, -95, 716, 716, 716, 394, 716, 716, 452, 452, 716, 716, 716, 716, 716, 716, 716, 716, 716, 716, 716, 0, 0, 0, 145, -70, 716, 827, 827, 827, 827, 716, 716, 716, 716, -70, -70, 716, 716, 716, 0, 0, 0, 0, 0, 0, 0, 0, 145, 0, 0, 145, 0, 0, 827, 638, 827, 638, 716, 394, 855, 659, 716, 0, 0, 0, 0, 145, 827, 145, 632, -70, -70, 632, 632, 5, 37, 659, 613, 613, 613, 613, 0, 0, 633, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 827, 0, 855, 0, 827, 827, 827, 0, 0, 0, 0, 0, 0, 0, 0, 933, 0, 0, 0, 0, 0, 0, 0, 827, 0, 933, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 827, 0, 0, 0, 0, 0, 0, 0, 0, 0, 823, 834, 0, 0, 834, 0, 823, 823, 823, 0, 0, 0, 848, 826); + protected array $actionDefault = array(3, 32767, 102, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 100, 32767, 618, 618, 618, 618, 32767, 32767, 255, 102, 32767, 32767, 487, 404, 404, 404, 32767, 32767, 560, 560, 560, 560, 560, 32767, 32767, 32767, 32767, 32767, 32767, 487, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 36, 7, 8, 10, 11, 49, 17, 328, 100, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 102, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 611, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 392, 491, 470, 471, 473, 474, 403, 561, 617, 331, 614, 333, 402, 145, 343, 334, 243, 259, 492, 260, 493, 496, 497, 216, 389, 149, 150, 434, 488, 436, 486, 490, 435, 409, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 407, 408, 489, 32767, 32767, 467, 466, 465, 432, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 102, 32767, 433, 437, 406, 440, 438, 439, 456, 457, 454, 455, 458, 32767, 32767, 320, 32767, 32767, 459, 460, 461, 462, 370, 368, 32767, 32767, 320, 111, 32767, 32767, 447, 448, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 504, 554, 464, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 102, 32767, 100, 556, 429, 431, 524, 442, 443, 441, 410, 32767, 529, 32767, 102, 32767, 531, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 555, 32767, 562, 562, 32767, 517, 100, 195, 32767, 530, 195, 195, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 625, 517, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 32767, 195, 110, 32767, 32767, 32767, 100, 195, 195, 195, 195, 195, 195, 195, 195, 532, 195, 195, 190, 32767, 269, 271, 102, 579, 195, 534, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 517, 452, 138, 32767, 519, 138, 562, 444, 445, 446, 562, 562, 562, 316, 293, 32767, 32767, 32767, 32767, 532, 532, 100, 100, 100, 100, 32767, 32767, 32767, 32767, 111, 503, 99, 99, 99, 99, 99, 103, 101, 32767, 32767, 32767, 32767, 224, 32767, 101, 99, 32767, 101, 101, 32767, 32767, 224, 226, 213, 228, 32767, 583, 584, 224, 101, 228, 228, 228, 248, 248, 506, 322, 101, 99, 101, 101, 197, 322, 322, 32767, 101, 506, 322, 506, 322, 199, 322, 322, 322, 506, 322, 32767, 101, 322, 215, 392, 99, 99, 322, 32767, 32767, 32767, 519, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 223, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 549, 32767, 567, 581, 450, 451, 453, 566, 564, 475, 476, 477, 478, 479, 480, 481, 483, 613, 32767, 523, 32767, 32767, 32767, 342, 32767, 623, 32767, 32767, 32767, 9, 74, 512, 42, 43, 51, 57, 538, 539, 540, 541, 535, 536, 542, 537, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 624, 32767, 562, 32767, 32767, 32767, 32767, 449, 544, 589, 32767, 32767, 563, 616, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 138, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 549, 32767, 136, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 545, 32767, 32767, 32767, 562, 32767, 32767, 32767, 32767, 318, 315, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 562, 32767, 32767, 32767, 32767, 32767, 295, 32767, 312, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 388, 519, 298, 300, 301, 32767, 32767, 32767, 32767, 364, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 152, 152, 3, 3, 345, 152, 152, 152, 345, 345, 152, 345, 345, 345, 152, 152, 152, 152, 152, 152, 281, 185, 263, 266, 248, 248, 152, 356, 152); + protected array $goto = array(196, 196, 1041, 352, 700, 465, 587, 470, 470, 1072, 736, 641, 643, 1205, 855, 663, 470, 856, 709, 687, 690, 1014, 698, 707, 1010, 625, 662, 166, 166, 166, 166, 220, 197, 193, 193, 176, 178, 215, 193, 193, 193, 193, 193, 194, 194, 194, 194, 194, 188, 189, 190, 191, 192, 217, 215, 218, 540, 541, 423, 542, 545, 546, 547, 548, 549, 550, 551, 552, 1156, 167, 168, 169, 195, 170, 171, 172, 165, 173, 174, 175, 177, 214, 216, 219, 239, 242, 253, 254, 256, 257, 258, 259, 260, 261, 262, 263, 269, 270, 271, 272, 281, 282, 317, 318, 319, 429, 430, 431, 602, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 179, 236, 180, 188, 189, 190, 191, 192, 217, 1156, 198, 199, 200, 201, 240, 181, 182, 202, 183, 203, 199, 184, 241, 198, 164, 204, 205, 185, 206, 207, 208, 186, 209, 210, 187, 211, 212, 213, 278, 278, 278, 278, 858, 433, 665, 979, 916, 604, 917, 428, 320, 314, 315, 338, 597, 432, 339, 434, 642, 627, 627, 896, 854, 896, 896, 1291, 1291, 1291, 1291, 1291, 1291, 1291, 1291, 1291, 1291, 614, 628, 631, 632, 633, 634, 655, 656, 657, 711, 830, 871, 460, 912, 907, 908, 921, 864, 909, 861, 910, 911, 862, 356, 915, 868, 421, 883, 482, 867, 870, 1361, 1361, 356, 356, 484, 1094, 1089, 1090, 1091, 889, 603, 1107, 397, 400, 605, 609, 356, 356, 1361, 594, 356, 712, 344, 1378, 353, 354, 511, 703, 442, 1105, 1260, 1041, 1260, 1260, 350, 559, 1364, 1364, 356, 356, 1041, 1260, 1041, 1351, 1041, 1041, 345, 344, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1000, 1236, 948, 249, 249, 1260, 1237, 1240, 949, 1241, 1260, 1260, 1260, 1260, 1114, 1115, 1260, 1260, 1260, 1343, 1343, 1343, 1343, 564, 557, 851, 427, 1322, 616, 395, 247, 247, 247, 247, 244, 250, 592, 929, 503, 664, 504, 930, 355, 355, 355, 355, 510, 945, 512, 945, 479, 1336, 1337, 328, 557, 564, 589, 590, 330, 600, 606, 1153, 621, 622, 555, 1065, 555, 555, 658, 659, 25, 676, 677, 678, 440, 555, 1310, 1310, 686, 559, 851, 670, 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1310, 1044, 1044, 1047, 1046, 685, 956, 458, 340, 1036, 1052, 1053, 973, 973, 973, 973, 1050, 1051, 458, 967, 974, 1307, 1307, 971, 412, 708, 848, 1307, 1307, 1307, 1307, 1307, 1307, 1307, 1307, 1307, 1307, 5, 610, 6, 873, 934, 1143, 451, 451, 876, 451, 451, 1333, 962, 1333, 1333, 1253, 1019, 404, 553, 553, 553, 553, 1333, 608, 875, 620, 668, 998, 1251, 558, 584, 1022, 869, 739, 558, 885, 584, 480, 398, 464, 1078, 697, 326, 309, 1250, 832, 1345, 1345, 1345, 1345, 1082, 473, 601, 474, 475, 1338, 1339, 697, 1128, 881, 697, 984, 1369, 1370, 598, 619, 1032, 0, 544, 544, 851, 836, 0, 1329, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 543, 543, 1255, 879, 0, 0, 543, 0, 543, 543, 543, 543, 543, 543, 543, 543, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 451, 252, 252, 451, 836, 1080, 836, 409, 410, 1331, 1331, 1080, 674, 0, 675, 0, 414, 415, 416, 0, 688, 0, 0, 417, 635, 637, 639, 0, 348, 0, 0, 1256, 1257, 0, 1243, 884, 872, 1077, 1081, 0, 846, 1003, 0, 0, 975, 0, 735, 1243, 982, 556, 1012, 1007, 0, 435, 0, 0, 0, 0, 0, 1258, 1319, 1320, 0, 0, 435, 273, 325, 0, 325, 325, 0, 972, 1048, 1048, 0, 0, 0, 669, 1059, 1055, 1056, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1126, 888, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1017, 1017); + protected array $gotoCheck = array(42, 42, 73, 97, 73, 156, 48, 154, 154, 128, 48, 48, 48, 156, 26, 48, 154, 27, 9, 48, 48, 48, 48, 48, 48, 56, 56, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 23, 23, 23, 23, 15, 66, 66, 49, 65, 131, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 108, 108, 25, 25, 25, 25, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 6, 35, 83, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 43, 35, 84, 15, 35, 188, 188, 14, 14, 84, 15, 15, 15, 15, 45, 8, 8, 59, 59, 59, 59, 14, 14, 188, 178, 14, 8, 174, 14, 97, 97, 8, 8, 83, 8, 73, 73, 73, 73, 185, 14, 188, 188, 14, 14, 73, 73, 73, 187, 73, 73, 174, 174, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 103, 79, 79, 5, 5, 73, 79, 79, 79, 79, 73, 73, 73, 73, 145, 145, 73, 73, 73, 9, 9, 9, 9, 76, 76, 22, 13, 14, 13, 62, 5, 5, 5, 5, 5, 5, 104, 73, 160, 64, 160, 73, 24, 24, 24, 24, 160, 9, 14, 9, 182, 182, 182, 76, 76, 76, 76, 76, 76, 76, 76, 155, 76, 76, 19, 115, 19, 19, 86, 86, 76, 86, 86, 86, 113, 19, 176, 176, 117, 14, 22, 121, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 89, 89, 119, 119, 89, 89, 19, 29, 89, 89, 89, 19, 19, 19, 19, 120, 120, 19, 19, 19, 177, 177, 93, 93, 93, 18, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 46, 17, 46, 37, 17, 17, 23, 23, 39, 23, 23, 131, 92, 131, 131, 14, 17, 28, 107, 107, 107, 107, 131, 107, 17, 80, 17, 17, 166, 9, 9, 110, 17, 99, 9, 41, 9, 157, 9, 9, 130, 7, 175, 175, 17, 7, 131, 131, 131, 131, 133, 9, 9, 9, 9, 184, 184, 7, 148, 9, 7, 96, 9, 9, 2, 2, 114, -1, 179, 179, 22, 12, -1, 131, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 162, 162, 20, 9, -1, -1, 162, -1, 162, 162, 162, 162, 162, 162, 162, 162, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 5, 5, 23, 12, 131, 12, 82, 82, 131, 131, 131, 82, -1, 82, -1, 82, 82, 82, -1, 82, -1, -1, 82, 85, 85, 85, -1, 82, -1, -1, 20, 20, -1, 20, 16, 16, 16, 16, -1, 20, 50, -1, -1, 50, -1, 50, 20, 16, 50, 50, 50, -1, 118, -1, -1, -1, -1, -1, 20, 20, 20, -1, -1, 118, 24, 24, -1, 24, 24, -1, 16, 118, 118, -1, -1, -1, 118, 118, 118, 118, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, 107); + protected array $gotoBase = array(0, 0, -234, 0, 0, 291, 199, 451, 232, 8, 0, 0, 191, -25, -76, -183, 108, -48, 96, 88, 109, 0, 36, 159, 328, 182, 10, 13, 94, 91, 0, 0, 0, 0, 0, -162, 0, 78, 0, 101, 0, 9, -1, 202, 0, 213, -322, 0, -708, 151, 556, 0, 0, 0, 0, 0, -15, 0, 0, 197, 0, 0, 276, 0, 90, 156, -70, 0, 0, 0, 0, 0, 0, -5, 0, 0, -34, 0, 0, -119, 112, -160, 40, -67, -246, 69, -364, 0, 0, 102, 0, 0, 97, 98, 0, 0, 33, -483, 0, 42, 0, 0, 0, 254, 282, 0, 0, 407, -54, 0, 77, 0, 0, 86, -29, 79, 0, 84, 314, 104, 111, 80, 0, 0, 0, 0, 0, 0, 7, 0, 82, 163, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 29, 0, 0, 0, 0, 0, -27, 106, -263, 12, 0, 0, -171, 0, 264, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, -46, 137, 128, 164, 220, 248, 0, 0, 38, 0, 99, 234, 0, 242, -78, 0, 0); + protected array $gotoDefault = array(-32768, 516, 743, 4, 744, 938, 819, 828, 580, 534, 710, 349, 629, 424, 1327, 914, 1142, 599, 847, 1269, 1275, 459, 850, 333, 733, 926, 897, 898, 401, 388, 863, 399, 653, 630, 497, 882, 455, 874, 489, 877, 454, 886, 163, 420, 514, 890, 3, 893, 562, 924, 977, 389, 901, 390, 681, 903, 583, 905, 906, 396, 402, 403, 1147, 591, 626, 918, 255, 585, 919, 387, 920, 928, 392, 394, 691, 469, 508, 502, 413, 1109, 586, 613, 650, 448, 476, 624, 636, 623, 483, 436, 418, 332, 961, 969, 490, 467, 983, 351, 991, 741, 1155, 644, 492, 999, 645, 1006, 1009, 535, 536, 481, 1021, 266, 1024, 493, 1033, 23, 671, 1038, 1039, 672, 646, 1061, 647, 673, 648, 1063, 466, 581, 1071, 456, 1079, 1315, 457, 1083, 264, 1086, 277, 419, 437, 1092, 1093, 9, 1099, 701, 702, 19, 274, 513, 1127, 692, -32768, -32768, -32768, -32768, 453, 1154, 452, 1224, 1226, 563, 494, 1244, 294, 1247, 684, 509, 1252, 449, 1318, 450, 537, 477, 316, 538, 1362, 308, 336, 313, 554, 295, 337, 539, 478, 1324, 1332, 334, 31, 1352, 1363, 596, 618); + protected array $ruleToNonTerminal = array(0, 1, 3, 3, 2, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 10, 11, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 21, 21, 22, 23, 23, 24, 24, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 30, 30, 32, 34, 34, 28, 36, 36, 33, 38, 38, 35, 35, 37, 37, 39, 39, 31, 40, 40, 41, 43, 44, 44, 45, 45, 46, 46, 48, 47, 47, 47, 47, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 25, 25, 50, 69, 69, 72, 72, 71, 70, 70, 63, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 80, 26, 26, 27, 27, 27, 27, 27, 88, 88, 90, 90, 83, 83, 91, 91, 92, 92, 92, 84, 84, 87, 87, 85, 85, 93, 94, 94, 57, 57, 65, 65, 68, 68, 68, 67, 95, 95, 96, 58, 58, 58, 58, 97, 97, 98, 98, 99, 99, 100, 101, 101, 102, 102, 103, 103, 55, 55, 51, 51, 105, 53, 53, 106, 52, 52, 54, 54, 64, 64, 64, 64, 81, 81, 109, 109, 111, 111, 112, 112, 112, 112, 112, 112, 112, 110, 110, 110, 115, 115, 115, 115, 89, 89, 118, 118, 118, 119, 119, 116, 116, 120, 120, 122, 122, 123, 123, 117, 124, 124, 121, 125, 125, 125, 125, 113, 113, 82, 82, 82, 20, 20, 20, 127, 126, 126, 128, 128, 128, 128, 60, 129, 129, 130, 61, 132, 132, 133, 133, 134, 134, 86, 135, 135, 135, 135, 135, 135, 135, 140, 140, 141, 141, 142, 142, 142, 142, 142, 143, 144, 144, 139, 139, 136, 136, 138, 138, 146, 146, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 137, 147, 147, 149, 148, 148, 150, 150, 114, 151, 151, 153, 153, 153, 152, 152, 62, 104, 154, 154, 56, 56, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 161, 162, 162, 163, 155, 155, 160, 160, 164, 165, 165, 166, 167, 168, 168, 168, 168, 19, 19, 73, 73, 73, 73, 156, 156, 156, 156, 170, 170, 159, 159, 159, 157, 157, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 177, 177, 177, 108, 179, 179, 179, 179, 158, 158, 158, 158, 158, 158, 158, 158, 59, 59, 173, 173, 173, 173, 173, 180, 180, 169, 169, 169, 169, 181, 181, 181, 181, 181, 181, 74, 74, 66, 66, 66, 66, 131, 131, 131, 131, 184, 183, 172, 172, 172, 172, 172, 172, 172, 171, 171, 171, 182, 182, 182, 182, 107, 178, 186, 186, 185, 185, 187, 187, 187, 187, 187, 187, 187, 187, 175, 175, 175, 175, 174, 189, 188, 188, 188, 188, 188, 188, 188, 188, 190, 190, 190, 190); + protected array $ruleToLength = array(1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 2, 1, 3, 4, 1, 2, 0, 1, 1, 1, 1, 4, 3, 5, 4, 3, 4, 1, 3, 1, 1, 8, 7, 2, 3, 1, 2, 3, 1, 2, 3, 1, 1, 3, 1, 3, 1, 2, 2, 3, 1, 3, 2, 3, 1, 3, 3, 2, 0, 1, 1, 1, 1, 1, 3, 7, 10, 5, 7, 9, 5, 3, 3, 3, 3, 3, 3, 1, 2, 5, 7, 9, 6, 5, 6, 3, 2, 1, 1, 1, 1, 0, 2, 1, 3, 8, 0, 4, 2, 1, 3, 0, 1, 0, 1, 0, 1, 3, 1, 1, 1, 1, 8, 9, 7, 8, 7, 6, 8, 0, 2, 0, 2, 1, 2, 1, 2, 1, 1, 1, 0, 2, 0, 2, 0, 2, 2, 1, 3, 1, 4, 1, 4, 1, 1, 4, 2, 1, 3, 3, 3, 4, 4, 5, 0, 2, 4, 3, 1, 1, 7, 0, 2, 1, 3, 3, 4, 1, 4, 0, 2, 5, 0, 2, 6, 0, 2, 0, 3, 1, 2, 1, 1, 2, 0, 1, 3, 0, 2, 1, 1, 1, 1, 1, 1, 1, 7, 9, 6, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, 3, 1, 1, 2, 1, 1, 0, 1, 0, 2, 2, 2, 4, 3, 1, 1, 3, 1, 2, 2, 3, 2, 3, 1, 1, 2, 3, 1, 1, 3, 2, 0, 1, 5, 5, 6, 10, 3, 5, 1, 1, 3, 0, 2, 4, 5, 4, 4, 4, 3, 1, 1, 1, 1, 1, 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 3, 0, 2, 0, 5, 8, 1, 3, 3, 0, 2, 2, 2, 3, 1, 0, 1, 1, 3, 3, 3, 4, 4, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 3, 4, 4, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 2, 1, 2, 4, 2, 2, 8, 9, 8, 9, 9, 10, 9, 10, 8, 3, 2, 2, 1, 1, 0, 4, 2, 1, 3, 2, 1, 2, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 3, 3, 4, 1, 1, 3, 1, 1, 1, 1, 1, 3, 2, 3, 0, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 4, 4, 1, 4, 4, 0, 1, 1, 1, 3, 3, 1, 4, 2, 2, 1, 3, 1, 4, 4, 3, 3, 3, 3, 1, 3, 1, 1, 3, 1, 1, 4, 1, 1, 1, 3, 1, 1, 2, 1, 3, 4, 3, 2, 0, 2, 2, 1, 2, 1, 1, 1, 4, 3, 3, 3, 3, 6, 3, 1, 1, 2, 1); + protected function initReduceCallbacks() : void { - $this->reduceCallbacks = [0 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 1 => function ($stackPos) { - $this->semValue = $this->handleNamespaces($this->semStack[$stackPos - (1 - 1)]); - }, 2 => function ($stackPos) { - if (\is_array($this->semStack[$stackPos - (2 - 2)])) { - $this->semValue = \array_merge($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); - } else { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - } - }, 3 => function ($stackPos) { - $this->semValue = array(); - }, 4 => function ($stackPos) { - $startAttributes = $this->lookaheadStartAttributes; - if (isset($startAttributes['comments'])) { - $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); - } else { - $nop = null; + $this->reduceCallbacks = [0 => null, 1 => static function ($self, $stackPos) { + $self->semValue = $self->handleNamespaces($self->semStack[$stackPos - (1 - 1)]); + }, 2 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos - (2 - 2)] !== null) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; } + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 3 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 4 => static function ($self, $stackPos) { + $nop = $self->maybeCreateZeroLengthNop($self->tokenPos); if ($nop !== null) { - $this->semStack[$stackPos - (1 - 1)][] = $nop; + $self->semStack[$stackPos - (1 - 1)][] = $nop; } - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 5 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 6 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 7 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 8 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 9 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 10 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 11 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 12 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 13 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 14 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 15 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 16 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 17 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 18 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 19 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 20 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 21 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 22 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 23 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 24 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 25 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 26 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 27 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 28 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 29 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 30 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 31 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 32 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 33 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 34 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 35 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 36 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 37 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 38 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 39 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 40 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 41 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 42 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 43 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 44 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 45 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 46 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 47 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 48 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 49 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 50 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 51 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 52 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 53 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 54 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 55 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 56 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 57 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 58 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 59 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 60 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 61 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 62 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 63 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 64 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 65 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 66 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 67 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 68 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 69 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 70 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 71 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 72 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 73 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 74 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 75 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 76 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 77 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 78 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 79 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 80 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 81 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 82 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 83 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 84 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 85 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 86 => function ($stackPos) { - $this->semValue = new Node\Identifier($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 87 => function ($stackPos) { - $this->semValue = new Node\Identifier($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 88 => function ($stackPos) { - $this->semValue = new Node\Identifier($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 89 => function ($stackPos) { - $this->semValue = new Node\Identifier($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 90 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 91 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 92 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 93 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 94 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 95 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 96 => function ($stackPos) { - $this->semValue = new Name(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 97 => function ($stackPos) { - $this->semValue = new Expr\Variable(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 98 => function ($stackPos) { - /* nothing */ - }, 99 => function ($stackPos) { - /* nothing */ - }, 100 => function ($stackPos) { - /* nothing */ - }, 101 => function ($stackPos) { - $this->emitError(new Error('A trailing comma is not allowed here', $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes)); - }, 102 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 103 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 104 => function ($stackPos) { - $this->semValue = new Node\Attribute($this->semStack[$stackPos - (1 - 1)], [], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 105 => function ($stackPos) { - $this->semValue = new Node\Attribute($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 106 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 107 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 108 => function ($stackPos) { - $this->semValue = new Node\AttributeGroup($this->semStack[$stackPos - (4 - 2)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 109 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 110 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 111 => function ($stackPos) { - $this->semValue = []; - }, 112 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 113 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 114 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 115 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 116 => function ($stackPos) { - $this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 117 => function ($stackPos) { - $this->semValue = new Stmt\Namespace_($this->semStack[$stackPos - (3 - 2)], null, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - $this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_SEMICOLON); - $this->checkNamespace($this->semValue); - }, 118 => function ($stackPos) { - $this->semValue = new Stmt\Namespace_($this->semStack[$stackPos - (5 - 2)], $this->semStack[$stackPos - (5 - 4)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - $this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); - $this->checkNamespace($this->semValue); - }, 119 => function ($stackPos) { - $this->semValue = new Stmt\Namespace_(null, $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - $this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); - $this->checkNamespace($this->semValue); - }, 120 => function ($stackPos) { - $this->semValue = new Stmt\Use_($this->semStack[$stackPos - (3 - 2)], Stmt\Use_::TYPE_NORMAL, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 121 => function ($stackPos) { - $this->semValue = new Stmt\Use_($this->semStack[$stackPos - (4 - 3)], $this->semStack[$stackPos - (4 - 2)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 122 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 123 => function ($stackPos) { - $this->semValue = new Stmt\Const_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 124 => function ($stackPos) { - $this->semValue = Stmt\Use_::TYPE_FUNCTION; - }, 125 => function ($stackPos) { - $this->semValue = Stmt\Use_::TYPE_CONSTANT; - }, 126 => function ($stackPos) { - $this->semValue = new Stmt\GroupUse($this->semStack[$stackPos - (8 - 3)], $this->semStack[$stackPos - (8 - 6)], $this->semStack[$stackPos - (8 - 2)], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes); - }, 127 => function ($stackPos) { - $this->semValue = new Stmt\GroupUse($this->semStack[$stackPos - (7 - 2)], $this->semStack[$stackPos - (7 - 5)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); - }, 128 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 129 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 130 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 131 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 132 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 133 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 134 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 135 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 136 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 137 => function ($stackPos) { - $this->semValue = new Stmt\UseUse($this->semStack[$stackPos - (1 - 1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - $this->checkUseUse($this->semValue, $stackPos - (1 - 1)); - }, 138 => function ($stackPos) { - $this->semValue = new Stmt\UseUse($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - $this->checkUseUse($this->semValue, $stackPos - (3 - 3)); - }, 139 => function ($stackPos) { - $this->semValue = new Stmt\UseUse($this->semStack[$stackPos - (1 - 1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - $this->checkUseUse($this->semValue, $stackPos - (1 - 1)); - }, 140 => function ($stackPos) { - $this->semValue = new Stmt\UseUse($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - $this->checkUseUse($this->semValue, $stackPos - (3 - 3)); - }, 141 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - $this->semValue->type = Stmt\Use_::TYPE_NORMAL; - }, 142 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue->type = $this->semStack[$stackPos - (2 - 1)]; - }, 143 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 144 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 145 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 146 => function ($stackPos) { - $this->semValue = new Node\Const_($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 147 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 148 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 149 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 150 => function ($stackPos) { - $this->semValue = new Node\Const_(new Node\Identifier($this->semStack[$stackPos - (3 - 1)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributeStack[$stackPos - (3 - 1)]), $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 151 => function ($stackPos) { - $this->semValue = new Node\Const_(new Node\Identifier($this->semStack[$stackPos - (3 - 1)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributeStack[$stackPos - (3 - 1)]), $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 152 => function ($stackPos) { - if (\is_array($this->semStack[$stackPos - (2 - 2)])) { - $this->semValue = \array_merge($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); - } else { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + }, 5 => null, 6 => null, 7 => null, 8 => null, 9 => null, 10 => null, 11 => null, 12 => null, 13 => null, 14 => null, 15 => null, 16 => null, 17 => null, 18 => null, 19 => null, 20 => null, 21 => null, 22 => null, 23 => null, 24 => null, 25 => null, 26 => null, 27 => null, 28 => null, 29 => null, 30 => null, 31 => null, 32 => null, 33 => null, 34 => null, 35 => null, 36 => null, 37 => null, 38 => null, 39 => null, 40 => null, 41 => null, 42 => null, 43 => null, 44 => null, 45 => null, 46 => null, 47 => null, 48 => null, 49 => null, 50 => null, 51 => null, 52 => null, 53 => null, 54 => null, 55 => null, 56 => null, 57 => null, 58 => null, 59 => null, 60 => null, 61 => null, 62 => null, 63 => null, 64 => null, 65 => null, 66 => null, 67 => null, 68 => null, 69 => null, 70 => null, 71 => null, 72 => null, 73 => null, 74 => null, 75 => null, 76 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + if ($self->semValue === "emitError(new Error('Cannot use "getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos]))); } - }, 153 => function ($stackPos) { - $this->semValue = array(); - }, 154 => function ($stackPos) { - $startAttributes = $this->lookaheadStartAttributes; - if (isset($startAttributes['comments'])) { - $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); - } else { - $nop = null; + }, 77 => null, 78 => null, 79 => null, 80 => null, 81 => null, 82 => null, 83 => null, 84 => null, 85 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 86 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 87 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 88 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 89 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 90 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 91 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 92 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 93 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 94 => null, 95 => static function ($self, $stackPos) { + $self->semValue = new Name(\substr($self->semStack[$stackPos - (1 - 1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 96 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable(\substr($self->semStack[$stackPos - (1 - 1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 97 => static function ($self, $stackPos) { + /* nothing */ + }, 98 => static function ($self, $stackPos) { + /* nothing */ + }, 99 => static function ($self, $stackPos) { + /* nothing */ + }, 100 => static function ($self, $stackPos) { + $self->emitError(new Error('A trailing comma is not allowed here', $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos]))); + }, 101 => null, 102 => null, 103 => static function ($self, $stackPos) { + $self->semValue = new Node\Attribute($self->semStack[$stackPos - (1 - 1)], [], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 104 => static function ($self, $stackPos) { + $self->semValue = new Node\Attribute($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 105 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 106 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 107 => static function ($self, $stackPos) { + $self->semValue = new Node\AttributeGroup($self->semStack[$stackPos - (4 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 108 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 109 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 110 => static function ($self, $stackPos) { + $self->semValue = []; + }, 111 => null, 112 => null, 113 => null, 114 => null, 115 => static function ($self, $stackPos) { + $self->semValue = new Stmt\HaltCompiler($self->handleHaltCompiler(), $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 116 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Namespace_($self->semStack[$stackPos - (3 - 2)], null, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Stmt\Namespace_::KIND_SEMICOLON); + $self->checkNamespace($self->semValue); + }, 117 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Namespace_($self->semStack[$stackPos - (5 - 2)], $self->semStack[$stackPos - (5 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); + $self->checkNamespace($self->semValue); + }, 118 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Namespace_(null, $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); + $self->checkNamespace($self->semValue); + }, 119 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Use_($self->semStack[$stackPos - (3 - 2)], Stmt\Use_::TYPE_NORMAL, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 120 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Use_($self->semStack[$stackPos - (4 - 3)], $self->semStack[$stackPos - (4 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 121 => null, 122 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Const_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 123 => static function ($self, $stackPos) { + $self->semValue = Stmt\Use_::TYPE_FUNCTION; + }, 124 => static function ($self, $stackPos) { + $self->semValue = Stmt\Use_::TYPE_CONSTANT; + }, 125 => static function ($self, $stackPos) { + $self->semValue = new Stmt\GroupUse($self->semStack[$stackPos - (8 - 3)], $self->semStack[$stackPos - (8 - 6)], $self->semStack[$stackPos - (8 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + }, 126 => static function ($self, $stackPos) { + $self->semValue = new Stmt\GroupUse($self->semStack[$stackPos - (7 - 2)], $self->semStack[$stackPos - (7 - 5)], Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + }, 127 => null, 128 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 129 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 130 => null, 131 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 132 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 133 => null, 134 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 135 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 136 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos - (1 - 1)], null, Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkUseUse($self->semValue, $stackPos - (1 - 1)); + }, 137 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkUseUse($self->semValue, $stackPos - (3 - 3)); + }, 138 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos - (1 - 1)], null, Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkUseUse($self->semValue, $stackPos - (1 - 1)); + }, 139 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkUseUse($self->semValue, $stackPos - (3 - 3)); + }, 140 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + $self->semValue->type = Stmt\Use_::TYPE_NORMAL; + }, 141 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue->type = $self->semStack[$stackPos - (2 - 1)]; + }, 142 => null, 143 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 144 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 145 => static function ($self, $stackPos) { + $self->semValue = new Node\Const_($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 146 => null, 147 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 148 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 149 => static function ($self, $stackPos) { + $self->semValue = new Node\Const_(new Node\Identifier($self->semStack[$stackPos - (3 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos - (3 - 1)])), $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 150 => static function ($self, $stackPos) { + $self->semValue = new Node\Const_(new Node\Identifier($self->semStack[$stackPos - (3 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos - (3 - 1)])), $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 151 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos - (2 - 2)] !== null) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; } + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 152 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 153 => static function ($self, $stackPos) { + $nop = $self->maybeCreateZeroLengthNop($self->tokenPos); if ($nop !== null) { - $this->semStack[$stackPos - (1 - 1)][] = $nop; + $self->semStack[$stackPos - (1 - 1)][] = $nop; } - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 155 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 156 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 157 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 158 => function ($stackPos) { - throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 159 => function ($stackPos) { - if ($this->semStack[$stackPos - (3 - 2)]) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - $attrs = $this->startAttributeStack[$stackPos - (3 - 1)]; - $stmts = $this->semValue; - if (!empty($attrs['comments'])) { - $stmts[0]->setAttribute('comments', \array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); - } + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + }, 154 => null, 155 => null, 156 => null, 157 => static function ($self, $stackPos) { + throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 158 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Block($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 159 => static function ($self, $stackPos) { + $self->semValue = new Stmt\If_($self->semStack[$stackPos - (7 - 3)], ['stmts' => $self->semStack[$stackPos - (7 - 5)], 'elseifs' => $self->semStack[$stackPos - (7 - 6)], 'else' => $self->semStack[$stackPos - (7 - 7)]], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + }, 160 => static function ($self, $stackPos) { + $self->semValue = new Stmt\If_($self->semStack[$stackPos - (10 - 3)], ['stmts' => $self->semStack[$stackPos - (10 - 6)], 'elseifs' => $self->semStack[$stackPos - (10 - 7)], 'else' => $self->semStack[$stackPos - (10 - 8)]], $self->getAttributes($self->tokenStartStack[$stackPos - (10 - 1)], $self->tokenEndStack[$stackPos])); + }, 161 => static function ($self, $stackPos) { + $self->semValue = new Stmt\While_($self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 162 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Do_($self->semStack[$stackPos - (7 - 5)], $self->semStack[$stackPos - (7 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + }, 163 => static function ($self, $stackPos) { + $self->semValue = new Stmt\For_(['init' => $self->semStack[$stackPos - (9 - 3)], 'cond' => $self->semStack[$stackPos - (9 - 5)], 'loop' => $self->semStack[$stackPos - (9 - 7)], 'stmts' => $self->semStack[$stackPos - (9 - 9)]], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 164 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Switch_($self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 165 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Break_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 166 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Continue_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 167 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Return_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 168 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Global_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 169 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Static_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 170 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Echo_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 171 => static function ($self, $stackPos) { + $self->semValue = new Stmt\InlineHTML($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('hasLeadingNewline', $self->inlineHtmlHasLeadingNewline($stackPos - (1 - 1))); + }, 172 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Expression($self->semStack[$stackPos - (2 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 173 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Unset_($self->semStack[$stackPos - (5 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 174 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Foreach_($self->semStack[$stackPos - (7 - 3)], $self->semStack[$stackPos - (7 - 5)][0], ['keyVar' => null, 'byRef' => $self->semStack[$stackPos - (7 - 5)][1], 'stmts' => $self->semStack[$stackPos - (7 - 7)]], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + }, 175 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Foreach_($self->semStack[$stackPos - (9 - 3)], $self->semStack[$stackPos - (9 - 7)][0], ['keyVar' => $self->semStack[$stackPos - (9 - 5)], 'byRef' => $self->semStack[$stackPos - (9 - 7)][1], 'stmts' => $self->semStack[$stackPos - (9 - 9)]], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 176 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Foreach_($self->semStack[$stackPos - (6 - 3)], new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos - (6 - 4)], $self->tokenEndStack[$stackPos - (6 - 4)])), ['stmts' => $self->semStack[$stackPos - (6 - 6)]], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos])); + }, 177 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Declare_($self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 178 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TryCatch($self->semStack[$stackPos - (6 - 3)], $self->semStack[$stackPos - (6 - 5)], $self->semStack[$stackPos - (6 - 6)], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkTryCatch($self->semValue); + }, 179 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Goto_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 180 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Label($self->semStack[$stackPos - (2 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 181 => static function ($self, $stackPos) { + $self->semValue = null; + /* means: no statement */ + }, 182 => null, 183 => static function ($self, $stackPos) { + $self->semValue = $self->maybeCreateNop($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos]); + }, 184 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos - (1 - 1)] instanceof Stmt\Block) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]->stmts; } else { - $startAttributes = $this->startAttributeStack[$stackPos - (3 - 1)]; - if (isset($startAttributes['comments'])) { - $this->semValue = new Stmt\Nop($startAttributes + $this->endAttributes); + if ($self->semStack[$stackPos - (1 - 1)] === null) { + $self->semValue = []; } else { - $this->semValue = null; - } - if (null === $this->semValue) { - $this->semValue = array(); + $self->semValue = [$self->semStack[$stackPos - (1 - 1)]]; } } - }, 160 => function ($stackPos) { - $this->semValue = new Stmt\If_($this->semStack[$stackPos - (7 - 3)], ['stmts' => \is_array($this->semStack[$stackPos - (7 - 5)]) ? $this->semStack[$stackPos - (7 - 5)] : array($this->semStack[$stackPos - (7 - 5)]), 'elseifs' => $this->semStack[$stackPos - (7 - 6)], 'else' => $this->semStack[$stackPos - (7 - 7)]], $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); - }, 161 => function ($stackPos) { - $this->semValue = new Stmt\If_($this->semStack[$stackPos - (10 - 3)], ['stmts' => $this->semStack[$stackPos - (10 - 6)], 'elseifs' => $this->semStack[$stackPos - (10 - 7)], 'else' => $this->semStack[$stackPos - (10 - 8)]], $this->startAttributeStack[$stackPos - (10 - 1)] + $this->endAttributes); - }, 162 => function ($stackPos) { - $this->semValue = new Stmt\While_($this->semStack[$stackPos - (5 - 3)], $this->semStack[$stackPos - (5 - 5)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 163 => function ($stackPos) { - $this->semValue = new Stmt\Do_($this->semStack[$stackPos - (7 - 5)], \is_array($this->semStack[$stackPos - (7 - 2)]) ? $this->semStack[$stackPos - (7 - 2)] : array($this->semStack[$stackPos - (7 - 2)]), $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); - }, 164 => function ($stackPos) { - $this->semValue = new Stmt\For_(['init' => $this->semStack[$stackPos - (9 - 3)], 'cond' => $this->semStack[$stackPos - (9 - 5)], 'loop' => $this->semStack[$stackPos - (9 - 7)], 'stmts' => $this->semStack[$stackPos - (9 - 9)]], $this->startAttributeStack[$stackPos - (9 - 1)] + $this->endAttributes); - }, 165 => function ($stackPos) { - $this->semValue = new Stmt\Switch_($this->semStack[$stackPos - (5 - 3)], $this->semStack[$stackPos - (5 - 5)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 166 => function ($stackPos) { - $this->semValue = new Stmt\Break_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 167 => function ($stackPos) { - $this->semValue = new Stmt\Continue_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 168 => function ($stackPos) { - $this->semValue = new Stmt\Return_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 169 => function ($stackPos) { - $this->semValue = new Stmt\Global_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 170 => function ($stackPos) { - $this->semValue = new Stmt\Static_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 171 => function ($stackPos) { - $this->semValue = new Stmt\Echo_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 172 => function ($stackPos) { - $this->semValue = new Stmt\InlineHTML($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 173 => function ($stackPos) { - $e = $this->semStack[$stackPos - (2 - 1)]; - if ($e instanceof Expr\Throw_) { - // For backwards-compatibility reasons, convert throw in statement position into - // Stmt\Throw_ rather than Stmt\Expression(Expr\Throw_). - $this->semValue = new Stmt\Throw_($e->expr, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); + }, 185 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 186 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 187 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 188 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 189 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Catch_($self->semStack[$stackPos - (8 - 3)], $self->semStack[$stackPos - (8 - 4)], $self->semStack[$stackPos - (8 - 7)], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + }, 190 => static function ($self, $stackPos) { + $self->semValue = null; + }, 191 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Finally_($self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 192 => null, 193 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 194 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 195 => static function ($self, $stackPos) { + $self->semValue = \false; + }, 196 => static function ($self, $stackPos) { + $self->semValue = \true; + }, 197 => static function ($self, $stackPos) { + $self->semValue = \false; + }, 198 => static function ($self, $stackPos) { + $self->semValue = \true; + }, 199 => static function ($self, $stackPos) { + $self->semValue = \false; + }, 200 => static function ($self, $stackPos) { + $self->semValue = \true; + }, 201 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 202 => static function ($self, $stackPos) { + $self->semValue = []; + }, 203 => null, 204 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 205 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 206 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Function_($self->semStack[$stackPos - (8 - 3)], ['byRef' => $self->semStack[$stackPos - (8 - 2)], 'params' => $self->semStack[$stackPos - (8 - 5)], 'returnType' => $self->semStack[$stackPos - (8 - 7)], 'stmts' => $self->semStack[$stackPos - (8 - 8)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + }, 207 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Function_($self->semStack[$stackPos - (9 - 4)], ['byRef' => $self->semStack[$stackPos - (9 - 3)], 'params' => $self->semStack[$stackPos - (9 - 6)], 'returnType' => $self->semStack[$stackPos - (9 - 8)], 'stmts' => $self->semStack[$stackPos - (9 - 9)], 'attrGroups' => $self->semStack[$stackPos - (9 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 208 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Class_($self->semStack[$stackPos - (7 - 2)], ['type' => $self->semStack[$stackPos - (7 - 1)], 'extends' => $self->semStack[$stackPos - (7 - 3)], 'implements' => $self->semStack[$stackPos - (7 - 4)], 'stmts' => $self->semStack[$stackPos - (7 - 6)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkClass($self->semValue, $stackPos - (7 - 2)); + }, 209 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Class_($self->semStack[$stackPos - (8 - 3)], ['type' => $self->semStack[$stackPos - (8 - 2)], 'extends' => $self->semStack[$stackPos - (8 - 4)], 'implements' => $self->semStack[$stackPos - (8 - 5)], 'stmts' => $self->semStack[$stackPos - (8 - 7)], 'attrGroups' => $self->semStack[$stackPos - (8 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkClass($self->semValue, $stackPos - (8 - 3)); + }, 210 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Interface_($self->semStack[$stackPos - (7 - 3)], ['extends' => $self->semStack[$stackPos - (7 - 4)], 'stmts' => $self->semStack[$stackPos - (7 - 6)], 'attrGroups' => $self->semStack[$stackPos - (7 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkInterface($self->semValue, $stackPos - (7 - 3)); + }, 211 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Trait_($self->semStack[$stackPos - (6 - 3)], ['stmts' => $self->semStack[$stackPos - (6 - 5)], 'attrGroups' => $self->semStack[$stackPos - (6 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos])); + }, 212 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Enum_($self->semStack[$stackPos - (8 - 3)], ['scalarType' => $self->semStack[$stackPos - (8 - 4)], 'implements' => $self->semStack[$stackPos - (8 - 5)], 'stmts' => $self->semStack[$stackPos - (8 - 7)], 'attrGroups' => $self->semStack[$stackPos - (8 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkEnum($self->semValue, $stackPos - (8 - 3)); + }, 213 => static function ($self, $stackPos) { + $self->semValue = null; + }, 214 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + }, 215 => static function ($self, $stackPos) { + $self->semValue = null; + }, 216 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + }, 217 => static function ($self, $stackPos) { + $self->semValue = 0; + }, 218 => null, 219 => null, 220 => static function ($self, $stackPos) { + $self->checkClassModifier($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $stackPos - (2 - 2)); + $self->semValue = $self->semStack[$stackPos - (2 - 1)] | $self->semStack[$stackPos - (2 - 2)]; + }, 221 => static function ($self, $stackPos) { + $self->semValue = Modifiers::ABSTRACT; + }, 222 => static function ($self, $stackPos) { + $self->semValue = Modifiers::FINAL; + }, 223 => static function ($self, $stackPos) { + $self->semValue = Modifiers::READONLY; + }, 224 => static function ($self, $stackPos) { + $self->semValue = null; + }, 225 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + }, 226 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 227 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + }, 228 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 229 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + }, 230 => null, 231 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 232 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 233 => null, 234 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 2)]; + }, 235 => null, 236 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 2)]; + }, 237 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos - (1 - 1)] instanceof Stmt\Block) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]->stmts; } else { - $this->semValue = new Stmt\Expression($e, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); + if ($self->semStack[$stackPos - (1 - 1)] === null) { + $self->semValue = []; + } else { + $self->semValue = [$self->semStack[$stackPos - (1 - 1)]]; + } } - }, 174 => function ($stackPos) { - $this->semValue = new Stmt\Unset_($this->semStack[$stackPos - (5 - 3)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 175 => function ($stackPos) { - $this->semValue = new Stmt\Foreach_($this->semStack[$stackPos - (7 - 3)], $this->semStack[$stackPos - (7 - 5)][0], ['keyVar' => null, 'byRef' => $this->semStack[$stackPos - (7 - 5)][1], 'stmts' => $this->semStack[$stackPos - (7 - 7)]], $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); - }, 176 => function ($stackPos) { - $this->semValue = new Stmt\Foreach_($this->semStack[$stackPos - (9 - 3)], $this->semStack[$stackPos - (9 - 7)][0], ['keyVar' => $this->semStack[$stackPos - (9 - 5)], 'byRef' => $this->semStack[$stackPos - (9 - 7)][1], 'stmts' => $this->semStack[$stackPos - (9 - 9)]], $this->startAttributeStack[$stackPos - (9 - 1)] + $this->endAttributes); - }, 177 => function ($stackPos) { - $this->semValue = new Stmt\Foreach_($this->semStack[$stackPos - (6 - 3)], new Expr\Error($this->startAttributeStack[$stackPos - (6 - 4)] + $this->endAttributeStack[$stackPos - (6 - 4)]), ['stmts' => $this->semStack[$stackPos - (6 - 6)]], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes); - }, 178 => function ($stackPos) { - $this->semValue = new Stmt\Declare_($this->semStack[$stackPos - (5 - 3)], $this->semStack[$stackPos - (5 - 5)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 179 => function ($stackPos) { - $this->semValue = new Stmt\TryCatch($this->semStack[$stackPos - (6 - 3)], $this->semStack[$stackPos - (6 - 5)], $this->semStack[$stackPos - (6 - 6)], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes); - $this->checkTryCatch($this->semValue); - }, 180 => function ($stackPos) { - $this->semValue = new Stmt\Goto_($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 181 => function ($stackPos) { - $this->semValue = new Stmt\Label($this->semStack[$stackPos - (2 - 1)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 182 => function ($stackPos) { - $this->semValue = array(); - /* means: no statement */ - }, 183 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 184 => function ($stackPos) { - $startAttributes = $this->startAttributeStack[$stackPos - (1 - 1)]; - if (isset($startAttributes['comments'])) { - $this->semValue = new Stmt\Nop($startAttributes + $this->endAttributes); + }, 238 => static function ($self, $stackPos) { + $self->semValue = null; + }, 239 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 2)]; + }, 240 => null, 241 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 242 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 243 => static function ($self, $stackPos) { + $self->semValue = new Node\DeclareItem($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 244 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 245 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 3)]; + }, 246 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 2)]; + }, 247 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (5 - 3)]; + }, 248 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 249 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 250 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Case_($self->semStack[$stackPos - (4 - 2)], $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 251 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Case_(null, $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 252 => null, 253 => null, 254 => static function ($self, $stackPos) { + $self->semValue = new Expr\Match_($self->semStack[$stackPos - (7 - 3)], $self->semStack[$stackPos - (7 - 6)], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + }, 255 => static function ($self, $stackPos) { + $self->semValue = []; + }, 256 => null, 257 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 258 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 259 => static function ($self, $stackPos) { + $self->semValue = new Node\MatchArm($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 260 => static function ($self, $stackPos) { + $self->semValue = new Node\MatchArm(null, $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 261 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + }, 262 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 2)]; + }, 263 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 264 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 265 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ElseIf_($self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 266 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 267 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 268 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ElseIf_($self->semStack[$stackPos - (6 - 3)], $self->semStack[$stackPos - (6 - 6)], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos])); + $self->fixupAlternativeElse($self->semValue); + }, 269 => static function ($self, $stackPos) { + $self->semValue = null; + }, 270 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Else_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 271 => static function ($self, $stackPos) { + $self->semValue = null; + }, 272 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Else_($self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + $self->fixupAlternativeElse($self->semValue); + }, 273 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)], \false); + }, 274 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (2 - 2)], \true); + }, 275 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)], \false); + }, 276 => static function ($self, $stackPos) { + $self->semValue = array($self->fixupArrayDestructuring($self->semStack[$stackPos - (1 - 1)]), \false); + }, 277 => null, 278 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 279 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 280 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 281 => static function ($self, $stackPos) { + $self->semValue = 0; + }, 282 => static function ($self, $stackPos) { + $self->checkModifier($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $stackPos - (2 - 2)); + $self->semValue = $self->semStack[$stackPos - (2 - 1)] | $self->semStack[$stackPos - (2 - 2)]; + }, 283 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PUBLIC; + }, 284 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PROTECTED; + }, 285 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PRIVATE; + }, 286 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PUBLIC_SET; + }, 287 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PROTECTED_SET; + }, 288 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PRIVATE_SET; + }, 289 => static function ($self, $stackPos) { + $self->semValue = Modifiers::READONLY; + }, 290 => static function ($self, $stackPos) { + $self->semValue = new Node\Param($self->semStack[$stackPos - (7 - 6)], null, $self->semStack[$stackPos - (7 - 3)], $self->semStack[$stackPos - (7 - 4)], $self->semStack[$stackPos - (7 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (7 - 2)], $self->semStack[$stackPos - (7 - 1)], $self->semStack[$stackPos - (7 - 7)]); + $self->checkParam($self->semValue); + }, 291 => static function ($self, $stackPos) { + $self->semValue = new Node\Param($self->semStack[$stackPos - (9 - 6)], $self->semStack[$stackPos - (9 - 8)], $self->semStack[$stackPos - (9 - 3)], $self->semStack[$stackPos - (9 - 4)], $self->semStack[$stackPos - (9 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (9 - 2)], $self->semStack[$stackPos - (9 - 1)], $self->semStack[$stackPos - (9 - 9)]); + $self->checkParam($self->semValue); + }, 292 => static function ($self, $stackPos) { + $self->semValue = new Node\Param(new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos])), null, $self->semStack[$stackPos - (6 - 3)], $self->semStack[$stackPos - (6 - 4)], $self->semStack[$stackPos - (6 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (6 - 2)], $self->semStack[$stackPos - (6 - 1)]); + }, 293 => null, 294 => static function ($self, $stackPos) { + $self->semValue = new Node\NullableType($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 295 => static function ($self, $stackPos) { + $self->semValue = new Node\UnionType($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 296 => null, 297 => null, 298 => static function ($self, $stackPos) { + $self->semValue = new Node\Name('static', $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 299 => static function ($self, $stackPos) { + $self->semValue = $self->handleBuiltinTypes($self->semStack[$stackPos - (1 - 1)]); + }, 300 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier('array', $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 301 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier('callable', $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 302 => null, 303 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 304 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)]); + }, 305 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 306 => null, 307 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 308 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)]); + }, 309 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 310 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)]); + }, 311 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 312 => static function ($self, $stackPos) { + $self->semValue = new Node\IntersectionType($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 313 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)]); + }, 314 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 315 => static function ($self, $stackPos) { + $self->semValue = new Node\IntersectionType($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 316 => null, 317 => static function ($self, $stackPos) { + $self->semValue = new Node\NullableType($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 318 => static function ($self, $stackPos) { + $self->semValue = new Node\UnionType($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 319 => null, 320 => static function ($self, $stackPos) { + $self->semValue = null; + }, 321 => null, 322 => static function ($self, $stackPos) { + $self->semValue = null; + }, 323 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + }, 324 => static function ($self, $stackPos) { + $self->semValue = null; + }, 325 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 326 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 2)]; + }, 327 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (3 - 2)]); + }, 328 => static function ($self, $stackPos) { + $self->semValue = new Node\VariadicPlaceholder($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 329 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 330 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 331 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos - (1 - 1)], \false, \false, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 332 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos - (2 - 2)], \true, \false, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 333 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos - (2 - 2)], \false, \true, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 334 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos - (3 - 3)], \false, \false, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (3 - 1)]); + }, 335 => null, 336 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 337 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 338 => null, 339 => null, 340 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 341 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 342 => static function ($self, $stackPos) { + $self->semValue = new Node\StaticVar($self->semStack[$stackPos - (1 - 1)], null, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 343 => static function ($self, $stackPos) { + $self->semValue = new Node\StaticVar($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 344 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos - (2 - 2)] !== null) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; } else { - $this->semValue = null; - } - if ($this->semValue === null) { - $this->semValue = array(); - } - /* means: no statement */ - }, 185 => function ($stackPos) { - $this->semValue = array(); - }, 186 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 187 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 188 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 189 => function ($stackPos) { - $this->semValue = new Stmt\Catch_($this->semStack[$stackPos - (8 - 3)], $this->semStack[$stackPos - (8 - 4)], $this->semStack[$stackPos - (8 - 7)], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes); - }, 190 => function ($stackPos) { - $this->semValue = null; - }, 191 => function ($stackPos) { - $this->semValue = new Stmt\Finally_($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 192 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 193 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 194 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 195 => function ($stackPos) { - $this->semValue = \false; - }, 196 => function ($stackPos) { - $this->semValue = \true; - }, 197 => function ($stackPos) { - $this->semValue = \false; - }, 198 => function ($stackPos) { - $this->semValue = \true; - }, 199 => function ($stackPos) { - $this->semValue = \false; - }, 200 => function ($stackPos) { - $this->semValue = \true; - }, 201 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 202 => function ($stackPos) { - $this->semValue = []; - }, 203 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 204 => function ($stackPos) { - $this->semValue = new Node\Identifier($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 205 => function ($stackPos) { - $this->semValue = new Stmt\Function_($this->semStack[$stackPos - (8 - 3)], ['byRef' => $this->semStack[$stackPos - (8 - 2)], 'params' => $this->semStack[$stackPos - (8 - 5)], 'returnType' => $this->semStack[$stackPos - (8 - 7)], 'stmts' => $this->semStack[$stackPos - (8 - 8)], 'attrGroups' => []], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes); - }, 206 => function ($stackPos) { - $this->semValue = new Stmt\Function_($this->semStack[$stackPos - (9 - 4)], ['byRef' => $this->semStack[$stackPos - (9 - 3)], 'params' => $this->semStack[$stackPos - (9 - 6)], 'returnType' => $this->semStack[$stackPos - (9 - 8)], 'stmts' => $this->semStack[$stackPos - (9 - 9)], 'attrGroups' => $this->semStack[$stackPos - (9 - 1)]], $this->startAttributeStack[$stackPos - (9 - 1)] + $this->endAttributes); - }, 207 => function ($stackPos) { - $this->semValue = new Stmt\Class_($this->semStack[$stackPos - (7 - 2)], ['type' => $this->semStack[$stackPos - (7 - 1)], 'extends' => $this->semStack[$stackPos - (7 - 3)], 'implements' => $this->semStack[$stackPos - (7 - 4)], 'stmts' => $this->semStack[$stackPos - (7 - 6)], 'attrGroups' => []], $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); - $this->checkClass($this->semValue, $stackPos - (7 - 2)); - }, 208 => function ($stackPos) { - $this->semValue = new Stmt\Class_($this->semStack[$stackPos - (8 - 3)], ['type' => $this->semStack[$stackPos - (8 - 2)], 'extends' => $this->semStack[$stackPos - (8 - 4)], 'implements' => $this->semStack[$stackPos - (8 - 5)], 'stmts' => $this->semStack[$stackPos - (8 - 7)], 'attrGroups' => $this->semStack[$stackPos - (8 - 1)]], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes); - $this->checkClass($this->semValue, $stackPos - (8 - 3)); - }, 209 => function ($stackPos) { - $this->semValue = new Stmt\Interface_($this->semStack[$stackPos - (7 - 3)], ['extends' => $this->semStack[$stackPos - (7 - 4)], 'stmts' => $this->semStack[$stackPos - (7 - 6)], 'attrGroups' => $this->semStack[$stackPos - (7 - 1)]], $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); - $this->checkInterface($this->semValue, $stackPos - (7 - 3)); - }, 210 => function ($stackPos) { - $this->semValue = new Stmt\Trait_($this->semStack[$stackPos - (6 - 3)], ['stmts' => $this->semStack[$stackPos - (6 - 5)], 'attrGroups' => $this->semStack[$stackPos - (6 - 1)]], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes); - }, 211 => function ($stackPos) { - $this->semValue = new Stmt\Enum_($this->semStack[$stackPos - (8 - 3)], ['scalarType' => $this->semStack[$stackPos - (8 - 4)], 'implements' => $this->semStack[$stackPos - (8 - 5)], 'stmts' => $this->semStack[$stackPos - (8 - 7)], 'attrGroups' => $this->semStack[$stackPos - (8 - 1)]], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes); - $this->checkEnum($this->semValue, $stackPos - (8 - 3)); - }, 212 => function ($stackPos) { - $this->semValue = null; - }, 213 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 2)]; - }, 214 => function ($stackPos) { - $this->semValue = null; - }, 215 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 2)]; - }, 216 => function ($stackPos) { - $this->semValue = 0; - }, 217 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 218 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 219 => function ($stackPos) { - $this->checkClassModifier($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $stackPos - (2 - 2)); - $this->semValue = $this->semStack[$stackPos - (2 - 1)] | $this->semStack[$stackPos - (2 - 2)]; - }, 220 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; - }, 221 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; - }, 222 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_READONLY; - }, 223 => function ($stackPos) { - $this->semValue = null; - }, 224 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 2)]; - }, 225 => function ($stackPos) { - $this->semValue = array(); - }, 226 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 2)]; - }, 227 => function ($stackPos) { - $this->semValue = array(); - }, 228 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 2)]; - }, 229 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 230 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 231 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 232 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); - }, 233 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 2)]; - }, 234 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); - }, 235 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 2)]; - }, 236 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); - }, 237 => function ($stackPos) { - $this->semValue = null; - }, 238 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 2)]; - }, 239 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 240 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 241 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 242 => function ($stackPos) { - $this->semValue = new Stmt\DeclareDeclare($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 243 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 244 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 3)]; - }, 245 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 2)]; - }, 246 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (5 - 3)]; - }, 247 => function ($stackPos) { - $this->semValue = array(); - }, 248 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 249 => function ($stackPos) { - $this->semValue = new Stmt\Case_($this->semStack[$stackPos - (4 - 2)], $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 250 => function ($stackPos) { - $this->semValue = new Stmt\Case_(null, $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 251 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 252 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 253 => function ($stackPos) { - $this->semValue = new Expr\Match_($this->semStack[$stackPos - (7 - 3)], $this->semStack[$stackPos - (7 - 6)], $this->startAttributeStack[$stackPos - (7 - 1)] + $this->endAttributes); - }, 254 => function ($stackPos) { - $this->semValue = []; - }, 255 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 256 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 257 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 258 => function ($stackPos) { - $this->semValue = new Node\MatchArm($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 259 => function ($stackPos) { - $this->semValue = new Node\MatchArm(null, $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 260 => function ($stackPos) { - $this->semValue = \is_array($this->semStack[$stackPos - (1 - 1)]) ? $this->semStack[$stackPos - (1 - 1)] : array($this->semStack[$stackPos - (1 - 1)]); - }, 261 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 2)]; - }, 262 => function ($stackPos) { - $this->semValue = array(); - }, 263 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 264 => function ($stackPos) { - $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos - (5 - 3)], \is_array($this->semStack[$stackPos - (5 - 5)]) ? $this->semStack[$stackPos - (5 - 5)] : array($this->semStack[$stackPos - (5 - 5)]), $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 265 => function ($stackPos) { - $this->semValue = array(); - }, 266 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 267 => function ($stackPos) { - $this->semValue = new Stmt\ElseIf_($this->semStack[$stackPos - (6 - 3)], $this->semStack[$stackPos - (6 - 6)], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes); - $this->fixupAlternativeElse($this->semValue); - }, 268 => function ($stackPos) { - $this->semValue = null; - }, 269 => function ($stackPos) { - $this->semValue = new Stmt\Else_(\is_array($this->semStack[$stackPos - (2 - 2)]) ? $this->semStack[$stackPos - (2 - 2)] : array($this->semStack[$stackPos - (2 - 2)]), $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 270 => function ($stackPos) { - $this->semValue = null; - }, 271 => function ($stackPos) { - $this->semValue = new Stmt\Else_($this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - $this->fixupAlternativeElse($this->semValue); - }, 272 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)], \false); - }, 273 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (2 - 2)], \true); - }, 274 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)], \false); - }, 275 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)], \false); - }, 276 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 277 => function ($stackPos) { - $this->semValue = array(); - }, 278 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 279 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 280 => function ($stackPos) { - $this->semValue = 0; - }, 281 => function ($stackPos) { - $this->checkModifier($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $stackPos - (2 - 2)); - $this->semValue = $this->semStack[$stackPos - (2 - 1)] | $this->semStack[$stackPos - (2 - 2)]; - }, 282 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; - }, 283 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; - }, 284 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; - }, 285 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_READONLY; - }, 286 => function ($stackPos) { - $this->semValue = new Node\Param($this->semStack[$stackPos - (6 - 6)], null, $this->semStack[$stackPos - (6 - 3)], $this->semStack[$stackPos - (6 - 4)], $this->semStack[$stackPos - (6 - 5)], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes, $this->semStack[$stackPos - (6 - 2)], $this->semStack[$stackPos - (6 - 1)]); - $this->checkParam($this->semValue); - }, 287 => function ($stackPos) { - $this->semValue = new Node\Param($this->semStack[$stackPos - (8 - 6)], $this->semStack[$stackPos - (8 - 8)], $this->semStack[$stackPos - (8 - 3)], $this->semStack[$stackPos - (8 - 4)], $this->semStack[$stackPos - (8 - 5)], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes, $this->semStack[$stackPos - (8 - 2)], $this->semStack[$stackPos - (8 - 1)]); - $this->checkParam($this->semValue); - }, 288 => function ($stackPos) { - $this->semValue = new Node\Param(new Expr\Error($this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes), null, $this->semStack[$stackPos - (6 - 3)], $this->semStack[$stackPos - (6 - 4)], $this->semStack[$stackPos - (6 - 5)], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes, $this->semStack[$stackPos - (6 - 2)], $this->semStack[$stackPos - (6 - 1)]); - }, 289 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 290 => function ($stackPos) { - $this->semValue = new Node\NullableType($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 291 => function ($stackPos) { - $this->semValue = new Node\UnionType($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 292 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 293 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 294 => function ($stackPos) { - $this->semValue = new Node\Name('static', $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 295 => function ($stackPos) { - $this->semValue = $this->handleBuiltinTypes($this->semStack[$stackPos - (1 - 1)]); - }, 296 => function ($stackPos) { - $this->semValue = new Node\Identifier('array', $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 297 => function ($stackPos) { - $this->semValue = new Node\Identifier('callable', $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 298 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 299 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 300 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)]); - }, 301 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 302 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 303 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 304 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)]); - }, 305 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 306 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)]); - }, 307 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 308 => function ($stackPos) { - $this->semValue = new Node\IntersectionType($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 309 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)]); - }, 310 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 311 => function ($stackPos) { - $this->semValue = new Node\IntersectionType($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 312 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 313 => function ($stackPos) { - $this->semValue = new Node\NullableType($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 314 => function ($stackPos) { - $this->semValue = new Node\UnionType($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 315 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 316 => function ($stackPos) { - $this->semValue = null; - }, 317 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 318 => function ($stackPos) { - $this->semValue = null; - }, 319 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 2)]; - }, 320 => function ($stackPos) { - $this->semValue = null; - }, 321 => function ($stackPos) { - $this->semValue = array(); - }, 322 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 2)]; - }, 323 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (3 - 2)]); - }, 324 => function ($stackPos) { - $this->semValue = new Node\VariadicPlaceholder($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 325 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 326 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 327 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos - (1 - 1)], \false, \false, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 328 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos - (2 - 2)], \true, \false, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 329 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos - (2 - 2)], \false, \true, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 330 => function ($stackPos) { - $this->semValue = new Node\Arg($this->semStack[$stackPos - (3 - 3)], \false, \false, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes, $this->semStack[$stackPos - (3 - 1)]); - }, 331 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 332 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 333 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 334 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 335 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 336 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 337 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 338 => function ($stackPos) { - $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos - (1 - 1)], null, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 339 => function ($stackPos) { - $this->semValue = new Stmt\StaticVar($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 340 => function ($stackPos) { - if ($this->semStack[$stackPos - (2 - 2)] !== null) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - } else { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - } - }, 341 => function ($stackPos) { - $this->semValue = array(); - }, 342 => function ($stackPos) { - $startAttributes = $this->lookaheadStartAttributes; - if (isset($startAttributes['comments'])) { - $nop = new Stmt\Nop($this->createCommentNopAttributes($startAttributes['comments'])); - } else { - $nop = null; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; } + }, 345 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 346 => static function ($self, $stackPos) { + $nop = $self->maybeCreateZeroLengthNop($self->tokenPos); if ($nop !== null) { - $this->semStack[$stackPos - (1 - 1)][] = $nop; + $self->semStack[$stackPos - (1 - 1)][] = $nop; } - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 343 => function ($stackPos) { - $this->semValue = new Stmt\Property($this->semStack[$stackPos - (5 - 2)], $this->semStack[$stackPos - (5 - 4)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes, $this->semStack[$stackPos - (5 - 3)], $this->semStack[$stackPos - (5 - 1)]); - $this->checkProperty($this->semValue, $stackPos - (5 - 2)); - }, 344 => function ($stackPos) { - $this->semValue = new Stmt\ClassConst($this->semStack[$stackPos - (5 - 4)], $this->semStack[$stackPos - (5 - 2)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes, $this->semStack[$stackPos - (5 - 1)]); - $this->checkClassConst($this->semValue, $stackPos - (5 - 2)); - }, 345 => function ($stackPos) { - $this->semValue = new Stmt\ClassConst($this->semStack[$stackPos - (6 - 5)], $this->semStack[$stackPos - (6 - 2)], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes, $this->semStack[$stackPos - (6 - 1)], $this->semStack[$stackPos - (6 - 4)]); - $this->checkClassConst($this->semValue, $stackPos - (6 - 2)); - }, 346 => function ($stackPos) { - $this->semValue = new Stmt\ClassMethod($this->semStack[$stackPos - (10 - 5)], ['type' => $this->semStack[$stackPos - (10 - 2)], 'byRef' => $this->semStack[$stackPos - (10 - 4)], 'params' => $this->semStack[$stackPos - (10 - 7)], 'returnType' => $this->semStack[$stackPos - (10 - 9)], 'stmts' => $this->semStack[$stackPos - (10 - 10)], 'attrGroups' => $this->semStack[$stackPos - (10 - 1)]], $this->startAttributeStack[$stackPos - (10 - 1)] + $this->endAttributes); - $this->checkClassMethod($this->semValue, $stackPos - (10 - 2)); - }, 347 => function ($stackPos) { - $this->semValue = new Stmt\TraitUse($this->semStack[$stackPos - (3 - 2)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 348 => function ($stackPos) { - $this->semValue = new Stmt\EnumCase($this->semStack[$stackPos - (5 - 3)], $this->semStack[$stackPos - (5 - 4)], $this->semStack[$stackPos - (5 - 1)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 349 => function ($stackPos) { - $this->semValue = null; + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + }, 347 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Property($self->semStack[$stackPos - (5 - 2)], $self->semStack[$stackPos - (5 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 1)]); + }, 348 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ClassConst($self->semStack[$stackPos - (5 - 4)], $self->semStack[$stackPos - (5 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (5 - 1)]); + $self->checkClassConst($self->semValue, $stackPos - (5 - 2)); + }, 349 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ClassConst($self->semStack[$stackPos - (6 - 5)], $self->semStack[$stackPos - (6 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (6 - 1)], $self->semStack[$stackPos - (6 - 4)]); + $self->checkClassConst($self->semValue, $stackPos - (6 - 2)); + }, 350 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ClassMethod($self->semStack[$stackPos - (10 - 5)], ['type' => $self->semStack[$stackPos - (10 - 2)], 'byRef' => $self->semStack[$stackPos - (10 - 4)], 'params' => $self->semStack[$stackPos - (10 - 7)], 'returnType' => $self->semStack[$stackPos - (10 - 9)], 'stmts' => $self->semStack[$stackPos - (10 - 10)], 'attrGroups' => $self->semStack[$stackPos - (10 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (10 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkClassMethod($self->semValue, $stackPos - (10 - 2)); + }, 351 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUse($self->semStack[$stackPos - (3 - 2)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 352 => static function ($self, $stackPos) { + $self->semValue = new Stmt\EnumCase($self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 4)], $self->semStack[$stackPos - (5 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 353 => static function ($self, $stackPos) { + $self->semValue = null; /* will be skipped */ - }, 350 => function ($stackPos) { - $this->semValue = array(); - }, 351 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 352 => function ($stackPos) { - $this->semValue = array(); - }, 353 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 354 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$stackPos - (4 - 1)][0], $this->semStack[$stackPos - (4 - 1)][1], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 355 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos - (5 - 1)][0], $this->semStack[$stackPos - (5 - 1)][1], $this->semStack[$stackPos - (5 - 3)], $this->semStack[$stackPos - (5 - 4)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 356 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos - (4 - 1)][0], $this->semStack[$stackPos - (4 - 1)][1], $this->semStack[$stackPos - (4 - 3)], null, $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 357 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos - (4 - 1)][0], $this->semStack[$stackPos - (4 - 1)][1], null, $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 358 => function ($stackPos) { - $this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$stackPos - (4 - 1)][0], $this->semStack[$stackPos - (4 - 1)][1], null, $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 359 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)]); - }, 360 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 361 => function ($stackPos) { - $this->semValue = array(null, $this->semStack[$stackPos - (1 - 1)]); - }, 362 => function ($stackPos) { - $this->semValue = null; - }, 363 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 364 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 365 => function ($stackPos) { - $this->semValue = 0; - }, 366 => function ($stackPos) { - $this->semValue = 0; - }, 367 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 368 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 369 => function ($stackPos) { - $this->checkModifier($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $stackPos - (2 - 2)); - $this->semValue = $this->semStack[$stackPos - (2 - 1)] | $this->semStack[$stackPos - (2 - 2)]; - }, 370 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PUBLIC; - }, 371 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PROTECTED; - }, 372 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_PRIVATE; - }, 373 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_STATIC; - }, 374 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_ABSTRACT; - }, 375 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_FINAL; - }, 376 => function ($stackPos) { - $this->semValue = Stmt\Class_::MODIFIER_READONLY; - }, 377 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 378 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 379 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 380 => function ($stackPos) { - $this->semValue = new Node\VarLikeIdentifier(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 381 => function ($stackPos) { - $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos - (1 - 1)], null, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 382 => function ($stackPos) { - $this->semValue = new Stmt\PropertyProperty($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 383 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 384 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 385 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 386 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 387 => function ($stackPos) { - $this->semValue = array(); - }, 388 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 389 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 390 => function ($stackPos) { - $this->semValue = new Expr\Assign($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 391 => function ($stackPos) { - $this->semValue = new Expr\Assign($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 392 => function ($stackPos) { - $this->semValue = new Expr\Assign($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 393 => function ($stackPos) { - $this->semValue = new Expr\AssignRef($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 394 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 395 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 396 => function ($stackPos) { - $this->semValue = new Expr\Clone_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 397 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Plus($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 398 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Minus($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 399 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Mul($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 400 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Div($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 401 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Concat($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 402 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Mod($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 403 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 404 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 405 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 406 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 407 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 408 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Pow($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 409 => function ($stackPos) { - $this->semValue = new Expr\AssignOp\Coalesce($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 410 => function ($stackPos) { - $this->semValue = new Expr\PostInc($this->semStack[$stackPos - (2 - 1)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 411 => function ($stackPos) { - $this->semValue = new Expr\PreInc($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 412 => function ($stackPos) { - $this->semValue = new Expr\PostDec($this->semStack[$stackPos - (2 - 1)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 413 => function ($stackPos) { - $this->semValue = new Expr\PreDec($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 414 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 415 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 416 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 417 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 418 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 419 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 420 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 421 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 422 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 423 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Concat($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 424 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Plus($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 425 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Minus($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 426 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Mul($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 427 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Div($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 428 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Mod($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 429 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 430 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 431 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Pow($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 432 => function ($stackPos) { - $this->semValue = new Expr\UnaryPlus($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 433 => function ($stackPos) { - $this->semValue = new Expr\UnaryMinus($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 434 => function ($stackPos) { - $this->semValue = new Expr\BooleanNot($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 435 => function ($stackPos) { - $this->semValue = new Expr\BitwiseNot($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 436 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Identical($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 437 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 438 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Equal($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 439 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 440 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 441 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 442 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 443 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Greater($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 444 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 445 => function ($stackPos) { - $this->semValue = new Expr\Instanceof_($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 446 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 447 => function ($stackPos) { - $this->semValue = new Expr\Ternary($this->semStack[$stackPos - (5 - 1)], $this->semStack[$stackPos - (5 - 3)], $this->semStack[$stackPos - (5 - 5)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 448 => function ($stackPos) { - $this->semValue = new Expr\Ternary($this->semStack[$stackPos - (4 - 1)], null, $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 449 => function ($stackPos) { - $this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 450 => function ($stackPos) { - $this->semValue = new Expr\Isset_($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 451 => function ($stackPos) { - $this->semValue = new Expr\Empty_($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 452 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 453 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 454 => function ($stackPos) { - $this->semValue = new Expr\Eval_($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 455 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 456 => function ($stackPos) { - $this->semValue = new Expr\Include_($this->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 457 => function ($stackPos) { - $this->semValue = new Expr\Cast\Int_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 458 => function ($stackPos) { - $attrs = $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes; - $attrs['kind'] = $this->getFloatCastKind($this->semStack[$stackPos - (2 - 1)]); - $this->semValue = new Expr\Cast\Double($this->semStack[$stackPos - (2 - 2)], $attrs); - }, 459 => function ($stackPos) { - $this->semValue = new Expr\Cast\String_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 460 => function ($stackPos) { - $this->semValue = new Expr\Cast\Array_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 461 => function ($stackPos) { - $this->semValue = new Expr\Cast\Object_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 462 => function ($stackPos) { - $this->semValue = new Expr\Cast\Bool_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 463 => function ($stackPos) { - $this->semValue = new Expr\Cast\Unset_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 464 => function ($stackPos) { - $attrs = $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes; - $attrs['kind'] = \strtolower($this->semStack[$stackPos - (2 - 1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; - $this->semValue = new Expr\Exit_($this->semStack[$stackPos - (2 - 2)], $attrs); - }, 465 => function ($stackPos) { - $this->semValue = new Expr\ErrorSuppress($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 466 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 467 => function ($stackPos) { - $this->semValue = new Expr\ShellExec($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 468 => function ($stackPos) { - $this->semValue = new Expr\Print_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 469 => function ($stackPos) { - $this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 470 => function ($stackPos) { - $this->semValue = new Expr\Yield_($this->semStack[$stackPos - (2 - 2)], null, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 471 => function ($stackPos) { - $this->semValue = new Expr\Yield_($this->semStack[$stackPos - (4 - 4)], $this->semStack[$stackPos - (4 - 2)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 472 => function ($stackPos) { - $this->semValue = new Expr\YieldFrom($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 473 => function ($stackPos) { - $this->semValue = new Expr\Throw_($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 474 => function ($stackPos) { - $this->semValue = new Expr\ArrowFunction(['static' => \false, 'byRef' => $this->semStack[$stackPos - (8 - 2)], 'params' => $this->semStack[$stackPos - (8 - 4)], 'returnType' => $this->semStack[$stackPos - (8 - 6)], 'expr' => $this->semStack[$stackPos - (8 - 8)], 'attrGroups' => []], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes); - }, 475 => function ($stackPos) { - $this->semValue = new Expr\ArrowFunction(['static' => \true, 'byRef' => $this->semStack[$stackPos - (9 - 3)], 'params' => $this->semStack[$stackPos - (9 - 5)], 'returnType' => $this->semStack[$stackPos - (9 - 7)], 'expr' => $this->semStack[$stackPos - (9 - 9)], 'attrGroups' => []], $this->startAttributeStack[$stackPos - (9 - 1)] + $this->endAttributes); - }, 476 => function ($stackPos) { - $this->semValue = new Expr\Closure(['static' => \false, 'byRef' => $this->semStack[$stackPos - (8 - 2)], 'params' => $this->semStack[$stackPos - (8 - 4)], 'uses' => $this->semStack[$stackPos - (8 - 6)], 'returnType' => $this->semStack[$stackPos - (8 - 7)], 'stmts' => $this->semStack[$stackPos - (8 - 8)], 'attrGroups' => []], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes); - }, 477 => function ($stackPos) { - $this->semValue = new Expr\Closure(['static' => \true, 'byRef' => $this->semStack[$stackPos - (9 - 3)], 'params' => $this->semStack[$stackPos - (9 - 5)], 'uses' => $this->semStack[$stackPos - (9 - 7)], 'returnType' => $this->semStack[$stackPos - (9 - 8)], 'stmts' => $this->semStack[$stackPos - (9 - 9)], 'attrGroups' => []], $this->startAttributeStack[$stackPos - (9 - 1)] + $this->endAttributes); - }, 478 => function ($stackPos) { - $this->semValue = new Expr\ArrowFunction(['static' => \false, 'byRef' => $this->semStack[$stackPos - (9 - 3)], 'params' => $this->semStack[$stackPos - (9 - 5)], 'returnType' => $this->semStack[$stackPos - (9 - 7)], 'expr' => $this->semStack[$stackPos - (9 - 9)], 'attrGroups' => $this->semStack[$stackPos - (9 - 1)]], $this->startAttributeStack[$stackPos - (9 - 1)] + $this->endAttributes); - }, 479 => function ($stackPos) { - $this->semValue = new Expr\ArrowFunction(['static' => \true, 'byRef' => $this->semStack[$stackPos - (10 - 4)], 'params' => $this->semStack[$stackPos - (10 - 6)], 'returnType' => $this->semStack[$stackPos - (10 - 8)], 'expr' => $this->semStack[$stackPos - (10 - 10)], 'attrGroups' => $this->semStack[$stackPos - (10 - 1)]], $this->startAttributeStack[$stackPos - (10 - 1)] + $this->endAttributes); - }, 480 => function ($stackPos) { - $this->semValue = new Expr\Closure(['static' => \false, 'byRef' => $this->semStack[$stackPos - (9 - 3)], 'params' => $this->semStack[$stackPos - (9 - 5)], 'uses' => $this->semStack[$stackPos - (9 - 7)], 'returnType' => $this->semStack[$stackPos - (9 - 8)], 'stmts' => $this->semStack[$stackPos - (9 - 9)], 'attrGroups' => $this->semStack[$stackPos - (9 - 1)]], $this->startAttributeStack[$stackPos - (9 - 1)] + $this->endAttributes); - }, 481 => function ($stackPos) { - $this->semValue = new Expr\Closure(['static' => \true, 'byRef' => $this->semStack[$stackPos - (10 - 4)], 'params' => $this->semStack[$stackPos - (10 - 6)], 'uses' => $this->semStack[$stackPos - (10 - 8)], 'returnType' => $this->semStack[$stackPos - (10 - 9)], 'stmts' => $this->semStack[$stackPos - (10 - 10)], 'attrGroups' => $this->semStack[$stackPos - (10 - 1)]], $this->startAttributeStack[$stackPos - (10 - 1)] + $this->endAttributes); - }, 482 => function ($stackPos) { - $this->semValue = array(new Stmt\Class_(null, ['type' => $this->semStack[$stackPos - (8 - 2)], 'extends' => $this->semStack[$stackPos - (8 - 4)], 'implements' => $this->semStack[$stackPos - (8 - 5)], 'stmts' => $this->semStack[$stackPos - (8 - 7)], 'attrGroups' => $this->semStack[$stackPos - (8 - 1)]], $this->startAttributeStack[$stackPos - (8 - 1)] + $this->endAttributes), $this->semStack[$stackPos - (8 - 3)]); - $this->checkClass($this->semValue[0], -1); - }, 483 => function ($stackPos) { - $this->semValue = new Expr\New_($this->semStack[$stackPos - (3 - 2)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 484 => function ($stackPos) { - list($class, $ctorArgs) = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 485 => function ($stackPos) { - $this->semValue = array(); - }, 486 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (4 - 3)]; - }, 487 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 488 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 489 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 490 => function ($stackPos) { - $this->semValue = new Expr\ClosureUse($this->semStack[$stackPos - (2 - 2)], $this->semStack[$stackPos - (2 - 1)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 491 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 492 => function ($stackPos) { - $this->semValue = new Expr\FuncCall($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 493 => function ($stackPos) { - $this->semValue = new Expr\FuncCall($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 494 => function ($stackPos) { - $this->semValue = new Expr\FuncCall($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 495 => function ($stackPos) { - $this->semValue = new Expr\StaticCall($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 496 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 497 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 498 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 499 => function ($stackPos) { - $this->semValue = new Name($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 500 => function ($stackPos) { - $this->semValue = new Name\FullyQualified(\substr($this->semStack[$stackPos - (1 - 1)], 1), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 501 => function ($stackPos) { - $this->semValue = new Name\Relative(\substr($this->semStack[$stackPos - (1 - 1)], 10), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 502 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 503 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 504 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 505 => function ($stackPos) { - $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - $this->errorState = 2; - }, 506 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 507 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 508 => function ($stackPos) { - $this->semValue = null; - }, 509 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 510 => function ($stackPos) { - $this->semValue = array(); - }, 511 => function ($stackPos) { - $this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$stackPos - (1 - 1)], '`'), $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes)); - }, 512 => function ($stackPos) { - foreach ($this->semStack[$stackPos - (1 - 1)] as $s) { - if ($s instanceof Node\Scalar\EncapsedStringPart) { - $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', \true); + }, 354 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 355 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 356 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 357 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 358 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Precedence($self->semStack[$stackPos - (4 - 1)][0], $self->semStack[$stackPos - (4 - 1)][1], $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 359 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos - (5 - 1)][0], $self->semStack[$stackPos - (5 - 1)][1], $self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 360 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos - (4 - 1)][0], $self->semStack[$stackPos - (4 - 1)][1], $self->semStack[$stackPos - (4 - 3)], null, $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 361 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos - (4 - 1)][0], $self->semStack[$stackPos - (4 - 1)][1], null, $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 362 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos - (4 - 1)][0], $self->semStack[$stackPos - (4 - 1)][1], null, $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 363 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)]); + }, 364 => null, 365 => static function ($self, $stackPos) { + $self->semValue = array(null, $self->semStack[$stackPos - (1 - 1)]); + }, 366 => static function ($self, $stackPos) { + $self->semValue = null; + }, 367 => null, 368 => null, 369 => static function ($self, $stackPos) { + $self->semValue = 0; + }, 370 => static function ($self, $stackPos) { + $self->semValue = 0; + }, 371 => null, 372 => null, 373 => static function ($self, $stackPos) { + $self->checkModifier($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $stackPos - (2 - 2)); + $self->semValue = $self->semStack[$stackPos - (2 - 1)] | $self->semStack[$stackPos - (2 - 2)]; + }, 374 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PUBLIC; + }, 375 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PROTECTED; + }, 376 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PRIVATE; + }, 377 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PUBLIC_SET; + }, 378 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PROTECTED_SET; + }, 379 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PRIVATE_SET; + }, 380 => static function ($self, $stackPos) { + $self->semValue = Modifiers::STATIC; + }, 381 => static function ($self, $stackPos) { + $self->semValue = Modifiers::ABSTRACT; + }, 382 => static function ($self, $stackPos) { + $self->semValue = Modifiers::FINAL; + }, 383 => static function ($self, $stackPos) { + $self->semValue = Modifiers::READONLY; + }, 384 => null, 385 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 386 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 387 => static function ($self, $stackPos) { + $self->semValue = new Node\VarLikeIdentifier(\substr($self->semStack[$stackPos - (1 - 1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 388 => static function ($self, $stackPos) { + $self->semValue = new Node\PropertyItem($self->semStack[$stackPos - (1 - 1)], null, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 389 => static function ($self, $stackPos) { + $self->semValue = new Node\PropertyItem($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 390 => static function ($self, $stackPos) { + $self->semValue = []; + }, 391 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 392 => static function ($self, $stackPos) { + $self->semValue = []; + }, 393 => static function ($self, $stackPos) { + $self->semValue = new Node\PropertyHook($self->semStack[$stackPos - (5 - 4)], $self->semStack[$stackPos - (5 - 5)], ['flags' => $self->semStack[$stackPos - (5 - 2)], 'byRef' => $self->semStack[$stackPos - (5 - 3)], 'params' => [], 'attrGroups' => $self->semStack[$stackPos - (5 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkPropertyHook($self->semValue, null); + }, 394 => static function ($self, $stackPos) { + $self->semValue = new Node\PropertyHook($self->semStack[$stackPos - (8 - 4)], $self->semStack[$stackPos - (8 - 8)], ['flags' => $self->semStack[$stackPos - (8 - 2)], 'byRef' => $self->semStack[$stackPos - (8 - 3)], 'params' => $self->semStack[$stackPos - (8 - 6)], 'attrGroups' => $self->semStack[$stackPos - (8 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkPropertyHook($self->semValue, $stackPos - (8 - 5)); + }, 395 => static function ($self, $stackPos) { + $self->semValue = null; + }, 396 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 397 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 398 => static function ($self, $stackPos) { + $self->semValue = 0; + }, 399 => static function ($self, $stackPos) { + $self->checkPropertyHookModifiers($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $stackPos - (2 - 2)); + $self->semValue = $self->semStack[$stackPos - (2 - 1)] | $self->semStack[$stackPos - (2 - 2)]; + }, 400 => null, 401 => null, 402 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 403 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 404 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 405 => null, 406 => null, 407 => static function ($self, $stackPos) { + $self->semValue = new Expr\Assign($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 408 => static function ($self, $stackPos) { + $self->semValue = new Expr\Assign($self->fixupArrayDestructuring($self->semStack[$stackPos - (3 - 1)]), $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 409 => static function ($self, $stackPos) { + $self->semValue = new Expr\Assign($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 410 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignRef($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 411 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignRef($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + if (!$self->phpVersion->allowsAssignNewByReference()) { + $self->emitError(new Error('Cannot assign new by reference', $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos]))); + } + }, 412 => null, 413 => null, 414 => static function ($self, $stackPos) { + $self->semValue = new Expr\Clone_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 415 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Plus($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 416 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Minus($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 417 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Mul($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 418 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Div($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 419 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Concat($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 420 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Mod($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 421 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\BitwiseAnd($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 422 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\BitwiseOr($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 423 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\BitwiseXor($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 424 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\ShiftLeft($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 425 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\ShiftRight($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 426 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Pow($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 427 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Coalesce($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 428 => static function ($self, $stackPos) { + $self->semValue = new Expr\PostInc($self->semStack[$stackPos - (2 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 429 => static function ($self, $stackPos) { + $self->semValue = new Expr\PreInc($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 430 => static function ($self, $stackPos) { + $self->semValue = new Expr\PostDec($self->semStack[$stackPos - (2 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 431 => static function ($self, $stackPos) { + $self->semValue = new Expr\PreDec($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 432 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BooleanOr($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 433 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BooleanAnd($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 434 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\LogicalOr($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 435 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\LogicalAnd($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 436 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\LogicalXor($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 437 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseOr($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 438 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseAnd($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 439 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseAnd($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 440 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseXor($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 441 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Concat($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 442 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Plus($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 443 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Minus($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 444 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Mul($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 445 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Div($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 446 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Mod($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 447 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\ShiftLeft($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 448 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\ShiftRight($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 449 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Pow($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 450 => static function ($self, $stackPos) { + $self->semValue = new Expr\UnaryPlus($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 451 => static function ($self, $stackPos) { + $self->semValue = new Expr\UnaryMinus($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 452 => static function ($self, $stackPos) { + $self->semValue = new Expr\BooleanNot($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 453 => static function ($self, $stackPos) { + $self->semValue = new Expr\BitwiseNot($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 454 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Identical($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 455 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\NotIdentical($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 456 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Equal($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 457 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\NotEqual($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 458 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Spaceship($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 459 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Smaller($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 460 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\SmallerOrEqual($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 461 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Greater($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 462 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\GreaterOrEqual($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 463 => static function ($self, $stackPos) { + $self->semValue = new Expr\Instanceof_($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 464 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 465 => static function ($self, $stackPos) { + $self->semValue = new Expr\Ternary($self->semStack[$stackPos - (5 - 1)], $self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 466 => static function ($self, $stackPos) { + $self->semValue = new Expr\Ternary($self->semStack[$stackPos - (4 - 1)], null, $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 467 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Coalesce($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 468 => static function ($self, $stackPos) { + $self->semValue = new Expr\Isset_($self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 469 => static function ($self, $stackPos) { + $self->semValue = new Expr\Empty_($self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 470 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_INCLUDE, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 471 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_INCLUDE_ONCE, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 472 => static function ($self, $stackPos) { + $self->semValue = new Expr\Eval_($self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 473 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_REQUIRE, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 474 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_REQUIRE_ONCE, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 475 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Int_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 476 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos]); + $attrs['kind'] = $self->getFloatCastKind($self->semStack[$stackPos - (2 - 1)]); + $self->semValue = new Expr\Cast\Double($self->semStack[$stackPos - (2 - 2)], $attrs); + }, 477 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\String_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 478 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Array_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 479 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Object_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 480 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Bool_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 481 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Unset_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 482 => static function ($self, $stackPos) { + $self->semValue = $self->createExitExpr($self->semStack[$stackPos - (2 - 1)], $stackPos - (2 - 1), $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 483 => static function ($self, $stackPos) { + $self->semValue = new Expr\ErrorSuppress($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 484 => null, 485 => static function ($self, $stackPos) { + $self->semValue = new Expr\ShellExec($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 486 => static function ($self, $stackPos) { + $self->semValue = new Expr\Print_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 487 => static function ($self, $stackPos) { + $self->semValue = new Expr\Yield_(null, null, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 488 => static function ($self, $stackPos) { + $self->semValue = new Expr\Yield_($self->semStack[$stackPos - (2 - 2)], null, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 489 => static function ($self, $stackPos) { + $self->semValue = new Expr\Yield_($self->semStack[$stackPos - (4 - 4)], $self->semStack[$stackPos - (4 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 490 => static function ($self, $stackPos) { + $self->semValue = new Expr\YieldFrom($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 491 => static function ($self, $stackPos) { + $self->semValue = new Expr\Throw_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 492 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => \false, 'byRef' => $self->semStack[$stackPos - (8 - 2)], 'params' => $self->semStack[$stackPos - (8 - 4)], 'returnType' => $self->semStack[$stackPos - (8 - 6)], 'expr' => $self->semStack[$stackPos - (8 - 8)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + }, 493 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => \true, 'byRef' => $self->semStack[$stackPos - (9 - 3)], 'params' => $self->semStack[$stackPos - (9 - 5)], 'returnType' => $self->semStack[$stackPos - (9 - 7)], 'expr' => $self->semStack[$stackPos - (9 - 9)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 494 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => \false, 'byRef' => $self->semStack[$stackPos - (8 - 2)], 'params' => $self->semStack[$stackPos - (8 - 4)], 'uses' => $self->semStack[$stackPos - (8 - 6)], 'returnType' => $self->semStack[$stackPos - (8 - 7)], 'stmts' => $self->semStack[$stackPos - (8 - 8)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + }, 495 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => \true, 'byRef' => $self->semStack[$stackPos - (9 - 3)], 'params' => $self->semStack[$stackPos - (9 - 5)], 'uses' => $self->semStack[$stackPos - (9 - 7)], 'returnType' => $self->semStack[$stackPos - (9 - 8)], 'stmts' => $self->semStack[$stackPos - (9 - 9)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 496 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => \false, 'byRef' => $self->semStack[$stackPos - (9 - 3)], 'params' => $self->semStack[$stackPos - (9 - 5)], 'returnType' => $self->semStack[$stackPos - (9 - 7)], 'expr' => $self->semStack[$stackPos - (9 - 9)], 'attrGroups' => $self->semStack[$stackPos - (9 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 497 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => \true, 'byRef' => $self->semStack[$stackPos - (10 - 4)], 'params' => $self->semStack[$stackPos - (10 - 6)], 'returnType' => $self->semStack[$stackPos - (10 - 8)], 'expr' => $self->semStack[$stackPos - (10 - 10)], 'attrGroups' => $self->semStack[$stackPos - (10 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (10 - 1)], $self->tokenEndStack[$stackPos])); + }, 498 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => \false, 'byRef' => $self->semStack[$stackPos - (9 - 3)], 'params' => $self->semStack[$stackPos - (9 - 5)], 'uses' => $self->semStack[$stackPos - (9 - 7)], 'returnType' => $self->semStack[$stackPos - (9 - 8)], 'stmts' => $self->semStack[$stackPos - (9 - 9)], 'attrGroups' => $self->semStack[$stackPos - (9 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 499 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => \true, 'byRef' => $self->semStack[$stackPos - (10 - 4)], 'params' => $self->semStack[$stackPos - (10 - 6)], 'uses' => $self->semStack[$stackPos - (10 - 8)], 'returnType' => $self->semStack[$stackPos - (10 - 9)], 'stmts' => $self->semStack[$stackPos - (10 - 10)], 'attrGroups' => $self->semStack[$stackPos - (10 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (10 - 1)], $self->tokenEndStack[$stackPos])); + }, 500 => static function ($self, $stackPos) { + $self->semValue = array(new Stmt\Class_(null, ['type' => $self->semStack[$stackPos - (8 - 2)], 'extends' => $self->semStack[$stackPos - (8 - 4)], 'implements' => $self->semStack[$stackPos - (8 - 5)], 'stmts' => $self->semStack[$stackPos - (8 - 7)], 'attrGroups' => $self->semStack[$stackPos - (8 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])), $self->semStack[$stackPos - (8 - 3)]); + $self->checkClass($self->semValue[0], -1); + }, 501 => static function ($self, $stackPos) { + $self->semValue = new Expr\New_($self->semStack[$stackPos - (3 - 2)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 502 => static function ($self, $stackPos) { + list($class, $ctorArgs) = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = new Expr\New_($class, $ctorArgs, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 503 => static function ($self, $stackPos) { + $self->semValue = new Expr\New_($self->semStack[$stackPos - (2 - 2)], [], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 504 => null, 505 => null, 506 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 507 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 3)]; + }, 508 => null, 509 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 510 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 511 => static function ($self, $stackPos) { + $self->semValue = new Node\ClosureUse($self->semStack[$stackPos - (2 - 2)], $self->semStack[$stackPos - (2 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 512 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 513 => static function ($self, $stackPos) { + $self->semValue = new Expr\FuncCall($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 514 => static function ($self, $stackPos) { + $self->semValue = new Expr\FuncCall($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 515 => static function ($self, $stackPos) { + $self->semValue = new Expr\FuncCall($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 516 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticCall($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 517 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 518 => null, 519 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 520 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 521 => static function ($self, $stackPos) { + $self->semValue = new Name\FullyQualified(\substr($self->semStack[$stackPos - (1 - 1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 522 => static function ($self, $stackPos) { + $self->semValue = new Name\Relative(\substr($self->semStack[$stackPos - (1 - 1)], 10), $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 523 => null, 524 => null, 525 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 526 => static function ($self, $stackPos) { + $self->semValue = new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + $self->errorState = 2; + }, 527 => null, 528 => null, 529 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 530 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + foreach ($self->semValue as $s) { + if ($s instanceof Node\InterpolatedStringPart) { + $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', $self->phpVersion->supportsUnicodeEscapes()); } } - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 513 => function ($stackPos) { - $this->semValue = array(); - }, 514 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 515 => function ($stackPos) { - $this->semValue = new Expr\ConstFetch($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 516 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 517 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 518 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 519 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 520 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 521 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 522 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 523 => function ($stackPos) { - $this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 524 => function ($stackPos) { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 525 => function ($stackPos) { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos - (5 - 1)], $this->semStack[$stackPos - (5 - 4)], $this->startAttributeStack[$stackPos - (5 - 1)] + $this->endAttributes); - }, 526 => function ($stackPos) { - $this->semValue = new Expr\ClassConstFetch($this->semStack[$stackPos - (3 - 1)], new Expr\Error($this->startAttributeStack[$stackPos - (3 - 3)] + $this->endAttributeStack[$stackPos - (3 - 3)]), $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - $this->errorState = 2; - }, 527 => function ($stackPos) { - $attrs = $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes; + }, 531 => static function ($self, $stackPos) { + foreach ($self->semStack[$stackPos - (1 - 1)] as $s) { + if ($s instanceof Node\InterpolatedStringPart) { + $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', $self->phpVersion->supportsUnicodeEscapes()); + } + } + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + }, 532 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 533 => null, 534 => static function ($self, $stackPos) { + $self->semValue = new Expr\ConstFetch($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 535 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Line($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 536 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\File($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 537 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Dir($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 538 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Class_($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 539 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Trait_($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 540 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Method($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 541 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Function_($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 542 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Namespace_($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 543 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Property($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 544 => static function ($self, $stackPos) { + $self->semValue = new Expr\ClassConstFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 545 => static function ($self, $stackPos) { + $self->semValue = new Expr\ClassConstFetch($self->semStack[$stackPos - (5 - 1)], $self->semStack[$stackPos - (5 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 546 => static function ($self, $stackPos) { + $self->semValue = new Expr\ClassConstFetch($self->semStack[$stackPos - (3 - 1)], new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos - (3 - 3)], $self->tokenEndStack[$stackPos - (3 - 3)])), $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + $self->errorState = 2; + }, 547 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos]); $attrs['kind'] = Expr\Array_::KIND_SHORT; - $this->semValue = new Expr\Array_($this->semStack[$stackPos - (3 - 2)], $attrs); - }, 528 => function ($stackPos) { - $attrs = $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes; + $self->semValue = new Expr\Array_($self->semStack[$stackPos - (3 - 2)], $attrs); + }, 548 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos]); $attrs['kind'] = Expr\Array_::KIND_LONG; - $this->semValue = new Expr\Array_($this->semStack[$stackPos - (4 - 3)], $attrs); - }, 529 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 530 => function ($stackPos) { - $this->semValue = Scalar\String_::fromString($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 531 => function ($stackPos) { - $attrs = $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes; + $self->semValue = new Expr\Array_($self->semStack[$stackPos - (4 - 3)], $attrs); + $self->createdArrays->attach($self->semValue); + }, 549 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + $self->createdArrays->attach($self->semValue); + }, 550 => static function ($self, $stackPos) { + $self->semValue = Scalar\String_::fromString($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos]), $self->phpVersion->supportsUnicodeEscapes()); + }, 551 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos]); $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; - foreach ($this->semStack[$stackPos - (3 - 2)] as $s) { - if ($s instanceof Node\Scalar\EncapsedStringPart) { - $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', \true); + foreach ($self->semStack[$stackPos - (3 - 2)] as $s) { + if ($s instanceof Node\InterpolatedStringPart) { + $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', $self->phpVersion->supportsUnicodeEscapes()); } } - $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos - (3 - 2)], $attrs); - }, 532 => function ($stackPos) { - $this->semValue = $this->parseLNumber($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 533 => function ($stackPos) { - $this->semValue = Scalar\DNumber::fromString($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 534 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 535 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 536 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 537 => function ($stackPos) { - $this->semValue = $this->parseDocString($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 2)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes, $this->startAttributeStack[$stackPos - (3 - 3)] + $this->endAttributeStack[$stackPos - (3 - 3)], \true); - }, 538 => function ($stackPos) { - $this->semValue = $this->parseDocString($this->semStack[$stackPos - (2 - 1)], '', $this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes, $this->startAttributeStack[$stackPos - (2 - 2)] + $this->endAttributeStack[$stackPos - (2 - 2)], \true); - }, 539 => function ($stackPos) { - $this->semValue = $this->parseDocString($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 2)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes, $this->startAttributeStack[$stackPos - (3 - 3)] + $this->endAttributeStack[$stackPos - (3 - 3)], \true); - }, 540 => function ($stackPos) { - $this->semValue = null; - }, 541 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 542 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 543 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 544 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 545 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 546 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 547 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 548 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 549 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 550 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 551 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 552 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 553 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 554 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 555 => function ($stackPos) { - $this->semValue = new Expr\MethodCall($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 556 => function ($stackPos) { - $this->semValue = new Expr\NullsafeMethodCall($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->semStack[$stackPos - (4 - 4)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 557 => function ($stackPos) { - $this->semValue = null; - }, 558 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 559 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 560 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 561 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 562 => function ($stackPos) { - $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 563 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 564 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 565 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 566 => function ($stackPos) { - $this->semValue = new Expr\Variable(new Expr\Error($this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes), $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - $this->errorState = 2; - }, 567 => function ($stackPos) { - $var = $this->semStack[$stackPos - (1 - 1)]->name; - $this->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes) : $var; - }, 568 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 569 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 570 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 571 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 572 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 573 => function ($stackPos) { - $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 574 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 575 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 576 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 577 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 578 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 579 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 580 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 581 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 582 => function ($stackPos) { - $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - $this->errorState = 2; - }, 583 => function ($stackPos) { - $this->semValue = new Expr\List_($this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 584 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - $end = \count($this->semValue) - 1; - if ($this->semValue[$end] === null) { - \array_pop($this->semValue); + $self->semValue = new Scalar\InterpolatedString($self->semStack[$stackPos - (3 - 2)], $attrs); + }, 552 => static function ($self, $stackPos) { + $self->semValue = $self->parseLNumber($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos]), $self->phpVersion->allowsInvalidOctals()); + }, 553 => static function ($self, $stackPos) { + $self->semValue = Scalar\Float_::fromString($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 554 => null, 555 => null, 556 => null, 557 => static function ($self, $stackPos) { + $self->semValue = $self->parseDocString($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 2)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos]), $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 3)], $self->tokenEndStack[$stackPos - (3 - 3)]), \true); + }, 558 => static function ($self, $stackPos) { + $self->semValue = $self->parseDocString($self->semStack[$stackPos - (2 - 1)], '', $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos]), $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 2)], $self->tokenEndStack[$stackPos - (2 - 2)]), \true); + }, 559 => static function ($self, $stackPos) { + $self->semValue = $self->parseDocString($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 2)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos]), $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 3)], $self->tokenEndStack[$stackPos - (3 - 3)]), \true); + }, 560 => static function ($self, $stackPos) { + $self->semValue = null; + }, 561 => null, 562 => null, 563 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 564 => null, 565 => null, 566 => null, 567 => null, 568 => null, 569 => null, 570 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 571 => null, 572 => null, 573 => null, 574 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 575 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 576 => null, 577 => static function ($self, $stackPos) { + $self->semValue = new Expr\MethodCall($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 578 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafeMethodCall($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 579 => static function ($self, $stackPos) { + $self->semValue = null; + }, 580 => null, 581 => null, 582 => null, 583 => static function ($self, $stackPos) { + $self->semValue = new Expr\PropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 584 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafePropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 585 => null, 586 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 587 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 588 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable(new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])), $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + $self->errorState = 2; + }, 589 => static function ($self, $stackPos) { + $var = $self->semStack[$stackPos - (1 - 1)]->name; + $self->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])) : $var; + }, 590 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticPropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 591 => null, 592 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 593 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 594 => static function ($self, $stackPos) { + $self->semValue = new Expr\PropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 595 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafePropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 596 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticPropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 597 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticPropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 598 => null, 599 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 600 => null, 601 => null, 602 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 603 => null, 604 => static function ($self, $stackPos) { + $self->semValue = new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + $self->errorState = 2; + }, 605 => static function ($self, $stackPos) { + $self->semValue = new Expr\List_($self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Expr\List_::KIND_LIST); + $self->postprocessList($self->semValue); + }, 606 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + $end = \count($self->semValue) - 1; + if ($self->semValue[$end]->value instanceof Expr\Error) { + \array_pop($self->semValue); } - }, 585 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; - }, 586 => function ($stackPos) { - /* do nothing -- prevent default action of $$=$this->semStack[$1]. See $551. */ - }, 587 => function ($stackPos) { - $this->semStack[$stackPos - (3 - 1)][] = $this->semStack[$stackPos - (3 - 3)]; - $this->semValue = $this->semStack[$stackPos - (3 - 1)]; - }, 588 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 589 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (1 - 1)], null, \false, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 590 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (2 - 2)], null, \true, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 591 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (1 - 1)], null, \false, $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 592 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (3 - 3)], $this->semStack[$stackPos - (3 - 1)], \false, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 593 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (4 - 4)], $this->semStack[$stackPos - (4 - 1)], \true, $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 594 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (3 - 3)], $this->semStack[$stackPos - (3 - 1)], \false, $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 595 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos - (2 - 2)], null, \false, $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes, \true); - }, 596 => function ($stackPos) { - $this->semValue = null; - }, 597 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 598 => function ($stackPos) { - $this->semStack[$stackPos - (2 - 1)][] = $this->semStack[$stackPos - (2 - 2)]; - $this->semValue = $this->semStack[$stackPos - (2 - 1)]; - }, 599 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (1 - 1)]); - }, 600 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos - (2 - 1)], $this->semStack[$stackPos - (2 - 2)]); - }, 601 => function ($stackPos) { - $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 602 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 603 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }, 604 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (4 - 1)], $this->semStack[$stackPos - (4 - 3)], $this->startAttributeStack[$stackPos - (4 - 1)] + $this->endAttributes); - }, 605 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 606 => function ($stackPos) { - $this->semValue = new Expr\NullsafePropertyFetch($this->semStack[$stackPos - (3 - 1)], $this->semStack[$stackPos - (3 - 3)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 607 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 608 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos - (3 - 2)], $this->startAttributeStack[$stackPos - (3 - 1)] + $this->endAttributes); - }, 609 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos - (6 - 2)], $this->semStack[$stackPos - (6 - 4)], $this->startAttributeStack[$stackPos - (6 - 1)] + $this->endAttributes); - }, 610 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (3 - 2)]; - }, 611 => function ($stackPos) { - $this->semValue = new Scalar\String_($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 612 => function ($stackPos) { - $this->semValue = $this->parseNumString($this->semStack[$stackPos - (1 - 1)], $this->startAttributeStack[$stackPos - (1 - 1)] + $this->endAttributes); - }, 613 => function ($stackPos) { - $this->semValue = $this->parseNumString('-' . $this->semStack[$stackPos - (2 - 2)], $this->startAttributeStack[$stackPos - (2 - 1)] + $this->endAttributes); - }, 614 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos - (1 - 1)]; - }]; + }, 607 => null, 608 => static function ($self, $stackPos) { + /* do nothing -- prevent default action of $$=$self->semStack[$1]. See $551. */ + }, 609 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 610 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 611 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (1 - 1)], null, \false, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 612 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (2 - 2)], null, \true, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 613 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (1 - 1)], null, \false, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 614 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (3 - 3)], $self->semStack[$stackPos - (3 - 1)], \false, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 615 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (4 - 4)], $self->semStack[$stackPos - (4 - 1)], \true, $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 616 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (3 - 3)], $self->semStack[$stackPos - (3 - 1)], \false, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 617 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (2 - 2)], null, \false, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos]), \true); + }, 618 => static function ($self, $stackPos) { + /* Create an Error node now to remember the position. We'll later either report an error, + or convert this into a null element, depending on whether this is a creation or destructuring context. */ + $attrs = $self->createEmptyElemAttributes($self->tokenPos); + $self->semValue = new Node\ArrayItem(new Expr\Error($attrs), null, \false, $attrs); + }, 619 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 620 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 621 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 622 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)]); + }, 623 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos]); + $attrs['rawValue'] = $self->semStack[$stackPos - (1 - 1)]; + $self->semValue = new Node\InterpolatedStringPart($self->semStack[$stackPos - (1 - 1)], $attrs); + }, 624 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 625 => null, 626 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 627 => static function ($self, $stackPos) { + $self->semValue = new Expr\PropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 628 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafePropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 629 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 630 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 631 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos - (6 - 2)], $self->semStack[$stackPos - (6 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos])); + }, 632 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 633 => static function ($self, $stackPos) { + $self->semValue = new Scalar\String_($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 634 => static function ($self, $stackPos) { + $self->semValue = $self->parseNumString($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 635 => static function ($self, $stackPos) { + $self->semValue = $self->parseNumString('-' . $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 636 => null]; } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php new file mode 100644 index 00000000000..0fc46f8e1a0 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php @@ -0,0 +1,1281 @@ +'", "T_IS_GREATER_OR_EQUAL", "'.'", "T_SL", "T_SR", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "T_INSTANCEOF", "'~'", "T_INC", "T_DEC", "T_INT_CAST", "T_DOUBLE_CAST", "T_STRING_CAST", "T_ARRAY_CAST", "T_OBJECT_CAST", "T_BOOL_CAST", "T_UNSET_CAST", "'@'", "T_POW", "'['", "T_NEW", "T_CLONE", "T_EXIT", "T_IF", "T_ELSEIF", "T_ELSE", "T_ENDIF", "T_LNUMBER", "T_DNUMBER", "T_STRING", "T_STRING_VARNAME", "T_VARIABLE", "T_NUM_STRING", "T_INLINE_HTML", "T_ENCAPSED_AND_WHITESPACE", "T_CONSTANT_ENCAPSED_STRING", "T_ECHO", "T_DO", "T_WHILE", "T_ENDWHILE", "T_FOR", "T_ENDFOR", "T_FOREACH", "T_ENDFOREACH", "T_DECLARE", "T_ENDDECLARE", "T_AS", "T_SWITCH", "T_MATCH", "T_ENDSWITCH", "T_CASE", "T_DEFAULT", "T_BREAK", "T_CONTINUE", "T_GOTO", "T_FUNCTION", "T_FN", "T_CONST", "T_RETURN", "T_TRY", "T_CATCH", "T_FINALLY", "T_USE", "T_INSTEADOF", "T_GLOBAL", "T_STATIC", "T_ABSTRACT", "T_FINAL", "T_PRIVATE", "T_PROTECTED", "T_PUBLIC", "T_READONLY", "T_PUBLIC_SET", "T_PROTECTED_SET", "T_PRIVATE_SET", "T_VAR", "T_UNSET", "T_ISSET", "T_EMPTY", "T_HALT_COMPILER", "T_CLASS", "T_TRAIT", "T_INTERFACE", "T_ENUM", "T_EXTENDS", "T_IMPLEMENTS", "T_OBJECT_OPERATOR", "T_NULLSAFE_OBJECT_OPERATOR", "T_LIST", "T_ARRAY", "T_CALLABLE", "T_CLASS_C", "T_TRAIT_C", "T_METHOD_C", "T_FUNC_C", "T_PROPERTY_C", "T_LINE", "T_FILE", "T_START_HEREDOC", "T_END_HEREDOC", "T_DOLLAR_OPEN_CURLY_BRACES", "T_CURLY_OPEN", "T_PAAMAYIM_NEKUDOTAYIM", "T_NAMESPACE", "T_NS_C", "T_DIR", "T_NS_SEPARATOR", "T_ELLIPSIS", "T_NAME_FULLY_QUALIFIED", "T_NAME_QUALIFIED", "T_NAME_RELATIVE", "T_ATTRIBUTE", "';'", "']'", "'('", "')'", "'{'", "'}'", "'`'", "'\"'", "'\$'"); + protected array $tokenToSymbol = array(0, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 56, 170, 172, 171, 55, 172, 172, 165, 166, 53, 51, 8, 52, 48, 54, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 31, 163, 44, 16, 46, 30, 68, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 70, 172, 164, 36, 172, 169, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 167, 35, 168, 58, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43, 45, 47, 49, 50, 57, 59, 60, 61, 62, 63, 64, 65, 66, 67, 69, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162); + protected array $action = array(126, 127, 128, 570, 129, 130, 955, 765, 766, 767, 131, 38, 849, -85, -32766, 1376, -32766, -32766, -32766, 0, 840, 1134, 1135, 1136, 1130, 1129, 1128, 1137, 1131, 1132, 1133, -32766, -32766, -32766, 851, 759, 758, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32766, -32767, -32767, -32767, -32767, -32767, 1005, -32766, 1045, -570, 768, 1134, 1135, 1136, 1130, 1129, 1128, 1137, 1131, 1132, 1133, 388, 387, 842, 263, 132, 389, 772, 773, 774, 775, 430, 845, 431, -85, 2, 36, 246, 47, 291, 829, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 805, 571, 806, 807, 808, 809, 797, 798, 344, 345, 800, 801, 786, 787, 788, 790, 791, 792, 359, 832, 833, 834, 835, 836, 572, -570, -570, -332, 793, 794, 573, 574, 236, 817, 815, 816, 828, 812, 813, 26, -194, 575, 576, 811, 577, 578, 579, 580, 323, 581, 582, 876, 844, 877, 297, 298, 814, 583, 584, 722, 133, 846, 126, 127, 128, 570, 129, 130, 1078, 765, 766, 767, 131, 38, -32766, 35, 735, 1038, 1037, 1036, 1042, 1039, 1040, 1041, -32766, -32766, -32766, 1006, 104, 105, 106, 107, 108, -372, 275, -372, -32766, 759, 758, 1054, 850, -32766, -32766, -32766, 848, -32766, 109, -32766, -32766, -32766, -32766, -32766, -32766, -32766, 134, 476, 477, 768, -32766, -32766, -32766, 1054, -32766, 290, -32766, -32766, -32766, -32766, -32766, 616, 143, 263, 132, 389, 772, 773, 774, 775, 249, -32766, 431, -32766, -32766, -32766, -32766, 290, 307, 829, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 805, 571, 806, 807, 808, 809, 797, 798, 344, 345, 800, 801, 786, 787, 788, 790, 791, 792, 359, 832, 833, 834, 835, 836, 572, 958, -273, -332, 793, 794, 573, 574, 840, 817, 815, 816, 828, 812, 813, 1301, -194, 575, 576, 811, 577, 578, 579, 580, 566, 581, 582, 1108, 82, 83, 84, 748, 814, 583, 584, 309, 146, 789, 760, 761, 762, 763, 764, 235, 765, 766, 767, 802, 803, 37, 957, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 157, 275, -32766, -32766, -32766, -32767, -32767, -32767, -32767, 101, 102, 103, -32766, 109, 1313, 622, 318, 768, -32766, -32766, -32766, 849, 1361, -32766, 1107, -32766, -32766, -32766, 340, 1360, 1357, 769, 770, 771, 772, 773, 774, 775, 341, -32766, 838, -32766, -32766, 1386, 374, 1281, 1387, 829, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 805, 827, 806, 807, 808, 809, 797, 798, 799, 826, 800, 801, 786, 787, 788, 790, 791, 792, 831, 832, 833, 834, 835, 836, 837, 1077, 431, -567, 793, 794, 795, 796, 148, 817, 815, 816, 828, 812, 813, 380, -193, 804, 810, 811, 818, 819, 821, 820, 138, 822, 823, 840, 321, 396, 285, 24, 814, 825, 824, 49, 50, 51, 522, 52, 53, 398, -110, 7, 849, 54, 55, -110, 56, -110, -32766, -32766, -32766, 1342, 303, 125, 1123, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, 161, 750, -567, -567, 291, 974, 975, -32766, -32766, -32766, 976, 448, 285, 1276, 1275, 1277, 57, 58, -567, -32766, -32766, 59, 1109, 60, 243, 244, 61, 62, 63, 64, 65, 66, 67, 68, -32766, 28, 265, 69, 446, 523, 490, -346, 449, 1307, 1308, 524, 139, 849, 1051, 450, 321, 1305, 42, 20, 525, 934, 526, 934, 527, 74, 528, -568, 698, 529, 530, 321, 386, 387, 44, 45, 452, 383, 382, 1054, 46, 531, 430, 974, 975, 451, 372, 339, 976, 1281, 855, 725, 934, 1267, 759, 758, -32766, 970, 533, 534, 535, 149, 934, 281, 699, -78, -566, 1274, 102, 103, 537, 538, -193, 1293, 1294, 1295, 1296, 1298, 1290, 1291, 295, 1054, 726, 466, 467, 468, 1297, 1292, 700, 701, 1276, 1275, 1277, 296, -568, -568, 70, -153, -153, -153, 316, 317, 321, 1272, 924, 290, 924, 1276, 1275, 1277, -568, 1051, -153, 281, -153, 1150, -153, 81, -153, 740, 151, 321, -574, 152, 759, 758, -32766, 1053, 381, 876, 849, 877, 153, -566, -566, 924, 1054, 1051, 155, 974, 975, -606, 491, -606, 532, 924, 1276, 1275, 1277, -566, 33, 1054, 910, 970, -110, -110, -110, 28, 266, -58, 281, -573, 1054, -32766, -32766, -110, -110, 665, 21, 849, -110, -57, -564, 1305, 684, 685, 147, 413, 123, -110, 384, 385, 124, 936, 135, 936, 136, 720, -32766, 720, -153, 142, 48, 32, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 390, 391, 1267, 296, 759, 758, 74, 936, 156, 934, 158, 720, 321, -4, 934, 159, 934, 936, 160, 537, 538, 720, 1293, 1294, 1295, 1296, 1298, 1290, 1291, 1183, 1185, 934, -564, -564, -565, 1297, 1292, 759, 758, 727, -564, -32766, 656, 657, -306, 72, 730, 1274, -564, -87, 317, 321, 299, 300, -32766, -32766, -32766, -84, -32766, -78, -32766, 737, -32766, -73, -72, -32766, -71, -70, 379, -69, -32766, -32766, -32766, -68, -32766, -67, -32766, -32766, -66, -65, 1274, -46, -32766, 427, 28, 265, -18, -32766, -32766, -32766, 140, -32766, 924, -32766, -32766, -32766, 849, 924, -32766, 924, 1305, -565, -565, -32766, -32766, -32766, 274, -564, -564, -32766, -32766, 282, 736, 739, 924, -32766, 427, -565, 933, 381, 145, 443, 286, -564, 951, 73, 294, -32766, -302, -572, 974, 975, 279, 280, 283, 532, 1267, 28, 266, 284, 329, 275, 109, 536, 970, -110, -110, -110, 287, 849, 292, 293, 840, 1305, 538, 694, 1293, 1294, 1295, 1296, 1298, 1290, 1291, 709, 144, 587, 711, 11, 10, 1297, 1292, 991, 849, 1141, 473, 720, 936, -32766, 936, 72, 720, -4, 720, 1388, 317, 321, -50, 970, 672, 1267, 687, 666, 501, 936, 971, 301, 308, 720, 671, 1312, 302, 1314, -32766, 688, 953, -530, -520, 538, 40, 1293, 1294, 1295, 1296, 1298, 1290, 1291, 848, 41, 8, 137, 654, 27, 1297, 1292, 304, 34, 593, 620, 296, -32766, 0, 0, 72, 0, 0, 1274, 0, 317, 321, 0, 0, 0, -32766, -32766, -32766, -276, -32766, 0, -32766, 0, -32766, 0, 0, -32766, 0, 0, 0, 0, -32766, -32766, -32766, 934, -32766, 0, -32766, -32766, 0, 0, 1274, 378, -32766, 427, 745, -600, 412, -32766, -32766, -32766, 746, -32766, 868, -32766, -32766, -32766, 934, 915, -32766, 1015, 992, 999, 989, -32766, -32766, -32766, 1000, -32766, 913, -32766, -32766, 987, 1112, 1274, 1115, -32766, 427, 1116, 1113, 1152, -32766, -32766, -32766, 1114, -32766, 1120, -32766, -32766, -32766, 1302, 860, -32766, 1329, 1346, 1379, 496, -32766, -32766, -32766, 659, -32766, -599, -32766, -32766, -598, -574, 1274, 600, -32766, 427, -573, -572, -571, -32766, -32766, -32766, 924, -32766, -514, -32766, -32766, -32766, 1, 29, -32766, -274, 30, 39, 43, -32766, -32766, -32766, -251, -251, -251, -32766, -32766, 71, 381, 924, 75, -32766, 427, 76, 77, 78, 1281, 79, 80, 974, 975, 141, 150, -32766, 532, -250, -250, -250, -273, 154, 241, 381, 910, 970, -110, -110, -110, 325, 360, 361, 362, 363, 974, 975, 364, 365, -16, 532, 366, 367, 368, 369, 370, 373, 444, 910, 970, -110, -110, -110, -32766, 13, 565, 371, 1306, 936, 1274, 14, 416, 720, -251, 15, 16, -32766, -32766, -32766, 18, -32766, 354, -32766, 411, -32766, 492, 493, -32766, 500, 503, 504, 936, -32766, -32766, -32766, 720, -250, 505, -32766, -32766, 849, 506, 510, 511, -32766, 427, 512, 519, 598, 704, 1080, 1223, 1303, 1079, 1060, 1262, -32766, 1056, -278, -102, 12, 17, 22, 312, 410, 612, 617, 645, 710, 1227, 1280, 1224, 1358, 0, 315, -110, -110, 375, 721, 724, -110, 728, 729, 731, 732, 733, 734, 738, 750, -110, 723, 751, 0, 742, 911, 1383, 1385, 0, -32766, 871, 870, 964, 1007, 1384, 963, 961, 962, 965, 1255, 944, 954, 942, 1151, 1147, 1101, 997, 998, 643, 1382, 1340, 296, 1355, 0, 74, 1240, 321, 0, 0, 0, 321); + protected array $actionCheck = array(2, 3, 4, 5, 6, 7, 1, 9, 10, 11, 12, 13, 82, 31, 116, 85, 9, 10, 11, 0, 80, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 9, 10, 11, 1, 37, 38, 30, 140, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 31, 30, 1, 70, 57, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 106, 107, 80, 71, 72, 73, 74, 75, 76, 77, 116, 80, 80, 97, 8, 151, 152, 70, 30, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 137, 138, 8, 126, 127, 128, 129, 14, 131, 132, 133, 134, 135, 136, 8, 8, 139, 140, 141, 142, 143, 144, 145, 70, 147, 148, 106, 160, 108, 137, 138, 154, 155, 156, 167, 158, 160, 2, 3, 4, 5, 6, 7, 166, 9, 10, 11, 12, 13, 116, 8, 167, 119, 120, 121, 122, 123, 124, 125, 9, 10, 11, 163, 51, 52, 53, 54, 55, 106, 57, 108, 116, 37, 38, 141, 163, 9, 10, 11, 159, 30, 69, 32, 33, 34, 35, 36, 37, 38, 8, 137, 138, 57, 9, 10, 11, 141, 30, 165, 32, 33, 34, 35, 36, 1, 8, 71, 72, 73, 74, 75, 76, 77, 8, 30, 80, 32, 33, 34, 35, 165, 8, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 73, 166, 166, 126, 127, 128, 129, 80, 131, 132, 133, 134, 135, 136, 1, 166, 139, 140, 141, 142, 143, 144, 145, 85, 147, 148, 163, 9, 10, 11, 167, 154, 155, 156, 8, 158, 2, 3, 4, 5, 6, 7, 97, 9, 10, 11, 12, 13, 30, 122, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 16, 57, 9, 10, 11, 44, 45, 46, 47, 48, 49, 50, 9, 69, 150, 52, 8, 57, 9, 10, 11, 82, 1, 30, 1, 32, 33, 34, 8, 8, 1, 71, 72, 73, 74, 75, 76, 77, 8, 30, 80, 32, 33, 80, 8, 1, 83, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 1, 80, 70, 126, 127, 128, 129, 14, 131, 132, 133, 134, 135, 136, 8, 8, 139, 140, 141, 142, 143, 144, 145, 167, 147, 148, 80, 171, 8, 30, 101, 154, 155, 156, 2, 3, 4, 5, 6, 7, 106, 101, 108, 82, 12, 13, 106, 15, 108, 9, 10, 11, 1, 113, 14, 126, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 14, 167, 137, 138, 30, 117, 118, 9, 10, 11, 122, 8, 30, 159, 160, 161, 51, 52, 153, 9, 10, 56, 168, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 140, 70, 71, 72, 73, 74, 31, 168, 8, 78, 79, 80, 167, 82, 116, 8, 171, 86, 87, 88, 89, 1, 91, 1, 93, 165, 95, 70, 80, 98, 99, 171, 106, 107, 103, 104, 105, 106, 107, 141, 109, 110, 116, 117, 118, 8, 115, 116, 122, 1, 8, 31, 1, 122, 37, 38, 116, 131, 127, 128, 129, 14, 1, 165, 116, 16, 70, 80, 49, 50, 139, 140, 166, 142, 143, 144, 145, 146, 147, 148, 149, 141, 31, 132, 133, 134, 155, 156, 140, 141, 159, 160, 161, 162, 137, 138, 165, 75, 76, 77, 169, 170, 171, 116, 84, 165, 84, 159, 160, 161, 153, 116, 90, 165, 92, 163, 94, 167, 96, 167, 14, 171, 165, 14, 37, 38, 116, 140, 106, 106, 82, 108, 14, 137, 138, 84, 141, 116, 14, 117, 118, 164, 167, 166, 122, 84, 159, 160, 161, 153, 14, 141, 130, 131, 132, 133, 134, 70, 71, 16, 165, 165, 141, 51, 52, 117, 118, 75, 76, 82, 122, 16, 70, 86, 75, 76, 101, 102, 16, 131, 106, 107, 16, 163, 16, 163, 16, 167, 140, 167, 168, 16, 70, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 106, 107, 122, 162, 37, 38, 165, 163, 16, 1, 16, 167, 171, 0, 1, 16, 1, 163, 16, 139, 140, 167, 142, 143, 144, 145, 146, 147, 148, 59, 60, 1, 137, 138, 70, 155, 156, 37, 38, 31, 70, 74, 111, 112, 35, 165, 31, 80, 153, 31, 170, 171, 137, 138, 87, 88, 89, 31, 91, 31, 93, 31, 95, 31, 31, 98, 31, 31, 153, 31, 103, 104, 105, 31, 74, 31, 109, 110, 31, 31, 80, 31, 115, 116, 70, 71, 31, 87, 88, 89, 31, 91, 84, 93, 127, 95, 82, 84, 98, 84, 86, 137, 138, 103, 104, 105, 31, 137, 138, 109, 110, 31, 31, 31, 84, 115, 116, 153, 31, 106, 31, 108, 37, 153, 38, 158, 113, 127, 35, 165, 117, 118, 35, 35, 35, 122, 122, 70, 71, 35, 35, 57, 69, 130, 131, 132, 133, 134, 37, 82, 37, 37, 80, 86, 140, 77, 142, 143, 144, 145, 146, 147, 148, 80, 70, 89, 92, 154, 97, 155, 156, 163, 82, 82, 97, 167, 163, 85, 163, 165, 167, 168, 167, 83, 170, 171, 31, 131, 100, 122, 94, 90, 97, 163, 131, 135, 135, 167, 96, 150, 136, 150, 140, 100, 158, 153, 153, 140, 163, 142, 143, 144, 145, 146, 147, 148, 159, 163, 153, 31, 113, 153, 155, 156, 114, 167, 157, 157, 162, 74, -1, -1, 165, -1, -1, 80, -1, 170, 171, -1, -1, -1, 87, 88, 89, 166, 91, -1, 93, -1, 95, -1, -1, 98, -1, -1, -1, -1, 103, 104, 105, 1, 74, -1, 109, 110, -1, -1, 80, 153, 115, 116, 163, 165, 168, 87, 88, 89, 163, 91, 163, 93, 127, 95, 1, 163, 98, 163, 163, 163, 163, 103, 104, 105, 163, 74, 163, 109, 110, 163, 163, 80, 163, 115, 116, 163, 163, 163, 87, 88, 89, 163, 91, 163, 93, 127, 95, 164, 164, 98, 164, 164, 164, 102, 103, 104, 105, 164, 74, 165, 109, 110, 165, 165, 80, 81, 115, 116, 165, 165, 165, 87, 88, 89, 84, 91, 165, 93, 127, 95, 165, 165, 98, 166, 165, 165, 165, 103, 104, 105, 100, 101, 102, 109, 110, 165, 106, 84, 165, 115, 116, 165, 165, 165, 1, 165, 165, 117, 118, 165, 165, 127, 122, 100, 101, 102, 166, 165, 165, 106, 130, 131, 132, 133, 134, 165, 165, 165, 165, 165, 117, 118, 165, 165, 31, 122, 165, 165, 165, 165, 165, 165, 165, 130, 131, 132, 133, 134, 74, 166, 165, 165, 170, 163, 80, 166, 168, 167, 168, 166, 166, 87, 88, 89, 166, 91, 166, 93, 166, 95, 166, 166, 98, 166, 166, 166, 163, 103, 104, 105, 167, 168, 166, 109, 110, 82, 166, 166, 166, 115, 116, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 127, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, -1, 167, 117, 118, 167, 167, 167, 122, 167, 167, 167, 167, 167, 167, 167, 167, 131, 167, 167, -1, 168, 168, 168, 168, -1, 140, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 162, 168, -1, 165, 169, 171, -1, -1, -1, 171); + protected array $actionBase = array(0, -2, 156, 559, 757, 1004, 1027, 485, 292, 357, -60, -12, 588, 759, 759, 774, 759, 557, 752, 892, 598, 598, 598, 827, 313, 313, 827, 313, 711, 711, 711, 711, 744, 744, 965, 965, 998, 932, 899, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 1088, 33, 20, 224, 1080, 673, 1056, 1062, 1058, 1063, 1054, 1053, 1057, 1059, 1064, 1109, 1110, 833, 1108, 1112, 1060, 907, 1055, 1061, 888, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 356, 476, 513, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 624, 624, 22, 22, 22, 362, 811, 758, 811, 811, 811, 811, 811, 811, 811, 811, 346, 205, 188, 714, 171, 171, 7, 7, 7, 7, 7, 376, 1117, 54, 585, 585, 314, 314, 314, 314, 365, 554, 83, 435, 397, 556, 477, 463, 532, 532, 558, 558, 76, 76, 558, 558, 558, 133, 133, 547, 547, 547, 547, 41, 217, 806, 382, 382, 382, 382, 806, 806, 806, 806, 795, 996, 806, 806, 806, 494, 533, 708, 649, 649, 560, -70, -70, 560, 800, -70, 487, 975, 316, 982, -102, 807, -40, 514, -102, 1000, 368, 639, 639, 659, 639, 639, 639, 801, 611, 801, 1052, 836, 836, 794, 776, 894, 1082, 1065, 832, 1106, 847, 1107, 1083, 489, 488, -16, 13, 74, 772, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1113, 554, 1052, -3, 1104, 1105, 1113, 1113, 1113, 554, 554, 554, 554, 554, 554, 554, 554, 799, 554, 554, 675, -3, 629, 636, -3, 849, 554, 797, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 512, 33, 33, 20, 5, 5, 33, 142, 52, 5, 5, 5, 337, 5, 33, 33, 33, 611, 828, 813, 638, -18, 814, 443, 828, 828, 828, 115, 114, 128, 753, 837, 370, 816, 816, 835, 929, 929, 816, 834, 816, 835, 816, 816, 929, 929, 810, 929, 202, 506, 373, 442, 537, 929, 234, 816, 816, 816, 816, 805, 929, 72, 544, 816, 226, 218, 816, 816, 805, 804, 824, 808, 929, 929, 929, 805, 389, 808, 808, 808, 853, 859, 851, 819, 361, 305, 579, 163, 830, 819, 819, 816, 456, 851, 819, 851, 819, 790, 819, 819, 819, 851, 819, 834, 383, 819, 736, 574, 127, 819, 816, 19, 944, 947, 762, 950, 934, 951, 991, 952, 954, 1070, 925, 967, 935, 955, 999, 933, 930, 831, 699, 703, 809, 796, 919, 817, 817, 817, 912, 917, 817, 817, 817, 817, 817, 817, 817, 817, 699, 897, 860, 820, 976, 705, 707, 1041, 793, 1085, 1114, 975, 944, 954, 770, 935, 955, 933, 930, 792, 791, 786, 788, 782, 780, 777, 779, 803, 1043, 958, 789, 712, 1012, 977, 1084, 1066, 978, 981, 1016, 1044, 861, 1045, 1086, 838, 1087, 1090, 898, 985, 1071, 817, 911, 852, 900, 982, 918, 699, 901, 1046, 997, 802, 1018, 1019, 1069, 821, 844, 902, 1091, 986, 987, 988, 1073, 1074, 798, 1003, 823, 1021, 839, 850, 1022, 1023, 1030, 1034, 1075, 1092, 1076, 908, 1077, 866, 845, 931, 846, 1093, 429, 843, 848, 858, 990, 584, 974, 1078, 1002, 1094, 1035, 1036, 1039, 1095, 1096, 959, 868, 1007, 840, 1008, 964, 869, 870, 643, 857, 1047, 841, 842, 855, 646, 655, 1097, 1098, 1099, 966, 825, 822, 871, 875, 1048, 829, 1050, 1100, 661, 877, 1101, 1042, 738, 743, 586, 692, 680, 746, 818, 1079, 812, 854, 815, 989, 743, 826, 880, 1102, 881, 883, 886, 1040, 887, 1014, 1103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 468, 468, 468, 468, 468, 468, 313, 313, 313, 313, 313, 468, 468, 468, 468, 468, 468, 468, 313, 468, 468, 468, 313, 0, 0, 313, 0, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 524, 524, 297, 297, 297, 297, 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 297, 297, 297, 0, 297, 297, 297, 297, 297, 297, 297, 810, 524, 524, 524, 524, 133, 133, 133, 133, -95, -95, -95, 524, 524, 133, 524, 810, 524, 524, 524, 524, 524, 524, 524, 524, 524, 0, 0, 524, 524, 524, 524, -3, -70, 524, 834, 834, 834, 834, 524, 524, 524, 524, -70, -70, 524, 524, 524, 0, 0, 0, 133, 133, -3, 0, 0, -3, 391, 0, 834, 206, 834, 206, 524, 391, 810, 374, 524, 489, 0, 0, 0, 0, 0, 0, 0, -3, 834, -3, 554, -70, -70, 554, 554, 5, 33, 374, 612, 612, 612, 612, 33, 0, 0, 0, 0, 0, 611, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 810, 834, 0, 810, 0, 810, 810, 834, 834, 834, 0, 0, 0, 0, 0, 0, 0, 0, 929, 0, 0, 0, 0, 0, 0, 0, 834, 0, 929, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 834, 0, 0, 0, 0, 0, 0, 0, 0, 0, 817, 821, 0, 0, 821, 0, 817, 817, 817, 0, 0, 0, 857, 829); + protected array $actionDefault = array(3, 32767, 102, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 100, 32767, 618, 618, 618, 618, 32767, 32767, 255, 102, 32767, 32767, 489, 406, 406, 406, 32767, 32767, 562, 562, 562, 562, 562, 32767, 32767, 32767, 32767, 32767, 32767, 489, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 36, 7, 8, 10, 11, 49, 17, 328, 100, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 102, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 393, 611, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 493, 472, 473, 475, 476, 405, 563, 617, 331, 614, 333, 404, 145, 343, 334, 243, 259, 494, 260, 495, 498, 499, 216, 390, 149, 150, 436, 490, 438, 488, 492, 437, 411, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 409, 410, 491, 32767, 32767, 469, 468, 467, 434, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 102, 32767, 435, 439, 442, 408, 440, 441, 458, 459, 456, 457, 460, 32767, 32767, 320, 32767, 32767, 461, 462, 463, 464, 371, 195, 369, 32767, 32767, 443, 320, 111, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 449, 450, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 102, 32767, 100, 506, 556, 466, 444, 445, 32767, 531, 32767, 102, 32767, 533, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 558, 431, 433, 526, 612, 412, 615, 32767, 519, 100, 195, 32767, 532, 195, 195, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 557, 32767, 625, 519, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 32767, 195, 110, 32767, 110, 110, 32767, 32767, 100, 195, 195, 195, 195, 195, 195, 195, 195, 534, 195, 195, 190, 32767, 269, 271, 102, 580, 195, 536, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 393, 32767, 32767, 32767, 32767, 519, 454, 138, 32767, 521, 138, 564, 446, 447, 448, 564, 564, 564, 316, 293, 32767, 32767, 32767, 32767, 534, 534, 100, 100, 100, 100, 32767, 32767, 32767, 32767, 111, 505, 99, 99, 99, 99, 99, 103, 101, 32767, 32767, 32767, 32767, 224, 32767, 101, 99, 32767, 101, 101, 32767, 32767, 224, 226, 213, 228, 32767, 584, 585, 224, 101, 228, 228, 228, 248, 248, 508, 322, 101, 99, 101, 101, 197, 322, 322, 32767, 101, 508, 322, 508, 322, 199, 322, 322, 322, 508, 322, 32767, 101, 322, 215, 99, 99, 322, 32767, 32767, 32767, 32767, 521, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 223, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 551, 32767, 569, 582, 452, 453, 455, 568, 566, 477, 478, 479, 480, 481, 482, 483, 485, 613, 32767, 525, 32767, 32767, 32767, 342, 32767, 623, 32767, 32767, 32767, 9, 74, 514, 42, 43, 51, 57, 540, 541, 542, 543, 537, 538, 544, 539, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 624, 32767, 564, 32767, 32767, 32767, 32767, 451, 546, 590, 32767, 32767, 565, 616, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 138, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 551, 32767, 136, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 547, 32767, 32767, 32767, 564, 32767, 32767, 32767, 32767, 318, 315, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 564, 32767, 32767, 32767, 32767, 32767, 295, 32767, 312, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 389, 521, 298, 300, 301, 32767, 32767, 32767, 32767, 365, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 152, 152, 3, 3, 345, 152, 152, 152, 345, 345, 152, 345, 345, 345, 152, 152, 152, 152, 152, 152, 152, 281, 185, 263, 266, 248, 248, 152, 357, 152, 391, 391, 400); + protected array $goto = array(194, 194, 1052, 487, 705, 278, 278, 278, 278, 990, 489, 548, 548, 907, 865, 907, 907, 548, 714, 548, 548, 548, 548, 548, 548, 548, 548, 166, 166, 166, 166, 218, 195, 191, 191, 176, 178, 213, 191, 191, 191, 191, 191, 192, 192, 192, 192, 192, 186, 187, 188, 189, 190, 215, 213, 216, 545, 546, 428, 547, 550, 551, 552, 553, 554, 555, 556, 557, 1169, 167, 168, 169, 193, 170, 171, 172, 164, 173, 174, 175, 177, 212, 214, 217, 237, 240, 251, 252, 253, 255, 256, 257, 258, 259, 260, 261, 267, 268, 269, 270, 276, 288, 289, 313, 314, 434, 435, 436, 607, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 186, 187, 188, 189, 190, 215, 1169, 196, 197, 198, 199, 238, 179, 180, 200, 181, 201, 197, 182, 239, 196, 163, 202, 203, 183, 204, 205, 206, 184, 207, 208, 165, 209, 210, 211, 185, 869, 560, 1083, 560, 560, 592, 1100, 475, 475, 744, 646, 648, 609, 560, 668, 432, 475, 621, 692, 695, 1025, 703, 712, 1021, 719, 558, 558, 558, 558, 470, 613, 866, 663, 664, 463, 681, 682, 683, 1218, 984, 984, 984, 984, 247, 247, 463, 978, 985, 355, 355, 355, 355, 867, 923, 918, 919, 932, 875, 920, 872, 921, 922, 873, 350, 926, 879, 1126, 1154, 1127, 878, 245, 245, 245, 245, 242, 248, 841, 1106, 1102, 1103, 438, 670, 402, 405, 610, 614, 433, 336, 332, 333, 335, 602, 437, 337, 439, 647, 426, 1273, 1052, 1273, 1273, 342, 900, 456, 456, 348, 456, 456, 1052, 1273, 882, 1052, 520, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 343, 342, 1052, 1052, 1052, 1052, 894, 465, 1273, 881, 508, 599, 509, 1273, 1273, 1273, 1273, 358, 515, 1273, 1273, 1273, 1354, 1354, 1354, 1354, 862, 358, 358, 1372, 1372, 630, 667, 895, 883, 1088, 1092, 940, 358, 358, 1362, 941, 358, 1011, 1372, 1389, 993, 956, 447, 956, 619, 633, 636, 637, 638, 639, 660, 661, 662, 716, 718, 564, 569, 562, 358, 358, 1375, 1375, 400, 983, 1055, 1055, 690, 967, 597, 862, 1047, 1063, 1064, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 456, 1138, 899, 456, 669, 456, 456, 1058, 1057, 322, 562, 569, 594, 595, 324, 605, 611, 1166, 626, 627, 1028, 1028, 1061, 1062, 632, 632, 25, 320, 306, 1334, 1304, 1304, 1304, 1304, 1304, 1304, 1304, 1304, 1304, 1304, 702, 1349, 1350, 1014, 843, 5, 986, 6, 743, 445, 422, 561, 1023, 1018, 1076, 1345, 702, 1345, 1345, 702, 603, 624, 1323, 1323, 691, 250, 250, 1345, 1323, 1323, 1323, 1323, 1323, 1323, 1323, 1323, 1323, 1323, 563, 589, 927, 564, 928, 563, 675, 589, 859, 403, 469, 1356, 1356, 1356, 1356, 338, 887, 271, 319, 625, 319, 319, 478, 606, 479, 480, 973, 351, 352, 409, 892, 1320, 1320, 1380, 1381, 1341, 862, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 982, 417, 713, 1268, 1264, 414, 415, 1033, 884, 440, 679, 890, 680, 1149, 419, 420, 421, 1089, 693, 847, 1266, 423, 440, 747, 1043, 346, 485, 1093, 1059, 1059, 330, 484, 1347, 1348, 1140, 674, 1070, 1066, 1067, 1091, 896, 995, 549, 549, 377, 1343, 1343, 1091, 549, 549, 549, 549, 549, 549, 549, 549, 549, 549, 1269, 1270, 0, 1256, 0, 847, 0, 847, 615, 857, 0, 945, 1156, 640, 642, 644, 1256, 0, 0, 0, 0, 608, 1119, 1030, 0, 0, 752, 752, 1271, 1331, 1332, 886, 717, 673, 1009, 0, 0, 516, 708, 880, 1117, 1249, 959, 0, 0, 0, 1250, 1253, 960, 0, 1254, 1263); + protected array $gotoCheck = array(42, 42, 73, 84, 73, 23, 23, 23, 23, 49, 84, 162, 162, 25, 25, 25, 25, 162, 9, 162, 162, 162, 162, 162, 162, 162, 162, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 15, 19, 128, 19, 19, 48, 15, 154, 154, 48, 48, 48, 131, 19, 48, 13, 154, 13, 48, 48, 48, 48, 48, 48, 48, 107, 107, 107, 107, 156, 107, 26, 86, 86, 19, 86, 86, 86, 156, 19, 19, 19, 19, 5, 5, 19, 19, 19, 24, 24, 24, 24, 27, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 97, 15, 15, 146, 146, 146, 15, 5, 5, 5, 5, 5, 5, 6, 15, 15, 15, 66, 66, 59, 59, 59, 59, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 43, 73, 73, 73, 73, 174, 45, 23, 23, 185, 23, 23, 73, 73, 35, 73, 76, 73, 73, 73, 73, 73, 73, 73, 73, 73, 174, 174, 73, 73, 73, 73, 35, 83, 73, 35, 160, 178, 160, 73, 73, 73, 73, 14, 160, 73, 73, 73, 9, 9, 9, 9, 22, 14, 14, 188, 188, 56, 56, 16, 16, 16, 16, 73, 14, 14, 187, 73, 14, 103, 188, 14, 16, 9, 83, 9, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 14, 76, 76, 14, 14, 188, 188, 62, 16, 89, 89, 89, 89, 104, 22, 89, 89, 89, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 16, 16, 23, 64, 23, 23, 119, 119, 76, 76, 76, 76, 76, 76, 76, 76, 155, 76, 76, 107, 107, 120, 120, 108, 108, 76, 175, 175, 14, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 7, 184, 184, 50, 7, 46, 50, 46, 50, 113, 14, 50, 50, 50, 115, 131, 7, 131, 131, 7, 2, 2, 176, 176, 117, 5, 5, 131, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 9, 9, 65, 14, 65, 9, 121, 9, 18, 9, 9, 131, 131, 131, 131, 29, 39, 24, 24, 80, 24, 24, 9, 9, 9, 9, 92, 97, 97, 28, 9, 177, 177, 9, 9, 131, 22, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 93, 93, 93, 20, 166, 82, 82, 110, 37, 118, 82, 9, 82, 153, 82, 82, 82, 130, 82, 12, 14, 82, 118, 99, 114, 82, 157, 133, 118, 118, 9, 182, 182, 182, 149, 118, 118, 118, 118, 131, 41, 96, 179, 179, 138, 131, 131, 131, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 20, 20, -1, 20, -1, 12, -1, 12, 17, 20, -1, 17, 17, 85, 85, 85, 20, -1, -1, -1, -1, 8, 8, 17, -1, -1, 24, 24, 20, 20, 20, 17, 8, 17, 17, -1, -1, 8, 8, 17, 8, 79, 79, -1, -1, -1, 79, 79, 79, -1, 79, 17); + protected array $gotoBase = array(0, 0, -289, 0, 0, 203, 227, 406, 569, 8, 0, 0, 223, -162, 5, -186, -143, 93, 152, -101, 102, 0, 31, 2, 206, 10, 188, 209, 142, 172, 0, 0, 0, 0, 0, -104, 0, 166, 0, 149, 0, 90, -1, 234, 0, 237, -329, 0, -555, -9, 404, 0, 0, 0, 0, 0, 274, 0, 0, 198, 0, 0, 309, 0, 141, 439, 6, 0, 0, 0, 0, 0, 0, -5, 0, 0, 1, 0, 0, 183, 146, -28, 4, 12, -475, 82, -535, 0, 0, 74, 0, 0, 151, 196, 0, 0, 89, -267, 0, 108, 0, 0, 0, 291, 314, 0, 0, 158, 162, 0, 131, 0, 0, 145, 100, 153, 0, 156, 243, 101, 112, 167, 0, 0, 0, 0, 0, 0, 161, 0, 135, 165, 0, 76, 0, 0, 0, 0, -209, 0, 0, 0, 0, 0, 0, 0, -44, 0, 0, 81, 0, 0, 0, 157, 134, 148, -76, 77, 0, 0, -210, 0, -224, 0, 0, 0, 129, 0, 0, 0, 0, 0, 0, 0, -33, 84, 200, 247, 265, 305, 0, 0, 231, 0, 36, 236, 0, 292, 7, 0, 0); + protected array $gotoDefault = array(-32768, 521, 754, 4, 755, 949, 830, 839, 585, 539, 715, 347, 634, 429, 1339, 925, 1155, 604, 858, 1282, 1288, 464, 861, 327, 741, 937, 908, 909, 406, 393, 874, 404, 658, 635, 502, 893, 460, 885, 494, 888, 459, 897, 162, 425, 518, 901, 3, 904, 567, 935, 988, 394, 912, 395, 686, 914, 588, 916, 917, 401, 407, 408, 1160, 596, 631, 929, 254, 590, 930, 392, 931, 939, 397, 399, 696, 474, 513, 507, 418, 1121, 591, 618, 655, 453, 481, 629, 641, 628, 488, 441, 424, 326, 972, 980, 495, 472, 994, 349, 1002, 749, 1168, 649, 497, 1010, 650, 1017, 1020, 540, 541, 486, 1032, 264, 1035, 498, 1044, 23, 676, 1049, 1050, 677, 651, 1072, 652, 678, 653, 1074, 471, 586, 1082, 461, 1090, 1328, 462, 1094, 262, 1097, 277, 353, 376, 442, 1104, 1105, 9, 1111, 706, 707, 19, 273, 517, 1139, 697, 1145, 272, 1148, 458, 1167, 457, 1237, 1239, 568, 499, 1257, 310, 1260, 689, 514, 1265, 454, 1330, 455, 542, 482, 334, 543, 1373, 305, 356, 331, 559, 311, 357, 544, 483, 1336, 1344, 328, 31, 1363, 1374, 601, 623); + protected array $ruleToNonTerminal = array(0, 1, 3, 3, 2, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 10, 11, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 21, 21, 22, 23, 23, 24, 24, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 30, 30, 32, 34, 34, 28, 36, 36, 33, 38, 38, 35, 35, 37, 37, 39, 39, 31, 40, 40, 41, 43, 44, 44, 45, 45, 46, 46, 48, 47, 47, 47, 47, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 25, 25, 50, 69, 69, 72, 72, 71, 70, 70, 63, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 80, 26, 26, 27, 27, 27, 27, 27, 88, 88, 90, 90, 83, 83, 91, 91, 92, 92, 92, 84, 84, 87, 87, 85, 85, 93, 94, 94, 57, 57, 65, 65, 68, 68, 68, 67, 95, 95, 96, 58, 58, 58, 58, 97, 97, 98, 98, 99, 99, 100, 101, 101, 102, 102, 103, 103, 55, 55, 51, 51, 105, 53, 53, 106, 52, 52, 54, 54, 64, 64, 64, 64, 81, 81, 109, 109, 111, 111, 112, 112, 112, 112, 112, 112, 112, 110, 110, 110, 115, 115, 115, 115, 89, 89, 118, 118, 118, 119, 119, 116, 116, 120, 120, 122, 122, 123, 123, 117, 124, 124, 121, 125, 125, 125, 125, 113, 113, 82, 82, 82, 20, 20, 20, 127, 126, 126, 128, 128, 128, 128, 60, 129, 129, 130, 61, 132, 132, 133, 133, 134, 134, 86, 135, 135, 135, 135, 135, 135, 135, 135, 141, 141, 142, 142, 143, 143, 143, 143, 143, 144, 145, 145, 140, 140, 136, 136, 139, 139, 147, 147, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 137, 148, 148, 150, 149, 149, 138, 138, 114, 114, 151, 151, 153, 153, 153, 152, 152, 62, 104, 154, 154, 56, 56, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 161, 162, 162, 163, 155, 155, 160, 160, 164, 165, 165, 166, 167, 168, 168, 168, 168, 19, 19, 73, 73, 73, 73, 156, 156, 156, 156, 170, 170, 159, 159, 159, 157, 157, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 177, 177, 177, 108, 179, 179, 179, 179, 158, 158, 158, 158, 158, 158, 158, 158, 59, 59, 173, 173, 173, 173, 173, 180, 180, 169, 169, 169, 169, 181, 181, 181, 181, 181, 74, 74, 66, 66, 66, 66, 131, 131, 131, 131, 184, 183, 172, 172, 172, 172, 172, 172, 171, 171, 171, 182, 182, 182, 182, 107, 178, 186, 186, 185, 185, 187, 187, 187, 187, 187, 187, 187, 187, 175, 175, 175, 175, 174, 189, 188, 188, 188, 188, 188, 188, 188, 188, 190, 190, 190, 190); + protected array $ruleToLength = array(1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 2, 1, 3, 4, 1, 2, 0, 1, 1, 1, 1, 4, 3, 5, 4, 3, 4, 1, 3, 1, 1, 8, 7, 2, 3, 1, 2, 3, 1, 2, 3, 1, 1, 3, 1, 3, 1, 2, 2, 3, 1, 3, 2, 3, 1, 3, 3, 2, 0, 1, 1, 1, 1, 1, 3, 7, 10, 5, 7, 9, 5, 3, 3, 3, 3, 3, 3, 1, 2, 5, 7, 9, 6, 5, 6, 3, 2, 1, 1, 1, 1, 0, 2, 1, 3, 8, 0, 4, 2, 1, 3, 0, 1, 0, 1, 0, 1, 3, 1, 1, 1, 1, 8, 9, 7, 8, 7, 6, 8, 0, 2, 0, 2, 1, 2, 1, 2, 1, 1, 1, 0, 2, 0, 2, 0, 2, 2, 1, 3, 1, 4, 1, 4, 1, 1, 4, 2, 1, 3, 3, 3, 4, 4, 5, 0, 2, 4, 3, 1, 1, 7, 0, 2, 1, 3, 3, 4, 1, 4, 0, 2, 5, 0, 2, 6, 0, 2, 0, 3, 1, 2, 1, 1, 2, 0, 1, 3, 0, 2, 1, 1, 1, 1, 1, 1, 1, 7, 9, 6, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, 3, 1, 1, 2, 1, 1, 0, 1, 0, 2, 2, 2, 4, 3, 1, 1, 3, 1, 2, 2, 3, 2, 3, 1, 1, 2, 3, 1, 1, 3, 2, 0, 1, 5, 7, 5, 6, 10, 3, 5, 1, 1, 3, 0, 2, 4, 5, 4, 4, 4, 3, 1, 1, 1, 1, 1, 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 3, 0, 2, 0, 3, 5, 8, 1, 3, 3, 0, 2, 2, 2, 3, 1, 0, 1, 1, 3, 3, 3, 4, 4, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 3, 4, 4, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 2, 1, 2, 4, 2, 2, 8, 9, 8, 9, 9, 10, 9, 10, 8, 3, 2, 2, 1, 1, 0, 4, 2, 1, 3, 2, 1, 2, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 3, 3, 4, 1, 1, 3, 1, 1, 1, 1, 1, 3, 2, 3, 0, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 4, 1, 4, 4, 0, 1, 1, 1, 3, 3, 1, 4, 2, 2, 1, 3, 1, 4, 3, 3, 3, 3, 1, 3, 1, 1, 3, 1, 1, 4, 1, 1, 1, 3, 1, 1, 2, 1, 3, 4, 3, 2, 0, 2, 2, 1, 2, 1, 1, 1, 4, 3, 3, 3, 3, 6, 3, 1, 1, 2, 1); + protected function initReduceCallbacks() : void + { + $this->reduceCallbacks = [0 => null, 1 => static function ($self, $stackPos) { + $self->semValue = $self->handleNamespaces($self->semStack[$stackPos - (1 - 1)]); + }, 2 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos - (2 - 2)] !== null) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + } + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 3 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 4 => static function ($self, $stackPos) { + $nop = $self->maybeCreateZeroLengthNop($self->tokenPos); + if ($nop !== null) { + $self->semStack[$stackPos - (1 - 1)][] = $nop; + } + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + }, 5 => null, 6 => null, 7 => null, 8 => null, 9 => null, 10 => null, 11 => null, 12 => null, 13 => null, 14 => null, 15 => null, 16 => null, 17 => null, 18 => null, 19 => null, 20 => null, 21 => null, 22 => null, 23 => null, 24 => null, 25 => null, 26 => null, 27 => null, 28 => null, 29 => null, 30 => null, 31 => null, 32 => null, 33 => null, 34 => null, 35 => null, 36 => null, 37 => null, 38 => null, 39 => null, 40 => null, 41 => null, 42 => null, 43 => null, 44 => null, 45 => null, 46 => null, 47 => null, 48 => null, 49 => null, 50 => null, 51 => null, 52 => null, 53 => null, 54 => null, 55 => null, 56 => null, 57 => null, 58 => null, 59 => null, 60 => null, 61 => null, 62 => null, 63 => null, 64 => null, 65 => null, 66 => null, 67 => null, 68 => null, 69 => null, 70 => null, 71 => null, 72 => null, 73 => null, 74 => null, 75 => null, 76 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + if ($self->semValue === "emitError(new Error('Cannot use "getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos]))); + } + }, 77 => null, 78 => null, 79 => null, 80 => null, 81 => null, 82 => null, 83 => null, 84 => null, 85 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 86 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 87 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 88 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 89 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 90 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 91 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 92 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 93 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 94 => null, 95 => static function ($self, $stackPos) { + $self->semValue = new Name(\substr($self->semStack[$stackPos - (1 - 1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 96 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable(\substr($self->semStack[$stackPos - (1 - 1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 97 => static function ($self, $stackPos) { + /* nothing */ + }, 98 => static function ($self, $stackPos) { + /* nothing */ + }, 99 => static function ($self, $stackPos) { + /* nothing */ + }, 100 => static function ($self, $stackPos) { + $self->emitError(new Error('A trailing comma is not allowed here', $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos]))); + }, 101 => null, 102 => null, 103 => static function ($self, $stackPos) { + $self->semValue = new Node\Attribute($self->semStack[$stackPos - (1 - 1)], [], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 104 => static function ($self, $stackPos) { + $self->semValue = new Node\Attribute($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 105 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 106 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 107 => static function ($self, $stackPos) { + $self->semValue = new Node\AttributeGroup($self->semStack[$stackPos - (4 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 108 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 109 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 110 => static function ($self, $stackPos) { + $self->semValue = []; + }, 111 => null, 112 => null, 113 => null, 114 => null, 115 => static function ($self, $stackPos) { + $self->semValue = new Stmt\HaltCompiler($self->handleHaltCompiler(), $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 116 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Namespace_($self->semStack[$stackPos - (3 - 2)], null, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Stmt\Namespace_::KIND_SEMICOLON); + $self->checkNamespace($self->semValue); + }, 117 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Namespace_($self->semStack[$stackPos - (5 - 2)], $self->semStack[$stackPos - (5 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); + $self->checkNamespace($self->semValue); + }, 118 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Namespace_(null, $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED); + $self->checkNamespace($self->semValue); + }, 119 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Use_($self->semStack[$stackPos - (3 - 2)], Stmt\Use_::TYPE_NORMAL, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 120 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Use_($self->semStack[$stackPos - (4 - 3)], $self->semStack[$stackPos - (4 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 121 => null, 122 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Const_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 123 => static function ($self, $stackPos) { + $self->semValue = Stmt\Use_::TYPE_FUNCTION; + }, 124 => static function ($self, $stackPos) { + $self->semValue = Stmt\Use_::TYPE_CONSTANT; + }, 125 => static function ($self, $stackPos) { + $self->semValue = new Stmt\GroupUse($self->semStack[$stackPos - (8 - 3)], $self->semStack[$stackPos - (8 - 6)], $self->semStack[$stackPos - (8 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + }, 126 => static function ($self, $stackPos) { + $self->semValue = new Stmt\GroupUse($self->semStack[$stackPos - (7 - 2)], $self->semStack[$stackPos - (7 - 5)], Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + }, 127 => null, 128 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 129 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 130 => null, 131 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 132 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 133 => null, 134 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 135 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 136 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos - (1 - 1)], null, Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkUseUse($self->semValue, $stackPos - (1 - 1)); + }, 137 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkUseUse($self->semValue, $stackPos - (3 - 3)); + }, 138 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos - (1 - 1)], null, Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkUseUse($self->semValue, $stackPos - (1 - 1)); + }, 139 => static function ($self, $stackPos) { + $self->semValue = new Node\UseItem($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], Stmt\Use_::TYPE_UNKNOWN, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkUseUse($self->semValue, $stackPos - (3 - 3)); + }, 140 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + $self->semValue->type = Stmt\Use_::TYPE_NORMAL; + }, 141 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue->type = $self->semStack[$stackPos - (2 - 1)]; + }, 142 => null, 143 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 144 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 145 => static function ($self, $stackPos) { + $self->semValue = new Node\Const_($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 146 => null, 147 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 148 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 149 => static function ($self, $stackPos) { + $self->semValue = new Node\Const_(new Node\Identifier($self->semStack[$stackPos - (3 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos - (3 - 1)])), $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 150 => static function ($self, $stackPos) { + $self->semValue = new Node\Const_(new Node\Identifier($self->semStack[$stackPos - (3 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos - (3 - 1)])), $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 151 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos - (2 - 2)] !== null) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + } + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 152 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 153 => static function ($self, $stackPos) { + $nop = $self->maybeCreateZeroLengthNop($self->tokenPos); + if ($nop !== null) { + $self->semStack[$stackPos - (1 - 1)][] = $nop; + } + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + }, 154 => null, 155 => null, 156 => null, 157 => static function ($self, $stackPos) { + throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 158 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Block($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 159 => static function ($self, $stackPos) { + $self->semValue = new Stmt\If_($self->semStack[$stackPos - (7 - 3)], ['stmts' => $self->semStack[$stackPos - (7 - 5)], 'elseifs' => $self->semStack[$stackPos - (7 - 6)], 'else' => $self->semStack[$stackPos - (7 - 7)]], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + }, 160 => static function ($self, $stackPos) { + $self->semValue = new Stmt\If_($self->semStack[$stackPos - (10 - 3)], ['stmts' => $self->semStack[$stackPos - (10 - 6)], 'elseifs' => $self->semStack[$stackPos - (10 - 7)], 'else' => $self->semStack[$stackPos - (10 - 8)]], $self->getAttributes($self->tokenStartStack[$stackPos - (10 - 1)], $self->tokenEndStack[$stackPos])); + }, 161 => static function ($self, $stackPos) { + $self->semValue = new Stmt\While_($self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 162 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Do_($self->semStack[$stackPos - (7 - 5)], $self->semStack[$stackPos - (7 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + }, 163 => static function ($self, $stackPos) { + $self->semValue = new Stmt\For_(['init' => $self->semStack[$stackPos - (9 - 3)], 'cond' => $self->semStack[$stackPos - (9 - 5)], 'loop' => $self->semStack[$stackPos - (9 - 7)], 'stmts' => $self->semStack[$stackPos - (9 - 9)]], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 164 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Switch_($self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 165 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Break_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 166 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Continue_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 167 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Return_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 168 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Global_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 169 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Static_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 170 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Echo_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 171 => static function ($self, $stackPos) { + $self->semValue = new Stmt\InlineHTML($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('hasLeadingNewline', $self->inlineHtmlHasLeadingNewline($stackPos - (1 - 1))); + }, 172 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Expression($self->semStack[$stackPos - (2 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 173 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Unset_($self->semStack[$stackPos - (5 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 174 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Foreach_($self->semStack[$stackPos - (7 - 3)], $self->semStack[$stackPos - (7 - 5)][0], ['keyVar' => null, 'byRef' => $self->semStack[$stackPos - (7 - 5)][1], 'stmts' => $self->semStack[$stackPos - (7 - 7)]], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + }, 175 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Foreach_($self->semStack[$stackPos - (9 - 3)], $self->semStack[$stackPos - (9 - 7)][0], ['keyVar' => $self->semStack[$stackPos - (9 - 5)], 'byRef' => $self->semStack[$stackPos - (9 - 7)][1], 'stmts' => $self->semStack[$stackPos - (9 - 9)]], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 176 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Foreach_($self->semStack[$stackPos - (6 - 3)], new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos - (6 - 4)], $self->tokenEndStack[$stackPos - (6 - 4)])), ['stmts' => $self->semStack[$stackPos - (6 - 6)]], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos])); + }, 177 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Declare_($self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 178 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TryCatch($self->semStack[$stackPos - (6 - 3)], $self->semStack[$stackPos - (6 - 5)], $self->semStack[$stackPos - (6 - 6)], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkTryCatch($self->semValue); + }, 179 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Goto_($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 180 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Label($self->semStack[$stackPos - (2 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 181 => static function ($self, $stackPos) { + $self->semValue = null; + /* means: no statement */ + }, 182 => null, 183 => static function ($self, $stackPos) { + $self->semValue = $self->maybeCreateNop($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos]); + }, 184 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos - (1 - 1)] instanceof Stmt\Block) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]->stmts; + } else { + if ($self->semStack[$stackPos - (1 - 1)] === null) { + $self->semValue = []; + } else { + $self->semValue = [$self->semStack[$stackPos - (1 - 1)]]; + } + } + }, 185 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 186 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 187 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 188 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 189 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Catch_($self->semStack[$stackPos - (8 - 3)], $self->semStack[$stackPos - (8 - 4)], $self->semStack[$stackPos - (8 - 7)], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + }, 190 => static function ($self, $stackPos) { + $self->semValue = null; + }, 191 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Finally_($self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 192 => null, 193 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 194 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 195 => static function ($self, $stackPos) { + $self->semValue = \false; + }, 196 => static function ($self, $stackPos) { + $self->semValue = \true; + }, 197 => static function ($self, $stackPos) { + $self->semValue = \false; + }, 198 => static function ($self, $stackPos) { + $self->semValue = \true; + }, 199 => static function ($self, $stackPos) { + $self->semValue = \false; + }, 200 => static function ($self, $stackPos) { + $self->semValue = \true; + }, 201 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 202 => static function ($self, $stackPos) { + $self->semValue = []; + }, 203 => null, 204 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 205 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 206 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Function_($self->semStack[$stackPos - (8 - 3)], ['byRef' => $self->semStack[$stackPos - (8 - 2)], 'params' => $self->semStack[$stackPos - (8 - 5)], 'returnType' => $self->semStack[$stackPos - (8 - 7)], 'stmts' => $self->semStack[$stackPos - (8 - 8)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + }, 207 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Function_($self->semStack[$stackPos - (9 - 4)], ['byRef' => $self->semStack[$stackPos - (9 - 3)], 'params' => $self->semStack[$stackPos - (9 - 6)], 'returnType' => $self->semStack[$stackPos - (9 - 8)], 'stmts' => $self->semStack[$stackPos - (9 - 9)], 'attrGroups' => $self->semStack[$stackPos - (9 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 208 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Class_($self->semStack[$stackPos - (7 - 2)], ['type' => $self->semStack[$stackPos - (7 - 1)], 'extends' => $self->semStack[$stackPos - (7 - 3)], 'implements' => $self->semStack[$stackPos - (7 - 4)], 'stmts' => $self->semStack[$stackPos - (7 - 6)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkClass($self->semValue, $stackPos - (7 - 2)); + }, 209 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Class_($self->semStack[$stackPos - (8 - 3)], ['type' => $self->semStack[$stackPos - (8 - 2)], 'extends' => $self->semStack[$stackPos - (8 - 4)], 'implements' => $self->semStack[$stackPos - (8 - 5)], 'stmts' => $self->semStack[$stackPos - (8 - 7)], 'attrGroups' => $self->semStack[$stackPos - (8 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkClass($self->semValue, $stackPos - (8 - 3)); + }, 210 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Interface_($self->semStack[$stackPos - (7 - 3)], ['extends' => $self->semStack[$stackPos - (7 - 4)], 'stmts' => $self->semStack[$stackPos - (7 - 6)], 'attrGroups' => $self->semStack[$stackPos - (7 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkInterface($self->semValue, $stackPos - (7 - 3)); + }, 211 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Trait_($self->semStack[$stackPos - (6 - 3)], ['stmts' => $self->semStack[$stackPos - (6 - 5)], 'attrGroups' => $self->semStack[$stackPos - (6 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos])); + }, 212 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Enum_($self->semStack[$stackPos - (8 - 3)], ['scalarType' => $self->semStack[$stackPos - (8 - 4)], 'implements' => $self->semStack[$stackPos - (8 - 5)], 'stmts' => $self->semStack[$stackPos - (8 - 7)], 'attrGroups' => $self->semStack[$stackPos - (8 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkEnum($self->semValue, $stackPos - (8 - 3)); + }, 213 => static function ($self, $stackPos) { + $self->semValue = null; + }, 214 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + }, 215 => static function ($self, $stackPos) { + $self->semValue = null; + }, 216 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + }, 217 => static function ($self, $stackPos) { + $self->semValue = 0; + }, 218 => null, 219 => null, 220 => static function ($self, $stackPos) { + $self->checkClassModifier($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $stackPos - (2 - 2)); + $self->semValue = $self->semStack[$stackPos - (2 - 1)] | $self->semStack[$stackPos - (2 - 2)]; + }, 221 => static function ($self, $stackPos) { + $self->semValue = Modifiers::ABSTRACT; + }, 222 => static function ($self, $stackPos) { + $self->semValue = Modifiers::FINAL; + }, 223 => static function ($self, $stackPos) { + $self->semValue = Modifiers::READONLY; + }, 224 => static function ($self, $stackPos) { + $self->semValue = null; + }, 225 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + }, 226 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 227 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + }, 228 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 229 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + }, 230 => null, 231 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 232 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 233 => null, 234 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 2)]; + }, 235 => null, 236 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 2)]; + }, 237 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos - (1 - 1)] instanceof Stmt\Block) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]->stmts; + } else { + if ($self->semStack[$stackPos - (1 - 1)] === null) { + $self->semValue = []; + } else { + $self->semValue = [$self->semStack[$stackPos - (1 - 1)]]; + } + } + }, 238 => static function ($self, $stackPos) { + $self->semValue = null; + }, 239 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 2)]; + }, 240 => null, 241 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 242 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 243 => static function ($self, $stackPos) { + $self->semValue = new Node\DeclareItem($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 244 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 245 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 3)]; + }, 246 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 2)]; + }, 247 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (5 - 3)]; + }, 248 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 249 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 250 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Case_($self->semStack[$stackPos - (4 - 2)], $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 251 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Case_(null, $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 252 => null, 253 => null, 254 => static function ($self, $stackPos) { + $self->semValue = new Expr\Match_($self->semStack[$stackPos - (7 - 3)], $self->semStack[$stackPos - (7 - 6)], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos])); + }, 255 => static function ($self, $stackPos) { + $self->semValue = []; + }, 256 => null, 257 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 258 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 259 => static function ($self, $stackPos) { + $self->semValue = new Node\MatchArm($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 260 => static function ($self, $stackPos) { + $self->semValue = new Node\MatchArm(null, $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 261 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + }, 262 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 2)]; + }, 263 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 264 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 265 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ElseIf_($self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 266 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 267 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 268 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ElseIf_($self->semStack[$stackPos - (6 - 3)], $self->semStack[$stackPos - (6 - 6)], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos])); + $self->fixupAlternativeElse($self->semValue); + }, 269 => static function ($self, $stackPos) { + $self->semValue = null; + }, 270 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Else_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 271 => static function ($self, $stackPos) { + $self->semValue = null; + }, 272 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Else_($self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + $self->fixupAlternativeElse($self->semValue); + }, 273 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)], \false); + }, 274 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (2 - 2)], \true); + }, 275 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)], \false); + }, 276 => static function ($self, $stackPos) { + $self->semValue = array($self->fixupArrayDestructuring($self->semStack[$stackPos - (1 - 1)]), \false); + }, 277 => null, 278 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 279 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 280 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 281 => static function ($self, $stackPos) { + $self->semValue = 0; + }, 282 => static function ($self, $stackPos) { + $self->checkModifier($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $stackPos - (2 - 2)); + $self->semValue = $self->semStack[$stackPos - (2 - 1)] | $self->semStack[$stackPos - (2 - 2)]; + }, 283 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PUBLIC; + }, 284 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PROTECTED; + }, 285 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PRIVATE; + }, 286 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PUBLIC_SET; + }, 287 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PROTECTED_SET; + }, 288 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PRIVATE_SET; + }, 289 => static function ($self, $stackPos) { + $self->semValue = Modifiers::READONLY; + }, 290 => static function ($self, $stackPos) { + $self->semValue = new Node\Param($self->semStack[$stackPos - (7 - 6)], null, $self->semStack[$stackPos - (7 - 3)], $self->semStack[$stackPos - (7 - 4)], $self->semStack[$stackPos - (7 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (7 - 2)], $self->semStack[$stackPos - (7 - 1)], $self->semStack[$stackPos - (7 - 7)]); + $self->checkParam($self->semValue); + }, 291 => static function ($self, $stackPos) { + $self->semValue = new Node\Param($self->semStack[$stackPos - (9 - 6)], $self->semStack[$stackPos - (9 - 8)], $self->semStack[$stackPos - (9 - 3)], $self->semStack[$stackPos - (9 - 4)], $self->semStack[$stackPos - (9 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (9 - 2)], $self->semStack[$stackPos - (9 - 1)], $self->semStack[$stackPos - (9 - 9)]); + $self->checkParam($self->semValue); + }, 292 => static function ($self, $stackPos) { + $self->semValue = new Node\Param(new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos])), null, $self->semStack[$stackPos - (6 - 3)], $self->semStack[$stackPos - (6 - 4)], $self->semStack[$stackPos - (6 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (6 - 2)], $self->semStack[$stackPos - (6 - 1)]); + }, 293 => null, 294 => static function ($self, $stackPos) { + $self->semValue = new Node\NullableType($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 295 => static function ($self, $stackPos) { + $self->semValue = new Node\UnionType($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 296 => null, 297 => null, 298 => static function ($self, $stackPos) { + $self->semValue = new Node\Name('static', $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 299 => static function ($self, $stackPos) { + $self->semValue = $self->handleBuiltinTypes($self->semStack[$stackPos - (1 - 1)]); + }, 300 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier('array', $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 301 => static function ($self, $stackPos) { + $self->semValue = new Node\Identifier('callable', $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 302 => null, 303 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 304 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)]); + }, 305 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 306 => null, 307 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 308 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)]); + }, 309 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 310 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)]); + }, 311 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 312 => static function ($self, $stackPos) { + $self->semValue = new Node\IntersectionType($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 313 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)]); + }, 314 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 315 => static function ($self, $stackPos) { + $self->semValue = new Node\IntersectionType($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 316 => null, 317 => static function ($self, $stackPos) { + $self->semValue = new Node\NullableType($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 318 => static function ($self, $stackPos) { + $self->semValue = new Node\UnionType($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 319 => null, 320 => static function ($self, $stackPos) { + $self->semValue = null; + }, 321 => null, 322 => static function ($self, $stackPos) { + $self->semValue = null; + }, 323 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (2 - 2)]; + }, 324 => static function ($self, $stackPos) { + $self->semValue = null; + }, 325 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 326 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 2)]; + }, 327 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (3 - 2)]); + }, 328 => static function ($self, $stackPos) { + $self->semValue = new Node\VariadicPlaceholder($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 329 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 330 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 331 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos - (1 - 1)], \false, \false, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 332 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos - (2 - 2)], \true, \false, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 333 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos - (2 - 2)], \false, \true, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 334 => static function ($self, $stackPos) { + $self->semValue = new Node\Arg($self->semStack[$stackPos - (3 - 3)], \false, \false, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (3 - 1)]); + }, 335 => null, 336 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 337 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 338 => null, 339 => null, 340 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 341 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 342 => static function ($self, $stackPos) { + $self->semValue = new Node\StaticVar($self->semStack[$stackPos - (1 - 1)], null, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 343 => static function ($self, $stackPos) { + $self->semValue = new Node\StaticVar($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 344 => static function ($self, $stackPos) { + if ($self->semStack[$stackPos - (2 - 2)] !== null) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + } else { + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + } + }, 345 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 346 => static function ($self, $stackPos) { + $nop = $self->maybeCreateZeroLengthNop($self->tokenPos); + if ($nop !== null) { + $self->semStack[$stackPos - (1 - 1)][] = $nop; + } + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + }, 347 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Property($self->semStack[$stackPos - (5 - 2)], $self->semStack[$stackPos - (5 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 1)]); + }, 348 => static function ($self, $stackPos) { + $self->semValue = new Stmt\Property($self->semStack[$stackPos - (7 - 2)], $self->semStack[$stackPos - (7 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (7 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (7 - 3)], $self->semStack[$stackPos - (7 - 1)], $self->semStack[$stackPos - (7 - 6)]); + $self->checkPropertyHookList($self->semStack[$stackPos - (7 - 6)], $stackPos - (7 - 5)); + }, 349 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ClassConst($self->semStack[$stackPos - (5 - 4)], $self->semStack[$stackPos - (5 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (5 - 1)]); + $self->checkClassConst($self->semValue, $stackPos - (5 - 2)); + }, 350 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ClassConst($self->semStack[$stackPos - (6 - 5)], $self->semStack[$stackPos - (6 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos]), $self->semStack[$stackPos - (6 - 1)], $self->semStack[$stackPos - (6 - 4)]); + $self->checkClassConst($self->semValue, $stackPos - (6 - 2)); + }, 351 => static function ($self, $stackPos) { + $self->semValue = new Stmt\ClassMethod($self->semStack[$stackPos - (10 - 5)], ['type' => $self->semStack[$stackPos - (10 - 2)], 'byRef' => $self->semStack[$stackPos - (10 - 4)], 'params' => $self->semStack[$stackPos - (10 - 7)], 'returnType' => $self->semStack[$stackPos - (10 - 9)], 'stmts' => $self->semStack[$stackPos - (10 - 10)], 'attrGroups' => $self->semStack[$stackPos - (10 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (10 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkClassMethod($self->semValue, $stackPos - (10 - 2)); + }, 352 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUse($self->semStack[$stackPos - (3 - 2)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 353 => static function ($self, $stackPos) { + $self->semValue = new Stmt\EnumCase($self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 4)], $self->semStack[$stackPos - (5 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 354 => static function ($self, $stackPos) { + $self->semValue = null; + /* will be skipped */ + }, 355 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 356 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 357 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 358 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 359 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Precedence($self->semStack[$stackPos - (4 - 1)][0], $self->semStack[$stackPos - (4 - 1)][1], $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 360 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos - (5 - 1)][0], $self->semStack[$stackPos - (5 - 1)][1], $self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 361 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos - (4 - 1)][0], $self->semStack[$stackPos - (4 - 1)][1], $self->semStack[$stackPos - (4 - 3)], null, $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 362 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos - (4 - 1)][0], $self->semStack[$stackPos - (4 - 1)][1], null, $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 363 => static function ($self, $stackPos) { + $self->semValue = new Stmt\TraitUseAdaptation\Alias($self->semStack[$stackPos - (4 - 1)][0], $self->semStack[$stackPos - (4 - 1)][1], null, $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 364 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)]); + }, 365 => null, 366 => static function ($self, $stackPos) { + $self->semValue = array(null, $self->semStack[$stackPos - (1 - 1)]); + }, 367 => static function ($self, $stackPos) { + $self->semValue = null; + }, 368 => null, 369 => null, 370 => static function ($self, $stackPos) { + $self->semValue = 0; + }, 371 => static function ($self, $stackPos) { + $self->semValue = 0; + }, 372 => null, 373 => null, 374 => static function ($self, $stackPos) { + $self->checkModifier($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $stackPos - (2 - 2)); + $self->semValue = $self->semStack[$stackPos - (2 - 1)] | $self->semStack[$stackPos - (2 - 2)]; + }, 375 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PUBLIC; + }, 376 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PROTECTED; + }, 377 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PRIVATE; + }, 378 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PUBLIC_SET; + }, 379 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PROTECTED_SET; + }, 380 => static function ($self, $stackPos) { + $self->semValue = Modifiers::PRIVATE_SET; + }, 381 => static function ($self, $stackPos) { + $self->semValue = Modifiers::STATIC; + }, 382 => static function ($self, $stackPos) { + $self->semValue = Modifiers::ABSTRACT; + }, 383 => static function ($self, $stackPos) { + $self->semValue = Modifiers::FINAL; + }, 384 => static function ($self, $stackPos) { + $self->semValue = Modifiers::READONLY; + }, 385 => null, 386 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 387 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 388 => static function ($self, $stackPos) { + $self->semValue = new Node\VarLikeIdentifier(\substr($self->semStack[$stackPos - (1 - 1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 389 => static function ($self, $stackPos) { + $self->semValue = new Node\PropertyItem($self->semStack[$stackPos - (1 - 1)], null, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 390 => static function ($self, $stackPos) { + $self->semValue = new Node\PropertyItem($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 391 => static function ($self, $stackPos) { + $self->semValue = []; + }, 392 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 393 => static function ($self, $stackPos) { + $self->semValue = []; + }, 394 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + $self->checkPropertyHookList($self->semStack[$stackPos - (3 - 2)], $stackPos - (3 - 1)); + }, 395 => static function ($self, $stackPos) { + $self->semValue = new Node\PropertyHook($self->semStack[$stackPos - (5 - 4)], $self->semStack[$stackPos - (5 - 5)], ['flags' => $self->semStack[$stackPos - (5 - 2)], 'byRef' => $self->semStack[$stackPos - (5 - 3)], 'params' => [], 'attrGroups' => $self->semStack[$stackPos - (5 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkPropertyHook($self->semValue, null); + }, 396 => static function ($self, $stackPos) { + $self->semValue = new Node\PropertyHook($self->semStack[$stackPos - (8 - 4)], $self->semStack[$stackPos - (8 - 8)], ['flags' => $self->semStack[$stackPos - (8 - 2)], 'byRef' => $self->semStack[$stackPos - (8 - 3)], 'params' => $self->semStack[$stackPos - (8 - 6)], 'attrGroups' => $self->semStack[$stackPos - (8 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + $self->checkPropertyHook($self->semValue, $stackPos - (8 - 5)); + }, 397 => static function ($self, $stackPos) { + $self->semValue = null; + }, 398 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 399 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 400 => static function ($self, $stackPos) { + $self->semValue = 0; + }, 401 => static function ($self, $stackPos) { + $self->checkPropertyHookModifiers($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $stackPos - (2 - 2)); + $self->semValue = $self->semStack[$stackPos - (2 - 1)] | $self->semStack[$stackPos - (2 - 2)]; + }, 402 => null, 403 => null, 404 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 405 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 406 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 407 => null, 408 => null, 409 => static function ($self, $stackPos) { + $self->semValue = new Expr\Assign($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 410 => static function ($self, $stackPos) { + $self->semValue = new Expr\Assign($self->fixupArrayDestructuring($self->semStack[$stackPos - (3 - 1)]), $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 411 => static function ($self, $stackPos) { + $self->semValue = new Expr\Assign($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 412 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignRef($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 413 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignRef($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + if (!$self->phpVersion->allowsAssignNewByReference()) { + $self->emitError(new Error('Cannot assign new by reference', $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos]))); + } + }, 414 => null, 415 => null, 416 => static function ($self, $stackPos) { + $self->semValue = new Expr\Clone_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 417 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Plus($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 418 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Minus($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 419 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Mul($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 420 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Div($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 421 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Concat($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 422 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Mod($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 423 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\BitwiseAnd($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 424 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\BitwiseOr($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 425 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\BitwiseXor($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 426 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\ShiftLeft($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 427 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\ShiftRight($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 428 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Pow($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 429 => static function ($self, $stackPos) { + $self->semValue = new Expr\AssignOp\Coalesce($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 430 => static function ($self, $stackPos) { + $self->semValue = new Expr\PostInc($self->semStack[$stackPos - (2 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 431 => static function ($self, $stackPos) { + $self->semValue = new Expr\PreInc($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 432 => static function ($self, $stackPos) { + $self->semValue = new Expr\PostDec($self->semStack[$stackPos - (2 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 433 => static function ($self, $stackPos) { + $self->semValue = new Expr\PreDec($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 434 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BooleanOr($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 435 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BooleanAnd($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 436 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\LogicalOr($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 437 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\LogicalAnd($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 438 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\LogicalXor($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 439 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseOr($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 440 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseAnd($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 441 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseAnd($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 442 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\BitwiseXor($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 443 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Concat($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 444 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Plus($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 445 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Minus($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 446 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Mul($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 447 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Div($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 448 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Mod($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 449 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\ShiftLeft($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 450 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\ShiftRight($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 451 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Pow($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 452 => static function ($self, $stackPos) { + $self->semValue = new Expr\UnaryPlus($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 453 => static function ($self, $stackPos) { + $self->semValue = new Expr\UnaryMinus($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 454 => static function ($self, $stackPos) { + $self->semValue = new Expr\BooleanNot($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 455 => static function ($self, $stackPos) { + $self->semValue = new Expr\BitwiseNot($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 456 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Identical($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 457 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\NotIdentical($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 458 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Equal($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 459 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\NotEqual($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 460 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Spaceship($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 461 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Smaller($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 462 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\SmallerOrEqual($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 463 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Greater($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 464 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\GreaterOrEqual($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 465 => static function ($self, $stackPos) { + $self->semValue = new Expr\Instanceof_($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 466 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 467 => static function ($self, $stackPos) { + $self->semValue = new Expr\Ternary($self->semStack[$stackPos - (5 - 1)], $self->semStack[$stackPos - (5 - 3)], $self->semStack[$stackPos - (5 - 5)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 468 => static function ($self, $stackPos) { + $self->semValue = new Expr\Ternary($self->semStack[$stackPos - (4 - 1)], null, $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 469 => static function ($self, $stackPos) { + $self->semValue = new Expr\BinaryOp\Coalesce($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 470 => static function ($self, $stackPos) { + $self->semValue = new Expr\Isset_($self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 471 => static function ($self, $stackPos) { + $self->semValue = new Expr\Empty_($self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 472 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_INCLUDE, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 473 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_INCLUDE_ONCE, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 474 => static function ($self, $stackPos) { + $self->semValue = new Expr\Eval_($self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 475 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_REQUIRE, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 476 => static function ($self, $stackPos) { + $self->semValue = new Expr\Include_($self->semStack[$stackPos - (2 - 2)], Expr\Include_::TYPE_REQUIRE_ONCE, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 477 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Int_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 478 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos]); + $attrs['kind'] = $self->getFloatCastKind($self->semStack[$stackPos - (2 - 1)]); + $self->semValue = new Expr\Cast\Double($self->semStack[$stackPos - (2 - 2)], $attrs); + }, 479 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\String_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 480 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Array_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 481 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Object_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 482 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Bool_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 483 => static function ($self, $stackPos) { + $self->semValue = new Expr\Cast\Unset_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 484 => static function ($self, $stackPos) { + $self->semValue = $self->createExitExpr($self->semStack[$stackPos - (2 - 1)], $stackPos - (2 - 1), $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 485 => static function ($self, $stackPos) { + $self->semValue = new Expr\ErrorSuppress($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 486 => null, 487 => static function ($self, $stackPos) { + $self->semValue = new Expr\ShellExec($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 488 => static function ($self, $stackPos) { + $self->semValue = new Expr\Print_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 489 => static function ($self, $stackPos) { + $self->semValue = new Expr\Yield_(null, null, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 490 => static function ($self, $stackPos) { + $self->semValue = new Expr\Yield_($self->semStack[$stackPos - (2 - 2)], null, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 491 => static function ($self, $stackPos) { + $self->semValue = new Expr\Yield_($self->semStack[$stackPos - (4 - 4)], $self->semStack[$stackPos - (4 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 492 => static function ($self, $stackPos) { + $self->semValue = new Expr\YieldFrom($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 493 => static function ($self, $stackPos) { + $self->semValue = new Expr\Throw_($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 494 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => \false, 'byRef' => $self->semStack[$stackPos - (8 - 2)], 'params' => $self->semStack[$stackPos - (8 - 4)], 'returnType' => $self->semStack[$stackPos - (8 - 6)], 'expr' => $self->semStack[$stackPos - (8 - 8)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + }, 495 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => \true, 'byRef' => $self->semStack[$stackPos - (9 - 3)], 'params' => $self->semStack[$stackPos - (9 - 5)], 'returnType' => $self->semStack[$stackPos - (9 - 7)], 'expr' => $self->semStack[$stackPos - (9 - 9)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 496 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => \false, 'byRef' => $self->semStack[$stackPos - (8 - 2)], 'params' => $self->semStack[$stackPos - (8 - 4)], 'uses' => $self->semStack[$stackPos - (8 - 6)], 'returnType' => $self->semStack[$stackPos - (8 - 7)], 'stmts' => $self->semStack[$stackPos - (8 - 8)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])); + }, 497 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => \true, 'byRef' => $self->semStack[$stackPos - (9 - 3)], 'params' => $self->semStack[$stackPos - (9 - 5)], 'uses' => $self->semStack[$stackPos - (9 - 7)], 'returnType' => $self->semStack[$stackPos - (9 - 8)], 'stmts' => $self->semStack[$stackPos - (9 - 9)], 'attrGroups' => []], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 498 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => \false, 'byRef' => $self->semStack[$stackPos - (9 - 3)], 'params' => $self->semStack[$stackPos - (9 - 5)], 'returnType' => $self->semStack[$stackPos - (9 - 7)], 'expr' => $self->semStack[$stackPos - (9 - 9)], 'attrGroups' => $self->semStack[$stackPos - (9 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 499 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrowFunction(['static' => \true, 'byRef' => $self->semStack[$stackPos - (10 - 4)], 'params' => $self->semStack[$stackPos - (10 - 6)], 'returnType' => $self->semStack[$stackPos - (10 - 8)], 'expr' => $self->semStack[$stackPos - (10 - 10)], 'attrGroups' => $self->semStack[$stackPos - (10 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (10 - 1)], $self->tokenEndStack[$stackPos])); + }, 500 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => \false, 'byRef' => $self->semStack[$stackPos - (9 - 3)], 'params' => $self->semStack[$stackPos - (9 - 5)], 'uses' => $self->semStack[$stackPos - (9 - 7)], 'returnType' => $self->semStack[$stackPos - (9 - 8)], 'stmts' => $self->semStack[$stackPos - (9 - 9)], 'attrGroups' => $self->semStack[$stackPos - (9 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (9 - 1)], $self->tokenEndStack[$stackPos])); + }, 501 => static function ($self, $stackPos) { + $self->semValue = new Expr\Closure(['static' => \true, 'byRef' => $self->semStack[$stackPos - (10 - 4)], 'params' => $self->semStack[$stackPos - (10 - 6)], 'uses' => $self->semStack[$stackPos - (10 - 8)], 'returnType' => $self->semStack[$stackPos - (10 - 9)], 'stmts' => $self->semStack[$stackPos - (10 - 10)], 'attrGroups' => $self->semStack[$stackPos - (10 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (10 - 1)], $self->tokenEndStack[$stackPos])); + }, 502 => static function ($self, $stackPos) { + $self->semValue = array(new Stmt\Class_(null, ['type' => $self->semStack[$stackPos - (8 - 2)], 'extends' => $self->semStack[$stackPos - (8 - 4)], 'implements' => $self->semStack[$stackPos - (8 - 5)], 'stmts' => $self->semStack[$stackPos - (8 - 7)], 'attrGroups' => $self->semStack[$stackPos - (8 - 1)]], $self->getAttributes($self->tokenStartStack[$stackPos - (8 - 1)], $self->tokenEndStack[$stackPos])), $self->semStack[$stackPos - (8 - 3)]); + $self->checkClass($self->semValue[0], -1); + }, 503 => static function ($self, $stackPos) { + $self->semValue = new Expr\New_($self->semStack[$stackPos - (3 - 2)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 504 => static function ($self, $stackPos) { + list($class, $ctorArgs) = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = new Expr\New_($class, $ctorArgs, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 505 => static function ($self, $stackPos) { + $self->semValue = new Expr\New_($self->semStack[$stackPos - (2 - 2)], [], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 506 => null, 507 => null, 508 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 509 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (4 - 3)]; + }, 510 => null, 511 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 512 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 513 => static function ($self, $stackPos) { + $self->semValue = new Node\ClosureUse($self->semStack[$stackPos - (2 - 2)], $self->semStack[$stackPos - (2 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 514 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 515 => static function ($self, $stackPos) { + $self->semValue = new Expr\FuncCall($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 516 => static function ($self, $stackPos) { + $self->semValue = new Expr\FuncCall($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 517 => static function ($self, $stackPos) { + $self->semValue = new Expr\FuncCall($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 518 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticCall($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 519 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 520 => null, 521 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 522 => static function ($self, $stackPos) { + $self->semValue = new Name($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 523 => static function ($self, $stackPos) { + $self->semValue = new Name\FullyQualified(\substr($self->semStack[$stackPos - (1 - 1)], 1), $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 524 => static function ($self, $stackPos) { + $self->semValue = new Name\Relative(\substr($self->semStack[$stackPos - (1 - 1)], 10), $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 525 => null, 526 => null, 527 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 528 => static function ($self, $stackPos) { + $self->semValue = new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + $self->errorState = 2; + }, 529 => null, 530 => null, 531 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 532 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + foreach ($self->semValue as $s) { + if ($s instanceof Node\InterpolatedStringPart) { + $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', $self->phpVersion->supportsUnicodeEscapes()); + } + } + }, 533 => static function ($self, $stackPos) { + foreach ($self->semStack[$stackPos - (1 - 1)] as $s) { + if ($s instanceof Node\InterpolatedStringPart) { + $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', $self->phpVersion->supportsUnicodeEscapes()); + } + } + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + }, 534 => static function ($self, $stackPos) { + $self->semValue = array(); + }, 535 => null, 536 => static function ($self, $stackPos) { + $self->semValue = new Expr\ConstFetch($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 537 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Line($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 538 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\File($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 539 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Dir($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 540 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Class_($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 541 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Trait_($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 542 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Method($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 543 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Function_($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 544 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Namespace_($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 545 => static function ($self, $stackPos) { + $self->semValue = new Scalar\MagicConst\Property($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 546 => static function ($self, $stackPos) { + $self->semValue = new Expr\ClassConstFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 547 => static function ($self, $stackPos) { + $self->semValue = new Expr\ClassConstFetch($self->semStack[$stackPos - (5 - 1)], $self->semStack[$stackPos - (5 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (5 - 1)], $self->tokenEndStack[$stackPos])); + }, 548 => static function ($self, $stackPos) { + $self->semValue = new Expr\ClassConstFetch($self->semStack[$stackPos - (3 - 1)], new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos - (3 - 3)], $self->tokenEndStack[$stackPos - (3 - 3)])), $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + $self->errorState = 2; + }, 549 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos]); + $attrs['kind'] = Expr\Array_::KIND_SHORT; + $self->semValue = new Expr\Array_($self->semStack[$stackPos - (3 - 2)], $attrs); + }, 550 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos]); + $attrs['kind'] = Expr\Array_::KIND_LONG; + $self->semValue = new Expr\Array_($self->semStack[$stackPos - (4 - 3)], $attrs); + $self->createdArrays->attach($self->semValue); + }, 551 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + $self->createdArrays->attach($self->semValue); + }, 552 => static function ($self, $stackPos) { + $self->semValue = Scalar\String_::fromString($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos]), $self->phpVersion->supportsUnicodeEscapes()); + }, 553 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos]); + $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; + foreach ($self->semStack[$stackPos - (3 - 2)] as $s) { + if ($s instanceof Node\InterpolatedStringPart) { + $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', $self->phpVersion->supportsUnicodeEscapes()); + } + } + $self->semValue = new Scalar\InterpolatedString($self->semStack[$stackPos - (3 - 2)], $attrs); + }, 554 => static function ($self, $stackPos) { + $self->semValue = $self->parseLNumber($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos]), $self->phpVersion->allowsInvalidOctals()); + }, 555 => static function ($self, $stackPos) { + $self->semValue = Scalar\Float_::fromString($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 556 => null, 557 => null, 558 => null, 559 => static function ($self, $stackPos) { + $self->semValue = $self->parseDocString($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 2)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos]), $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 3)], $self->tokenEndStack[$stackPos - (3 - 3)]), \true); + }, 560 => static function ($self, $stackPos) { + $self->semValue = $self->parseDocString($self->semStack[$stackPos - (2 - 1)], '', $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos]), $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 2)], $self->tokenEndStack[$stackPos - (2 - 2)]), \true); + }, 561 => static function ($self, $stackPos) { + $self->semValue = $self->parseDocString($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 2)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos]), $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 3)], $self->tokenEndStack[$stackPos - (3 - 3)]), \true); + }, 562 => static function ($self, $stackPos) { + $self->semValue = null; + }, 563 => null, 564 => null, 565 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 566 => null, 567 => null, 568 => null, 569 => null, 570 => null, 571 => null, 572 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 573 => null, 574 => null, 575 => null, 576 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 577 => null, 578 => static function ($self, $stackPos) { + $self->semValue = new Expr\MethodCall($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 579 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafeMethodCall($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->semStack[$stackPos - (4 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 580 => static function ($self, $stackPos) { + $self->semValue = null; + }, 581 => null, 582 => null, 583 => null, 584 => static function ($self, $stackPos) { + $self->semValue = new Expr\PropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 585 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafePropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 586 => null, 587 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 588 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 589 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable(new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])), $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + $self->errorState = 2; + }, 590 => static function ($self, $stackPos) { + $var = $self->semStack[$stackPos - (1 - 1)]->name; + $self->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])) : $var; + }, 591 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticPropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 592 => null, 593 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 594 => static function ($self, $stackPos) { + $self->semValue = new Expr\PropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 595 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafePropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 596 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticPropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 597 => static function ($self, $stackPos) { + $self->semValue = new Expr\StaticPropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 598 => null, 599 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 600 => null, 601 => null, 602 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 603 => null, 604 => static function ($self, $stackPos) { + $self->semValue = new Expr\Error($self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + $self->errorState = 2; + }, 605 => static function ($self, $stackPos) { + $self->semValue = new Expr\List_($self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + $self->semValue->setAttribute('kind', Expr\List_::KIND_LIST); + $self->postprocessList($self->semValue); + }, 606 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (1 - 1)]; + $end = \count($self->semValue) - 1; + if ($self->semValue[$end]->value instanceof Expr\Error) { + \array_pop($self->semValue); + } + }, 607 => null, 608 => static function ($self, $stackPos) { + /* do nothing -- prevent default action of $$=$self->semStack[$1]. See $551. */ + }, 609 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (3 - 1)][] = $self->semStack[$stackPos - (3 - 3)]; + $self->semValue = $self->semStack[$stackPos - (3 - 1)]; + }, 610 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 611 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (1 - 1)], null, \false, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 612 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (2 - 2)], null, \true, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 613 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (1 - 1)], null, \false, $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 614 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (3 - 3)], $self->semStack[$stackPos - (3 - 1)], \false, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 615 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (4 - 4)], $self->semStack[$stackPos - (4 - 1)], \true, $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 616 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (3 - 3)], $self->semStack[$stackPos - (3 - 1)], \false, $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 617 => static function ($self, $stackPos) { + $self->semValue = new Node\ArrayItem($self->semStack[$stackPos - (2 - 2)], null, \false, $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos]), \true); + }, 618 => static function ($self, $stackPos) { + /* Create an Error node now to remember the position. We'll later either report an error, + or convert this into a null element, depending on whether this is a creation or destructuring context. */ + $attrs = $self->createEmptyElemAttributes($self->tokenPos); + $self->semValue = new Node\ArrayItem(new Expr\Error($attrs), null, \false, $attrs); + }, 619 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 620 => static function ($self, $stackPos) { + $self->semStack[$stackPos - (2 - 1)][] = $self->semStack[$stackPos - (2 - 2)]; + $self->semValue = $self->semStack[$stackPos - (2 - 1)]; + }, 621 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (1 - 1)]); + }, 622 => static function ($self, $stackPos) { + $self->semValue = array($self->semStack[$stackPos - (2 - 1)], $self->semStack[$stackPos - (2 - 2)]); + }, 623 => static function ($self, $stackPos) { + $attrs = $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos]); + $attrs['rawValue'] = $self->semStack[$stackPos - (1 - 1)]; + $self->semValue = new Node\InterpolatedStringPart($self->semStack[$stackPos - (1 - 1)], $attrs); + }, 624 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 625 => null, 626 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos - (4 - 1)], $self->semStack[$stackPos - (4 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (4 - 1)], $self->tokenEndStack[$stackPos])); + }, 627 => static function ($self, $stackPos) { + $self->semValue = new Expr\PropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 628 => static function ($self, $stackPos) { + $self->semValue = new Expr\NullsafePropertyFetch($self->semStack[$stackPos - (3 - 1)], $self->semStack[$stackPos - (3 - 3)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 629 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 630 => static function ($self, $stackPos) { + $self->semValue = new Expr\Variable($self->semStack[$stackPos - (3 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (3 - 1)], $self->tokenEndStack[$stackPos])); + }, 631 => static function ($self, $stackPos) { + $self->semValue = new Expr\ArrayDimFetch($self->semStack[$stackPos - (6 - 2)], $self->semStack[$stackPos - (6 - 4)], $self->getAttributes($self->tokenStartStack[$stackPos - (6 - 1)], $self->tokenEndStack[$stackPos])); + }, 632 => static function ($self, $stackPos) { + $self->semValue = $self->semStack[$stackPos - (3 - 2)]; + }, 633 => static function ($self, $stackPos) { + $self->semValue = new Scalar\String_($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 634 => static function ($self, $stackPos) { + $self->semValue = $self->parseNumString($self->semStack[$stackPos - (1 - 1)], $self->getAttributes($self->tokenStartStack[$stackPos - (1 - 1)], $self->tokenEndStack[$stackPos])); + }, 635 => static function ($self, $stackPos) { + $self->semValue = $self->parseNumString('-' . $self->semStack[$stackPos - (2 - 2)], $self->getAttributes($self->tokenStartStack[$stackPos - (2 - 1)], $self->tokenEndStack[$stackPos])); + }, 636 => null]; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php b/vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php deleted file mode 100644 index b76a5d94c8a..00000000000 --- a/vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php +++ /dev/null @@ -1,148 +0,0 @@ - Map of PHP token IDs to drop */ + protected array $dropTokens; + /** @var int[] Map of external symbols (static::T_*) to internal symbols */ + protected array $tokenToSymbol; /** @var string[] Map of symbols to their names */ - protected $symbolToName; - /** @var array Names of the production rules (only necessary for debugging) */ - protected $productions; + protected array $symbolToName; + /** @var array Names of the production rules (only necessary for debugging) */ + protected array $productions; /** @var int[] Map of states to a displacement into the $action table. The corresponding action for this * state/symbol pair is $action[$actionBase[$state] + $symbol]. If $actionBase[$state] is 0, the * action is defaulted, i.e. $actionDefault[$state] should be used instead. */ - protected $actionBase; + protected array $actionBase; /** @var int[] Table of actions. Indexed according to $actionBase comment. */ - protected $action; + protected array $action; /** @var int[] Table indexed analogously to $action. If $actionCheck[$actionBase[$state] + $symbol] != $symbol * then the action is defaulted, i.e. $actionDefault[$state] should be used instead. */ - protected $actionCheck; + protected array $actionCheck; /** @var int[] Map of states to their default action */ - protected $actionDefault; + protected array $actionDefault; /** @var callable[] Semantic action callbacks */ - protected $reduceCallbacks; + protected array $reduceCallbacks; /** @var int[] Map of non-terminals to a displacement into the $goto table. The corresponding goto state for this * non-terminal/state pair is $goto[$gotoBase[$nonTerminal] + $state] (unless defaulted) */ - protected $gotoBase; + protected array $gotoBase; /** @var int[] Table of states to goto after reduction. Indexed according to $gotoBase comment. */ - protected $goto; + protected array $goto; /** @var int[] Table indexed analogously to $goto. If $gotoCheck[$gotoBase[$nonTerminal] + $state] != $nonTerminal * then the goto state is defaulted, i.e. $gotoDefault[$nonTerminal] should be used. */ - protected $gotoCheck; + protected array $gotoCheck; /** @var int[] Map of non-terminals to the default state to goto after their reduction */ - protected $gotoDefault; + protected array $gotoDefault; /** @var int[] Map of rules to the non-terminal on their left-hand side, i.e. the non-terminal to use for * determining the state to goto after reduction. */ - protected $ruleToNonTerminal; + protected array $ruleToNonTerminal; /** @var int[] Map of rules to the length of their right-hand side, which is the number of elements that have to * be popped from the stack(s) on reduction. */ - protected $ruleToLength; + protected array $ruleToLength; /* * The following members are part of the parser state: */ - /** @var Lexer Lexer that is used when parsing */ - protected $lexer; /** @var mixed Temporary value containing the result of last semantic action (reduction) */ protected $semValue; - /** @var array Semantic value stack (contains values of tokens and semantic action results) */ - protected $semStack; - /** @var array[] Start attribute stack */ - protected $startAttributeStack; - /** @var array[] End attribute stack */ - protected $endAttributeStack; - /** @var array End attributes of last *shifted* token */ - protected $endAttributes; - /** @var array Start attributes of last *read* token */ - protected $lookaheadStartAttributes; + /** @var mixed[] Semantic value stack (contains values of tokens and semantic action results) */ + protected array $semStack; + /** @var int[] Token start position stack */ + protected array $tokenStartStack; + /** @var int[] Token end position stack */ + protected array $tokenEndStack; /** @var ErrorHandler Error handler */ - protected $errorHandler; + protected \PhpParser\ErrorHandler $errorHandler; /** @var int Error state, used to avoid error floods */ - protected $errorState; + protected int $errorState; + /** @var \SplObjectStorage|null Array nodes created during parsing, for postprocessing of empty elements. */ + protected ?\SplObjectStorage $createdArrays; + /** @var Token[] Tokens for the current parse */ + protected array $tokens; + /** @var int Current position in token array */ + protected int $tokenPos; /** * Initialize $reduceCallbacks map. */ - protected abstract function initReduceCallbacks(); + protected abstract function initReduceCallbacks() : void; /** * Creates a parser instance. * - * Options: Currently none. + * Options: + * * phpVersion: ?PhpVersion, * * @param Lexer $lexer A lexer - * @param array $options Options array. + * @param PhpVersion $phpVersion PHP version to target, defaults to latest supported. This + * option is best-effort: Even if specified, parsing will generally assume the latest + * supported version and only adjust behavior in minor ways, for example by omitting + * errors in older versions and interpreting type hints as a name or identifier depending + * on version. */ - public function __construct(\PhpParser\Lexer $lexer, array $options = []) + public function __construct(\PhpParser\Lexer $lexer, ?\PhpParser\PhpVersion $phpVersion = null) { $this->lexer = $lexer; - if (isset($options['throwOnError'])) { - throw new \LogicException('"throwOnError" is no longer supported, use "errorHandler" instead'); - } + $this->phpVersion = $phpVersion ?? \PhpParser\PhpVersion::getNewestSupported(); $this->initReduceCallbacks(); + $this->phpTokenToSymbol = $this->createTokenMap(); + $this->dropTokens = \array_fill_keys([\T_WHITESPACE, \T_OPEN_TAG, \T_COMMENT, \T_DOC_COMMENT, \T_BAD_CHARACTER], \true); } /** * Parses PHP code into a node tree. @@ -139,32 +158,49 @@ abstract class ParserAbstract implements \PhpParser\Parser * @return Node\Stmt[]|null Array of statements (or null non-throwing error handler is used and * the parser was unable to recover from an error). */ - public function parse(string $code, ?\PhpParser\ErrorHandler $errorHandler = null) + public function parse(string $code, ?\PhpParser\ErrorHandler $errorHandler = null) : ?array { $this->errorHandler = $errorHandler ?: new \PhpParser\ErrorHandler\Throwing(); - $this->lexer->startLexing($code, $this->errorHandler); + $this->createdArrays = new \SplObjectStorage(); + $this->tokens = $this->lexer->tokenize($code, $this->errorHandler); $result = $this->doParse(); + // Report errors for any empty elements used inside arrays. This is delayed until after the main parse, + // because we don't know a priori whether a given array expression will be used in a destructuring context + // or not. + foreach ($this->createdArrays as $node) { + foreach ($node->items as $item) { + if ($item->value instanceof Expr\Error) { + $this->errorHandler->handleError(new \PhpParser\Error('Cannot use empty array elements in arrays', $item->getAttributes())); + } + } + } // Clear out some of the interior state, so we don't hold onto unnecessary // memory between uses of the parser - $this->startAttributeStack = []; - $this->endAttributeStack = []; + $this->tokenStartStack = []; + $this->tokenEndStack = []; $this->semStack = []; $this->semValue = null; + $this->createdArrays = null; + if ($result !== null) { + $traverser = new \PhpParser\NodeTraverser(new CommentAnnotatingVisitor($this->tokens)); + $traverser->traverse($result); + } return $result; } - protected function doParse() + public function getTokens() : array + { + return $this->tokens; + } + /** @return Stmt[]|null */ + protected function doParse() : ?array { // We start off with no lookahead-token $symbol = self::SYMBOL_NONE; - // The attributes for a node are taken from the first and last token of the node. - // From the first token only the startAttributes are taken and from the last only - // the endAttributes. Both are merged using the array union operator (+). - $startAttributes = []; - $endAttributes = []; - $this->endAttributes = $endAttributes; + $tokenValue = null; + $this->tokenPos = -1; // Keep stack of start and end attributes - $this->startAttributeStack = []; - $this->endAttributeStack = [$endAttributes]; + $this->tokenStartStack = []; + $this->tokenEndStack = [0]; // Start off in the initial state and keep a stack of previous states $state = 0; $stateStack = [$state]; @@ -179,18 +215,16 @@ abstract class ParserAbstract implements \PhpParser\Parser $rule = $this->actionDefault[$state]; } else { if ($symbol === self::SYMBOL_NONE) { - // Fetch the next token id from the lexer and fetch additional info by-ref. - // The end attributes are fetched into a temporary variable and only set once the token is really - // shifted (not during read). Otherwise you would sometimes get off-by-one errors, when a rule is - // reduced after a token was read but not yet shifted. - $tokenId = $this->lexer->getNextToken($tokenValue, $startAttributes, $endAttributes); - // map the lexer token id to the internally used symbols - $symbol = $tokenId >= 0 && $tokenId < $this->tokenToSymbolMapSize ? $this->tokenToSymbol[$tokenId] : $this->invalidSymbol; - if ($symbol === $this->invalidSymbol) { + do { + $token = $this->tokens[++$this->tokenPos]; + $tokenId = \is_array($token) ? $token[0] : $token; + } while (isset($this->dropTokens[$tokenId])); + // Map the lexer token id to the internally used symbols. + $tokenValue = \is_array($token) ? $token[1] : $token; + if (!isset($this->phpTokenToSymbol[$tokenId])) { throw new \RangeException(\sprintf('The lexer returned an invalid token (id=%d, value=%s)', $tokenId, $tokenValue)); } - // Allow productions to access the start attributes of the lookahead token. - $this->lookaheadStartAttributes = $startAttributes; + $symbol = $this->phpTokenToSymbol[$tokenId]; //$this->traceRead($symbol); } $idx = $this->actionBase[$state] + $symbol; @@ -208,9 +242,8 @@ abstract class ParserAbstract implements \PhpParser\Parser ++$stackPos; $stateStack[$stackPos] = $state = $action; $this->semStack[$stackPos] = $tokenValue; - $this->startAttributeStack[$stackPos] = $startAttributes; - $this->endAttributeStack[$stackPos] = $endAttributes; - $this->endAttributes = $endAttributes; + $this->tokenStartStack[$stackPos] = $this->tokenPos; + $this->tokenEndStack[$stackPos] = $this->tokenPos; $symbol = self::SYMBOL_NONE; if ($this->errorState) { --$this->errorState; @@ -232,22 +265,28 @@ abstract class ParserAbstract implements \PhpParser\Parser /* accept */ //$this->traceAccept(); return $this->semValue; - } elseif ($rule !== $this->unexpectedTokenRule) { + } + if ($rule !== $this->unexpectedTokenRule) { /* reduce */ //$this->traceReduce($rule); + $ruleLength = $this->ruleToLength[$rule]; try { - $this->reduceCallbacks[$rule]($stackPos); + $callback = $this->reduceCallbacks[$rule]; + if ($callback !== null) { + $callback($this, $stackPos); + } elseif ($ruleLength > 0) { + $this->semValue = $this->semStack[$stackPos - $ruleLength + 1]; + } } catch (\PhpParser\Error $e) { - if (-1 === $e->getStartLine() && isset($startAttributes['startLine'])) { - $e->setStartLine($startAttributes['startLine']); + if (-1 === $e->getStartLine()) { + $e->setStartLine($this->tokens[$this->tokenPos]->line); } $this->emitError($e); // Can't recover from this type of error return null; } /* Goto - shift nonterminal */ - $lastEndAttributes = $this->endAttributeStack[$stackPos]; - $ruleLength = $this->ruleToLength[$rule]; + $lastTokenEnd = $this->tokenEndStack[$stackPos]; $stackPos -= $ruleLength; $nonTerminal = $this->ruleToNonTerminal[$rule]; $idx = $this->gotoBase[$nonTerminal] + $stateStack[$stackPos]; @@ -259,18 +298,19 @@ abstract class ParserAbstract implements \PhpParser\Parser ++$stackPos; $stateStack[$stackPos] = $state; $this->semStack[$stackPos] = $this->semValue; - $this->endAttributeStack[$stackPos] = $lastEndAttributes; + $this->tokenEndStack[$stackPos] = $lastTokenEnd; if ($ruleLength === 0) { // Empty productions use the start attributes of the lookahead token. - $this->startAttributeStack[$stackPos] = $this->lookaheadStartAttributes; + $this->tokenStartStack[$stackPos] = $this->tokenPos; } } else { /* error */ switch ($this->errorState) { case 0: $msg = $this->getErrorMessage($symbol, $state); - $this->emitError(new \PhpParser\Error($msg, $startAttributes + $endAttributes)); + $this->emitError(new \PhpParser\Error($msg, $this->getAttributesForToken($this->tokenPos))); // Break missing intentionally + // no break case 1: case 2: $this->errorState = 3; @@ -289,9 +329,8 @@ abstract class ParserAbstract implements \PhpParser\Parser $stateStack[$stackPos] = $state = $action; // We treat the error symbol as being empty, so we reset the end attributes // to the end attributes of the last non-error symbol - $this->startAttributeStack[$stackPos] = $this->lookaheadStartAttributes; - $this->endAttributeStack[$stackPos] = $this->endAttributeStack[$stackPos - 1]; - $this->endAttributes = $this->endAttributeStack[$stackPos - 1]; + $this->tokenStartStack[$stackPos] = $this->tokenPos; + $this->tokenEndStack[$stackPos] = $this->tokenEndStack[$stackPos - 1]; break; case 3: if ($symbol === 0) { @@ -312,7 +351,7 @@ abstract class ParserAbstract implements \PhpParser\Parser } throw new \RuntimeException('Reached end of parser loop'); } - protected function emitError(\PhpParser\Error $error) + protected function emitError(\PhpParser\Error $error) : void { $this->errorHandler->handleError($error); } @@ -320,7 +359,7 @@ abstract class ParserAbstract implements \PhpParser\Parser * Format error message including expected tokens. * * @param int $symbol Unexpected symbol - * @param int $state State at time of error + * @param int $state State at time of error * * @return string Formatted error message */ @@ -357,36 +396,63 @@ abstract class ParserAbstract implements \PhpParser\Parser } return $expected; } + /** + * Get attributes for a node with the given start and end token positions. + * + * @param int $tokenStartPos Token position the node starts at + * @param int $tokenEndPos Token position the node ends at + * @return array Attributes + */ + protected function getAttributes(int $tokenStartPos, int $tokenEndPos) : array + { + $startToken = $this->tokens[$tokenStartPos]; + $afterEndToken = $this->tokens[$tokenEndPos + 1]; + return ['startLine' => $startToken->line, 'startTokenPos' => $tokenStartPos, 'startFilePos' => $startToken->pos, 'endLine' => $afterEndToken->line, 'endTokenPos' => $tokenEndPos, 'endFilePos' => $afterEndToken->pos - 1]; + } + /** + * Get attributes for a single token at the given token position. + * + * @return array Attributes + */ + protected function getAttributesForToken(int $tokenPos) : array + { + if ($tokenPos < \count($this->tokens) - 1) { + return $this->getAttributes($tokenPos, $tokenPos); + } + // Get attributes for the sentinel token. + $token = $this->tokens[$tokenPos]; + return ['startLine' => $token->line, 'startTokenPos' => $tokenPos, 'startFilePos' => $token->pos, 'endLine' => $token->line, 'endTokenPos' => $tokenPos, 'endFilePos' => $token->pos]; + } /* * Tracing functions used for debugging the parser. */ /* - protected function traceNewState($state, $symbol) { + protected function traceNewState($state, $symbol): void { echo '% State ' . $state . ', Lookahead ' . ($symbol == self::SYMBOL_NONE ? '--none--' : $this->symbolToName[$symbol]) . "\n"; } - protected function traceRead($symbol) { + protected function traceRead($symbol): void { echo '% Reading ' . $this->symbolToName[$symbol] . "\n"; } - protected function traceShift($symbol) { + protected function traceShift($symbol): void { echo '% Shift ' . $this->symbolToName[$symbol] . "\n"; } - protected function traceAccept() { + protected function traceAccept(): void { echo "% Accepted.\n"; } - protected function traceReduce($n) { + protected function traceReduce($n): void { echo '% Reduce by (' . $n . ') ' . $this->productions[$n] . "\n"; } - protected function tracePop($state) { + protected function tracePop($state): void { echo '% Recovering, uncovered state ' . $state . "\n"; } - protected function traceDiscard($symbol) { + protected function traceDiscard($symbol): void { echo '% Discard ' . $this->symbolToName[$symbol] . "\n"; } */ @@ -406,7 +472,8 @@ abstract class ParserAbstract implements \PhpParser\Parser if (null === $style) { // not namespaced, nothing to do return $stmts; - } elseif ('brace' === $style) { + } + if ('brace' === $style) { // For braced namespaces we only have to check that there are no invalid statements between the namespaces $afterFirstNamespace = \false; foreach ($stmts as $stmt) { @@ -452,7 +519,7 @@ abstract class ParserAbstract implements \PhpParser\Parser return $resultStmts; } } - private function fixupNamespaceAttributes(\PhpParser\Node\Stmt\Namespace_ $stmt) + private function fixupNamespaceAttributes(\PhpParser\Node\Stmt\Namespace_ $stmt) : void { // We moved the statements into the namespace node, as such the end of the namespace node // needs to be extended to the end of the statements. @@ -469,6 +536,22 @@ abstract class ParserAbstract implements \PhpParser\Parser } } } + /** @return array */ + private function getNamespaceErrorAttributes(Namespace_ $node) : array + { + $attrs = $node->getAttributes(); + // Adjust end attributes to only cover the "namespace" keyword, not the whole namespace. + if (isset($attrs['startLine'])) { + $attrs['endLine'] = $attrs['startLine']; + } + if (isset($attrs['startTokenPos'])) { + $attrs['endTokenPos'] = $attrs['startTokenPos']; + } + if (isset($attrs['startFilePos'])) { + $attrs['endFilePos'] = $attrs['startFilePos'] + \strlen('namespace') - 1; + } + return $attrs; + } /** * Determine namespacing style (semicolon or brace) * @@ -476,7 +559,7 @@ abstract class ParserAbstract implements \PhpParser\Parser * * @return null|string One of "semicolon", "brace" or null (no namespaces) */ - private function getNamespacingStyle(array $stmts) + private function getNamespacingStyle(array $stmts) : ?string { $style = null; $hasNotAllowedStmts = \false; @@ -486,10 +569,10 @@ abstract class ParserAbstract implements \PhpParser\Parser if (null === $style) { $style = $currentStyle; if ($hasNotAllowedStmts) { - $this->emitError(new \PhpParser\Error('Namespace declaration statement has to be the very first statement in the script', $stmt->getLine())); + $this->emitError(new \PhpParser\Error('Namespace declaration statement has to be the very first statement in the script', $this->getNamespaceErrorAttributes($stmt))); } } elseif ($style !== $currentStyle) { - $this->emitError(new \PhpParser\Error('Cannot mix bracketed namespace declarations with unbracketed namespace declarations', $stmt->getLine())); + $this->emitError(new \PhpParser\Error('Cannot mix bracketed namespace declarations with unbracketed namespace declarations', $this->getNamespaceErrorAttributes($stmt))); // Treat like semicolon style for namespace normalization return 'semicolon'; } @@ -508,64 +591,14 @@ abstract class ParserAbstract implements \PhpParser\Parser } return $style; } - /** - * Fix up parsing of static property calls in PHP 5. - * - * In PHP 5 A::$b[c][d] and A::$b[c][d]() have very different interpretation. The former is - * interpreted as (A::$b)[c][d], while the latter is the same as A::{$b[c][d]}(). We parse the - * latter as the former initially and this method fixes the AST into the correct form when we - * encounter the "()". - * - * @param Node\Expr\StaticPropertyFetch|Node\Expr\ArrayDimFetch $prop - * @param Node\Arg[] $args - * @param array $attributes - * - * @return Expr\StaticCall - */ - protected function fixupPhp5StaticPropCall($prop, array $args, array $attributes) : Expr\StaticCall - { - if ($prop instanceof \PhpParser\Node\Expr\StaticPropertyFetch) { - $name = $prop->name instanceof VarLikeIdentifier ? $prop->name->toString() : $prop->name; - $var = new Expr\Variable($name, $prop->name->getAttributes()); - return new Expr\StaticCall($prop->class, $var, $args, $attributes); - } elseif ($prop instanceof \PhpParser\Node\Expr\ArrayDimFetch) { - $tmp = $prop; - while ($tmp->var instanceof \PhpParser\Node\Expr\ArrayDimFetch) { - $tmp = $tmp->var; - } - /** @var Expr\StaticPropertyFetch $staticProp */ - $staticProp = $tmp->var; - // Set start attributes to attributes of innermost node - $tmp = $prop; - $this->fixupStartAttributes($tmp, $staticProp->name); - while ($tmp->var instanceof \PhpParser\Node\Expr\ArrayDimFetch) { - $tmp = $tmp->var; - $this->fixupStartAttributes($tmp, $staticProp->name); - } - $name = $staticProp->name instanceof VarLikeIdentifier ? $staticProp->name->toString() : $staticProp->name; - $tmp->var = new Expr\Variable($name, $staticProp->name->getAttributes()); - return new Expr\StaticCall($staticProp->class, $prop, $args, $attributes); - } else { - throw new \Exception(); - } - } - protected function fixupStartAttributes(\PhpParser\Node $to, \PhpParser\Node $from) - { - $startAttributes = ['startLine', 'startFilePos', 'startTokenPos']; - foreach ($startAttributes as $startAttribute) { - if ($from->hasAttribute($startAttribute)) { - $to->setAttribute($startAttribute, $from->getAttribute($startAttribute)); - } - } - } + /** @return Name|Identifier */ protected function handleBuiltinTypes(Name $name) { - $builtinTypes = ['bool' => \true, 'int' => \true, 'float' => \true, 'string' => \true, 'iterable' => \true, 'void' => \true, 'object' => \true, 'null' => \true, 'false' => \true, 'mixed' => \true, 'never' => \true, 'true' => \true]; if (!$name->isUnqualified()) { return $name; } $lowerName = $name->toLowerString(); - if (!isset($builtinTypes[$lowerName])) { + if (!$this->phpVersion->supportsBuiltinType($lowerName)) { return $name; } return new \PhpParser\Node\Identifier($lowerName, $name->getAttributes()); @@ -573,13 +606,13 @@ abstract class ParserAbstract implements \PhpParser\Parser /** * Get combined start and end attributes at a stack location * - * @param int $pos Stack location + * @param int $stackPos Stack location * - * @return array Combined start and end attributes + * @return array Combined start and end attributes */ - protected function getAttributesAt(int $pos) : array + protected function getAttributesAt(int $stackPos) : array { - return $this->startAttributeStack[$pos] + $this->endAttributeStack[$pos]; + return $this->getAttributes($this->tokenStartStack[$stackPos], $this->tokenEndStack[$stackPos]); } protected function getFloatCastKind(string $cast) : int { @@ -592,23 +625,24 @@ abstract class ParserAbstract implements \PhpParser\Parser } return Double::KIND_DOUBLE; } - protected function parseLNumber($str, $attributes, $allowInvalidOctal = \false) + /** @param array $attributes */ + protected function parseLNumber(string $str, array $attributes, bool $allowInvalidOctal = \false) : Int_ { try { - return LNumber::fromString($str, $attributes, $allowInvalidOctal); + return Int_::fromString($str, $attributes, $allowInvalidOctal); } catch (\PhpParser\Error $error) { $this->emitError($error); // Use dummy value - return new LNumber(0, $attributes); + return new Int_(0, $attributes); } } /** * Parse a T_NUM_STRING token into either an integer or string node. * - * @param string $str Number string - * @param array $attributes Attributes + * @param string $str Number string + * @param array $attributes Attributes * - * @return LNumber|String_ Integer or string node. + * @return Int_|String_ Integer or string node. */ protected function parseNumString(string $str, array $attributes) { @@ -619,9 +653,10 @@ abstract class ParserAbstract implements \PhpParser\Parser if (!\is_int($num)) { return new String_($str, $attributes); } - return new LNumber($num, $attributes); + return new Int_($num, $attributes); } - protected function stripIndentation(string $string, int $indentLen, string $indentChar, bool $newlineAtStart, bool $newlineAtEnd, array $attributes) + /** @param array $attributes */ + protected function stripIndentation(string $string, int $indentLen, string $indentChar, bool $newlineAtStart, bool $newlineAtEnd, array $attributes) : string { if ($indentLen === 0) { return $string; @@ -639,7 +674,12 @@ abstract class ParserAbstract implements \PhpParser\Parser return \substr($matches[0], \strlen($prefix)); }, $string); } - protected function parseDocString(string $startToken, $contents, string $endToken, array $attributes, array $endTokenAttributes, bool $parseUnicodeEscape) + /** + * @param string|(Expr|InterpolatedStringPart)[] $contents + * @param array $attributes + * @param array $endTokenAttributes + */ + protected function parseDocString(string $startToken, $contents, string $endToken, array $attributes, array $endTokenAttributes, bool $parseUnicodeEscape) : Expr { $kind = \strpos($startToken, "'") === \false ? String_::KIND_HEREDOC : String_::KIND_NOWDOC; $regex = '/\\A[bB]?<<<[ \\t]*[\'"]?([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*)[\'"]?(?:\\r\\n|\\n|\\r)\\z/'; @@ -663,67 +703,136 @@ abstract class ParserAbstract implements \PhpParser\Parser $indentChar = $indentHasSpaces ? " " : "\t"; if (\is_string($contents)) { if ($contents === '') { + $attributes['rawValue'] = $contents; return new String_('', $attributes); } $contents = $this->stripIndentation($contents, $indentLen, $indentChar, \true, \true, $attributes); $contents = \preg_replace('~(\\r\\n|\\n|\\r)\\z~', '', $contents); + $attributes['rawValue'] = $contents; if ($kind === String_::KIND_HEREDOC) { $contents = String_::parseEscapeSequences($contents, null, $parseUnicodeEscape); } return new String_($contents, $attributes); } else { \assert(\count($contents) > 0); - if (!$contents[0] instanceof \PhpParser\Node\Scalar\EncapsedStringPart) { + if (!$contents[0] instanceof \PhpParser\Node\InterpolatedStringPart) { // If there is no leading encapsed string part, pretend there is an empty one $this->stripIndentation('', $indentLen, $indentChar, \true, \false, $contents[0]->getAttributes()); } $newContents = []; foreach ($contents as $i => $part) { - if ($part instanceof \PhpParser\Node\Scalar\EncapsedStringPart) { + if ($part instanceof \PhpParser\Node\InterpolatedStringPart) { $isLast = $i === \count($contents) - 1; $part->value = $this->stripIndentation($part->value, $indentLen, $indentChar, $i === 0, $isLast, $part->getAttributes()); - $part->value = String_::parseEscapeSequences($part->value, null, $parseUnicodeEscape); if ($isLast) { $part->value = \preg_replace('~(\\r\\n|\\n|\\r)\\z~', '', $part->value); } + $part->setAttribute('rawValue', $part->value); + $part->value = String_::parseEscapeSequences($part->value, null, $parseUnicodeEscape); if ('' === $part->value) { continue; } } $newContents[] = $part; } - return new Encapsed($newContents, $attributes); + return new InterpolatedString($newContents, $attributes); } } - /** - * Create attributes for a zero-length common-capturing nop. - * - * @param Comment[] $comments - * @return array - */ - protected function createCommentNopAttributes(array $comments) + protected function createCommentFromToken(\PhpParser\Token $token, int $tokenPos) : \PhpParser\Comment { - $comment = $comments[\count($comments) - 1]; + \assert((\is_array($token) ? $token[0] : $token) === \T_COMMENT || (\is_array($token) ? $token[0] : $token) == \T_DOC_COMMENT); + return \T_DOC_COMMENT === (\is_array($token) ? $token[0] : $token) ? new \PhpParser\Comment\Doc(\is_array($token) ? $token[1] : $token, $token->line, $token->pos, $tokenPos, $token->getEndLine(), $token->getEndPos() - 1, $tokenPos) : new \PhpParser\Comment(\is_array($token) ? $token[1] : $token, $token->line, $token->pos, $tokenPos, $token->getEndLine(), $token->getEndPos() - 1, $tokenPos); + } + /** + * Get last comment before the given token position, if any + */ + protected function getCommentBeforeToken(int $tokenPos) : ?\PhpParser\Comment + { + while (--$tokenPos >= 0) { + $token = $this->tokens[$tokenPos]; + if (!isset($this->dropTokens[\is_array($token) ? $token[0] : $token])) { + break; + } + if ((\is_array($token) ? $token[0] : $token) === \T_COMMENT || (\is_array($token) ? $token[0] : $token) === \T_DOC_COMMENT) { + return $this->createCommentFromToken($token, $tokenPos); + } + } + return null; + } + /** + * Create a zero-length nop to capture preceding comments, if any. + */ + protected function maybeCreateZeroLengthNop(int $tokenPos) : ?Nop + { + $comment = $this->getCommentBeforeToken($tokenPos); + if ($comment === null) { + return null; + } $commentEndLine = $comment->getEndLine(); $commentEndFilePos = $comment->getEndFilePos(); $commentEndTokenPos = $comment->getEndTokenPos(); - $attributes = ['comments' => $comments]; - if (-1 !== $commentEndLine) { - $attributes['startLine'] = $commentEndLine; - $attributes['endLine'] = $commentEndLine; + $attributes = ['startLine' => $commentEndLine, 'endLine' => $commentEndLine, 'startFilePos' => $commentEndFilePos + 1, 'endFilePos' => $commentEndFilePos, 'startTokenPos' => $commentEndTokenPos + 1, 'endTokenPos' => $commentEndTokenPos]; + return new Nop($attributes); + } + protected function maybeCreateNop(int $tokenStartPos, int $tokenEndPos) : ?Nop + { + if ($this->getCommentBeforeToken($tokenStartPos) === null) { + return null; } - if (-1 !== $commentEndFilePos) { - $attributes['startFilePos'] = $commentEndFilePos + 1; - $attributes['endFilePos'] = $commentEndFilePos; + return new Nop($this->getAttributes($tokenStartPos, $tokenEndPos)); + } + protected function handleHaltCompiler() : string + { + // Prevent the lexer from returning any further tokens. + $nextToken = $this->tokens[$this->tokenPos + 1]; + $this->tokenPos = \count($this->tokens) - 2; + // Return text after __halt_compiler. + return (\is_array($nextToken) ? $nextToken[0] : $nextToken) === \T_INLINE_HTML ? \is_array($nextToken) ? $nextToken[1] : $nextToken : ''; + } + protected function inlineHtmlHasLeadingNewline(int $stackPos) : bool + { + $tokenPos = $this->tokenStartStack[$stackPos]; + $token = $this->tokens[$tokenPos]; + \assert((\is_array($token) ? $token[0] : $token) == \T_INLINE_HTML); + if ($tokenPos > 0) { + $prevToken = $this->tokens[$tokenPos - 1]; + \assert((\is_array($prevToken) ? $prevToken[0] : $prevToken) == \T_CLOSE_TAG); + return \false !== \strpos(\is_array($prevToken) ? $prevToken[1] : $prevToken, "\n") || \false !== \strpos(\is_array($prevToken) ? $prevToken[1] : $prevToken, "\r"); } - if (-1 !== $commentEndTokenPos) { - $attributes['startTokenPos'] = $commentEndTokenPos + 1; - $attributes['endTokenPos'] = $commentEndTokenPos; + return \true; + } + /** + * @return array + */ + protected function createEmptyElemAttributes(int $tokenPos) : array + { + return $this->getAttributesForToken($tokenPos); + } + protected function fixupArrayDestructuring(Array_ $node) : Expr\List_ + { + $this->createdArrays->detach($node); + return new Expr\List_(\array_map(function (\PhpParser\Node\ArrayItem $item) { + if ($item->value instanceof Expr\Error) { + // We used Error as a placeholder for empty elements, which are legal for destructuring. + return null; + } + if ($item->value instanceof Array_) { + return new \PhpParser\Node\ArrayItem($this->fixupArrayDestructuring($item->value), $item->key, $item->byRef, $item->getAttributes()); + } + return $item; + }, $node->items), ['kind' => Expr\List_::KIND_ARRAY] + $node->getAttributes()); + } + protected function postprocessList(Expr\List_ $node) : void + { + foreach ($node->items as $i => $item) { + if ($item->value instanceof Expr\Error) { + // We used Error as a placeholder for empty elements, which are legal for destructuring. + $node->items[$i] = null; + } } - return $attributes; } /** @param ElseIf_|Else_ $node */ - protected function fixupAlternativeElse($node) + protected function fixupAlternativeElse($node) : void { // Make sure a trailing nop statement carrying comments is part of the node. $numStmts = \count($node->stmts); @@ -740,38 +849,38 @@ abstract class ParserAbstract implements \PhpParser\Parser } } } - protected function checkClassModifier($a, $b, $modifierPos) + protected function checkClassModifier(int $a, int $b, int $modifierPos) : void { try { - Class_::verifyClassModifier($a, $b); + \PhpParser\Modifiers::verifyClassModifier($a, $b); } catch (\PhpParser\Error $error) { $error->setAttributes($this->getAttributesAt($modifierPos)); $this->emitError($error); } } - protected function checkModifier($a, $b, $modifierPos) + protected function checkModifier(int $a, int $b, int $modifierPos) : void { // Jumping through some hoops here because verifyModifier() is also used elsewhere try { - Class_::verifyModifier($a, $b); + \PhpParser\Modifiers::verifyModifier($a, $b); } catch (\PhpParser\Error $error) { $error->setAttributes($this->getAttributesAt($modifierPos)); $this->emitError($error); } } - protected function checkParam(Param $node) + protected function checkParam(Param $node) : void { if ($node->variadic && null !== $node->default) { $this->emitError(new \PhpParser\Error('Variadic parameter cannot have a default value', $node->default->getAttributes())); } } - protected function checkTryCatch(TryCatch $node) + protected function checkTryCatch(TryCatch $node) : void { if (empty($node->catches) && null === $node->finally) { $this->emitError(new \PhpParser\Error('Cannot use try without catch or finally', $node->getAttributes())); } } - protected function checkNamespace(Namespace_ $node) + protected function checkNamespace(Namespace_ $node) : void { if (null !== $node->stmts) { foreach ($node->stmts as $stmt) { @@ -781,13 +890,14 @@ abstract class ParserAbstract implements \PhpParser\Parser } } } - private function checkClassName($name, $namePos) + private function checkClassName(?Identifier $name, int $namePos) : void { if (null !== $name && $name->isSpecialClassName()) { $this->emitError(new \PhpParser\Error(\sprintf('Cannot use \'%s\' as class name as it is reserved', $name), $this->getAttributesAt($namePos))); } } - private function checkImplementedInterfaces(array $interfaces) + /** @param Name[] $interfaces */ + private function checkImplementedInterfaces(array $interfaces) : void { foreach ($interfaces as $interface) { if ($interface->isSpecialClassName()) { @@ -795,7 +905,7 @@ abstract class ParserAbstract implements \PhpParser\Parser } } } - protected function checkClass(Class_ $node, $namePos) + protected function checkClass(Class_ $node, int $namePos) : void { $this->checkClassName($node->name, $namePos); if ($node->extends && $node->extends->isSpecialClassName()) { @@ -803,19 +913,19 @@ abstract class ParserAbstract implements \PhpParser\Parser } $this->checkImplementedInterfaces($node->implements); } - protected function checkInterface(Interface_ $node, $namePos) + protected function checkInterface(Interface_ $node, int $namePos) : void { $this->checkClassName($node->name, $namePos); $this->checkImplementedInterfaces($node->extends); } - protected function checkEnum(Enum_ $node, $namePos) + protected function checkEnum(Enum_ $node, int $namePos) : void { $this->checkClassName($node->name, $namePos); $this->checkImplementedInterfaces($node->implements); } - protected function checkClassMethod(ClassMethod $node, $modifierPos) + protected function checkClassMethod(ClassMethod $node, int $modifierPos) : void { - if ($node->flags & Class_::MODIFIER_STATIC) { + if ($node->flags & \PhpParser\Modifiers::STATIC) { switch ($node->name->toLowerString()) { case '__construct': $this->emitError(new \PhpParser\Error(\sprintf('Constructor %s() cannot be static', $node->name), $this->getAttributesAt($modifierPos))); @@ -828,35 +938,113 @@ abstract class ParserAbstract implements \PhpParser\Parser break; } } - if ($node->flags & Class_::MODIFIER_READONLY) { + if ($node->flags & \PhpParser\Modifiers::READONLY) { $this->emitError(new \PhpParser\Error(\sprintf('Method %s() cannot be readonly', $node->name), $this->getAttributesAt($modifierPos))); } } - protected function checkClassConst(ClassConst $node, $modifierPos) + protected function checkClassConst(ClassConst $node, int $modifierPos) : void { - if ($node->flags & Class_::MODIFIER_STATIC) { - $this->emitError(new \PhpParser\Error("Cannot use 'static' as constant modifier", $this->getAttributesAt($modifierPos))); - } - if ($node->flags & Class_::MODIFIER_ABSTRACT) { - $this->emitError(new \PhpParser\Error("Cannot use 'abstract' as constant modifier", $this->getAttributesAt($modifierPos))); - } - if ($node->flags & Class_::MODIFIER_READONLY) { - $this->emitError(new \PhpParser\Error("Cannot use 'readonly' as constant modifier", $this->getAttributesAt($modifierPos))); + foreach ([\PhpParser\Modifiers::STATIC, \PhpParser\Modifiers::ABSTRACT, \PhpParser\Modifiers::READONLY] as $modifier) { + if ($node->flags & $modifier) { + $this->emitError(new \PhpParser\Error("Cannot use '" . \PhpParser\Modifiers::toString($modifier) . "' as constant modifier", $this->getAttributesAt($modifierPos))); + } } } - protected function checkProperty(Property $node, $modifierPos) - { - if ($node->flags & Class_::MODIFIER_ABSTRACT) { - $this->emitError(new \PhpParser\Error('Properties cannot be declared abstract', $this->getAttributesAt($modifierPos))); - } - if ($node->flags & Class_::MODIFIER_FINAL) { - $this->emitError(new \PhpParser\Error('Properties cannot be declared final', $this->getAttributesAt($modifierPos))); - } - } - protected function checkUseUse(UseUse $node, $namePos) + protected function checkUseUse(UseItem $node, int $namePos) : void { if ($node->alias && $node->alias->isSpecialClassName()) { $this->emitError(new \PhpParser\Error(\sprintf('Cannot use %s as %s because \'%2$s\' is a special class name', $node->name, $node->alias), $this->getAttributesAt($namePos))); } } + /** @param PropertyHook[] $hooks */ + protected function checkPropertyHookList(array $hooks, int $hookPos) : void + { + if (empty($hooks)) { + $this->emitError(new \PhpParser\Error('Property hook list cannot be empty', $this->getAttributesAt($hookPos))); + } + } + protected function checkPropertyHook(PropertyHook $hook, ?int $paramListPos) : void + { + $name = $hook->name->toLowerString(); + if ($name !== 'get' && $name !== 'set') { + $this->emitError(new \PhpParser\Error('Unknown hook "' . $hook->name . '", expected "get" or "set"', $hook->name->getAttributes())); + } + if ($name === 'get' && $paramListPos !== null) { + $this->emitError(new \PhpParser\Error('get hook must not have a parameter list', $this->getAttributesAt($paramListPos))); + } + } + protected function checkPropertyHookModifiers(int $a, int $b, int $modifierPos) : void + { + try { + \PhpParser\Modifiers::verifyModifier($a, $b); + } catch (\PhpParser\Error $error) { + $error->setAttributes($this->getAttributesAt($modifierPos)); + $this->emitError($error); + } + if ($b != \PhpParser\Modifiers::FINAL) { + $this->emitError(new \PhpParser\Error('Cannot use the ' . \PhpParser\Modifiers::toString($b) . ' modifier on a property hook', $this->getAttributesAt($modifierPos))); + } + } + /** @param array $args */ + private function isSimpleExit(array $args) : bool + { + if (\count($args) === 0) { + return \true; + } + if (\count($args) === 1) { + $arg = $args[0]; + return $arg instanceof Arg && $arg->name === null && $arg->byRef === \false && $arg->unpack === \false; + } + return \false; + } + /** + * @param array $args + * @param array $attrs + */ + protected function createExitExpr(string $name, int $namePos, array $args, array $attrs) : Expr + { + if ($this->isSimpleExit($args)) { + // Create Exit node for backwards compatibility. + $attrs['kind'] = \strtolower($name) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE; + return new Expr\Exit_(\count($args) === 1 ? $args[0]->value : null, $attrs); + } + return new Expr\FuncCall(new Name($name, $this->getAttributesAt($namePos)), $args, $attrs); + } + /** + * Creates the token map. + * + * The token map maps the PHP internal token identifiers + * to the identifiers used by the Parser. Additionally it + * maps T_OPEN_TAG_WITH_ECHO to T_ECHO and T_CLOSE_TAG to ';'. + * + * @return array The token map + */ + protected function createTokenMap() : array + { + $tokenMap = []; + // Single-char tokens use an identity mapping. + for ($i = 0; $i < 256; ++$i) { + $tokenMap[$i] = $i; + } + foreach ($this->symbolToName as $name) { + if ($name[0] === 'T') { + $tokenMap[\constant($name)] = \constant(static::class . '::' . $name); + } + } + // T_OPEN_TAG_WITH_ECHO with dropped T_OPEN_TAG results in T_ECHO + $tokenMap[\T_OPEN_TAG_WITH_ECHO] = static::T_ECHO; + // T_CLOSE_TAG is equivalent to ';' + $tokenMap[\T_CLOSE_TAG] = \ord(';'); + // We have created a map from PHP token IDs to external symbol IDs. + // Now map them to the internal symbol ID. + $fullTokenMap = []; + foreach ($tokenMap as $phpToken => $extSymbol) { + $intSymbol = $this->tokenToSymbol[$extSymbol]; + if ($intSymbol === $this->invalidSymbol) { + continue; + } + $fullTokenMap[$phpToken] = $intSymbol; + } + return $fullTokenMap; + } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php b/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php index 95e0e6d16d1..e05d2daa5b2 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php +++ b/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php @@ -3,66 +3,42 @@ declare (strict_types=1); namespace PhpParser; -use PhpParser\Lexer\Emulative; use PhpParser\Parser\Php7; +use PhpParser\Parser\Php8; class ParserFactory { - const PREFER_PHP7 = 1; - const PREFER_PHP5 = 2; - const ONLY_PHP7 = 3; - const ONLY_PHP5 = 4; /** - * Creates a Parser instance, according to the provided kind. - * - * @param int $kind One of ::PREFER_PHP7, ::PREFER_PHP5, ::ONLY_PHP7 or ::ONLY_PHP5 - * @param Lexer|null $lexer Lexer to use. Defaults to emulative lexer when not specified - * @param array $parserOptions Parser options. See ParserAbstract::__construct() argument - * - * @return Parser The parser instance + * Create a parser targeting the given version on a best-effort basis. The parser will generally + * accept code for the newest supported version, but will try to accommodate code that becomes + * invalid in newer versions or changes in interpretation. */ - public function create(int $kind, ?\PhpParser\Lexer $lexer = null, array $parserOptions = []) : \PhpParser\Parser + public function createForVersion(\PhpParser\PhpVersion $version) : \PhpParser\Parser { - if (null === $lexer) { - $lexer = new \PhpParser\Lexer\Emulative(); + if ($version->isHostVersion()) { + $lexer = new \PhpParser\Lexer(); + } else { + $lexer = new \PhpParser\Lexer\Emulative($version); } - switch ($kind) { - case self::PREFER_PHP7: - return new \PhpParser\Parser\Multiple([new \PhpParser\Parser\Php7($lexer, $parserOptions), new \PhpParser\Parser\Php5($lexer, $parserOptions)]); - case self::PREFER_PHP5: - return new \PhpParser\Parser\Multiple([new \PhpParser\Parser\Php5($lexer, $parserOptions), new \PhpParser\Parser\Php7($lexer, $parserOptions)]); - case self::ONLY_PHP7: - return new \PhpParser\Parser\Php7($lexer, $parserOptions); - case self::ONLY_PHP5: - return new \PhpParser\Parser\Php5($lexer, $parserOptions); - default: - throw new \LogicException('Kind must be one of ::PREFER_PHP7, ::PREFER_PHP5, ::ONLY_PHP7 or ::ONLY_PHP5'); + if ($version->id >= 80000) { + return new Php8($lexer, $version); } + return new Php7($lexer, $version); } /** * Create a parser targeting the newest version supported by this library. Code for older * versions will be accepted if there have been no relevant backwards-compatibility breaks in * PHP. - * - * All supported lexer attributes (comments, startLine, endLine, startTokenPos, endTokenPos, - * startFilePos, endFilePos) will be enabled. */ public function createForNewestSupportedVersion() : \PhpParser\Parser { - return new Php7(new Emulative($this->getLexerOptions())); + return $this->createForVersion(\PhpParser\PhpVersion::getNewestSupported()); } /** * Create a parser targeting the host PHP version, that is the PHP version we're currently * running on. This parser will not use any token emulation. - * - * All supported lexer attributes (comments, startLine, endLine, startTokenPos, endTokenPos, - * startFilePos, endFilePos) will be enabled. */ public function createForHostVersion() : \PhpParser\Parser { - return new Php7(new \PhpParser\Lexer($this->getLexerOptions())); - } - private function getLexerOptions() : array - { - return ['usedAttributes' => ['comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos', 'startFilePos', 'endFilePos']]; + return $this->createForVersion(\PhpParser\PhpVersion::getHostVersion()); } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/PhpVersion.php b/vendor/nikic/php-parser/lib/PhpParser/PhpVersion.php new file mode 100644 index 00000000000..122e4bdad1f --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/PhpVersion.php @@ -0,0 +1,150 @@ + 50100, 'callable' => 50400, 'bool' => 70000, 'int' => 70000, 'float' => 70000, 'string' => 70000, 'iterable' => 70100, 'void' => 70100, 'object' => 70200, 'null' => 80000, 'false' => 80000, 'mixed' => 80000, 'never' => 80100, 'true' => 80200]; + private function __construct(int $id) + { + $this->id = $id; + } + /** + * Create a PhpVersion object from major and minor version components. + */ + public static function fromComponents(int $major, int $minor) : self + { + return new self($major * 10000 + $minor * 100); + } + /** + * Get the newest PHP version supported by this library. Support for this version may be partial, + * if it is still under development. + */ + public static function getNewestSupported() : self + { + return self::fromComponents(8, 4); + } + /** + * Get the host PHP version, that is the PHP version we're currently running on. + */ + public static function getHostVersion() : self + { + return self::fromComponents(\PHP_MAJOR_VERSION, \PHP_MINOR_VERSION); + } + /** + * Parse the version from a string like "8.1". + */ + public static function fromString(string $version) : self + { + if (!\preg_match('/^(\\d+)\\.(\\d+)/', $version, $matches)) { + throw new \LogicException("Invalid PHP version \"{$version}\""); + } + return self::fromComponents((int) $matches[1], (int) $matches[2]); + } + /** + * Check whether two versions are the same. + */ + public function equals(\PhpParser\PhpVersion $other) : bool + { + return $this->id === $other->id; + } + /** + * Check whether this version is greater than or equal to the argument. + */ + public function newerOrEqual(\PhpParser\PhpVersion $other) : bool + { + return $this->id >= $other->id; + } + /** + * Check whether this version is older than the argument. + */ + public function older(\PhpParser\PhpVersion $other) : bool + { + return $this->id < $other->id; + } + /** + * Check whether this is the host PHP version. + */ + public function isHostVersion() : bool + { + return $this->equals(self::getHostVersion()); + } + /** + * Check whether this PHP version supports the given builtin type. Type name must be lowercase. + */ + public function supportsBuiltinType(string $type) : bool + { + $minVersion = self::BUILTIN_TYPE_VERSIONS[$type] ?? null; + return $minVersion !== null && $this->id >= $minVersion; + } + /** + * Whether this version supports [] array literals. + */ + public function supportsShortArraySyntax() : bool + { + return $this->id >= 50400; + } + /** + * Whether this version supports [] for destructuring. + */ + public function supportsShortArrayDestructuring() : bool + { + return $this->id >= 70100; + } + /** + * Whether this version supports flexible heredoc/nowdoc. + */ + public function supportsFlexibleHeredoc() : bool + { + return $this->id >= 70300; + } + /** + * Whether this version supports trailing commas in parameter lists. + */ + public function supportsTrailingCommaInParamList() : bool + { + return $this->id >= 80000; + } + /** + * Whether this version allows "$var =& new Obj". + */ + public function allowsAssignNewByReference() : bool + { + return $this->id < 70000; + } + /** + * Whether this version allows invalid octals like "08". + */ + public function allowsInvalidOctals() : bool + { + return $this->id < 70000; + } + /** + * Whether this version allows DEL (\x7f) to occur in identifiers. + */ + public function allowsDelInIdentifiers() : bool + { + return $this->id < 70100; + } + /** + * Whether this version supports yield in expression context without parentheses. + */ + public function supportsYieldWithoutParentheses() : bool + { + return $this->id >= 70000; + } + /** + * Whether this version supports unicode escape sequences in strings. + */ + public function supportsUnicodeEscapes() : bool + { + return $this->id >= 70000; + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter.php b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter.php new file mode 100644 index 00000000000..dcaac130ac4 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter.php @@ -0,0 +1,49 @@ +pAttrGroups($node->attrGroups, \true) . $this->pModifiers($node->flags) . ($node->type ? $this->p($node->type) . ' ' : '') . ($node->byRef ? '&' : '') . ($node->variadic ? '...' : '') . $this->p($node->var) . ($node->default ? ' = ' . $this->p($node->default) : ''); + return $this->pAttrGroups($node->attrGroups, \true) . $this->pModifiers($node->flags) . ($node->type ? $this->p($node->type) . ' ' : '') . ($node->byRef ? '&' : '') . ($node->variadic ? '...' : '') . $this->p($node->var) . ($node->default ? ' = ' . $this->p($node->default) : '') . ($node->hooks ? ' {' . $this->pStmts($node->hooks) . $this->nl . '}' : ''); } - protected function pArg(Node\Arg $node) + protected function pArg(Node\Arg $node) : string { return ($node->name ? $node->name->toString() . ': ' : '') . ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '') . $this->p($node->value); } - protected function pVariadicPlaceholder(Node\VariadicPlaceholder $node) + protected function pVariadicPlaceholder(Node\VariadicPlaceholder $node) : string { return '...'; } - protected function pConst(Node\Const_ $node) + protected function pConst(Node\Const_ $node) : string { return $node->name . ' = ' . $this->p($node->value); } - protected function pNullableType(Node\NullableType $node) + protected function pNullableType(Node\NullableType $node) : string { return '?' . $this->p($node->type); } - protected function pUnionType(Node\UnionType $node) + protected function pUnionType(Node\UnionType $node) : string { $types = []; foreach ($node->types as $typeNode) { @@ -48,125 +48,143 @@ class Standard extends PrettyPrinterAbstract } return \implode('|', $types); } - protected function pIntersectionType(Node\IntersectionType $node) + protected function pIntersectionType(Node\IntersectionType $node) : string { return $this->pImplode($node->types, '&'); } - protected function pIdentifier(Node\Identifier $node) + protected function pIdentifier(Node\Identifier $node) : string { return $node->name; } - protected function pVarLikeIdentifier(Node\VarLikeIdentifier $node) + protected function pVarLikeIdentifier(Node\VarLikeIdentifier $node) : string { return '$' . $node->name; } - protected function pAttribute(Node\Attribute $node) + protected function pAttribute(Node\Attribute $node) : string { return $this->p($node->name) . ($node->args ? '(' . $this->pCommaSeparated($node->args) . ')' : ''); } - protected function pAttributeGroup(Node\AttributeGroup $node) + protected function pAttributeGroup(Node\AttributeGroup $node) : string { return '#[' . $this->pCommaSeparated($node->attrs) . ']'; } // Names - protected function pName(Name $node) + protected function pName(Name $node) : string { - return \implode('\\', $node->parts); + return $node->name; } - protected function pName_FullyQualified(Name\FullyQualified $node) + protected function pName_FullyQualified(Name\FullyQualified $node) : string { - return '\\' . \implode('\\', $node->parts); + return '\\' . $node->name; } - protected function pName_Relative(Name\Relative $node) + protected function pName_Relative(Name\Relative $node) : string { - return 'namespace\\' . \implode('\\', $node->parts); + return 'namespace\\' . $node->name; } // Magic Constants - protected function pScalar_MagicConst_Class(MagicConst\Class_ $node) + protected function pScalar_MagicConst_Class(MagicConst\Class_ $node) : string { return '__CLASS__'; } - protected function pScalar_MagicConst_Dir(MagicConst\Dir $node) + protected function pScalar_MagicConst_Dir(MagicConst\Dir $node) : string { return '__DIR__'; } - protected function pScalar_MagicConst_File(MagicConst\File $node) + protected function pScalar_MagicConst_File(MagicConst\File $node) : string { return '__FILE__'; } - protected function pScalar_MagicConst_Function(MagicConst\Function_ $node) + protected function pScalar_MagicConst_Function(MagicConst\Function_ $node) : string { return '__FUNCTION__'; } - protected function pScalar_MagicConst_Line(MagicConst\Line $node) + protected function pScalar_MagicConst_Line(MagicConst\Line $node) : string { return '__LINE__'; } - protected function pScalar_MagicConst_Method(MagicConst\Method $node) + protected function pScalar_MagicConst_Method(MagicConst\Method $node) : string { return '__METHOD__'; } - protected function pScalar_MagicConst_Namespace(MagicConst\Namespace_ $node) + protected function pScalar_MagicConst_Namespace(MagicConst\Namespace_ $node) : string { return '__NAMESPACE__'; } - protected function pScalar_MagicConst_Trait(MagicConst\Trait_ $node) + protected function pScalar_MagicConst_Trait(MagicConst\Trait_ $node) : string { return '__TRAIT__'; } + protected function pScalar_MagicConst_Property(MagicConst\Property $node) : string + { + return '__PROPERTY__'; + } // Scalars - protected function pScalar_String(Scalar\String_ $node) + private function indentString(string $str) : string + { + return \str_replace("\n", $this->nl, $str); + } + protected function pScalar_String(Scalar\String_ $node) : string { $kind = $node->getAttribute('kind', Scalar\String_::KIND_SINGLE_QUOTED); switch ($kind) { case Scalar\String_::KIND_NOWDOC: $label = $node->getAttribute('docLabel'); if ($label && !$this->containsEndLabel($node->value, $label)) { + $shouldIdent = $this->phpVersion->supportsFlexibleHeredoc(); + $nl = $shouldIdent ? $this->nl : $this->newline; if ($node->value === '') { - return "<<<'{$label}'\n{$label}" . $this->docStringEndToken; + return "<<<'{$label}'{$nl}{$label}{$this->docStringEndToken}"; + } + // Make sure trailing \r is not combined with following \n into CRLF. + if ($node->value[\strlen($node->value) - 1] !== "\r") { + $value = $shouldIdent ? $this->indentString($node->value) : $node->value; + return "<<<'{$label}'{$nl}{$value}{$nl}{$label}{$this->docStringEndToken}"; } - return "<<<'{$label}'\n{$node->value}\n{$label}" . $this->docStringEndToken; } /* break missing intentionally */ + // no break case Scalar\String_::KIND_SINGLE_QUOTED: return $this->pSingleQuotedString($node->value); case Scalar\String_::KIND_HEREDOC: $label = $node->getAttribute('docLabel'); - if ($label && !$this->containsEndLabel($node->value, $label)) { - if ($node->value === '') { - return "<<<{$label}\n{$label}" . $this->docStringEndToken; + $escaped = $this->escapeString($node->value, null); + if ($label && !$this->containsEndLabel($escaped, $label)) { + $nl = $this->phpVersion->supportsFlexibleHeredoc() ? $this->nl : $this->newline; + if ($escaped === '') { + return "<<<{$label}{$nl}{$label}{$this->docStringEndToken}"; } - $escaped = $this->escapeString($node->value, null); - return "<<<{$label}\n" . $escaped . "\n{$label}" . $this->docStringEndToken; + return "<<<{$label}{$nl}{$escaped}{$nl}{$label}{$this->docStringEndToken}"; } /* break missing intentionally */ + // no break case Scalar\String_::KIND_DOUBLE_QUOTED: return '"' . $this->escapeString($node->value, '"') . '"'; } throw new \Exception('Invalid string kind'); } - protected function pScalar_Encapsed(Scalar\Encapsed $node) + protected function pScalar_InterpolatedString(Scalar\InterpolatedString $node) : string { if ($node->getAttribute('kind') === Scalar\String_::KIND_HEREDOC) { $label = $node->getAttribute('docLabel'); if ($label && !$this->encapsedContainsEndLabel($node->parts, $label)) { - if (\count($node->parts) === 1 && $node->parts[0] instanceof Scalar\EncapsedStringPart && $node->parts[0]->value === '') { - return "<<<{$label}\n{$label}" . $this->docStringEndToken; + $nl = $this->phpVersion->supportsFlexibleHeredoc() ? $this->nl : $this->newline; + if (\count($node->parts) === 1 && $node->parts[0] instanceof Node\InterpolatedStringPart && $node->parts[0]->value === '') { + return "<<<{$label}{$nl}{$label}{$this->docStringEndToken}"; } - return "<<<{$label}\n" . $this->pEncapsList($node->parts, null) . "\n{$label}" . $this->docStringEndToken; + return "<<<{$label}{$nl}" . $this->pEncapsList($node->parts, null) . "{$nl}{$label}{$this->docStringEndToken}"; } } return '"' . $this->pEncapsList($node->parts, '"') . '"'; } - protected function pScalar_LNumber(Scalar\LNumber $node) + protected function pScalar_Int(Scalar\Int_ $node) : string { if ($node->value === -\PHP_INT_MAX - 1) { // PHP_INT_MIN cannot be represented as a literal, // because the sign is not part of the literal return '(-' . \PHP_INT_MAX . '-1)'; } - $kind = $node->getAttribute('kind', Scalar\LNumber::KIND_DEC); - if (Scalar\LNumber::KIND_DEC === $kind) { + $kind = $node->getAttribute('kind', Scalar\Int_::KIND_DEC); + if (Scalar\Int_::KIND_DEC === $kind) { return (string) $node->value; } if ($node->value < 0) { @@ -177,29 +195,30 @@ class Standard extends PrettyPrinterAbstract $str = (string) $node->value; } switch ($kind) { - case Scalar\LNumber::KIND_BIN: + case Scalar\Int_::KIND_BIN: return $sign . '0b' . \base_convert($str, 10, 2); - case Scalar\LNumber::KIND_OCT: + case Scalar\Int_::KIND_OCT: return $sign . '0' . \base_convert($str, 10, 8); - case Scalar\LNumber::KIND_HEX: + case Scalar\Int_::KIND_HEX: return $sign . '0x' . \base_convert($str, 10, 16); } throw new \Exception('Invalid number kind'); } - protected function pScalar_DNumber(Scalar\DNumber $node) + protected function pScalar_Float(Scalar\Float_ $node) : string { if (!\is_finite($node->value)) { if ($node->value === \INF) { - return '\\INF'; - } elseif ($node->value === -\INF) { - return '-\\INF'; + return '1.0E+1000'; + } + if ($node->value === -\INF) { + return '-1.0E+1000'; } else { return '\\NAN'; } } // Try to find a short full-precision representation $stringValue = \sprintf('%.16G', $node->value); - if ($node->value !== (double) $stringValue) { + if ($node->value !== (float) $stringValue) { $stringValue = \sprintf('%.17G', $node->value); } // %G is locale dependent and there exists no locale-independent alternative. We don't want @@ -209,319 +228,312 @@ class Standard extends PrettyPrinterAbstract // ensure that number is really printed as float return \preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue; } - protected function pScalar_EncapsedStringPart(Scalar\EncapsedStringPart $node) - { - throw new \LogicException('Cannot directly print EncapsedStringPart'); - } // Assignments - protected function pExpr_Assign(Expr\Assign $node) + protected function pExpr_Assign(Expr\Assign $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(Expr\Assign::class, $node->var, ' = ', $node->expr); + return $this->pPrefixOp(Expr\Assign::class, $this->p($node->var) . ' = ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignRef(Expr\AssignRef $node) + protected function pExpr_AssignRef(Expr\AssignRef $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(Expr\AssignRef::class, $node->var, ' =& ', $node->expr); + return $this->pPrefixOp(Expr\AssignRef::class, $this->p($node->var) . ' =& ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_Plus(AssignOp\Plus $node) + protected function pExpr_AssignOp_Plus(AssignOp\Plus $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\Plus::class, $node->var, ' += ', $node->expr); + return $this->pPrefixOp(AssignOp\Plus::class, $this->p($node->var) . ' += ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_Minus(AssignOp\Minus $node) + protected function pExpr_AssignOp_Minus(AssignOp\Minus $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\Minus::class, $node->var, ' -= ', $node->expr); + return $this->pPrefixOp(AssignOp\Minus::class, $this->p($node->var) . ' -= ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_Mul(AssignOp\Mul $node) + protected function pExpr_AssignOp_Mul(AssignOp\Mul $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\Mul::class, $node->var, ' *= ', $node->expr); + return $this->pPrefixOp(AssignOp\Mul::class, $this->p($node->var) . ' *= ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_Div(AssignOp\Div $node) + protected function pExpr_AssignOp_Div(AssignOp\Div $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\Div::class, $node->var, ' /= ', $node->expr); + return $this->pPrefixOp(AssignOp\Div::class, $this->p($node->var) . ' /= ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_Concat(AssignOp\Concat $node) + protected function pExpr_AssignOp_Concat(AssignOp\Concat $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\Concat::class, $node->var, ' .= ', $node->expr); + return $this->pPrefixOp(AssignOp\Concat::class, $this->p($node->var) . ' .= ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_Mod(AssignOp\Mod $node) + protected function pExpr_AssignOp_Mod(AssignOp\Mod $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\Mod::class, $node->var, ' %= ', $node->expr); + return $this->pPrefixOp(AssignOp\Mod::class, $this->p($node->var) . ' %= ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_BitwiseAnd(AssignOp\BitwiseAnd $node) + protected function pExpr_AssignOp_BitwiseAnd(AssignOp\BitwiseAnd $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\BitwiseAnd::class, $node->var, ' &= ', $node->expr); + return $this->pPrefixOp(AssignOp\BitwiseAnd::class, $this->p($node->var) . ' &= ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_BitwiseOr(AssignOp\BitwiseOr $node) + protected function pExpr_AssignOp_BitwiseOr(AssignOp\BitwiseOr $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\BitwiseOr::class, $node->var, ' |= ', $node->expr); + return $this->pPrefixOp(AssignOp\BitwiseOr::class, $this->p($node->var) . ' |= ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_BitwiseXor(AssignOp\BitwiseXor $node) + protected function pExpr_AssignOp_BitwiseXor(AssignOp\BitwiseXor $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\BitwiseXor::class, $node->var, ' ^= ', $node->expr); + return $this->pPrefixOp(AssignOp\BitwiseXor::class, $this->p($node->var) . ' ^= ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_ShiftLeft(AssignOp\ShiftLeft $node) + protected function pExpr_AssignOp_ShiftLeft(AssignOp\ShiftLeft $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\ShiftLeft::class, $node->var, ' <<= ', $node->expr); + return $this->pPrefixOp(AssignOp\ShiftLeft::class, $this->p($node->var) . ' <<= ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_ShiftRight(AssignOp\ShiftRight $node) + protected function pExpr_AssignOp_ShiftRight(AssignOp\ShiftRight $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\ShiftRight::class, $node->var, ' >>= ', $node->expr); + return $this->pPrefixOp(AssignOp\ShiftRight::class, $this->p($node->var) . ' >>= ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_Pow(AssignOp\Pow $node) + protected function pExpr_AssignOp_Pow(AssignOp\Pow $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\Pow::class, $node->var, ' **= ', $node->expr); + return $this->pPrefixOp(AssignOp\Pow::class, $this->p($node->var) . ' **= ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_AssignOp_Coalesce(AssignOp\Coalesce $node) + protected function pExpr_AssignOp_Coalesce(AssignOp\Coalesce $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(AssignOp\Coalesce::class, $node->var, ' ??= ', $node->expr); + return $this->pPrefixOp(AssignOp\Coalesce::class, $this->p($node->var) . ' ??= ', $node->expr, $precedence, $lhsPrecedence); } // Binary expressions - protected function pExpr_BinaryOp_Plus(BinaryOp\Plus $node) + protected function pExpr_BinaryOp_Plus(BinaryOp\Plus $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Plus::class, $node->left, ' + ', $node->right); + return $this->pInfixOp(BinaryOp\Plus::class, $node->left, ' + ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_Minus(BinaryOp\Minus $node) + protected function pExpr_BinaryOp_Minus(BinaryOp\Minus $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Minus::class, $node->left, ' - ', $node->right); + return $this->pInfixOp(BinaryOp\Minus::class, $node->left, ' - ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_Mul(BinaryOp\Mul $node) + protected function pExpr_BinaryOp_Mul(BinaryOp\Mul $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Mul::class, $node->left, ' * ', $node->right); + return $this->pInfixOp(BinaryOp\Mul::class, $node->left, ' * ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_Div(BinaryOp\Div $node) + protected function pExpr_BinaryOp_Div(BinaryOp\Div $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Div::class, $node->left, ' / ', $node->right); + return $this->pInfixOp(BinaryOp\Div::class, $node->left, ' / ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_Concat(BinaryOp\Concat $node) + protected function pExpr_BinaryOp_Concat(BinaryOp\Concat $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Concat::class, $node->left, ' . ', $node->right); + return $this->pInfixOp(BinaryOp\Concat::class, $node->left, ' . ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_Mod(BinaryOp\Mod $node) + protected function pExpr_BinaryOp_Mod(BinaryOp\Mod $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Mod::class, $node->left, ' % ', $node->right); + return $this->pInfixOp(BinaryOp\Mod::class, $node->left, ' % ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_BooleanAnd(BinaryOp\BooleanAnd $node) + protected function pExpr_BinaryOp_BooleanAnd(BinaryOp\BooleanAnd $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\BooleanAnd::class, $node->left, ' && ', $node->right); + return $this->pInfixOp(BinaryOp\BooleanAnd::class, $node->left, ' && ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_BooleanOr(BinaryOp\BooleanOr $node) + protected function pExpr_BinaryOp_BooleanOr(BinaryOp\BooleanOr $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\BooleanOr::class, $node->left, ' || ', $node->right); + return $this->pInfixOp(BinaryOp\BooleanOr::class, $node->left, ' || ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_BitwiseAnd(BinaryOp\BitwiseAnd $node) + protected function pExpr_BinaryOp_BitwiseAnd(BinaryOp\BitwiseAnd $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\BitwiseAnd::class, $node->left, ' & ', $node->right); + return $this->pInfixOp(BinaryOp\BitwiseAnd::class, $node->left, ' & ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_BitwiseOr(BinaryOp\BitwiseOr $node) + protected function pExpr_BinaryOp_BitwiseOr(BinaryOp\BitwiseOr $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\BitwiseOr::class, $node->left, ' | ', $node->right); + return $this->pInfixOp(BinaryOp\BitwiseOr::class, $node->left, ' | ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_BitwiseXor(BinaryOp\BitwiseXor $node) + protected function pExpr_BinaryOp_BitwiseXor(BinaryOp\BitwiseXor $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\BitwiseXor::class, $node->left, ' ^ ', $node->right); + return $this->pInfixOp(BinaryOp\BitwiseXor::class, $node->left, ' ^ ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_ShiftLeft(BinaryOp\ShiftLeft $node) + protected function pExpr_BinaryOp_ShiftLeft(BinaryOp\ShiftLeft $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\ShiftLeft::class, $node->left, ' << ', $node->right); + return $this->pInfixOp(BinaryOp\ShiftLeft::class, $node->left, ' << ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_ShiftRight(BinaryOp\ShiftRight $node) + protected function pExpr_BinaryOp_ShiftRight(BinaryOp\ShiftRight $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\ShiftRight::class, $node->left, ' >> ', $node->right); + return $this->pInfixOp(BinaryOp\ShiftRight::class, $node->left, ' >> ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_Pow(BinaryOp\Pow $node) + protected function pExpr_BinaryOp_Pow(BinaryOp\Pow $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Pow::class, $node->left, ' ** ', $node->right); + return $this->pInfixOp(BinaryOp\Pow::class, $node->left, ' ** ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_LogicalAnd(BinaryOp\LogicalAnd $node) + protected function pExpr_BinaryOp_LogicalAnd(BinaryOp\LogicalAnd $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\LogicalAnd::class, $node->left, ' and ', $node->right); + return $this->pInfixOp(BinaryOp\LogicalAnd::class, $node->left, ' and ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_LogicalOr(BinaryOp\LogicalOr $node) + protected function pExpr_BinaryOp_LogicalOr(BinaryOp\LogicalOr $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\LogicalOr::class, $node->left, ' or ', $node->right); + return $this->pInfixOp(BinaryOp\LogicalOr::class, $node->left, ' or ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_LogicalXor(BinaryOp\LogicalXor $node) + protected function pExpr_BinaryOp_LogicalXor(BinaryOp\LogicalXor $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\LogicalXor::class, $node->left, ' xor ', $node->right); + return $this->pInfixOp(BinaryOp\LogicalXor::class, $node->left, ' xor ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_Equal(BinaryOp\Equal $node) + protected function pExpr_BinaryOp_Equal(BinaryOp\Equal $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Equal::class, $node->left, ' == ', $node->right); + return $this->pInfixOp(BinaryOp\Equal::class, $node->left, ' == ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_NotEqual(BinaryOp\NotEqual $node) + protected function pExpr_BinaryOp_NotEqual(BinaryOp\NotEqual $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\NotEqual::class, $node->left, ' != ', $node->right); + return $this->pInfixOp(BinaryOp\NotEqual::class, $node->left, ' != ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_Identical(BinaryOp\Identical $node) + protected function pExpr_BinaryOp_Identical(BinaryOp\Identical $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Identical::class, $node->left, ' === ', $node->right); + return $this->pInfixOp(BinaryOp\Identical::class, $node->left, ' === ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_NotIdentical(BinaryOp\NotIdentical $node) + protected function pExpr_BinaryOp_NotIdentical(BinaryOp\NotIdentical $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\NotIdentical::class, $node->left, ' !== ', $node->right); + return $this->pInfixOp(BinaryOp\NotIdentical::class, $node->left, ' !== ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_Spaceship(BinaryOp\Spaceship $node) + protected function pExpr_BinaryOp_Spaceship(BinaryOp\Spaceship $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Spaceship::class, $node->left, ' <=> ', $node->right); + return $this->pInfixOp(BinaryOp\Spaceship::class, $node->left, ' <=> ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_Greater(BinaryOp\Greater $node) + protected function pExpr_BinaryOp_Greater(BinaryOp\Greater $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Greater::class, $node->left, ' > ', $node->right); + return $this->pInfixOp(BinaryOp\Greater::class, $node->left, ' > ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_GreaterOrEqual(BinaryOp\GreaterOrEqual $node) + protected function pExpr_BinaryOp_GreaterOrEqual(BinaryOp\GreaterOrEqual $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\GreaterOrEqual::class, $node->left, ' >= ', $node->right); + return $this->pInfixOp(BinaryOp\GreaterOrEqual::class, $node->left, ' >= ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_Smaller(BinaryOp\Smaller $node) + protected function pExpr_BinaryOp_Smaller(BinaryOp\Smaller $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Smaller::class, $node->left, ' < ', $node->right); + return $this->pInfixOp(BinaryOp\Smaller::class, $node->left, ' < ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_SmallerOrEqual(BinaryOp\SmallerOrEqual $node) + protected function pExpr_BinaryOp_SmallerOrEqual(BinaryOp\SmallerOrEqual $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\SmallerOrEqual::class, $node->left, ' <= ', $node->right); + return $this->pInfixOp(BinaryOp\SmallerOrEqual::class, $node->left, ' <= ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_BinaryOp_Coalesce(BinaryOp\Coalesce $node) + protected function pExpr_BinaryOp_Coalesce(BinaryOp\Coalesce $node, int $precedence, int $lhsPrecedence) : string { - return $this->pInfixOp(BinaryOp\Coalesce::class, $node->left, ' ?? ', $node->right); + return $this->pInfixOp(BinaryOp\Coalesce::class, $node->left, ' ?? ', $node->right, $precedence, $lhsPrecedence); } - protected function pExpr_Instanceof(Expr\Instanceof_ $node) + protected function pExpr_Instanceof(Expr\Instanceof_ $node, int $precedence, int $lhsPrecedence) : string { - list($precedence, $associativity) = $this->precedenceMap[Expr\Instanceof_::class]; - return $this->pPrec($node->expr, $precedence, $associativity, -1) . ' instanceof ' . $this->pNewVariable($node->class); + return $this->pPostfixOp(Expr\Instanceof_::class, $node->expr, ' instanceof ' . $this->pNewOperand($node->class), $precedence, $lhsPrecedence); } // Unary expressions - protected function pExpr_BooleanNot(Expr\BooleanNot $node) + protected function pExpr_BooleanNot(Expr\BooleanNot $node, int $precedence, int $lhsPrecedence) : string { - return $this->pPrefixOp(Expr\BooleanNot::class, '!', $node->expr); + return $this->pPrefixOp(Expr\BooleanNot::class, '!', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_BitwiseNot(Expr\BitwiseNot $node) + protected function pExpr_BitwiseNot(Expr\BitwiseNot $node, int $precedence, int $lhsPrecedence) : string { - return $this->pPrefixOp(Expr\BitwiseNot::class, '~', $node->expr); + return $this->pPrefixOp(Expr\BitwiseNot::class, '~', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_UnaryMinus(Expr\UnaryMinus $node) + protected function pExpr_UnaryMinus(Expr\UnaryMinus $node, int $precedence, int $lhsPrecedence) : string { - if ($node->expr instanceof Expr\UnaryMinus || $node->expr instanceof Expr\PreDec) { - // Enforce -(-$expr) instead of --$expr - return '-(' . $this->p($node->expr) . ')'; - } - return $this->pPrefixOp(Expr\UnaryMinus::class, '-', $node->expr); + return $this->pPrefixOp(Expr\UnaryMinus::class, '-', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_UnaryPlus(Expr\UnaryPlus $node) + protected function pExpr_UnaryPlus(Expr\UnaryPlus $node, int $precedence, int $lhsPrecedence) : string { - if ($node->expr instanceof Expr\UnaryPlus || $node->expr instanceof Expr\PreInc) { - // Enforce +(+$expr) instead of ++$expr - return '+(' . $this->p($node->expr) . ')'; - } - return $this->pPrefixOp(Expr\UnaryPlus::class, '+', $node->expr); + return $this->pPrefixOp(Expr\UnaryPlus::class, '+', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_PreInc(Expr\PreInc $node) + protected function pExpr_PreInc(Expr\PreInc $node) : string { - return $this->pPrefixOp(Expr\PreInc::class, '++', $node->var); + return '++' . $this->p($node->var); } - protected function pExpr_PreDec(Expr\PreDec $node) + protected function pExpr_PreDec(Expr\PreDec $node) : string { - return $this->pPrefixOp(Expr\PreDec::class, '--', $node->var); + return '--' . $this->p($node->var); } - protected function pExpr_PostInc(Expr\PostInc $node) + protected function pExpr_PostInc(Expr\PostInc $node) : string { - return $this->pPostfixOp(Expr\PostInc::class, $node->var, '++'); + return $this->p($node->var) . '++'; } - protected function pExpr_PostDec(Expr\PostDec $node) + protected function pExpr_PostDec(Expr\PostDec $node) : string { - return $this->pPostfixOp(Expr\PostDec::class, $node->var, '--'); + return $this->p($node->var) . '--'; } - protected function pExpr_ErrorSuppress(Expr\ErrorSuppress $node) + protected function pExpr_ErrorSuppress(Expr\ErrorSuppress $node, int $precedence, int $lhsPrecedence) : string { - return $this->pPrefixOp(Expr\ErrorSuppress::class, '@', $node->expr); + return $this->pPrefixOp(Expr\ErrorSuppress::class, '@', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_YieldFrom(Expr\YieldFrom $node) + protected function pExpr_YieldFrom(Expr\YieldFrom $node, int $precedence, int $lhsPrecedence) : string { - return $this->pPrefixOp(Expr\YieldFrom::class, 'yield from ', $node->expr); + return $this->pPrefixOp(Expr\YieldFrom::class, 'yield from ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_Print(Expr\Print_ $node) + protected function pExpr_Print(Expr\Print_ $node, int $precedence, int $lhsPrecedence) : string { - return $this->pPrefixOp(Expr\Print_::class, 'print ', $node->expr); + return $this->pPrefixOp(Expr\Print_::class, 'print ', $node->expr, $precedence, $lhsPrecedence); } // Casts - protected function pExpr_Cast_Int(Cast\Int_ $node) + protected function pExpr_Cast_Int(Cast\Int_ $node, int $precedence, int $lhsPrecedence) : string { - return $this->pPrefixOp(Cast\Int_::class, '(int) ', $node->expr); + return $this->pPrefixOp(Cast\Int_::class, '(int) ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_Cast_Double(Cast\Double $node) + protected function pExpr_Cast_Double(Cast\Double $node, int $precedence, int $lhsPrecedence) : string { $kind = $node->getAttribute('kind', Cast\Double::KIND_DOUBLE); if ($kind === Cast\Double::KIND_DOUBLE) { $cast = '(double)'; } elseif ($kind === Cast\Double::KIND_FLOAT) { $cast = '(float)'; - } elseif ($kind === Cast\Double::KIND_REAL) { + } else { + \assert($kind === Cast\Double::KIND_REAL); $cast = '(real)'; } - return $this->pPrefixOp(Cast\Double::class, $cast . ' ', $node->expr); + return $this->pPrefixOp(Cast\Double::class, $cast . ' ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_Cast_String(Cast\String_ $node) + protected function pExpr_Cast_String(Cast\String_ $node, int $precedence, int $lhsPrecedence) : string { - return $this->pPrefixOp(Cast\String_::class, '(string) ', $node->expr); + return $this->pPrefixOp(Cast\String_::class, '(string) ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_Cast_Array(Cast\Array_ $node) + protected function pExpr_Cast_Array(Cast\Array_ $node, int $precedence, int $lhsPrecedence) : string { - return $this->pPrefixOp(Cast\Array_::class, '(array) ', $node->expr); + return $this->pPrefixOp(Cast\Array_::class, '(array) ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_Cast_Object(Cast\Object_ $node) + protected function pExpr_Cast_Object(Cast\Object_ $node, int $precedence, int $lhsPrecedence) : string { - return $this->pPrefixOp(Cast\Object_::class, '(object) ', $node->expr); + return $this->pPrefixOp(Cast\Object_::class, '(object) ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_Cast_Bool(Cast\Bool_ $node) + protected function pExpr_Cast_Bool(Cast\Bool_ $node, int $precedence, int $lhsPrecedence) : string { - return $this->pPrefixOp(Cast\Bool_::class, '(bool) ', $node->expr); + return $this->pPrefixOp(Cast\Bool_::class, '(bool) ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_Cast_Unset(Cast\Unset_ $node) + protected function pExpr_Cast_Unset(Cast\Unset_ $node, int $precedence, int $lhsPrecedence) : string { - return $this->pPrefixOp(Cast\Unset_::class, '(unset) ', $node->expr); + return $this->pPrefixOp(Cast\Unset_::class, '(unset) ', $node->expr, $precedence, $lhsPrecedence); } // Function calls and similar constructs - protected function pExpr_FuncCall(Expr\FuncCall $node) + protected function pExpr_FuncCall(Expr\FuncCall $node) : string { return $this->pCallLhs($node->name) . '(' . $this->pMaybeMultiline($node->args) . ')'; } - protected function pExpr_MethodCall(Expr\MethodCall $node) + protected function pExpr_MethodCall(Expr\MethodCall $node) : string { return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name) . '(' . $this->pMaybeMultiline($node->args) . ')'; } - protected function pExpr_NullsafeMethodCall(Expr\NullsafeMethodCall $node) + protected function pExpr_NullsafeMethodCall(Expr\NullsafeMethodCall $node) : string { return $this->pDereferenceLhs($node->var) . '?->' . $this->pObjectProperty($node->name) . '(' . $this->pMaybeMultiline($node->args) . ')'; } - protected function pExpr_StaticCall(Expr\StaticCall $node) + protected function pExpr_StaticCall(Expr\StaticCall $node) : string { return $this->pStaticDereferenceLhs($node->class) . '::' . ($node->name instanceof Expr ? $node->name instanceof Expr\Variable ? $this->p($node->name) : '{' . $this->p($node->name) . '}' : $node->name) . '(' . $this->pMaybeMultiline($node->args) . ')'; } - protected function pExpr_Empty(Expr\Empty_ $node) + protected function pExpr_Empty(Expr\Empty_ $node) : string { return 'empty(' . $this->p($node->expr) . ')'; } - protected function pExpr_Isset(Expr\Isset_ $node) + protected function pExpr_Isset(Expr\Isset_ $node) : string { return 'isset(' . $this->pCommaSeparated($node->vars) . ')'; } - protected function pExpr_Eval(Expr\Eval_ $node) + protected function pExpr_Eval(Expr\Eval_ $node) : string { return 'eval(' . $this->p($node->expr) . ')'; } - protected function pExpr_Include(Expr\Include_ $node) + protected function pExpr_Include(Expr\Include_ $node, int $precedence, int $lhsPrecedence) : string { static $map = [Expr\Include_::TYPE_INCLUDE => 'include', Expr\Include_::TYPE_INCLUDE_ONCE => 'include_once', Expr\Include_::TYPE_REQUIRE => 'require', Expr\Include_::TYPE_REQUIRE_ONCE => 'require_once']; - return $map[$node->type] . ' ' . $this->p($node->expr); + return $this->pPrefixOp(Expr\Include_::class, $map[$node->type] . ' ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_List(Expr\List_ $node) + protected function pExpr_List(Expr\List_ $node) : string { - return 'list(' . $this->pCommaSeparated($node->items) . ')'; + $syntax = $node->getAttribute('kind', $this->phpVersion->supportsShortArrayDestructuring() ? Expr\List_::KIND_ARRAY : Expr\List_::KIND_LIST); + if ($syntax === Expr\List_::KIND_ARRAY) { + return '[' . $this->pMaybeMultiline($node->items, \true) . ']'; + } else { + return 'list(' . $this->pMaybeMultiline($node->items, \true) . ')'; + } } // Other - protected function pExpr_Error(Expr\Error $node) + protected function pExpr_Error(Expr\Error $node) : string { throw new \LogicException('Cannot pretty-print AST with Error nodes'); } - protected function pExpr_Variable(Expr\Variable $node) + protected function pExpr_Variable(Expr\Variable $node) : string { if ($node->name instanceof Expr) { return '${' . $this->p($node->name) . '}'; @@ -529,105 +541,131 @@ class Standard extends PrettyPrinterAbstract return '$' . $node->name; } } - protected function pExpr_Array(Expr\Array_ $node) + protected function pExpr_Array(Expr\Array_ $node) : string { - $syntax = $node->getAttribute('kind', $this->options['shortArraySyntax'] ? Expr\Array_::KIND_SHORT : Expr\Array_::KIND_LONG); + $syntax = $node->getAttribute('kind', $this->shortArraySyntax ? Expr\Array_::KIND_SHORT : Expr\Array_::KIND_LONG); if ($syntax === Expr\Array_::KIND_SHORT) { return '[' . $this->pMaybeMultiline($node->items, \true) . ']'; } else { return 'array(' . $this->pMaybeMultiline($node->items, \true) . ')'; } } - protected function pExpr_ArrayItem(Expr\ArrayItem $node) + protected function pKey(?Node $node) : string { - return (null !== $node->key ? $this->p($node->key) . ' => ' : '') . ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '') . $this->p($node->value); + if ($node === null) { + return ''; + } + // => is not really an operator and does not typically participate in precedence resolution. + // However, there is an exception if yield expressions with keys are involved: + // [yield $a => $b] is interpreted as [(yield $a => $b)], so we need to ensure that + // [(yield $a) => $b] is printed with parentheses. We approximate this by lowering the LHS + // precedence to that of yield (which will also print unnecessary parentheses for rare low + // precedence unary operators like include). + $yieldPrecedence = $this->precedenceMap[Expr\Yield_::class][0]; + return $this->p($node, self::MAX_PRECEDENCE, $yieldPrecedence) . ' => '; } - protected function pExpr_ArrayDimFetch(Expr\ArrayDimFetch $node) + protected function pArrayItem(Node\ArrayItem $node) : string + { + return $this->pKey($node->key) . ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '') . $this->p($node->value); + } + protected function pExpr_ArrayDimFetch(Expr\ArrayDimFetch $node) : string { return $this->pDereferenceLhs($node->var) . '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']'; } - protected function pExpr_ConstFetch(Expr\ConstFetch $node) + protected function pExpr_ConstFetch(Expr\ConstFetch $node) : string { return $this->p($node->name); } - protected function pExpr_ClassConstFetch(Expr\ClassConstFetch $node) + protected function pExpr_ClassConstFetch(Expr\ClassConstFetch $node) : string { return $this->pStaticDereferenceLhs($node->class) . '::' . $this->pObjectProperty($node->name); } - protected function pExpr_PropertyFetch(Expr\PropertyFetch $node) + protected function pExpr_PropertyFetch(Expr\PropertyFetch $node) : string { return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name); } - protected function pExpr_NullsafePropertyFetch(Expr\NullsafePropertyFetch $node) + protected function pExpr_NullsafePropertyFetch(Expr\NullsafePropertyFetch $node) : string { return $this->pDereferenceLhs($node->var) . '?->' . $this->pObjectProperty($node->name); } - protected function pExpr_StaticPropertyFetch(Expr\StaticPropertyFetch $node) + protected function pExpr_StaticPropertyFetch(Expr\StaticPropertyFetch $node) : string { return $this->pStaticDereferenceLhs($node->class) . '::$' . $this->pObjectProperty($node->name); } - protected function pExpr_ShellExec(Expr\ShellExec $node) + protected function pExpr_ShellExec(Expr\ShellExec $node) : string { return '`' . $this->pEncapsList($node->parts, '`') . '`'; } - protected function pExpr_Closure(Expr\Closure $node) + protected function pExpr_Closure(Expr\Closure $node) : string { - return $this->pAttrGroups($node->attrGroups, \true) . ($node->static ? 'static ' : '') . 'function ' . ($node->byRef ? '&' : '') . '(' . $this->pCommaSeparated($node->params) . ')' . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')' : '') . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '') . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; + return $this->pAttrGroups($node->attrGroups, \true) . $this->pStatic($node->static) . 'function ' . ($node->byRef ? '&' : '') . '(' . $this->pMaybeMultiline($node->params, $this->phpVersion->supportsTrailingCommaInParamList()) . ')' . (!empty($node->uses) ? ' use (' . $this->pCommaSeparated($node->uses) . ')' : '') . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '') . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pExpr_Match(Expr\Match_ $node) + protected function pExpr_Match(Expr\Match_ $node) : string { return 'match (' . $this->p($node->cond) . ') {' . $this->pCommaSeparatedMultiline($node->arms, \true) . $this->nl . '}'; } - protected function pMatchArm(Node\MatchArm $node) + protected function pMatchArm(Node\MatchArm $node) : string { - return ($node->conds ? $this->pCommaSeparated($node->conds) : 'default') . ' => ' . $this->p($node->body); + $result = ''; + if ($node->conds) { + for ($i = 0, $c = \count($node->conds); $i + 1 < $c; $i++) { + $result .= $this->p($node->conds[$i]) . ', '; + } + $result .= $this->pKey($node->conds[$i]); + } else { + $result = 'default => '; + } + return $result . $this->p($node->body); } - protected function pExpr_ArrowFunction(Expr\ArrowFunction $node) + protected function pExpr_ArrowFunction(Expr\ArrowFunction $node, int $precedence, int $lhsPrecedence) : string { - return $this->pAttrGroups($node->attrGroups, \true) . ($node->static ? 'static ' : '') . 'fn' . ($node->byRef ? '&' : '') . '(' . $this->pCommaSeparated($node->params) . ')' . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '') . ' => ' . $this->p($node->expr); + return $this->pPrefixOp(Expr\ArrowFunction::class, $this->pAttrGroups($node->attrGroups, \true) . $this->pStatic($node->static) . 'fn' . ($node->byRef ? '&' : '') . '(' . $this->pMaybeMultiline($node->params, $this->phpVersion->supportsTrailingCommaInParamList()) . ')' . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '') . ' => ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_ClosureUse(Expr\ClosureUse $node) + protected function pClosureUse(Node\ClosureUse $node) : string { return ($node->byRef ? '&' : '') . $this->p($node->var); } - protected function pExpr_New(Expr\New_ $node) + protected function pExpr_New(Expr\New_ $node) : string { if ($node->class instanceof Stmt\Class_) { $args = $node->args ? '(' . $this->pMaybeMultiline($node->args) . ')' : ''; return 'new ' . $this->pClassCommon($node->class, $args); } - return 'new ' . $this->pNewVariable($node->class) . '(' . $this->pMaybeMultiline($node->args) . ')'; + return 'new ' . $this->pNewOperand($node->class) . '(' . $this->pMaybeMultiline($node->args) . ')'; } - protected function pExpr_Clone(Expr\Clone_ $node) + protected function pExpr_Clone(Expr\Clone_ $node, int $precedence, int $lhsPrecedence) : string { - return 'clone ' . $this->p($node->expr); + return $this->pPrefixOp(Expr\Clone_::class, 'clone ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_Ternary(Expr\Ternary $node) + protected function pExpr_Ternary(Expr\Ternary $node, int $precedence, int $lhsPrecedence) : string { // a bit of cheating: we treat the ternary as a binary op where the ?...: part is the operator. // this is okay because the part between ? and : never needs parentheses. - return $this->pInfixOp(Expr\Ternary::class, $node->cond, ' ?' . (null !== $node->if ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->else); + return $this->pInfixOp(Expr\Ternary::class, $node->cond, ' ?' . (null !== $node->if ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->else, $precedence, $lhsPrecedence); } - protected function pExpr_Exit(Expr\Exit_ $node) + protected function pExpr_Exit(Expr\Exit_ $node) : string { $kind = $node->getAttribute('kind', Expr\Exit_::KIND_DIE); return ($kind === Expr\Exit_::KIND_EXIT ? 'exit' : 'die') . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : ''); } - protected function pExpr_Throw(Expr\Throw_ $node) + protected function pExpr_Throw(Expr\Throw_ $node, int $precedence, int $lhsPrecedence) : string { - return 'throw ' . $this->p($node->expr); + return $this->pPrefixOp(Expr\Throw_::class, 'throw ', $node->expr, $precedence, $lhsPrecedence); } - protected function pExpr_Yield(Expr\Yield_ $node) + protected function pExpr_Yield(Expr\Yield_ $node, int $precedence, int $lhsPrecedence) : string { if ($node->value === null) { - return 'yield'; + $opPrecedence = $this->precedenceMap[Expr\Yield_::class][0]; + return $opPrecedence >= $lhsPrecedence ? '(yield)' : 'yield'; } else { - // this is a bit ugly, but currently there is no way to detect whether the parentheses are necessary - return '(yield ' . ($node->key !== null ? $this->p($node->key) . ' => ' : '') . $this->p($node->value) . ')'; + if (!$this->phpVersion->supportsYieldWithoutParentheses()) { + return '(yield ' . $this->pKey($node->key) . $this->p($node->value) . ')'; + } + return $this->pPrefixOp(Expr\Yield_::class, 'yield ' . $this->pKey($node->key), $node->value, $precedence, $lhsPrecedence); } } // Declarations - protected function pStmt_Namespace(Stmt\Namespace_ $node) + protected function pStmt_Namespace(Stmt\Namespace_ $node) : string { if ($this->canUseSemicolonNamespaces) { return 'namespace ' . $this->p($node->name) . ';' . $this->nl . $this->pStmts($node->stmts, \false); @@ -635,215 +673,225 @@ class Standard extends PrettyPrinterAbstract return 'namespace' . (null !== $node->name ? ' ' . $this->p($node->name) : '') . ' {' . $this->pStmts($node->stmts) . $this->nl . '}'; } } - protected function pStmt_Use(Stmt\Use_ $node) + protected function pStmt_Use(Stmt\Use_ $node) : string { return 'use ' . $this->pUseType($node->type) . $this->pCommaSeparated($node->uses) . ';'; } - protected function pStmt_GroupUse(Stmt\GroupUse $node) + protected function pStmt_GroupUse(Stmt\GroupUse $node) : string { return 'use ' . $this->pUseType($node->type) . $this->pName($node->prefix) . '\\{' . $this->pCommaSeparated($node->uses) . '};'; } - protected function pStmt_UseUse(Stmt\UseUse $node) + protected function pUseItem(Node\UseItem $node) : string { return $this->pUseType($node->type) . $this->p($node->name) . (null !== $node->alias ? ' as ' . $node->alias : ''); } - protected function pUseType($type) + protected function pUseType(int $type) : string { return $type === Stmt\Use_::TYPE_FUNCTION ? 'function ' : ($type === Stmt\Use_::TYPE_CONSTANT ? 'const ' : ''); } - protected function pStmt_Interface(Stmt\Interface_ $node) + protected function pStmt_Interface(Stmt\Interface_ $node) : string { return $this->pAttrGroups($node->attrGroups) . 'interface ' . $node->name . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pStmt_Enum(Stmt\Enum_ $node) + protected function pStmt_Enum(Stmt\Enum_ $node) : string { - return $this->pAttrGroups($node->attrGroups) . 'enum ' . $node->name . ($node->scalarType ? " : {$node->scalarType}" : '') . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + return $this->pAttrGroups($node->attrGroups) . 'enum ' . $node->name . ($node->scalarType ? ' : ' . $this->p($node->scalarType) : '') . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pStmt_Class(Stmt\Class_ $node) + protected function pStmt_Class(Stmt\Class_ $node) : string { return $this->pClassCommon($node, ' ' . $node->name); } - protected function pStmt_Trait(Stmt\Trait_ $node) + protected function pStmt_Trait(Stmt\Trait_ $node) : string { return $this->pAttrGroups($node->attrGroups) . 'trait ' . $node->name . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pStmt_EnumCase(Stmt\EnumCase $node) + protected function pStmt_EnumCase(Stmt\EnumCase $node) : string { return $this->pAttrGroups($node->attrGroups) . 'case ' . $node->name . ($node->expr ? ' = ' . $this->p($node->expr) : '') . ';'; } - protected function pStmt_TraitUse(Stmt\TraitUse $node) + protected function pStmt_TraitUse(Stmt\TraitUse $node) : string { return 'use ' . $this->pCommaSeparated($node->traits) . (empty($node->adaptations) ? ';' : ' {' . $this->pStmts($node->adaptations) . $this->nl . '}'); } - protected function pStmt_TraitUseAdaptation_Precedence(Stmt\TraitUseAdaptation\Precedence $node) + protected function pStmt_TraitUseAdaptation_Precedence(Stmt\TraitUseAdaptation\Precedence $node) : string { return $this->p($node->trait) . '::' . $node->method . ' insteadof ' . $this->pCommaSeparated($node->insteadof) . ';'; } - protected function pStmt_TraitUseAdaptation_Alias(Stmt\TraitUseAdaptation\Alias $node) + protected function pStmt_TraitUseAdaptation_Alias(Stmt\TraitUseAdaptation\Alias $node) : string { return (null !== $node->trait ? $this->p($node->trait) . '::' : '') . $node->method . ' as' . (null !== $node->newModifier ? ' ' . \rtrim($this->pModifiers($node->newModifier), ' ') : '') . (null !== $node->newName ? ' ' . $node->newName : '') . ';'; } - protected function pStmt_Property(Stmt\Property $node) + protected function pStmt_Property(Stmt\Property $node) : string { - return $this->pAttrGroups($node->attrGroups) . (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags)) . ($node->type ? $this->p($node->type) . ' ' : '') . $this->pCommaSeparated($node->props) . ';'; + return $this->pAttrGroups($node->attrGroups) . (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags)) . ($node->type ? $this->p($node->type) . ' ' : '') . $this->pCommaSeparated($node->props) . ($node->hooks ? ' {' . $this->pStmts($node->hooks) . $this->nl . '}' : ';'); } - protected function pStmt_PropertyProperty(Stmt\PropertyProperty $node) + protected function pPropertyItem(Node\PropertyItem $node) : string { return '$' . $node->name . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); } - protected function pStmt_ClassMethod(Stmt\ClassMethod $node) + protected function pPropertyHook(Node\PropertyHook $node) : string { - return $this->pAttrGroups($node->attrGroups) . $this->pModifiers($node->flags) . 'function ' . ($node->byRef ? '&' : '') . $node->name . '(' . $this->pMaybeMultiline($node->params) . ')' . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '') . (null !== $node->stmts ? $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}' : ';'); + return $this->pAttrGroups($node->attrGroups) . $this->pModifiers($node->flags) . ($node->byRef ? '&' : '') . $node->name . ($node->params ? '(' . $this->pMaybeMultiline($node->params, $this->phpVersion->supportsTrailingCommaInParamList()) . ')' : '') . (\is_array($node->body) ? ' {' . $this->pStmts($node->body) . $this->nl . '}' : ($node->body !== null ? ' => ' . $this->p($node->body) : '') . ';'); } - protected function pStmt_ClassConst(Stmt\ClassConst $node) + protected function pStmt_ClassMethod(Stmt\ClassMethod $node) : string + { + return $this->pAttrGroups($node->attrGroups) . $this->pModifiers($node->flags) . 'function ' . ($node->byRef ? '&' : '') . $node->name . '(' . $this->pMaybeMultiline($node->params, $this->phpVersion->supportsTrailingCommaInParamList()) . ')' . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '') . (null !== $node->stmts ? $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}' : ';'); + } + protected function pStmt_ClassConst(Stmt\ClassConst $node) : string { return $this->pAttrGroups($node->attrGroups) . $this->pModifiers($node->flags) . 'const ' . (null !== $node->type ? $this->p($node->type) . ' ' : '') . $this->pCommaSeparated($node->consts) . ';'; } - protected function pStmt_Function(Stmt\Function_ $node) + protected function pStmt_Function(Stmt\Function_ $node) : string { - return $this->pAttrGroups($node->attrGroups) . 'function ' . ($node->byRef ? '&' : '') . $node->name . '(' . $this->pCommaSeparated($node->params) . ')' . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + return $this->pAttrGroups($node->attrGroups) . 'function ' . ($node->byRef ? '&' : '') . $node->name . '(' . $this->pMaybeMultiline($node->params, $this->phpVersion->supportsTrailingCommaInParamList()) . ')' . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pStmt_Const(Stmt\Const_ $node) + protected function pStmt_Const(Stmt\Const_ $node) : string { return 'const ' . $this->pCommaSeparated($node->consts) . ';'; } - protected function pStmt_Declare(Stmt\Declare_ $node) + protected function pStmt_Declare(Stmt\Declare_ $node) : string { return 'declare (' . $this->pCommaSeparated($node->declares) . ')' . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . $this->nl . '}' : ';'); } - protected function pStmt_DeclareDeclare(Stmt\DeclareDeclare $node) + protected function pDeclareItem(Node\DeclareItem $node) : string { return $node->key . '=' . $this->p($node->value); } // Control flow - protected function pStmt_If(Stmt\If_ $node) + protected function pStmt_If(Stmt\If_ $node) : string { return 'if (' . $this->p($node->cond) . ') {' . $this->pStmts($node->stmts) . $this->nl . '}' . ($node->elseifs ? ' ' . $this->pImplode($node->elseifs, ' ') : '') . (null !== $node->else ? ' ' . $this->p($node->else) : ''); } - protected function pStmt_ElseIf(Stmt\ElseIf_ $node) + protected function pStmt_ElseIf(Stmt\ElseIf_ $node) : string { return 'elseif (' . $this->p($node->cond) . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pStmt_Else(Stmt\Else_ $node) + protected function pStmt_Else(Stmt\Else_ $node) : string { + if (\count($node->stmts) === 1 && $node->stmts[0] instanceof Stmt\If_) { + // Print as "else if" rather than "else { if }" + return 'else ' . $this->p($node->stmts[0]); + } return 'else {' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pStmt_For(Stmt\For_ $node) + protected function pStmt_For(Stmt\For_ $node) : string { return 'for (' . $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '') . $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '') . $this->pCommaSeparated($node->loop) . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pStmt_Foreach(Stmt\Foreach_ $node) + protected function pStmt_Foreach(Stmt\Foreach_ $node) : string { return 'foreach (' . $this->p($node->expr) . ' as ' . (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '') . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pStmt_While(Stmt\While_ $node) + protected function pStmt_While(Stmt\While_ $node) : string { return 'while (' . $this->p($node->cond) . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pStmt_Do(Stmt\Do_ $node) + protected function pStmt_Do(Stmt\Do_ $node) : string { return 'do {' . $this->pStmts($node->stmts) . $this->nl . '} while (' . $this->p($node->cond) . ');'; } - protected function pStmt_Switch(Stmt\Switch_ $node) + protected function pStmt_Switch(Stmt\Switch_ $node) : string { return 'switch (' . $this->p($node->cond) . ') {' . $this->pStmts($node->cases) . $this->nl . '}'; } - protected function pStmt_Case(Stmt\Case_ $node) + protected function pStmt_Case(Stmt\Case_ $node) : string { return (null !== $node->cond ? 'case ' . $this->p($node->cond) : 'default') . ':' . $this->pStmts($node->stmts); } - protected function pStmt_TryCatch(Stmt\TryCatch $node) + protected function pStmt_TryCatch(Stmt\TryCatch $node) : string { return 'try {' . $this->pStmts($node->stmts) . $this->nl . '}' . ($node->catches ? ' ' . $this->pImplode($node->catches, ' ') : '') . ($node->finally !== null ? ' ' . $this->p($node->finally) : ''); } - protected function pStmt_Catch(Stmt\Catch_ $node) + protected function pStmt_Catch(Stmt\Catch_ $node) : string { return 'catch (' . $this->pImplode($node->types, '|') . ($node->var !== null ? ' ' . $this->p($node->var) : '') . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pStmt_Finally(Stmt\Finally_ $node) + protected function pStmt_Finally(Stmt\Finally_ $node) : string { return 'finally {' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pStmt_Break(Stmt\Break_ $node) + protected function pStmt_Break(Stmt\Break_ $node) : string { return 'break' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';'; } - protected function pStmt_Continue(Stmt\Continue_ $node) + protected function pStmt_Continue(Stmt\Continue_ $node) : string { return 'continue' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';'; } - protected function pStmt_Return(Stmt\Return_ $node) + protected function pStmt_Return(Stmt\Return_ $node) : string { return 'return' . (null !== $node->expr ? ' ' . $this->p($node->expr) : '') . ';'; } - protected function pStmt_Throw(Stmt\Throw_ $node) - { - return 'throw ' . $this->p($node->expr) . ';'; - } - protected function pStmt_Label(Stmt\Label $node) + protected function pStmt_Label(Stmt\Label $node) : string { return $node->name . ':'; } - protected function pStmt_Goto(Stmt\Goto_ $node) + protected function pStmt_Goto(Stmt\Goto_ $node) : string { return 'goto ' . $node->name . ';'; } // Other - protected function pStmt_Expression(Stmt\Expression $node) + protected function pStmt_Expression(Stmt\Expression $node) : string { return $this->p($node->expr) . ';'; } - protected function pStmt_Echo(Stmt\Echo_ $node) + protected function pStmt_Echo(Stmt\Echo_ $node) : string { return 'echo ' . $this->pCommaSeparated($node->exprs) . ';'; } - protected function pStmt_Static(Stmt\Static_ $node) + protected function pStmt_Static(Stmt\Static_ $node) : string { return 'static ' . $this->pCommaSeparated($node->vars) . ';'; } - protected function pStmt_Global(Stmt\Global_ $node) + protected function pStmt_Global(Stmt\Global_ $node) : string { return 'global ' . $this->pCommaSeparated($node->vars) . ';'; } - protected function pStmt_StaticVar(Stmt\StaticVar $node) + protected function pStaticVar(Node\StaticVar $node) : string { return $this->p($node->var) . (null !== $node->default ? ' = ' . $this->p($node->default) : ''); } - protected function pStmt_Unset(Stmt\Unset_ $node) + protected function pStmt_Unset(Stmt\Unset_ $node) : string { return 'unset(' . $this->pCommaSeparated($node->vars) . ');'; } - protected function pStmt_InlineHTML(Stmt\InlineHTML $node) + protected function pStmt_InlineHTML(Stmt\InlineHTML $node) : string { - $newline = $node->getAttribute('hasLeadingNewline', \true) ? "\n" : ''; + $newline = $node->getAttribute('hasLeadingNewline', \true) ? $this->newline : ''; return '?>' . $newline . $node->value . 'remaining; } - protected function pStmt_Nop(Stmt\Nop $node) + protected function pStmt_Nop(Stmt\Nop $node) : string { return ''; } + protected function pStmt_Block(Stmt\Block $node) : string + { + return '{' . $this->pStmts($node->stmts) . $this->nl . '}'; + } // Helpers - protected function pClassCommon(Stmt\Class_ $node, $afterClassToken) + protected function pClassCommon(Stmt\Class_ $node, string $afterClassToken) : string { return $this->pAttrGroups($node->attrGroups, $node->name === null) . $this->pModifiers($node->flags) . 'class' . $afterClassToken . (null !== $node->extends ? ' extends ' . $this->p($node->extends) : '') . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '') . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'; } - protected function pObjectProperty($node) + protected function pObjectProperty(Node $node) : string { if ($node instanceof Expr) { return '{' . $this->p($node) . '}'; } else { - return $node; + \assert($node instanceof Node\Identifier); + return $node->name; } } - protected function pEncapsList(array $encapsList, $quote) + /** @param (Expr|Node\InterpolatedStringPart)[] $encapsList */ + protected function pEncapsList(array $encapsList, ?string $quote) : string { $return = ''; foreach ($encapsList as $element) { - if ($element instanceof Scalar\EncapsedStringPart) { + if ($element instanceof Node\InterpolatedStringPart) { $return .= $this->escapeString($element->value, $quote); } else { $return .= '{' . $this->p($element) . '}'; @@ -851,15 +899,26 @@ class Standard extends PrettyPrinterAbstract } return $return; } - protected function pSingleQuotedString(string $string) + protected function pSingleQuotedString(string $string) : string { - return '\'' . \addcslashes($string, '\'\\') . '\''; + // It is idiomatic to only escape backslashes when necessary, i.e. when followed by ', \ or + // the end of the string ('Foo\Bar' instead of 'Foo\\Bar'). However, we also don't want to + // produce an odd number of backslashes, so '\\\\a' should not get rendered as '\\\a', even + // though that would be legal. + $regex = '/\'|\\\\(?=[\'\\\\]|$)|(?<=\\\\)\\\\/'; + return '\'' . \preg_replace($regex, '\\\\$0', $string) . '\''; } - protected function escapeString($string, $quote) + protected function escapeString(string $string, ?string $quote) : string { if (null === $quote) { // For doc strings, don't escape newlines $escaped = \addcslashes($string, "\t\f\v\$\\"); + // But do escape isolated \r. Combined with the terminating newline, it might get + // interpreted as \r\n and dropped from the string contents. + $escaped = \preg_replace('/\\r(?!\\n)/', '\\r', $escaped); + if ($this->phpVersion->supportsFlexibleHeredoc()) { + $escaped = $this->indentString($escaped); + } } else { $escaped = \addcslashes($string, "\n\r\t\f\v\$" . $quote . "\\"); } @@ -880,30 +939,28 @@ class Standard extends PrettyPrinterAbstract | (?<=[\\xF0-\\xF4])[\\x80-\\xBF](?![\\x80-\\xBF]{2}) # Short 4 byte sequence | (?<=[\\xF0-\\xF4][\\x80-\\xBF])[\\x80-\\xBF](?![\\x80-\\xBF]) # Short 4 byte sequence (2) )/x'; - return \preg_replace_callback($regex, function ($matches) { + return \preg_replace_callback($regex, function ($matches) : string { \assert(\strlen($matches[0]) === 1); $hex = \dechex(\ord($matches[0])); return '\\x' . \str_pad($hex, 2, '0', \STR_PAD_LEFT); }, $escaped); } - protected function containsEndLabel($string, $label, $atStart = \true, $atEnd = \true) + protected function containsEndLabel(string $string, string $label, bool $atStart = \true) : bool { - $start = $atStart ? '(?:^|[\\r\\n])' : '[\\r\\n]'; - $end = $atEnd ? '(?:$|[;\\r\\n])' : '[;\\r\\n]'; - return \false !== \strpos($string, $label) && \preg_match('/' . $start . $label . $end . '/', $string); + $start = $atStart ? '(?:^|[\\r\\n])[ \\t]*' : '[\\r\\n][ \\t]*'; + return \false !== \strpos($string, $label) && \preg_match('/' . $start . $label . '(?:$|[^_A-Za-z0-9\\x80-\\xff])/', $string); } - protected function encapsedContainsEndLabel(array $parts, $label) + /** @param (Expr|Node\InterpolatedStringPart)[] $parts */ + protected function encapsedContainsEndLabel(array $parts, string $label) : bool { foreach ($parts as $i => $part) { - $atStart = $i === 0; - $atEnd = $i === \count($parts) - 1; - if ($part instanceof Scalar\EncapsedStringPart && $this->containsEndLabel($part->value, $label, $atStart, $atEnd)) { + if ($part instanceof Node\InterpolatedStringPart && $this->containsEndLabel($this->escapeString($part->value, null), $label, $i === 0)) { return \true; } } return \false; } - protected function pDereferenceLhs(Node $node) + protected function pDereferenceLhs(Node $node) : string { if (!$this->dereferenceLhsRequiresParens($node)) { return $this->p($node); @@ -911,7 +968,7 @@ class Standard extends PrettyPrinterAbstract return '(' . $this->p($node) . ')'; } } - protected function pStaticDereferenceLhs(Node $node) + protected function pStaticDereferenceLhs(Node $node) : string { if (!$this->staticDereferenceLhsRequiresParens($node)) { return $this->p($node); @@ -919,7 +976,7 @@ class Standard extends PrettyPrinterAbstract return '(' . $this->p($node) . ')'; } } - protected function pCallLhs(Node $node) + protected function pCallLhs(Node $node) : string { if (!$this->callLhsRequiresParens($node)) { return $this->p($node); @@ -927,7 +984,7 @@ class Standard extends PrettyPrinterAbstract return '(' . $this->p($node) . ')'; } } - protected function pNewVariable(Node $node) : string + protected function pNewOperand(Node $node) : string { if (!$this->newOperandRequiresParens($node)) { return $this->p($node); @@ -937,9 +994,8 @@ class Standard extends PrettyPrinterAbstract } /** * @param Node[] $nodes - * @return bool */ - protected function hasNodeWithComments(array $nodes) + protected function hasNodeWithComments(array $nodes) : bool { foreach ($nodes as $node) { if ($node && $node->getComments()) { @@ -948,7 +1004,8 @@ class Standard extends PrettyPrinterAbstract } return \false; } - protected function pMaybeMultiline(array $nodes, bool $trailingComma = \false) + /** @param Node[] $nodes */ + protected function pMaybeMultiline(array $nodes, bool $trailingComma = \false) : string { if (!$this->hasNodeWithComments($nodes)) { return $this->pCommaSeparated($nodes); @@ -956,6 +1013,7 @@ class Standard extends PrettyPrinterAbstract return $this->pCommaSeparatedMultiline($nodes, $trailingComma) . $this->nl; } } + /** @param Node\AttributeGroup[] $nodes */ protected function pAttrGroups(array $nodes, bool $inline = \false) : string { $result = ''; diff --git a/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php index 918ff2165fa..7b9bd4dfe24 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php +++ b/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php @@ -4,166 +4,222 @@ declare (strict_types=1); namespace PhpParser; use PhpParser\Internal\DiffElem; +use PhpParser\Internal\Differ; use PhpParser\Internal\PrintableNewAnonClassNode; use PhpParser\Internal\TokenStream; +use PhpParser\Node\AttributeGroup; use PhpParser\Node\Expr; use PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\Cast; +use PhpParser\Node\IntersectionType; +use PhpParser\Node\MatchArm; +use PhpParser\Node\Param; +use PhpParser\Node\PropertyHook; use PhpParser\Node\Scalar; use PhpParser\Node\Stmt; -abstract class PrettyPrinterAbstract +use PhpParser\Node\UnionType; +abstract class PrettyPrinterAbstract implements \PhpParser\PrettyPrinter { - const FIXUP_PREC_LEFT = 0; + protected const FIXUP_PREC_LEFT = 0; // LHS operand affected by precedence - const FIXUP_PREC_RIGHT = 1; + protected const FIXUP_PREC_RIGHT = 1; // RHS operand affected by precedence - const FIXUP_CALL_LHS = 2; + protected const FIXUP_PREC_UNARY = 2; + // Only operand affected by precedence + protected const FIXUP_CALL_LHS = 3; // LHS of call - const FIXUP_DEREF_LHS = 3; + protected const FIXUP_DEREF_LHS = 4; // LHS of dereferencing operation - const FIXUP_BRACED_NAME = 4; - // Name operand that may require bracing - const FIXUP_VAR_BRACED_NAME = 5; - // Name operand that may require ${} bracing - const FIXUP_ENCAPSED = 6; - // Encapsed string part - const FIXUP_NEW = 7; - // New/instanceof operand - const FIXUP_STATIC_DEREF_LHS = 8; + protected const FIXUP_STATIC_DEREF_LHS = 5; // LHS of static dereferencing operation - protected $precedenceMap = [ - // [precedence, associativity] - // where for precedence -1 is %left, 0 is %nonassoc and 1 is %right - BinaryOp\Pow::class => [0, 1], - Expr\BitwiseNot::class => [10, 1], - Expr\PreInc::class => [10, 1], - Expr\PreDec::class => [10, 1], - Expr\PostInc::class => [10, -1], - Expr\PostDec::class => [10, -1], - Expr\UnaryPlus::class => [10, 1], - Expr\UnaryMinus::class => [10, 1], - Cast\Int_::class => [10, 1], - Cast\Double::class => [10, 1], - Cast\String_::class => [10, 1], - Cast\Array_::class => [10, 1], - Cast\Object_::class => [10, 1], - Cast\Bool_::class => [10, 1], - Cast\Unset_::class => [10, 1], - Expr\ErrorSuppress::class => [10, 1], - Expr\Instanceof_::class => [20, 0], - Expr\BooleanNot::class => [30, 1], - BinaryOp\Mul::class => [40, -1], - BinaryOp\Div::class => [40, -1], - BinaryOp\Mod::class => [40, -1], - BinaryOp\Plus::class => [50, -1], - BinaryOp\Minus::class => [50, -1], - BinaryOp\Concat::class => [50, -1], - BinaryOp\ShiftLeft::class => [60, -1], - BinaryOp\ShiftRight::class => [60, -1], - BinaryOp\Smaller::class => [70, 0], - BinaryOp\SmallerOrEqual::class => [70, 0], - BinaryOp\Greater::class => [70, 0], - BinaryOp\GreaterOrEqual::class => [70, 0], - BinaryOp\Equal::class => [80, 0], - BinaryOp\NotEqual::class => [80, 0], - BinaryOp\Identical::class => [80, 0], - BinaryOp\NotIdentical::class => [80, 0], - BinaryOp\Spaceship::class => [80, 0], - BinaryOp\BitwiseAnd::class => [90, -1], - BinaryOp\BitwiseXor::class => [100, -1], - BinaryOp\BitwiseOr::class => [110, -1], - BinaryOp\BooleanAnd::class => [120, -1], - BinaryOp\BooleanOr::class => [130, -1], - BinaryOp\Coalesce::class => [140, 1], - Expr\Ternary::class => [150, 0], - // parser uses %left for assignments, but they really behave as %right - Expr\Assign::class => [160, 1], - Expr\AssignRef::class => [160, 1], - AssignOp\Plus::class => [160, 1], - AssignOp\Minus::class => [160, 1], - AssignOp\Mul::class => [160, 1], - AssignOp\Div::class => [160, 1], - AssignOp\Concat::class => [160, 1], - AssignOp\Mod::class => [160, 1], - AssignOp\BitwiseAnd::class => [160, 1], - AssignOp\BitwiseOr::class => [160, 1], - AssignOp\BitwiseXor::class => [160, 1], - AssignOp\ShiftLeft::class => [160, 1], - AssignOp\ShiftRight::class => [160, 1], - AssignOp\Pow::class => [160, 1], - AssignOp\Coalesce::class => [160, 1], - Expr\YieldFrom::class => [165, 1], - Expr\Print_::class => [168, 1], - BinaryOp\LogicalAnd::class => [170, -1], - BinaryOp\LogicalXor::class => [180, -1], - BinaryOp\LogicalOr::class => [190, -1], - Expr\Include_::class => [200, -1], + protected const FIXUP_BRACED_NAME = 6; + // Name operand that may require bracing + protected const FIXUP_VAR_BRACED_NAME = 7; + // Name operand that may require ${} bracing + protected const FIXUP_ENCAPSED = 8; + // Encapsed string part + protected const FIXUP_NEW = 9; + // New/instanceof operand + protected const MAX_PRECEDENCE = 1000; + /** @var array */ + protected array $precedenceMap = [ + // [precedence, precedenceLHS, precedenceRHS] + // Where the latter two are the precedences to use for the LHS and RHS of a binary operator, + // where 1 is added to one of the sides depending on associativity. This information is not + // used for unary operators and set to -1. + Expr\Clone_::class => [-10, 0, 1], + BinaryOp\Pow::class => [0, 0, 1], + Expr\BitwiseNot::class => [10, -1, -1], + Expr\UnaryPlus::class => [10, -1, -1], + Expr\UnaryMinus::class => [10, -1, -1], + Cast\Int_::class => [10, -1, -1], + Cast\Double::class => [10, -1, -1], + Cast\String_::class => [10, -1, -1], + Cast\Array_::class => [10, -1, -1], + Cast\Object_::class => [10, -1, -1], + Cast\Bool_::class => [10, -1, -1], + Cast\Unset_::class => [10, -1, -1], + Expr\ErrorSuppress::class => [10, -1, -1], + Expr\Instanceof_::class => [20, -1, -1], + Expr\BooleanNot::class => [30, -1, -1], + BinaryOp\Mul::class => [40, 41, 40], + BinaryOp\Div::class => [40, 41, 40], + BinaryOp\Mod::class => [40, 41, 40], + BinaryOp\Plus::class => [50, 51, 50], + BinaryOp\Minus::class => [50, 51, 50], + BinaryOp\Concat::class => [50, 51, 50], + BinaryOp\ShiftLeft::class => [60, 61, 60], + BinaryOp\ShiftRight::class => [60, 61, 60], + BinaryOp\Smaller::class => [70, 70, 70], + BinaryOp\SmallerOrEqual::class => [70, 70, 70], + BinaryOp\Greater::class => [70, 70, 70], + BinaryOp\GreaterOrEqual::class => [70, 70, 70], + BinaryOp\Equal::class => [80, 80, 80], + BinaryOp\NotEqual::class => [80, 80, 80], + BinaryOp\Identical::class => [80, 80, 80], + BinaryOp\NotIdentical::class => [80, 80, 80], + BinaryOp\Spaceship::class => [80, 80, 80], + BinaryOp\BitwiseAnd::class => [90, 91, 90], + BinaryOp\BitwiseXor::class => [100, 101, 100], + BinaryOp\BitwiseOr::class => [110, 111, 110], + BinaryOp\BooleanAnd::class => [120, 121, 120], + BinaryOp\BooleanOr::class => [130, 131, 130], + BinaryOp\Coalesce::class => [140, 140, 141], + Expr\Ternary::class => [150, 150, 150], + Expr\Assign::class => [160, -1, -1], + Expr\AssignRef::class => [160, -1, -1], + AssignOp\Plus::class => [160, -1, -1], + AssignOp\Minus::class => [160, -1, -1], + AssignOp\Mul::class => [160, -1, -1], + AssignOp\Div::class => [160, -1, -1], + AssignOp\Concat::class => [160, -1, -1], + AssignOp\Mod::class => [160, -1, -1], + AssignOp\BitwiseAnd::class => [160, -1, -1], + AssignOp\BitwiseOr::class => [160, -1, -1], + AssignOp\BitwiseXor::class => [160, -1, -1], + AssignOp\ShiftLeft::class => [160, -1, -1], + AssignOp\ShiftRight::class => [160, -1, -1], + AssignOp\Pow::class => [160, -1, -1], + AssignOp\Coalesce::class => [160, -1, -1], + Expr\YieldFrom::class => [170, -1, -1], + Expr\Yield_::class => [175, -1, -1], + Expr\Print_::class => [180, -1, -1], + BinaryOp\LogicalAnd::class => [190, 191, 190], + BinaryOp\LogicalXor::class => [200, 201, 200], + BinaryOp\LogicalOr::class => [210, 211, 210], + Expr\Include_::class => [220, -1, -1], + Expr\ArrowFunction::class => [230, -1, -1], + Expr\Throw_::class => [240, -1, -1], ]; /** @var int Current indentation level. */ - protected $indentLevel; + protected int $indentLevel; + /** @var string String for single level of indentation */ + private string $indent; + /** @var int Width in spaces to indent by. */ + private int $indentWidth; + /** @var bool Whether to use tab indentation. */ + private bool $useTabs; + /** @var int Width in spaces of one tab. */ + private int $tabWidth = 4; + /** @var string Newline style. Does not include current indentation. */ + protected string $newline; /** @var string Newline including current indentation. */ - protected $nl; - /** @var string Token placed at end of doc string to ensure it is followed by a newline. */ - protected $docStringEndToken; + protected string $nl; + /** @var string|null Token placed at end of doc string to ensure it is followed by a newline. + * Null if flexible doc strings are used. */ + protected ?string $docStringEndToken; /** @var bool Whether semicolon namespaces can be used (i.e. no global namespace is used) */ - protected $canUseSemicolonNamespaces; - /** @var array Pretty printer options */ - protected $options; - /** @var TokenStream Original tokens for use in format-preserving pretty print */ - protected $origTokens; - /** @var Internal\Differ Differ for node lists */ - protected $nodeListDiffer; - /** @var bool[] Map determining whether a certain character is a label character */ - protected $labelCharMap; + protected bool $canUseSemicolonNamespaces; + /** @var bool Whether to use short array syntax if the node specifies no preference */ + protected bool $shortArraySyntax; + /** @var PhpVersion PHP version to target */ + protected \PhpParser\PhpVersion $phpVersion; + /** @var TokenStream|null Original tokens for use in format-preserving pretty print */ + protected ?TokenStream $origTokens; + /** @var Internal\Differ Differ for node lists */ + protected Differ $nodeListDiffer; + /** @var array Map determining whether a certain character is a label character */ + protected array $labelCharMap; /** - * @var int[][] Map from token classes and subnode names to FIXUP_* constants. This is used - * during format-preserving prints to place additional parens/braces if necessary. + * @var array> Map from token classes and subnode names to FIXUP_* constants. + * This is used during format-preserving prints to place additional parens/braces if necessary. */ - protected $fixupMap; + protected array $fixupMap; /** - * @var int[][] Map from "{$node->getType()}->{$subNode}" to ['left' => $l, 'right' => $r], - * where $l and $r specify the token type that needs to be stripped when removing - * this node. + * @var array Map from "{$node->getType()}->{$subNode}" + * to ['left' => $l, 'right' => $r], where $l and $r specify the token type that needs to be stripped + * when removing this node. */ - protected $removalMap; + protected array $removalMap; /** - * @var mixed[] Map from "{$node->getType()}->{$subNode}" to [$find, $beforeToken, $extraLeft, $extraRight]. - * $find is an optional token after which the insertion occurs. $extraLeft/Right - * are optionally added before/after the main insertions. + * @var array Map from + * "{$node->getType()}->{$subNode}" to [$find, $beforeToken, $extraLeft, $extraRight]. + * $find is an optional token after which the insertion occurs. $extraLeft/Right + * are optionally added before/after the main insertions. */ - protected $insertionMap; + protected array $insertionMap; /** - * @var string[] Map From "{$node->getType()}->{$subNode}" to string that should be inserted - * between elements of this list subnode. + * @var array Map From "{$class}->{$subNode}" to string that should be inserted + * between elements of this list subnode. */ - protected $listInsertionMap; - protected $emptyListInsertionMap; - /** @var int[] Map from "{$node->getType()}->{$subNode}" to token before which the modifiers - * should be reprinted. */ - protected $modifierChangeMap; + protected array $listInsertionMap; + /** + * @var array + */ + protected array $emptyListInsertionMap; + /** @var array Map from "{$class}->{$subNode}" to [$printFn, $token] + * where $printFn is the function to print the modifiers and $token is the token before which + * the modifiers should be reprinted. */ + protected array $modifierChangeMap; /** * Creates a pretty printer instance using the given options. * * Supported options: - * * bool $shortArraySyntax = false: Whether to use [] instead of array() as the default array - * syntax, if the node does not specify a format. + * * PhpVersion $phpVersion: The PHP version to target (default to PHP 7.4). This option + * controls compatibility of the generated code with older PHP + * versions in cases where a simple stylistic choice exists (e.g. + * array() vs []). It is safe to pretty-print an AST for a newer + * PHP version while specifying an older target (but the result will + * of course not be compatible with the older version in that case). + * * string $newline: The newline style to use. Should be "\n" (default) or "\r\n". + * * string $indent: The indentation to use. Should either be all spaces or a single + * tab. Defaults to four spaces (" "). + * * bool $shortArraySyntax: Whether to use [] instead of array() as the default array + * syntax, if the node does not specify a format. Defaults to whether + * the phpVersion support short array syntax. * - * @param array $options Dictionary of formatting options + * @param array{ + * phpVersion?: PhpVersion, newline?: string, indent?: string, shortArraySyntax?: bool + * } $options Dictionary of formatting options */ public function __construct(array $options = []) { - $this->docStringEndToken = '_DOC_STRING_END_' . \mt_rand(); - $defaultOptions = ['shortArraySyntax' => \false]; - $this->options = $options + $defaultOptions; + $this->phpVersion = $options['phpVersion'] ?? \PhpParser\PhpVersion::fromComponents(7, 4); + $this->newline = $options['newline'] ?? "\n"; + if ($this->newline !== "\n" && $this->newline != "\r\n") { + throw new \LogicException('Option "newline" must be one of "\\n" or "\\r\\n"'); + } + $this->shortArraySyntax = $options['shortArraySyntax'] ?? $this->phpVersion->supportsShortArraySyntax(); + $this->docStringEndToken = $this->phpVersion->supportsFlexibleHeredoc() ? null : '_DOC_STRING_END_' . \mt_rand(); + $this->indent = $indent = $options['indent'] ?? ' '; + if ($indent === "\t") { + $this->useTabs = \true; + $this->indentWidth = $this->tabWidth; + } elseif ($indent === \str_repeat(' ', \strlen($indent))) { + $this->useTabs = \false; + $this->indentWidth = \strlen($indent); + } else { + throw new \LogicException('Option "indent" must either be all spaces or a single tab'); + } } /** * Reset pretty printing state. */ - protected function resetState() + protected function resetState() : void { $this->indentLevel = 0; - $this->nl = "\n"; + $this->nl = $this->newline; $this->origTokens = null; } /** @@ -171,27 +227,32 @@ abstract class PrettyPrinterAbstract * * @param int $level Level in number of spaces */ - protected function setIndentLevel(int $level) + protected function setIndentLevel(int $level) : void { $this->indentLevel = $level; - $this->nl = "\n" . \str_repeat(' ', $level); + if ($this->useTabs) { + $tabs = \intdiv($level, $this->tabWidth); + $spaces = $level % $this->tabWidth; + $this->nl = $this->newline . \str_repeat("\t", $tabs) . \str_repeat(' ', $spaces); + } else { + $this->nl = $this->newline . \str_repeat(' ', $level); + } } /** * Increase indentation level. */ - protected function indent() + protected function indent() : void { - $this->indentLevel += 4; - $this->nl .= ' '; + $this->indentLevel += $this->indentWidth; + $this->nl .= $this->indent; } /** * Decrease indentation level. */ - protected function outdent() + protected function outdent() : void { - \assert($this->indentLevel >= 4); - $this->indentLevel -= 4; - $this->nl = "\n" . \str_repeat(' ', $this->indentLevel); + \assert($this->indentLevel >= $this->indentWidth); + $this->setIndentLevel($this->indentLevel - $this->indentWidth); } /** * Pretty prints an array of statements. @@ -228,11 +289,11 @@ abstract class PrettyPrinterAbstract public function prettyPrintFile(array $stmts) : string { if (!$stmts) { - return "newline . $this->newline; } - $p = "prettyPrint($stmts); + $p = "newline . $this->newline . $this->prettyPrint($stmts); if ($stmts[0] instanceof Stmt\InlineHTML) { - $p = \preg_replace('/^<\\?php\\s+\\?>\\n?/', '', $p); + $p = \preg_replace('/^<\\?php\\s+\\?>\\r?\\n?/', '', $p); } if ($stmts[\count($stmts) - 1] instanceof Stmt\InlineHTML) { $p = \preg_replace('/<\\?php$/', '', \rtrim($p)); @@ -244,7 +305,7 @@ abstract class PrettyPrinterAbstract * * @param Node[] $nodes Array of nodes */ - protected function preprocessNodes(array $nodes) + protected function preprocessNodes(array $nodes) : void { /* We can use semicolon-namespaces unless there is a global namespace declaration */ $this->canUseSemicolonNamespaces = \true; @@ -256,23 +317,22 @@ abstract class PrettyPrinterAbstract } } /** - * Handles (and removes) no-indent and doc-string-end tokens. - * - * @param string $str - * @return string + * Handles (and removes) doc-string-end tokens. */ protected function handleMagicTokens(string $str) : string { - // Replace doc-string-end tokens with nothing or a newline - $str = \str_replace($this->docStringEndToken . ";\n", ";\n", $str); - $str = \str_replace($this->docStringEndToken, "\n", $str); + if ($this->docStringEndToken !== null) { + // Replace doc-string-end tokens with nothing or a newline + $str = \str_replace($this->docStringEndToken . ';' . $this->newline, ';' . $this->newline, $str); + $str = \str_replace($this->docStringEndToken, $this->newline, $str); + } return $str; } /** * Pretty prints an array of nodes (statements) and indents them optionally. * - * @param Node[] $nodes Array of nodes - * @param bool $indent Whether to indent the printed nodes + * @param Node[] $nodes Array of nodes + * @param bool $indent Whether to indent the printed nodes * * @return string Pretty printed statements */ @@ -300,76 +360,88 @@ abstract class PrettyPrinterAbstract /** * Pretty-print an infix operation while taking precedence into account. * - * @param string $class Node class of operator - * @param Node $leftNode Left-hand side node + * @param string $class Node class of operator + * @param Node $leftNode Left-hand side node * @param string $operatorString String representation of the operator - * @param Node $rightNode Right-hand side node + * @param Node $rightNode Right-hand side node + * @param int $precedence Precedence of parent operator + * @param int $lhsPrecedence Precedence for unary operator on LHS of binary operator * * @return string Pretty printed infix operation */ - protected function pInfixOp(string $class, \PhpParser\Node $leftNode, string $operatorString, \PhpParser\Node $rightNode) : string + protected function pInfixOp(string $class, \PhpParser\Node $leftNode, string $operatorString, \PhpParser\Node $rightNode, int $precedence, int $lhsPrecedence) : string { - list($precedence, $associativity) = $this->precedenceMap[$class]; - return $this->pPrec($leftNode, $precedence, $associativity, -1) . $operatorString . $this->pPrec($rightNode, $precedence, $associativity, 1); + list($opPrecedence, $newPrecedenceLHS, $newPrecedenceRHS) = $this->precedenceMap[$class]; + $prefix = ''; + $suffix = ''; + if ($opPrecedence >= $precedence) { + $prefix = '('; + $suffix = ')'; + $lhsPrecedence = self::MAX_PRECEDENCE; + } + return $prefix . $this->p($leftNode, $newPrecedenceLHS, $newPrecedenceLHS) . $operatorString . $this->p($rightNode, $newPrecedenceRHS, $lhsPrecedence) . $suffix; } /** * Pretty-print a prefix operation while taking precedence into account. * - * @param string $class Node class of operator + * @param string $class Node class of operator * @param string $operatorString String representation of the operator - * @param Node $node Node + * @param Node $node Node + * @param int $precedence Precedence of parent operator + * @param int $lhsPrecedence Precedence for unary operator on LHS of binary operator * * @return string Pretty printed prefix operation */ - protected function pPrefixOp(string $class, string $operatorString, \PhpParser\Node $node) : string + protected function pPrefixOp(string $class, string $operatorString, \PhpParser\Node $node, int $precedence, int $lhsPrecedence) : string { - list($precedence, $associativity) = $this->precedenceMap[$class]; - return $operatorString . $this->pPrec($node, $precedence, $associativity, 1); + $opPrecedence = $this->precedenceMap[$class][0]; + $prefix = ''; + $suffix = ''; + if ($opPrecedence >= $lhsPrecedence) { + $prefix = '('; + $suffix = ')'; + $lhsPrecedence = self::MAX_PRECEDENCE; + } + $printedArg = $this->p($node, $opPrecedence, $lhsPrecedence); + if ($operatorString === '+' && $printedArg[0] === '+' || $operatorString === '-' && $printedArg[0] === '-') { + // Avoid printing +(+$a) as ++$a and similar. + $printedArg = '(' . $printedArg . ')'; + } + return $prefix . $operatorString . $printedArg . $suffix; } /** * Pretty-print a postfix operation while taking precedence into account. * - * @param string $class Node class of operator + * @param string $class Node class of operator * @param string $operatorString String representation of the operator - * @param Node $node Node + * @param Node $node Node + * @param int $precedence Precedence of parent operator + * @param int $lhsPrecedence Precedence for unary operator on LHS of binary operator * * @return string Pretty printed postfix operation */ - protected function pPostfixOp(string $class, \PhpParser\Node $node, string $operatorString) : string + protected function pPostfixOp(string $class, \PhpParser\Node $node, string $operatorString, int $precedence, int $lhsPrecedence) : string { - list($precedence, $associativity) = $this->precedenceMap[$class]; - return $this->pPrec($node, $precedence, $associativity, -1) . $operatorString; - } - /** - * Prints an expression node with the least amount of parentheses necessary to preserve the meaning. - * - * @param Node $node Node to pretty print - * @param int $parentPrecedence Precedence of the parent operator - * @param int $parentAssociativity Associativity of parent operator - * (-1 is left, 0 is nonassoc, 1 is right) - * @param int $childPosition Position of the node relative to the operator - * (-1 is left, 1 is right) - * - * @return string The pretty printed node - */ - protected function pPrec(\PhpParser\Node $node, int $parentPrecedence, int $parentAssociativity, int $childPosition) : string - { - $class = \get_class($node); - if (isset($this->precedenceMap[$class])) { - $childPrecedence = $this->precedenceMap[$class][0]; - if ($childPrecedence > $parentPrecedence || $parentPrecedence === $childPrecedence && $parentAssociativity !== $childPosition) { - return '(' . $this->p($node) . ')'; - } + $opPrecedence = $this->precedenceMap[$class][0]; + $prefix = ''; + $suffix = ''; + if ($opPrecedence >= $precedence) { + $prefix = '('; + $suffix = ')'; + $lhsPrecedence = self::MAX_PRECEDENCE; } - return $this->p($node); + if ($opPrecedence < $lhsPrecedence) { + $lhsPrecedence = $opPrecedence; + } + return $prefix . $this->p($node, $opPrecedence, $lhsPrecedence) . $operatorString . $suffix; } /** * Pretty prints an array of nodes and implodes the printed values. * * @param Node[] $nodes Array of Nodes to be printed - * @param string $glue Character to implode with + * @param string $glue Character to implode with * - * @return string Imploded pretty printed nodes + * @return string Imploded pretty printed nodes> $pre */ protected function pImplode(array $nodes, string $glue = '') : string { @@ -399,8 +471,8 @@ abstract class PrettyPrinterAbstract * * The result includes a leading newline and one level of indentation (same as pStmts). * - * @param Node[] $nodes Array of Nodes to be printed - * @param bool $trailingComma Whether to use a trailing comma + * @param Node[] $nodes Array of Nodes to be printed + * @param bool $trailingComma Whether to use a trailing comma * * @return string Comma separated pretty printed nodes in multiline style */ @@ -452,11 +524,9 @@ abstract class PrettyPrinterAbstract * * The CloningVisitor must be run on the AST prior to modification. * * The original tokens must be provided, using the getTokens() method on the lexer. * - * @param Node[] $stmts Modified AST with links to original AST - * @param Node[] $origStmts Original AST with token offset information - * @param array $origTokens Tokens of the original code - * - * @return string + * @param Node[] $stmts Modified AST with links to original AST + * @param Node[] $origStmts Original AST with token offset information + * @param Token[] $origTokens Tokens of the original code */ public function printFormatPreserving(array $stmts, array $origStmts, array $origTokens) : string { @@ -469,22 +539,22 @@ abstract class PrettyPrinterAbstract $this->initializeEmptyListInsertionMap(); $this->initializeModifierChangeMap(); $this->resetState(); - $this->origTokens = new TokenStream($origTokens); + $this->origTokens = new TokenStream($origTokens, $this->tabWidth); $this->preprocessNodes($stmts); $pos = 0; $result = $this->pArray($stmts, $origStmts, $pos, 0, 'File', 'stmts', null); if (null !== $result) { - $result .= $this->origTokens->getTokenCode($pos, \count($origTokens), 0); + $result .= $this->origTokens->getTokenCode($pos, \count($origTokens) - 1, 0); } else { // Fallback // TODO Add pStmts($stmts, \false); + $result = "newline . $this->pStmts($stmts, \false); } - return \ltrim($this->handleMagicTokens($result)); + return $this->handleMagicTokens($result); } - protected function pFallback(\PhpParser\Node $node) + protected function pFallback(\PhpParser\Node $node, int $precedence, int $lhsPrecedence) : string { - return $this->{'p' . $node->getType()}($node); + return $this->{'p' . $node->getType()}($node, $precedence, $lhsPrecedence); } /** * Pretty prints a node. @@ -492,20 +562,22 @@ abstract class PrettyPrinterAbstract * This method also handles formatting preservation for nodes. * * @param Node $node Node to be pretty printed + * @param int $precedence Precedence of parent operator + * @param int $lhsPrecedence Precedence for unary operator on LHS of binary operator * @param bool $parentFormatPreserved Whether parent node has preserved formatting * * @return string Pretty printed node */ - protected function p(\PhpParser\Node $node, $parentFormatPreserved = \false) : string + protected function p(\PhpParser\Node $node, int $precedence = self::MAX_PRECEDENCE, int $lhsPrecedence = self::MAX_PRECEDENCE, bool $parentFormatPreserved = \false) : string { // No orig tokens means this is a normal pretty print without preservation of formatting if (!$this->origTokens) { - return $this->{'p' . $node->getType()}($node); + return $this->{'p' . $node->getType()}($node, $precedence, $lhsPrecedence); } - /** @var Node $origNode */ + /** @var Node|null $origNode */ $origNode = $node->getAttribute('origNode'); if (null === $origNode) { - return $this->pFallback($node); + return $this->pFallback($node, $precedence, $lhsPrecedence); } $class = \get_class($node); \assert($class === \get_class($origNode)); @@ -515,14 +587,16 @@ abstract class PrettyPrinterAbstract $fallbackNode = $node; if ($node instanceof Expr\New_ && $node->class instanceof Stmt\Class_) { // Normalize node structure of anonymous classes + \assert($origNode instanceof Expr\New_); $node = PrintableNewAnonClassNode::fromNewNode($node); $origNode = PrintableNewAnonClassNode::fromNewNode($origNode); + $class = PrintableNewAnonClassNode::class; } // InlineHTML node does not contain closing and opening PHP tags. If the parent formatting // is not preserved, then we need to use the fallback code to make sure the tags are // printed. if ($node instanceof Stmt\InlineHTML && !$parentFormatPreserved) { - return $this->pFallback($fallbackNode); + return $this->pFallback($fallbackNode, $precedence, $lhsPrecedence); } $indentAdjustment = $this->indentLevel - $this->origTokens->getIndentationBefore($startPos); $type = $node->getType(); @@ -539,28 +613,22 @@ abstract class PrettyPrinterAbstract } if (\is_array($subNode) && \is_array($origSubNode)) { // Array subnode changed, we might be able to reconstruct it - $listResult = $this->pArray($subNode, $origSubNode, $pos, $indentAdjustment, $type, $subNodeName, $fixupInfo[$subNodeName] ?? null); + $listResult = $this->pArray($subNode, $origSubNode, $pos, $indentAdjustment, $class, $subNodeName, $fixupInfo[$subNodeName] ?? null); if (null === $listResult) { - return $this->pFallback($fallbackNode); + return $this->pFallback($fallbackNode, $precedence, $lhsPrecedence); } $result .= $listResult; continue; } - if (\is_int($subNode) && \is_int($origSubNode)) { - // Check if this is a modifier change - $key = $type . '->' . $subNodeName; - if (!isset($this->modifierChangeMap[$key])) { - return $this->pFallback($fallbackNode); - } - $findToken = $this->modifierChangeMap[$key]; - $result .= $this->pModifiers($subNode); - $pos = $this->origTokens->findRight($pos, $findToken); - continue; + // Check if this is a modifier change + $key = $class . '->' . $subNodeName; + if (!isset($this->modifierChangeMap[$key])) { + return $this->pFallback($fallbackNode, $precedence, $lhsPrecedence); } - // If a non-node, non-array subnode changed, we don't be able to do a partial - // reconstructions, as we don't have enough offset information. Pretty print the - // whole node instead. - return $this->pFallback($fallbackNode); + [$printFn, $findToken] = $this->modifierChangeMap[$key]; + $result .= $this->{$printFn}($subNode); + $pos = $this->origTokens->findRight($pos, $findToken); + continue; } $extraLeft = ''; $extraRight = ''; @@ -576,7 +644,7 @@ abstract class PrettyPrinterAbstract // A node has been inserted, check if we have insertion information for it $key = $type . '->' . $subNodeName; if (!isset($this->insertionMap[$key])) { - return $this->pFallback($fallbackNode); + return $this->pFallback($fallbackNode, $precedence, $lhsPrecedence); } list($findToken, $beforeToken, $extraLeft, $extraRight) = $this->insertionMap[$key]; if (null !== $findToken) { @@ -594,7 +662,7 @@ abstract class PrettyPrinterAbstract // A node has been removed, check if we have removal information for it $key = $type . '->' . $subNodeName; if (!isset($this->removalMap[$key])) { - return $this->pFallback($fallbackNode); + return $this->pFallback($fallbackNode, $precedence, $lhsPrecedence); } // Adjust positions to account for additional tokens that must be skipped $removalInfo = $this->removalMap[$key]; @@ -617,7 +685,7 @@ abstract class PrettyPrinterAbstract $fixup = $fixupInfo[$subNodeName]; $res = $this->pFixup($fixup, $subNode, $class, $subStartPos, $subEndPos); } else { - $res = $this->p($subNode, \true); + $res = $this->p($subNode, self::MAX_PRECEDENCE, self::MAX_PRECEDENCE, \true); } $this->safeAppend($result, $res); $this->setIndentLevel($origIndentLevel); @@ -631,20 +699,20 @@ abstract class PrettyPrinterAbstract /** * Perform a format-preserving pretty print of an array. * - * @param array $nodes New nodes - * @param array $origNodes Original nodes - * @param int $pos Current token position (updated by reference) - * @param int $indentAdjustment Adjustment for indentation - * @param string $parentNodeType Type of the containing node. - * @param string $subNodeName Name of array subnode. - * @param null|int $fixup Fixup information for array item nodes + * @param Node[] $nodes New nodes + * @param Node[] $origNodes Original nodes + * @param int $pos Current token position (updated by reference) + * @param int $indentAdjustment Adjustment for indentation + * @param string $parentNodeClass Class of the containing node. + * @param string $subNodeName Name of array subnode. + * @param null|int $fixup Fixup information for array item nodes * * @return null|string Result of pretty print or null if cannot preserve formatting */ - protected function pArray(array $nodes, array $origNodes, int &$pos, int $indentAdjustment, string $parentNodeType, string $subNodeName, $fixup) + protected function pArray(array $nodes, array $origNodes, int &$pos, int $indentAdjustment, string $parentNodeClass, string $subNodeName, ?int $fixup) : ?string { $diff = $this->nodeListDiffer->diffWithReplacements($origNodes, $nodes); - $mapKey = $parentNodeType . '->' . $subNodeName; + $mapKey = $parentNodeClass . '->' . $subNodeName; $insertStr = $this->listInsertionMap[$mapKey] ?? null; $isStmtList = $subNodeName === 'stmts'; $beforeFirstKeepOrReplace = \true; @@ -671,9 +739,9 @@ abstract class PrettyPrinterAbstract $result = ''; foreach ($diff as $i => $diffElem) { $diffType = $diffElem->type; - /** @var Node|null $arrItem */ + /** @var Node|string|null $arrItem */ $arrItem = $diffElem->new; - /** @var Node|null $origArrItem */ + /** @var Node|string|null $origArrItem */ $origArrItem = $diffElem->old; if ($diffType === DiffElem::TYPE_KEEP || $diffType === DiffElem::TYPE_REPLACE) { $beforeFirstKeepOrReplace = \false; @@ -704,8 +772,8 @@ abstract class PrettyPrinterAbstract $commentStartPos = $itemStartPos; } if ($skipRemovedNode) { - if ($isStmtList && ($this->origTokens->haveBracesInRange($pos, $itemStartPos) || $this->origTokens->haveTagInRange($pos, $itemStartPos))) { - // We'd remove the brace of a code block. + if ($isStmtList && $this->origTokens->haveTagInRange($pos, $itemStartPos)) { + // We'd remove an opening/closing PHP tag. // TODO: Preserve formatting. $this->setIndentLevel($origIndentLevel); return null; @@ -722,7 +790,7 @@ abstract class PrettyPrinterAbstract $result .= $this->pComments($delayedAddComments) . $this->nl; } } - $this->safeAppend($result, $this->p($delayedAddNode, \true)); + $this->safeAppend($result, $this->p($delayedAddNode, self::MAX_PRECEDENCE, self::MAX_PRECEDENCE, \true)); if ($insertNewline) { $result .= $insertStr . $this->nl; } else { @@ -745,9 +813,14 @@ abstract class PrettyPrinterAbstract // We don't have insertion information for this list type return null; } + if (!$arrItem instanceof \PhpParser\Node) { + // We only support list insertion of nodes. + return null; + } // We go multiline if the original code was multiline, // or if it's an array item with a comment above it. - if ($insertStr === ', ' && ($this->isMultiline($origNodes) || $arrItem->getComments())) { + // Match always uses multiline formatting. + if ($insertStr === ', ' && ($this->isMultiline($origNodes) || $arrItem->getComments() || $parentNodeClass === Expr\Match_::class)) { $insertStr = ','; $insertNewline = \true; } @@ -788,8 +861,8 @@ abstract class PrettyPrinterAbstract $result .= $this->origTokens->getTokenCode($pos, $itemStartPos, $indentAdjustment); $skipRemovedNode = \true; } else { - if ($isStmtList && ($this->origTokens->haveBracesInRange($pos, $itemStartPos) || $this->origTokens->haveTagInRange($pos, $itemStartPos))) { - // We'd remove the brace of a code block. + if ($isStmtList && $this->origTokens->haveTagInRange($pos, $itemStartPos)) { + // We'd remove an opening/closing PHP tag. // TODO: Preserve formatting. return null; } @@ -802,7 +875,7 @@ abstract class PrettyPrinterAbstract if (null !== $fixup && $arrItem->getAttribute('origNode') !== $origArrItem) { $res = $this->pFixup($fixup, $arrItem, null, $itemStartPos, $itemEndPos); } else { - $res = $this->p($arrItem, \true); + $res = $this->p($arrItem, self::MAX_PRECEDENCE, self::MAX_PRECEDENCE, \true); } $this->safeAppend($result, $res); $this->setIndentLevel($origIndentLevel); @@ -831,7 +904,7 @@ abstract class PrettyPrinterAbstract $result .= $this->nl; } } - $result .= $this->p($delayedAddNode, \true); + $result .= $this->p($delayedAddNode, self::MAX_PRECEDENCE, self::MAX_PRECEDENCE, \true); $first = \false; } $result .= $extraRight === "\n" ? $this->nl : $extraRight; @@ -845,22 +918,34 @@ abstract class PrettyPrinterAbstract * are required to preserve program semantics in a certain context (e.g. to maintain precedence * or because only certain expressions are allowed in certain places). * - * @param int $fixup Fixup type - * @param Node $subNode Subnode to print + * @param int $fixup Fixup type + * @param Node $subNode Subnode to print * @param string|null $parentClass Class of parent node - * @param int $subStartPos Original start pos of subnode - * @param int $subEndPos Original end pos of subnode + * @param int $subStartPos Original start pos of subnode + * @param int $subEndPos Original end pos of subnode * * @return string Result of fixed-up print of subnode */ - protected function pFixup(int $fixup, \PhpParser\Node $subNode, $parentClass, int $subStartPos, int $subEndPos) : string + protected function pFixup(int $fixup, \PhpParser\Node $subNode, ?string $parentClass, int $subStartPos, int $subEndPos) : string { switch ($fixup) { case self::FIXUP_PREC_LEFT: + // We use a conservative approximation where lhsPrecedence == precedence. + if (!$this->origTokens->haveParens($subStartPos, $subEndPos)) { + $precedence = $this->precedenceMap[$parentClass][1]; + return $this->p($subNode, $precedence, $precedence); + } + break; case self::FIXUP_PREC_RIGHT: if (!$this->origTokens->haveParens($subStartPos, $subEndPos)) { - list($precedence, $associativity) = $this->precedenceMap[$parentClass]; - return $this->pPrec($subNode, $precedence, $associativity, $fixup === self::FIXUP_PREC_LEFT ? -1 : 1); + $precedence = $this->precedenceMap[$parentClass][2]; + return $this->p($subNode, $precedence, $precedence); + } + break; + case self::FIXUP_PREC_UNARY: + if (!$this->origTokens->haveParens($subStartPos, $subEndPos)) { + $precedence = $this->precedenceMap[$parentClass][0]; + return $this->p($subNode, $precedence, $precedence); } break; case self::FIXUP_CALL_LHS: @@ -890,7 +975,7 @@ abstract class PrettyPrinterAbstract } break; case self::FIXUP_ENCAPSED: - if (!$subNode instanceof Scalar\EncapsedStringPart && !$this->origTokens->haveBraces($subStartPos, $subEndPos)) { + if (!$subNode instanceof \PhpParser\Node\InterpolatedStringPart && !$this->origTokens->haveBraces($subStartPos, $subEndPos)) { return '{' . $this->p($subNode) . '}'; } break; @@ -905,11 +990,8 @@ abstract class PrettyPrinterAbstract * * Example: "echo" and "$x" result in "echo$x", but "echo" and "x" result in "echo x". * Without safeAppend the result would be "echox", which does not preserve semantics. - * - * @param string $str - * @param string $append */ - protected function safeAppend(string &$str, string $append) + protected function safeAppend(string &$str, string $append) : void { if ($str === "") { $str = $append; @@ -985,9 +1067,13 @@ abstract class PrettyPrinterAbstract * * @return string Printed modifiers */ - protected function pModifiers(int $modifiers) + protected function pModifiers(int $modifiers) : string { - return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC ? 'public ' : '') . ($modifiers & Stmt\Class_::MODIFIER_PROTECTED ? 'protected ' : '') . ($modifiers & Stmt\Class_::MODIFIER_PRIVATE ? 'private ' : '') . ($modifiers & Stmt\Class_::MODIFIER_STATIC ? 'static ' : '') . ($modifiers & Stmt\Class_::MODIFIER_ABSTRACT ? 'abstract ' : '') . ($modifiers & Stmt\Class_::MODIFIER_FINAL ? 'final ' : '') . ($modifiers & Stmt\Class_::MODIFIER_READONLY ? 'readonly ' : ''); + return ($modifiers & \PhpParser\Modifiers::FINAL ? 'final ' : '') . ($modifiers & \PhpParser\Modifiers::ABSTRACT ? 'abstract ' : '') . ($modifiers & \PhpParser\Modifiers::PUBLIC ? 'public ' : '') . ($modifiers & \PhpParser\Modifiers::PROTECTED ? 'protected ' : '') . ($modifiers & \PhpParser\Modifiers::PRIVATE ? 'private ' : '') . ($modifiers & \PhpParser\Modifiers::PUBLIC_SET ? 'public(set) ' : '') . ($modifiers & \PhpParser\Modifiers::PROTECTED_SET ? 'protected(set) ' : '') . ($modifiers & \PhpParser\Modifiers::PRIVATE_SET ? 'private(set) ' : '') . ($modifiers & \PhpParser\Modifiers::STATIC ? 'static ' : '') . ($modifiers & \PhpParser\Modifiers::READONLY ? 'readonly ' : ''); + } + protected function pStatic(bool $static) : string + { + return $static ? 'static ' : ''; } /** * Determine whether a list of nodes uses multiline formatting. @@ -1025,17 +1111,18 @@ abstract class PrettyPrinterAbstract * * The label char map determines whether a certain character may occur in a label. */ - protected function initializeLabelCharMap() + protected function initializeLabelCharMap() : void { - if ($this->labelCharMap) { + if (isset($this->labelCharMap)) { return; } $this->labelCharMap = []; for ($i = 0; $i < 256; $i++) { - // Since PHP 7.1 The lower range is 0x80. However, we also want to support code for - // older versions. $chr = \chr($i); - $this->labelCharMap[$chr] = $i >= 0x7f || \ctype_alnum($chr); + $this->labelCharMap[$chr] = $i >= 0x80 || \ctype_alnum($chr); + } + if ($this->phpVersion->allowsDelInIdentifiers()) { + $this->labelCharMap[""] = \true; } } /** @@ -1043,9 +1130,9 @@ abstract class PrettyPrinterAbstract * * The node list differ is used to determine differences between two array subnodes. */ - protected function initializeNodeListDiffer() + protected function initializeNodeListDiffer() : void { - if ($this->nodeListDiffer) { + if (isset($this->nodeListDiffer)) { return; } $this->nodeListDiffer = new \PhpParser\Internal\Differ(function ($a, $b) { @@ -1062,23 +1149,19 @@ abstract class PrettyPrinterAbstract * The fixup map is used to determine whether a certain subnode of a certain node may require * some kind of "fixup" operation, e.g. the addition of parenthesis or braces. */ - protected function initializeFixupMap() + protected function initializeFixupMap() : void { - if ($this->fixupMap) { + if (isset($this->fixupMap)) { return; } - $this->fixupMap = [Expr\PreInc::class => ['var' => self::FIXUP_PREC_RIGHT], Expr\PreDec::class => ['var' => self::FIXUP_PREC_RIGHT], Expr\PostInc::class => ['var' => self::FIXUP_PREC_LEFT], Expr\PostDec::class => ['var' => self::FIXUP_PREC_LEFT], Expr\Instanceof_::class => ['expr' => self::FIXUP_PREC_LEFT, 'class' => self::FIXUP_NEW], Expr\Ternary::class => ['cond' => self::FIXUP_PREC_LEFT, 'else' => self::FIXUP_PREC_RIGHT], Expr\FuncCall::class => ['name' => self::FIXUP_CALL_LHS], Expr\StaticCall::class => ['class' => self::FIXUP_STATIC_DEREF_LHS], Expr\ArrayDimFetch::class => ['var' => self::FIXUP_DEREF_LHS], Expr\ClassConstFetch::class => ['class' => self::FIXUP_STATIC_DEREF_LHS, 'name' => self::FIXUP_BRACED_NAME], Expr\New_::class => ['class' => self::FIXUP_NEW], Expr\MethodCall::class => ['var' => self::FIXUP_DEREF_LHS, 'name' => self::FIXUP_BRACED_NAME], Expr\NullsafeMethodCall::class => ['var' => self::FIXUP_DEREF_LHS, 'name' => self::FIXUP_BRACED_NAME], Expr\StaticPropertyFetch::class => ['class' => self::FIXUP_STATIC_DEREF_LHS, 'name' => self::FIXUP_VAR_BRACED_NAME], Expr\PropertyFetch::class => ['var' => self::FIXUP_DEREF_LHS, 'name' => self::FIXUP_BRACED_NAME], Expr\NullsafePropertyFetch::class => ['var' => self::FIXUP_DEREF_LHS, 'name' => self::FIXUP_BRACED_NAME], Scalar\Encapsed::class => ['parts' => self::FIXUP_ENCAPSED]]; + $this->fixupMap = [Expr\Instanceof_::class => ['expr' => self::FIXUP_PREC_UNARY, 'class' => self::FIXUP_NEW], Expr\Ternary::class => ['cond' => self::FIXUP_PREC_LEFT, 'else' => self::FIXUP_PREC_RIGHT], Expr\Yield_::class => ['value' => self::FIXUP_PREC_UNARY], Expr\FuncCall::class => ['name' => self::FIXUP_CALL_LHS], Expr\StaticCall::class => ['class' => self::FIXUP_STATIC_DEREF_LHS], Expr\ArrayDimFetch::class => ['var' => self::FIXUP_DEREF_LHS], Expr\ClassConstFetch::class => ['class' => self::FIXUP_STATIC_DEREF_LHS, 'name' => self::FIXUP_BRACED_NAME], Expr\New_::class => ['class' => self::FIXUP_NEW], Expr\MethodCall::class => ['var' => self::FIXUP_DEREF_LHS, 'name' => self::FIXUP_BRACED_NAME], Expr\NullsafeMethodCall::class => ['var' => self::FIXUP_DEREF_LHS, 'name' => self::FIXUP_BRACED_NAME], Expr\StaticPropertyFetch::class => ['class' => self::FIXUP_STATIC_DEREF_LHS, 'name' => self::FIXUP_VAR_BRACED_NAME], Expr\PropertyFetch::class => ['var' => self::FIXUP_DEREF_LHS, 'name' => self::FIXUP_BRACED_NAME], Expr\NullsafePropertyFetch::class => ['var' => self::FIXUP_DEREF_LHS, 'name' => self::FIXUP_BRACED_NAME], Scalar\InterpolatedString::class => ['parts' => self::FIXUP_ENCAPSED]]; $binaryOps = [BinaryOp\Pow::class, BinaryOp\Mul::class, BinaryOp\Div::class, BinaryOp\Mod::class, BinaryOp\Plus::class, BinaryOp\Minus::class, BinaryOp\Concat::class, BinaryOp\ShiftLeft::class, BinaryOp\ShiftRight::class, BinaryOp\Smaller::class, BinaryOp\SmallerOrEqual::class, BinaryOp\Greater::class, BinaryOp\GreaterOrEqual::class, BinaryOp\Equal::class, BinaryOp\NotEqual::class, BinaryOp\Identical::class, BinaryOp\NotIdentical::class, BinaryOp\Spaceship::class, BinaryOp\BitwiseAnd::class, BinaryOp\BitwiseXor::class, BinaryOp\BitwiseOr::class, BinaryOp\BooleanAnd::class, BinaryOp\BooleanOr::class, BinaryOp\Coalesce::class, BinaryOp\LogicalAnd::class, BinaryOp\LogicalXor::class, BinaryOp\LogicalOr::class]; foreach ($binaryOps as $binaryOp) { $this->fixupMap[$binaryOp] = ['left' => self::FIXUP_PREC_LEFT, 'right' => self::FIXUP_PREC_RIGHT]; } - $assignOps = [Expr\Assign::class, Expr\AssignRef::class, AssignOp\Plus::class, AssignOp\Minus::class, AssignOp\Mul::class, AssignOp\Div::class, AssignOp\Concat::class, AssignOp\Mod::class, AssignOp\BitwiseAnd::class, AssignOp\BitwiseOr::class, AssignOp\BitwiseXor::class, AssignOp\ShiftLeft::class, AssignOp\ShiftRight::class, AssignOp\Pow::class, AssignOp\Coalesce::class]; - foreach ($assignOps as $assignOp) { - $this->fixupMap[$assignOp] = ['var' => self::FIXUP_PREC_LEFT, 'expr' => self::FIXUP_PREC_RIGHT]; - } - $prefixOps = [Expr\BitwiseNot::class, Expr\BooleanNot::class, Expr\UnaryPlus::class, Expr\UnaryMinus::class, Cast\Int_::class, Cast\Double::class, Cast\String_::class, Cast\Array_::class, Cast\Object_::class, Cast\Bool_::class, Cast\Unset_::class, Expr\ErrorSuppress::class, Expr\YieldFrom::class, Expr\Print_::class, Expr\Include_::class]; + $prefixOps = [Expr\Clone_::class, Expr\BitwiseNot::class, Expr\BooleanNot::class, Expr\UnaryPlus::class, Expr\UnaryMinus::class, Cast\Int_::class, Cast\Double::class, Cast\String_::class, Cast\Array_::class, Cast\Object_::class, Cast\Bool_::class, Cast\Unset_::class, Expr\ErrorSuppress::class, Expr\YieldFrom::class, Expr\Print_::class, Expr\Include_::class, Expr\Assign::class, Expr\AssignRef::class, AssignOp\Plus::class, AssignOp\Minus::class, AssignOp\Mul::class, AssignOp\Div::class, AssignOp\Concat::class, AssignOp\Mod::class, AssignOp\BitwiseAnd::class, AssignOp\BitwiseOr::class, AssignOp\BitwiseXor::class, AssignOp\ShiftLeft::class, AssignOp\ShiftRight::class, AssignOp\Pow::class, AssignOp\Coalesce::class, Expr\ArrowFunction::class, Expr\Throw_::class]; foreach ($prefixOps as $prefixOp) { - $this->fixupMap[$prefixOp] = ['expr' => self::FIXUP_PREC_RIGHT]; + $this->fixupMap[$prefixOp] = ['expr' => self::FIXUP_PREC_UNARY]; } } /** @@ -1087,9 +1170,9 @@ abstract class PrettyPrinterAbstract * The removal map is used to determine which additional tokens should be removed when a * certain node is replaced by null. */ - protected function initializeRemovalMap() + protected function initializeRemovalMap() : void { - if ($this->removalMap) { + if (isset($this->removalMap)) { return; } $stripBoth = ['left' => \T_WHITESPACE, 'right' => \T_WHITESPACE]; @@ -1098,20 +1181,20 @@ abstract class PrettyPrinterAbstract $stripDoubleArrow = ['right' => \T_DOUBLE_ARROW]; $stripColon = ['left' => ':']; $stripEquals = ['left' => '=']; - $this->removalMap = ['Expr_ArrayDimFetch->dim' => $stripBoth, 'Expr_ArrayItem->key' => $stripDoubleArrow, 'Expr_ArrowFunction->returnType' => $stripColon, 'Expr_Closure->returnType' => $stripColon, 'Expr_Exit->expr' => $stripBoth, 'Expr_Ternary->if' => $stripBoth, 'Expr_Yield->key' => $stripDoubleArrow, 'Expr_Yield->value' => $stripBoth, 'Param->type' => $stripRight, 'Param->default' => $stripEquals, 'Stmt_Break->num' => $stripBoth, 'Stmt_Catch->var' => $stripLeft, 'Stmt_ClassConst->type' => $stripRight, 'Stmt_ClassMethod->returnType' => $stripColon, 'Stmt_Class->extends' => ['left' => \T_EXTENDS], 'Stmt_Enum->scalarType' => $stripColon, 'Stmt_EnumCase->expr' => $stripEquals, 'Expr_PrintableNewAnonClass->extends' => ['left' => \T_EXTENDS], 'Stmt_Continue->num' => $stripBoth, 'Stmt_Foreach->keyVar' => $stripDoubleArrow, 'Stmt_Function->returnType' => $stripColon, 'Stmt_If->else' => $stripLeft, 'Stmt_Namespace->name' => $stripLeft, 'Stmt_Property->type' => $stripRight, 'Stmt_PropertyProperty->default' => $stripEquals, 'Stmt_Return->expr' => $stripBoth, 'Stmt_StaticVar->default' => $stripEquals, 'Stmt_TraitUseAdaptation_Alias->newName' => $stripLeft, 'Stmt_TryCatch->finally' => $stripLeft]; + $this->removalMap = ['Expr_ArrayDimFetch->dim' => $stripBoth, 'ArrayItem->key' => $stripDoubleArrow, 'Expr_ArrowFunction->returnType' => $stripColon, 'Expr_Closure->returnType' => $stripColon, 'Expr_Exit->expr' => $stripBoth, 'Expr_Ternary->if' => $stripBoth, 'Expr_Yield->key' => $stripDoubleArrow, 'Expr_Yield->value' => $stripBoth, 'Param->type' => $stripRight, 'Param->default' => $stripEquals, 'Stmt_Break->num' => $stripBoth, 'Stmt_Catch->var' => $stripLeft, 'Stmt_ClassConst->type' => $stripRight, 'Stmt_ClassMethod->returnType' => $stripColon, 'Stmt_Class->extends' => ['left' => \T_EXTENDS], 'Stmt_Enum->scalarType' => $stripColon, 'Stmt_EnumCase->expr' => $stripEquals, 'Expr_PrintableNewAnonClass->extends' => ['left' => \T_EXTENDS], 'Stmt_Continue->num' => $stripBoth, 'Stmt_Foreach->keyVar' => $stripDoubleArrow, 'Stmt_Function->returnType' => $stripColon, 'Stmt_If->else' => $stripLeft, 'Stmt_Namespace->name' => $stripLeft, 'Stmt_Property->type' => $stripRight, 'PropertyItem->default' => $stripEquals, 'Stmt_Return->expr' => $stripBoth, 'Stmt_StaticVar->default' => $stripEquals, 'Stmt_TraitUseAdaptation_Alias->newName' => $stripLeft, 'Stmt_TryCatch->finally' => $stripLeft]; } - protected function initializeInsertionMap() + protected function initializeInsertionMap() : void { - if ($this->insertionMap) { + if (isset($this->insertionMap)) { return; } // TODO: "yield" where both key and value are inserted doesn't work // [$find, $beforeToken, $extraLeft, $extraRight] $this->insertionMap = [ 'Expr_ArrayDimFetch->dim' => ['[', \false, null, null], - 'Expr_ArrayItem->key' => [null, \false, null, ' => '], - 'Expr_ArrowFunction->returnType' => [')', \false, ' : ', null], - 'Expr_Closure->returnType' => [')', \false, ' : ', null], + 'ArrayItem->key' => [null, \false, null, ' => '], + 'Expr_ArrowFunction->returnType' => [')', \false, ': ', null], + 'Expr_Closure->returnType' => [')', \false, ': ', null], 'Expr_Ternary->if' => ['?', \false, ' ', ' '], 'Expr_Yield->key' => [\T_YIELD, \false, null, ' => '], 'Expr_Yield->value' => [\T_YIELD, \false, ' ', null], @@ -1119,136 +1202,143 @@ abstract class PrettyPrinterAbstract 'Param->default' => [null, \false, ' = ', null], 'Stmt_Break->num' => [\T_BREAK, \false, ' ', null], 'Stmt_Catch->var' => [null, \false, ' ', null], - 'Stmt_ClassMethod->returnType' => [')', \false, ' : ', null], + 'Stmt_ClassMethod->returnType' => [')', \false, ': ', null], 'Stmt_ClassConst->type' => [\T_CONST, \false, ' ', null], 'Stmt_Class->extends' => [null, \false, ' extends ', null], 'Stmt_Enum->scalarType' => [null, \false, ' : ', null], 'Stmt_EnumCase->expr' => [null, \false, ' = ', null], - 'Expr_PrintableNewAnonClass->extends' => [null, ' extends ', null], + 'Expr_PrintableNewAnonClass->extends' => [null, \false, ' extends ', null], 'Stmt_Continue->num' => [\T_CONTINUE, \false, ' ', null], 'Stmt_Foreach->keyVar' => [\T_AS, \false, null, ' => '], - 'Stmt_Function->returnType' => [')', \false, ' : ', null], + 'Stmt_Function->returnType' => [')', \false, ': ', null], 'Stmt_If->else' => [null, \false, ' ', null], 'Stmt_Namespace->name' => [\T_NAMESPACE, \false, ' ', null], 'Stmt_Property->type' => [\T_VARIABLE, \true, null, ' '], - 'Stmt_PropertyProperty->default' => [null, \false, ' = ', null], + 'PropertyItem->default' => [null, \false, ' = ', null], 'Stmt_Return->expr' => [\T_RETURN, \false, ' ', null], 'Stmt_StaticVar->default' => [null, \false, ' = ', null], //'Stmt_TraitUseAdaptation_Alias->newName' => [T_AS, false, ' ', null], // TODO 'Stmt_TryCatch->finally' => [null, \false, ' ', null], ]; } - protected function initializeListInsertionMap() + protected function initializeListInsertionMap() : void { - if ($this->listInsertionMap) { + if (isset($this->listInsertionMap)) { return; } $this->listInsertionMap = [ // special //'Expr_ShellExec->parts' => '', // TODO These need to be treated more carefully - //'Scalar_Encapsed->parts' => '', - 'Stmt_Catch->types' => '|', - 'UnionType->types' => '|', - 'IntersectionType->types' => '&', - 'Stmt_If->elseifs' => ' ', - 'Stmt_TryCatch->catches' => ' ', + //'Scalar_InterpolatedString->parts' => '', + Stmt\Catch_::class . '->types' => '|', + UnionType::class . '->types' => '|', + IntersectionType::class . '->types' => '&', + Stmt\If_::class . '->elseifs' => ' ', + Stmt\TryCatch::class . '->catches' => ' ', // comma-separated lists - 'Expr_Array->items' => ', ', - 'Expr_ArrowFunction->params' => ', ', - 'Expr_Closure->params' => ', ', - 'Expr_Closure->uses' => ', ', - 'Expr_FuncCall->args' => ', ', - 'Expr_Isset->vars' => ', ', - 'Expr_List->items' => ', ', - 'Expr_MethodCall->args' => ', ', - 'Expr_NullsafeMethodCall->args' => ', ', - 'Expr_New->args' => ', ', - 'Expr_PrintableNewAnonClass->args' => ', ', - 'Expr_StaticCall->args' => ', ', - 'Stmt_ClassConst->consts' => ', ', - 'Stmt_ClassMethod->params' => ', ', - 'Stmt_Class->implements' => ', ', - 'Stmt_Enum->implements' => ', ', - 'Expr_PrintableNewAnonClass->implements' => ', ', - 'Stmt_Const->consts' => ', ', - 'Stmt_Declare->declares' => ', ', - 'Stmt_Echo->exprs' => ', ', - 'Stmt_For->init' => ', ', - 'Stmt_For->cond' => ', ', - 'Stmt_For->loop' => ', ', - 'Stmt_Function->params' => ', ', - 'Stmt_Global->vars' => ', ', - 'Stmt_GroupUse->uses' => ', ', - 'Stmt_Interface->extends' => ', ', - 'Stmt_Match->arms' => ', ', - 'Stmt_Property->props' => ', ', - 'Stmt_StaticVar->vars' => ', ', - 'Stmt_TraitUse->traits' => ', ', - 'Stmt_TraitUseAdaptation_Precedence->insteadof' => ', ', - 'Stmt_Unset->vars' => ', ', - 'Stmt_Use->uses' => ', ', - 'MatchArm->conds' => ', ', - 'AttributeGroup->attrs' => ', ', + Expr\Array_::class . '->items' => ', ', + Expr\ArrowFunction::class . '->params' => ', ', + Expr\Closure::class . '->params' => ', ', + Expr\Closure::class . '->uses' => ', ', + Expr\FuncCall::class . '->args' => ', ', + Expr\Isset_::class . '->vars' => ', ', + Expr\List_::class . '->items' => ', ', + Expr\MethodCall::class . '->args' => ', ', + Expr\NullsafeMethodCall::class . '->args' => ', ', + Expr\New_::class . '->args' => ', ', + PrintableNewAnonClassNode::class . '->args' => ', ', + Expr\StaticCall::class . '->args' => ', ', + Stmt\ClassConst::class . '->consts' => ', ', + Stmt\ClassMethod::class . '->params' => ', ', + Stmt\Class_::class . '->implements' => ', ', + Stmt\Enum_::class . '->implements' => ', ', + PrintableNewAnonClassNode::class . '->implements' => ', ', + Stmt\Const_::class . '->consts' => ', ', + Stmt\Declare_::class . '->declares' => ', ', + Stmt\Echo_::class . '->exprs' => ', ', + Stmt\For_::class . '->init' => ', ', + Stmt\For_::class . '->cond' => ', ', + Stmt\For_::class . '->loop' => ', ', + Stmt\Function_::class . '->params' => ', ', + Stmt\Global_::class . '->vars' => ', ', + Stmt\GroupUse::class . '->uses' => ', ', + Stmt\Interface_::class . '->extends' => ', ', + Expr\Match_::class . '->arms' => ', ', + Stmt\Property::class . '->props' => ', ', + Stmt\StaticVar::class . '->vars' => ', ', + Stmt\TraitUse::class . '->traits' => ', ', + Stmt\TraitUseAdaptation\Precedence::class . '->insteadof' => ', ', + Stmt\Unset_::class . '->vars' => ', ', + Stmt\UseUse::class . '->uses' => ', ', + MatchArm::class . '->conds' => ', ', + AttributeGroup::class . '->attrs' => ', ', + PropertyHook::class . '->params' => ', ', // statement lists - 'Expr_Closure->stmts' => "\n", - 'Stmt_Case->stmts' => "\n", - 'Stmt_Catch->stmts' => "\n", - 'Stmt_Class->stmts' => "\n", - 'Stmt_Enum->stmts' => "\n", - 'Expr_PrintableNewAnonClass->stmts' => "\n", - 'Stmt_Interface->stmts' => "\n", - 'Stmt_Trait->stmts' => "\n", - 'Stmt_ClassMethod->stmts' => "\n", - 'Stmt_Declare->stmts' => "\n", - 'Stmt_Do->stmts' => "\n", - 'Stmt_ElseIf->stmts' => "\n", - 'Stmt_Else->stmts' => "\n", - 'Stmt_Finally->stmts' => "\n", - 'Stmt_Foreach->stmts' => "\n", - 'Stmt_For->stmts' => "\n", - 'Stmt_Function->stmts' => "\n", - 'Stmt_If->stmts' => "\n", - 'Stmt_Namespace->stmts' => "\n", - 'Stmt_Class->attrGroups' => "\n", - 'Stmt_Enum->attrGroups' => "\n", - 'Stmt_EnumCase->attrGroups' => "\n", - 'Stmt_Interface->attrGroups' => "\n", - 'Stmt_Trait->attrGroups' => "\n", - 'Stmt_Function->attrGroups' => "\n", - 'Stmt_ClassMethod->attrGroups' => "\n", - 'Stmt_ClassConst->attrGroups' => "\n", - 'Stmt_Property->attrGroups' => "\n", - 'Expr_PrintableNewAnonClass->attrGroups' => ' ', - 'Expr_Closure->attrGroups' => ' ', - 'Expr_ArrowFunction->attrGroups' => ' ', - 'Param->attrGroups' => ' ', - 'Stmt_Switch->cases' => "\n", - 'Stmt_TraitUse->adaptations' => "\n", - 'Stmt_TryCatch->stmts' => "\n", - 'Stmt_While->stmts' => "\n", + Expr\Closure::class . '->stmts' => "\n", + Stmt\Case_::class . '->stmts' => "\n", + Stmt\Catch_::class . '->stmts' => "\n", + Stmt\Class_::class . '->stmts' => "\n", + Stmt\Enum_::class . '->stmts' => "\n", + PrintableNewAnonClassNode::class . '->stmts' => "\n", + Stmt\Interface_::class . '->stmts' => "\n", + Stmt\Trait_::class . '->stmts' => "\n", + Stmt\ClassMethod::class . '->stmts' => "\n", + Stmt\Declare_::class . '->stmts' => "\n", + Stmt\Do_::class . '->stmts' => "\n", + Stmt\ElseIf_::class . '->stmts' => "\n", + Stmt\Else_::class . '->stmts' => "\n", + Stmt\Finally_::class . '->stmts' => "\n", + Stmt\Foreach_::class . '->stmts' => "\n", + Stmt\For_::class . '->stmts' => "\n", + Stmt\Function_::class . '->stmts' => "\n", + Stmt\If_::class . '->stmts' => "\n", + Stmt\Namespace_::class . '->stmts' => "\n", + Stmt\Block::class . '->stmts' => "\n", + // Attribute groups + Stmt\Class_::class . '->attrGroups' => "\n", + Stmt\Enum_::class . '->attrGroups' => "\n", + Stmt\EnumCase::class . '->attrGroups' => "\n", + Stmt\Interface_::class . '->attrGroups' => "\n", + Stmt\Trait_::class . '->attrGroups' => "\n", + Stmt\Function_::class . '->attrGroups' => "\n", + Stmt\ClassMethod::class . '->attrGroups' => "\n", + Stmt\ClassConst::class . '->attrGroups' => "\n", + Stmt\Property::class . '->attrGroups' => "\n", + PrintableNewAnonClassNode::class . '->attrGroups' => ' ', + Expr\Closure::class . '->attrGroups' => ' ', + Expr\ArrowFunction::class . '->attrGroups' => ' ', + Param::class . '->attrGroups' => ' ', + PropertyHook::class . '->attrGroups' => ' ', + Stmt\Switch_::class . '->cases' => "\n", + Stmt\TraitUse::class . '->adaptations' => "\n", + Stmt\TryCatch::class . '->stmts' => "\n", + Stmt\While_::class . '->stmts' => "\n", + PropertyHook::class . '->body' => "\n", + Stmt\Property::class . '->hooks' => "\n", + Param::class . '->hooks' => "\n", // dummy for top-level context 'File->stmts' => "\n", ]; } - protected function initializeEmptyListInsertionMap() + protected function initializeEmptyListInsertionMap() : void { - if ($this->emptyListInsertionMap) { + if (isset($this->emptyListInsertionMap)) { return; } // TODO Insertion into empty statement lists. // [$find, $extraLeft, $extraRight] - $this->emptyListInsertionMap = ['Expr_ArrowFunction->params' => ['(', '', ''], 'Expr_Closure->uses' => [')', ' use(', ')'], 'Expr_Closure->params' => ['(', '', ''], 'Expr_FuncCall->args' => ['(', '', ''], 'Expr_MethodCall->args' => ['(', '', ''], 'Expr_NullsafeMethodCall->args' => ['(', '', ''], 'Expr_New->args' => ['(', '', ''], 'Expr_PrintableNewAnonClass->args' => ['(', '', ''], 'Expr_PrintableNewAnonClass->implements' => [null, ' implements ', ''], 'Expr_StaticCall->args' => ['(', '', ''], 'Stmt_Class->implements' => [null, ' implements ', ''], 'Stmt_Enum->implements' => [null, ' implements ', ''], 'Stmt_ClassMethod->params' => ['(', '', ''], 'Stmt_Interface->extends' => [null, ' extends ', ''], 'Stmt_Function->params' => ['(', '', ''], 'Stmt_Interface->attrGroups' => [null, '', "\n"], 'Stmt_Class->attrGroups' => [null, '', "\n"], 'Stmt_ClassConst->attrGroups' => [null, '', "\n"], 'Stmt_ClassMethod->attrGroups' => [null, '', "\n"], 'Stmt_Function->attrGroups' => [null, '', "\n"], 'Stmt_Property->attrGroups' => [null, '', "\n"], 'Stmt_Trait->attrGroups' => [null, '', "\n"], 'Expr_ArrowFunction->attrGroups' => [null, '', ' '], 'Expr_Closure->attrGroups' => [null, '', ' '], 'Expr_PrintableNewAnonClass->attrGroups' => [\T_NEW, ' ', '']]; + $this->emptyListInsertionMap = [Expr\ArrowFunction::class . '->params' => ['(', '', ''], Expr\Closure::class . '->uses' => [')', ' use (', ')'], Expr\Closure::class . '->params' => ['(', '', ''], Expr\FuncCall::class . '->args' => ['(', '', ''], Expr\MethodCall::class . '->args' => ['(', '', ''], Expr\NullsafeMethodCall::class . '->args' => ['(', '', ''], Expr\New_::class . '->args' => ['(', '', ''], PrintableNewAnonClassNode::class . '->args' => ['(', '', ''], PrintableNewAnonClassNode::class . '->implements' => [null, ' implements ', ''], Expr\StaticCall::class . '->args' => ['(', '', ''], Stmt\Class_::class . '->implements' => [null, ' implements ', ''], Stmt\Enum_::class . '->implements' => [null, ' implements ', ''], Stmt\ClassMethod::class . '->params' => ['(', '', ''], Stmt\Interface_::class . '->extends' => [null, ' extends ', ''], Stmt\Function_::class . '->params' => ['(', '', ''], Stmt\Interface_::class . '->attrGroups' => [null, '', "\n"], Stmt\Class_::class . '->attrGroups' => [null, '', "\n"], Stmt\ClassConst::class . '->attrGroups' => [null, '', "\n"], Stmt\ClassMethod::class . '->attrGroups' => [null, '', "\n"], Stmt\Function_::class . '->attrGroups' => [null, '', "\n"], Stmt\Property::class . '->attrGroups' => [null, '', "\n"], Stmt\Trait_::class . '->attrGroups' => [null, '', "\n"], Expr\ArrowFunction::class . '->attrGroups' => [null, '', ' '], Expr\Closure::class . '->attrGroups' => [null, '', ' '], PrintableNewAnonClassNode::class . '->attrGroups' => [\T_NEW, ' ', '']]; } - protected function initializeModifierChangeMap() + protected function initializeModifierChangeMap() : void { - if ($this->modifierChangeMap) { + if (isset($this->modifierChangeMap)) { return; } - $this->modifierChangeMap = ['Stmt_ClassConst->flags' => \T_CONST, 'Stmt_ClassMethod->flags' => \T_FUNCTION, 'Stmt_Class->flags' => \T_CLASS, 'Stmt_Property->flags' => \T_VARIABLE, 'Expr_PrintableNewAnonClass->flags' => \T_CLASS, 'Param->flags' => \T_VARIABLE]; + $this->modifierChangeMap = [Stmt\ClassConst::class . '->flags' => ['pModifiers', \T_CONST], Stmt\ClassMethod::class . '->flags' => ['pModifiers', \T_FUNCTION], Stmt\Class_::class . '->flags' => ['pModifiers', \T_CLASS], Stmt\Property::class . '->flags' => ['pModifiers', \T_VARIABLE], PrintableNewAnonClassNode::class . '->flags' => ['pModifiers', \T_CLASS], Param::class . '->flags' => ['pModifiers', \T_VARIABLE], PropertyHook::class . '->flags' => ['pModifiers', \T_STRING], Expr\Closure::class . '->static' => ['pStatic', \T_FUNCTION], Expr\ArrowFunction::class . '->static' => ['pStatic', \T_FN]]; // List of integer subnodes that are not modifiers: // Expr_Include->type // Stmt_GroupUse->type // Stmt_Use->type - // Stmt_UseUse->type + // UseItem->type } } diff --git a/vendor/nikic/php-parser/lib/PhpParser/Token.php b/vendor/nikic/php-parser/lib/PhpParser/Token.php new file mode 100644 index 00000000000..f44062f649b --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Token.php @@ -0,0 +1,21 @@ +pos + \strlen(\is_array($this) ? $this[1] : $this); + } + /** Get 1-based end line number of the token. */ + public function getEndLine() : int + { + return $this->line + \substr_count(\is_array($this) ? $this[1] : $this, "\n"); + } +} diff --git a/vendor/nikic/php-parser/lib/PhpParser/compatibility_tokens.php b/vendor/nikic/php-parser/lib/PhpParser/compatibility_tokens.php new file mode 100644 index 00000000000..629a14dc52e --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/compatibility_tokens.php @@ -0,0 +1,59 @@ +env = $env; diff --git a/vendor/ondram/ci-detector/src/CiDetector.php b/vendor/ondram/ci-detector/src/CiDetector.php index 2c17cbecce3..8278abe8591 100644 --- a/vendor/ondram/ci-detector/src/CiDetector.php +++ b/vendor/ondram/ci-detector/src/CiDetector.php @@ -30,10 +30,7 @@ class CiDetector implements CiDetectorInterface * @deprecated Will be removed in next major version */ public const CI_WERCKER = 'Wercker'; - /** - * @var \OndraM\CiDetector\Env - */ - private $environment; + private Env $environment; public final function __construct() { $this->environment = new Env(); diff --git a/vendor/ondram/ci-detector/src/TrinaryLogic.php b/vendor/ondram/ci-detector/src/TrinaryLogic.php index b3b1ba4acc3..25608e95080 100644 --- a/vendor/ondram/ci-detector/src/TrinaryLogic.php +++ b/vendor/ondram/ci-detector/src/TrinaryLogic.php @@ -15,11 +15,8 @@ final class TrinaryLogic private const MAYBE = 0; private const NO = -1; /** @var self[] */ - private static $registry = []; - /** - * @var int - */ - private $value; + private static array $registry = []; + private int $value; private function __construct(int $value) { $this->value = $value; @@ -65,6 +62,6 @@ final class TrinaryLogic } private static function create(int $value) : self { - return self::$registry[$value] = self::$registry[$value] ?? new self($value); + return self::$registry[$value] ??= new self($value); } } diff --git a/vendor/phpstan/phpdoc-parser/README.md b/vendor/phpstan/phpdoc-parser/README.md index 706b2a3c5cd..ff6e808e1cd 100644 --- a/vendor/phpstan/phpdoc-parser/README.md +++ b/vendor/phpstan/phpdoc-parser/README.md @@ -13,9 +13,9 @@ For the complete list of supported PHPDoc features check out PHPStan documentati * [PHPDoc Basics](https://phpstan.org/writing-php-code/phpdocs-basics) (list of PHPDoc tags) * [PHPDoc Types](https://phpstan.org/writing-php-code/phpdoc-types) (list of PHPDoc types) -* [phpdoc-parser API Reference](https://phpstan.github.io/phpdoc-parser/1.23.x/namespace-PHPStan.PhpDocParser.html) with all the AST node types etc. +* [phpdoc-parser API Reference](https://phpstan.github.io/phpdoc-parser/2.0.x/namespace-PHPStan.PhpDocParser.html) with all the AST node types etc. -This parser also supports parsing [Doctrine Annotations](https://github.com/doctrine/annotations). The AST nodes live in the [PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine namespace](https://phpstan.github.io/phpdoc-parser/1.23.x/namespace-PHPStan.PhpDocParser.Ast.PhpDoc.Doctrine.html). The support needs to be turned on by setting `bool $parseDoctrineAnnotations` to `true` in `Lexer` and `PhpDocParser` class constructors. +This parser also supports parsing [Doctrine Annotations](https://github.com/doctrine/annotations). The AST nodes live in the [PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine namespace](https://phpstan.github.io/phpdoc-parser/2.0.x/namespace-PHPStan.PhpDocParser.Ast.PhpDoc.Doctrine.html). ## Installation @@ -34,6 +34,7 @@ use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; use PHPStan\PhpDocParser\Lexer\Lexer; +use PHPStan\PhpDocParser\ParserConfig; use PHPStan\PhpDocParser\Parser\ConstExprParser; use PHPStan\PhpDocParser\Parser\PhpDocParser; use PHPStan\PhpDocParser\Parser\TokenIterator; @@ -41,10 +42,11 @@ use PHPStan\PhpDocParser\Parser\TypeParser; // basic setup -$lexer = new Lexer(); -$constExprParser = new ConstExprParser(); -$typeParser = new TypeParser($constExprParser); -$phpDocParser = new PhpDocParser($typeParser, $constExprParser); +$config = new ParserConfig(usedAttributes: []); +$lexer = new Lexer($config); +$constExprParser = new ConstExprParser($config); +$typeParser = new TypeParser($config, $constExprParser); +$phpDocParser = new PhpDocParser($config, $typeParser, $constExprParser); // parsing and reading a PHPDoc string @@ -72,6 +74,7 @@ use PHPStan\PhpDocParser\Ast\NodeVisitor\CloningVisitor; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; use PHPStan\PhpDocParser\Lexer\Lexer; +use PHPStan\PhpDocParser\ParserConfig; use PHPStan\PhpDocParser\Parser\ConstExprParser; use PHPStan\PhpDocParser\Parser\PhpDocParser; use PHPStan\PhpDocParser\Parser\TokenIterator; @@ -80,12 +83,11 @@ use PHPStan\PhpDocParser\Printer\Printer; // basic setup with enabled required lexer attributes -$usedAttributes = ['lines' => true, 'indexes' => true]; - -$lexer = new Lexer(); -$constExprParser = new ConstExprParser(true, true, $usedAttributes); -$typeParser = new TypeParser($constExprParser, true, $usedAttributes); -$phpDocParser = new PhpDocParser($typeParser, $constExprParser, true, true, $usedAttributes); +$config = new ParserConfig(usedAttributes: ['lines' => true, 'indexes' => true]); +$lexer = new Lexer($config); +$constExprParser = new ConstExprParser($config); +$typeParser = new TypeParser($config, $constExprParser); +$phpDocParser = new PhpDocParser($config, $typeParser, $constExprParser); $tokens = new TokenIterator($lexer->tokenize('/** @param Lorem $a */')); $phpDocNode = $phpDocParser->parse($tokens); // PhpDocNode diff --git a/vendor/phpstan/phpdoc-parser/UPGRADING.md b/vendor/phpstan/phpdoc-parser/UPGRADING.md new file mode 100644 index 00000000000..b673bccfb42 --- /dev/null +++ b/vendor/phpstan/phpdoc-parser/UPGRADING.md @@ -0,0 +1,129 @@ +Upgrading from phpstan/phpdoc-parser 1.x to 2.0 +================================= + +### PHP version requirements + +phpstan/phpdoc-parser now requires PHP 7.4 or newer to run. + +### Changed constructors of parser classes + +Instead of different arrays and boolean values passed into class constructors during setup, parser classes now share a common ParserConfig object. + +Before: + +```php +use PHPStan\PhpDocParser\Lexer\Lexer; +use PHPStan\PhpDocParser\Parser\ConstExprParser; +use PHPStan\PhpDocParser\Parser\TypeParser; +use PHPStan\PhpDocParser\Parser\PhpDocParser; + +$usedAttributes = ['lines' => true, 'indexes' => true]; + +$lexer = new Lexer(); +$constExprParser = new ConstExprParser(true, true, $usedAttributes); +$typeParser = new TypeParser($constExprParser, true, $usedAttributes); +$phpDocParser = new PhpDocParser($typeParser, $constExprParser, true, true, $usedAttributes); +``` + +After: + +```php +use PHPStan\PhpDocParser\Lexer\Lexer; +use PHPStan\PhpDocParser\ParserConfig; +use PHPStan\PhpDocParser\Parser\ConstExprParser; +use PHPStan\PhpDocParser\Parser\TypeParser; +use PHPStan\PhpDocParser\Parser\PhpDocParser; + +$config = new ParserConfig(usedAttributes: ['lines' => true, 'indexes' => true]); +$lexer = new Lexer($config); +$constExprParser = new ConstExprParser($config); +$typeParser = new TypeParser($config, $constExprParser); +$phpDocParser = new PhpDocParser($config, $typeParser, $constExprParser); +``` + +The point of ParserConfig is that over the course of phpstan/phpdoc-parser 2.x development series it's most likely going to gain new optional parameters akin to PHPStan's [bleeding edge](https://phpstan.org/blog/what-is-bleeding-edge). These parameters will allow opting in to new behaviour which will become the default in 3.0. + +With ParserConfig object, it's now going to be impossible to configure parser classes inconsistently. Which [happened to users](https://github.com/phpstan/phpdoc-parser/issues/251#issuecomment-2333927959) when they were separate boolean values. + +### Support for parsing Doctrine annotations + +This parser now supports parsing [Doctrine Annotations](https://github.com/doctrine/annotations). The AST nodes representing Doctrine Annotations live in the [PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine namespace](https://phpstan.github.io/phpdoc-parser/2.0.x/namespace-PHPStan.PhpDocParser.Ast.PhpDoc.Doctrine.html). + +### Whitespace before description is required + +phpdoc-parser 1.x sometimes silently consumed invalid part of a PHPDoc type as description: + +```php +/** @return \Closure(...int, string): string */ +``` + +This became `IdentifierTypeNode` of `\Closure` and with `(...int, string): string` as description. (Valid callable syntax is: `\Closure(int ...$u, string): string`.) + +Another example: + +```php +/** @return array{foo: int}} */ +``` + +The extra `}` also became description. + +Both of these examples are now InvalidTagValueNode. + +If these parts are supposed to be PHPDoc descriptions, you need to put whitespace between the type and the description text: + +```php +/** @return \Closure (...int, string): string */ +/** @return array{foo: int} } */ +``` + +### Type aliases with invalid types are preserved + +In phpdoc-parser 1.x, invalid type alias syntax was represented as [`InvalidTagValueNode`](https://phpstan.github.io/phpdoc-parser/2.0.x/PHPStan.PhpDocParser.Ast.PhpDoc.InvalidTagValueNode.html), losing information about a type alias being present. + +```php +/** + * @phpstan-type TypeAlias + */ +``` + +This `@phpstan-type` is missing the actual type to alias. In phpdoc-parser 2.0 this is now represented as [`TypeAliasTagValueNode`](https://phpstan.github.io/phpdoc-parser/2.0.x/PHPStan.PhpDocParser.Ast.PhpDoc.TypeAliasTagValueNode.html) (instead of `InvalidTagValueNode`) with [`InvalidTypeNode`](https://phpstan.github.io/phpdoc-parser/2.0.x/PHPStan.PhpDocParser.Ast.Type.InvalidTypeNode.html) in place of the type. + +### Removal of QuoteAwareConstExprStringNode + +The class [QuoteAwareConstExprStringNode](https://phpstan.github.io/phpdoc-parser/1.23.x/PHPStan.PhpDocParser.Ast.ConstExpr.QuoteAwareConstExprStringNode.html) has been removed. + +Instead, [ConstExprStringNode](https://phpstan.github.io/phpdoc-parser/2.0.x/PHPStan.PhpDocParser.Ast.ConstExpr.ConstExprStringNode.html) gained information about the kind of quotes being used. + +### Removed 2nd parameter of `ConstExprParser::parse()` (`$trimStrings`) + +`ConstExprStringNode::$value` now contains unescaped values without surrounding `''` or `""` quotes. + +Use `ConstExprStringNode::__toString()` or [`Printer`](https://phpstan.github.io/phpdoc-parser/2.0.x/PHPStan.PhpDocParser.Printer.Printer.html) to get the escaped value along with surrounding quotes. + +### Text between tags always belongs to description + +Multi-line descriptions between tags were previously represented as separate [PhpDocTextNode](https://phpstan.github.io/phpdoc-parser/2.0.x/PHPStan.PhpDocParser.Ast.PhpDoc.PhpDocTextNode.html): + +```php +/** + * @param Foo $foo 1st multi world description + * some text in the middle + * @param Bar $bar 2nd multi world description + */ +``` + +The line with `some text in the middle` in phpdoc-parser 2.0 is now part of the description of the first `@param` tag. + +### `ArrayShapeNode` construction changes + +`ArrayShapeNode` constructor made private, added public static methods `createSealed()` and `createUnsealed()`. + +### Minor BC breaks + +* Constructor parameter `$isEquality` in `AssertTag*ValueNode` made required +* Constructor parameter `$templateTypes` in `MethodTagValueNode` made required +* Constructor parameter `$isReference` in `ParamTagValueNode` made required +* Constructor parameter `$isReference` in `TypelessParamTagValueNode` made required +* Constructor parameter `$templateTypes` in `CallableTypeNode` made required +* Constructor parameters `$expectedTokenValue` and `$currentTokenLine` in `ParserException` made required +* `ArrayShapeItemNode` and `ObjectShapeItemNode` are not standalone TypeNode, just Node diff --git a/vendor/phpstan/phpdoc-parser/composer.json b/vendor/phpstan/phpdoc-parser/composer.json index 3a2cce65ca4..131e0c4f15a 100644 --- a/vendor/phpstan/phpdoc-parser/composer.json +++ b/vendor/phpstan/phpdoc-parser/composer.json @@ -3,17 +3,17 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "license": "MIT", "require": { - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "doctrine\/annotations": "^2.0", - "nikic\/php-parser": "^4.15", + "nikic\/php-parser": "^5.3.0", "php-parallel-lint\/php-parallel-lint": "^1.2", "phpstan\/extension-installer": "^1.0", - "phpstan\/phpstan": "^1.5", - "phpstan\/phpstan-phpunit": "^1.1", - "phpstan\/phpstan-strict-rules": "^1.0", - "phpunit\/phpunit": "^9.5", + "phpstan\/phpstan": "^2.0", + "phpstan\/phpstan-phpunit": "^2.0", + "phpstan\/phpstan-strict-rules": "^2.0", + "phpunit\/phpunit": "^9.6", "symfony\/process": "^5.2" }, "config": { diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprArrayItemNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprArrayItemNode.php index 0a4d8eacfae..8908722aed8 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprArrayItemNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprArrayItemNode.php @@ -8,10 +8,8 @@ use function sprintf; class ConstExprArrayItemNode implements \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode { use NodeAttributes; - /** @var ConstExprNode|null */ - public $key; - /** @var ConstExprNode */ - public $value; + public ?\PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode $key = null; + public \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode $value; public function __construct(?\PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode $key, \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode $value) { $this->key = $key; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprArrayNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprArrayNode.php index 7b463fe7889..7fa5f482924 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprArrayNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprArrayNode.php @@ -9,7 +9,7 @@ class ConstExprArrayNode implements \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExp { use NodeAttributes; /** @var ConstExprArrayItemNode[] */ - public $items; + public array $items; /** * @param ConstExprArrayItemNode[] $items */ diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprFloatNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprFloatNode.php index 2e616d04ad6..307181adef8 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprFloatNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprFloatNode.php @@ -7,8 +7,7 @@ use PHPStan\PhpDocParser\Ast\NodeAttributes; class ConstExprFloatNode implements \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode { use NodeAttributes; - /** @var string */ - public $value; + public string $value; public function __construct(string $value) { $this->value = $value; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprIntegerNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprIntegerNode.php index ce4baee6439..c4a2317e31c 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprIntegerNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprIntegerNode.php @@ -7,8 +7,7 @@ use PHPStan\PhpDocParser\Ast\NodeAttributes; class ConstExprIntegerNode implements \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode { use NodeAttributes; - /** @var string */ - public $value; + public string $value; public function __construct(string $value) { $this->value = $value; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprStringNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprStringNode.php index 95ac80c6f37..3b11b6941ac 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprStringNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprStringNode.php @@ -4,17 +4,65 @@ declare (strict_types=1); namespace PHPStan\PhpDocParser\Ast\ConstExpr; use PHPStan\PhpDocParser\Ast\NodeAttributes; +use function addcslashes; +use function assert; +use function dechex; +use function ord; +use function preg_replace_callback; +use function sprintf; +use function str_pad; +use function strlen; +use const STR_PAD_LEFT; class ConstExprStringNode implements \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode { + public const SINGLE_QUOTED = 1; + public const DOUBLE_QUOTED = 2; use NodeAttributes; - /** @var string */ - public $value; - public function __construct(string $value) + public string $value; + /** @var self::SINGLE_QUOTED|self::DOUBLE_QUOTED */ + public $quoteType; + /** + * @param self::SINGLE_QUOTED|self::DOUBLE_QUOTED $quoteType + */ + public function __construct(string $value, int $quoteType) { $this->value = $value; + $this->quoteType = $quoteType; } public function __toString() : string { - return $this->value; + if ($this->quoteType === self::SINGLE_QUOTED) { + // from https://github.com/nikic/PHP-Parser/blob/0ffddce52d816f72d0efc4d9b02e276d3309ef01/lib/PhpParser/PrettyPrinter/Standard.php#L1007 + return sprintf("'%s'", addcslashes($this->value, '\'\\')); + } + // from https://github.com/nikic/PHP-Parser/blob/0ffddce52d816f72d0efc4d9b02e276d3309ef01/lib/PhpParser/PrettyPrinter/Standard.php#L1010-L1040 + return sprintf('"%s"', $this->escapeDoubleQuotedString()); + } + private function escapeDoubleQuotedString() : string + { + $quote = '"'; + $escaped = addcslashes($this->value, "\n\r\t\f\v\$" . $quote . '\\'); + // Escape control characters and non-UTF-8 characters. + // Regex based on https://stackoverflow.com/a/11709412/385378. + $regex = '/( + [\\x00-\\x08\\x0E-\\x1F] # Control characters + | [\\xC0-\\xC1] # Invalid UTF-8 Bytes + | [\\xF5-\\xFF] # Invalid UTF-8 Bytes + | \\xE0(?=[\\x80-\\x9F]) # Overlong encoding of prior code point + | \\xF0(?=[\\x80-\\x8F]) # Overlong encoding of prior code point + | [\\xC2-\\xDF](?![\\x80-\\xBF]) # Invalid UTF-8 Sequence Start + | [\\xE0-\\xEF](?![\\x80-\\xBF]{2}) # Invalid UTF-8 Sequence Start + | [\\xF0-\\xF4](?![\\x80-\\xBF]{3}) # Invalid UTF-8 Sequence Start + | (?<=[\\x00-\\x7F\\xF5-\\xFF])[\\x80-\\xBF] # Invalid UTF-8 Sequence Middle + | (?className = $className; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/DoctrineConstExprStringNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/DoctrineConstExprStringNode.php index a6675a284f7..05968372449 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/DoctrineConstExprStringNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/DoctrineConstExprStringNode.php @@ -11,11 +11,10 @@ use function substr; class DoctrineConstExprStringNode extends \PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprStringNode { use NodeAttributes; - /** @var string */ - public $value; + public string $value; public function __construct(string $value) { - parent::__construct($value); + parent::__construct($value, self::DOUBLE_QUOTED); $this->value = $value; } public function __toString() : string diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/QuoteAwareConstExprStringNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/QuoteAwareConstExprStringNode.php deleted file mode 100644 index 9bcb9b14fed..00000000000 --- a/vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/QuoteAwareConstExprStringNode.php +++ /dev/null @@ -1,67 +0,0 @@ -quoteType = $quoteType; - } - public function __toString() : string - { - if ($this->quoteType === self::SINGLE_QUOTED) { - // from https://github.com/nikic/PHP-Parser/blob/0ffddce52d816f72d0efc4d9b02e276d3309ef01/lib/PhpParser/PrettyPrinter/Standard.php#L1007 - return sprintf("'%s'", addcslashes($this->value, '\'\\')); - } - // from https://github.com/nikic/PHP-Parser/blob/0ffddce52d816f72d0efc4d9b02e276d3309ef01/lib/PhpParser/PrettyPrinter/Standard.php#L1010-L1040 - return sprintf('"%s"', $this->escapeDoubleQuotedString()); - } - private function escapeDoubleQuotedString() : string - { - $quote = '"'; - $escaped = addcslashes($this->value, "\n\r\t\f\v\$" . $quote . '\\'); - // Escape control characters and non-UTF-8 characters. - // Regex based on https://stackoverflow.com/a/11709412/385378. - $regex = '/( - [\\x00-\\x08\\x0E-\\x1F] # Control characters - | [\\xC0-\\xC1] # Invalid UTF-8 Bytes - | [\\xF5-\\xFF] # Invalid UTF-8 Bytes - | \\xE0(?=[\\x80-\\x9F]) # Overlong encoding of prior code point - | \\xF0(?=[\\x80-\\x8F]) # Overlong encoding of prior code point - | [\\xC2-\\xDF](?![\\x80-\\xBF]) # Invalid UTF-8 Sequence Start - | [\\xE0-\\xEF](?![\\x80-\\xBF]{2}) # Invalid UTF-8 Sequence Start - | [\\xF0-\\xF4](?![\\x80-\\xBF]{3}) # Invalid UTF-8 Sequence Start - | (?<=[\\x00-\\x7F\\xF5-\\xFF])[\\x80-\\xBF] # Invalid UTF-8 Sequence Middle - | (? */ - private $attributes = []; + private array $attributes = []; /** * @param mixed $value */ diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/NodeTraverser.php b/vendor/phpstan/phpdoc-parser/src/Ast/NodeTraverser.php index 296071d4fb3..c7e0a5f2ca3 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/NodeTraverser.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/NodeTraverser.php @@ -57,9 +57,9 @@ final class NodeTraverser */ public const DONT_TRAVERSE_CURRENT_AND_CHILDREN = 4; /** @var list Visitors */ - private $visitors = []; + private array $visitors = []; /** @var bool Whether traversal should be stopped */ - private $stopTraversal; + private bool $stopTraversal; /** * @param list $visitors */ diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/NodeVisitor/CloningVisitor.php b/vendor/phpstan/phpdoc-parser/src/Ast/NodeVisitor/CloningVisitor.php index 29e0b619e0c..26a24e038bf 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/NodeVisitor/CloningVisitor.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/NodeVisitor/CloningVisitor.php @@ -8,7 +8,7 @@ use PHPStan\PhpDocParser\Ast\Attribute; use PHPStan\PhpDocParser\Ast\Node; final class CloningVisitor extends AbstractNodeVisitor { - public function enterNode(Node $originalNode) + public function enterNode(Node $originalNode) : Node { $node = clone $originalNode; $node->setAttribute(Attribute::ORIGINAL_NODE, $originalNode); diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagMethodValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagMethodValueNode.php index e534c532666..7730936774d 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagMethodValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagMethodValueNode.php @@ -9,19 +9,14 @@ use function trim; class AssertTagMethodValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; - /** @var string */ - public $parameter; - /** @var string */ - public $method; - /** @var bool */ - public $isNegated; - /** @var bool */ - public $isEquality; + public TypeNode $type; + public string $parameter; + public string $method; + public bool $isNegated; + public bool $isEquality; /** @var string (may be empty) */ - public $description; - public function __construct(TypeNode $type, string $parameter, string $method, bool $isNegated, string $description, bool $isEquality = \false) + public string $description; + public function __construct(TypeNode $type, string $parameter, string $method, bool $isNegated, string $description, bool $isEquality) { $this->type = $type; $this->parameter = $parameter; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagPropertyValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagPropertyValueNode.php index ef67e62a48f..a263b526662 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagPropertyValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagPropertyValueNode.php @@ -9,19 +9,14 @@ use function trim; class AssertTagPropertyValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; - /** @var string */ - public $parameter; - /** @var string */ - public $property; - /** @var bool */ - public $isNegated; - /** @var bool */ - public $isEquality; + public TypeNode $type; + public string $parameter; + public string $property; + public bool $isNegated; + public bool $isEquality; /** @var string (may be empty) */ - public $description; - public function __construct(TypeNode $type, string $parameter, string $property, bool $isNegated, string $description, bool $isEquality = \false) + public string $description; + public function __construct(TypeNode $type, string $parameter, string $property, bool $isNegated, string $description, bool $isEquality) { $this->type = $type; $this->parameter = $parameter; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagValueNode.php index 33f01627adc..f719ad3dcfe 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagValueNode.php @@ -9,17 +9,13 @@ use function trim; class AssertTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; - /** @var string */ - public $parameter; - /** @var bool */ - public $isNegated; - /** @var bool */ - public $isEquality; + public TypeNode $type; + public string $parameter; + public bool $isNegated; + public bool $isEquality; /** @var string (may be empty) */ - public $description; - public function __construct(TypeNode $type, string $parameter, bool $isNegated, string $description, bool $isEquality = \false) + public string $description; + public function __construct(TypeNode $type, string $parameter, bool $isNegated, string $description, bool $isEquality) { $this->type = $type; $this->parameter = $parameter; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/DeprecatedTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/DeprecatedTagValueNode.php index 8199bef6a8c..23ca785c15d 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/DeprecatedTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/DeprecatedTagValueNode.php @@ -9,7 +9,7 @@ class DeprecatedTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocT { use NodeAttributes; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(string $description) { $this->description = $description; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineAnnotation.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineAnnotation.php index 3dde2312f02..e8e518033e1 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineAnnotation.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineAnnotation.php @@ -9,10 +9,9 @@ use function implode; class DoctrineAnnotation implements Node { use NodeAttributes; - /** @var string */ - public $name; + public string $name; /** @var list */ - public $arguments; + public array $arguments; /** * @param list $arguments */ diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineArgument.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineArgument.php index 20b77483b61..9ddba21187e 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineArgument.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineArgument.php @@ -13,8 +13,7 @@ use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; class DoctrineArgument implements Node { use NodeAttributes; - /** @var IdentifierTypeNode|null */ - public $key; + public ?IdentifierTypeNode $key = null; /** @var ValueType */ public $value; /** diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineArray.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineArray.php index fb0a087c74b..d283b25e2d8 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineArray.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineArray.php @@ -10,7 +10,7 @@ class DoctrineArray implements Node { use NodeAttributes; /** @var list */ - public $items; + public array $items; /** * @param list $items */ diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineTagValueNode.php index cebd4075eae..9fee2996a43 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/Doctrine/DoctrineTagValueNode.php @@ -9,10 +9,9 @@ use function trim; class DoctrineTagValueNode implements PhpDocTagValueNode { use NodeAttributes; - /** @var DoctrineAnnotation */ - public $annotation; + public \PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine\DoctrineAnnotation $annotation; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(\PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine\DoctrineAnnotation $annotation, string $description) { $this->annotation = $annotation; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ExtendsTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ExtendsTagValueNode.php index 31eeaaa5901..b65e79f825d 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ExtendsTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ExtendsTagValueNode.php @@ -9,10 +9,9 @@ use function trim; class ExtendsTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var GenericTypeNode */ - public $type; + public GenericTypeNode $type; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(GenericTypeNode $type, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/GenericTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/GenericTagValueNode.php index 1773022b162..70ea4024184 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/GenericTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/GenericTagValueNode.php @@ -8,7 +8,7 @@ class GenericTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagV { use NodeAttributes; /** @var string (may be empty) */ - public $value; + public string $value; public function __construct(string $value) { $this->value = $value; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ImplementsTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ImplementsTagValueNode.php index 1f4d6afc274..b85912f9f0d 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ImplementsTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ImplementsTagValueNode.php @@ -9,10 +9,9 @@ use function trim; class ImplementsTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var GenericTypeNode */ - public $type; + public GenericTypeNode $type; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(GenericTypeNode $type, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/InvalidTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/InvalidTagValueNode.php index 9d8f8b9e8cb..09d1166caf5 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/InvalidTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/InvalidTagValueNode.php @@ -15,9 +15,9 @@ class InvalidTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagV { use NodeAttributes; /** @var string (may be empty) */ - public $value; + public string $value; /** @var mixed[] */ - private $exceptionArgs; + private array $exceptionArgs; public function __construct(string $value, ParserException $exception) { $this->value = $value; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MethodTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MethodTagValueNode.php index 62a3f415898..2b11fcbf588 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MethodTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MethodTagValueNode.php @@ -10,23 +10,20 @@ use function implode; class MethodTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var bool */ - public $isStatic; - /** @var TypeNode|null */ - public $returnType; - /** @var string */ - public $methodName; + public bool $isStatic; + public ?TypeNode $returnType = null; + public string $methodName; /** @var TemplateTagValueNode[] */ - public $templateTypes; + public array $templateTypes; /** @var MethodTagValueParameterNode[] */ - public $parameters; + public array $parameters; /** @var string (may be empty) */ - public $description; + public string $description; /** * @param MethodTagValueParameterNode[] $parameters * @param TemplateTagValueNode[] $templateTypes */ - public function __construct(bool $isStatic, ?TypeNode $returnType, string $methodName, array $parameters, string $description, array $templateTypes = []) + public function __construct(bool $isStatic, ?TypeNode $returnType, string $methodName, array $parameters, string $description, array $templateTypes) { $this->isStatic = $isStatic; $this->returnType = $returnType; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MethodTagValueParameterNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MethodTagValueParameterNode.php index 3d45e70b7d4..31560fac946 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MethodTagValueParameterNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MethodTagValueParameterNode.php @@ -10,16 +10,11 @@ use PHPStan\PhpDocParser\Ast\Type\TypeNode; class MethodTagValueParameterNode implements Node { use NodeAttributes; - /** @var TypeNode|null */ - public $type; - /** @var bool */ - public $isReference; - /** @var bool */ - public $isVariadic; - /** @var string */ - public $parameterName; - /** @var ConstExprNode|null */ - public $defaultValue; + public ?TypeNode $type = null; + public bool $isReference; + public bool $isVariadic; + public string $parameterName; + public ?ConstExprNode $defaultValue = null; public function __construct(?TypeNode $type, bool $isReference, bool $isVariadic, string $parameterName, ?ConstExprNode $defaultValue) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MixinTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MixinTagValueNode.php index e7138d59ad5..17e2dbdb651 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MixinTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MixinTagValueNode.php @@ -9,10 +9,9 @@ use function trim; class MixinTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; + public TypeNode $type; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(TypeNode $type, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamClosureThisTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamClosureThisTagValueNode.php index 2b5b928e749..0dbf7c47014 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamClosureThisTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamClosureThisTagValueNode.php @@ -9,12 +9,10 @@ use function trim; class ParamClosureThisTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; - /** @var string */ - public $parameterName; + public TypeNode $type; + public string $parameterName; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(TypeNode $type, string $parameterName, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamImmediatelyInvokedCallableTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamImmediatelyInvokedCallableTagValueNode.php index bcd97e41a9a..3941b7e7f3a 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamImmediatelyInvokedCallableTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamImmediatelyInvokedCallableTagValueNode.php @@ -8,10 +8,9 @@ use function trim; class ParamImmediatelyInvokedCallableTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var string */ - public $parameterName; + public string $parameterName; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(string $parameterName, string $description) { $this->parameterName = $parameterName; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamLaterInvokedCallableTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamLaterInvokedCallableTagValueNode.php index 511e6c53e49..46cb8ba4fab 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamLaterInvokedCallableTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamLaterInvokedCallableTagValueNode.php @@ -8,10 +8,9 @@ use function trim; class ParamLaterInvokedCallableTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var string */ - public $parameterName; + public string $parameterName; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(string $parameterName, string $description) { $this->parameterName = $parameterName; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamOutTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamOutTagValueNode.php index 0d4a2e79e36..fbbda793872 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamOutTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamOutTagValueNode.php @@ -9,12 +9,10 @@ use function trim; class ParamOutTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; - /** @var string */ - public $parameterName; + public TypeNode $type; + public string $parameterName; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(TypeNode $type, string $parameterName, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamTagValueNode.php index b7e7991058d..2e90bbab645 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamTagValueNode.php @@ -9,17 +9,13 @@ use function trim; class ParamTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; - /** @var bool */ - public $isReference; - /** @var bool */ - public $isVariadic; - /** @var string */ - public $parameterName; + public TypeNode $type; + public bool $isReference; + public bool $isVariadic; + public string $parameterName; /** @var string (may be empty) */ - public $description; - public function __construct(TypeNode $type, bool $isVariadic, string $parameterName, string $description, bool $isReference = \false) + public string $description; + public function __construct(TypeNode $type, bool $isVariadic, string $parameterName, string $description, bool $isReference) { $this->type = $type; $this->isReference = $isReference; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocNode.php index 49246a36166..16a489bdd43 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocNode.php @@ -13,7 +13,7 @@ class PhpDocNode implements Node { use NodeAttributes; /** @var PhpDocChildNode[] */ - public $children; + public array $children; /** * @param PhpDocChildNode[] $children */ @@ -26,270 +26,210 @@ class PhpDocNode implements Node */ public function getTags() : array { - return array_filter($this->children, static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode $child) : bool { - return $child instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; - }); + return array_filter($this->children, static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode $child): bool => $child instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode); } /** * @return PhpDocTagNode[] */ public function getTagsByName(string $tagName) : array { - return array_filter($this->getTags(), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode $tag) use($tagName) : bool { - return $tag->name === $tagName; - }); + return array_filter($this->getTags(), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode $tag): bool => $tag->name === $tagName); } /** * @return VarTagValueNode[] */ public function getVarTagValues(string $tagName = '@var') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode); } /** * @return ParamTagValueNode[] */ public function getParamTagValues(string $tagName = '@param') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode); } /** * @return TypelessParamTagValueNode[] */ public function getTypelessParamTagValues(string $tagName = '@param') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\TypelessParamTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\TypelessParamTagValueNode); } /** * @return ParamImmediatelyInvokedCallableTagValueNode[] */ public function getParamImmediatelyInvokedCallableTagValues(string $tagName = '@param-immediately-invoked-callable') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamImmediatelyInvokedCallableTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamImmediatelyInvokedCallableTagValueNode); } /** * @return ParamLaterInvokedCallableTagValueNode[] */ public function getParamLaterInvokedCallableTagValues(string $tagName = '@param-later-invoked-callable') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamLaterInvokedCallableTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamLaterInvokedCallableTagValueNode); } /** * @return ParamClosureThisTagValueNode[] */ public function getParamClosureThisTagValues(string $tagName = '@param-closure-this') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamClosureThisTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamClosureThisTagValueNode); } /** * @return PureUnlessCallableIsImpureTagValueNode[] */ public function getPureUnlessCallableIsImpureTagValues(string $tagName = '@pure-unless-callable-is-impure') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PureUnlessCallableIsImpureTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PureUnlessCallableIsImpureTagValueNode); } /** * @return TemplateTagValueNode[] */ public function getTemplateTagValues(string $tagName = '@template') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode); } /** * @return ExtendsTagValueNode[] */ public function getExtendsTagValues(string $tagName = '@extends') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode); } /** * @return ImplementsTagValueNode[] */ public function getImplementsTagValues(string $tagName = '@implements') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode); } /** * @return UsesTagValueNode[] */ public function getUsesTagValues(string $tagName = '@use') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\UsesTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\UsesTagValueNode); } /** * @return ReturnTagValueNode[] */ public function getReturnTagValues(string $tagName = '@return') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode); } /** * @return ThrowsTagValueNode[] */ public function getThrowsTagValues(string $tagName = '@throws') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode); } /** * @return MixinTagValueNode[] */ public function getMixinTagValues(string $tagName = '@mixin') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\MixinTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\MixinTagValueNode); } /** * @return RequireExtendsTagValueNode[] */ public function getRequireExtendsTagValues(string $tagName = '@phpstan-require-extends') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\RequireExtendsTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\RequireExtendsTagValueNode); } /** * @return RequireImplementsTagValueNode[] */ public function getRequireImplementsTagValues(string $tagName = '@phpstan-require-implements') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\RequireImplementsTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\RequireImplementsTagValueNode); } /** * @return DeprecatedTagValueNode[] */ public function getDeprecatedTagValues() : array { - return array_filter(array_column($this->getTagsByName('@deprecated'), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\DeprecatedTagValueNode; - }); + return array_filter(array_column($this->getTagsByName('@deprecated'), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\DeprecatedTagValueNode); } /** * @return PropertyTagValueNode[] */ public function getPropertyTagValues(string $tagName = '@property') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode); } /** * @return PropertyTagValueNode[] */ public function getPropertyReadTagValues(string $tagName = '@property-read') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode); } /** * @return PropertyTagValueNode[] */ public function getPropertyWriteTagValues(string $tagName = '@property-write') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode); } /** * @return MethodTagValueNode[] */ public function getMethodTagValues(string $tagName = '@method') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode); } /** * @return TypeAliasTagValueNode[] */ public function getTypeAliasTagValues(string $tagName = '@phpstan-type') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\TypeAliasTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\TypeAliasTagValueNode); } /** * @return TypeAliasImportTagValueNode[] */ public function getTypeAliasImportTagValues(string $tagName = '@phpstan-import-type') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\TypeAliasImportTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\TypeAliasImportTagValueNode); } /** * @return AssertTagValueNode[] */ public function getAssertTagValues(string $tagName = '@phpstan-assert') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\AssertTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\AssertTagValueNode); } /** * @return AssertTagPropertyValueNode[] */ public function getAssertPropertyTagValues(string $tagName = '@phpstan-assert') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\AssertTagPropertyValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\AssertTagPropertyValueNode); } /** * @return AssertTagMethodValueNode[] */ public function getAssertMethodTagValues(string $tagName = '@phpstan-assert') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\AssertTagMethodValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\AssertTagMethodValueNode); } /** * @return SelfOutTagValueNode[] */ public function getSelfOutTypeTagValues(string $tagName = '@phpstan-this-out') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\SelfOutTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\SelfOutTagValueNode); } /** * @return ParamOutTagValueNode[] */ public function getParamOutTypeTagValues(string $tagName = '@param-out') : array { - return array_filter(array_column($this->getTagsByName($tagName), 'value'), static function (\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) : bool { - return $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamOutTagValueNode; - }); + return array_filter(array_column($this->getTagsByName($tagName), 'value'), static fn(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value): bool => $value instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamOutTagValueNode); } public function __toString() : string { diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTagNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTagNode.php index 36a48a0dc66..e4a60970bbc 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTagNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTagNode.php @@ -9,10 +9,8 @@ use function trim; class PhpDocTagNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode { use NodeAttributes; - /** @var string */ - public $name; - /** @var PhpDocTagValueNode */ - public $value; + public string $name; + public \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value; public function __construct(string $name, \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $value) { $this->name = $name; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTextNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTextNode.php index 388143ca3c4..87422d1b24e 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTextNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTextNode.php @@ -7,8 +7,7 @@ use PHPStan\PhpDocParser\Ast\NodeAttributes; class PhpDocTextNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode { use NodeAttributes; - /** @var string */ - public $text; + public string $text; public function __construct(string $text) { $this->text = $text; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PropertyTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PropertyTagValueNode.php index 4cadbeec1a3..caf99157692 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PropertyTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PropertyTagValueNode.php @@ -9,12 +9,10 @@ use function trim; class PropertyTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; - /** @var string */ - public $propertyName; + public TypeNode $type; + public string $propertyName; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(TypeNode $type, string $propertyName, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PureUnlessCallableIsImpureTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PureUnlessCallableIsImpureTagValueNode.php index 19c20cc68ac..b022484fe13 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PureUnlessCallableIsImpureTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PureUnlessCallableIsImpureTagValueNode.php @@ -8,10 +8,9 @@ use function trim; class PureUnlessCallableIsImpureTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var string */ - public $parameterName; + public string $parameterName; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(string $parameterName, string $description) { $this->parameterName = $parameterName; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/RequireExtendsTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/RequireExtendsTagValueNode.php index 584ca231b66..5bd33937a78 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/RequireExtendsTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/RequireExtendsTagValueNode.php @@ -9,10 +9,9 @@ use function trim; class RequireExtendsTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; + public TypeNode $type; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(TypeNode $type, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/RequireImplementsTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/RequireImplementsTagValueNode.php index 72576e3eac0..7091894ba7c 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/RequireImplementsTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/RequireImplementsTagValueNode.php @@ -9,10 +9,9 @@ use function trim; class RequireImplementsTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; + public TypeNode $type; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(TypeNode $type, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ReturnTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ReturnTagValueNode.php index e3fb544ee28..5ce1be39142 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ReturnTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ReturnTagValueNode.php @@ -9,10 +9,9 @@ use function trim; class ReturnTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; + public TypeNode $type; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(TypeNode $type, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/SelfOutTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/SelfOutTagValueNode.php index 45aedad56d8..465b9dc9d6a 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/SelfOutTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/SelfOutTagValueNode.php @@ -9,10 +9,9 @@ use function trim; class SelfOutTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; + public TypeNode $type; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(TypeNode $type, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TemplateTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TemplateTagValueNode.php index 23f3932858d..5f8a915ea74 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TemplateTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TemplateTagValueNode.php @@ -10,15 +10,12 @@ class TemplateTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTag { use NodeAttributes; /** @var non-empty-string */ - public $name; - /** @var TypeNode|null */ - public $bound; - /** @var TypeNode|null */ - public $lowerBound; - /** @var TypeNode|null */ - public $default; + public string $name; + public ?TypeNode $bound; + public ?TypeNode $default; + public ?TypeNode $lowerBound; /** @var string (may be empty) */ - public $description; + public string $description; /** * @param non-empty-string $name */ diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ThrowsTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ThrowsTagValueNode.php index 02bf48f8c4f..0d069915b3b 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ThrowsTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ThrowsTagValueNode.php @@ -9,10 +9,9 @@ use function trim; class ThrowsTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; + public TypeNode $type; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(TypeNode $type, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypeAliasImportTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypeAliasImportTagValueNode.php index 2a1f390882b..6ad5b347ed1 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypeAliasImportTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypeAliasImportTagValueNode.php @@ -9,12 +9,9 @@ use function trim; class TypeAliasImportTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var string */ - public $importedAlias; - /** @var IdentifierTypeNode */ - public $importedFrom; - /** @var string|null */ - public $importedAs; + public string $importedAlias; + public IdentifierTypeNode $importedFrom; + public ?string $importedAs = null; public function __construct(string $importedAlias, IdentifierTypeNode $importedFrom, ?string $importedAs) { $this->importedAlias = $importedAlias; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypeAliasTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypeAliasTagValueNode.php index 3b41363c11d..f36789ee979 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypeAliasTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypeAliasTagValueNode.php @@ -9,10 +9,8 @@ use function trim; class TypeAliasTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var string */ - public $alias; - /** @var TypeNode */ - public $type; + public string $alias; + public TypeNode $type; public function __construct(string $alias, TypeNode $type) { $this->alias = $alias; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypelessParamTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypelessParamTagValueNode.php index a1d712f2388..12bc0b926c6 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypelessParamTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypelessParamTagValueNode.php @@ -8,15 +8,12 @@ use function trim; class TypelessParamTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var bool */ - public $isReference; - /** @var bool */ - public $isVariadic; - /** @var string */ - public $parameterName; + public bool $isReference; + public bool $isVariadic; + public string $parameterName; /** @var string (may be empty) */ - public $description; - public function __construct(bool $isVariadic, string $parameterName, string $description, bool $isReference = \false) + public string $description; + public function __construct(bool $isVariadic, string $parameterName, string $description, bool $isReference) { $this->isReference = $isReference; $this->isVariadic = $isVariadic; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/UsesTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/UsesTagValueNode.php index 98ab9c66c42..00370d49268 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/UsesTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/UsesTagValueNode.php @@ -9,10 +9,9 @@ use function trim; class UsesTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var GenericTypeNode */ - public $type; + public GenericTypeNode $type; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(GenericTypeNode $type, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/VarTagValueNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/VarTagValueNode.php index 345f27c2c1a..30d50be5a0d 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/VarTagValueNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/VarTagValueNode.php @@ -9,12 +9,11 @@ use function trim; class VarTagValueNode implements \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode { use NodeAttributes; - /** @var TypeNode */ - public $type; + public TypeNode $type; /** @var string (may be empty) */ - public $variableName; + public string $variableName; /** @var string (may be empty) */ - public $description; + public string $description; public function __construct(TypeNode $type, string $variableName, string $description) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeItemNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeItemNode.php index d421a1ce010..156b21f34ad 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeItemNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeItemNode.php @@ -5,17 +5,16 @@ namespace PHPStan\PhpDocParser\Ast\Type; use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprIntegerNode; use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprStringNode; +use PHPStan\PhpDocParser\Ast\Node; use PHPStan\PhpDocParser\Ast\NodeAttributes; use function sprintf; -class ArrayShapeItemNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode +class ArrayShapeItemNode implements Node { use NodeAttributes; /** @var ConstExprIntegerNode|ConstExprStringNode|IdentifierTypeNode|null */ public $keyName; - /** @var bool */ - public $optional; - /** @var TypeNode */ - public $valueType; + public bool $optional; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $valueType; /** * @param ConstExprIntegerNode|ConstExprStringNode|IdentifierTypeNode|null $keyName */ diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeNode.php index 993e873a5a8..4ba456bf26b 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeNode.php @@ -13,23 +13,37 @@ class ArrayShapeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode public const KIND_NON_EMPTY_LIST = 'non-empty-list'; use NodeAttributes; /** @var ArrayShapeItemNode[] */ - public $items; - /** @var bool */ - public $sealed; + public array $items; + public bool $sealed; /** @var self::KIND_* */ public $kind; - /** @var ArrayShapeUnsealedTypeNode|null */ - public $unsealedType; + public ?\PHPStan\PhpDocParser\Ast\Type\ArrayShapeUnsealedTypeNode $unsealedType = null; /** * @param ArrayShapeItemNode[] $items * @param self::KIND_* $kind */ - public function __construct(array $items, bool $sealed = \true, string $kind = self::KIND_ARRAY, ?\PHPStan\PhpDocParser\Ast\Type\ArrayShapeUnsealedTypeNode $unsealedType = null) + private function __construct(array $items, bool $sealed = \true, ?\PHPStan\PhpDocParser\Ast\Type\ArrayShapeUnsealedTypeNode $unsealedType = null, string $kind = self::KIND_ARRAY) { $this->items = $items; $this->sealed = $sealed; - $this->kind = $kind; $this->unsealedType = $unsealedType; + $this->kind = $kind; + } + /** + * @param ArrayShapeItemNode[] $items + * @param self::KIND_* $kind + */ + public static function createSealed(array $items, string $kind = self::KIND_ARRAY) : self + { + return new self($items, \true, null, $kind); + } + /** + * @param ArrayShapeItemNode[] $items + * @param self::KIND_* $kind + */ + public static function createUnsealed(array $items, ?\PHPStan\PhpDocParser\Ast\Type\ArrayShapeUnsealedTypeNode $unsealedType, string $kind = self::KIND_ARRAY) : self + { + return new self($items, \false, $unsealedType, $kind); } public function __toString() : string { diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeUnsealedTypeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeUnsealedTypeNode.php index 5d3c314b275..1e74c0c7a5f 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeUnsealedTypeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeUnsealedTypeNode.php @@ -9,10 +9,8 @@ use function sprintf; class ArrayShapeUnsealedTypeNode implements Node { use NodeAttributes; - /** @var TypeNode */ - public $valueType; - /** @var TypeNode|null */ - public $keyType; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $valueType; + public ?\PHPStan\PhpDocParser\Ast\Type\TypeNode $keyType = null; public function __construct(\PHPStan\PhpDocParser\Ast\Type\TypeNode $valueType, ?\PHPStan\PhpDocParser\Ast\Type\TypeNode $keyType) { $this->valueType = $valueType; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayTypeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayTypeNode.php index 61ec14ddfb2..0987e2f8913 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayTypeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayTypeNode.php @@ -7,8 +7,7 @@ use PHPStan\PhpDocParser\Ast\NodeAttributes; class ArrayTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode { use NodeAttributes; - /** @var TypeNode */ - public $type; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $type; public function __construct(\PHPStan\PhpDocParser\Ast\Type\TypeNode $type) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/CallableTypeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/CallableTypeNode.php index b648a09f3b9..d49f9a8a143 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/CallableTypeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/CallableTypeNode.php @@ -9,19 +9,17 @@ use function implode; class CallableTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode { use NodeAttributes; - /** @var IdentifierTypeNode */ - public $identifier; + public \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $identifier; /** @var TemplateTagValueNode[] */ - public $templateTypes; + public array $templateTypes; /** @var CallableTypeParameterNode[] */ - public $parameters; - /** @var TypeNode */ - public $returnType; + public array $parameters; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $returnType; /** * @param CallableTypeParameterNode[] $parameters * @param TemplateTagValueNode[] $templateTypes */ - public function __construct(\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $identifier, array $parameters, \PHPStan\PhpDocParser\Ast\Type\TypeNode $returnType, array $templateTypes = []) + public function __construct(\PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $identifier, array $parameters, \PHPStan\PhpDocParser\Ast\Type\TypeNode $returnType, array $templateTypes) { $this->identifier = $identifier; $this->parameters = $parameters; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/CallableTypeParameterNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/CallableTypeParameterNode.php index ba9f18ab26e..1f624f2fbd0 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/CallableTypeParameterNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/CallableTypeParameterNode.php @@ -9,16 +9,12 @@ use function trim; class CallableTypeParameterNode implements Node { use NodeAttributes; - /** @var TypeNode */ - public $type; - /** @var bool */ - public $isReference; - /** @var bool */ - public $isVariadic; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $type; + public bool $isReference; + public bool $isVariadic; /** @var string (may be empty) */ - public $parameterName; - /** @var bool */ - public $isOptional; + public string $parameterName; + public bool $isOptional; public function __construct(\PHPStan\PhpDocParser\Ast\Type\TypeNode $type, bool $isReference, bool $isVariadic, string $parameterName, bool $isOptional) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ConditionalTypeForParameterNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ConditionalTypeForParameterNode.php index 0f4065dc219..02d1d124bb2 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ConditionalTypeForParameterNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ConditionalTypeForParameterNode.php @@ -8,16 +8,11 @@ use function sprintf; class ConditionalTypeForParameterNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode { use NodeAttributes; - /** @var string */ - public $parameterName; - /** @var TypeNode */ - public $targetType; - /** @var TypeNode */ - public $if; - /** @var TypeNode */ - public $else; - /** @var bool */ - public $negated; + public string $parameterName; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $targetType; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $if; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $else; + public bool $negated; public function __construct(string $parameterName, \PHPStan\PhpDocParser\Ast\Type\TypeNode $targetType, \PHPStan\PhpDocParser\Ast\Type\TypeNode $if, \PHPStan\PhpDocParser\Ast\Type\TypeNode $else, bool $negated) { $this->parameterName = $parameterName; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ConditionalTypeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ConditionalTypeNode.php index fcd5b1b5a5f..05d177f6ab0 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ConditionalTypeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ConditionalTypeNode.php @@ -8,16 +8,11 @@ use function sprintf; class ConditionalTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode { use NodeAttributes; - /** @var TypeNode */ - public $subjectType; - /** @var TypeNode */ - public $targetType; - /** @var TypeNode */ - public $if; - /** @var TypeNode */ - public $else; - /** @var bool */ - public $negated; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $subjectType; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $targetType; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $if; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $else; + public bool $negated; public function __construct(\PHPStan\PhpDocParser\Ast\Type\TypeNode $subjectType, \PHPStan\PhpDocParser\Ast\Type\TypeNode $targetType, \PHPStan\PhpDocParser\Ast\Type\TypeNode $if, \PHPStan\PhpDocParser\Ast\Type\TypeNode $else, bool $negated) { $this->subjectType = $subjectType; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ConstTypeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ConstTypeNode.php index 45d03a3bc2d..792085db106 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ConstTypeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ConstTypeNode.php @@ -8,8 +8,7 @@ use PHPStan\PhpDocParser\Ast\NodeAttributes; class ConstTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode { use NodeAttributes; - /** @var ConstExprNode */ - public $constExpr; + public ConstExprNode $constExpr; public function __construct(ConstExprNode $constExpr) { $this->constExpr = $constExpr; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/GenericTypeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/GenericTypeNode.php index d9634ff99ce..62e21f8dfd1 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/GenericTypeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/GenericTypeNode.php @@ -13,12 +13,11 @@ class GenericTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode public const VARIANCE_CONTRAVARIANT = 'contravariant'; public const VARIANCE_BIVARIANT = 'bivariant'; use NodeAttributes; - /** @var IdentifierTypeNode */ - public $type; + public \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $type; /** @var TypeNode[] */ - public $genericTypes; + public array $genericTypes; /** @var (self::VARIANCE_*)[] */ - public $variances; + public array $variances; /** * @param TypeNode[] $genericTypes * @param (self::VARIANCE_*)[] $variances diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/IdentifierTypeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/IdentifierTypeNode.php index 72299867409..d8e898b82e8 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/IdentifierTypeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/IdentifierTypeNode.php @@ -7,8 +7,7 @@ use PHPStan\PhpDocParser\Ast\NodeAttributes; class IdentifierTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode { use NodeAttributes; - /** @var string */ - public $name; + public string $name; public function __construct(string $name) { $this->name = $name; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/IntersectionTypeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/IntersectionTypeNode.php index 142631884a0..5ef207cea70 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/IntersectionTypeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/IntersectionTypeNode.php @@ -10,7 +10,7 @@ class IntersectionTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode { use NodeAttributes; /** @var TypeNode[] */ - public $types; + public array $types; /** * @param TypeNode[] $types */ diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/InvalidTypeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/InvalidTypeNode.php index bc49699810f..f1353e02bb4 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/InvalidTypeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/InvalidTypeNode.php @@ -9,7 +9,7 @@ class InvalidTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode { use NodeAttributes; /** @var mixed[] */ - private $exceptionArgs; + private array $exceptionArgs; public function __construct(ParserException $exception) { $this->exceptionArgs = [$exception->getCurrentTokenValue(), $exception->getCurrentTokenType(), $exception->getCurrentOffset(), $exception->getExpectedTokenType(), $exception->getExpectedTokenValue(), $exception->getCurrentTokenLine()]; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/NullableTypeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/NullableTypeNode.php index b655491904d..f4a0c318d65 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/NullableTypeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/NullableTypeNode.php @@ -7,8 +7,7 @@ use PHPStan\PhpDocParser\Ast\NodeAttributes; class NullableTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode { use NodeAttributes; - /** @var TypeNode */ - public $type; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $type; public function __construct(\PHPStan\PhpDocParser\Ast\Type\TypeNode $type) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ObjectShapeItemNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ObjectShapeItemNode.php index b0273f885d0..2a8d6337916 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ObjectShapeItemNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ObjectShapeItemNode.php @@ -4,17 +4,16 @@ declare (strict_types=1); namespace PHPStan\PhpDocParser\Ast\Type; use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprStringNode; +use PHPStan\PhpDocParser\Ast\Node; use PHPStan\PhpDocParser\Ast\NodeAttributes; use function sprintf; -class ObjectShapeItemNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode +class ObjectShapeItemNode implements Node { use NodeAttributes; /** @var ConstExprStringNode|IdentifierTypeNode */ public $keyName; - /** @var bool */ - public $optional; - /** @var TypeNode */ - public $valueType; + public bool $optional; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $valueType; /** * @param ConstExprStringNode|IdentifierTypeNode $keyName */ diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ObjectShapeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ObjectShapeNode.php index 16954f5163d..17b78c34e14 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/ObjectShapeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/ObjectShapeNode.php @@ -9,7 +9,7 @@ class ObjectShapeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode { use NodeAttributes; /** @var ObjectShapeItemNode[] */ - public $items; + public array $items; /** * @param ObjectShapeItemNode[] $items */ diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/OffsetAccessTypeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/OffsetAccessTypeNode.php index ced475e9e80..c247fe73ab9 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/OffsetAccessTypeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/OffsetAccessTypeNode.php @@ -7,10 +7,8 @@ use PHPStan\PhpDocParser\Ast\NodeAttributes; class OffsetAccessTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode { use NodeAttributes; - /** @var TypeNode */ - public $type; - /** @var TypeNode */ - public $offset; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $type; + public \PHPStan\PhpDocParser\Ast\Type\TypeNode $offset; public function __construct(\PHPStan\PhpDocParser\Ast\Type\TypeNode $type, \PHPStan\PhpDocParser\Ast\Type\TypeNode $offset) { $this->type = $type; diff --git a/vendor/phpstan/phpdoc-parser/src/Ast/Type/UnionTypeNode.php b/vendor/phpstan/phpdoc-parser/src/Ast/Type/UnionTypeNode.php index 98f30584176..5e8e321cad7 100644 --- a/vendor/phpstan/phpdoc-parser/src/Ast/Type/UnionTypeNode.php +++ b/vendor/phpstan/phpdoc-parser/src/Ast/Type/UnionTypeNode.php @@ -10,7 +10,7 @@ class UnionTypeNode implements \PHPStan\PhpDocParser\Ast\Type\TypeNode { use NodeAttributes; /** @var TypeNode[] */ - public $types; + public array $types; /** * @param TypeNode[] $types */ diff --git a/vendor/phpstan/phpdoc-parser/src/Lexer/Lexer.php b/vendor/phpstan/phpdoc-parser/src/Lexer/Lexer.php index bf56762797d..ed90e8472eb 100644 --- a/vendor/phpstan/phpdoc-parser/src/Lexer/Lexer.php +++ b/vendor/phpstan/phpdoc-parser/src/Lexer/Lexer.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace PHPStan\PhpDocParser\Lexer; +use PHPStan\PhpDocParser\ParserConfig; use function implode; use function preg_match_all; use const PREG_SET_ORDER; @@ -52,13 +53,12 @@ class Lexer public const VALUE_OFFSET = 0; public const TYPE_OFFSET = 1; public const LINE_OFFSET = 2; - /** @var bool */ - private $parseDoctrineAnnotations; - /** @var string|null */ - private $regexp; - public function __construct(bool $parseDoctrineAnnotations = \false) + private ParserConfig $config; + // @phpstan-ignore property.onlyWritten + private ?string $regexp = null; + public function __construct(ParserConfig $config) { - $this->parseDoctrineAnnotations = $parseDoctrineAnnotations; + $this->config = $config; } /** * @return list @@ -113,19 +113,17 @@ class Lexer self::TOKEN_OPEN_PHPDOC => '/\\*\\*(?=\\s)\\x20?+', self::TOKEN_CLOSE_PHPDOC => '\\*/', self::TOKEN_PHPDOC_TAG => '@(?:[a-z][a-z0-9-\\\\]+:)?[a-z][a-z0-9-\\\\]*+', + self::TOKEN_DOCTRINE_TAG => '@[a-z_\\\\][a-z0-9_\\:\\\\]*[a-z_][a-z0-9_]*', self::TOKEN_PHPDOC_EOL => '\\r?+\\n[\\x09\\x20]*+(?:\\*(?!/)\\x20?+)?', self::TOKEN_FLOAT => '[+\\-]?(?:(?:[0-9]++(_[0-9]++)*\\.[0-9]*+(_[0-9]++)*(?:e[+\\-]?[0-9]++(_[0-9]++)*)?)|(?:[0-9]*+(_[0-9]++)*\\.[0-9]++(_[0-9]++)*(?:e[+\\-]?[0-9]++(_[0-9]++)*)?)|(?:[0-9]++(_[0-9]++)*e[+\\-]?[0-9]++(_[0-9]++)*))', self::TOKEN_INTEGER => '[+\\-]?(?:(?:0b[0-1]++(_[0-1]++)*)|(?:0o[0-7]++(_[0-7]++)*)|(?:0x[0-9a-f]++(_[0-9a-f]++)*)|(?:[0-9]++(_[0-9]++)*))', self::TOKEN_SINGLE_QUOTED_STRING => '\'(?:\\\\[^\\r\\n]|[^\'\\r\\n\\\\])*+\'', self::TOKEN_DOUBLE_QUOTED_STRING => '"(?:\\\\[^\\r\\n]|[^"\\r\\n\\\\])*+"', + self::TOKEN_DOCTRINE_ANNOTATION_STRING => '"(?:""|[^"])*+"', self::TOKEN_WILDCARD => '\\*', + // anything but TOKEN_CLOSE_PHPDOC or TOKEN_HORIZONTAL_WS or TOKEN_EOL + self::TOKEN_OTHER => '(?:(?!\\*/)[^\\s])++', ]; - if ($this->parseDoctrineAnnotations) { - $patterns[self::TOKEN_DOCTRINE_TAG] = '@[a-z_\\\\][a-z0-9_\\:\\\\]*[a-z_][a-z0-9_]*'; - $patterns[self::TOKEN_DOCTRINE_ANNOTATION_STRING] = '"(?:""|[^"])*+"'; - } - // anything but TOKEN_CLOSE_PHPDOC or TOKEN_HORIZONTAL_WS or TOKEN_EOL - $patterns[self::TOKEN_OTHER] = '(?:(?!\\*/)[^\\s])++'; foreach ($patterns as $type => &$pattern) { $pattern = '(?:' . $pattern . ')(*MARK:' . $type . ')'; } diff --git a/vendor/phpstan/phpdoc-parser/src/Parser/ConstExprParser.php b/vendor/phpstan/phpdoc-parser/src/Parser/ConstExprParser.php index 9530fded6b8..8e25bb488fc 100644 --- a/vendor/phpstan/phpdoc-parser/src/Parser/ConstExprParser.php +++ b/vendor/phpstan/phpdoc-parser/src/Parser/ConstExprParser.php @@ -5,30 +5,16 @@ namespace PHPStan\PhpDocParser\Parser; use PHPStan\PhpDocParser\Ast; use PHPStan\PhpDocParser\Lexer\Lexer; +use PHPStan\PhpDocParser\ParserConfig; use function str_replace; use function strtolower; -use function substr; class ConstExprParser { - /** @var bool */ - private $unescapeStrings; - /** @var bool */ - private $quoteAwareConstExprString; - /** @var bool */ - private $useLinesAttributes; - /** @var bool */ - private $useIndexAttributes; - /** @var bool */ - private $parseDoctrineStrings; - /** - * @param array{lines?: bool, indexes?: bool} $usedAttributes - */ - public function __construct(bool $unescapeStrings = \false, bool $quoteAwareConstExprString = \false, array $usedAttributes = []) + private ParserConfig $config; + private bool $parseDoctrineStrings; + public function __construct(ParserConfig $config) { - $this->unescapeStrings = $unescapeStrings; - $this->quoteAwareConstExprString = $quoteAwareConstExprString; - $this->useLinesAttributes = $usedAttributes['lines'] ?? \false; - $this->useIndexAttributes = $usedAttributes['indexes'] ?? \false; + $this->config = $config; $this->parseDoctrineStrings = \false; } /** @@ -36,11 +22,11 @@ class ConstExprParser */ public function toDoctrine() : self { - $self = new self($this->unescapeStrings, $this->quoteAwareConstExprString, ['lines' => $this->useLinesAttributes, 'indexes' => $this->useIndexAttributes]); + $self = new self($this->config); $self->parseDoctrineStrings = \true; return $self; } - public function parse(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens, bool $trimStrings = \false) : Ast\ConstExpr\ConstExprNode + public function parse(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\ConstExpr\ConstExprNode { $startLine = $tokens->currentTokenLine(); $startIndex = $tokens->currentTokenIndex(); @@ -68,20 +54,10 @@ class ConstExprParser $tokens->next(); return $this->enrichWithAttributes($tokens, $this->parseDoctrineString($value, $tokens), $startLine, $startIndex); } - $value = $tokens->currentTokenValue(); + $value = \PHPStan\PhpDocParser\Parser\StringUnescaper::unescapeString($tokens->currentTokenValue()); $type = $tokens->currentTokenType(); - if ($trimStrings) { - if ($this->unescapeStrings) { - $value = \PHPStan\PhpDocParser\Parser\StringUnescaper::unescapeString($value); - } else { - $value = substr($value, 1, -1); - } - } $tokens->next(); - if ($this->quoteAwareConstExprString) { - return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\QuoteAwareConstExprStringNode($value, $type === Lexer::TOKEN_SINGLE_QUOTED_STRING ? Ast\ConstExpr\QuoteAwareConstExprStringNode::SINGLE_QUOTED : Ast\ConstExpr\QuoteAwareConstExprStringNode::DOUBLE_QUOTED), $startLine, $startIndex); - } - return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstExprStringNode($value), $startLine, $startIndex); + return $this->enrichWithAttributes($tokens, new Ast\ConstExpr\ConstExprStringNode($value, $type === Lexer::TOKEN_SINGLE_QUOTED_STRING ? Ast\ConstExpr\ConstExprStringNode::SINGLE_QUOTED : Ast\ConstExpr\ConstExprStringNode::DOUBLE_QUOTED), $startLine, $startIndex); } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_IDENTIFIER)) { $identifier = $tokens->currentTokenValue(); $tokens->next(); @@ -175,11 +151,11 @@ class ConstExprParser */ private function enrichWithAttributes(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens, Ast\ConstExpr\ConstExprNode $node, int $startLine, int $startIndex) : Ast\ConstExpr\ConstExprNode { - if ($this->useLinesAttributes) { + if ($this->config->useLinesAttributes) { $node->setAttribute(Ast\Attribute::START_LINE, $startLine); $node->setAttribute(Ast\Attribute::END_LINE, $tokens->currentTokenLine()); } - if ($this->useIndexAttributes) { + if ($this->config->useIndexAttributes) { $node->setAttribute(Ast\Attribute::START_INDEX, $startIndex); $node->setAttribute(Ast\Attribute::END_INDEX, $tokens->endIndexOfLastRelevantToken()); } diff --git a/vendor/phpstan/phpdoc-parser/src/Parser/ParserException.php b/vendor/phpstan/phpdoc-parser/src/Parser/ParserException.php index e09bc15da39..b256800ffb4 100644 --- a/vendor/phpstan/phpdoc-parser/src/Parser/ParserException.php +++ b/vendor/phpstan/phpdoc-parser/src/Parser/ParserException.php @@ -13,19 +13,13 @@ use const JSON_UNESCAPED_SLASHES; use const JSON_UNESCAPED_UNICODE; class ParserException extends Exception { - /** @var string */ - private $currentTokenValue; - /** @var int */ - private $currentTokenType; - /** @var int */ - private $currentOffset; - /** @var int */ - private $expectedTokenType; - /** @var string|null */ - private $expectedTokenValue; - /** @var int|null */ - private $currentTokenLine; - public function __construct(string $currentTokenValue, int $currentTokenType, int $currentOffset, int $expectedTokenType, ?string $expectedTokenValue = null, ?int $currentTokenLine = null) + private string $currentTokenValue; + private int $currentTokenType; + private int $currentOffset; + private int $expectedTokenType; + private ?string $expectedTokenValue; + private ?int $currentTokenLine; + public function __construct(string $currentTokenValue, int $currentTokenType, int $currentOffset, int $expectedTokenType, ?string $expectedTokenValue, ?int $currentTokenLine) { $this->currentTokenValue = $currentTokenValue; $this->currentTokenType = $currentTokenType; diff --git a/vendor/phpstan/phpdoc-parser/src/Parser/PhpDocParser.php b/vendor/phpstan/phpdoc-parser/src/Parser/PhpDocParser.php index dd3a4502615..a582094f2e4 100644 --- a/vendor/phpstan/phpdoc-parser/src/Parser/PhpDocParser.php +++ b/vendor/phpstan/phpdoc-parser/src/Parser/PhpDocParser.php @@ -11,9 +11,9 @@ use PHPStan\PhpDocParser\Ast\ConstExpr\ConstFetchNode; use PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; use PHPStan\PhpDocParser\Lexer\Lexer; +use PHPStan\PhpDocParser\ParserConfig; use PHPStan\ShouldNotHappenException; use function array_key_exists; -use function array_values; use function count; use function rtrim; use function str_replace; @@ -24,74 +24,43 @@ use function trim; class PhpDocParser { private const DISALLOWED_DESCRIPTION_START_TOKENS = [Lexer::TOKEN_UNION, Lexer::TOKEN_INTERSECTION]; - /** @var TypeParser */ - private $typeParser; - /** @var ConstExprParser */ - private $constantExprParser; - /** @var ConstExprParser */ - private $doctrineConstantExprParser; - /** @var bool */ - private $requireWhitespaceBeforeDescription; - /** @var bool */ - private $preserveTypeAliasesWithInvalidTypes; - /** @var bool */ - private $parseDoctrineAnnotations; - /** @var bool */ - private $useLinesAttributes; - /** @var bool */ - private $useIndexAttributes; - /** @var bool */ - private $textBetweenTagsBelongsToDescription; - /** - * @param array{lines?: bool, indexes?: bool} $usedAttributes - */ - public function __construct(\PHPStan\PhpDocParser\Parser\TypeParser $typeParser, \PHPStan\PhpDocParser\Parser\ConstExprParser $constantExprParser, bool $requireWhitespaceBeforeDescription = \false, bool $preserveTypeAliasesWithInvalidTypes = \false, array $usedAttributes = [], bool $parseDoctrineAnnotations = \false, bool $textBetweenTagsBelongsToDescription = \false) + private ParserConfig $config; + private \PHPStan\PhpDocParser\Parser\TypeParser $typeParser; + private \PHPStan\PhpDocParser\Parser\ConstExprParser $constantExprParser; + private \PHPStan\PhpDocParser\Parser\ConstExprParser $doctrineConstantExprParser; + public function __construct(ParserConfig $config, \PHPStan\PhpDocParser\Parser\TypeParser $typeParser, \PHPStan\PhpDocParser\Parser\ConstExprParser $constantExprParser) { + $this->config = $config; $this->typeParser = $typeParser; $this->constantExprParser = $constantExprParser; $this->doctrineConstantExprParser = $constantExprParser->toDoctrine(); - $this->requireWhitespaceBeforeDescription = $requireWhitespaceBeforeDescription; - $this->preserveTypeAliasesWithInvalidTypes = $preserveTypeAliasesWithInvalidTypes; - $this->parseDoctrineAnnotations = $parseDoctrineAnnotations; - $this->useLinesAttributes = $usedAttributes['lines'] ?? \false; - $this->useIndexAttributes = $usedAttributes['indexes'] ?? \false; - $this->textBetweenTagsBelongsToDescription = $textBetweenTagsBelongsToDescription; } public function parse(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\PhpDocNode { $tokens->consumeTokenType(Lexer::TOKEN_OPEN_PHPDOC); $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); $children = []; - if ($this->parseDoctrineAnnotations) { - if (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { - $lastChild = $this->parseChild($tokens); - $children[] = $lastChild; - while (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { - if ($lastChild instanceof Ast\PhpDoc\PhpDocTagNode && ($lastChild->value instanceof Doctrine\DoctrineTagValueNode || $lastChild->value instanceof Ast\PhpDoc\GenericTagValueNode)) { - $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); - if ($tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { - break; - } - $lastChild = $this->parseChild($tokens); - $children[] = $lastChild; - continue; - } - if (!$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL)) { - break; - } + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { + $lastChild = $this->parseChild($tokens); + $children[] = $lastChild; + while (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { + if ($lastChild instanceof Ast\PhpDoc\PhpDocTagNode && ($lastChild->value instanceof Doctrine\DoctrineTagValueNode || $lastChild->value instanceof Ast\PhpDoc\GenericTagValueNode)) { + $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); if ($tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { break; } $lastChild = $this->parseChild($tokens); $children[] = $lastChild; + continue; } - } - } else { - if (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { - $children[] = $this->parseChild($tokens); - while ($tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL) && !$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { - $children[] = $this->parseChild($tokens); + if (!$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL)) { + break; } + if ($tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { + break; + } + $lastChild = $this->parseChild($tokens); + $children[] = $lastChild; } } try { @@ -112,7 +81,7 @@ class PhpDocParser $tokens->forwardToTheEnd(); return $this->enrichWithAttributes($tokens, new Ast\PhpDoc\PhpDocNode([$this->enrichWithAttributes($tokens, $tag, $startLine, $startIndex)]), 1, 0); } - return $this->enrichWithAttributes($tokens, new Ast\PhpDoc\PhpDocNode(array_values($children)), 1, 0); + return $this->enrichWithAttributes($tokens, new Ast\PhpDoc\PhpDocNode($children), 1, 0); } /** @phpstan-impure */ private function parseChild(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\PhpDocChildNode @@ -143,11 +112,11 @@ class PhpDocParser */ private function enrichWithAttributes(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens, Ast\Node $tag, int $startLine, int $startIndex) : Ast\Node { - if ($this->useLinesAttributes) { + if ($this->config->useLinesAttributes) { $tag->setAttribute(Ast\Attribute::START_LINE, $startLine); $tag->setAttribute(Ast\Attribute::END_LINE, $tokens->currentTokenLine()); } - if ($this->useIndexAttributes) { + if ($this->config->useIndexAttributes) { $tag->setAttribute(Ast\Attribute::START_INDEX, $startIndex); $tag->setAttribute(Ast\Attribute::END_INDEX, $tokens->endIndexOfLastRelevantToken()); } @@ -156,27 +125,22 @@ class PhpDocParser private function parseText(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\PhpDocTextNode { $text = ''; - $endTokens = [Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END]; - if ($this->textBetweenTagsBelongsToDescription) { - $endTokens = [Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END]; - } + $endTokens = [Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END]; $savepoint = \false; // if the next token is EOL, everything below is skipped and empty string is returned - while ($this->textBetweenTagsBelongsToDescription || !$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL)) { + while (\true) { $tmpText = $tokens->getSkippedHorizontalWhiteSpaceIfAny() . $tokens->joinUntil(Lexer::TOKEN_PHPDOC_EOL, ...$endTokens); $text .= $tmpText; // stop if we're not at EOL - meaning it's the end of PHPDoc if (!$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC)) { break; } - if ($this->textBetweenTagsBelongsToDescription) { - if (!$savepoint) { - $tokens->pushSavePoint(); - $savepoint = \true; - } elseif ($tmpText !== '') { - $tokens->dropSavePoint(); - $tokens->pushSavePoint(); - } + if (!$savepoint) { + $tokens->pushSavePoint(); + $savepoint = \true; + } elseif ($tmpText !== '') { + $tokens->dropSavePoint(); + $tokens->pushSavePoint(); } $tokens->pushSavePoint(); $tokens->next(); @@ -199,13 +163,10 @@ class PhpDocParser private function parseOptionalDescriptionAfterDoctrineTag(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : string { $text = ''; - $endTokens = [Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END]; - if ($this->textBetweenTagsBelongsToDescription) { - $endTokens = [Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END]; - } + $endTokens = [Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END]; $savepoint = \false; // if the next token is EOL, everything below is skipped and empty string is returned - while ($this->textBetweenTagsBelongsToDescription || !$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL)) { + while (\true) { $tmpText = $tokens->getSkippedHorizontalWhiteSpaceIfAny() . $tokens->joinUntil(Lexer::TOKEN_PHPDOC_TAG, Lexer::TOKEN_DOCTRINE_TAG, Lexer::TOKEN_PHPDOC_EOL, ...$endTokens); $text .= $tmpText; // stop if we're not at EOL - meaning it's the end of PHPDoc @@ -238,14 +199,12 @@ class PhpDocParser } break; } - if ($this->textBetweenTagsBelongsToDescription) { - if (!$savepoint) { - $tokens->pushSavePoint(); - $savepoint = \true; - } elseif ($tmpText !== '') { - $tokens->dropSavePoint(); - $tokens->pushSavePoint(); - } + if (!$savepoint) { + $tokens->pushSavePoint(); + $savepoint = \true; + } elseif ($tmpText !== '') { + $tokens->dropSavePoint(); + $tokens->pushSavePoint(); } $tokens->pushSavePoint(); $tokens->next(); @@ -363,9 +322,7 @@ class PhpDocParser case '@template-contravariant': case '@phpstan-template-contravariant': case '@psalm-template-contravariant': - $tagValue = $this->typeParser->parseTemplateTagValue($tokens, function ($tokens) { - return $this->parseOptionalDescription($tokens); - }); + $tagValue = $this->typeParser->parseTemplateTagValue($tokens, fn($tokens) => $this->parseOptionalDescription($tokens, \true)); break; case '@extends': case '@phpstan-extends': @@ -416,21 +373,17 @@ class PhpDocParser $tagValue = $this->parseParamOutTagValue($tokens); break; default: - if ($this->parseDoctrineAnnotations) { - if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_PARENTHESES)) { - $tagValue = $this->parseDoctrineTagValue($tokens, $tag); - } else { - $tagValue = new Ast\PhpDoc\GenericTagValueNode($this->parseOptionalDescriptionAfterDoctrineTag($tokens)); - } - break; + if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_PARENTHESES)) { + $tagValue = $this->parseDoctrineTagValue($tokens, $tag); + } else { + $tagValue = new Ast\PhpDoc\GenericTagValueNode($this->parseOptionalDescriptionAfterDoctrineTag($tokens)); } - $tagValue = new Ast\PhpDoc\GenericTagValueNode($this->parseOptionalDescription($tokens)); break; } $tokens->dropSavePoint(); } catch (\PHPStan\PhpDocParser\Parser\ParserException $e) { $tokens->rollback(); - $tagValue = new Ast\PhpDoc\InvalidTagValueNode($this->parseOptionalDescription($tokens), $e); + $tagValue = new Ast\PhpDoc\InvalidTagValueNode($this->parseOptionalDescription($tokens, \false), $e); } return $this->enrichWithAttributes($tokens, $tagValue, $startLine, $startIndex); } @@ -534,7 +487,7 @@ class PhpDocParser $currentTokenOffset = $tokens->currentTokenOffset(); $currentTokenLine = $tokens->currentTokenLine(); try { - $constExpr = $this->doctrineConstantExprParser->parse($tokens, \true); + $constExpr = $this->doctrineConstantExprParser->parse($tokens); if ($constExpr instanceof Ast\ConstExpr\ConstExprArrayNode) { throw new \PHPStan\PhpDocParser\Parser\ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); } @@ -575,7 +528,10 @@ class PhpDocParser $key = new Ast\ConstExpr\ConstExprIntegerNode(str_replace('_', '', $tokens->currentTokenValue())); $tokens->next(); } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_DOCTRINE_ANNOTATION_STRING)) { - $key = new Ast\ConstExpr\DoctrineConstExprStringNode(Ast\ConstExpr\DoctrineConstExprStringNode::unescape($tokens->currentTokenValue())); + $key = $this->doctrineConstantExprParser->parseDoctrineString($tokens->currentTokenValue(), $tokens); + $tokens->next(); + } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_SINGLE_QUOTED_STRING)) { + $key = new Ast\ConstExpr\ConstExprStringNode(\PHPStan\PhpDocParser\Parser\StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\ConstExprStringNode::SINGLE_QUOTED); $tokens->next(); } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_DOUBLE_QUOTED_STRING)) { $value = $tokens->currentTokenValue(); @@ -594,7 +550,7 @@ class PhpDocParser return $this->enrichWithAttributes($tokens, new IdentifierTypeNode($currentTokenValue), $startLine, $startIndex); } $tokens->rollback(); - $constExpr = $this->doctrineConstantExprParser->parse($tokens, \true); + $constExpr = $this->doctrineConstantExprParser->parse($tokens); if (!$constExpr instanceof Ast\ConstExpr\ConstFetchNode) { throw new \PHPStan\PhpDocParser\Parser\ParserException($tokens->currentTokenValue(), $tokens->currentTokenType(), $tokens->currentTokenOffset(), Lexer::TOKEN_IDENTIFIER, null, $tokens->currentTokenLine()); } @@ -615,7 +571,7 @@ class PhpDocParser $isReference = $tokens->tryConsumeTokenType(Lexer::TOKEN_REFERENCE); $isVariadic = $tokens->tryConsumeTokenType(Lexer::TOKEN_VARIADIC); $parameterName = $this->parseRequiredVariableName($tokens); - $description = $this->parseOptionalDescription($tokens); + $description = $this->parseOptionalDescription($tokens, \false); if ($type !== null) { return new Ast\PhpDoc\ParamTagValueNode($type, $isVariadic, $parameterName, $description, $isReference); } @@ -624,26 +580,26 @@ class PhpDocParser private function parseParamImmediatelyInvokedCallableTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\ParamImmediatelyInvokedCallableTagValueNode { $parameterName = $this->parseRequiredVariableName($tokens); - $description = $this->parseOptionalDescription($tokens); + $description = $this->parseOptionalDescription($tokens, \false); return new Ast\PhpDoc\ParamImmediatelyInvokedCallableTagValueNode($parameterName, $description); } private function parseParamLaterInvokedCallableTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\ParamLaterInvokedCallableTagValueNode { $parameterName = $this->parseRequiredVariableName($tokens); - $description = $this->parseOptionalDescription($tokens); + $description = $this->parseOptionalDescription($tokens, \false); return new Ast\PhpDoc\ParamLaterInvokedCallableTagValueNode($parameterName, $description); } private function parseParamClosureThisTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\ParamClosureThisTagValueNode { $type = $this->typeParser->parse($tokens); $parameterName = $this->parseRequiredVariableName($tokens); - $description = $this->parseOptionalDescription($tokens); + $description = $this->parseOptionalDescription($tokens, \false); return new Ast\PhpDoc\ParamClosureThisTagValueNode($type, $parameterName, $description); } private function parsePureUnlessCallableIsImpureTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\PureUnlessCallableIsImpureTagValueNode { $parameterName = $this->parseRequiredVariableName($tokens); - $description = $this->parseOptionalDescription($tokens); + $description = $this->parseOptionalDescription($tokens, \false); return new Ast\PhpDoc\PureUnlessCallableIsImpureTagValueNode($parameterName, $description); } private function parseVarTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\VarTagValueNode @@ -685,14 +641,14 @@ class PhpDocParser } private function parseDeprecatedTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\DeprecatedTagValueNode { - $description = $this->parseOptionalDescription($tokens); + $description = $this->parseOptionalDescription($tokens, \false); return new Ast\PhpDoc\DeprecatedTagValueNode($description); } private function parsePropertyTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\PropertyTagValueNode { $type = $this->typeParser->parse($tokens); $parameterName = $this->parseRequiredVariableName($tokens); - $description = $this->parseOptionalDescription($tokens); + $description = $this->parseOptionalDescription($tokens, \false); return new Ast\PhpDoc\PropertyTagValueNode($type, $parameterName, $description); } private function parseMethodTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\MethodTagValueNode @@ -736,7 +692,7 @@ class PhpDocParser } } $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PARENTHESES); - $description = $this->parseOptionalDescription($tokens); + $description = $this->parseOptionalDescription($tokens, \false); return new Ast\PhpDoc\MethodTagValueNode($isStatic, $returnType, $methodName, $parameters, $description, $templateTypes); } private function parseMethodTagValueParameter(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\MethodTagValueParameterNode @@ -770,7 +726,7 @@ class PhpDocParser $baseType = new IdentifierTypeNode($tokens->currentTokenValue()); $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); $type = $this->typeParser->parseGeneric($tokens, $this->typeParser->enrichWithAttributes($tokens, $baseType, $startLine, $startIndex)); - $description = $this->parseOptionalDescription($tokens); + $description = $this->parseOptionalDescription($tokens, \true); switch ($tagName) { case '@extends': return new Ast\PhpDoc\ExtendsTagValueNode($type, $description); @@ -787,24 +743,20 @@ class PhpDocParser $tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER); // support phan-type/psalm-type syntax $tokens->tryConsumeTokenType(Lexer::TOKEN_EQUAL); - if ($this->preserveTypeAliasesWithInvalidTypes) { - $startLine = $tokens->currentTokenLine(); - $startIndex = $tokens->currentTokenIndex(); - try { - $type = $this->typeParser->parse($tokens); - if (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { - if (!$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL)) { - throw new \PHPStan\PhpDocParser\Parser\ParserException($tokens->currentTokenValue(), $tokens->currentTokenType(), $tokens->currentTokenOffset(), Lexer::TOKEN_PHPDOC_EOL, null, $tokens->currentTokenLine()); - } + $startLine = $tokens->currentTokenLine(); + $startIndex = $tokens->currentTokenIndex(); + try { + $type = $this->typeParser->parse($tokens); + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC)) { + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL)) { + throw new \PHPStan\PhpDocParser\Parser\ParserException($tokens->currentTokenValue(), $tokens->currentTokenType(), $tokens->currentTokenOffset(), Lexer::TOKEN_PHPDOC_EOL, null, $tokens->currentTokenLine()); } - return new Ast\PhpDoc\TypeAliasTagValueNode($alias, $type); - } catch (\PHPStan\PhpDocParser\Parser\ParserException $e) { - $this->parseOptionalDescription($tokens); - return new Ast\PhpDoc\TypeAliasTagValueNode($alias, $this->enrichWithAttributes($tokens, new Ast\Type\InvalidTypeNode($e), $startLine, $startIndex)); } + return new Ast\PhpDoc\TypeAliasTagValueNode($alias, $type); + } catch (\PHPStan\PhpDocParser\Parser\ParserException $e) { + $this->parseOptionalDescription($tokens, \false); + return new Ast\PhpDoc\TypeAliasTagValueNode($alias, $this->enrichWithAttributes($tokens, new Ast\Type\InvalidTypeNode($e), $startLine, $startIndex)); } - $type = $this->typeParser->parse($tokens); - return new Ast\PhpDoc\TypeAliasTagValueNode($alias, $type); } private function parseTypeAliasImportTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\TypeAliasImportTagValueNode { @@ -832,7 +784,7 @@ class PhpDocParser $isEquality = $tokens->tryConsumeTokenType(Lexer::TOKEN_EQUAL); $type = $this->typeParser->parse($tokens); $parameter = $this->parseAssertParameter($tokens); - $description = $this->parseOptionalDescription($tokens); + $description = $this->parseOptionalDescription($tokens, \false); if (array_key_exists('method', $parameter)) { return new Ast\PhpDoc\AssertTagMethodValueNode($type, $parameter['parameter'], $parameter['method'], $isNegated, $description, $isEquality); } elseif (array_key_exists('property', $parameter)) { @@ -867,14 +819,14 @@ class PhpDocParser private function parseSelfOutTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\SelfOutTagValueNode { $type = $this->typeParser->parse($tokens); - $description = $this->parseOptionalDescription($tokens); + $description = $this->parseOptionalDescription($tokens, \true); return new Ast\PhpDoc\SelfOutTagValueNode($type, $description); } private function parseParamOutTagValue(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\PhpDoc\ParamOutTagValueNode { $type = $this->typeParser->parse($tokens); $parameterName = $this->parseRequiredVariableName($tokens); - $description = $this->parseOptionalDescription($tokens); + $description = $this->parseOptionalDescription($tokens, \false); return new Ast\PhpDoc\ParamOutTagValueNode($type, $parameterName, $description); } private function parseOptionalVariableName(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : string @@ -896,7 +848,10 @@ class PhpDocParser $tokens->consumeTokenType(Lexer::TOKEN_VARIABLE); return $parameterName; } - private function parseOptionalDescription(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens, bool $limitStartToken = \false) : string + /** + * @param bool $limitStartToken true should be used when the description immediately follows a parsed type + */ + private function parseOptionalDescription(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens, bool $limitStartToken) : string { if ($limitStartToken) { foreach (self::DISALLOWED_DESCRIPTION_START_TOKENS as $disallowedStartToken) { @@ -906,7 +861,7 @@ class PhpDocParser $tokens->consumeTokenType(Lexer::TOKEN_OTHER); // will throw exception } - if ($this->requireWhitespaceBeforeDescription && !$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END) && !$tokens->isPrecededByHorizontalWhitespace()) { + if (!$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END) && !$tokens->isPrecededByHorizontalWhitespace()) { $tokens->consumeTokenType(Lexer::TOKEN_HORIZONTAL_WS); // will throw exception } diff --git a/vendor/phpstan/phpdoc-parser/src/Parser/TokenIterator.php b/vendor/phpstan/phpdoc-parser/src/Parser/TokenIterator.php index ecc64b37ee7..6293cf0a104 100644 --- a/vendor/phpstan/phpdoc-parser/src/Parser/TokenIterator.php +++ b/vendor/phpstan/phpdoc-parser/src/Parser/TokenIterator.php @@ -14,15 +14,13 @@ use function substr; class TokenIterator { /** @var list */ - private $tokens; - /** @var int */ - private $index; + private array $tokens; + private int $index; /** @var int[] */ - private $savePoints = []; + private array $savePoints = []; /** @var list */ - private $skippedTokenTypes = [Lexer::TOKEN_HORIZONTAL_WS]; - /** @var string|null */ - private $newline = null; + private array $skippedTokenTypes = [Lexer::TOKEN_HORIZONTAL_WS]; + private ?string $newline = null; /** * @param list $tokens */ diff --git a/vendor/phpstan/phpdoc-parser/src/Parser/TypeParser.php b/vendor/phpstan/phpdoc-parser/src/Parser/TypeParser.php index 622e5c2ce93..8eb22cc9dd0 100644 --- a/vendor/phpstan/phpdoc-parser/src/Parser/TypeParser.php +++ b/vendor/phpstan/phpdoc-parser/src/Parser/TypeParser.php @@ -7,31 +7,20 @@ use LogicException; use PHPStan\PhpDocParser\Ast; use PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode; use PHPStan\PhpDocParser\Lexer\Lexer; +use PHPStan\PhpDocParser\ParserConfig; use function in_array; use function str_replace; use function strlen; use function strpos; use function substr_compare; -use function trim; class TypeParser { - /** @var ConstExprParser|null */ - private $constExprParser; - /** @var bool */ - private $quoteAwareConstExprString; - /** @var bool */ - private $useLinesAttributes; - /** @var bool */ - private $useIndexAttributes; - /** - * @param array{lines?: bool, indexes?: bool} $usedAttributes - */ - public function __construct(?\PHPStan\PhpDocParser\Parser\ConstExprParser $constExprParser = null, bool $quoteAwareConstExprString = \false, array $usedAttributes = []) + private ParserConfig $config; + private \PHPStan\PhpDocParser\Parser\ConstExprParser $constExprParser; + public function __construct(ParserConfig $config, \PHPStan\PhpDocParser\Parser\ConstExprParser $constExprParser) { + $this->config = $config; $this->constExprParser = $constExprParser; - $this->quoteAwareConstExprString = $quoteAwareConstExprString; - $this->useLinesAttributes = $usedAttributes['lines'] ?? \false; - $this->useIndexAttributes = $usedAttributes['indexes'] ?? \false; } /** @phpstan-impure */ public function parse(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\Type\TypeNode @@ -58,11 +47,11 @@ class TypeParser */ public function enrichWithAttributes(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens, Ast\Node $type, int $startLine, int $startIndex) : Ast\Node { - if ($this->useLinesAttributes) { + if ($this->config->useLinesAttributes) { $type->setAttribute(Ast\Attribute::START_LINE, $startLine); $type->setAttribute(Ast\Attribute::END_LINE, $tokens->currentTokenLine()); } - if ($this->useIndexAttributes) { + if ($this->config->useIndexAttributes) { $type->setAttribute(Ast\Attribute::START_INDEX, $startIndex); $type->setAttribute(Ast\Attribute::END_INDEX, $tokens->endIndexOfLastRelevantToken()); } @@ -164,11 +153,8 @@ class TypeParser $currentTokenType = $tokens->currentTokenType(); $currentTokenOffset = $tokens->currentTokenOffset(); $currentTokenLine = $tokens->currentTokenLine(); - if ($this->constExprParser === null) { - throw new \PHPStan\PhpDocParser\Parser\ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); - } try { - $constExpr = $this->constExprParser->parse($tokens, \true); + $constExpr = $this->constExprParser->parse($tokens); if ($constExpr instanceof Ast\ConstExpr\ConstExprArrayNode) { throw new \PHPStan\PhpDocParser\Parser\ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); } @@ -498,11 +484,8 @@ class TypeParser $currentTokenType = $tokens->currentTokenType(); $currentTokenOffset = $tokens->currentTokenOffset(); $currentTokenLine = $tokens->currentTokenLine(); - if ($this->constExprParser === null) { - throw new \PHPStan\PhpDocParser\Parser\ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); - } try { - $constExpr = $this->constExprParser->parse($tokens, \true); + $constExpr = $this->constExprParser->parse($tokens); if ($constExpr instanceof Ast\ConstExpr\ConstExprArrayNode) { throw new \PHPStan\PhpDocParser\Parser\ParserException($currentTokenValue, $currentTokenType, $currentTokenOffset, Lexer::TOKEN_IDENTIFIER, null, $currentTokenLine); } @@ -573,7 +556,7 @@ class TypeParser do { $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); if ($tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_CURLY_BRACKET)) { - return new Ast\Type\ArrayShapeNode($items, \true, $kind); + return Ast\Type\ArrayShapeNode::createSealed($items, $kind); } if ($tokens->tryConsumeTokenType(Lexer::TOKEN_VARIADIC)) { $sealed = \false; @@ -594,7 +577,10 @@ class TypeParser } while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)); $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_CURLY_BRACKET); - return new Ast\Type\ArrayShapeNode($items, $sealed, $kind, $unsealedType); + if ($sealed) { + return Ast\Type\ArrayShapeNode::createSealed($items, $kind); + } + return Ast\Type\ArrayShapeNode::createUnsealed($items, $unsealedType, $kind); } /** @phpstan-impure */ private function parseArrayShapeItem(\PHPStan\PhpDocParser\Parser\TokenIterator $tokens) : Ast\Type\ArrayShapeItemNode @@ -627,18 +613,10 @@ class TypeParser $key = new Ast\ConstExpr\ConstExprIntegerNode(str_replace('_', '', $tokens->currentTokenValue())); $tokens->next(); } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_SINGLE_QUOTED_STRING)) { - if ($this->quoteAwareConstExprString) { - $key = new Ast\ConstExpr\QuoteAwareConstExprStringNode(\PHPStan\PhpDocParser\Parser\StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\QuoteAwareConstExprStringNode::SINGLE_QUOTED); - } else { - $key = new Ast\ConstExpr\ConstExprStringNode(trim($tokens->currentTokenValue(), "'")); - } + $key = new Ast\ConstExpr\ConstExprStringNode(\PHPStan\PhpDocParser\Parser\StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\ConstExprStringNode::SINGLE_QUOTED); $tokens->next(); } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_DOUBLE_QUOTED_STRING)) { - if ($this->quoteAwareConstExprString) { - $key = new Ast\ConstExpr\QuoteAwareConstExprStringNode(\PHPStan\PhpDocParser\Parser\StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\QuoteAwareConstExprStringNode::DOUBLE_QUOTED); - } else { - $key = new Ast\ConstExpr\ConstExprStringNode(trim($tokens->currentTokenValue(), '"')); - } + $key = new Ast\ConstExpr\ConstExprStringNode(\PHPStan\PhpDocParser\Parser\StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\ConstExprStringNode::DOUBLE_QUOTED); $tokens->next(); } else { $key = new Ast\Type\IdentifierTypeNode($tokens->currentTokenValue()); @@ -720,18 +698,10 @@ class TypeParser $startLine = $tokens->currentTokenLine(); $startIndex = $tokens->currentTokenIndex(); if ($tokens->isCurrentTokenType(Lexer::TOKEN_SINGLE_QUOTED_STRING)) { - if ($this->quoteAwareConstExprString) { - $key = new Ast\ConstExpr\QuoteAwareConstExprStringNode(\PHPStan\PhpDocParser\Parser\StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\QuoteAwareConstExprStringNode::SINGLE_QUOTED); - } else { - $key = new Ast\ConstExpr\ConstExprStringNode(trim($tokens->currentTokenValue(), "'")); - } + $key = new Ast\ConstExpr\ConstExprStringNode(\PHPStan\PhpDocParser\Parser\StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\ConstExprStringNode::SINGLE_QUOTED); $tokens->next(); } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_DOUBLE_QUOTED_STRING)) { - if ($this->quoteAwareConstExprString) { - $key = new Ast\ConstExpr\QuoteAwareConstExprStringNode(\PHPStan\PhpDocParser\Parser\StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\QuoteAwareConstExprStringNode::DOUBLE_QUOTED); - } else { - $key = new Ast\ConstExpr\ConstExprStringNode(trim($tokens->currentTokenValue(), '"')); - } + $key = new Ast\ConstExpr\ConstExprStringNode(\PHPStan\PhpDocParser\Parser\StringUnescaper::unescapeString($tokens->currentTokenValue()), Ast\ConstExpr\ConstExprStringNode::DOUBLE_QUOTED); $tokens->next(); } else { $key = new Ast\Type\IdentifierTypeNode($tokens->currentTokenValue()); diff --git a/vendor/phpstan/phpdoc-parser/src/ParserConfig.php b/vendor/phpstan/phpdoc-parser/src/ParserConfig.php new file mode 100644 index 00000000000..6369bd6d170 --- /dev/null +++ b/vendor/phpstan/phpdoc-parser/src/ParserConfig.php @@ -0,0 +1,18 @@ +useLinesAttributes = $usedAttributes['lines'] ?? \false; + $this->useIndexAttributes = $usedAttributes['indexes'] ?? \false; + } +} diff --git a/vendor/phpstan/phpdoc-parser/src/Printer/Printer.php b/vendor/phpstan/phpdoc-parser/src/Printer/Printer.php index a4738334277..692e3ac6342 100644 --- a/vendor/phpstan/phpdoc-parser/src/Printer/Printer.php +++ b/vendor/phpstan/phpdoc-parser/src/Printer/Printer.php @@ -88,24 +88,24 @@ use const PREG_SET_ORDER; final class Printer { /** @var Differ */ - private $differ; + private \PHPStan\PhpDocParser\Printer\Differ $differ; /** * Map From "{$class}->{$subNode}" to string that should be inserted * between elements of this list subnode * * @var array */ - private $listInsertionMap = [PhpDocNode::class . '->children' => "\n * ", UnionTypeNode::class . '->types' => '|', IntersectionTypeNode::class . '->types' => '&', ArrayShapeNode::class . '->items' => ', ', ObjectShapeNode::class . '->items' => ', ', CallableTypeNode::class . '->parameters' => ', ', CallableTypeNode::class . '->templateTypes' => ', ', GenericTypeNode::class . '->genericTypes' => ', ', ConstExprArrayNode::class . '->items' => ', ', MethodTagValueNode::class . '->parameters' => ', ', DoctrineArray::class . '->items' => ', ', DoctrineAnnotation::class . '->arguments' => ', ']; + private array $listInsertionMap = [PhpDocNode::class . '->children' => "\n * ", UnionTypeNode::class . '->types' => '|', IntersectionTypeNode::class . '->types' => '&', ArrayShapeNode::class . '->items' => ', ', ObjectShapeNode::class . '->items' => ', ', CallableTypeNode::class . '->parameters' => ', ', CallableTypeNode::class . '->templateTypes' => ', ', GenericTypeNode::class . '->genericTypes' => ', ', ConstExprArrayNode::class . '->items' => ', ', MethodTagValueNode::class . '->parameters' => ', ', DoctrineArray::class . '->items' => ', ', DoctrineAnnotation::class . '->arguments' => ', ']; /** * [$find, $extraLeft, $extraRight] * * @var array */ - private $emptyListInsertionMap = [CallableTypeNode::class . '->parameters' => ['(', '', ''], ArrayShapeNode::class . '->items' => ['{', '', ''], ObjectShapeNode::class . '->items' => ['{', '', ''], DoctrineArray::class . '->items' => ['{', '', ''], DoctrineAnnotation::class . '->arguments' => ['(', '', '']]; + private array $emptyListInsertionMap = [CallableTypeNode::class . '->parameters' => ['(', '', ''], ArrayShapeNode::class . '->items' => ['{', '', ''], ObjectShapeNode::class . '->items' => ['{', '', ''], DoctrineArray::class . '->items' => ['{', '', ''], DoctrineAnnotation::class . '->arguments' => ['(', '', '']]; /** @var array>> */ - private $parenthesesMap = [CallableTypeNode::class . '->returnType' => [CallableTypeNode::class, UnionTypeNode::class, IntersectionTypeNode::class], ArrayTypeNode::class . '->type' => [CallableTypeNode::class, UnionTypeNode::class, IntersectionTypeNode::class, ConstTypeNode::class, NullableTypeNode::class], OffsetAccessTypeNode::class . '->type' => [CallableTypeNode::class, UnionTypeNode::class, IntersectionTypeNode::class, NullableTypeNode::class]]; + private array $parenthesesMap = [CallableTypeNode::class . '->returnType' => [CallableTypeNode::class, UnionTypeNode::class, IntersectionTypeNode::class], ArrayTypeNode::class . '->type' => [CallableTypeNode::class, UnionTypeNode::class, IntersectionTypeNode::class, ConstTypeNode::class, NullableTypeNode::class], OffsetAccessTypeNode::class . '->type' => [CallableTypeNode::class, UnionTypeNode::class, IntersectionTypeNode::class, NullableTypeNode::class]]; /** @var array>> */ - private $parenthesesListMap = [IntersectionTypeNode::class . '->types' => [IntersectionTypeNode::class, UnionTypeNode::class, NullableTypeNode::class], UnionTypeNode::class . '->types' => [IntersectionTypeNode::class, UnionTypeNode::class, NullableTypeNode::class]]; + private array $parenthesesListMap = [IntersectionTypeNode::class . '->types' => [IntersectionTypeNode::class, UnionTypeNode::class, NullableTypeNode::class], UnionTypeNode::class . '->types' => [IntersectionTypeNode::class, UnionTypeNode::class, NullableTypeNode::class]]; public function printFormatPreserving(PhpDocNode $node, PhpDocNode $originalNode, TokenIterator $originalTokens) : string { $this->differ = new \PHPStan\PhpDocParser\Printer\Differ(static function ($a, $b) { @@ -179,6 +179,18 @@ final class Printer if ($node instanceof DoctrineArrayItem) { return (string) $node; } + if ($node instanceof ArrayShapeItemNode) { + if ($node->keyName !== null) { + return sprintf('%s%s: %s', $this->print($node->keyName), $node->optional ? '?' : '', $this->printType($node->valueType)); + } + return $this->printType($node->valueType); + } + if ($node instanceof ObjectShapeItemNode) { + if ($node->keyName !== null) { + return sprintf('%s%s: %s', $this->print($node->keyName), $node->optional ? '?' : '', $this->printType($node->valueType)); + } + return $this->printType($node->valueType); + } throw new LogicException(sprintf('Unknown node type %s', get_class($node))); } private function printTagValue(PhpDocTagValueNode $node) : string @@ -210,13 +222,9 @@ final class Printer if ($node instanceof MethodTagValueNode) { $static = $node->isStatic ? 'static ' : ''; $returnType = $node->returnType !== null ? $this->printType($node->returnType) . ' ' : ''; - $parameters = implode(', ', array_map(function (MethodTagValueParameterNode $parameter) : string { - return $this->print($parameter); - }, $node->parameters)); + $parameters = implode(', ', array_map(fn(MethodTagValueParameterNode $parameter): string => $this->print($parameter), $node->parameters)); $description = $node->description !== '' ? " {$node->description}" : ''; - $templateTypes = count($node->templateTypes) > 0 ? '<' . implode(', ', array_map(function (TemplateTagValueNode $templateTag) : string { - return $this->print($templateTag); - }, $node->templateTypes)) . '>' : ''; + $templateTypes = count($node->templateTypes) > 0 ? '<' . implode(', ', array_map(fn(TemplateTagValueNode $templateTag): string => $this->print($templateTag), $node->templateTypes)) . '>' : ''; return "{$static}{$returnType}{$node->methodName}{$templateTypes}({$parameters}){$description}"; } if ($node instanceof MixinTagValueNode) { @@ -295,20 +303,12 @@ final class Printer private function printType(TypeNode $node) : string { if ($node instanceof ArrayShapeNode) { - $items = array_map(function (ArrayShapeItemNode $item) : string { - return $this->printType($item); - }, $node->items); + $items = array_map(fn(ArrayShapeItemNode $item): string => $this->print($item), $node->items); if (!$node->sealed) { $items[] = '...' . ($node->unsealedType === null ? '' : $this->print($node->unsealedType)); } return $node->kind . '{' . implode(', ', $items) . '}'; } - if ($node instanceof ArrayShapeItemNode) { - if ($node->keyName !== null) { - return sprintf('%s%s: %s', $this->print($node->keyName), $node->optional ? '?' : '', $this->printType($node->valueType)); - } - return $this->printType($node->valueType); - } if ($node instanceof ArrayTypeNode) { return $this->printOffsetAccessType($node->type) . '[]'; } @@ -318,12 +318,8 @@ final class Printer } else { $returnType = $this->printType($node->returnType); } - $template = $node->templateTypes !== [] ? '<' . implode(', ', array_map(function (TemplateTagValueNode $templateNode) : string { - return $this->print($templateNode); - }, $node->templateTypes)) . '>' : ''; - $parameters = implode(', ', array_map(function (CallableTypeParameterNode $parameterNode) : string { - return $this->print($parameterNode); - }, $node->parameters)); + $template = $node->templateTypes !== [] ? '<' . implode(', ', array_map(fn(TemplateTagValueNode $templateNode): string => $this->print($templateNode), $node->templateTypes)) . '>' : ''; + $parameters = implode(', ', array_map(fn(CallableTypeParameterNode $parameterNode): string => $this->print($parameterNode), $node->parameters)); return "{$node->identifier}{$template}({$parameters}): {$returnType}"; } if ($node instanceof ConditionalTypeForParameterNode) { @@ -373,17 +369,9 @@ final class Printer return '?' . $this->printType($node->type); } if ($node instanceof ObjectShapeNode) { - $items = array_map(function (ObjectShapeItemNode $item) : string { - return $this->printType($item); - }, $node->items); + $items = array_map(fn(ObjectShapeItemNode $item): string => $this->print($item), $node->items); return 'object{' . implode(', ', $items) . '}'; } - if ($node instanceof ObjectShapeItemNode) { - if ($node->keyName !== null) { - return sprintf('%s%s: %s', $this->print($node->keyName), $node->optional ? '?' : '', $this->printType($node->valueType)); - } - return $this->printType($node->valueType); - } if ($node instanceof OffsetAccessTypeNode) { return $this->printOffsetAccessType($node->type) . '[' . $this->printType($node->offset) . ']'; } @@ -434,7 +422,9 @@ final class Printer if (!$newNode instanceof Node || !$originalNode instanceof Node) { return null; } + /** @var int $itemStartPos */ $itemStartPos = $originalNode->getAttribute(Attribute::START_INDEX); + /** @var int $itemEndPos */ $itemEndPos = $originalNode->getAttribute(Attribute::END_INDEX); if ($itemStartPos < 0 || $itemEndPos < 0 || $itemStartPos < $tokenIndex) { throw new LogicException(); @@ -484,6 +474,7 @@ final class Printer $delayedAdd[] = $newNode; continue; } + /** @var int $itemEndPos */ $itemEndPos = $tokenIndex - 1; if ($insertNewline) { $result .= $insertStr . sprintf('%s%s*%s', $originalTokens->getDetectedNewline() ?? "\n", $beforeAsteriskIndent, $afterAsteriskIndent); @@ -503,7 +494,9 @@ final class Printer if (!$originalNode instanceof Node) { return null; } + /** @var int $itemStartPos */ $itemStartPos = $originalNode->getAttribute(Attribute::START_INDEX); + /** @var int $itemEndPos */ $itemEndPos = $originalNode->getAttribute(Attribute::END_INDEX); if ($itemStartPos < 0 || $itemEndPos < 0) { throw new LogicException(); @@ -555,7 +548,7 @@ final class Printer return $result; } /** - * @param Node[] $nodes + * @param array $nodes * @return array{bool, string, string} */ private function isMultiline(int $initialIndex, array $nodes, TokenIterator $originalTokens) : array diff --git a/vendor/psr/log/src/LoggerAwareTrait.php b/vendor/psr/log/src/LoggerAwareTrait.php index ff6a1e8d16f..624f80fa73e 100644 --- a/vendor/psr/log/src/LoggerAwareTrait.php +++ b/vendor/psr/log/src/LoggerAwareTrait.php @@ -9,9 +9,8 @@ trait LoggerAwareTrait { /** * The logger instance. - * @var \Psr\Log\LoggerInterface|null */ - protected $logger; + protected ?LoggerInterface $logger = null; /** * Sets a logger. */ diff --git a/vendor/rector/extension-installer/src/GeneratedConfig.php b/vendor/rector/extension-installer/src/GeneratedConfig.php index a233311043c..968e07d74da 100644 --- a/vendor/rector/extension-installer/src/GeneratedConfig.php +++ b/vendor/rector/extension-installer/src/GeneratedConfig.php @@ -9,7 +9,7 @@ namespace Rector\RectorInstaller; */ final class GeneratedConfig { - public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 9cfbe48'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main eb03bfe'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main b75c030'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main d0f8cf2')); + public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 02ae401'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 829f969'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main a506b2c'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 89fa7a4')); private function __construct() { } diff --git a/vendor/rector/extension-installer/src/PluginInstaller.php b/vendor/rector/extension-installer/src/PluginInstaller.php index 1d778b426f8..d5f73f4f7bd 100644 --- a/vendor/rector/extension-installer/src/PluginInstaller.php +++ b/vendor/rector/extension-installer/src/PluginInstaller.php @@ -13,30 +13,12 @@ use RectorPrefix202411\Composer\Util\Filesystem as ComposerFilesystem; */ final class PluginInstaller { - /** - * @var \Rector\RectorInstaller\Filesystem - */ - private $filesystem; - /** - * @var \Composer\Repository\InstalledRepositoryInterface - */ - private $localRepository; - /** - * @var \Composer\IO\IOInterface - */ - private $io; - /** - * @var \Composer\Installer\InstallationManager - */ - private $installationManager; - /** - * @var ComposerFilesystem - */ - private $composerFilesystem; - /** - * @var string - */ - private $configurationFile; + private \Rector\RectorInstaller\Filesystem $filesystem; + private InstalledRepositoryInterface $localRepository; + private IOInterface $io; + private InstallationManager $installationManager; + private ComposerFilesystem $composerFilesystem; + private string $configurationFile; /** * @var string */ @@ -45,10 +27,7 @@ final class PluginInstaller * @var string */ public const RECTOR_EXTRA_KEY = 'rector'; - /** - * @var string - */ - private static $generatedFileTemplate = <<<'CODE_SAMPLE' + private static string $generatedFileTemplate = <<<'CODE_SAMPLE' nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/SoftDeletableClassAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/SoftDeletableClassAttributeTransformer.php index c8c9f20d31f..69f858eb3a9 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/SoftDeletableClassAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/SoftDeletableClassAttributeTransformer.php @@ -15,9 +15,8 @@ final class SoftDeletableClassAttributeTransformer implements ClassAttributeTran { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/TableClassAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/TableClassAttributeTransformer.php index ba543359c82..e8368e3b7b2 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/TableClassAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/TableClassAttributeTransformer.php @@ -14,9 +14,8 @@ final class TableClassAttributeTransformer implements ClassAttributeTransformerI { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @var string */ diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ColumnAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ColumnAttributeTransformer.php index 2f207b2c106..d72ccaad472 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ColumnAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ColumnAttributeTransformer.php @@ -15,9 +15,8 @@ final class ColumnAttributeTransformer implements PropertyAttributeTransformerIn { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/EmbeddedPropertyAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/EmbeddedPropertyAttributeTransformer.php index 2e2351478f3..07a43ed93c4 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/EmbeddedPropertyAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/EmbeddedPropertyAttributeTransformer.php @@ -15,9 +15,8 @@ final class EmbeddedPropertyAttributeTransformer implements PropertyAttributeTra { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/GedmoTimestampableAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/GedmoTimestampableAttributeTransformer.php index f5b2ca28da1..23f813ea30f 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/GedmoTimestampableAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/GedmoTimestampableAttributeTransformer.php @@ -14,9 +14,8 @@ final class GedmoTimestampableAttributeTransformer implements PropertyAttributeT { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/IdGeneratorAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/IdGeneratorAttributeTransformer.php index bde1fb073ff..a0d1278a2a8 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/IdGeneratorAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/IdGeneratorAttributeTransformer.php @@ -15,9 +15,8 @@ final class IdGeneratorAttributeTransformer implements PropertyAttributeTransfor { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @see https://www.doctrine-project.org/projects/doctrine-orm/en/3.0/reference/basic-mapping.html#identifier-generation-strategies * @var string[] diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/InverseJoinColumnAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/InverseJoinColumnAttributeTransformer.php index 400ee48c7e2..7d259e0e613 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/InverseJoinColumnAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/InverseJoinColumnAttributeTransformer.php @@ -15,9 +15,8 @@ final class InverseJoinColumnAttributeTransformer implements PropertyAttributeTr { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/JoinColumnAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/JoinColumnAttributeTransformer.php index f9a17748fec..1d40f9346f6 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/JoinColumnAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/JoinColumnAttributeTransformer.php @@ -15,9 +15,8 @@ final class JoinColumnAttributeTransformer implements PropertyAttributeTransform { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/JoinTableAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/JoinTableAttributeTransformer.php index b5b7be29841..a3c37b3ac51 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/JoinTableAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/JoinTableAttributeTransformer.php @@ -16,9 +16,8 @@ final class JoinTableAttributeTransformer implements PropertyAttributeTransforme { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ManyToManyAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ManyToManyAttributeTransformer.php index 7bff4a36ec6..509c211b31b 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ManyToManyAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ManyToManyAttributeTransformer.php @@ -16,9 +16,8 @@ final class ManyToManyAttributeTransformer implements PropertyAttributeTransform { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ManyToOneAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ManyToOneAttributeTransformer.php index b094c311d7c..5d0cd79af68 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ManyToOneAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ManyToOneAttributeTransformer.php @@ -16,9 +16,8 @@ final class ManyToOneAttributeTransformer implements PropertyAttributeTransforme { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/OneToManyAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/OneToManyAttributeTransformer.php index 2dadda1a489..a080396832e 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/OneToManyAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/OneToManyAttributeTransformer.php @@ -16,9 +16,8 @@ final class OneToManyAttributeTransformer implements PropertyAttributeTransforme { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/OrderByAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/OrderByAttributeTransformer.php index 3b3f1da038b..f6b63f6c513 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/OrderByAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/OrderByAttributeTransformer.php @@ -15,9 +15,8 @@ final class OrderByAttributeTransformer implements PropertyAttributeTransformerI { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/YamlToAttributeTransformer.php b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/YamlToAttributeTransformer.php index 52bd4c234f8..06904441d49 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/YamlToAttributeTransformer.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/YamlToAttributeTransformer.php @@ -17,12 +17,12 @@ final class YamlToAttributeTransformer * @var ClassAttributeTransformerInterface[] * @readonly */ - private $classAttributeTransformers; + private iterable $classAttributeTransformers; /** * @var PropertyAttributeTransformerInterface[] * @readonly */ - private $propertyAttributeTransformers; + private iterable $propertyAttributeTransformers; /** * @param ClassAttributeTransformerInterface[] $classAttributeTransformers * @param PropertyAttributeTransformerInterface[] $propertyAttributeTransformers diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/EntityMappingResolver.php b/vendor/rector/rector-doctrine/rules/CodeQuality/EntityMappingResolver.php index d10d5c8a83a..3187da0ae72 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/EntityMappingResolver.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/EntityMappingResolver.php @@ -13,13 +13,12 @@ final class EntityMappingResolver { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @var EntityMapping[] */ - private $entityMappings = []; + private array $entityMappings = []; public function __construct(ReflectionProvider $reflectionProvider) { $this->reflectionProvider = $reflectionProvider; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/AddReturnDocBlockToCollectionPropertyGetterByToManyAnnotationRector.php b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/AddReturnDocBlockToCollectionPropertyGetterByToManyAnnotationRector.php index 5b43e625ee2..88842827027 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/AddReturnDocBlockToCollectionPropertyGetterByToManyAnnotationRector.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/AddReturnDocBlockToCollectionPropertyGetterByToManyAnnotationRector.php @@ -25,39 +25,32 @@ final class AddReturnDocBlockToCollectionPropertyGetterByToManyAnnotationRector { /** * @readonly - * @var \Rector\VendorLocker\NodeVendorLocker\ClassMethodReturnTypeOverrideGuard */ - private $classMethodReturnTypeOverrideGuard; + private ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Doctrine\PhpDocParser\DoctrineDocBlockResolver */ - private $doctrineDocBlockResolver; + private DoctrineDocBlockResolver $doctrineDocBlockResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\Doctrine\TypeAnalyzer\CollectionTypeResolver */ - private $collectionTypeResolver; + private CollectionTypeResolver $collectionTypeResolver; /** * @readonly - * @var \Rector\Doctrine\TypeAnalyzer\CollectionTypeFactory */ - private $collectionTypeFactory; + private CollectionTypeFactory $collectionTypeFactory; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\MethodUniqueReturnedPropertyResolver */ - private $methodUniqueReturnedPropertyResolver; + private MethodUniqueReturnedPropertyResolver $methodUniqueReturnedPropertyResolver; public function __construct(ClassMethodReturnTypeOverrideGuard $classMethodReturnTypeOverrideGuard, PhpDocInfoFactory $phpDocInfoFactory, DoctrineDocBlockResolver $doctrineDocBlockResolver, PhpDocTypeChanger $phpDocTypeChanger, CollectionTypeResolver $collectionTypeResolver, CollectionTypeFactory $collectionTypeFactory, MethodUniqueReturnedPropertyResolver $methodUniqueReturnedPropertyResolver) { $this->classMethodReturnTypeOverrideGuard = $classMethodReturnTypeOverrideGuard; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/ExplicitRelationCollectionRector.php b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/ExplicitRelationCollectionRector.php index 72e71846e9d..4238f8d8a26 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/ExplicitRelationCollectionRector.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/ExplicitRelationCollectionRector.php @@ -27,24 +27,20 @@ final class ExplicitRelationCollectionRector extends AbstractRector implements M { /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttrinationFinder */ - private $attrinationFinder; + private AttrinationFinder $attrinationFinder; /** * @readonly - * @var \Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector */ - private $constructorAssignDetector; + private ConstructorAssignDetector $constructorAssignDetector; /** * @readonly - * @var \Rector\Doctrine\NodeFactory\ArrayCollectionAssignFactory */ - private $arrayCollectionAssignFactory; + private ArrayCollectionAssignFactory $arrayCollectionAssignFactory; /** * @readonly - * @var \Rector\NodeManipulator\ClassDependencyManipulator */ - private $classDependencyManipulator; + private ClassDependencyManipulator $classDependencyManipulator; public function __construct(AttrinationFinder $attrinationFinder, ConstructorAssignDetector $constructorAssignDetector, ArrayCollectionAssignFactory $arrayCollectionAssignFactory, ClassDependencyManipulator $classDependencyManipulator) { $this->attrinationFinder = $attrinationFinder; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/MoveCurrentDateTimeDefaultInEntityToConstructorRector.php b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/MoveCurrentDateTimeDefaultInEntityToConstructorRector.php index 0f19aa8fc5c..50e739dd645 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/MoveCurrentDateTimeDefaultInEntityToConstructorRector.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/MoveCurrentDateTimeDefaultInEntityToConstructorRector.php @@ -33,38 +33,29 @@ final class MoveCurrentDateTimeDefaultInEntityToConstructorRector extends Abstra { /** * @readonly - * @var \Rector\Doctrine\NodeManipulator\ConstructorManipulator */ - private $constructorManipulator; + private ConstructorManipulator $constructorManipulator; /** * @readonly - * @var \Rector\Doctrine\NodeFactory\ValueAssignFactory */ - private $valueAssignFactory; + private ValueAssignFactory $valueAssignFactory; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\ConstructorAssignPropertyAnalyzer */ - private $constructorAssignPropertyAnalyzer; + private ConstructorAssignPropertyAnalyzer $constructorAssignPropertyAnalyzer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; - /** - * @var bool - */ - private $hasChanged = \false; + private ValueResolver $valueResolver; + private bool $hasChanged = \false; public function __construct(ConstructorManipulator $constructorManipulator, ValueAssignFactory $valueAssignFactory, ConstructorAssignPropertyAnalyzer $constructorAssignPropertyAnalyzer, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory, ValueResolver $valueResolver) { $this->constructorManipulator = $constructorManipulator; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector.php b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector.php index e553452d900..9d3ae88c812 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector.php @@ -25,18 +25,16 @@ final class YamlToAttributeDoctrineMappingRector extends AbstractRector implemen { /** * @readonly - * @var \Rector\Doctrine\CodeQuality\EntityMappingResolver */ - private $entityMappingResolver; + private EntityMappingResolver $entityMappingResolver; /** * @readonly - * @var \Rector\Doctrine\CodeQuality\AttributeTransformer\YamlToAttributeTransformer */ - private $yamlToAttributeTransformer; + private YamlToAttributeTransformer $yamlToAttributeTransformer; /** * @var string[] */ - private $yamlMappingDirectories = []; + private array $yamlMappingDirectories = []; public function __construct(EntityMappingResolver $entityMappingResolver, YamlToAttributeTransformer $yamlToAttributeTransformer) { $this->entityMappingResolver = $entityMappingResolver; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/CorrectDefaultTypesOnEntityPropertyRector.php b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/CorrectDefaultTypesOnEntityPropertyRector.php index 51651f0f44f..d68726ffee1 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/CorrectDefaultTypesOnEntityPropertyRector.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/CorrectDefaultTypesOnEntityPropertyRector.php @@ -3,16 +3,16 @@ declare (strict_types=1); namespace Rector\Doctrine\CodeQuality\Rector\Property; +use PhpParser\Node\PropertyItem; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\UnaryMinus; use PhpParser\Node\Expr\UnaryPlus; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Property; -use PhpParser\Node\Stmt\PropertyProperty; use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode; use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode; use Rector\BetterPhpDocParser\PhpDoc\StringNode; @@ -30,14 +30,12 @@ final class CorrectDefaultTypesOnEntityPropertyRector extends AbstractRector { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, ValueResolver $valueResolver) { $this->phpDocInfoFactory = $phpDocInfoFactory; @@ -116,14 +114,14 @@ CODE_SAMPLE } return null; } - private function refactorToBoolType(PropertyProperty $propertyProperty, Property $property) : ?Property + private function refactorToBoolType(PropertyItem $propertyItem, Property $property) : ?Property { - if (!$propertyProperty->default instanceof Expr) { + if (!$propertyItem->default instanceof Expr) { return null; } - $defaultExpr = $propertyProperty->default; + $defaultExpr = $propertyItem->default; if ($defaultExpr instanceof String_) { - $propertyProperty->default = (bool) $defaultExpr->value ? $this->nodeFactory->createTrue() : $this->nodeFactory->createFalse(); + $propertyItem->default = (bool) $defaultExpr->value ? $this->nodeFactory->createTrue() : $this->nodeFactory->createFalse(); return $property; } if ($defaultExpr instanceof ConstFetch || $defaultExpr instanceof ClassConstFetch) { @@ -132,17 +130,17 @@ CODE_SAMPLE } throw new NotImplementedYetException(); } - private function refactorToIntType(PropertyProperty $propertyProperty, Property $property) : ?Property + private function refactorToIntType(PropertyItem $propertyItem, Property $property) : ?Property { - if (!$propertyProperty->default instanceof Expr) { + if (!$propertyItem->default instanceof Expr) { return null; } - $defaultExpr = $propertyProperty->default; + $defaultExpr = $propertyItem->default; if ($defaultExpr instanceof String_) { - $propertyProperty->default = new LNumber((int) $defaultExpr->value); + $propertyItem->default = new Int_((int) $defaultExpr->value); return $property; } - if ($defaultExpr instanceof LNumber) { + if ($defaultExpr instanceof Int_) { // already correct return null; } diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector.php b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector.php index 034e5fffca4..3554bedda38 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector.php @@ -33,49 +33,40 @@ final class ImproveDoctrineCollectionDocTypeInEntityRector extends AbstractRecto { /** * @readonly - * @var \Rector\Doctrine\TypeAnalyzer\CollectionTypeFactory */ - private $collectionTypeFactory; + private CollectionTypeFactory $collectionTypeFactory; /** * @readonly - * @var \Rector\Doctrine\TypeAnalyzer\CollectionTypeResolver */ - private $collectionTypeResolver; + private CollectionTypeResolver $collectionTypeResolver; /** * @readonly - * @var \Rector\Doctrine\TypeAnalyzer\CollectionVarTagValueNodeResolver */ - private $collectionVarTagValueNodeResolver; + private CollectionVarTagValueNodeResolver $collectionVarTagValueNodeResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\Doctrine\PhpDocParser\DoctrineDocBlockResolver */ - private $doctrineDocBlockResolver; + private DoctrineDocBlockResolver $doctrineDocBlockResolver; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttributeFinder */ - private $attributeFinder; + private AttributeFinder $attributeFinder; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\TargetEntityResolver */ - private $targetEntityResolver; + private TargetEntityResolver $targetEntityResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Doctrine\CodeQuality\SetterCollectionResolver */ - private $setterCollectionResolver; + private SetterCollectionResolver $setterCollectionResolver; public function __construct(CollectionTypeFactory $collectionTypeFactory, CollectionTypeResolver $collectionTypeResolver, CollectionVarTagValueNodeResolver $collectionVarTagValueNodeResolver, PhpDocTypeChanger $phpDocTypeChanger, DoctrineDocBlockResolver $doctrineDocBlockResolver, AttributeFinder $attributeFinder, TargetEntityResolver $targetEntityResolver, PhpDocInfoFactory $phpDocInfoFactory, SetterCollectionResolver $setterCollectionResolver) { $this->collectionTypeFactory = $collectionTypeFactory; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/MakeEntityDateTimePropertyDateTimeInterfaceRector.php b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/MakeEntityDateTimePropertyDateTimeInterfaceRector.php index 1c12fed9b55..29dbfea6e9f 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/MakeEntityDateTimePropertyDateTimeInterfaceRector.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/MakeEntityDateTimePropertyDateTimeInterfaceRector.php @@ -28,24 +28,20 @@ final class MakeEntityDateTimePropertyDateTimeInterfaceRector extends AbstractRe { /** * @readonly - * @var \Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockClassRenamer */ - private $docBlockClassRenamer; + private DocBlockClassRenamer $docBlockClassRenamer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\DoctrineEntityDetector */ - private $doctrineEntityDetector; + private DoctrineEntityDetector $doctrineEntityDetector; public function __construct(DocBlockClassRenamer $docBlockClassRenamer, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory, DoctrineEntityDetector $doctrineEntityDetector) { $this->docBlockClassRenamer = $docBlockClassRenamer; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromColumnTypeRector.php b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromColumnTypeRector.php index 2f4ebe3f401..7091f22d305 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromColumnTypeRector.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromColumnTypeRector.php @@ -27,29 +27,24 @@ final class TypedPropertyFromColumnTypeRector extends AbstractRector implements { /** * @readonly - * @var \Rector\TypeDeclaration\NodeTypeAnalyzer\PropertyTypeDecorator */ - private $propertyTypeDecorator; + private PropertyTypeDecorator $propertyTypeDecorator; /** * @readonly - * @var \Rector\Doctrine\NodeManipulator\ColumnPropertyTypeResolver */ - private $columnPropertyTypeResolver; + private ColumnPropertyTypeResolver $columnPropertyTypeResolver; /** * @readonly - * @var \Rector\Doctrine\NodeManipulator\NullabilityColumnPropertyTypeResolver */ - private $nullabilityColumnPropertyTypeResolver; + private NullabilityColumnPropertyTypeResolver $nullabilityColumnPropertyTypeResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(PropertyTypeDecorator $propertyTypeDecorator, ColumnPropertyTypeResolver $columnPropertyTypeResolver, NullabilityColumnPropertyTypeResolver $nullabilityColumnPropertyTypeResolver, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper) { $this->propertyTypeDecorator = $propertyTypeDecorator; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromToManyRelationTypeRector.php b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromToManyRelationTypeRector.php index 24afe733aa6..effc4b7fcc9 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromToManyRelationTypeRector.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromToManyRelationTypeRector.php @@ -28,34 +28,28 @@ final class TypedPropertyFromToManyRelationTypeRector extends AbstractRector imp { /** * @readonly - * @var \Rector\TypeDeclaration\NodeTypeAnalyzer\PropertyTypeDecorator */ - private $propertyTypeDecorator; + private PropertyTypeDecorator $propertyTypeDecorator; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\Doctrine\NodeManipulator\ToManyRelationPropertyTypeResolver */ - private $toManyRelationPropertyTypeResolver; + private ToManyRelationPropertyTypeResolver $toManyRelationPropertyTypeResolver; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(PropertyTypeDecorator $propertyTypeDecorator, PhpDocTypeChanger $phpDocTypeChanger, ToManyRelationPropertyTypeResolver $toManyRelationPropertyTypeResolver, PhpVersionProvider $phpVersionProvider, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper) { $this->propertyTypeDecorator = $propertyTypeDecorator; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromToOneRelationTypeRector.php b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromToOneRelationTypeRector.php index 61d01afa6ac..d709034bef0 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromToOneRelationTypeRector.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromToOneRelationTypeRector.php @@ -33,39 +33,30 @@ final class TypedPropertyFromToOneRelationTypeRector extends AbstractRector impl { /** * @readonly - * @var \Rector\TypeDeclaration\NodeTypeAnalyzer\PropertyTypeDecorator */ - private $propertyTypeDecorator; + private PropertyTypeDecorator $propertyTypeDecorator; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\Doctrine\NodeManipulator\ToOneRelationPropertyTypeResolver */ - private $toOneRelationPropertyTypeResolver; + private ToOneRelationPropertyTypeResolver $toOneRelationPropertyTypeResolver; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public const FORCE_NULLABLE = 'force_nullable'; - /** - * @var bool - */ - private $forceNullable = \true; + private bool $forceNullable = \true; public function __construct(PropertyTypeDecorator $propertyTypeDecorator, PhpDocTypeChanger $phpDocTypeChanger, ToOneRelationPropertyTypeResolver $toOneRelationPropertyTypeResolver, PhpVersionProvider $phpVersionProvider, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper) { $this->propertyTypeDecorator = $propertyTypeDecorator; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/SetterCollectionResolver.php b/vendor/rector/rector-doctrine/rules/CodeQuality/SetterCollectionResolver.php index e2b53ad0d2c..103290bb4c1 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/SetterCollectionResolver.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/SetterCollectionResolver.php @@ -25,34 +25,28 @@ final class SetterCollectionResolver { /** * @readonly - * @var \Rector\NodeManipulator\AssignManipulator */ - private $assignManipulator; + private AssignManipulator $assignManipulator; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Doctrine\TypeAnalyzer\CollectionVarTagValueNodeResolver */ - private $collectionVarTagValueNodeResolver; + private CollectionVarTagValueNodeResolver $collectionVarTagValueNodeResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\Doctrine\TypeAnalyzer\CollectionTypeFactory */ - private $collectionTypeFactory; + private CollectionTypeFactory $collectionTypeFactory; public function __construct(AssignManipulator $assignManipulator, ReflectionResolver $reflectionResolver, NodeNameResolver $nodeNameResolver, CollectionVarTagValueNodeResolver $collectionVarTagValueNodeResolver, StaticTypeMapper $staticTypeMapper, CollectionTypeFactory $collectionTypeFactory) { $this->assignManipulator = $assignManipulator; diff --git a/vendor/rector/rector-doctrine/rules/CodeQuality/ValueObject/EntityMapping.php b/vendor/rector/rector-doctrine/rules/CodeQuality/ValueObject/EntityMapping.php index c12ba077912..535e5675509 100644 --- a/vendor/rector/rector-doctrine/rules/CodeQuality/ValueObject/EntityMapping.php +++ b/vendor/rector/rector-doctrine/rules/CodeQuality/ValueObject/EntityMapping.php @@ -12,13 +12,12 @@ final class EntityMapping { /** * @readonly - * @var string */ - private $className; + private string $className; /** * @var array */ - private $entityMapping; + private array $entityMapping; /** * @param array $propertyMapping */ diff --git a/vendor/rector/rector-doctrine/rules/Collection22/Rector/CriteriaOrderingConstantsDeprecationRector.php b/vendor/rector/rector-doctrine/rules/Collection22/Rector/CriteriaOrderingConstantsDeprecationRector.php index 14ceb855802..c70b56bcfdc 100644 --- a/vendor/rector/rector-doctrine/rules/Collection22/Rector/CriteriaOrderingConstantsDeprecationRector.php +++ b/vendor/rector/rector-doctrine/rules/Collection22/Rector/CriteriaOrderingConstantsDeprecationRector.php @@ -3,11 +3,11 @@ declare (strict_types=1); namespace Rector\Doctrine\Collection22\Rector; +use PhpParser\Node\ArrayItem; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Identifier; @@ -24,9 +24,8 @@ final class CriteriaOrderingConstantsDeprecationRector extends AbstractRector { /** * @readonly - * @var \PHPStan\Type\ObjectType */ - private $criteriaObjectType; + private ObjectType $criteriaObjectType; public function __construct() { $this->criteriaObjectType = new ObjectType('Doctrine\\Common\\Collections\\Criteria'); diff --git a/vendor/rector/rector-doctrine/rules/Dbal211/Rector/MethodCall/ExtractArrayArgOnQueryBuilderSelectRector.php b/vendor/rector/rector-doctrine/rules/Dbal211/Rector/MethodCall/ExtractArrayArgOnQueryBuilderSelectRector.php index 970f08bb19f..e769a160af0 100644 --- a/vendor/rector/rector-doctrine/rules/Dbal211/Rector/MethodCall/ExtractArrayArgOnQueryBuilderSelectRector.php +++ b/vendor/rector/rector-doctrine/rules/Dbal211/Rector/MethodCall/ExtractArrayArgOnQueryBuilderSelectRector.php @@ -3,10 +3,10 @@ declare (strict_types=1); namespace Rector\Doctrine\Dbal211\Rector\MethodCall; +use PhpParser\Node\ArrayItem; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PHPStan\Type\ObjectType; use Rector\Rector\AbstractRector; @@ -74,7 +74,7 @@ CODE_SAMPLE if (!$value instanceof ArrayItem) { return null; } - $newArgs[] = new Arg($value); + $newArgs[] = new Arg($value->value); } $node->args = $newArgs; return $node; diff --git a/vendor/rector/rector-doctrine/rules/Dbal40/Rector/MethodCall/ChangeCompositeExpressionAddMultipleWithWithRector.php b/vendor/rector/rector-doctrine/rules/Dbal40/Rector/MethodCall/ChangeCompositeExpressionAddMultipleWithWithRector.php index 0a5babe9a63..80b4ecf12c7 100644 --- a/vendor/rector/rector-doctrine/rules/Dbal40/Rector/MethodCall/ChangeCompositeExpressionAddMultipleWithWithRector.php +++ b/vendor/rector/rector-doctrine/rules/Dbal40/Rector/MethodCall/ChangeCompositeExpressionAddMultipleWithWithRector.php @@ -4,7 +4,6 @@ declare (strict_types=1); namespace Rector\Doctrine\Dbal40\Rector\MethodCall; use PhpParser\Node; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Identifier; use PHPStan\Type\ObjectType; @@ -70,7 +69,7 @@ CODE_SAMPLE } $node->name = new Identifier('with'); $firstArg = $node->getArgs()[0]; - $firstArg->value = new ArrayItem($firstArg->value, null, \false, [], \true); + $firstArg->unpack = \true; return $node; } } diff --git a/vendor/rector/rector-doctrine/rules/Orm28/Rector/MethodCall/IterateToToIterableRector.php b/vendor/rector/rector-doctrine/rules/Orm28/Rector/MethodCall/IterateToToIterableRector.php index 1c40f858dd0..2c50e7b0a1d 100644 --- a/vendor/rector/rector-doctrine/rules/Orm28/Rector/MethodCall/IterateToToIterableRector.php +++ b/vendor/rector/rector-doctrine/rules/Orm28/Rector/MethodCall/IterateToToIterableRector.php @@ -119,9 +119,6 @@ CODE_SAMPLE if (!$node instanceof ArrayDimFetch) { return null; } - if (!$node->var instanceof Expr) { - return null; - } if (!$this->isName($node->var, $itemName)) { return null; } diff --git a/vendor/rector/rector-doctrine/src/NodeAnalyzer/AttributeFinder.php b/vendor/rector/rector-doctrine/src/NodeAnalyzer/AttributeFinder.php index b5cb7fe079a..3bd4f088fad 100644 --- a/vendor/rector/rector-doctrine/src/NodeAnalyzer/AttributeFinder.php +++ b/vendor/rector/rector-doctrine/src/NodeAnalyzer/AttributeFinder.php @@ -21,9 +21,8 @@ final class AttributeFinder { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-doctrine/src/NodeAnalyzer/AttrinationFinder.php b/vendor/rector/rector-doctrine/src/NodeAnalyzer/AttrinationFinder.php index 9961bf5bc6f..f11789ac1b8 100644 --- a/vendor/rector/rector-doctrine/src/NodeAnalyzer/AttrinationFinder.php +++ b/vendor/rector/rector-doctrine/src/NodeAnalyzer/AttrinationFinder.php @@ -18,14 +18,12 @@ final class AttrinationFinder { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttributeFinder */ - private $attributeFinder; + private \Rector\Doctrine\NodeAnalyzer\AttributeFinder $attributeFinder; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, \Rector\Doctrine\NodeAnalyzer\AttributeFinder $attributeFinder) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/vendor/rector/rector-doctrine/src/NodeAnalyzer/ConstructorAssignPropertyAnalyzer.php b/vendor/rector/rector-doctrine/src/NodeAnalyzer/ConstructorAssignPropertyAnalyzer.php index dcdf7aa2903..b11f6869fd5 100644 --- a/vendor/rector/rector-doctrine/src/NodeAnalyzer/ConstructorAssignPropertyAnalyzer.php +++ b/vendor/rector/rector-doctrine/src/NodeAnalyzer/ConstructorAssignPropertyAnalyzer.php @@ -16,19 +16,16 @@ final class ConstructorAssignPropertyAnalyzer { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\PropertyFetchAnalyzer */ - private $propertyFetchAnalyzer; + private PropertyFetchAnalyzer $propertyFetchAnalyzer; public function __construct(BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver, PropertyFetchAnalyzer $propertyFetchAnalyzer) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/vendor/rector/rector-doctrine/src/NodeAnalyzer/DoctrineEntityDetector.php b/vendor/rector/rector-doctrine/src/NodeAnalyzer/DoctrineEntityDetector.php index 4dd262e4d57..1a7b43bb302 100644 --- a/vendor/rector/rector-doctrine/src/NodeAnalyzer/DoctrineEntityDetector.php +++ b/vendor/rector/rector-doctrine/src/NodeAnalyzer/DoctrineEntityDetector.php @@ -11,14 +11,12 @@ final class DoctrineEntityDetector { /** * @readonly - * @var \Rector\NodeAnalyzer\DoctrineEntityAnalyzer */ - private $doctrineEntityAnalyzer; + private DoctrineEntityAnalyzer $doctrineEntityAnalyzer; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(DoctrineEntityAnalyzer $doctrineEntityAnalyzer, ReflectionProvider $reflectionProvider) { $this->doctrineEntityAnalyzer = $doctrineEntityAnalyzer; diff --git a/vendor/rector/rector-doctrine/src/NodeAnalyzer/MethodUniqueReturnedPropertyResolver.php b/vendor/rector/rector-doctrine/src/NodeAnalyzer/MethodUniqueReturnedPropertyResolver.php index 94676afe699..03f90b59505 100644 --- a/vendor/rector/rector-doctrine/src/NodeAnalyzer/MethodUniqueReturnedPropertyResolver.php +++ b/vendor/rector/rector-doctrine/src/NodeAnalyzer/MethodUniqueReturnedPropertyResolver.php @@ -14,14 +14,12 @@ final class MethodUniqueReturnedPropertyResolver { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/vendor/rector/rector-doctrine/src/NodeAnalyzer/TargetEntityResolver.php b/vendor/rector/rector-doctrine/src/NodeAnalyzer/TargetEntityResolver.php index f507d43fb1e..2c3b8d18ce4 100644 --- a/vendor/rector/rector-doctrine/src/NodeAnalyzer/TargetEntityResolver.php +++ b/vendor/rector/rector-doctrine/src/NodeAnalyzer/TargetEntityResolver.php @@ -16,14 +16,12 @@ final class TargetEntityResolver { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-doctrine/src/NodeFactory/ArrayCollectionAssignFactory.php b/vendor/rector/rector-doctrine/src/NodeFactory/ArrayCollectionAssignFactory.php index 1691f99060d..3354e8f3450 100644 --- a/vendor/rector/rector-doctrine/src/NodeFactory/ArrayCollectionAssignFactory.php +++ b/vendor/rector/rector-doctrine/src/NodeFactory/ArrayCollectionAssignFactory.php @@ -12,9 +12,8 @@ final class ArrayCollectionAssignFactory { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/src/NodeManipulator/ColumnPropertyTypeResolver.php b/vendor/rector/rector-doctrine/src/NodeManipulator/ColumnPropertyTypeResolver.php index 33d813cc9f0..70d988b6ee3 100644 --- a/vendor/rector/rector-doctrine/src/NodeManipulator/ColumnPropertyTypeResolver.php +++ b/vendor/rector/rector-doctrine/src/NodeManipulator/ColumnPropertyTypeResolver.php @@ -25,24 +25,21 @@ final class ColumnPropertyTypeResolver { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttributeFinder */ - private $attributeFinder; + private AttributeFinder $attributeFinder; /** * @var array * @readonly */ - private $doctrineTypeToScalarType; + private array $doctrineTypeToScalarType; /** * @var string */ @@ -53,7 +50,7 @@ final class ColumnPropertyTypeResolver */ public function __construct(PhpDocInfoFactory $phpDocInfoFactory, TypeFactory $typeFactory, AttributeFinder $attributeFinder, array $doctrineTypeToScalarType = null) { - $doctrineTypeToScalarType = $doctrineTypeToScalarType ?? [ + $doctrineTypeToScalarType ??= [ 'tinyint' => new BooleanType(), 'boolean' => new BooleanType(), // integers diff --git a/vendor/rector/rector-doctrine/src/NodeManipulator/ConstructorManipulator.php b/vendor/rector/rector-doctrine/src/NodeManipulator/ConstructorManipulator.php index 162805a86e2..509d0a08cc0 100644 --- a/vendor/rector/rector-doctrine/src/NodeManipulator/ConstructorManipulator.php +++ b/vendor/rector/rector-doctrine/src/NodeManipulator/ConstructorManipulator.php @@ -14,14 +14,12 @@ final class ConstructorManipulator { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \Rector\NodeManipulator\ClassInsertManipulator */ - private $classInsertManipulator; + private ClassInsertManipulator $classInsertManipulator; public function __construct(NodeFactory $nodeFactory, ClassInsertManipulator $classInsertManipulator) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-doctrine/src/NodeManipulator/NullabilityColumnPropertyTypeResolver.php b/vendor/rector/rector-doctrine/src/NodeManipulator/NullabilityColumnPropertyTypeResolver.php index b839fcdb500..9e6d2c195e3 100644 --- a/vendor/rector/rector-doctrine/src/NodeManipulator/NullabilityColumnPropertyTypeResolver.php +++ b/vendor/rector/rector-doctrine/src/NodeManipulator/NullabilityColumnPropertyTypeResolver.php @@ -17,19 +17,16 @@ final class NullabilityColumnPropertyTypeResolver { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttributeFinder */ - private $attributeFinder; + private AttributeFinder $attributeFinder; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var string */ diff --git a/vendor/rector/rector-doctrine/src/NodeManipulator/ToManyRelationPropertyTypeResolver.php b/vendor/rector/rector-doctrine/src/NodeManipulator/ToManyRelationPropertyTypeResolver.php index 968d9ed3858..e42917340ff 100644 --- a/vendor/rector/rector-doctrine/src/NodeManipulator/ToManyRelationPropertyTypeResolver.php +++ b/vendor/rector/rector-doctrine/src/NodeManipulator/ToManyRelationPropertyTypeResolver.php @@ -24,29 +24,24 @@ final class ToManyRelationPropertyTypeResolver { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Doctrine\PhpDoc\ShortClassExpander */ - private $shortClassExpander; + private ShortClassExpander $shortClassExpander; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttributeFinder */ - private $attributeFinder; + private AttributeFinder $attributeFinder; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\Doctrine\TypeAnalyzer\CollectionTypeFactory */ - private $collectionTypeFactory; + private CollectionTypeFactory $collectionTypeFactory; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, ShortClassExpander $shortClassExpander, AttributeFinder $attributeFinder, ValueResolver $valueResolver, CollectionTypeFactory $collectionTypeFactory) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/vendor/rector/rector-doctrine/src/NodeManipulator/ToOneRelationPropertyTypeResolver.php b/vendor/rector/rector-doctrine/src/NodeManipulator/ToOneRelationPropertyTypeResolver.php index a91e068921c..2ddbd227dee 100644 --- a/vendor/rector/rector-doctrine/src/NodeManipulator/ToOneRelationPropertyTypeResolver.php +++ b/vendor/rector/rector-doctrine/src/NodeManipulator/ToOneRelationPropertyTypeResolver.php @@ -27,29 +27,24 @@ final class ToOneRelationPropertyTypeResolver { /** * @readonly - * @var \Rector\NodeTypeResolver\PHPStan\Type\TypeFactory */ - private $typeFactory; + private TypeFactory $typeFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocParser\ClassAnnotationMatcher */ - private $classAnnotationMatcher; + private ClassAnnotationMatcher $classAnnotationMatcher; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttributeFinder */ - private $attributeFinder; + private AttributeFinder $attributeFinder; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\TargetEntityResolver */ - private $targetEntityResolver; + private TargetEntityResolver $targetEntityResolver; private const JOIN_COLUMN = ['Doctrine\\ORM\\Mapping\\JoinColumn', 'Doctrine\\ORM\\Mapping\\Column']; public function __construct(TypeFactory $typeFactory, PhpDocInfoFactory $phpDocInfoFactory, ClassAnnotationMatcher $classAnnotationMatcher, AttributeFinder $attributeFinder, TargetEntityResolver $targetEntityResolver) { diff --git a/vendor/rector/rector-doctrine/src/PhpDoc/ShortClassExpander.php b/vendor/rector/rector-doctrine/src/PhpDoc/ShortClassExpander.php index e34a3ea2f46..f622c0ad3f7 100644 --- a/vendor/rector/rector-doctrine/src/PhpDoc/ShortClassExpander.php +++ b/vendor/rector/rector-doctrine/src/PhpDoc/ShortClassExpander.php @@ -15,14 +15,12 @@ final class ShortClassExpander { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier */ - private $objectTypeSpecifier; + private ObjectTypeSpecifier $objectTypeSpecifier; /** * @var string * @see https://regex101.com/r/548EJJ/1 diff --git a/vendor/rector/rector-doctrine/src/PhpDocParser/DoctrineDocBlockResolver.php b/vendor/rector/rector-doctrine/src/PhpDocParser/DoctrineDocBlockResolver.php index 70ee5c86e4a..05126cf9098 100644 --- a/vendor/rector/rector-doctrine/src/PhpDocParser/DoctrineDocBlockResolver.php +++ b/vendor/rector/rector-doctrine/src/PhpDocParser/DoctrineDocBlockResolver.php @@ -11,9 +11,8 @@ final class DoctrineDocBlockResolver { /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttrinationFinder */ - private $attrinationFinder; + private AttrinationFinder $attrinationFinder; public function __construct(AttrinationFinder $attrinationFinder) { $this->attrinationFinder = $attrinationFinder; diff --git a/vendor/rector/rector-doctrine/src/Set/SetProvider/DoctrineSetProvider.php b/vendor/rector/rector-doctrine/src/Set/SetProvider/DoctrineSetProvider.php index e91255821f5..b8ad77e1c1c 100644 --- a/vendor/rector/rector-doctrine/src/Set/SetProvider/DoctrineSetProvider.php +++ b/vendor/rector/rector-doctrine/src/Set/SetProvider/DoctrineSetProvider.php @@ -18,6 +18,22 @@ final class DoctrineSetProvider implements SetProviderInterface */ public function provide() : array { - return [new Set(SetGroup::DOCTRINE, 'Code Quality', __DIR__ . '/../../../config/sets/doctrine-code-quality.php'), new Set(SetGroup::DOCTRINE, 'Typed Collections', __DIR__ . '/../../../config/sets/typed-collections.php'), new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/common', '2.0', __DIR__ . '/../../../config/sets/doctrine-common-20.php'), new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/collection', '2.2', __DIR__ . '/../../../config/sets/doctrine-collection-22.php'), new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/doctrine-bundle', '2.10', __DIR__ . '/../../../config/sets/doctrine-bundle-210.php'), new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/dbal', '3.0', __DIR__ . '/../../../config/sets/doctrine-dbal-30.php'), new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/dbal', '4.0', __DIR__ . '/../../../config/sets/doctrine-dbal-40.php'), new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/dbal', '2.11', __DIR__ . '/../../../config/sets/doctrine-dbal-211.php'), new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/orm', '2.5', __DIR__ . '/../../../config/sets/doctrine-orm-25.php'), new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/orm', '2.13', __DIR__ . '/../../../config/sets/doctrine-orm-213.php'), new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/orm', '2.14', __DIR__ . '/../../../config/sets/doctrine-orm-214.php'), new Set(SetGroup::ATTRIBUTES, 'Doctrine ORM', __DIR__ . '/../../../config/sets/attributes/doctrine.php'), new Set(SetGroup::ATTRIBUTES, 'Gedmo', __DIR__ . '/../../../config/sets/attributes/gedmo.php'), new Set(SetGroup::ATTRIBUTES, 'MongoDB', __DIR__ . '/../../../config/sets/attributes/mongodb.php')]; + return [ + new Set(SetGroup::DOCTRINE, 'Code Quality', __DIR__ . '/../../../config/sets/doctrine-code-quality.php'), + new Set(SetGroup::DOCTRINE, 'Typed Collections', __DIR__ . '/../../../config/sets/typed-collections.php'), + // @see https://github.com/rectorphp/getrector-com/pull/2672 + new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/common', '2.0', __DIR__ . '/../../../config/sets/doctrine-common-20.php'), + new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/collection', '2.2', __DIR__ . '/../../../config/sets/doctrine-collection-22.php'), + new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/doctrine-bundle', '2.10', __DIR__ . '/../../../config/sets/doctrine-bundle-210.php'), + new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/dbal', '3.0', __DIR__ . '/../../../config/sets/doctrine-dbal-30.php'), + new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/dbal', '4.0', __DIR__ . '/../../../config/sets/doctrine-dbal-40.php'), + new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/dbal', '2.11', __DIR__ . '/../../../config/sets/doctrine-dbal-211.php'), + new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/orm', '2.5', __DIR__ . '/../../../config/sets/doctrine-orm-25.php'), + new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/orm', '2.13', __DIR__ . '/../../../config/sets/doctrine-orm-213.php'), + new ComposerTriggeredSet(SetGroup::DOCTRINE, 'doctrine/orm', '2.14', __DIR__ . '/../../../config/sets/doctrine-orm-214.php'), + new Set(SetGroup::ATTRIBUTES, 'Doctrine ORM', __DIR__ . '/../../../config/sets/attributes/doctrine.php'), + new Set(SetGroup::ATTRIBUTES, 'Gedmo', __DIR__ . '/../../../config/sets/attributes/gedmo.php'), + new Set(SetGroup::ATTRIBUTES, 'MongoDB', __DIR__ . '/../../../config/sets/attributes/mongodb.php'), + ]; } } diff --git a/vendor/rector/rector-doctrine/src/TypeAnalyzer/CollectionTypeResolver.php b/vendor/rector/rector-doctrine/src/TypeAnalyzer/CollectionTypeResolver.php index 42c1df16126..ec592966045 100644 --- a/vendor/rector/rector-doctrine/src/TypeAnalyzer/CollectionTypeResolver.php +++ b/vendor/rector/rector-doctrine/src/TypeAnalyzer/CollectionTypeResolver.php @@ -29,24 +29,20 @@ final class CollectionTypeResolver { /** * @readonly - * @var \Rector\StaticTypeMapper\Naming\NameScopeFactory */ - private $nameScopeFactory; + private NameScopeFactory $nameScopeFactory; /** * @readonly - * @var \Rector\Doctrine\PhpDoc\ShortClassExpander */ - private $shortClassExpander; + private ShortClassExpander $shortClassExpander; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttrinationFinder */ - private $attrinationFinder; + private AttrinationFinder $attrinationFinder; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\TargetEntityResolver */ - private $targetEntityResolver; + private TargetEntityResolver $targetEntityResolver; /** * @var string */ diff --git a/vendor/rector/rector-doctrine/src/TypeAnalyzer/CollectionVarTagValueNodeResolver.php b/vendor/rector/rector-doctrine/src/TypeAnalyzer/CollectionVarTagValueNodeResolver.php index b9fe2a97d23..9ec8ec5e6b0 100644 --- a/vendor/rector/rector-doctrine/src/TypeAnalyzer/CollectionVarTagValueNodeResolver.php +++ b/vendor/rector/rector-doctrine/src/TypeAnalyzer/CollectionVarTagValueNodeResolver.php @@ -13,14 +13,12 @@ final class CollectionVarTagValueNodeResolver { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttributeFinder */ - private $attributeFinder; + private AttributeFinder $attributeFinder; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, AttributeFinder $attributeFinder) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/vendor/rector/rector-downgrade-php/composer.json b/vendor/rector/rector-downgrade-php/composer.json index e0f3cfca1c2..e39af046fd1 100644 --- a/vendor/rector/rector-downgrade-php/composer.json +++ b/vendor/rector/rector-downgrade-php/composer.json @@ -8,14 +8,11 @@ }, "require-dev": { "phpstan\/extension-installer": "^1.3", - "phpstan\/phpstan": "^1.10", - "phpstan\/phpstan-webmozart-assert": "^1.2", + "phpstan\/phpstan": "^2.0", + "phpstan\/phpstan-webmozart-assert": "^2.0", "phpunit\/phpunit": "^10.5", "rector\/rector-src": "dev-main", - "rector\/type-perfect": "^1.0", "symplify\/easy-coding-standard": "^12.3", - "symplify\/phpstan-extensions": "^11.4", - "symplify\/phpstan-rules": "^13.0", "symplify\/rule-doc-generator": "^12.2", "symplify\/vendor-patches": "^11.3", "tomasvotruba\/class-leak": "^1.0", @@ -41,7 +38,7 @@ ] }, "scripts": { - "phpstan": "vendor\/bin\/phpstan analyse --ansi --error-format symplify", + "phpstan": "vendor\/bin\/phpstan analyse --ansi", "check-cs": "vendor\/bin\/ecs check --ansi", "fix-cs": "vendor\/bin\/ecs check --fix --ansi" }, diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeAnalyzer/BuiltInMethodAnalyzer.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeAnalyzer/BuiltInMethodAnalyzer.php index 9bd8d5aefbc..50f6fc69210 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeAnalyzer/BuiltInMethodAnalyzer.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeAnalyzer/BuiltInMethodAnalyzer.php @@ -10,9 +10,8 @@ final class BuiltInMethodAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeAnalyzer/OverrideFromAnonymousClassMethodAnalyzer.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeAnalyzer/OverrideFromAnonymousClassMethodAnalyzer.php index 74a60c3009c..3f332ac9225 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeAnalyzer/OverrideFromAnonymousClassMethodAnalyzer.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeAnalyzer/OverrideFromAnonymousClassMethodAnalyzer.php @@ -18,19 +18,16 @@ final class OverrideFromAnonymousClassMethodAnalyzer { /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(ClassAnalyzer $classAnalyzer, NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider) { $this->classAnalyzer = $classAnalyzer; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeAnalyzer/RegexFuncAnalyzer.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeAnalyzer/RegexFuncAnalyzer.php index 31bce28690e..0e9459c507e 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeAnalyzer/RegexFuncAnalyzer.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeAnalyzer/RegexFuncAnalyzer.php @@ -12,9 +12,8 @@ final class RegexFuncAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @var string[] */ diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeManipulator/BitwiseFlagCleaner.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeManipulator/BitwiseFlagCleaner.php index 4addd80cfc4..7a47caea4d2 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeManipulator/BitwiseFlagCleaner.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeManipulator/BitwiseFlagCleaner.php @@ -13,9 +13,8 @@ final class BitwiseFlagCleaner { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeManipulator/JsonConstCleaner.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeManipulator/JsonConstCleaner.php index bb226f57c31..c76dc117583 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeManipulator/JsonConstCleaner.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/NodeManipulator/JsonConstCleaner.php @@ -7,7 +7,7 @@ use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\BinaryOp\BitwiseOr; use PhpParser\Node\Expr\ConstFetch; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use Rector\Enum\JsonConstant; use Rector\NodeNameResolver\NodeNameResolver; use Rector\NodeTypeResolver\Node\AttributeKey; @@ -15,9 +15,8 @@ final class JsonConstCleaner { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; @@ -36,16 +35,16 @@ final class JsonConstCleaner /** * @param array $constants */ - private function cleanByConstFetch(ConstFetch $constFetch, array $constants) : ?LNumber + private function cleanByConstFetch(ConstFetch $constFetch, array $constants) : ?Int_ { if (!$this->nodeNameResolver->isNames($constFetch, $constants)) { return null; } - return new LNumber(0); + return new Int_(0); } /** * @param array $constants - * @return null|\PhpParser\Node\Expr|\PhpParser\Node\Scalar\LNumber + * @return null|\PhpParser\Node\Expr|\PhpParser\Node\Scalar\Int_ */ private function cleanByBitwiseOr(BitwiseOr $bitwiseOr, array $constants) { @@ -60,7 +59,7 @@ final class JsonConstCleaner if (!$isRightTransformed) { return $bitwiseOr->right; } - return new LNumber(0); + return new Int_(0); } /** * @param string[] $constants diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/PhpDoc/NativeParamToPhpDocDecorator.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/PhpDoc/NativeParamToPhpDocDecorator.php index 6275621c70b..6a57b73e131 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/PhpDoc/NativeParamToPhpDocDecorator.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/PhpDoc/NativeParamToPhpDocDecorator.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\DowngradePhp72\PhpDoc; +use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Param; use PhpParser\Node\Stmt\ClassMethod; @@ -18,29 +19,24 @@ final class NativeParamToPhpDocDecorator { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, NodeNameResolver $nodeNameResolver, StaticTypeMapper $staticTypeMapper, PhpDocTypeChanger $phpDocTypeChanger, ValueResolver $valueResolver) { $this->phpDocInfoFactory = $phpDocInfoFactory; @@ -51,7 +47,7 @@ final class NativeParamToPhpDocDecorator } public function decorate(ClassMethod $classMethod, Param $param) : void { - if ($param->type === null) { + if (!$param->type instanceof Node) { return; } $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($classMethod); diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/ClassMethod/DowngradeParameterTypeWideningRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/ClassMethod/DowngradeParameterTypeWideningRector.php index 22cb6b751e6..f23fd0e6024 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/ClassMethod/DowngradeParameterTypeWideningRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/ClassMethod/DowngradeParameterTypeWideningRector.php @@ -29,38 +29,32 @@ final class DowngradeParameterTypeWideningRector extends AbstractRector implemen { /** * @readonly - * @var \Rector\DowngradePhp72\PhpDoc\NativeParamToPhpDocDecorator */ - private $nativeParamToPhpDocDecorator; + private NativeParamToPhpDocDecorator $nativeParamToPhpDocDecorator; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\AutowiredClassMethodOrPropertyAnalyzer */ - private $autowiredClassMethodOrPropertyAnalyzer; + private AutowiredClassMethodOrPropertyAnalyzer $autowiredClassMethodOrPropertyAnalyzer; /** * @readonly - * @var \Rector\DowngradePhp72\NodeAnalyzer\BuiltInMethodAnalyzer */ - private $builtInMethodAnalyzer; + private BuiltInMethodAnalyzer $builtInMethodAnalyzer; /** * @readonly - * @var \Rector\DowngradePhp72\NodeAnalyzer\OverrideFromAnonymousClassMethodAnalyzer */ - private $overrideFromAnonymousClassMethodAnalyzer; + private OverrideFromAnonymousClassMethodAnalyzer $overrideFromAnonymousClassMethodAnalyzer; /** * @readonly - * @var \Rector\DowngradePhp72\NodeAnalyzer\SealedClassAnalyzer */ - private $sealedClassAnalyzer; + private SealedClassAnalyzer $sealedClassAnalyzer; /** * @var array */ - private $unsafeTypesToMethods = []; + private array $unsafeTypesToMethods = []; public function __construct(NativeParamToPhpDocDecorator $nativeParamToPhpDocDecorator, ReflectionResolver $reflectionResolver, AutowiredClassMethodOrPropertyAnalyzer $autowiredClassMethodOrPropertyAnalyzer, BuiltInMethodAnalyzer $builtInMethodAnalyzer, OverrideFromAnonymousClassMethodAnalyzer $overrideFromAnonymousClassMethodAnalyzer, SealedClassAnalyzer $sealedClassAnalyzer) { $this->nativeParamToPhpDocDecorator = $nativeParamToPhpDocDecorator; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/ConstFetch/DowngradePhp72JsonConstRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/ConstFetch/DowngradePhp72JsonConstRector.php index aa5461f805f..321776cd0c7 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/ConstFetch/DowngradePhp72JsonConstRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/ConstFetch/DowngradePhp72JsonConstRector.php @@ -23,14 +23,12 @@ final class DowngradePhp72JsonConstRector extends AbstractRector { /** * @readonly - * @var \Rector\DowngradePhp72\NodeManipulator\JsonConstCleaner */ - private $jsonConstCleaner; + private JsonConstCleaner $jsonConstCleaner; /** * @readonly - * @var \Rector\NodeAnalyzer\DefineFuncCallAnalyzer */ - private $defineFuncCallAnalyzer; + private DefineFuncCallAnalyzer $defineFuncCallAnalyzer; /** * @var string */ @@ -63,7 +61,7 @@ CODE_SAMPLE } /** * @param ConstFetch|BitwiseOr|If_ $node - * @return \PhpParser\Node\Expr|\PhpParser\Node\Stmt\If_|null|int + * @return \PhpParser\Node\Expr|\PhpParser\Node\Stmt\If_|null */ public function refactor(Node $node) { diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FuncCall/DowngradeJsonDecodeNullAssociativeArgRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FuncCall/DowngradeJsonDecodeNullAssociativeArgRector.php index f0d6c17cc83..938f7677c26 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FuncCall/DowngradeJsonDecodeNullAssociativeArgRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FuncCall/DowngradeJsonDecodeNullAssociativeArgRector.php @@ -24,14 +24,12 @@ final class DowngradeJsonDecodeNullAssociativeArgRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\ArgsAnalyzer */ - private $argsAnalyzer; + private ArgsAnalyzer $argsAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ArgsAnalyzer $argsAnalyzer, ValueResolver $valueResolver) { $this->argsAnalyzer = $argsAnalyzer; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FuncCall/DowngradePregUnmatchedAsNullConstantRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FuncCall/DowngradePregUnmatchedAsNullConstantRector.php index c2b745e02e6..d1038aa0361 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FuncCall/DowngradePregUnmatchedAsNullConstantRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FuncCall/DowngradePregUnmatchedAsNullConstantRector.php @@ -13,7 +13,7 @@ use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Param; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\ClassConst; @@ -32,19 +32,16 @@ final class DowngradePregUnmatchedAsNullConstantRector extends AbstractRector { /** * @readonly - * @var \Rector\DowngradePhp72\NodeManipulator\BitwiseFlagCleaner */ - private $bitwiseFlagCleaner; + private BitwiseFlagCleaner $bitwiseFlagCleaner; /** * @readonly - * @var \Rector\DowngradePhp72\NodeAnalyzer\RegexFuncAnalyzer */ - private $regexFuncAnalyzer; + private RegexFuncAnalyzer $regexFuncAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @see https://www.php.net/manual/en/function.preg-match.php * @var string @@ -138,7 +135,7 @@ CODE_SAMPLE if (!$this->isName($singleClassConst->value, self::UNMATCHED_NULL_FLAG)) { continue; } - $classConst->consts[$key]->value = new LNumber(512); + $classConst->consts[$key]->value = new Int_(512); return $classConst; } return null; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FuncCall/DowngradeStreamIsattyRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FuncCall/DowngradeStreamIsattyRector.php index 0b42653b9bf..523018358d1 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FuncCall/DowngradeStreamIsattyRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FuncCall/DowngradeStreamIsattyRector.php @@ -32,23 +32,17 @@ final class DowngradeStreamIsattyRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Parser\InlineCodeParser */ - private $inlineCodeParser; + private InlineCodeParser $inlineCodeParser; /** * @readonly - * @var \Rector\Naming\Naming\VariableNaming */ - private $variableNaming; + private VariableNaming $variableNaming; /** * @readonly - * @var \Rector\NodeAnalyzer\ExprInTopStmtMatcher */ - private $exprInTopStmtMatcher; - /** - * @var \PhpParser\Node\Expr\Closure|null - */ - private $cachedClosure; + private ExprInTopStmtMatcher $exprInTopStmtMatcher; + private ?Closure $cachedClosure = null; public function __construct(InlineCodeParser $inlineCodeParser, VariableNaming $variableNaming, ExprInTopStmtMatcher $exprInTopStmtMatcher) { $this->inlineCodeParser = $inlineCodeParser; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FunctionLike/DowngradeObjectTypeDeclarationRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FunctionLike/DowngradeObjectTypeDeclarationRector.php index 5f6537374f0..0facf564471 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FunctionLike/DowngradeObjectTypeDeclarationRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp72/Rector/FunctionLike/DowngradeObjectTypeDeclarationRector.php @@ -19,9 +19,8 @@ final class DowngradeObjectTypeDeclarationRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpDocDecorator\PhpDocFromTypeDeclarationDecorator */ - private $phpDocFromTypeDeclarationDecorator; + private PhpDocFromTypeDeclarationDecorator $phpDocFromTypeDeclarationDecorator; public function __construct(PhpDocFromTypeDeclarationDecorator $phpDocFromTypeDeclarationDecorator) { $this->phpDocFromTypeDeclarationDecorator = $phpDocFromTypeDeclarationDecorator; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/ConstFetch/DowngradePhp73JsonConstRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/ConstFetch/DowngradePhp73JsonConstRector.php index f83f670a847..e7cfa59579a 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/ConstFetch/DowngradePhp73JsonConstRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/ConstFetch/DowngradePhp73JsonConstRector.php @@ -13,16 +13,16 @@ use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\New_; +use PhpParser\Node\Expr\Throw_; use PhpParser\Node\Name; use PhpParser\Node\Name\FullyQualified as NameFullyQualified; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\If_; -use PhpParser\Node\Stmt\Throw_; use PhpParser\Node\Stmt\TryCatch; use PhpParser\Node\VariadicPlaceholder; -use PhpParser\NodeTraverser; +use PhpParser\NodeVisitor; use Rector\DowngradePhp72\NodeManipulator\JsonConstCleaner; use Rector\Enum\JsonConstant; use Rector\NodeAnalyzer\DefineFuncCallAnalyzer; @@ -38,14 +38,12 @@ final class DowngradePhp73JsonConstRector extends AbstractRector { /** * @readonly - * @var \Rector\DowngradePhp72\NodeManipulator\JsonConstCleaner */ - private $jsonConstCleaner; + private JsonConstCleaner $jsonConstCleaner; /** * @readonly - * @var \Rector\NodeAnalyzer\DefineFuncCallAnalyzer */ - private $defineFuncCallAnalyzer; + private DefineFuncCallAnalyzer $defineFuncCallAnalyzer; /** * @var string */ @@ -94,7 +92,7 @@ CODE_SAMPLE } /** * @param ConstFetch|BitwiseOr|If_|TryCatch|Expression $node - * @return int|null|Expr|If_|array + * @return null|Expr|If_|array */ public function refactor(Node $node) { @@ -108,7 +106,7 @@ CODE_SAMPLE if ($node instanceof TryCatch) { $this->traverseNodesWithCallable($node->stmts, function (Node $subNode) : ?int { if ($subNode instanceof Class_ || $subNode instanceof Function_ || $subNode instanceof Closure) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$subNode instanceof Expression) { return null; @@ -180,7 +178,7 @@ CODE_SAMPLE return null; } $nodes = [$Expression]; - $nodes[] = new If_(new NotIdentical(new FuncCall(new Name('json_last_error')), new ConstFetch(new Name('JSON_ERROR_NONE'))), ['stmts' => [new Throw_(new New_(new NameFullyQualified('Exception'), [new Arg(new FuncCall(new Name('json_last_error_msg')))]))]]); + $nodes[] = new If_(new NotIdentical(new FuncCall(new Name('json_last_error')), new ConstFetch(new Name('JSON_ERROR_NONE'))), ['stmts' => [new Expression(new Throw_(new New_(new NameFullyQualified('Exception'), [new Arg(new FuncCall(new Name('json_last_error_msg')))])))]]); return $nodes; } /** @@ -211,10 +209,6 @@ CODE_SAMPLE { $found = \false; foreach ([$bitwiseOr->left, $bitwiseOr->right] as $subNode) { - // Only `Node` instances can hold the constant. - if (!$subNode instanceof Node) { - continue; - } switch (\true) { case $subNode instanceof BitwiseOr: $found = $this->hasConstFetchInBitwiseOr($subNode, $constName); diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/FuncCall/DowngradeArrayKeyFirstLastRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/FuncCall/DowngradeArrayKeyFirstLastRector.php index 35242c8dfdf..5208cf1be63 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/FuncCall/DowngradeArrayKeyFirstLastRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/FuncCall/DowngradeArrayKeyFirstLastRector.php @@ -40,14 +40,12 @@ final class DowngradeArrayKeyFirstLastRector extends AbstractRector { /** * @readonly - * @var \Rector\Naming\Naming\VariableNaming */ - private $variableNaming; + private VariableNaming $variableNaming; /** * @readonly - * @var \Rector\NodeAnalyzer\ExprInTopStmtMatcher */ - private $exprInTopStmtMatcher; + private ExprInTopStmtMatcher $exprInTopStmtMatcher; public function __construct(VariableNaming $variableNaming, ExprInTopStmtMatcher $exprInTopStmtMatcher) { $this->variableNaming = $variableNaming; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php index cff8002246e..aa39711f8de 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php @@ -20,9 +20,8 @@ final class DowngradeTrailingCommasInFunctionCallsRector extends AbstractRector { /** * @readonly - * @var \Rector\DowngradePhp73\Tokenizer\FollowedByCommaAnalyzer */ - private $followedByCommaAnalyzer; + private FollowedByCommaAnalyzer $followedByCommaAnalyzer; public function __construct(FollowedByCommaAnalyzer $followedByCommaAnalyzer) { $this->followedByCommaAnalyzer = $followedByCommaAnalyzer; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/FuncCall/SetCookieOptionsArrayToArgumentsRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/FuncCall/SetCookieOptionsArrayToArgumentsRector.php index b1dc469efea..c579256e142 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/FuncCall/SetCookieOptionsArrayToArgumentsRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/FuncCall/SetCookieOptionsArrayToArgumentsRector.php @@ -6,8 +6,8 @@ namespace Rector\DowngradePhp73\Rector\FuncCall; use PhpParser\BuilderHelpers; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Scalar\String_; use Rector\Exception\ShouldNotHappenException; @@ -29,10 +29,7 @@ final class SetCookieOptionsArrayToArgumentsRector extends AbstractRector * @var array */ private const ARGUMENT_DEFAULT_VALUES = [2 => 0, 3 => '', 4 => '', 5 => \false, 6 => \false]; - /** - * @var int - */ - private $highestIndex = 1; + private int $highestIndex = 1; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Convert setcookie option array to arguments', [new CodeSample(<<<'CODE_SAMPLE' diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/List_/DowngradeListReferenceAssignmentRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/List_/DowngradeListReferenceAssignmentRector.php index 2bfaa67b5ba..0cc5c7ce931 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/List_/DowngradeListReferenceAssignmentRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/List_/DowngradeListReferenceAssignmentRector.php @@ -5,14 +5,14 @@ namespace Rector\DowngradePhp73\Rector\List_; use PhpParser\BuilderHelpers; use PhpParser\Node; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\ArrayDimFetch; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\AssignRef; use PhpParser\Node\Expr\List_; use PhpParser\Node\Expr\Variable; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Expression; use Rector\Rector\AbstractRector; @@ -134,7 +134,7 @@ CODE_SAMPLE /** * Count the number of params by reference placed at the end * These params are not needed anymore, so they can be removed - * @param (ArrayItem|null)[] $listItems + * @param (ArrayItem | null)[] $listItems */ private function countRightSideMostParamsByRefOrEmpty(array $listItems) : int { @@ -165,7 +165,7 @@ CODE_SAMPLE return $count; } /** - * @param (ArrayItem|null)[] $listItems + * @param (ArrayItem | null)[] $listItems * @param (int|string)[] $nestedArrayIndexes * @return Node\Stmt[] */ @@ -206,7 +206,7 @@ CODE_SAMPLE * - list(&$a, $b) * - list($a, $b, list(&$c, $d)) * - * @param (ArrayItem|null)[] $items + * @param (ArrayItem | null)[] $items */ private function hasAnyItemByRef(array $items) : bool { @@ -217,7 +217,7 @@ CODE_SAMPLE * - list(&$a, &$b) * - list(&$a, &$b, list(&$c, &$d)) * - * @param (ArrayItem|null)[] $items + * @param (ArrayItem | null)[] $items */ private function hasAllItemsByRef(array $items) : bool { @@ -233,7 +233,7 @@ CODE_SAMPLE if ($arrayItem->key instanceof String_) { return $arrayItem->key->value; } - if ($arrayItem->key instanceof LNumber) { + if ($arrayItem->key instanceof Int_) { return $arrayItem->key->value; } return $position; @@ -256,7 +256,7 @@ CODE_SAMPLE return new Expression($assignRef); } /** - * @param array $arrayItems + * @param array<(ArrayItem | null)> $arrayItems * @return ArrayItem[] */ private function getItemsByRef(array $arrayItems, int $condition) : array diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/String_/DowngradeFlexibleHeredocSyntaxRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/String_/DowngradeFlexibleHeredocSyntaxRector.php index 66cc7ffb14a..ee0add21d0d 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/String_/DowngradeFlexibleHeredocSyntaxRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/String_/DowngradeFlexibleHeredocSyntaxRector.php @@ -4,7 +4,7 @@ declare (strict_types=1); namespace Rector\DowngradePhp73\Rector\String_; use PhpParser\Node; -use PhpParser\Node\Scalar\Encapsed; +use PhpParser\Node\Scalar\InterpolatedString; use PhpParser\Node\Scalar\String_; use Rector\DowngradePhp73\Tokenizer\FollowedByNewlineOnlyMaybeWithSemicolonAnalyzer; use Rector\NodeTypeResolver\Node\AttributeKey; @@ -18,9 +18,8 @@ final class DowngradeFlexibleHeredocSyntaxRector extends AbstractRector { /** * @readonly - * @var \Rector\DowngradePhp73\Tokenizer\FollowedByNewlineOnlyMaybeWithSemicolonAnalyzer */ - private $followedByNewlineOnlyMaybeWithSemicolonAnalyzer; + private FollowedByNewlineOnlyMaybeWithSemicolonAnalyzer $followedByNewlineOnlyMaybeWithSemicolonAnalyzer; /** * @var int[] */ @@ -52,10 +51,10 @@ CODE_SAMPLE */ public function getNodeTypes() : array { - return [String_::class, Encapsed::class]; + return [String_::class, InterpolatedString::class]; } /** - * @param Encapsed|String_ $node + * @param InterpolatedString|String_ $node */ public function refactor(Node $node) : ?Node { @@ -68,7 +67,7 @@ CODE_SAMPLE if ($docIndentation === '' && $this->followedByNewlineOnlyMaybeWithSemicolonAnalyzer->isFollowed($this->file, $node)) { return null; } - $node->setAttribute(AttributeKey::DOC_INDENTATION, ''); + $node->setAttribute(AttributeKey::DOC_INDENTATION, '__REMOVED__'); $node->setAttribute(AttributeKey::ORIGINAL_NODE, null); return $node; } diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/Unset_/DowngradeTrailingCommasInUnsetRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/Unset_/DowngradeTrailingCommasInUnsetRector.php index 78289914f43..035a1f026ee 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/Unset_/DowngradeTrailingCommasInUnsetRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Rector/Unset_/DowngradeTrailingCommasInUnsetRector.php @@ -17,9 +17,8 @@ final class DowngradeTrailingCommasInUnsetRector extends AbstractRector { /** * @readonly - * @var \Rector\DowngradePhp73\Tokenizer\FollowedByCommaAnalyzer */ - private $followedByCommaAnalyzer; + private FollowedByCommaAnalyzer $followedByCommaAnalyzer; public function __construct(FollowedByCommaAnalyzer $followedByCommaAnalyzer) { $this->followedByCommaAnalyzer = $followedByCommaAnalyzer; @@ -53,9 +52,7 @@ CODE_SAMPLE public function refactor(Node $node) : ?Node { if ($node->vars !== []) { - \end($node->vars); - $lastArgumentPosition = \key($node->vars); - \reset($node->vars); + $lastArgumentPosition = \array_key_last($node->vars); $last = $node->vars[$lastArgumentPosition]; if (!$this->followedByCommaAnalyzer->isFollowed($this->file, $last)) { return null; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Tokenizer/FollowedByCommaAnalyzer.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Tokenizer/FollowedByCommaAnalyzer.php index bae1398e1eb..fb0ee5b5c0d 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Tokenizer/FollowedByCommaAnalyzer.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Tokenizer/FollowedByCommaAnalyzer.php @@ -15,12 +15,12 @@ final class FollowedByCommaAnalyzer while (isset($oldTokens[$nextTokenPosition])) { $currentToken = $oldTokens[$nextTokenPosition]; // only space - if (\is_array($currentToken) || StringUtils::isMatch($currentToken, '#\\s+#')) { + if (StringUtils::isMatch((string) $currentToken, '#\\s+#')) { ++$nextTokenPosition; continue; } // without comma - if (\in_array($currentToken, ['(', ')', ';'], \true)) { + if (\in_array((string) $currentToken, ['(', ')', ';'], \true)) { return \false; } break; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Tokenizer/FollowedByNewlineOnlyMaybeWithSemicolonAnalyzer.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Tokenizer/FollowedByNewlineOnlyMaybeWithSemicolonAnalyzer.php index ebacfa01c9e..68ea7f15d8d 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Tokenizer/FollowedByNewlineOnlyMaybeWithSemicolonAnalyzer.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp73/Tokenizer/FollowedByNewlineOnlyMaybeWithSemicolonAnalyzer.php @@ -11,9 +11,9 @@ final class FollowedByNewlineOnlyMaybeWithSemicolonAnalyzer { $oldTokens = $file->getOldTokens(); $nextTokenPosition = $node->getEndTokenPos() + 1; - if (isset($oldTokens[$nextTokenPosition]) && $oldTokens[$nextTokenPosition] === ';') { + if (isset($oldTokens[$nextTokenPosition]) && (string) $oldTokens[$nextTokenPosition] === ';') { ++$nextTokenPosition; } - return !isset($oldTokens[$nextTokenPosition]) || isset($oldTokens[$nextTokenPosition][1]) && \strncmp($oldTokens[$nextTokenPosition][1], "\n", \strlen("\n")) === 0; + return !isset($oldTokens[$nextTokenPosition]) || isset($oldTokens[$nextTokenPosition]) && \strncmp((string) $oldTokens[$nextTokenPosition], "\n", \strlen("\n")) === 0; } } diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Array_/DowngradeArraySpreadRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Array_/DowngradeArraySpreadRector.php index 9dfb6678bd6..11b074343fd 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Array_/DowngradeArraySpreadRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Array_/DowngradeArraySpreadRector.php @@ -4,8 +4,8 @@ declare (strict_types=1); namespace Rector\DowngradePhp74\Rector\Array_; use PhpParser\Node; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Identifier; use PhpParser\Node\Name; @@ -31,24 +31,20 @@ final class DowngradeArraySpreadRector extends AbstractRector { /** * @readonly - * @var \Rector\DowngradePhp81\NodeFactory\ArrayMergeFromArraySpreadFactory */ - private $arrayMergeFromArraySpreadFactory; + private ArrayMergeFromArraySpreadFactory $arrayMergeFromArraySpreadFactory; /** * @readonly - * @var \Rector\DowngradePhp81\NodeAnalyzer\ArraySpreadAnalyzer */ - private $arraySpreadAnalyzer; + private ArraySpreadAnalyzer $arraySpreadAnalyzer; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(ArrayMergeFromArraySpreadFactory $arrayMergeFromArraySpreadFactory, ArraySpreadAnalyzer $arraySpreadAnalyzer, AstResolver $astResolver, BetterNodeFinder $betterNodeFinder) { $this->arrayMergeFromArraySpreadFactory = $arrayMergeFromArraySpreadFactory; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php index d9e54581730..aa4a46086d1 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php @@ -4,14 +4,15 @@ declare (strict_types=1); namespace Rector\DowngradePhp74\Rector\ArrowFunction; use PhpParser\Node; +use PhpParser\Node\ClosureUse; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\Closure; -use PhpParser\Node\Expr\ClosureUse; +use PhpParser\Node\Expr\Throw_; use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Return_; -use PhpParser\Node\Stmt\Throw_; use PHPStan\Analyser\Scope; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\Php72\NodeFactory\AnonymousFunctionFactory; @@ -28,14 +29,12 @@ final class ArrowFunctionToAnonymousFunctionRector extends AbstractRector { /** * @readonly - * @var \Rector\Php72\NodeFactory\AnonymousFunctionFactory */ - private $anonymousFunctionFactory; + private AnonymousFunctionFactory $anonymousFunctionFactory; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(AnonymousFunctionFactory $anonymousFunctionFactory, BetterNodeFinder $betterNodeFinder) { $this->anonymousFunctionFactory = $anonymousFunctionFactory; @@ -82,24 +81,21 @@ CODE_SAMPLE $stmts = [new Return_($node->expr)]; $anonymousFunctionFactory = $this->anonymousFunctionFactory->create($node->params, $stmts, $node->returnType, $node->static); if ($node->expr instanceof Assign && $node->expr->expr instanceof Variable) { - $isFound = (bool) $this->betterNodeFinder->findFirst($anonymousFunctionFactory->uses, function (Node $subNode) use($node) : bool { - return $subNode instanceof Variable && $this->nodeComparator->areNodesEqual($subNode, $node->expr->expr); - }); + $isFound = (bool) $this->betterNodeFinder->findFirst($anonymousFunctionFactory->uses, fn(Node $subNode): bool => $subNode instanceof Variable && $this->nodeComparator->areNodesEqual($subNode, $node->expr->expr)); if (!$isFound) { $anonymousFunctionFactory->uses[] = new ClosureUse($node->expr->expr); } } // downgrade "return throw" - $this->traverseNodesWithCallable($anonymousFunctionFactory, static function (Node $node) : ?Throw_ { + $this->traverseNodesWithCallable($anonymousFunctionFactory, static function (Node $node) : ?Expression { if (!$node instanceof Return_) { return null; } - if (!$node->expr instanceof Node\Expr\Throw_) { + if (!$node->expr instanceof Throw_) { return null; } - $throw = $node->expr; // throw expr to throw stmts - return new Throw_($throw->expr); + return new Expression($node->expr); }); $this->appendUsesFromInsertedVariable($node->expr, $anonymousFunctionFactory); return $anonymousFunctionFactory; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ClassMethod/DowngradeContravariantArgumentTypeRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ClassMethod/DowngradeContravariantArgumentTypeRector.php index aaae864e03b..9a7012b66a9 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ClassMethod/DowngradeContravariantArgumentTypeRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ClassMethod/DowngradeContravariantArgumentTypeRector.php @@ -31,33 +31,25 @@ final class DowngradeContravariantArgumentTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\NodeAnalyzer\ParamAnalyzer */ - private $paramAnalyzer; + private ParamAnalyzer $paramAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; - /** - * @var bool - */ - private $hasChanged = \false; + private StaticTypeMapper $staticTypeMapper; + private bool $hasChanged = \false; public function __construct(PhpDocTypeChanger $phpDocTypeChanger, ParamAnalyzer $paramAnalyzer, ReflectionResolver $reflectionResolver, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper) { $this->phpDocTypeChanger = $phpDocTypeChanger; @@ -141,7 +133,7 @@ CODE_SAMPLE if ($param->variadic) { return \false; } - if ($param->type === null) { + if (!$param->type instanceof Node) { return \false; } // Don't consider for Union types @@ -250,7 +242,7 @@ CODE_SAMPLE */ private function decorateWithDocBlock($functionLike, Param $param) : void { - if ($param->type === null) { + if (!$param->type instanceof Node) { return; } $type = $this->staticTypeMapper->mapPhpParserNodePHPStanType($param->type); diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php index 738c27dc352..70071f92d2c 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php @@ -40,44 +40,36 @@ final class DowngradeCovariantReturnTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\DeadCode\PhpDoc\TagRemover\ReturnTagRemover */ - private $returnTagRemover; + private ReturnTagRemover $returnTagRemover; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\Util\Reflection\PrivatesAccessor */ - private $privatesAccessor; + private PrivatesAccessor $privatesAccessor; /** * @readonly - * @var \Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeAnalyzer */ - private $unionTypeAnalyzer; + private UnionTypeAnalyzer $unionTypeAnalyzer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(PhpDocTypeChanger $phpDocTypeChanger, ReturnTagRemover $returnTagRemover, ReflectionResolver $reflectionResolver, PrivatesAccessor $privatesAccessor, UnionTypeAnalyzer $unionTypeAnalyzer, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper) { $this->phpDocTypeChanger = $phpDocTypeChanger; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/FuncCall/DowngradeStripTagsCallWithArrayRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/FuncCall/DowngradeStripTagsCallWithArrayRector.php index 74c332b5674..2948cd0afa5 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/FuncCall/DowngradeStripTagsCallWithArrayRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/FuncCall/DowngradeStripTagsCallWithArrayRector.php @@ -29,9 +29,8 @@ final class DowngradeStripTagsCallWithArrayRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Identical/DowngradeFreadFwriteFalsyToNegationRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Identical/DowngradeFreadFwriteFalsyToNegationRector.php index 4d71afeaad4..533a1414780 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Identical/DowngradeFreadFwriteFalsyToNegationRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Identical/DowngradeFreadFwriteFalsyToNegationRector.php @@ -19,9 +19,8 @@ final class DowngradeFreadFwriteFalsyToNegationRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var string[] */ diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php index 87467d501f3..fa95a90b8ba 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php @@ -17,9 +17,8 @@ final class DowngradePreviouslyImplementedInterfaceRector extends AbstractRector { /** * @readonly - * @var \Rector\FamilyTree\Reflection\FamilyRelationsAnalyzer */ - private $familyRelationsAnalyzer; + private FamilyRelationsAnalyzer $familyRelationsAnalyzer; public function __construct(FamilyRelationsAnalyzer $familyRelationsAnalyzer) { $this->familyRelationsAnalyzer = $familyRelationsAnalyzer; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/LNumber/DowngradeNumericLiteralSeparatorRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/LNumber/DowngradeNumericLiteralSeparatorRector.php index 74d944250d1..e88f8585f5c 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/LNumber/DowngradeNumericLiteralSeparatorRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/LNumber/DowngradeNumericLiteralSeparatorRector.php @@ -4,8 +4,8 @@ declare (strict_types=1); namespace Rector\DowngradePhp74\Rector\LNumber; use PhpParser\Node; -use PhpParser\Node\Scalar\DNumber; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Float_; +use PhpParser\Node\Scalar\Int_; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -46,10 +46,10 @@ CODE_SAMPLE */ public function getNodeTypes() : array { - return [LNumber::class, DNumber::class]; + return [Int_::class, Float_::class]; } /** - * @param LNumber|DNumber $node + * @param Int_|Float_ $node */ public function refactor(Node $node) : ?Node { @@ -66,7 +66,7 @@ CODE_SAMPLE return $node; } /** - * @param \PhpParser\Node\Scalar\LNumber|\PhpParser\Node\Scalar\DNumber $node + * @param \PhpParser\Node\Scalar\Int_|\PhpParser\Node\Scalar\Float_ $node * @param mixed $rawValue */ private function shouldSkip($node, $rawValue) : bool @@ -75,9 +75,9 @@ CODE_SAMPLE return \true; } // "_" notation can be applied to decimal numbers only - if ($node instanceof LNumber) { + if ($node instanceof Int_) { $numberKind = $node->getAttribute(AttributeKey::KIND); - if ($numberKind !== LNumber::KIND_DEC) { + if ($numberKind !== Int_::KIND_DEC) { return \true; } } diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/MethodCall/DowngradeReflectionGetTypeRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/MethodCall/DowngradeReflectionGetTypeRector.php index 6abb842cbe5..fb2b6be9e89 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/MethodCall/DowngradeReflectionGetTypeRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/MethodCall/DowngradeReflectionGetTypeRector.php @@ -63,9 +63,8 @@ CODE_SAMPLE } /** * @param MethodCall|Ternary|Instanceof_ $node - * @return \PhpParser\Node|null|int */ - public function refactor(Node $node) + public function refactor(Node $node) : ?\PhpParser\Node { if ($node instanceof Instanceof_) { return $this->refactorInstanceof($node); diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Property/DowngradeTypedPropertyRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Property/DowngradeTypedPropertyRector.php index 481ec697ec9..19c54c32d47 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Property/DowngradeTypedPropertyRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Property/DowngradeTypedPropertyRector.php @@ -19,14 +19,12 @@ final class DowngradeTypedPropertyRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\PropertyDecorator */ - private $propertyDecorator; + private PropertyDecorator $propertyDecorator; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(PropertyDecorator $propertyDecorator, ValueResolver $valueResolver) { $this->propertyDecorator = $propertyDecorator; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/NodeAnalyzer/EnumAnalyzer.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/NodeAnalyzer/EnumAnalyzer.php index 86f02085bea..02c664bb153 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/NodeAnalyzer/EnumAnalyzer.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/NodeAnalyzer/EnumAnalyzer.php @@ -18,14 +18,12 @@ final class EnumAnalyzer { /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(AstResolver $astResolver, NodeTypeResolver $nodeTypeResolver) { $this->astResolver = $astResolver; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/NodeAnalyzer/NamedToUnnamedArgs.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/NodeAnalyzer/NamedToUnnamedArgs.php index a33ca22de5b..4404733a919 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/NodeAnalyzer/NamedToUnnamedArgs.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/NodeAnalyzer/NamedToUnnamedArgs.php @@ -18,14 +18,12 @@ final class NamedToUnnamedArgs { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\DowngradePhp80\Reflection\DefaultParameterValueResolver */ - private $defaultParameterValueResolver; + private DefaultParameterValueResolver $defaultParameterValueResolver; public function __construct(NodeNameResolver $nodeNameResolver, DefaultParameterValueResolver $defaultParameterValueResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/NodeAnalyzer/UnnamedArgumentResolver.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/NodeAnalyzer/UnnamedArgumentResolver.php index 7fcbf2ab85d..04a9cefb2b4 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/NodeAnalyzer/UnnamedArgumentResolver.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/NodeAnalyzer/UnnamedArgumentResolver.php @@ -15,14 +15,12 @@ final class UnnamedArgumentResolver { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\DowngradePhp80\NodeAnalyzer\NamedToUnnamedArgs */ - private $namedToUnnamedArgs; + private \Rector\DowngradePhp80\NodeAnalyzer\NamedToUnnamedArgs $namedToUnnamedArgs; public function __construct(NodeNameResolver $nodeNameResolver, \Rector\DowngradePhp80\NodeAnalyzer\NamedToUnnamedArgs $namedToUnnamedArgs) { $this->nodeNameResolver = $nodeNameResolver; @@ -35,8 +33,8 @@ final class UnnamedArgumentResolver */ public function resolveFromReflection($functionLikeReflection, array $currentArgs) : array { - $parametersAcceptorWithPhpDocs = ParametersAcceptorSelector::combineAcceptors($functionLikeReflection->getVariants()); - $parameters = $parametersAcceptorWithPhpDocs->getParameters(); + $extendedParametersAcceptor = ParametersAcceptorSelector::combineAcceptors($functionLikeReflection->getVariants()); + $parameters = $extendedParametersAcceptor->getParameters(); if ($functionLikeReflection instanceof NativeFunctionReflection) { $functionLikeReflection = new ReflectionFunction($functionLikeReflection->getName()); } diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ArrayDimFetch/DowngradeDereferenceableOperationRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ArrayDimFetch/DowngradeDereferenceableOperationRector.php index 1d3aa70db18..ebc13a789ea 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ArrayDimFetch/DowngradeDereferenceableOperationRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ArrayDimFetch/DowngradeDereferenceableOperationRector.php @@ -6,7 +6,7 @@ namespace Rector\DowngradePhp80\Rector\ArrayDimFetch; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrayDimFetch; -use PhpParser\Node\Scalar\Encapsed; +use PhpParser\Node\Scalar\InterpolatedString; use PhpParser\Node\Scalar\MagicConst; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\Rector\AbstractRector; @@ -58,7 +58,7 @@ CODE_SAMPLE if (!$arrayDimFetch->dim instanceof Expr) { return \true; } - if ($arrayDimFetch->var instanceof Encapsed) { + if ($arrayDimFetch->var instanceof InterpolatedString) { return $this->hasParentheses($arrayDimFetch); } if ($arrayDimFetch->var instanceof MagicConst) { @@ -81,7 +81,7 @@ CODE_SAMPLE if (!isset($oldTokens[$i])) { continue; } - if ($oldTokens[$i] !== ')') { + if ((string) $oldTokens[$i] !== ')') { continue; } return \true; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Catch_/DowngradeNonCapturingCatchesRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Catch_/DowngradeNonCapturingCatchesRector.php index c3e01fbea08..4425a6ed9a7 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Catch_/DowngradeNonCapturingCatchesRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Catch_/DowngradeNonCapturingCatchesRector.php @@ -20,9 +20,8 @@ final class DowngradeNonCapturingCatchesRector extends AbstractRector { /** * @readonly - * @var \Rector\Naming\Naming\VariableNaming */ - private $variableNaming; + private VariableNaming $variableNaming; public function __construct(VariableNaming $variableNaming) { $this->variableNaming = $variableNaming; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeAbstractPrivateMethodInTraitRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeAbstractPrivateMethodInTraitRector.php index fbe8739df77..784fa530800 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeAbstractPrivateMethodInTraitRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeAbstractPrivateMethodInTraitRector.php @@ -3,8 +3,8 @@ declare (strict_types=1); namespace Rector\DowngradePhp80\Rector\ClassMethod; +use PhpParser\Modifiers; use PhpParser\Node; -use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\Reflection\ClassReflection; use Rector\Rector\AbstractRector; @@ -18,9 +18,8 @@ final class DowngradeAbstractPrivateMethodInTraitRector extends AbstractRector { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ReflectionResolver $reflectionResolver) { $this->reflectionResolver = $reflectionResolver; @@ -57,7 +56,7 @@ CODE_SAMPLE return null; } // remove abstract - $node->flags -= Class_::MODIFIER_ABSTRACT; + $node->flags -= Modifiers::ABSTRACT; // Add empty array for stmts to generate empty function body $node->stmts = []; return $node; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeRecursiveDirectoryIteratorHasChildrenRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeRecursiveDirectoryIteratorHasChildrenRector.php index e025c21717e..89331789062 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeRecursiveDirectoryIteratorHasChildrenRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeRecursiveDirectoryIteratorHasChildrenRector.php @@ -16,9 +16,8 @@ final class DowngradeRecursiveDirectoryIteratorHasChildrenRector extends Abstrac { /** * @readonly - * @var \Rector\FamilyTree\Reflection\FamilyRelationsAnalyzer */ - private $familyRelationsAnalyzer; + private FamilyRelationsAnalyzer $familyRelationsAnalyzer; public function __construct(FamilyRelationsAnalyzer $familyRelationsAnalyzer) { $this->familyRelationsAnalyzer = $familyRelationsAnalyzer; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeStaticTypeDeclarationRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeStaticTypeDeclarationRector.php index 1992150273a..38e11f08d22 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeStaticTypeDeclarationRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeStaticTypeDeclarationRector.php @@ -19,14 +19,12 @@ final class DowngradeStaticTypeDeclarationRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpDocDecorator\PhpDocFromTypeDeclarationDecorator */ - private $phpDocFromTypeDeclarationDecorator; + private PhpDocFromTypeDeclarationDecorator $phpDocFromTypeDeclarationDecorator; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(PhpDocFromTypeDeclarationDecorator $phpDocFromTypeDeclarationDecorator, ReflectionResolver $reflectionResolver) { $this->phpDocFromTypeDeclarationDecorator = $phpDocFromTypeDeclarationDecorator; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeStringReturnTypeOnToStringRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeStringReturnTypeOnToStringRector.php index abbd8f55ec4..90d29ad3785 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeStringReturnTypeOnToStringRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeStringReturnTypeOnToStringRector.php @@ -20,14 +20,12 @@ final class DowngradeStringReturnTypeOnToStringRector extends AbstractRector { /** * @readonly - * @var \Rector\FamilyTree\NodeAnalyzer\ClassChildAnalyzer */ - private $classChildAnalyzer; + private ClassChildAnalyzer $classChildAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ClassChildAnalyzer $classChildAnalyzer, ReflectionResolver $reflectionResolver) { $this->classChildAnalyzer = $classChildAnalyzer; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeTrailingCommasInParamUseRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeTrailingCommasInParamUseRector.php index 7610ee0378f..87e392eb43c 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeTrailingCommasInParamUseRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeTrailingCommasInParamUseRector.php @@ -4,8 +4,8 @@ declare (strict_types=1); namespace Rector\DowngradePhp80\Rector\ClassMethod; use PhpParser\Node; +use PhpParser\Node\ClosureUse; use PhpParser\Node\Expr\Closure; -use PhpParser\Node\Expr\ClosureUse; use PhpParser\Node\Param; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; @@ -21,9 +21,8 @@ final class DowngradeTrailingCommasInParamUseRector extends AbstractRector { /** * @readonly - * @var \Rector\DowngradePhp73\Tokenizer\FollowedByCommaAnalyzer */ - private $followedByCommaAnalyzer; + private FollowedByCommaAnalyzer $followedByCommaAnalyzer; public function __construct(FollowedByCommaAnalyzer $followedByCommaAnalyzer) { $this->followedByCommaAnalyzer = $followedByCommaAnalyzer; @@ -106,9 +105,7 @@ CODE_SAMPLE */ private function cleanTrailingComma($node, array $array) : ?Node { - \end($array); - $lastPosition = \key($array); - \reset($array); + $lastPosition = \array_key_last($array); $last = $array[$lastPosition]; if (!$this->followedByCommaAnalyzer->isFollowed($this->file, $last)) { return null; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Class_/DowngradeAttributeToAnnotationRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Class_/DowngradeAttributeToAnnotationRector.php index a446ac1bf53..8b5a75c353f 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Class_/DowngradeAttributeToAnnotationRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Class_/DowngradeAttributeToAnnotationRector.php @@ -31,19 +31,16 @@ final class DowngradeAttributeToAnnotationRector extends AbstractRector implemen { /** * @readonly - * @var \Rector\NodeFactory\DoctrineAnnotationFactory */ - private $doctrineAnnotationFactory; + private DoctrineAnnotationFactory $doctrineAnnotationFactory; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var string[] */ @@ -51,11 +48,8 @@ final class DowngradeAttributeToAnnotationRector extends AbstractRector implemen /** * @var DowngradeAttributeToAnnotation[] */ - private $attributesToAnnotations = []; - /** - * @var bool - */ - private $isDowngraded = \false; + private array $attributesToAnnotations = []; + private bool $isDowngraded = \false; public function __construct(DoctrineAnnotationFactory $doctrineAnnotationFactory, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->doctrineAnnotationFactory = $doctrineAnnotationFactory; @@ -138,7 +132,7 @@ CODE_SAMPLE return $node; } /** - * @param mixed[] $configuration + * @param DowngradeAttributeToAnnotation[] $configuration */ public function configure(array $configuration) : void { diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php index 0f4f9909f49..2a101a2ef4d 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php @@ -8,11 +8,11 @@ use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\New_; use PhpParser\Node\Param; +use PhpParser\Node\PropertyItem; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Property; -use PhpParser\Node\Stmt\PropertyProperty; use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; @@ -33,24 +33,20 @@ final class DowngradePropertyPromotionRector extends AbstractRector { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(PhpDocTypeChanger $phpDocTypeChanger, BetterStandardPrinter $betterStandardPrinter, PhpDocInfoFactory $phpDocInfoFactory, BetterNodeFinder $betterNodeFinder) { $this->phpDocTypeChanger = $phpDocTypeChanger; @@ -187,7 +183,7 @@ CODE_SAMPLE foreach ($params as $param) { /** @var string $name */ $name = $this->getName($param->var); - $property = new Property($param->flags, [new PropertyProperty($name)], [], $param->type); + $property = new Property($param->flags, [new PropertyItem($name)], [], $param->type); $this->decoratePropertyWithParamDocInfo($classMethod, $param, $property); $hasNew = $param->default instanceof Expr && (bool) $this->betterNodeFinder->findFirstInstanceOf($param->default, New_::class); if ($param->default instanceof Expr && !$hasNew) { diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Enum_/DowngradeEnumToConstantListClassRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Enum_/DowngradeEnumToConstantListClassRector.php index 5e876ec18d3..d291433c3a4 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Enum_/DowngradeEnumToConstantListClassRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Enum_/DowngradeEnumToConstantListClassRector.php @@ -32,29 +32,24 @@ final class DowngradeEnumToConstantListClassRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeFactory\ClassFromEnumFactory */ - private $classFromEnumFactory; + private ClassFromEnumFactory $classFromEnumFactory; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\DowngradePhp80\NodeAnalyzer\EnumAnalyzer */ - private $enumAnalyzer; + private EnumAnalyzer $enumAnalyzer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(ClassFromEnumFactory $classFromEnumFactory, ReflectionProvider $reflectionProvider, EnumAnalyzer $enumAnalyzer, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->classFromEnumFactory = $classFromEnumFactory; @@ -136,7 +131,7 @@ CODE_SAMPLE $constTypeNode = new ConstTypeNode($constFetchNode); $paramName = '$' . $this->getName($param); $paramTypeNode = $isNullable ? new NullableTypeNode($constTypeNode) : $constTypeNode; - $paramTagValueNode = new ParamTagValueNode($paramTypeNode, \false, $paramName, ''); + $paramTagValueNode = new ParamTagValueNode($paramTypeNode, \false, $paramName, '', \false); $phpDocInfo->addTagValueNode($paramTagValueNode); $this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($classMethod); } diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector.php index b02a2267ae2..627e46522a7 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector.php @@ -5,7 +5,7 @@ namespace Rector\DowngradePhp80\Rector\Expression; use PhpParser\Node; use PhpParser\Node\Arg; -use PhpParser\Node\Expr\ArrayItem; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\CallLike; @@ -24,7 +24,7 @@ use PhpParser\Node\Stmt\Echo_; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Return_; use PhpParser\Node\Stmt\Switch_; -use PhpParser\NodeTraverser; +use PhpParser\NodeVisitor; use PHPStan\Analyser\Scope; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\Php72\NodeFactory\AnonymousFunctionFactory; @@ -41,9 +41,8 @@ final class DowngradeMatchToSwitchRector extends AbstractRector { /** * @readonly - * @var \Rector\Php72\NodeFactory\AnonymousFunctionFactory */ - private $anonymousFunctionFactory; + private AnonymousFunctionFactory $anonymousFunctionFactory; public function __construct(AnonymousFunctionFactory $anonymousFunctionFactory) { $this->anonymousFunctionFactory = $anonymousFunctionFactory; @@ -107,46 +106,46 @@ CODE_SAMPLE $switch = new Switch_($subNode->value->cond, $switchCases); $subNode->value = new FuncCall($this->anonymousFunctionFactory->create([], [$switch], null)); $hasChanged = \true; - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($subNode instanceof Arg && $subNode->value instanceof ArrowFunction && $subNode->value->expr instanceof Match_) { $refactoredNode = $this->refactorInArrowFunction($subNode, $subNode->value, $subNode->value->expr); if ($refactoredNode instanceof Node) { $hasChanged = \true; } - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($subNode instanceof Assign && $subNode->expr instanceof ArrowFunction && $subNode->expr->expr instanceof Match_) { $refactoredNode = $this->refactorInArrowFunction($subNode, $subNode->expr, $subNode->expr->expr); if ($refactoredNode instanceof Node) { $hasChanged = \true; } - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($subNode instanceof Expression && $subNode->expr instanceof ArrowFunction && $subNode->expr->expr instanceof Match_) { $refactoredNode = $this->refactorInArrowFunction($subNode, $subNode->expr, $subNode->expr->expr); if ($refactoredNode instanceof Node) { $hasChanged = \true; } - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($subNode instanceof Return_ && $subNode->expr instanceof ArrowFunction && $subNode->expr->expr instanceof Match_) { $refactoredNode = $this->refactorInArrowFunction($subNode, $subNode->expr, $subNode->expr->expr); if ($refactoredNode instanceof Node) { $hasChanged = \true; } - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($subNode instanceof FuncCall && $subNode->name instanceof ArrowFunction && $subNode->name->expr instanceof Match_) { $refactoredNode = $this->refactorInArrowFunction($subNode, $subNode->name, $subNode->name->expr); if ($refactoredNode instanceof Node) { $hasChanged = \true; } - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if ($subNode instanceof Match_) { $match = $subNode; - return NodeTraverser::STOP_TRAVERSAL; + return NodeVisitor::STOP_TRAVERSAL; } }); if ($hasChanged) { diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Expression/DowngradeThrowExprRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Expression/DowngradeThrowExprRector.php index 9f2b8cc7db3..0df569569f5 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Expression/DowngradeThrowExprRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Expression/DowngradeThrowExprRector.php @@ -6,11 +6,13 @@ namespace Rector\DowngradePhp80\Rector\Expression; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrayDimFetch; +use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\BinaryOp\Coalesce; use PhpParser\Node\Expr\BinaryOp\Identical; use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\BooleanNot; +use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\Isset_; use PhpParser\Node\Expr\PropertyFetch; @@ -24,6 +26,7 @@ use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\Return_; use Rector\NodeAnalyzer\CoalesceAnalyzer; use Rector\NodeManipulator\BinaryOpManipulator; +use Rector\Php72\NodeFactory\AnonymousFunctionFactory; use Rector\PhpParser\Node\BetterNodeFinder; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -37,24 +40,26 @@ final class DowngradeThrowExprRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\CoalesceAnalyzer */ - private $coalesceAnalyzer; + private CoalesceAnalyzer $coalesceAnalyzer; /** * @readonly - * @var \Rector\NodeManipulator\BinaryOpManipulator */ - private $binaryOpManipulator; + private BinaryOpManipulator $binaryOpManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; - public function __construct(CoalesceAnalyzer $coalesceAnalyzer, BinaryOpManipulator $binaryOpManipulator, BetterNodeFinder $betterNodeFinder) + private BetterNodeFinder $betterNodeFinder; + /** + * @readonly + */ + private AnonymousFunctionFactory $anonymousFunctionFactory; + public function __construct(CoalesceAnalyzer $coalesceAnalyzer, BinaryOpManipulator $binaryOpManipulator, BetterNodeFinder $betterNodeFinder, AnonymousFunctionFactory $anonymousFunctionFactory) { $this->coalesceAnalyzer = $coalesceAnalyzer; $this->binaryOpManipulator = $binaryOpManipulator; $this->betterNodeFinder = $betterNodeFinder; + $this->anonymousFunctionFactory = $anonymousFunctionFactory; } public function getRuleDefinition() : RuleDefinition { @@ -75,14 +80,17 @@ CODE_SAMPLE */ public function getNodeTypes() : array { - return [Expression::class, Return_::class]; + return [ArrowFunction::class, Expression::class, Return_::class]; } /** - * @param Expression|Return_ $node + * @param ArrowFunction|Expression|Return_ $node * @return Node|Node[]|null */ public function refactor(Node $node) { + if ($node instanceof ArrowFunction) { + return $this->refactorArrowFunctionReturn($node); + } if ($node instanceof Return_) { return $this->refactorReturn($node); } @@ -103,6 +111,14 @@ CODE_SAMPLE } return $this->refactorDirectCoalesce($node); } + private function refactorArrowFunctionReturn(ArrowFunction $arrowFunction) : ?Closure + { + if (!$arrowFunction->expr instanceof Throw_) { + return null; + } + $stmts = [new Expression($arrowFunction->expr)]; + return $this->anonymousFunctionFactory->create($arrowFunction->params, $stmts, $arrowFunction->returnType, $arrowFunction->static); + } /** * @return If_|Expression|Stmt[]|null */ @@ -159,9 +175,7 @@ CODE_SAMPLE } private function hasThrowInAssignExpr(Assign $assign) : bool { - return (bool) $this->betterNodeFinder->findFirst($assign->expr, static function (Node $node) : bool { - return $node instanceof Throw_; - }); + return (bool) $this->betterNodeFinder->findFirst($assign->expr, static fn(Node $node): bool => $node instanceof Throw_); } /** * @return Node[]|null @@ -225,8 +239,7 @@ CODE_SAMPLE } // add condition if above $throwExpr = $coalesce->right; - $throw = new Stmt\Throw_($throwExpr->expr); - $if = new If_(new Identical($coalesce->left, new ConstFetch(new Name('null'))), ['stmts' => [$throw]]); + $if = new If_(new Identical($coalesce->left, new ConstFetch(new Name('null'))), ['stmts' => [new Expression($throwExpr)]]); // replace coalsese with left :) $this->traverseNodesWithCallable($expression, static function (Node $node) : ?Expr { if (!$node instanceof Coalesce) { diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeArrayFilterNullableCallbackRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeArrayFilterNullableCallbackRector.php index e56627460b7..c5e48e68cd8 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeArrayFilterNullableCallbackRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeArrayFilterNullableCallbackRector.php @@ -19,7 +19,7 @@ use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Param; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; use PHPStan\Type\ArrayType; use PHPStan\Type\ClosureType; @@ -40,14 +40,12 @@ final class DowngradeArrayFilterNullableCallbackRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\ArgsAnalyzer */ - private $argsAnalyzer; + private ArgsAnalyzer $argsAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ArgsAnalyzer $argsAnalyzer, ValueResolver $valueResolver) { $this->argsAnalyzer = $argsAnalyzer; @@ -86,9 +84,8 @@ CODE_SAMPLE } /** * @param FuncCall $node - * @return \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\Ternary|null */ - public function refactor(Node $node) + public function refactor(Node $node) : ?\PhpParser\Node\Expr\FuncCall { if (!$this->isName($node, 'array_filter')) { return null; @@ -143,7 +140,7 @@ CODE_SAMPLE { $identical = new Identical($args[1]->value, $this->nodeFactory->createNull()); $constFetch = new ConstFetch(new Name('ARRAY_FILTER_USE_BOTH')); - return new Ternary($identical, $constFetch, isset($args[2]) ? $args[2]->value : new LNumber(0)); + return new Ternary($identical, $constFetch, isset($args[2]) ? $args[2]->value : new Int_(0)); } private function isAlreadyConditionedToNull(Expr $expr) : bool { diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeNumberFormatNoFourthArgRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeNumberFormatNoFourthArgRector.php index cd97331aeca..6f4ecab08b1 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeNumberFormatNoFourthArgRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeNumberFormatNoFourthArgRector.php @@ -21,9 +21,8 @@ final class DowngradeNumberFormatNoFourthArgRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\ArgsAnalyzer */ - private $argsAnalyzer; + private ArgsAnalyzer $argsAnalyzer; public function __construct(ArgsAnalyzer $argsAnalyzer) { $this->argsAnalyzer = $argsAnalyzer; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrEndsWithRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrEndsWithRector.php index ee8e0248431..3fc20cde623 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrEndsWithRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrEndsWithRector.php @@ -12,7 +12,7 @@ use PhpParser\Node\Expr\BooleanNot; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\UnaryMinus; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -40,12 +40,12 @@ final class DowngradeStrEndsWithRector extends AbstractRector public function refactor(Node $node) : ?Node { if ($node instanceof FuncCall && $this->isName($node->name, 'str_ends_with')) { - return new Identical($this->createSubstrCompareFuncCall($node), new LNumber(0)); + return new Identical($this->createSubstrCompareFuncCall($node), new Int_(0)); } if ($node instanceof BooleanNot) { $funcCall = $node->expr; if ($funcCall instanceof FuncCall && $this->isName($funcCall->name, 'str_ends_with')) { - return new NotIdentical($this->createSubstrCompareFuncCall($funcCall), new LNumber(0)); + return new NotIdentical($this->createSubstrCompareFuncCall($funcCall), new Int_(0)); } } return null; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrStartsWithRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrStartsWithRector.php index e2398f52084..29e166b7048 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrStartsWithRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrStartsWithRector.php @@ -10,7 +10,7 @@ use PhpParser\Node\Expr\BinaryOp\NotIdentical; use PhpParser\Node\Expr\BooleanNot; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -52,13 +52,13 @@ final class DowngradeStrStartsWithRector extends AbstractRector { $strlenFuncCall = $this->createStrlenFuncCall($funcCall); $strncmpFuncCall = $this->createStrncmpFuncCall($funcCall, $strlenFuncCall); - return new Identical($strncmpFuncCall, new LNumber(0)); + return new Identical($strncmpFuncCall, new Int_(0)); } private function createNotIdenticalStrncmpFuncCall(FuncCall $funcCall) : NotIdentical { $strlenFuncCall = $this->createStrlenFuncCall($funcCall); $strncmpFuncCall = $this->createStrncmpFuncCall($funcCall, $strlenFuncCall); - return new NotIdentical($strncmpFuncCall, new LNumber(0)); + return new NotIdentical($strncmpFuncCall, new Int_(0)); } private function createStrlenFuncCall(FuncCall $funcCall) : FuncCall { diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FunctionLike/DowngradeMixedTypeDeclarationRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FunctionLike/DowngradeMixedTypeDeclarationRector.php index 03a7511697b..594edca1413 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FunctionLike/DowngradeMixedTypeDeclarationRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FunctionLike/DowngradeMixedTypeDeclarationRector.php @@ -20,9 +20,8 @@ final class DowngradeMixedTypeDeclarationRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpDocDecorator\PhpDocFromTypeDeclarationDecorator */ - private $phpDocFromTypeDeclarationDecorator; + private PhpDocFromTypeDeclarationDecorator $phpDocFromTypeDeclarationDecorator; public function __construct(PhpDocFromTypeDeclarationDecorator $phpDocFromTypeDeclarationDecorator) { $this->phpDocFromTypeDeclarationDecorator = $phpDocFromTypeDeclarationDecorator; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FunctionLike/DowngradeUnionTypeDeclarationRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FunctionLike/DowngradeUnionTypeDeclarationRector.php index 2d0b2419d93..08df2908aad 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FunctionLike/DowngradeUnionTypeDeclarationRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FunctionLike/DowngradeUnionTypeDeclarationRector.php @@ -20,9 +20,8 @@ final class DowngradeUnionTypeDeclarationRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpDocDecorator\PhpDocFromTypeDeclarationDecorator */ - private $phpDocFromTypeDeclarationDecorator; + private PhpDocFromTypeDeclarationDecorator $phpDocFromTypeDeclarationDecorator; public function __construct(PhpDocFromTypeDeclarationDecorator $phpDocFromTypeDeclarationDecorator) { $this->phpDocFromTypeDeclarationDecorator = $phpDocFromTypeDeclarationDecorator; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Instanceof_/DowngradePhp80ResourceReturnToObjectRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Instanceof_/DowngradePhp80ResourceReturnToObjectRector.php index 59869662e7d..3bea0818df1 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Instanceof_/DowngradePhp80ResourceReturnToObjectRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Instanceof_/DowngradePhp80ResourceReturnToObjectRector.php @@ -19,9 +19,8 @@ final class DowngradePhp80ResourceReturnToObjectRector extends AbstractRector { /** * @readonly - * @var \Rector\DowngradePhp81\NodeManipulator\ObjectToResourceReturn */ - private $objectToResourceReturn; + private ObjectToResourceReturn $objectToResourceReturn; /** * @var string[] */ diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeNamedArgumentRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeNamedArgumentRector.php index 1ca3e10ac5c..186f96bd286 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeNamedArgumentRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeNamedArgumentRector.php @@ -24,19 +24,16 @@ final class DowngradeNamedArgumentRector extends AbstractRector { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\DowngradePhp80\NodeAnalyzer\UnnamedArgumentResolver */ - private $unnamedArgumentResolver; + private UnnamedArgumentResolver $unnamedArgumentResolver; /** * @readonly - * @var \Rector\NodeAnalyzer\ArgsAnalyzer */ - private $argsAnalyzer; + private ArgsAnalyzer $argsAnalyzer; public function __construct(ReflectionResolver $reflectionResolver, UnnamedArgumentResolver $unnamedArgumentResolver, ArgsAnalyzer $argsAnalyzer) { $this->reflectionResolver = $reflectionResolver; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionClassGetConstantsFilterRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionClassGetConstantsFilterRector.php index dcdf451e660..6e76dfd18fe 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionClassGetConstantsFilterRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionClassGetConstantsFilterRector.php @@ -4,13 +4,13 @@ declare (strict_types=1); namespace Rector\DowngradePhp80\Rector\MethodCall; use PhpParser\Node; +use PhpParser\Node\ClosureUse; use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\BinaryOp\BitwiseOr; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\Closure; -use PhpParser\Node\Expr\ClosureUse; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; @@ -33,14 +33,12 @@ final class DowngradeReflectionClassGetConstantsFilterRector extends AbstractRec { /** * @readonly - * @var \Rector\Naming\Naming\VariableNaming */ - private $variableNaming; + private VariableNaming $variableNaming; /** * @readonly - * @var \Rector\NodeCollector\BinaryOpConditionsCollector */ - private $binaryOpConditionsCollector; + private BinaryOpConditionsCollector $binaryOpConditionsCollector; /** * @var array */ diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php index 030ee9b77fa..9064dfe2d34 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector.php @@ -49,9 +49,8 @@ CODE_SAMPLE } /** * @param Ternary|MethodCall $node - * @return \PhpParser\Node\Expr\Ternary|null|int */ - public function refactor(Node $node) + public function refactor(Node $node) : ?\PhpParser\Node\Expr\Ternary { if ($node instanceof Ternary) { if ($node->if instanceof Expr && $node->cond instanceof FuncCall && $this->isName($node->cond, 'method_exists')) { diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/New_/DowngradeArbitraryExpressionsSupportRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/New_/DowngradeArbitraryExpressionsSupportRector.php index d32fe742df9..fb6862f11bb 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/New_/DowngradeArbitraryExpressionsSupportRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/New_/DowngradeArbitraryExpressionsSupportRector.php @@ -30,14 +30,12 @@ final class DowngradeArbitraryExpressionsSupportRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeFactory\NamedVariableFactory */ - private $namedVariableFactory; + private NamedVariableFactory $namedVariableFactory; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(NamedVariableFactory $namedVariableFactory, BetterNodeFinder $betterNodeFinder) { $this->namedVariableFactory = $namedVariableFactory; @@ -71,9 +69,9 @@ CODE_SAMPLE } /** * @param Expression $node - * @return Node\Stmt[]|null|Expression + * @return Expression[]|null */ - public function refactor(Node $node) + public function refactor(Node $node) : ?array { /** @var Assign[] $assigns */ $assigns = $this->betterNodeFinder->findInstancesOf($node, [Assign::class]); @@ -102,18 +100,18 @@ CODE_SAMPLE while ($previousTokenPos >= 0) { $token = $oldTokens[$previousTokenPos] ?? null; --$previousTokenPos; - if (!isset($token[0])) { - return $token === '('; + if ((string) $token === '(') { + return \true; } - if (!\in_array($token[0], [\T_COMMENT, \T_WHITESPACE], \true)) { - return $token === '('; + if (!\in_array((string) $token, [\T_COMMENT, \T_WHITESPACE], \true)) { + continue; } } return \false; } /** * @param Assign[] $assigns - * @return Node\Stmt[]|null + * @return Expression[]|null */ private function refactorAssign(array $assigns, Expression $expression) : ?array { @@ -148,7 +146,7 @@ CODE_SAMPLE return null; } /** - * @return Node\Stmt[]|null + * @return Expression[]|null */ private function refactorInstanceof(Instanceof_ $instanceof, Expression $expression) : ?array { diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/NullsafeMethodCall/DowngradeNullsafeToTernaryOperatorRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/NullsafeMethodCall/DowngradeNullsafeToTernaryOperatorRector.php index c5aa00890c8..a8b61d5c2e9 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/NullsafeMethodCall/DowngradeNullsafeToTernaryOperatorRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/NullsafeMethodCall/DowngradeNullsafeToTernaryOperatorRector.php @@ -19,10 +19,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; */ final class DowngradeNullsafeToTernaryOperatorRector extends AbstractRector { - /** - * @var int - */ - private $counter = 0; + private int $counter = 0; /** * Hack-ish way to reset counter for a new file, to avoid rising counter for each file * @@ -54,7 +51,7 @@ CODE_SAMPLE /** * @param NullsafeMethodCall|NullsafePropertyFetch $node */ - public function refactor(Node $node) : ?Ternary + public function refactor(Node $node) : Ternary { $nullsafeVariable = $this->createNullsafeVariable(); $methodCallOrPropertyFetch = $node instanceof NullsafeMethodCall ? new MethodCall($nullsafeVariable, $node->name, $node->getArgs()) : new PropertyFetch($nullsafeVariable, $node->name); diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Property/DowngradeMixedTypeTypedPropertyRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Property/DowngradeMixedTypeTypedPropertyRector.php index 97048672134..2f067e8e17a 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Property/DowngradeMixedTypeTypedPropertyRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Property/DowngradeMixedTypeTypedPropertyRector.php @@ -17,9 +17,8 @@ final class DowngradeMixedTypeTypedPropertyRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\PropertyDecorator */ - private $PropertyDecorator; + private PropertyDecorator $PropertyDecorator; public function __construct(PropertyDecorator $PropertyDecorator) { $this->PropertyDecorator = $PropertyDecorator; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Property/DowngradeUnionTypeTypedPropertyRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Property/DowngradeUnionTypeTypedPropertyRector.php index 359d3050cb8..b3d4b138c75 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Property/DowngradeUnionTypeTypedPropertyRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Property/DowngradeUnionTypeTypedPropertyRector.php @@ -17,9 +17,8 @@ final class DowngradeUnionTypeTypedPropertyRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\PropertyDecorator */ - private $PropertyDecorator; + private PropertyDecorator $PropertyDecorator; public function __construct(PropertyDecorator $PropertyDecorator) { $this->PropertyDecorator = $PropertyDecorator; @@ -67,7 +66,7 @@ CODE_SAMPLE } private function shouldRemoveProperty(Property $property) : bool { - if ($property->type === null) { + if (!$property->type instanceof Node) { return \false; } // Check it is the union type diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/StaticCall/DowngradePhpTokenRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/StaticCall/DowngradePhpTokenRector.php index a21cbea35fd..445413d21ae 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/StaticCall/DowngradePhpTokenRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/StaticCall/DowngradePhpTokenRector.php @@ -12,7 +12,7 @@ use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PHPStan\Type\ObjectType; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -85,7 +85,7 @@ CODE_SAMPLE return null; } $isArrayFuncCall = new FuncCall(new Name('is_array'), [new Arg($methodCall->var)]); - $arrayDimFetch = new ArrayDimFetch($methodCall->var, new LNumber(0)); + $arrayDimFetch = new ArrayDimFetch($methodCall->var, new Int_(0)); $tokenGetNameFuncCall = new FuncCall(new Name('token_name'), [new Arg($arrayDimFetch)]); return new Ternary($isArrayFuncCall, $tokenGetNameFuncCall, $this->nodeFactory->createNull()); } @@ -99,7 +99,7 @@ CODE_SAMPLE return null; } $isArrayFuncCall = new FuncCall(new Name('is_array'), [new Arg($propertyFetch->var)]); - $arrayDimFetch = new ArrayDimFetch($propertyFetch->var, $propertyFetchName === 'id' ? new LNumber(0) : new LNumber(1)); + $arrayDimFetch = new ArrayDimFetch($propertyFetch->var, $propertyFetchName === 'id' ? new Int_(0) : new Int_(1)); return new Ternary($isArrayFuncCall, $arrayDimFetch, $propertyFetch->var); } } diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Reflection/DefaultParameterValueResolver.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Reflection/DefaultParameterValueResolver.php index 762537200b1..3fbb7bfc2ba 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Reflection/DefaultParameterValueResolver.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Reflection/DefaultParameterValueResolver.php @@ -10,7 +10,9 @@ use PhpParser\Node\Name; use PHPStan\Reflection\ParameterReflection; use PHPStan\Type\Constant\ConstantArrayType; use PHPStan\Type\Constant\ConstantBooleanType; -use PHPStan\Type\ConstantType; +use PHPStan\Type\Constant\ConstantIntegerType; +use PHPStan\Type\Constant\ConstantStringType; +use PHPStan\Type\NullType; use PHPStan\Type\Type; use PHPStan\Type\VerbosityLevel; use Rector\Exception\ShouldNotHappenException; @@ -22,7 +24,7 @@ final class DefaultParameterValueResolver if (!$defaultValueType instanceof Type) { return null; } - if (!$defaultValueType instanceof ConstantType) { + if (!$defaultValueType->isConstantValue()->yes()) { throw new ShouldNotHappenException(); } return $this->resolveValueFromType($defaultValueType); @@ -30,7 +32,7 @@ final class DefaultParameterValueResolver /** * @return \PhpParser\Node\Expr\ConstFetch|\PhpParser\Node\Expr */ - private function resolveValueFromType(ConstantType $constantType) + private function resolveValueFromType(Type $constantType) { if ($constantType instanceof ConstantBooleanType) { return $this->resolveConstantBooleanType($constantType); @@ -38,13 +40,14 @@ final class DefaultParameterValueResolver if ($constantType instanceof ConstantArrayType) { $values = []; foreach ($constantType->getValueTypes() as $valueType) { - if (!$valueType instanceof ConstantType) { + if (!$valueType->isConstantValue()->yes()) { throw new ShouldNotHappenException(); } $values[] = $this->resolveValueFromType($valueType); } return BuilderHelpers::normalizeValue($values); } + /** @var ConstantStringType|ConstantIntegerType|NullType $constantType */ return BuilderHelpers::normalizeValue($constantType->getValue()); } private function resolveConstantBooleanType(ConstantBooleanType $constantBooleanType) : ConstFetch diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Reflection/SimplePhpParameterReflection.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Reflection/SimplePhpParameterReflection.php index ac8e281c0c8..b40c953051e 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Reflection/SimplePhpParameterReflection.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/Reflection/SimplePhpParameterReflection.php @@ -15,9 +15,8 @@ final class SimplePhpParameterReflection implements ParameterReflection { /** * @readonly - * @var \ReflectionParameter */ - private $reflectionParameter; + private ReflectionParameter $reflectionParameter; public function __construct(ReflectionFunction $reflectionFunction, int $position) { $this->reflectionParameter = $reflectionFunction->getParameters()[$position]; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/ValueObject/DowngradeAttributeToAnnotation.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/ValueObject/DowngradeAttributeToAnnotation.php index 50c9bd2ecb4..78d8781a555 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/ValueObject/DowngradeAttributeToAnnotation.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp80/ValueObject/DowngradeAttributeToAnnotation.php @@ -9,12 +9,12 @@ final class DowngradeAttributeToAnnotation * @var class-string * @readonly */ - private $attributeClass; + private string $attributeClass; /** * @var class-string|string|null * @readonly */ - private $tag; + private ?string $tag = null; /** * @param class-string $attributeClass * @param class-string|string|null $tag diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/NodeAnalyzer/ArraySpreadAnalyzer.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/NodeAnalyzer/ArraySpreadAnalyzer.php index 53af84a5661..64faa55c49b 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/NodeAnalyzer/ArraySpreadAnalyzer.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/NodeAnalyzer/ArraySpreadAnalyzer.php @@ -3,8 +3,8 @@ declare (strict_types=1); namespace Rector\DowngradePhp81\NodeAnalyzer; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; final class ArraySpreadAnalyzer { public function isArrayWithUnpack(Array_ $array) : bool diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/NodeFactory/ArrayMergeFromArraySpreadFactory.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/NodeFactory/ArrayMergeFromArraySpreadFactory.php index fb2f86fa27f..90314d5aebd 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/NodeFactory/ArrayMergeFromArraySpreadFactory.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/NodeFactory/ArrayMergeFromArraySpreadFactory.php @@ -3,16 +3,14 @@ declare (strict_types=1); namespace Rector\DowngradePhp81\NodeFactory; -use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name; use PHPStan\Analyser\MutatingScope; -use PHPStan\Type\ArrayType; use PHPStan\Type\IterableType; use PHPStan\Type\ObjectType; use PHPStan\Type\Type; @@ -23,14 +21,13 @@ final class ArrayMergeFromArraySpreadFactory { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; } - public function createFromArray(Array_ $array, MutatingScope $mutatingScope) : ?Node + public function createFromArray(Array_ $array, MutatingScope $mutatingScope) : FuncCall { $newArrayItems = $this->disolveArrayItems($array); return $this->createArrayMergeFuncCall($newArrayItems, $mutatingScope); @@ -79,12 +76,12 @@ final class ArrayMergeFromArraySpreadFactory $arrayItem->unpack = \false; return $this->createArgFromSpreadArrayItem($mutatingScope, $arrayItem); } - return new Arg($arrayItem); + return new Arg($arrayItem->value); }, $arrayItems); return new FuncCall(new Name('array_merge'), $args); } /** - * @param array $items + * @param array $items */ private function createArrayItemFromArray(array $items) : ArrayItem { @@ -109,20 +106,20 @@ final class ArrayMergeFromArraySpreadFactory throw new ShouldNotHappenException(); } } - $iteratorToArrayFuncCall = new FuncCall(new Name('iterator_to_array'), [new Arg($arrayItem)]); + $iteratorToArrayFuncCall = new FuncCall(new Name('iterator_to_array'), [new Arg($arrayItem->value)]); // If we know it is an array, then print it directly // Otherwise PHPStan throws an error: // "Else branch is unreachable because ternary operator condition is always true." - if ($type instanceof ArrayType) { - return new Arg($arrayItem); + if ($type->isArray()->yes()) { + return new Arg($arrayItem->value); } // If it is iterable, then directly return `iterator_to_array` if ($this->isIterableType($type)) { return new Arg($iteratorToArrayFuncCall); } // Print a ternary, handling either an array or an iterator - $inArrayFuncCall = new FuncCall(new Name('is_array'), [new Arg($arrayItem)]); - return new Arg(new Ternary($inArrayFuncCall, $arrayItem, $iteratorToArrayFuncCall)); + $inArrayFuncCall = new FuncCall(new Name('is_array'), [new Arg($arrayItem->value)]); + return new Arg(new Ternary($inArrayFuncCall, $arrayItem->value, $iteratorToArrayFuncCall)); } /** * Iterables: objects declaring the interface Traversable, diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/NodeManipulator/ObjectToResourceReturn.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/NodeManipulator/ObjectToResourceReturn.php index 09375299543..df42726b1dc 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/NodeManipulator/ObjectToResourceReturn.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/NodeManipulator/ObjectToResourceReturn.php @@ -20,29 +20,24 @@ final class ObjectToResourceReturn { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\PhpParser\Comparing\NodeComparator */ - private $nodeComparator; + private NodeComparator $nodeComparator; /** * @var string */ diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php index de091f718a8..2d2575c54f5 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/Array_/DowngradeArraySpreadStringKeyRector.php @@ -4,11 +4,14 @@ declare (strict_types=1); namespace Rector\DowngradePhp81\Rector\Array_; use PhpParser\Node; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PHPStan\Analyser\MutatingScope; use PHPStan\Type\ArrayType; +use PHPStan\Type\Constant\ConstantArrayType; use PHPStan\Type\IntegerType; +use PHPStan\Type\IntersectionType; +use PHPStan\Type\UnionType; use Rector\DowngradePhp81\NodeAnalyzer\ArraySpreadAnalyzer; use Rector\DowngradePhp81\NodeFactory\ArrayMergeFromArraySpreadFactory; use Rector\PHPStan\ScopeFetcher; @@ -24,14 +27,12 @@ final class DowngradeArraySpreadStringKeyRector extends AbstractRector { /** * @readonly - * @var \Rector\DowngradePhp81\NodeFactory\ArrayMergeFromArraySpreadFactory */ - private $arrayMergeFromArraySpreadFactory; + private ArrayMergeFromArraySpreadFactory $arrayMergeFromArraySpreadFactory; /** * @readonly - * @var \Rector\DowngradePhp81\NodeAnalyzer\ArraySpreadAnalyzer */ - private $arraySpreadAnalyzer; + private ArraySpreadAnalyzer $arraySpreadAnalyzer; public function __construct(ArrayMergeFromArraySpreadFactory $arrayMergeFromArraySpreadFactory, ArraySpreadAnalyzer $arraySpreadAnalyzer) { $this->arrayMergeFromArraySpreadFactory = $arrayMergeFromArraySpreadFactory; @@ -82,9 +83,16 @@ CODE_SAMPLE continue; } $type = $this->nodeTypeResolver->getType($item->value); - if (!$type instanceof ArrayType) { + if (!$type->isArray()->yes()) { continue; } + if ($type instanceof UnionType) { + continue; + } + if ($type instanceof IntersectionType) { + continue; + } + /** @var ArrayType|ConstantArrayType $type */ $keyType = $type->getKeyType(); if ($keyType instanceof IntegerType) { return \true; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/ClassConst/DowngradeFinalizePublicClassConstantRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/ClassConst/DowngradeFinalizePublicClassConstantRector.php index 82b215bfcfe..e6b765a0540 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/ClassConst/DowngradeFinalizePublicClassConstantRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/ClassConst/DowngradeFinalizePublicClassConstantRector.php @@ -18,9 +18,8 @@ final class DowngradeFinalizePublicClassConstantRector extends AbstractRector { /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; public function __construct(VisibilityManipulator $visibilityManipulator) { $this->visibilityManipulator = $visibilityManipulator; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector.php index 03e10f8b069..2427b51231f 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FuncCall/DowngradeArrayIsListRector.php @@ -31,18 +31,13 @@ final class DowngradeArrayIsListRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Parser\InlineCodeParser */ - private $inlineCodeParser; + private InlineCodeParser $inlineCodeParser; /** * @readonly - * @var \Rector\NodeAnalyzer\ExprInTopStmtMatcher */ - private $exprInTopStmtMatcher; - /** - * @var \PhpParser\Node\Expr\Closure|null - */ - private $cachedClosure; + private ExprInTopStmtMatcher $exprInTopStmtMatcher; + private ?Closure $cachedClosure = null; public function __construct(InlineCodeParser $inlineCodeParser, ExprInTopStmtMatcher $exprInTopStmtMatcher) { $this->inlineCodeParser = $inlineCodeParser; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FuncCall/DowngradeFirstClassCallableSyntaxRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FuncCall/DowngradeFirstClassCallableSyntaxRector.php index 6ecb44ee195..69c3aeef801 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FuncCall/DowngradeFirstClassCallableSyntaxRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FuncCall/DowngradeFirstClassCallableSyntaxRector.php @@ -5,9 +5,9 @@ namespace Rector\DowngradePhp81\Rector\FuncCall; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\MethodCall; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FuncCall/DowngradeHashAlgorithmXxHashRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FuncCall/DowngradeHashAlgorithmXxHashRector.php index 1c6dbe49b84..b00fa7b1607 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FuncCall/DowngradeHashAlgorithmXxHashRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FuncCall/DowngradeHashAlgorithmXxHashRector.php @@ -20,20 +20,15 @@ final class DowngradeHashAlgorithmXxHashRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\ArgsAnalyzer */ - private $argsAnalyzer; + private ArgsAnalyzer $argsAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; private const HASH_ALGORITHMS_TO_DOWNGRADE = ['xxh32' => \MHASH_XXH32, 'xxh64' => \MHASH_XXH64, 'xxh3' => \MHASH_XXH3, 'xxh128' => \MHASH_XXH128]; private const REPLACEMENT_ALGORITHM = 'md5'; - /** - * @var int - */ - private $argNamedKey; + private int $argNamedKey; public function __construct(ArgsAnalyzer $argsAnalyzer, ValueResolver $valueResolver) { $this->argsAnalyzer = $argsAnalyzer; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FunctionLike/DowngradeNeverTypeDeclarationRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FunctionLike/DowngradeNeverTypeDeclarationRector.php index 1a6b1d3140c..47c534c15ac 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FunctionLike/DowngradeNeverTypeDeclarationRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FunctionLike/DowngradeNeverTypeDeclarationRector.php @@ -21,9 +21,8 @@ final class DowngradeNeverTypeDeclarationRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpDocDecorator\PhpDocFromTypeDeclarationDecorator */ - private $phpDocFromTypeDeclarationDecorator; + private PhpDocFromTypeDeclarationDecorator $phpDocFromTypeDeclarationDecorator; public function __construct(PhpDocFromTypeDeclarationDecorator $phpDocFromTypeDeclarationDecorator) { $this->phpDocFromTypeDeclarationDecorator = $phpDocFromTypeDeclarationDecorator; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FunctionLike/DowngradeNewInInitializerRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FunctionLike/DowngradeNewInInitializerRector.php index 221c200b64b..5bb5053d1cc 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FunctionLike/DowngradeNewInInitializerRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FunctionLike/DowngradeNewInInitializerRector.php @@ -42,14 +42,12 @@ final class DowngradeNewInInitializerRector extends AbstractRector { /** * @readonly - * @var \Rector\Php72\NodeFactory\AnonymousFunctionFactory */ - private $anonymousFunctionFactory; + private AnonymousFunctionFactory $anonymousFunctionFactory; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(AnonymousFunctionFactory $anonymousFunctionFactory, BetterNodeFinder $betterNodeFinder) { $this->anonymousFunctionFactory = $anonymousFunctionFactory; @@ -162,7 +160,7 @@ CODE_SAMPLE if ($functionLike->stmts === null) { return $functionLike; } - $functionLike->stmts = $functionLike->stmts ?? []; + $functionLike->stmts ??= []; $functionLike->stmts = \array_merge($stmts, $functionLike->stmts); return $functionLike; } diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FunctionLike/DowngradePureIntersectionTypeRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FunctionLike/DowngradePureIntersectionTypeRector.php index 3db3819997b..4f1ee9eb163 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FunctionLike/DowngradePureIntersectionTypeRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/FunctionLike/DowngradePureIntersectionTypeRector.php @@ -22,9 +22,8 @@ final class DowngradePureIntersectionTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpDocDecorator\PhpDocFromTypeDeclarationDecorator */ - private $phpDocFromTypeDeclarationDecorator; + private PhpDocFromTypeDeclarationDecorator $phpDocFromTypeDeclarationDecorator; public function __construct(PhpDocFromTypeDeclarationDecorator $phpDocFromTypeDeclarationDecorator) { $this->phpDocFromTypeDeclarationDecorator = $phpDocFromTypeDeclarationDecorator; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/Instanceof_/DowngradePhp81ResourceReturnToObjectRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/Instanceof_/DowngradePhp81ResourceReturnToObjectRector.php index d60443e2da9..eaeea933c12 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/Instanceof_/DowngradePhp81ResourceReturnToObjectRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/Instanceof_/DowngradePhp81ResourceReturnToObjectRector.php @@ -20,9 +20,8 @@ final class DowngradePhp81ResourceReturnToObjectRector extends AbstractRector { /** * @readonly - * @var \Rector\DowngradePhp81\NodeManipulator\ObjectToResourceReturn */ - private $objectToResourceReturn; + private ObjectToResourceReturn $objectToResourceReturn; /** * @var string[]|class-string[] */ diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/LNumber/DowngradeOctalNumberRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/LNumber/DowngradeOctalNumberRector.php index e7327bbcb09..ce14559fd88 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/LNumber/DowngradeOctalNumberRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/LNumber/DowngradeOctalNumberRector.php @@ -4,7 +4,7 @@ declare (strict_types=1); namespace Rector\DowngradePhp81\Rector\LNumber; use PhpParser\Node; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -43,15 +43,15 @@ CODE_SAMPLE */ public function getNodeTypes() : array { - return [LNumber::class]; + return [Int_::class]; } /** - * @param LNumber $node + * @param Int_ $node */ public function refactor(Node $node) : ?Node { $numberKind = $node->getAttribute(AttributeKey::KIND); - if ($numberKind !== LNumber::KIND_OCT) { + if ($numberKind !== Int_::KIND_OCT) { return null; } /** @var string $rawValue */ diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/Property/DowngradeReadonlyPropertyRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/Property/DowngradeReadonlyPropertyRector.php index 0fd53dc966e..f6d1baff208 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/Property/DowngradeReadonlyPropertyRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp81/Rector/Property/DowngradeReadonlyPropertyRector.php @@ -23,19 +23,16 @@ final class DowngradeReadonlyPropertyRector extends AbstractRector { /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var string */ diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp82/Rector/Class_/DowngradeReadonlyClassRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp82/Rector/Class_/DowngradeReadonlyClassRector.php index 91813f571e4..95997ded365 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp82/Rector/Class_/DowngradeReadonlyClassRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp82/Rector/Class_/DowngradeReadonlyClassRector.php @@ -20,9 +20,8 @@ final class DowngradeReadonlyClassRector extends AbstractRector { /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; public function __construct(VisibilityManipulator $visibilityManipulator) { $this->visibilityManipulator = $visibilityManipulator; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp82/Rector/FunctionLike/DowngradeStandaloneNullTrueFalseReturnTypeRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp82/Rector/FunctionLike/DowngradeStandaloneNullTrueFalseReturnTypeRector.php index c1764f7d563..44fdd204075 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp82/Rector/FunctionLike/DowngradeStandaloneNullTrueFalseReturnTypeRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp82/Rector/FunctionLike/DowngradeStandaloneNullTrueFalseReturnTypeRector.php @@ -32,19 +32,16 @@ final class DowngradeStandaloneNullTrueFalseReturnTypeRector extends AbstractRec { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, PhpDocTypeChanger $phpDocTypeChanger, AstResolver $astResolver) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/vendor/rector/rector-downgrade-php/rules/DowngradePhp83/Rector/ClassConst/DowngradeTypedClassConstRector.php b/vendor/rector/rector-downgrade-php/rules/DowngradePhp83/Rector/ClassConst/DowngradeTypedClassConstRector.php index cf2422938de..50fd451b824 100644 --- a/vendor/rector/rector-downgrade-php/rules/DowngradePhp83/Rector/ClassConst/DowngradeTypedClassConstRector.php +++ b/vendor/rector/rector-downgrade-php/rules/DowngradePhp83/Rector/ClassConst/DowngradeTypedClassConstRector.php @@ -18,9 +18,8 @@ final class DowngradeTypedClassConstRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeManipulator\PropertyDecorator */ - private $propertyDecorator; + private PropertyDecorator $propertyDecorator; public function __construct(PropertyDecorator $propertyDecorator) { $this->propertyDecorator = $propertyDecorator; diff --git a/vendor/rector/rector-downgrade-php/src/NodeAnalyzer/DefineFuncCallAnalyzer.php b/vendor/rector/rector-downgrade-php/src/NodeAnalyzer/DefineFuncCallAnalyzer.php index ea698be674f..afa6738653a 100644 --- a/vendor/rector/rector-downgrade-php/src/NodeAnalyzer/DefineFuncCallAnalyzer.php +++ b/vendor/rector/rector-downgrade-php/src/NodeAnalyzer/DefineFuncCallAnalyzer.php @@ -11,9 +11,8 @@ final class DefineFuncCallAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-downgrade-php/src/NodeAnalyzer/ExprInTopStmtMatcher.php b/vendor/rector/rector-downgrade-php/src/NodeAnalyzer/ExprInTopStmtMatcher.php index 8ff61ea54ea..c9dca00bd9e 100644 --- a/vendor/rector/rector-downgrade-php/src/NodeAnalyzer/ExprInTopStmtMatcher.php +++ b/vendor/rector/rector-downgrade-php/src/NodeAnalyzer/ExprInTopStmtMatcher.php @@ -27,9 +27,8 @@ final class ExprInTopStmtMatcher { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(BetterNodeFinder $betterNodeFinder) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/vendor/rector/rector-downgrade-php/src/NodeFactory/ClassFromEnumFactory.php b/vendor/rector/rector-downgrade-php/src/NodeFactory/ClassFromEnumFactory.php index 0c95ad0968b..0c0af6d7a9f 100644 --- a/vendor/rector/rector-downgrade-php/src/NodeFactory/ClassFromEnumFactory.php +++ b/vendor/rector/rector-downgrade-php/src/NodeFactory/ClassFromEnumFactory.php @@ -16,9 +16,8 @@ final class ClassFromEnumFactory { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-downgrade-php/src/NodeFactory/DoctrineAnnotationFactory.php b/vendor/rector/rector-downgrade-php/src/NodeFactory/DoctrineAnnotationFactory.php index 5b3905a8565..5a3daf9eb49 100644 --- a/vendor/rector/rector-downgrade-php/src/NodeFactory/DoctrineAnnotationFactory.php +++ b/vendor/rector/rector-downgrade-php/src/NodeFactory/DoctrineAnnotationFactory.php @@ -15,9 +15,8 @@ final class DoctrineAnnotationFactory { /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; public function __construct(BetterStandardPrinter $betterStandardPrinter) { $this->betterStandardPrinter = $betterStandardPrinter; diff --git a/vendor/rector/rector-downgrade-php/src/NodeFactory/NamedVariableFactory.php b/vendor/rector/rector-downgrade-php/src/NodeFactory/NamedVariableFactory.php index 194b07a7538..2478e0377b2 100644 --- a/vendor/rector/rector-downgrade-php/src/NodeFactory/NamedVariableFactory.php +++ b/vendor/rector/rector-downgrade-php/src/NodeFactory/NamedVariableFactory.php @@ -11,9 +11,8 @@ final class NamedVariableFactory { /** * @readonly - * @var \Rector\Naming\Naming\VariableNaming */ - private $variableNaming; + private VariableNaming $variableNaming; public function __construct(VariableNaming $variableNaming) { $this->variableNaming = $variableNaming; diff --git a/vendor/rector/rector-downgrade-php/src/NodeManipulator/PropertyDecorator.php b/vendor/rector/rector-downgrade-php/src/NodeManipulator/PropertyDecorator.php index b97fe2b6331..991d87b98bc 100644 --- a/vendor/rector/rector-downgrade-php/src/NodeManipulator/PropertyDecorator.php +++ b/vendor/rector/rector-downgrade-php/src/NodeManipulator/PropertyDecorator.php @@ -16,19 +16,16 @@ final class PropertyDecorator { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper, PhpDocTypeChanger $phpDocTypeChanger) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/vendor/rector/rector-downgrade-php/src/PhpDocDecorator/PhpDocFromTypeDeclarationDecorator.php b/vendor/rector/rector-downgrade-php/src/PhpDocDecorator/PhpDocFromTypeDeclarationDecorator.php index f5f7cf27b38..bb075b36195 100644 --- a/vendor/rector/rector-downgrade-php/src/PhpDocDecorator/PhpDocFromTypeDeclarationDecorator.php +++ b/vendor/rector/rector-downgrade-php/src/PhpDocDecorator/PhpDocFromTypeDeclarationDecorator.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\PhpDocDecorator; +use PhpParser\Node; use PhpParser\Node\ComplexType; use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\Expr\Closure; @@ -38,48 +39,40 @@ final class PhpDocFromTypeDeclarationDecorator { /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @var ClassMethodWillChangeReturnType[] */ - private $classMethodWillChangeReturnTypes = []; + private array $classMethodWillChangeReturnTypes = []; public function __construct(StaticTypeMapper $staticTypeMapper, PhpDocInfoFactory $phpDocInfoFactory, NodeNameResolver $nodeNameResolver, PhpDocTypeChanger $phpDocTypeChanger, PhpAttributeGroupFactory $phpAttributeGroupFactory, ReflectionResolver $reflectionResolver, PhpAttributeAnalyzer $phpAttributeAnalyzer, PhpVersionProvider $phpVersionProvider) { $this->staticTypeMapper = $staticTypeMapper; @@ -132,7 +125,7 @@ final class PhpDocFromTypeDeclarationDecorator */ public function decorateParam(Param $param, $functionLike, array $requiredTypes) : void { - if ($param->type === null) { + if (!$param->type instanceof Node) { return; } $type = $this->staticTypeMapper->mapPhpParserNodePHPStanType($param->type); @@ -150,7 +143,7 @@ final class PhpDocFromTypeDeclarationDecorator */ public function decorateParamWithSpecificType(Param $param, $functionLike, Type $requireType) : bool { - if ($param->type === null) { + if (!$param->type instanceof Node) { return \false; } if (!$this->isTypeMatch($param->type, $requireType)) { diff --git a/vendor/rector/rector-downgrade-php/src/ValueObject/ClassMethodWillChangeReturnType.php b/vendor/rector/rector-downgrade-php/src/ValueObject/ClassMethodWillChangeReturnType.php index cf06953710b..682f801badd 100644 --- a/vendor/rector/rector-downgrade-php/src/ValueObject/ClassMethodWillChangeReturnType.php +++ b/vendor/rector/rector-downgrade-php/src/ValueObject/ClassMethodWillChangeReturnType.php @@ -7,14 +7,12 @@ final class ClassMethodWillChangeReturnType { /** * @readonly - * @var string */ - private $className; + private string $className; /** * @readonly - * @var string */ - private $methodName; + private string $methodName; public function __construct(string $className, string $methodName) { $this->className = $className; diff --git a/vendor/rector/rector-phpunit/composer.json b/vendor/rector/rector-phpunit/composer.json index 12d8954e589..14278283cc7 100644 --- a/vendor/rector/rector-phpunit/composer.json +++ b/vendor/rector/rector-phpunit/composer.json @@ -9,17 +9,14 @@ "require-dev": { "rector\/rector-src": "dev-main", "phpunit\/phpunit": "^10.5", - "phpstan\/phpstan": "^1.12", - "symplify\/phpstan-rules": "^13.0", - "symplify\/phpstan-extensions": "^11.4", + "phpstan\/phpstan": "^2.0", "symplify\/easy-coding-standard": "^12.3", "phpstan\/extension-installer": "^1.4", - "phpstan\/phpstan-webmozart-assert": "^1.2", "symplify\/vendor-patches": "^11.3", "tracy\/tracy": "^2.10", "tomasvotruba\/class-leak": "^1.2", - "rector\/type-perfect": "^1.0", - "rector\/swiss-knife": "^1.0" + "rector\/swiss-knife": "^1.0", + "phpstan\/phpstan-webmozart-assert": "^2.0" }, "autoload": { "psr-4": { @@ -49,7 +46,7 @@ "@docs", "phpunit" ], - "phpstan": "vendor\/bin\/phpstan analyse --ansi --error-format symplify", + "phpstan": "vendor\/bin\/phpstan analyse --ansi", "check-cs": "vendor\/bin\/ecs check --ansi", "class-leak": "vendor\/bin\/class-leak check config src rules --skip-suffix \"Rector\"", "fix-cs": "vendor\/bin\/ecs check --fix --ansi", diff --git a/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector.php b/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector.php index edab0917701..5d309249bc5 100644 --- a/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector.php +++ b/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector.php @@ -9,6 +9,7 @@ use PhpParser\Node\Stmt\ClassMethod; use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; use PHPStan\Reflection\ClassReflection; +use PHPStan\Reflection\ReflectionProvider; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover; @@ -28,35 +29,37 @@ final class DataProviderAnnotationToAttributeRector extends AbstractRector imple { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; - public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, PhpAttributeGroupFactory $phpAttributeGroupFactory, PhpDocTagRemover $phpDocTagRemover, ReflectionResolver $reflectionResolver, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) + private PhpDocInfoFactory $phpDocInfoFactory; + /** + * @readonly + */ + private ReflectionProvider $reflectionProvider; + /** + * @var string + */ + private const DATA_PROVIDER_CLASS = 'PHPUnit\\Framework\\Attributes\\DataProvider'; + public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, PhpAttributeGroupFactory $phpAttributeGroupFactory, PhpDocTagRemover $phpDocTagRemover, ReflectionResolver $reflectionResolver, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory, ReflectionProvider $reflectionProvider) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; $this->phpAttributeGroupFactory = $phpAttributeGroupFactory; @@ -64,6 +67,7 @@ final class DataProviderAnnotationToAttributeRector extends AbstractRector imple $this->reflectionResolver = $reflectionResolver; $this->docBlockUpdater = $docBlockUpdater; $this->phpDocInfoFactory = $phpDocInfoFactory; + $this->reflectionProvider = $reflectionProvider; } public function getRuleDefinition() : RuleDefinition { @@ -118,6 +122,9 @@ CODE_SAMPLE if (!$this->testsNodeAnalyzer->isInTestClass($node)) { return null; } + if (!$this->reflectionProvider->hasClass(self::DATA_PROVIDER_CLASS)) { + return null; + } $phpDocInfo = $this->phpDocInfoFactory->createFromNode($node); if (!$phpDocInfo instanceof PhpDocInfo) { return null; @@ -159,6 +166,6 @@ CODE_SAMPLE } return $this->phpAttributeGroupFactory->createFromClassWithItems('PHPUnit\\Framework\\Attributes\\DataProviderExternal', [$className . '::class', $methodName]); } - return $this->phpAttributeGroupFactory->createFromClassWithItems('PHPUnit\\Framework\\Attributes\\DataProvider', [$methodName]); + return $this->phpAttributeGroupFactory->createFromClassWithItems(self::DATA_PROVIDER_CLASS, [$methodName]); } } diff --git a/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/ClassMethod/DependsAnnotationWithValueToAttributeRector.php b/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/ClassMethod/DependsAnnotationWithValueToAttributeRector.php index 10272c943de..1490dd5ab26 100644 --- a/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/ClassMethod/DependsAnnotationWithValueToAttributeRector.php +++ b/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/ClassMethod/DependsAnnotationWithValueToAttributeRector.php @@ -8,6 +8,7 @@ use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; +use PHPStan\Reflection\ReflectionProvider; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover; @@ -26,36 +27,40 @@ final class DependsAnnotationWithValueToAttributeRector extends AbstractRector i { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; - public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, PhpAttributeGroupFactory $phpAttributeGroupFactory, PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) + private PhpDocInfoFactory $phpDocInfoFactory; + /** + * @readonly + */ + private ReflectionProvider $reflectionProvider; + /** + * @var string + */ + private const DEPENDS_ATTRIBUTE = 'PHPUnit\\Framework\\Attributes\\Depends'; + public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, PhpAttributeGroupFactory $phpAttributeGroupFactory, PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory, ReflectionProvider $reflectionProvider) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; $this->phpAttributeGroupFactory = $phpAttributeGroupFactory; $this->phpDocTagRemover = $phpDocTagRemover; $this->docBlockUpdater = $docBlockUpdater; $this->phpDocInfoFactory = $phpDocInfoFactory; + $this->reflectionProvider = $reflectionProvider; } public function getRuleDefinition() : RuleDefinition { @@ -108,6 +113,9 @@ CODE_SAMPLE if (!$this->testsNodeAnalyzer->isInTestClass($node)) { return null; } + if (!$this->reflectionProvider->hasClass(self::DEPENDS_ATTRIBUTE)) { + return null; + } $hasChanged = \false; foreach ($node->getMethods() as $classMethod) { $phpDocInfo = $this->phpDocInfoFactory->createFromNode($classMethod); @@ -157,7 +165,7 @@ CODE_SAMPLE { // process depends other ClassMethod $attributeValue = $this->resolveDependsClassMethod($currentClass, $currentMethodName, $originalAttributeValue); - $attributeName = 'PHPUnit\\Framework\\Attributes\\Depends'; + $attributeName = self::DEPENDS_ATTRIBUTE; if (!\is_string($attributeValue)) { // other: depends other Class_ $attributeValue = $this->resolveDependsClass($originalAttributeValue); diff --git a/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/ClassMethod/TestWithAnnotationToAttributeRector.php b/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/ClassMethod/TestWithAnnotationToAttributeRector.php index 148a2077513..1a325139933 100644 --- a/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/ClassMethod/TestWithAnnotationToAttributeRector.php +++ b/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/ClassMethod/TestWithAnnotationToAttributeRector.php @@ -8,6 +8,7 @@ use PhpParser\Node; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; +use PHPStan\Reflection\ReflectionProvider; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover; @@ -29,36 +30,40 @@ final class TestWithAnnotationToAttributeRector extends AbstractRector implement { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; - public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, PhpAttributeGroupFactory $phpAttributeGroupFactory, PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) + private PhpDocInfoFactory $phpDocInfoFactory; + /** + * @readonly + */ + private ReflectionProvider $reflectionProvider; + /** + * @var string + */ + private const TEST_WITH_ATTRIBUTE = 'PHPUnit\\Framework\\Attributes\\TestWith'; + public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, PhpAttributeGroupFactory $phpAttributeGroupFactory, PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory, ReflectionProvider $reflectionProvider) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; $this->phpAttributeGroupFactory = $phpAttributeGroupFactory; $this->phpDocTagRemover = $phpDocTagRemover; $this->docBlockUpdater = $docBlockUpdater; $this->phpDocInfoFactory = $phpDocInfoFactory; + $this->reflectionProvider = $reflectionProvider; } public function getRuleDefinition() : RuleDefinition { @@ -106,6 +111,10 @@ CODE_SAMPLE if (!$this->testsNodeAnalyzer->isTestClassMethod($node)) { return null; } + // make sure the attribute class exists + if (!$this->reflectionProvider->hasClass(self::TEST_WITH_ATTRIBUTE)) { + return null; + } $phpDocInfo = $this->phpDocInfoFactory->createFromNode($node); if (!$phpDocInfo instanceof PhpDocInfo) { return null; @@ -128,7 +137,7 @@ CODE_SAMPLE $testWithItems = \explode("\n", \trim($genericTagValueNode->value)); foreach ($testWithItems as $testWithItem) { $jsonArray = Json::decode(\trim($testWithItem), Json::FORCE_ARRAY); - $attributeGroups[] = $this->phpAttributeGroupFactory->createFromClassWithItems('PHPUnit\\Framework\\Attributes\\TestWith', [$jsonArray]); + $attributeGroups[] = $this->phpAttributeGroupFactory->createFromClassWithItems(self::TEST_WITH_ATTRIBUTE, [$jsonArray]); } } $this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node); diff --git a/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/AnnotationWithValueToAttributeRector.php b/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/AnnotationWithValueToAttributeRector.php index af81b0766ce..f23313a65b2 100644 --- a/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/AnnotationWithValueToAttributeRector.php +++ b/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/AnnotationWithValueToAttributeRector.php @@ -29,33 +29,28 @@ final class AnnotationWithValueToAttributeRector extends AbstractRector implemen { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var AnnotationWithValueToAttribute[] */ - private $annotationWithValueToAttributes = []; + private array $annotationWithValueToAttributes = []; public function __construct(PhpDocTagRemover $phpDocTagRemover, PhpAttributeGroupFactory $phpAttributeGroupFactory, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory, TestsNodeAnalyzer $testsNodeAnalyzer) { $this->phpDocTagRemover = $phpDocTagRemover; diff --git a/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/CoversAnnotationWithValueToAttributeRector.php b/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/CoversAnnotationWithValueToAttributeRector.php index e5330b18235..177b07f30c4 100644 --- a/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/CoversAnnotationWithValueToAttributeRector.php +++ b/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/CoversAnnotationWithValueToAttributeRector.php @@ -9,6 +9,7 @@ use PhpParser\Node\AttributeGroup; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode; +use PHPStan\Reflection\ReflectionProvider; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover; @@ -27,36 +28,44 @@ final class CoversAnnotationWithValueToAttributeRector extends AbstractRector im { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; - public function __construct(PhpDocTagRemover $phpDocTagRemover, PhpAttributeGroupFactory $phpAttributeGroupFactory, TestsNodeAnalyzer $testsNodeAnalyzer, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) + private PhpDocInfoFactory $phpDocInfoFactory; + /** + * @readonly + */ + private ReflectionProvider $reflectionProvider; + /** + * @var string + */ + private const COVERS_FUNCTION_ATTRIBUTE = 'PHPUnit\\Framework\\Attributes\\CoversFunction'; + /** + * @var string + */ + private const COVERTS_CLASS_ATTRIBUTE = 'PHPUnit\\Framework\\Attributes\\CoversClass'; + public function __construct(PhpDocTagRemover $phpDocTagRemover, PhpAttributeGroupFactory $phpAttributeGroupFactory, TestsNodeAnalyzer $testsNodeAnalyzer, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory, ReflectionProvider $reflectionProvider) { $this->phpDocTagRemover = $phpDocTagRemover; $this->phpAttributeGroupFactory = $phpAttributeGroupFactory; $this->testsNodeAnalyzer = $testsNodeAnalyzer; $this->docBlockUpdater = $docBlockUpdater; $this->phpDocInfoFactory = $phpDocInfoFactory; + $this->reflectionProvider = $reflectionProvider; } public function getRuleDefinition() : RuleDefinition { @@ -111,6 +120,9 @@ CODE_SAMPLE if (!$this->testsNodeAnalyzer->isInTestClass($node)) { return null; } + if (!$this->reflectionProvider->hasClass(self::COVERS_FUNCTION_ATTRIBUTE)) { + return null; + } if ($node instanceof Class_) { $coversAttributeGroups = $this->resolveClassAttributes($node); if ($coversAttributeGroups === []) { @@ -130,10 +142,10 @@ CODE_SAMPLE private function createAttributeGroup(string $annotationValue) : AttributeGroup { if (\strncmp($annotationValue, '::', \strlen('::')) === 0) { - $attributeClass = 'PHPUnit\\Framework\\Attributes\\CoversFunction'; + $attributeClass = self::COVERS_FUNCTION_ATTRIBUTE; $attributeValue = \trim($annotationValue, ':()'); } else { - $attributeClass = 'PHPUnit\\Framework\\Attributes\\CoversClass'; + $attributeClass = self::COVERTS_CLASS_ATTRIBUTE; $attributeValue = \trim($annotationValue) . '::class'; } return $this->phpAttributeGroupFactory->createFromClassWithItems($attributeClass, [$attributeValue]); diff --git a/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/TicketAnnotationToAttributeRector.php b/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/TicketAnnotationToAttributeRector.php index 0c5c7453c33..cab3939fe31 100644 --- a/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/TicketAnnotationToAttributeRector.php +++ b/vendor/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/TicketAnnotationToAttributeRector.php @@ -13,10 +13,12 @@ use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; +use PHPStan\Reflection\ReflectionProvider; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover; use Rector\Comments\NodeDocBlock\DocBlockUpdater; +use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer; use Rector\Rector\AbstractRector; use Rector\ValueObject\PhpVersionFeature; use Rector\VersionBonding\Contract\MinPhpVersionInterface; @@ -31,28 +33,35 @@ final class TicketAnnotationToAttributeRector extends AbstractRector implements { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; + /** + * @readonly + */ + private ReflectionProvider $reflectionProvider; + /** + * @readonly + */ + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var string */ private const TICKET_CLASS = 'PHPUnit\\Framework\\Attributes\\Ticket'; - public function __construct(PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) + public function __construct(PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory, ReflectionProvider $reflectionProvider, TestsNodeAnalyzer $testsNodeAnalyzer) { $this->phpDocTagRemover = $phpDocTagRemover; $this->docBlockUpdater = $docBlockUpdater; $this->phpDocInfoFactory = $phpDocInfoFactory; + $this->reflectionProvider = $reflectionProvider; + $this->testsNodeAnalyzer = $testsNodeAnalyzer; } public function getRuleDefinition() : RuleDefinition { @@ -93,6 +102,13 @@ CODE_SAMPLE */ public function refactor(Node $node) : ?Node { + if (!$this->testsNodeAnalyzer->isInTestClass($node)) { + return null; + } + // make sure the attribute class exists + if (!$this->reflectionProvider->hasClass(self::TICKET_CLASS)) { + return null; + } $phpDocInfo = $this->phpDocInfoFactory->createFromNode($node); if (!$phpDocInfo instanceof PhpDocInfo) { return null; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/NodeFactory/NestedClosureAssertFactory.php b/vendor/rector/rector-phpunit/rules/CodeQuality/NodeFactory/NestedClosureAssertFactory.php index 8eac3ac123c..77c2f9c4e08 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/NodeFactory/NestedClosureAssertFactory.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/NodeFactory/NestedClosureAssertFactory.php @@ -15,7 +15,7 @@ use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; use Rector\PHPUnit\Enum\ConsecutiveVariable; @@ -49,7 +49,7 @@ final class NestedClosureAssertFactory $callbackVariable = new Variable('callback'); $callbackAssign = new Assign($callbackVariable, $callableFirstArg->value); $stmts = [new Expression($callbackAssign)]; - $parametersArrayDimFetch = new ArrayDimFetch(new Variable('parameters'), new LNumber($assertKey)); + $parametersArrayDimFetch = new ArrayDimFetch(new Variable('parameters'), new Int_($assertKey)); $callbackFuncCall = new FuncCall($callbackVariable, [new Arg($parametersArrayDimFetch)]); // add assert true to the callback $assertTrueMethodCall = new MethodCall(new Variable('this'), 'assertTrue', [new Arg($callbackFuncCall)]); @@ -62,7 +62,7 @@ final class NestedClosureAssertFactory private function createAssertSameParameters(Expr $comparedExpr, int $assertKey) : array { // use assert same directly instead - $args = [new Arg($comparedExpr), new Arg(new ArrayDimFetch(new Variable('parameters'), new LNumber($assertKey)))]; + $args = [new Arg($comparedExpr), new Arg(new ArrayDimFetch(new Variable('parameters'), new Int_($assertKey)))]; $assertSameMethodCall = new MethodCall(new Variable('this'), new Identifier('assertSame'), $args); return [new Expression($assertSameMethodCall)]; } @@ -71,7 +71,7 @@ final class NestedClosureAssertFactory */ private function createAssertNotEmpty(int $assertKey, string $emptyMethodName) : array { - $arrayDimFetch = new ArrayDimFetch(new Variable(ConsecutiveVariable::PARAMETERS), new LNumber($assertKey)); + $arrayDimFetch = new ArrayDimFetch(new Variable(ConsecutiveVariable::PARAMETERS), new Int_($assertKey)); $assertEmptyMethodCall = new MethodCall(new Variable('this'), new Identifier($emptyMethodName), [new Arg($arrayDimFetch)]); return [new Expression($assertEmptyMethodCall)]; } diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/CreateMockToAnonymousClassRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/CreateMockToAnonymousClassRector.php index 55f7becd8ac..b0058896b60 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/CreateMockToAnonymousClassRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/CreateMockToAnonymousClassRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\PHPUnit\CodeQuality\Rector\ClassMethod; +use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Expr; @@ -31,9 +32,8 @@ final class CreateMockToAnonymousClassRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; @@ -197,6 +197,6 @@ CODE_SAMPLE throw new NotImplementedYetException(); } $returnedExpr = $methodCall->getArgs()[0]->value; - return new ClassMethod($methodName, ['flags' => Class_::MODIFIER_PUBLIC, 'stmts' => [new Return_($returnedExpr)]]); + return new ClassMethod($methodName, ['flags' => Modifiers::PUBLIC, 'stmts' => [new Return_($returnedExpr)]]); } } diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/DataProviderArrayItemsNewLinedRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/DataProviderArrayItemsNewLinedRector.php index 92648ccebda..b9f52c007bc 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/DataProviderArrayItemsNewLinedRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/DataProviderArrayItemsNewLinedRector.php @@ -4,8 +4,8 @@ declare (strict_types=1); namespace Rector\PHPUnit\CodeQuality\Rector\ClassMethod; use PhpParser\Node; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Return_; use Rector\NodeTypeResolver\Node\AttributeKey; @@ -21,14 +21,12 @@ final class DataProviderArrayItemsNewLinedRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, BetterNodeFinder $betterNodeFinder) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/EntityDocumentCreateMockToDirectNewRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/EntityDocumentCreateMockToDirectNewRector.php index 5048239dc3a..6d1a1bcab66 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/EntityDocumentCreateMockToDirectNewRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/EntityDocumentCreateMockToDirectNewRector.php @@ -30,19 +30,16 @@ final class EntityDocumentCreateMockToDirectNewRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\PHPUnit\CodeQuality\NodeAnalyser\DoctrineEntityDocumentAnalyser */ - private $doctrineEntityDocumentAnalyser; + private DoctrineEntityDocumentAnalyser $doctrineEntityDocumentAnalyser; public function __construct(ValueResolver $valueResolver, ReflectionProvider $reflectionProvider, DoctrineEntityDocumentAnalyser $doctrineEntityDocumentAnalyser) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/RemoveEmptyTestMethodRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/RemoveEmptyTestMethodRector.php index 9374b9c77af..876337ec4d0 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/RemoveEmptyTestMethodRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/RemoveEmptyTestMethodRector.php @@ -17,9 +17,8 @@ final class RemoveEmptyTestMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/ReplaceTestAnnotationWithPrefixedFunctionRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/ReplaceTestAnnotationWithPrefixedFunctionRector.php index 0f3f65b7c58..5216523d9f2 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/ReplaceTestAnnotationWithPrefixedFunctionRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/ReplaceTestAnnotationWithPrefixedFunctionRector.php @@ -20,24 +20,20 @@ final class ReplaceTestAnnotationWithPrefixedFunctionRector extends AbstractRect { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/ReplaceTestFunctionPrefixWithAttributeRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/ReplaceTestFunctionPrefixWithAttributeRector.php index d88971883e3..97109bd04d5 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/ReplaceTestFunctionPrefixWithAttributeRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/ReplaceTestFunctionPrefixWithAttributeRector.php @@ -19,19 +19,16 @@ final class ReplaceTestFunctionPrefixWithAttributeRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, PhpAttributeGroupFactory $phpAttributeGroupFactory, PhpAttributeAnalyzer $phpAttributeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/AddCoversClassAttributeRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/AddCoversClassAttributeRector.php index d2f28fc4cdf..29e96d50c81 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/AddCoversClassAttributeRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/AddCoversClassAttributeRector.php @@ -26,24 +26,20 @@ final class AddCoversClassAttributeRector extends AbstractRector { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(ReflectionProvider $reflectionProvider, PhpAttributeGroupFactory $phpAttributeGroupFactory, PhpAttributeAnalyzer $phpAttributeAnalyzer, TestsNodeAnalyzer $testsNodeAnalyzer) { $this->reflectionProvider = $reflectionProvider; @@ -119,9 +115,7 @@ CODE_SAMPLE $partCount = count($classNameParts); $classNameParts[$partCount - 1] = preg_replace(['#TestCase$#', '#Test$#'], '', $classNameParts[$partCount - 1]); $possibleTestClassNames = [implode('\\', $classNameParts)]; - $partsWithoutTests = array_filter($classNameParts, static function (?string $part) : bool { - return $part === null ? \false : !in_array(strtolower($part), ['test', 'tests'], \true); - }); + $partsWithoutTests = array_filter($classNameParts, static fn(?string $part): bool => $part === null ? \false : !in_array(strtolower($part), ['test', 'tests'], \true)); $possibleTestClassNames[] = implode('\\', $partsWithoutTests); return $possibleTestClassNames; } diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/AddParentSetupCallOnSetupRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/AddParentSetupCallOnSetupRector.php index 94c33d14cdf..669c9a77043 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/AddParentSetupCallOnSetupRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/AddParentSetupCallOnSetupRector.php @@ -23,14 +23,12 @@ final class AddParentSetupCallOnSetupRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, BetterNodeFinder $betterNodeFinder) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/AddSeeTestAnnotationRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/AddSeeTestAnnotationRector.php index 588c3c72834..790ee8afd58 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/AddSeeTestAnnotationRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/AddSeeTestAnnotationRector.php @@ -23,24 +23,20 @@ final class AddSeeTestAnnotationRector extends AbstractRector { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\PHPUnit\Naming\TestClassNameResolver */ - private $testClassNameResolver; + private TestClassNameResolver $testClassNameResolver; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var string */ diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/ConstructClassMethodToSetUpTestCaseRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/ConstructClassMethodToSetUpTestCaseRector.php index c4768264211..8ec72ac0dbd 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/ConstructClassMethodToSetUpTestCaseRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/ConstructClassMethodToSetUpTestCaseRector.php @@ -33,29 +33,24 @@ final class ConstructClassMethodToSetUpTestCaseRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\SetUpMethodDecorator */ - private $setUpMethodDecorator; + private SetUpMethodDecorator $setUpMethodDecorator; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, ClassAnalyzer $classAnalyzer, VisibilityManipulator $visibilityManipulator, SetUpMethodDecorator $setUpMethodDecorator, ReflectionResolver $reflectionResolver) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/NarrowUnusedSetUpDefinedPropertyRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/NarrowUnusedSetUpDefinedPropertyRector.php index 127072a1300..e549b39d783 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/NarrowUnusedSetUpDefinedPropertyRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/NarrowUnusedSetUpDefinedPropertyRector.php @@ -26,24 +26,20 @@ final class NarrowUnusedSetUpDefinedPropertyRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\NodeManipulator\PropertyManipulator */ - private $propertyManipulator; + private PropertyManipulator $propertyManipulator; /** * @readonly - * @var \PhpParser\NodeFinder */ - private $nodeFinder; + private NodeFinder $nodeFinder; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, ReflectionResolver $reflectionResolver, PropertyManipulator $propertyManipulator) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/PreferPHPUnitSelfCallRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/PreferPHPUnitSelfCallRector.php index 9a6e360a963..224673268a9 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/PreferPHPUnitSelfCallRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/PreferPHPUnitSelfCallRector.php @@ -21,14 +21,12 @@ final class PreferPHPUnitSelfCallRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, ReflectionResolver $reflectionResolver) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/PreferPHPUnitThisCallRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/PreferPHPUnitThisCallRector.php index 78fbf867c22..47182361832 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/PreferPHPUnitThisCallRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/PreferPHPUnitThisCallRector.php @@ -21,9 +21,8 @@ final class PreferPHPUnitThisCallRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var string[] */ diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/SetUpBeforeClassToSetUpRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/SetUpBeforeClassToSetUpRector.php index f59d7ae5fd8..d9a229558c6 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/SetUpBeforeClassToSetUpRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/SetUpBeforeClassToSetUpRector.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\PHPUnit\CodeQuality\Rector\Class_; +use PhpParser\Modifiers; use PhpParser\Node; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\PropertyFetch; @@ -23,9 +24,8 @@ final class SetUpBeforeClassToSetUpRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; @@ -117,18 +117,18 @@ CODE_SAMPLE return null; } // remove static flag - $setUpBeforeClassMethod->flags -= Class_::MODIFIER_STATIC; + $setUpBeforeClassMethod->flags -= Modifiers::STATIC; // remove public flag - $setUpBeforeClassMethod->flags -= Class_::MODIFIER_PUBLIC; + $setUpBeforeClassMethod->flags -= Modifiers::PUBLIC; // make protected - $setUpBeforeClassMethod->flags += Class_::MODIFIER_PROTECTED; + $setUpBeforeClassMethod->flags += Modifiers::PROTECTED; $setUpBeforeClassMethod->name = new Identifier('setUp'); foreach ($node->getProperties() as $property) { if (!$property->isStatic()) { continue; } if ($this->isNames($property, $changedPropertyNames)) { - $property->flags -= Class_::MODIFIER_STATIC; + $property->flags -= Modifiers::STATIC; } } // replace same property access in the class diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/SingleMockPropertyTypeRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/SingleMockPropertyTypeRector.php index 8504919f9bc..0ff09ab6ab2 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/SingleMockPropertyTypeRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/SingleMockPropertyTypeRector.php @@ -19,9 +19,8 @@ final class SingleMockPropertyTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/TestWithToDataProviderRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/TestWithToDataProviderRector.php index def48394056..c4ae630de3a 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/TestWithToDataProviderRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/TestWithToDataProviderRector.php @@ -5,10 +5,11 @@ namespace Rector\PHPUnit\CodeQuality\Rector\Class_; use RectorPrefix202411\Nette\Utils\Json; use RectorPrefix202411\Nette\Utils\Strings; +use PhpParser\Modifiers; use PhpParser\Node; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Name; use PhpParser\Node\Scalar\String_; @@ -33,33 +34,25 @@ final class TestWithToDataProviderRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\NodeManipulator\ClassInsertManipulator */ - private $classInsertManipulator; - /** - * @var bool - */ - private $hasChanged = \false; + private ClassInsertManipulator $classInsertManipulator; + private bool $hasChanged = \false; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, PhpDocInfoFactory $phpDocInfoFactory, PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, ClassInsertManipulator $classInsertManipulator) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; @@ -167,7 +160,7 @@ CODE_SAMPLE $returnValue = new Array_($arrayItemsSingleLine); } $providerMethod = new ClassMethod($dataProviderName); - $providerMethod->flags = Class_::MODIFIER_PUBLIC; + $providerMethod->flags = Modifiers::PUBLIC; $providerMethod->stmts[] = new Return_($returnValue); $this->classInsertManipulator->addAsFirstMethod($class, $providerMethod); } diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/YieldDataProviderRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/YieldDataProviderRector.php index fc13792ccf3..a60b53523e1 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/YieldDataProviderRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/Class_/YieldDataProviderRector.php @@ -30,29 +30,24 @@ final class YieldDataProviderRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\NodeTransformer */ - private $nodeTransformer; + private NodeTransformer $nodeTransformer; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PHPUnit\NodeFinder\DataProviderClassMethodFinder */ - private $dataProviderClassMethodFinder; + private DataProviderClassMethodFinder $dataProviderClassMethodFinder; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\DeadCode\NodeAnalyzer\IsClassMethodUsedAnalyzer */ - private $isClassMethodUsedAnalyzer; + private IsClassMethodUsedAnalyzer $isClassMethodUsedAnalyzer; public function __construct(NodeTransformer $nodeTransformer, TestsNodeAnalyzer $testsNodeAnalyzer, DataProviderClassMethodFinder $dataProviderClassMethodFinder, PhpDocInfoFactory $phpDocInfoFactory, IsClassMethodUsedAnalyzer $isClassMethodUsedAnalyzer) { $this->nodeTransformer = $nodeTransformer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCompareOnCountableWithMethodToAssertCountRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCompareOnCountableWithMethodToAssertCountRector.php index 5d2ba5e6b00..d89f5eb7128 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCompareOnCountableWithMethodToAssertCountRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCompareOnCountableWithMethodToAssertCountRector.php @@ -21,9 +21,8 @@ final class AssertCompareOnCountableWithMethodToAssertCountRector extends Abstra { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCompareToSpecificMethodRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCompareToSpecificMethodRector.php index d93e3835c41..04effb1428a 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCompareToSpecificMethodRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertCompareToSpecificMethodRector.php @@ -21,9 +21,8 @@ final class AssertCompareToSpecificMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var string */ @@ -35,7 +34,7 @@ final class AssertCompareToSpecificMethodRector extends AbstractRector /** * @var FunctionNameWithAssertMethods[] */ - private $functionNamesWithAssertMethods = []; + private array $functionNamesWithAssertMethods = []; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertComparisonToSpecificMethodRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertComparisonToSpecificMethodRector.php index dcacd4e4644..d3ccf1f97a6 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertComparisonToSpecificMethodRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertComparisonToSpecificMethodRector.php @@ -32,18 +32,16 @@ final class AssertComparisonToSpecificMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\IdentifierManipulator */ - private $identifierManipulator; + private IdentifierManipulator $identifierManipulator; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var BinaryOpWithAssertMethod[] */ - private $binaryOpWithAssertMethods = []; + private array $binaryOpWithAssertMethods = []; public function __construct(IdentifierManipulator $identifierManipulator, TestsNodeAnalyzer $testsNodeAnalyzer) { $this->identifierManipulator = $identifierManipulator; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector.php index 0d8eb71301a..58e62e17f8e 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector.php @@ -23,9 +23,8 @@ final class AssertEmptyNullableObjectToAssertInstanceofRector extends AbstractRe { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector.php index c233a6a8b08..ad988a7b8af 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector.php @@ -8,7 +8,7 @@ use PhpParser\Node\Arg; use PhpParser\Node\Expr\ConstFetch; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\DNumber; +use PhpParser\Node\Scalar\Float_; use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer; use Rector\PHPUnit\NodeFactory\AssertCallFactory; use Rector\Rector\AbstractRector; @@ -23,14 +23,12 @@ final class AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector ex { /** * @readonly - * @var \Rector\PHPUnit\NodeFactory\AssertCallFactory */ - private $assertCallFactory; + private AssertCallFactory $assertCallFactory; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(AssertCallFactory $assertCallFactory, TestsNodeAnalyzer $testsNodeAnalyzer) { $this->assertCallFactory = $assertCallFactory; @@ -72,7 +70,7 @@ CODE_SAMPLE } $args = $node->getArgs(); $firstValue = $args[0]->value; - if (!$firstValue instanceof DNumber) { + if (!$firstValue instanceof Float_) { return null; } $customMessageArg = $args[2] ?? null; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEqualsToSameRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEqualsToSameRector.php index 3555e982a40..78a0b0d05e5 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEqualsToSameRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertEqualsToSameRector.php @@ -8,7 +8,7 @@ use PhpParser\Node\Expr; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\StaticCall; -use PhpParser\Node\Scalar\Encapsed; +use PhpParser\Node\Scalar\InterpolatedString; use PHPStan\Type\Constant\ConstantArrayType; use PHPStan\Type\FloatType; use PHPStan\Type\IntegerType; @@ -26,14 +26,12 @@ final class AssertEqualsToSameRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\IdentifierManipulator */ - private $identifierManipulator; + private IdentifierManipulator $identifierManipulator; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var array */ @@ -131,7 +129,7 @@ final class AssertEqualsToSameRector extends AbstractRector if ($expr instanceof ClassConstFetch) { return \true; } - if ($expr instanceof Encapsed) { + if ($expr instanceof InterpolatedString) { return \true; } $valueNodeType = $this->nodeTypeResolver->getType($expr); diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertFalseStrposToContainsRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertFalseStrposToContainsRector.php index bbacd70cbd4..e550120d9ec 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertFalseStrposToContainsRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertFalseStrposToContainsRector.php @@ -19,14 +19,12 @@ final class AssertFalseStrposToContainsRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\IdentifierManipulator */ - private $identifierManipulator; + private IdentifierManipulator $identifierManipulator; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var array */ diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertInstanceOfComparisonRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertInstanceOfComparisonRector.php index 8f5ba519eed..c0641f6d54e 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertInstanceOfComparisonRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertInstanceOfComparisonRector.php @@ -22,14 +22,12 @@ final class AssertInstanceOfComparisonRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\IdentifierManipulator */ - private $identifierManipulator; + private IdentifierManipulator $identifierManipulator; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var array */ diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertIssetToSpecificMethodRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertIssetToSpecificMethodRector.php index 67befb730f8..5b5e28fcf23 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertIssetToSpecificMethodRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertIssetToSpecificMethodRector.php @@ -21,14 +21,12 @@ final class AssertIssetToSpecificMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\IdentifierManipulator */ - private $identifierManipulator; + private IdentifierManipulator $identifierManipulator; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(IdentifierManipulator $identifierManipulator, TestsNodeAnalyzer $testsNodeAnalyzer) { $this->identifierManipulator = $identifierManipulator; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertNotOperatorRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertNotOperatorRector.php index 220c5f26168..ccc247091bc 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertNotOperatorRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertNotOperatorRector.php @@ -20,14 +20,12 @@ final class AssertNotOperatorRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\IdentifierManipulator */ - private $identifierManipulator; + private IdentifierManipulator $identifierManipulator; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var array */ diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertPropertyExistsRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertPropertyExistsRector.php index 5b0c507a2c2..eb94e178f83 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertPropertyExistsRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertPropertyExistsRector.php @@ -22,14 +22,12 @@ final class AssertPropertyExistsRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\IdentifierManipulator */ - private $identifierManipulator; + private IdentifierManipulator $identifierManipulator; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var array */ diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertRegExpRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertRegExpRector.php index 1079f416461..8e3297e5205 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertRegExpRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertRegExpRector.php @@ -11,7 +11,7 @@ use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt\Expression; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\Exception\ShouldNotHappenException; @@ -28,19 +28,16 @@ final class AssertRegExpRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\NodeManipulator\StmtsManipulator */ - private $stmtsManipulator; + private StmtsManipulator $stmtsManipulator; /** * @var string */ @@ -128,7 +125,7 @@ final class AssertRegExpRector extends AbstractRector } private function resolveOldCondition(Expr $expr) : int { - if ($expr instanceof LNumber) { + if ($expr instanceof Int_) { return $expr->value; } if ($expr instanceof ConstFetch) { diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertSameBoolNullToSpecificMethodRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertSameBoolNullToSpecificMethodRector.php index 3d35193cd03..68eef02a2cf 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertSameBoolNullToSpecificMethodRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertSameBoolNullToSpecificMethodRector.php @@ -21,23 +21,20 @@ final class AssertSameBoolNullToSpecificMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\IdentifierManipulator */ - private $identifierManipulator; + private IdentifierManipulator $identifierManipulator; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\ArgumentMover */ - private $argumentMover; + private ArgumentMover $argumentMover; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var ConstantWithAssertMethods[] */ - private $constantWithAssertMethods = []; + private array $constantWithAssertMethods = []; public function __construct(IdentifierManipulator $identifierManipulator, ArgumentMover $argumentMover, TestsNodeAnalyzer $testsNodeAnalyzer) { $this->identifierManipulator = $identifierManipulator; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertSameTrueFalseToAssertTrueFalseRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertSameTrueFalseToAssertTrueFalseRector.php index 484dbce9932..93a6e22e534 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertSameTrueFalseToAssertTrueFalseRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertSameTrueFalseToAssertTrueFalseRector.php @@ -19,19 +19,16 @@ final class AssertSameTrueFalseToAssertTrueFalseRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\ArgumentMover */ - private $argumentMover; + private ArgumentMover $argumentMover; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ArgumentMover $argumentMover, TestsNodeAnalyzer $testsNodeAnalyzer, ValueResolver $valueResolver) { $this->argumentMover = $argumentMover; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertTrueFalseToSpecificMethodRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertTrueFalseToSpecificMethodRector.php index a836e0db93b..cf551f9f9d1 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertTrueFalseToSpecificMethodRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/AssertTrueFalseToSpecificMethodRector.php @@ -23,9 +23,8 @@ final class AssertTrueFalseToSpecificMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var array> */ diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/FlipAssertRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/FlipAssertRector.php index 93340e40f22..acbbb031d97 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/FlipAssertRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/FlipAssertRector.php @@ -20,9 +20,8 @@ final class FlipAssertRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/NarrowIdenticalWithConsecutiveRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/NarrowIdenticalWithConsecutiveRector.php index f8686a0d220..c00b3fd7e7e 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/NarrowIdenticalWithConsecutiveRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/NarrowIdenticalWithConsecutiveRector.php @@ -19,9 +19,8 @@ final class NarrowIdenticalWithConsecutiveRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/NarrowSingleWillReturnCallbackRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/NarrowSingleWillReturnCallbackRector.php index 9be1a239fc5..4dc37b45f81 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/NarrowSingleWillReturnCallbackRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/NarrowSingleWillReturnCallbackRector.php @@ -11,7 +11,7 @@ use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\Match_; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Return_; use Rector\PHPUnit\CodeQuality\ValueObject\MatchAndReturnMatch; @@ -26,9 +26,8 @@ final class NarrowSingleWillReturnCallbackRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; @@ -167,7 +166,7 @@ CODE_SAMPLE } private function isNumberOne(Expr $expr) : bool { - if (!$expr instanceof LNumber) { + if (!$expr instanceof Int_) { return \false; } return $expr->value === 1; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/RemoveExpectAnyFromMockRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/RemoveExpectAnyFromMockRector.php index 9d1f1967fc0..30c379999af 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/RemoveExpectAnyFromMockRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/RemoveExpectAnyFromMockRector.php @@ -18,9 +18,8 @@ final class RemoveExpectAnyFromMockRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/SingleWithConsecutiveToWithRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/SingleWithConsecutiveToWithRector.php index a218219023a..615ac196a6b 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/SingleWithConsecutiveToWithRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/SingleWithConsecutiveToWithRector.php @@ -20,14 +20,12 @@ final class SingleWithConsecutiveToWithRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, BetterNodeFinder $betterNodeFinder) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/UseSpecificWillMethodRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/UseSpecificWillMethodRector.php index 77ab4cde9c1..c03c56fe1c7 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/UseSpecificWillMethodRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/UseSpecificWillMethodRector.php @@ -20,9 +20,8 @@ final class UseSpecificWillMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var array */ diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/UseSpecificWithMethodRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/UseSpecificWithMethodRector.php index 670eff88268..407cb014cb3 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/UseSpecificWithMethodRector.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/MethodCall/UseSpecificWithMethodRector.php @@ -19,9 +19,8 @@ final class UseSpecificWithMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/ValueObject/MatchAndReturnMatch.php b/vendor/rector/rector-phpunit/rules/CodeQuality/ValueObject/MatchAndReturnMatch.php index b825247d2a3..ef5579b895b 100644 --- a/vendor/rector/rector-phpunit/rules/CodeQuality/ValueObject/MatchAndReturnMatch.php +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/ValueObject/MatchAndReturnMatch.php @@ -11,14 +11,12 @@ final class MatchAndReturnMatch { /** * @readonly - * @var \PhpParser\Node\Expr\Match_ */ - private $consecutiveMatch; + private Match_ $consecutiveMatch; /** * @readonly - * @var \PhpParser\Node\Expr\Match_|null */ - private $willReturnMatch; + private ?Match_ $willReturnMatch; public function __construct(Match_ $consecutiveMatch, ?Match_ $willReturnMatch) { $this->consecutiveMatch = $consecutiveMatch; diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit100/NodeFactory/WillReturnCallbackFactory.php b/vendor/rector/rector-phpunit/rules/PHPUnit100/NodeFactory/WillReturnCallbackFactory.php index aea1e40ef4a..ed708fdad91 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit100/NodeFactory/WillReturnCallbackFactory.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit100/NodeFactory/WillReturnCallbackFactory.php @@ -5,15 +5,15 @@ namespace Rector\PHPUnit\PHPUnit100\NodeFactory; use PhpParser\BuilderFactory; use PhpParser\Node\Arg; +use PhpParser\Node\ClosureUse; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node\Expr\BinaryOp\Minus; use PhpParser\Node\Expr\Closure; -use PhpParser\Node\Expr\ClosureUse; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Param; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; use Rector\PHPUnit\Enum\ConsecutiveVariable; @@ -24,24 +24,20 @@ final class WillReturnCallbackFactory { /** * @readonly - * @var \PhpParser\BuilderFactory */ - private $builderFactory; + private BuilderFactory $builderFactory; /** * @readonly - * @var \Rector\PHPUnit\NodeFactory\UsedVariablesResolver */ - private $usedVariablesResolver; + private UsedVariablesResolver $usedVariablesResolver; /** * @readonly - * @var \Rector\PHPUnit\NodeFactory\MatcherInvocationCountMethodCallNodeFactory */ - private $matcherInvocationCountMethodCallNodeFactory; + private MatcherInvocationCountMethodCallNodeFactory $matcherInvocationCountMethodCallNodeFactory; /** * @readonly - * @var \Rector\PHPUnit\NodeFactory\ConsecutiveIfsFactory */ - private $consecutiveIfsFactory; + private ConsecutiveIfsFactory $consecutiveIfsFactory; public function __construct(BuilderFactory $builderFactory, UsedVariablesResolver $usedVariablesResolver, MatcherInvocationCountMethodCallNodeFactory $matcherInvocationCountMethodCallNodeFactory, ConsecutiveIfsFactory $consecutiveIfsFactory) { $this->builderFactory = $builderFactory; @@ -81,7 +77,7 @@ final class WillReturnCallbackFactory private function createAssertSameDimFetch(Arg $firstArg, Variable $variable) : MethodCall { $matcherCountMethodCall = $this->matcherInvocationCountMethodCallNodeFactory->create(); - $currentValueArrayDimFetch = new ArrayDimFetch($firstArg->value, new Minus($matcherCountMethodCall, new LNumber(1))); + $currentValueArrayDimFetch = new ArrayDimFetch($firstArg->value, new Minus($matcherCountMethodCall, new Int_(1))); $compareArgs = [new Arg($currentValueArrayDimFetch), new Arg($variable)]; return $this->builderFactory->methodCall(new Variable('this'), 'assertSame', $compareArgs); } diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/Class_/AddProphecyTraitRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/Class_/AddProphecyTraitRector.php index 62e278a87d0..32dc5140a30 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/Class_/AddProphecyTraitRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/Class_/AddProphecyTraitRector.php @@ -25,19 +25,16 @@ final class AddProphecyTraitRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @var string */ @@ -98,9 +95,7 @@ CODE_SAMPLE } private function shouldSkipClass(Class_ $class) : bool { - $hasProphesizeMethodCall = (bool) $this->betterNodeFinder->findFirst($class, function (Node $node) : bool { - return $this->testsNodeAnalyzer->isAssertMethodCallName($node, 'prophesize'); - }); + $hasProphesizeMethodCall = (bool) $this->betterNodeFinder->findFirst($class, fn(Node $node): bool => $this->testsNodeAnalyzer->isAssertMethodCallName($node, 'prophesize')); if (!$hasProphesizeMethodCall) { return \true; } diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/Class_/PublicDataProviderClassMethodRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/Class_/PublicDataProviderClassMethodRector.php index 16a11e7b43c..827ed160c59 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/Class_/PublicDataProviderClassMethodRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/Class_/PublicDataProviderClassMethodRector.php @@ -19,19 +19,16 @@ final class PublicDataProviderClassMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PHPUnit\NodeFinder\DataProviderClassMethodFinder */ - private $dataProviderClassMethodFinder; + private DataProviderClassMethodFinder $dataProviderClassMethodFinder; /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, DataProviderClassMethodFinder $dataProviderClassMethodFinder, VisibilityManipulator $visibilityManipulator) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/Class_/StaticDataProviderClassMethodRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/Class_/StaticDataProviderClassMethodRector.php index 26f327b829e..8c78fc941c9 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/Class_/StaticDataProviderClassMethodRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/Class_/StaticDataProviderClassMethodRector.php @@ -21,24 +21,20 @@ final class StaticDataProviderClassMethodRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PHPUnit\NodeFinder\DataProviderClassMethodFinder */ - private $dataProviderClassMethodFinder; + private DataProviderClassMethodFinder $dataProviderClassMethodFinder; /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, DataProviderClassMethodFinder $dataProviderClassMethodFinder, VisibilityManipulator $visibilityManipulator, BetterNodeFinder $betterNodeFinder) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; @@ -124,8 +120,6 @@ CODE_SAMPLE if ($classMethod->stmts === null) { return \false; } - return (bool) $this->betterNodeFinder->findFirst($classMethod->stmts, function (Node $node) : bool { - return $node instanceof Variable && $this->nodeNameResolver->isName($node, 'this'); - }); + return (bool) $this->betterNodeFinder->findFirst($classMethod->stmts, fn(Node $node): bool => $node instanceof Variable && $this->nodeNameResolver->isName($node, 'this')); } } diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/MethodCall/RemoveSetMethodsMethodCallRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/MethodCall/RemoveSetMethodsMethodCallRector.php index c36ecd6135a..32d4a3e5172 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/MethodCall/RemoveSetMethodsMethodCallRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/MethodCall/RemoveSetMethodsMethodCallRector.php @@ -24,19 +24,16 @@ final class RemoveSetMethodsMethodCallRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, ValueResolver $valueResolver, ReflectionProvider $reflectionProvider) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/StmtsAwareInterface/ExpectsMethodCallDecorator.php b/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/StmtsAwareInterface/ExpectsMethodCallDecorator.php index fa17bbb3bfc..0e68b50a03d 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/StmtsAwareInterface/ExpectsMethodCallDecorator.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/StmtsAwareInterface/ExpectsMethodCallDecorator.php @@ -18,14 +18,12 @@ final class ExpectsMethodCallDecorator { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/StmtsAwareInterface/WithConsecutiveRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/StmtsAwareInterface/WithConsecutiveRector.php index ea981f24158..e5fbfba9436 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/StmtsAwareInterface/WithConsecutiveRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit100/Rector/StmtsAwareInterface/WithConsecutiveRector.php @@ -11,14 +11,14 @@ use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\StaticCall; +use PhpParser\Node\Expr\Throw_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Param; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Return_; -use PhpParser\Node\Stmt\Throw_; use Rector\Exception\ShouldNotHappenException; use Rector\PHPUnit\Enum\ConsecutiveMethodName; use Rector\PHPUnit\Enum\ConsecutiveVariable; @@ -37,34 +37,28 @@ final class WithConsecutiveRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PHPUnit\PHPUnit100\NodeFactory\WillReturnCallbackFactory */ - private $willReturnCallbackFactory; + private WillReturnCallbackFactory $willReturnCallbackFactory; /** * @readonly - * @var \Rector\PHPUnit\MethodCallRemover */ - private $methodCallRemover; + private MethodCallRemover $methodCallRemover; /** * @readonly - * @var \Rector\PHPUnit\NodeFinder\MethodCallNodeFinder */ - private $methodCallNodeFinder; + private MethodCallNodeFinder $methodCallNodeFinder; /** * @readonly - * @var \Rector\PHPUnit\PHPUnit100\Rector\StmtsAwareInterface\ExpectsMethodCallDecorator */ - private $expectsMethodCallDecorator; + private \Rector\PHPUnit\PHPUnit100\Rector\StmtsAwareInterface\ExpectsMethodCallDecorator $expectsMethodCallDecorator; /** * @readonly - * @var \Rector\PHPUnit\PHPUnit100\NodeDecorator\WillReturnIfNodeDecorator */ - private $willReturnIfNodeDecorator; + private WillReturnIfNodeDecorator $willReturnIfNodeDecorator; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, WillReturnCallbackFactory $willReturnCallbackFactory, MethodCallRemover $methodCallRemover, MethodCallNodeFinder $methodCallNodeFinder, \Rector\PHPUnit\PHPUnit100\Rector\StmtsAwareInterface\ExpectsMethodCallDecorator $expectsMethodCallDecorator, WillReturnIfNodeDecorator $willReturnIfNodeDecorator) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; @@ -126,6 +120,7 @@ CODE_SAMPLE } /** * @param Expression $node + * @return null|Stmt[]|Expression */ public function refactor(Node $node) { @@ -164,7 +159,7 @@ CODE_SAMPLE if ($willThrowException instanceof MethodCall) { $this->methodCallRemover->removeMethodCall($node, ConsecutiveMethodName::WILL_THROW_EXCEPTION); $expr = $this->getFirstArgValue($willThrowException); - $returnStmt = new Throw_($expr); + $returnStmt = new Expression(new Throw_($expr)); } $willReturnReferenceArgument = $this->methodCallNodeFinder->findByName($node, ConsecutiveMethodName::WILL_RETURN_REFERENCE); $referenceVariable = null; @@ -178,8 +173,8 @@ CODE_SAMPLE $expectsCall = $this->expectsMethodCallDecorator->decorate($node); if (!$expectsCall instanceof MethodCall && !$expectsCall instanceof StaticCall) { // fallback to default by case count - $lNumber = new LNumber(\count($withConsecutiveMethodCall->args)); - $expectsCall = new MethodCall(new Variable('this'), new Identifier('exactly'), [new Arg($lNumber)]); + $int = new Int_(\count($withConsecutiveMethodCall->args)); + $expectsCall = new MethodCall(new Variable('this'), new Identifier('exactly'), [new Arg($int)]); } // 2. does willReturnCallback() exist? just merge them together $existingWillReturnCallback = $this->methodCallNodeFinder->findByName($node, ConsecutiveMethodName::WILL_RETURN_CALLBACK); @@ -191,10 +186,11 @@ CODE_SAMPLE } /** * @return Stmt[] + * @param \PhpParser\Node\Stmt\Return_|\PhpParser\Node\Stmt\Expression|null $returnStmt * @param \PhpParser\Node\Expr|\PhpParser\Node\Expr\Variable|null $referenceVariable * @param \PhpParser\Node\Expr\StaticCall|\PhpParser\Node\Expr\MethodCall $expectsCall */ - private function refactorToWillReturnCallback(MethodCall $withConsecutiveMethodCall, ?Stmt $returnStmt, $referenceVariable, $expectsCall, Expression $expression, ?MethodCall $willReturnOnConsecutiveMethodCall) : array + private function refactorToWillReturnCallback(MethodCall $withConsecutiveMethodCall, $returnStmt, $referenceVariable, $expectsCall, Expression $expression, ?MethodCall $willReturnOnConsecutiveMethodCall) : array { $closure = $this->willReturnCallbackFactory->createClosure($withConsecutiveMethodCall, $returnStmt, $referenceVariable); $withConsecutiveMethodCall->name = new Identifier(ConsecutiveMethodName::WILL_RETURN_CALLBACK); diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit110/Rector/Class_/NamedArgumentForDataProviderRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit110/Rector/Class_/NamedArgumentForDataProviderRector.php index a45e4c86678..0eb60678045 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit110/Rector/Class_/NamedArgumentForDataProviderRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit110/Rector/Class_/NamedArgumentForDataProviderRector.php @@ -26,9 +26,8 @@ final class NamedArgumentForDataProviderRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; @@ -188,7 +187,7 @@ CODE_SAMPLE $needToSetAllKeyNames = \false; $allArrayKeyNames = []; foreach ($array->items as $arrayItem) { - if ((($nullsafeVariable1 = $arrayItem) ? $nullsafeVariable1->key : null) instanceof String_) { + if ($arrayItem->key instanceof String_) { $needToSetAllKeyNames = \true; $allArrayKeyNames[] = $arrayItem->key->value; } @@ -198,9 +197,6 @@ CODE_SAMPLE return \false; } foreach ($array->items as $arrayIndex => $arrayItem) { - if ($arrayItem === null) { - continue; - } if (!isset($dataProviderNameMapping[$arrayIndex])) { continue; } @@ -231,15 +227,15 @@ CODE_SAMPLE if ($stmt instanceof Return_ && $stmt->expr instanceof Array_) { $dataProviderTestCases = $stmt->expr; foreach ($dataProviderTestCases->items as $dataProviderTestCase) { - $arrayItem = ($nullsafeVariable2 = $dataProviderTestCase) ? $nullsafeVariable2->value : null; + $arrayItem = $dataProviderTestCase->value; if ($arrayItem instanceof Array_) { (yield $arrayItem); } - $variableName = $arrayItem === null ? null : $this->getName($arrayItem); + $variableName = $this->getName($arrayItem); if ($arrayItem instanceof Variable && $variableName !== null && isset($resolvedVariables[$variableName])) { $dataProviderList = $resolvedVariables[$variableName]; foreach ($dataProviderList->items as $dataProviderItem) { - if ((($nullsafeVariable3 = $dataProviderItem) ? $nullsafeVariable3->value : null) instanceof Array_) { + if ($dataProviderItem->value instanceof Array_) { (yield $dataProviderItem->value); } } diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit50/Rector/StaticCall/GetMockRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit50/Rector/StaticCall/GetMockRector.php index 98cca1150df..17ba96b2247 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit50/Rector/StaticCall/GetMockRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit50/Rector/StaticCall/GetMockRector.php @@ -23,14 +23,12 @@ final class GetMockRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, ReflectionResolver $reflectionResolver) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit60/Rector/ClassMethod/AddDoesNotPerformAssertionToNonAssertingTestRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit60/Rector/ClassMethod/AddDoesNotPerformAssertionToNonAssertingTestRector.php index f005a1035c4..4f0f6102234 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit60/Rector/ClassMethod/AddDoesNotPerformAssertionToNonAssertingTestRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit60/Rector/ClassMethod/AddDoesNotPerformAssertionToNonAssertingTestRector.php @@ -26,34 +26,28 @@ final class AddDoesNotPerformAssertionToNonAssertingTestRector extends AbstractR { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\AssertCallAnalyzer */ - private $assertCallAnalyzer; + private AssertCallAnalyzer $assertCallAnalyzer; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\MockedVariableAnalyzer */ - private $mockedVariableAnalyzer; + private MockedVariableAnalyzer $mockedVariableAnalyzer; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, AssertCallAnalyzer $assertCallAnalyzer, MockedVariableAnalyzer $mockedVariableAnalyzer, PhpAttributeAnalyzer $phpAttributeAnalyzer, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit60/Rector/ClassMethod/ExceptionAnnotationRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit60/Rector/ClassMethod/ExceptionAnnotationRector.php index e1a325f17e0..beac97c3de3 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit60/Rector/ClassMethod/ExceptionAnnotationRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit60/Rector/ClassMethod/ExceptionAnnotationRector.php @@ -24,29 +24,24 @@ final class ExceptionAnnotationRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeFactory\ExpectExceptionMethodCallFactory */ - private $expectExceptionMethodCallFactory; + private ExpectExceptionMethodCallFactory $expectExceptionMethodCallFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * In reversed order, which they should be called in code. * diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit60/Rector/MethodCall/DelegateExceptionArgumentsRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit60/Rector/MethodCall/DelegateExceptionArgumentsRector.php index f65bfec6ea1..25cb7537dc2 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit60/Rector/MethodCall/DelegateExceptionArgumentsRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit60/Rector/MethodCall/DelegateExceptionArgumentsRector.php @@ -21,14 +21,12 @@ final class DelegateExceptionArgumentsRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeFactory\AssertCallFactory */ - private $assertCallFactory; + private AssertCallFactory $assertCallFactory; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var array */ diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit70/Rector/Class_/RemoveDataProviderTestPrefixRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit70/Rector/Class_/RemoveDataProviderTestPrefixRector.php index 22842502393..4d28115a325 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit70/Rector/Class_/RemoveDataProviderTestPrefixRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit70/Rector/Class_/RemoveDataProviderTestPrefixRector.php @@ -22,19 +22,16 @@ final class RemoveDataProviderTestPrefixRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PHPUnit\NodeFinder\DataProviderClassMethodFinder */ - private $dataProviderClassMethodFinder; + private DataProviderClassMethodFinder $dataProviderClassMethodFinder; /** * @readonly - * @var \Rector\PHPUnit\PhpDoc\DataProviderMethodRenamer */ - private $dataProviderMethodRenamer; + private DataProviderMethodRenamer $dataProviderMethodRenamer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, DataProviderClassMethodFinder $dataProviderClassMethodFinder, DataProviderMethodRenamer $dataProviderMethodRenamer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit80/Rector/MethodCall/AssertEqualsParameterToSpecificMethodsTypeRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit80/Rector/MethodCall/AssertEqualsParameterToSpecificMethodsTypeRector.php index 7e8634fcbad..aa76f75b02c 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit80/Rector/MethodCall/AssertEqualsParameterToSpecificMethodsTypeRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit80/Rector/MethodCall/AssertEqualsParameterToSpecificMethodsTypeRector.php @@ -23,19 +23,16 @@ final class AssertEqualsParameterToSpecificMethodsTypeRector extends AbstractRec { /** * @readonly - * @var \Rector\PHPUnit\NodeFactory\AssertCallFactory */ - private $assertCallFactory; + private AssertCallFactory $assertCallFactory; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(AssertCallFactory $assertCallFactory, TestsNodeAnalyzer $testsNodeAnalyzer, ValueResolver $valueResolver) { $this->assertCallFactory = $assertCallFactory; diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit80/Rector/MethodCall/SpecificAssertContainsRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit80/Rector/MethodCall/SpecificAssertContainsRector.php index 50f0e10600e..8e54ab80302 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit80/Rector/MethodCall/SpecificAssertContainsRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit80/Rector/MethodCall/SpecificAssertContainsRector.php @@ -23,9 +23,8 @@ final class SpecificAssertContainsRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var array */ diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit80/Rector/MethodCall/SpecificAssertInternalTypeRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit80/Rector/MethodCall/SpecificAssertInternalTypeRector.php index 2909621974a..f8650ed7b5e 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit80/Rector/MethodCall/SpecificAssertInternalTypeRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit80/Rector/MethodCall/SpecificAssertInternalTypeRector.php @@ -22,9 +22,8 @@ final class SpecificAssertInternalTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var array */ diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit90/Rector/MethodCall/ExplicitPhpErrorApiRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit90/Rector/MethodCall/ExplicitPhpErrorApiRector.php index ef973d8d83e..eaeb0e4e95a 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit90/Rector/MethodCall/ExplicitPhpErrorApiRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit90/Rector/MethodCall/ExplicitPhpErrorApiRector.php @@ -23,14 +23,12 @@ final class ExplicitPhpErrorApiRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeFactory\AssertCallFactory */ - private $assertCallFactory; + private AssertCallFactory $assertCallFactory; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @var array */ diff --git a/vendor/rector/rector-phpunit/rules/PHPUnit90/Rector/MethodCall/SpecificAssertContainsWithoutIdentityRector.php b/vendor/rector/rector-phpunit/rules/PHPUnit90/Rector/MethodCall/SpecificAssertContainsWithoutIdentityRector.php index 622b2a77888..5992c9ada75 100644 --- a/vendor/rector/rector-phpunit/rules/PHPUnit90/Rector/MethodCall/SpecificAssertContainsWithoutIdentityRector.php +++ b/vendor/rector/rector-phpunit/rules/PHPUnit90/Rector/MethodCall/SpecificAssertContainsWithoutIdentityRector.php @@ -21,14 +21,12 @@ final class SpecificAssertContainsWithoutIdentityRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var array> */ diff --git a/vendor/rector/rector-phpunit/src/Composer/ProjectPackageVersionResolver.php b/vendor/rector/rector-phpunit/src/Composer/ProjectPackageVersionResolver.php index a32885364ec..a570a02ad4d 100644 --- a/vendor/rector/rector-phpunit/src/Composer/ProjectPackageVersionResolver.php +++ b/vendor/rector/rector-phpunit/src/Composer/ProjectPackageVersionResolver.php @@ -14,9 +14,8 @@ final class ProjectPackageVersionResolver { /** * @readonly - * @var \Rector\Composer\InstalledPackageResolver */ - private $installedPackageResolver; + private InstalledPackageResolver $installedPackageResolver; public function __construct() { $this->installedPackageResolver = new InstalledPackageResolver(\getcwd()); diff --git a/vendor/rector/rector-phpunit/src/MethodCallRemover.php b/vendor/rector/rector-phpunit/src/MethodCallRemover.php index 576c1de494e..29ec87a358d 100644 --- a/vendor/rector/rector-phpunit/src/MethodCallRemover.php +++ b/vendor/rector/rector-phpunit/src/MethodCallRemover.php @@ -12,14 +12,12 @@ final class MethodCallRemover { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; diff --git a/vendor/rector/rector-phpunit/src/NodeAnalyzer/AssertCallAnalyzer.php b/vendor/rector/rector-phpunit/src/NodeAnalyzer/AssertCallAnalyzer.php index 38cd673c937..6f159d8e548 100644 --- a/vendor/rector/rector-phpunit/src/NodeAnalyzer/AssertCallAnalyzer.php +++ b/vendor/rector/rector-phpunit/src/NodeAnalyzer/AssertCallAnalyzer.php @@ -19,29 +19,24 @@ final class AssertCallAnalyzer { /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @var int */ @@ -53,12 +48,11 @@ final class AssertCallAnalyzer /** * @var array */ - private $containsAssertCallByClassMethod = []; + private array $containsAssertCallByClassMethod = []; /** * This should prevent segfaults while going too deep into to parsed code. Without it, it might end-up with segfault - * @var int */ - private $classMethodNestingLevel = 0; + private int $classMethodNestingLevel = 0; public function __construct(AstResolver $astResolver, BetterStandardPrinter $betterStandardPrinter, BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver) { $this->astResolver = $astResolver; diff --git a/vendor/rector/rector-phpunit/src/NodeAnalyzer/IdentifierManipulator.php b/vendor/rector/rector-phpunit/src/NodeAnalyzer/IdentifierManipulator.php index 426153b5e9a..45290124d5e 100644 --- a/vendor/rector/rector-phpunit/src/NodeAnalyzer/IdentifierManipulator.php +++ b/vendor/rector/rector-phpunit/src/NodeAnalyzer/IdentifierManipulator.php @@ -20,9 +20,8 @@ final class IdentifierManipulator { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-phpunit/src/NodeAnalyzer/MockedVariableAnalyzer.php b/vendor/rector/rector-phpunit/src/NodeAnalyzer/MockedVariableAnalyzer.php index 5e130d7d503..9d771ec5c40 100644 --- a/vendor/rector/rector-phpunit/src/NodeAnalyzer/MockedVariableAnalyzer.php +++ b/vendor/rector/rector-phpunit/src/NodeAnalyzer/MockedVariableAnalyzer.php @@ -19,19 +19,16 @@ final class MockedVariableAnalyzer { /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; diff --git a/vendor/rector/rector-phpunit/src/NodeAnalyzer/SetUpMethodDecorator.php b/vendor/rector/rector-phpunit/src/NodeAnalyzer/SetUpMethodDecorator.php index 276215c0347..5ea9dedaa40 100644 --- a/vendor/rector/rector-phpunit/src/NodeAnalyzer/SetUpMethodDecorator.php +++ b/vendor/rector/rector-phpunit/src/NodeAnalyzer/SetUpMethodDecorator.php @@ -15,9 +15,8 @@ final class SetUpMethodDecorator { /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; public function __construct(AstResolver $astResolver) { $this->astResolver = $astResolver; diff --git a/vendor/rector/rector-phpunit/src/NodeAnalyzer/TestsNodeAnalyzer.php b/vendor/rector/rector-phpunit/src/NodeAnalyzer/TestsNodeAnalyzer.php index d65f5cf37fe..d480e3612dd 100644 --- a/vendor/rector/rector-phpunit/src/NodeAnalyzer/TestsNodeAnalyzer.php +++ b/vendor/rector/rector-phpunit/src/NodeAnalyzer/TestsNodeAnalyzer.php @@ -17,24 +17,20 @@ final class TestsNodeAnalyzer { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @var string[] */ diff --git a/vendor/rector/rector-phpunit/src/NodeFactory/ConsecutiveIfsFactory.php b/vendor/rector/rector-phpunit/src/NodeFactory/ConsecutiveIfsFactory.php index 5cb05007672..ab1f701832d 100644 --- a/vendor/rector/rector-phpunit/src/NodeFactory/ConsecutiveIfsFactory.php +++ b/vendor/rector/rector-phpunit/src/NodeFactory/ConsecutiveIfsFactory.php @@ -4,15 +4,15 @@ declare (strict_types=1); namespace Rector\PHPUnit\NodeFactory; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\ArrayDimFetch; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\Expr\BinaryOp\Identical; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\If_; @@ -24,14 +24,12 @@ final class ConsecutiveIfsFactory { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PHPUnit\CodeQuality\NodeFactory\NestedClosureAssertFactory */ - private $nestedClosureAssertFactory; + private NestedClosureAssertFactory $nestedClosureAssertFactory; public function __construct(NodeNameResolver $nodeNameResolver, NestedClosureAssertFactory $nestedClosureAssertFactory) { $this->nodeNameResolver = $nodeNameResolver; @@ -53,8 +51,8 @@ final class ConsecutiveIfsFactory continue; } if (!$assertArrayItem->value instanceof MethodCall) { - $parametersDimFetch = new ArrayDimFetch(new Variable('parameters'), new LNumber($assertKey)); - $args = [new Arg($assertArrayItem), new Arg($parametersDimFetch)]; + $parametersDimFetch = new ArrayDimFetch(new Variable('parameters'), new Int_($assertKey)); + $args = [new Arg($assertArrayItem->value), new Arg($parametersDimFetch)]; $ifStmts[] = new Expression(new MethodCall(new Variable('this'), 'assertSame', $args)); continue; } @@ -64,7 +62,7 @@ final class ConsecutiveIfsFactory } elseif ($this->nodeNameResolver->isName($assertMethodCall->name, 'callback')) { $ifStmts = \array_merge($ifStmts, $this->nestedClosureAssertFactory->create($assertMethodCall, $assertKey)); } else { - $args = [new Arg($assertMethodCall), new Arg(new ArrayDimFetch(new Variable('parameters'), new LNumber($assertKey)))]; + $args = [new Arg($assertMethodCall), new Arg(new ArrayDimFetch(new Variable('parameters'), new Int_($assertKey)))]; $assertSameMethodCall = new MethodCall(new Variable('this'), new Identifier('assertSame'), $args); $ifStmts[] = new Expression($assertSameMethodCall); } @@ -80,7 +78,7 @@ final class ConsecutiveIfsFactory $identicalCompare = $arrowFunction->expr; // @todo improve in time if ($identicalCompare->left instanceof Variable) { - $parametersArrayDimFetch = new ArrayDimFetch(new Variable('parameters'), new LNumber(0)); + $parametersArrayDimFetch = new ArrayDimFetch(new Variable('parameters'), new Int_(0)); $assertSameMethodCall = new MethodCall(new Variable('this'), new Identifier('assertSame')); $assertSameMethodCall->args[] = new Arg($identicalCompare->right); $assertSameMethodCall->args[] = new Arg($parametersArrayDimFetch); @@ -91,14 +89,14 @@ final class ConsecutiveIfsFactory } throw new NotImplementedYetException(); } - $ifs[] = new If_(new Identical($numberOfInvocationsMethodCall, new LNumber($key + 1)), ['stmts' => $ifStmts]); + $ifs[] = new If_(new Identical($numberOfInvocationsMethodCall, new Int_($key + 1)), ['stmts' => $ifStmts]); } return $ifs; } private function createAssertMethodCall(MethodCall $assertMethodCall, Variable $parametersVariable, int $parameterPositionKey) : Expression { $assertMethodCall->name = new Identifier('assertEquals'); - $parametersArrayDimFetch = new ArrayDimFetch($parametersVariable, new LNumber($parameterPositionKey)); + $parametersArrayDimFetch = new ArrayDimFetch($parametersVariable, new Int_($parameterPositionKey)); $assertMethodCall->args[] = new Arg($parametersArrayDimFetch); return new Expression($assertMethodCall); } diff --git a/vendor/rector/rector-phpunit/src/NodeFactory/ExpectExceptionMethodCallFactory.php b/vendor/rector/rector-phpunit/src/NodeFactory/ExpectExceptionMethodCallFactory.php index 87a593b724c..fc41ab1a4f3 100644 --- a/vendor/rector/rector-phpunit/src/NodeFactory/ExpectExceptionMethodCallFactory.php +++ b/vendor/rector/rector-phpunit/src/NodeFactory/ExpectExceptionMethodCallFactory.php @@ -17,14 +17,12 @@ final class ExpectExceptionMethodCallFactory { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \Rector\PHPUnit\PhpDoc\PhpDocValueToNodeMapper */ - private $phpDocValueToNodeMapper; + private PhpDocValueToNodeMapper $phpDocValueToNodeMapper; public function __construct(NodeFactory $nodeFactory, PhpDocValueToNodeMapper $phpDocValueToNodeMapper) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-phpunit/src/NodeFactory/MatcherInvocationCountMethodCallNodeFactory.php b/vendor/rector/rector-phpunit/src/NodeFactory/MatcherInvocationCountMethodCallNodeFactory.php index a77130b1f67..2b45df9b732 100644 --- a/vendor/rector/rector-phpunit/src/NodeFactory/MatcherInvocationCountMethodCallNodeFactory.php +++ b/vendor/rector/rector-phpunit/src/NodeFactory/MatcherInvocationCountMethodCallNodeFactory.php @@ -12,9 +12,8 @@ final class MatcherInvocationCountMethodCallNodeFactory { /** * @readonly - * @var \Rector\PHPUnit\Composer\ProjectPackageVersionResolver */ - private $projectPackageVersionResolver; + private ProjectPackageVersionResolver $projectPackageVersionResolver; public function __construct(ProjectPackageVersionResolver $projectPackageVersionResolver) { $this->projectPackageVersionResolver = $projectPackageVersionResolver; diff --git a/vendor/rector/rector-phpunit/src/NodeFactory/UsedVariablesResolver.php b/vendor/rector/rector-phpunit/src/NodeFactory/UsedVariablesResolver.php index 1a3c21bf441..0ec59f5e059 100644 --- a/vendor/rector/rector-phpunit/src/NodeFactory/UsedVariablesResolver.php +++ b/vendor/rector/rector-phpunit/src/NodeFactory/UsedVariablesResolver.php @@ -14,14 +14,12 @@ final class UsedVariablesResolver { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/vendor/rector/rector-phpunit/src/NodeFinder/DataProviderClassMethodFinder.php b/vendor/rector/rector-phpunit/src/NodeFinder/DataProviderClassMethodFinder.php index c28d5221a49..8371c894be3 100644 --- a/vendor/rector/rector-phpunit/src/NodeFinder/DataProviderClassMethodFinder.php +++ b/vendor/rector/rector-phpunit/src/NodeFinder/DataProviderClassMethodFinder.php @@ -19,24 +19,20 @@ final class DataProviderClassMethodFinder { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\PhpParser\AstResolver */ - private $astResolver; + private AstResolver $astResolver; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, ReflectionResolver $reflectionResolver, AstResolver $astResolver, NodeNameResolver $nodeNameResolver) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/vendor/rector/rector-phpunit/src/NodeFinder/MethodCallNodeFinder.php b/vendor/rector/rector-phpunit/src/NodeFinder/MethodCallNodeFinder.php index 4bf595063fb..ac3ebb22ae3 100644 --- a/vendor/rector/rector-phpunit/src/NodeFinder/MethodCallNodeFinder.php +++ b/vendor/rector/rector-phpunit/src/NodeFinder/MethodCallNodeFinder.php @@ -12,14 +12,12 @@ final class MethodCallNodeFinder { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/vendor/rector/rector-phpunit/src/PhpDoc/DataProviderMethodRenamer.php b/vendor/rector/rector-phpunit/src/PhpDoc/DataProviderMethodRenamer.php index 119ee5b5c3c..e44c450b64e 100644 --- a/vendor/rector/rector-phpunit/src/PhpDoc/DataProviderMethodRenamer.php +++ b/vendor/rector/rector-phpunit/src/PhpDoc/DataProviderMethodRenamer.php @@ -13,14 +13,12 @@ final class DataProviderMethodRenamer { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/vendor/rector/rector-phpunit/src/PhpDoc/PhpDocValueToNodeMapper.php b/vendor/rector/rector-phpunit/src/PhpDoc/PhpDocValueToNodeMapper.php index dac7f7ded37..3f576b60286 100644 --- a/vendor/rector/rector-phpunit/src/PhpDoc/PhpDocValueToNodeMapper.php +++ b/vendor/rector/rector-phpunit/src/PhpDoc/PhpDocValueToNodeMapper.php @@ -13,14 +13,12 @@ final class PhpDocValueToNodeMapper { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(NodeFactory $nodeFactory, ReflectionProvider $reflectionProvider) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-phpunit/src/ValueObject/AnnotationWithValueToAttribute.php b/vendor/rector/rector-phpunit/src/ValueObject/AnnotationWithValueToAttribute.php index f97bff09d75..d654a38a3c3 100644 --- a/vendor/rector/rector-phpunit/src/ValueObject/AnnotationWithValueToAttribute.php +++ b/vendor/rector/rector-phpunit/src/ValueObject/AnnotationWithValueToAttribute.php @@ -7,19 +7,17 @@ final class AnnotationWithValueToAttribute { /** * @readonly - * @var string */ - private $annotationName; + private string $annotationName; /** * @readonly - * @var string */ - private $attributeClass; + private string $attributeClass; /** * @var array * @readonly */ - private $valueMap = []; + private array $valueMap = []; /** * @param array $valueMap */ diff --git a/vendor/rector/rector-phpunit/src/ValueObject/BinaryOpWithAssertMethod.php b/vendor/rector/rector-phpunit/src/ValueObject/BinaryOpWithAssertMethod.php index 240035968a1..0557da59697 100644 --- a/vendor/rector/rector-phpunit/src/ValueObject/BinaryOpWithAssertMethod.php +++ b/vendor/rector/rector-phpunit/src/ValueObject/BinaryOpWithAssertMethod.php @@ -7,19 +7,16 @@ final class BinaryOpWithAssertMethod { /** * @readonly - * @var string */ - private $binaryOpClass; + private string $binaryOpClass; /** * @readonly - * @var string */ - private $assetMethodName; + private string $assetMethodName; /** * @readonly - * @var string */ - private $notAssertMethodName; + private string $notAssertMethodName; public function __construct(string $binaryOpClass, string $assetMethodName, string $notAssertMethodName) { $this->binaryOpClass = $binaryOpClass; diff --git a/vendor/rector/rector-phpunit/src/ValueObject/ConstantWithAssertMethods.php b/vendor/rector/rector-phpunit/src/ValueObject/ConstantWithAssertMethods.php index dcf318fe1a2..fc9ff59d354 100644 --- a/vendor/rector/rector-phpunit/src/ValueObject/ConstantWithAssertMethods.php +++ b/vendor/rector/rector-phpunit/src/ValueObject/ConstantWithAssertMethods.php @@ -7,19 +7,16 @@ final class ConstantWithAssertMethods { /** * @readonly - * @var string */ - private $constant; + private string $constant; /** * @readonly - * @var string */ - private $assetMethodName; + private string $assetMethodName; /** * @readonly - * @var string */ - private $notAssertMethodName; + private string $notAssertMethodName; public function __construct(string $constant, string $assetMethodName, string $notAssertMethodName) { $this->constant = $constant; diff --git a/vendor/rector/rector-phpunit/src/ValueObject/FunctionNameWithAssertMethods.php b/vendor/rector/rector-phpunit/src/ValueObject/FunctionNameWithAssertMethods.php index 913fcb732b2..d62ba31bffc 100644 --- a/vendor/rector/rector-phpunit/src/ValueObject/FunctionNameWithAssertMethods.php +++ b/vendor/rector/rector-phpunit/src/ValueObject/FunctionNameWithAssertMethods.php @@ -7,19 +7,16 @@ final class FunctionNameWithAssertMethods { /** * @readonly - * @var string */ - private $functionName; + private string $functionName; /** * @readonly - * @var string */ - private $assetMethodName; + private string $assetMethodName; /** * @readonly - * @var string */ - private $notAssertMethodName; + private string $notAssertMethodName; public function __construct(string $functionName, string $assetMethodName, string $notAssertMethodName) { $this->functionName = $functionName; diff --git a/vendor/rector/rector-symfony/composer.json b/vendor/rector/rector-symfony/composer.json index c79d4aba6ca..8c98de03076 100644 --- a/vendor/rector/rector-symfony/composer.json +++ b/vendor/rector/rector-symfony/composer.json @@ -9,11 +9,10 @@ }, "require-dev": { "phpstan\/extension-installer": "^1.4", - "phpstan\/phpstan": "^1.11", - "phpstan\/phpstan-webmozart-assert": "^1.2", + "phpstan\/phpstan": "^2.0", + "phpstan\/phpstan-webmozart-assert": "^2.0", "phpunit\/phpunit": "^10.5", "rector\/rector-src": "dev-main", - "rector\/type-perfect": "^1.0", "symfony\/config": "^6.4", "symfony\/dependency-injection": "^6.4", "symfony\/http-kernel": "~6.3", @@ -22,11 +21,8 @@ "symfony\/security-http": "^6.4", "symfony\/validator": "^6.4", "symplify\/easy-coding-standard": "^12.3", - "symplify\/phpstan-extensions": "^11.4", - "symplify\/phpstan-rules": "^13.0", "symplify\/vendor-patches": "^11.3", "tomasvotruba\/class-leak": "^1.0", - "tomasvotruba\/unused-public": "^1.0", "tracy\/tracy": "^2.10" }, "autoload": { @@ -49,7 +45,7 @@ ] }, "scripts": { - "phpstan": "vendor\/bin\/phpstan analyse --ansi --error-format symplify", + "phpstan": "vendor\/bin\/phpstan analyse --ansi", "check-cs": "vendor\/bin\/ecs check --ansi", "fix-cs": "vendor\/bin\/ecs check --fix --ansi" }, diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/NodeFactory/SymfonyClosureFactory.php b/vendor/rector/rector-symfony/rules/CodeQuality/NodeFactory/SymfonyClosureFactory.php index a05d2338645..6fcceb60a69 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/NodeFactory/SymfonyClosureFactory.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/NodeFactory/SymfonyClosureFactory.php @@ -13,9 +13,8 @@ final class SymfonyClosureFactory { /** * @readonly - * @var \Rector\Naming\Naming\PropertyNaming */ - private $propertyNaming; + private PropertyNaming $propertyNaming; public function __construct(PropertyNaming $propertyNaming) { $this->propertyNaming = $propertyNaming; diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/BinaryOp/ResponseStatusCodeRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/BinaryOp/ResponseStatusCodeRector.php index 38db46b2719..66edbd5fc15 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/BinaryOp/ResponseStatusCodeRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/BinaryOp/ResponseStatusCodeRector.php @@ -9,7 +9,7 @@ use PhpParser\Node\Expr\CallLike; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\New_; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PHPStan\Type\ObjectType; use Rector\Rector\AbstractRector; use Rector\Symfony\CodeQuality\Enum\ResponseClass; @@ -25,19 +25,16 @@ final class ResponseStatusCodeRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer */ - private $controllerAnalyzer; + private ControllerAnalyzer $controllerAnalyzer; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\LiteralCallLikeConstFetchReplacer */ - private $literalCallLikeConstFetchReplacer; + private LiteralCallLikeConstFetchReplacer $literalCallLikeConstFetchReplacer; /** * @readonly - * @var \PHPStan\Type\ObjectType */ - private $responseObjectType; + private ObjectType $responseObjectType; public function __construct(ControllerAnalyzer $controllerAnalyzer, LiteralCallLikeConstFetchReplacer $literalCallLikeConstFetchReplacer) { $this->controllerAnalyzer = $controllerAnalyzer; @@ -123,11 +120,11 @@ CODE_SAMPLE if (!$this->isGetStatusMethod($binaryOp->left) && !$this->isGetStatusMethod($binaryOp->right)) { return null; } - if ($binaryOp->right instanceof LNumber && $this->isGetStatusMethod($binaryOp->left)) { + if ($binaryOp->right instanceof Int_ && $this->isGetStatusMethod($binaryOp->left)) { $binaryOp->right = $this->convertNumberToConstant($binaryOp->right); return $binaryOp; } - if ($binaryOp->left instanceof LNumber && $this->isGetStatusMethod($binaryOp->right)) { + if ($binaryOp->left instanceof Int_ && $this->isGetStatusMethod($binaryOp->right)) { $binaryOp->left = $this->convertNumberToConstant($binaryOp->left); return $binaryOp; } @@ -144,14 +141,14 @@ CODE_SAMPLE return $this->isObjectType($node->var, $this->responseObjectType); } /** - * @return \PhpParser\Node\Expr\ClassConstFetch|\PhpParser\Node\Scalar\LNumber + * @return \PhpParser\Node\Expr\ClassConstFetch|\PhpParser\Node\Scalar\Int_ */ - private function convertNumberToConstant(LNumber $lNumber) + private function convertNumberToConstant(Int_ $int) { - if (!isset(SymfonyResponseConstantMap::CODE_TO_CONST[$lNumber->value])) { - return $lNumber; + if (!isset(SymfonyResponseConstantMap::CODE_TO_CONST[$int->value])) { + return $int; } - return $this->nodeFactory->createClassConstFetch($this->responseObjectType->getClassName(), SymfonyResponseConstantMap::CODE_TO_CONST[$lNumber->value]); + return $this->nodeFactory->createClassConstFetch($this->responseObjectType->getClassName(), SymfonyResponseConstantMap::CODE_TO_CONST[$int->value]); } private function processAssertMethodCall(MethodCall $methodCall) : ?\PhpParser\Node\Expr\MethodCall { diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ActionSuffixRemoverRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ActionSuffixRemoverRector.php index 33630fb0f05..bce1977bf67 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ActionSuffixRemoverRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ActionSuffixRemoverRector.php @@ -18,9 +18,8 @@ final class ActionSuffixRemoverRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\Bridge\NodeAnalyzer\ControllerMethodAnalyzer */ - private $controllerMethodAnalyzer; + private ControllerMethodAnalyzer $controllerMethodAnalyzer; public function __construct(ControllerMethodAnalyzer $controllerMethodAnalyzer) { $this->controllerMethodAnalyzer = $controllerMethodAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ParamTypeFromRouteRequiredRegexRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ParamTypeFromRouteRequiredRegexRector.php index 462adc3b092..ba27c06fb6e 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ParamTypeFromRouteRequiredRegexRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ParamTypeFromRouteRequiredRegexRector.php @@ -20,19 +20,16 @@ final class ParamTypeFromRouteRequiredRegexRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer */ - private $controllerAnalyzer; + private ControllerAnalyzer $controllerAnalyzer; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\RouteRequiredParamNameToTypesResolver */ - private $routeRequiredParamNameToTypesResolver; + private RouteRequiredParamNameToTypesResolver $routeRequiredParamNameToTypesResolver; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(ControllerAnalyzer $controllerAnalyzer, RouteRequiredParamNameToTypesResolver $routeRequiredParamNameToTypesResolver, StaticTypeMapper $staticTypeMapper) { $this->controllerAnalyzer = $controllerAnalyzer; @@ -103,7 +100,7 @@ CODE_SAMPLE if (!$param instanceof Param) { continue; } - if ($param->type !== null) { + if ($param->type instanceof Node) { continue; } $param->type = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($paramType, TypeKind::PARAM); diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/RemoveUnusedRequestParamRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/RemoveUnusedRequestParamRector.php index 77933528eb0..adfd563a0b6 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/RemoveUnusedRequestParamRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/RemoveUnusedRequestParamRector.php @@ -25,29 +25,24 @@ final class RemoveUnusedRequestParamRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer */ - private $controllerAnalyzer; + private ControllerAnalyzer $controllerAnalyzer; /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\FamilyTree\NodeAnalyzer\ClassChildAnalyzer */ - private $classChildAnalyzer; + private ClassChildAnalyzer $classChildAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\DeadCode\NodeAnalyzer\IsClassMethodUsedAnalyzer */ - private $isClassMethodUsedAnalyzer; + private IsClassMethodUsedAnalyzer $isClassMethodUsedAnalyzer; public function __construct(ControllerAnalyzer $controllerAnalyzer, ReflectionResolver $reflectionResolver, ClassChildAnalyzer $classChildAnalyzer, BetterNodeFinder $betterNodeFinder, IsClassMethodUsedAnalyzer $isClassMethodUsedAnalyzer) { $this->controllerAnalyzer = $controllerAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ResponseReturnTypeControllerActionRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ResponseReturnTypeControllerActionRector.php index add543c1c94..a52d1dc5a96 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ResponseReturnTypeControllerActionRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/ResponseReturnTypeControllerActionRector.php @@ -38,34 +38,28 @@ final class ResponseReturnTypeControllerActionRector extends AbstractRector impl { /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer */ - private $controllerAnalyzer; + private ControllerAnalyzer $controllerAnalyzer; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttrinationFinder */ - private $attrinationFinder; + private AttrinationFinder $attrinationFinder; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\TypeDeclaration\NodeAnalyzer\ReturnAnalyzer */ - private $returnAnalyzer; + private ReturnAnalyzer $returnAnalyzer; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer */ - private $returnTypeInferer; + private ReturnTypeInferer $returnTypeInferer; public function __construct(ControllerAnalyzer $controllerAnalyzer, AttrinationFinder $attrinationFinder, BetterNodeFinder $betterNodeFinder, ReturnAnalyzer $returnAnalyzer, StaticTypeMapper $staticTypeMapper, ReturnTypeInferer $returnTypeInferer) { $this->controllerAnalyzer = $controllerAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/TemplateAnnotationToThisRenderRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/TemplateAnnotationToThisRenderRector.php index a393b796d90..a9456243b06 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/TemplateAnnotationToThisRenderRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/ClassMethod/TemplateAnnotationToThisRenderRector.php @@ -13,7 +13,7 @@ use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Return_; -use PhpParser\NodeTraverser; +use PhpParser\NodeVisitor; use PHPStan\Type\ArrayType; use PHPStan\Type\Constant\ConstantArrayType; use PHPStan\Type\MixedType; @@ -44,49 +44,40 @@ final class TemplateAnnotationToThisRenderRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ArrayUnionResponseTypeAnalyzer */ - private $arrayUnionResponseTypeAnalyzer; + private ArrayUnionResponseTypeAnalyzer $arrayUnionResponseTypeAnalyzer; /** * @readonly - * @var \Rector\Symfony\TypeDeclaration\ReturnTypeDeclarationUpdater */ - private $returnTypeDeclarationUpdater; + private ReturnTypeDeclarationUpdater $returnTypeDeclarationUpdater; /** * @readonly - * @var \Rector\Symfony\NodeFactory\ThisRenderFactory */ - private $thisRenderFactory; + private ThisRenderFactory $thisRenderFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Symfony\NodeFinder\EmptyReturnNodeFinder */ - private $emptyReturnNodeFinder; + private EmptyReturnNodeFinder $emptyReturnNodeFinder; /** * @readonly - * @var \Rector\Symfony\Annotation\AnnotationAnalyzer */ - private $annotationAnalyzer; + private AnnotationAnalyzer $annotationAnalyzer; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(ArrayUnionResponseTypeAnalyzer $arrayUnionResponseTypeAnalyzer, ReturnTypeDeclarationUpdater $returnTypeDeclarationUpdater, ThisRenderFactory $thisRenderFactory, PhpDocTagRemover $phpDocTagRemover, EmptyReturnNodeFinder $emptyReturnNodeFinder, AnnotationAnalyzer $annotationAnalyzer, DocBlockUpdater $docBlockUpdater, BetterNodeFinder $betterNodeFinder, PhpDocInfoFactory $phpDocInfoFactory) { $this->arrayUnionResponseTypeAnalyzer = $arrayUnionResponseTypeAnalyzer; @@ -193,7 +184,7 @@ CODE_SAMPLE $this->traverseNodesWithCallable($classMethod, function (Node $node) use($templateDoctrineAnnotationTagValueNode, $hasThisRenderOrReturnsResponse, $classMethod, &$hasChanged) : ?int { // keep as similar type if ($node instanceof Closure || $node instanceof Function_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$node instanceof StmtsAwareInterface) { return null; diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/EventListenerToEventSubscriberRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/EventListenerToEventSubscriberRector.php index 850800a19ad..229bde55326 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/EventListenerToEventSubscriberRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/EventListenerToEventSubscriberRector.php @@ -24,24 +24,20 @@ final class EventListenerToEventSubscriberRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\ApplicationMetadata\ListenerServiceDefinitionProvider */ - private $listenerServiceDefinitionProvider; + private ListenerServiceDefinitionProvider $listenerServiceDefinitionProvider; /** * @readonly - * @var \Rector\Symfony\NodeFactory\GetSubscribedEventsClassMethodFactory */ - private $getSubscribedEventsClassMethodFactory; + private GetSubscribedEventsClassMethodFactory $getSubscribedEventsClassMethodFactory; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @var string */ @@ -66,7 +62,7 @@ final class EventListenerToEventSubscriberRector extends AbstractRector /** * @var EventNameToClassAndConstant[] */ - private $eventNamesToClassConstants = []; + private array $eventNamesToClassConstants = []; public function __construct(ListenerServiceDefinitionProvider $listenerServiceDefinitionProvider, GetSubscribedEventsClassMethodFactory $getSubscribedEventsClassMethodFactory, ClassAnalyzer $classAnalyzer, PhpAttributeAnalyzer $phpAttributeAnalyzer) { $this->listenerServiceDefinitionProvider = $listenerServiceDefinitionProvider; diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/LoadValidatorMetadataToAnnotationRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/LoadValidatorMetadataToAnnotationRector.php index 50f9390e586..9a177c6e0d9 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/LoadValidatorMetadataToAnnotationRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/LoadValidatorMetadataToAnnotationRector.php @@ -29,29 +29,24 @@ final class LoadValidatorMetadataToAnnotationRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\Annotations\MethodCallAnnotationAssertResolver */ - private $methodCallAnnotationAssertResolver; + private MethodCallAnnotationAssertResolver $methodCallAnnotationAssertResolver; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\Annotations\PropertyAnnotationAssertResolver */ - private $propertyAnnotationAssertResolver; + private PropertyAnnotationAssertResolver $propertyAnnotationAssertResolver; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\Annotations\ClassAnnotationAssertResolver */ - private $classAnnotationAssertResolver; + private ClassAnnotationAssertResolver $classAnnotationAssertResolver; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(MethodCallAnnotationAssertResolver $methodCallAnnotationAssertResolver, PropertyAnnotationAssertResolver $propertyAnnotationAssertResolver, ClassAnnotationAssertResolver $classAnnotationAssertResolver, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->methodCallAnnotationAssertResolver = $methodCallAnnotationAssertResolver; diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Closure/StringExtensionToConfigBuilderRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Closure/StringExtensionToConfigBuilderRector.php index 67e492ec06f..04f6d976ba0 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Closure/StringExtensionToConfigBuilderRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Closure/StringExtensionToConfigBuilderRector.php @@ -35,39 +35,32 @@ final class StringExtensionToConfigBuilderRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\SymfonyPhpClosureDetector */ - private $symfonyPhpClosureDetector; + private SymfonyPhpClosureDetector $symfonyPhpClosureDetector; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\SymfonyClosureExtensionMatcher */ - private $symfonyClosureExtensionMatcher; + private SymfonyClosureExtensionMatcher $symfonyClosureExtensionMatcher; /** * @readonly - * @var \Rector\Naming\Naming\PropertyNaming */ - private $propertyNaming; + private PropertyNaming $propertyNaming; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\Symfony\Configs\ConfigArrayHandler\NestedConfigCallsFactory */ - private $nestedConfigCallsFactory; + private NestedConfigCallsFactory $nestedConfigCallsFactory; /** * @readonly - * @var \Rector\Symfony\Configs\ConfigArrayHandler\SecurityAccessDecisionManagerConfigArrayHandler */ - private $securityAccessDecisionManagerConfigArrayHandler; + private SecurityAccessDecisionManagerConfigArrayHandler $securityAccessDecisionManagerConfigArrayHandler; /** * @readonly - * @var \Rector\Symfony\CodeQuality\NodeFactory\SymfonyClosureFactory */ - private $symfonyClosureFactory; + private SymfonyClosureFactory $symfonyClosureFactory; /** * @var array */ diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/MethodCall/AssertSameResponseCodeWithDebugContentsRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/MethodCall/AssertSameResponseCodeWithDebugContentsRector.php index 4e69ad8ea55..5336bfdaba7 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/MethodCall/AssertSameResponseCodeWithDebugContentsRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/MethodCall/AssertSameResponseCodeWithDebugContentsRector.php @@ -21,9 +21,8 @@ final class AssertSameResponseCodeWithDebugContentsRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/MethodCall/LiteralGetToRequestClassConstantRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/MethodCall/LiteralGetToRequestClassConstantRector.php index fbc10c0136e..0f50e550a3c 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/MethodCall/LiteralGetToRequestClassConstantRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/MethodCall/LiteralGetToRequestClassConstantRector.php @@ -20,14 +20,12 @@ final class LiteralGetToRequestClassConstantRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\LiteralCallLikeConstFetchReplacer */ - private $literalCallLikeConstFetchReplacer; + private LiteralCallLikeConstFetchReplacer $literalCallLikeConstFetchReplacer; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(LiteralCallLikeConstFetchReplacer $literalCallLikeConstFetchReplacer, ReflectionProvider $reflectionProvider) { $this->literalCallLikeConstFetchReplacer = $literalCallLikeConstFetchReplacer; diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Trait_/AddTraitGetterReturnTypeBasedOnSetterRequiredRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Trait_/AddTraitGetterReturnTypeBasedOnSetterRequiredRector.php index 9da4a701229..be92af526f9 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Trait_/AddTraitGetterReturnTypeBasedOnSetterRequiredRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Trait_/AddTraitGetterReturnTypeBasedOnSetterRequiredRector.php @@ -23,14 +23,12 @@ final class AddTraitGetterReturnTypeBasedOnSetterRequiredRector extends Abstract { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; /** * @var string */ diff --git a/vendor/rector/rector-symfony/rules/Configs/ConfigArrayHandler/NestedConfigCallsFactory.php b/vendor/rector/rector-symfony/rules/Configs/ConfigArrayHandler/NestedConfigCallsFactory.php index 5120f350664..90830800e48 100644 --- a/vendor/rector/rector-symfony/rules/Configs/ConfigArrayHandler/NestedConfigCallsFactory.php +++ b/vendor/rector/rector-symfony/rules/Configs/ConfigArrayHandler/NestedConfigCallsFactory.php @@ -15,9 +15,8 @@ final class NestedConfigCallsFactory { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-symfony/rules/Configs/ConfigArrayHandler/SecurityAccessDecisionManagerConfigArrayHandler.php b/vendor/rector/rector-symfony/rules/Configs/ConfigArrayHandler/SecurityAccessDecisionManagerConfigArrayHandler.php index 324adbc8584..f1fec39ff83 100644 --- a/vendor/rector/rector-symfony/rules/Configs/ConfigArrayHandler/SecurityAccessDecisionManagerConfigArrayHandler.php +++ b/vendor/rector/rector-symfony/rules/Configs/ConfigArrayHandler/SecurityAccessDecisionManagerConfigArrayHandler.php @@ -4,8 +4,8 @@ declare (strict_types=1); namespace Rector\Symfony\Configs\ConfigArrayHandler; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Scalar\String_; diff --git a/vendor/rector/rector-symfony/rules/Configs/NodeAnalyser/ConfigServiceArgumentsResolver.php b/vendor/rector/rector-symfony/rules/Configs/NodeAnalyser/ConfigServiceArgumentsResolver.php index 3852bc76631..94480acd95a 100644 --- a/vendor/rector/rector-symfony/rules/Configs/NodeAnalyser/ConfigServiceArgumentsResolver.php +++ b/vendor/rector/rector-symfony/rules/Configs/NodeAnalyser/ConfigServiceArgumentsResolver.php @@ -12,19 +12,16 @@ final class ConfigServiceArgumentsResolver { /** * @readonly - * @var \Rector\Symfony\PhpParser\NamedSimplePhpParser */ - private $namedSimplePhpParser; + private NamedSimplePhpParser $namedSimplePhpParser; /** * @readonly - * @var \PhpParser\NodeTraverser */ - private $nodeTraverser; + private NodeTraverser $nodeTraverser; /** * @readonly - * @var \Rector\Symfony\Configs\NodeVisitor\CollectServiceArgumentsNodeVisitor */ - private $collectServiceArgumentsNodeVisitor; + private CollectServiceArgumentsNodeVisitor $collectServiceArgumentsNodeVisitor; public function __construct(NamedSimplePhpParser $namedSimplePhpParser) { $this->namedSimplePhpParser = $namedSimplePhpParser; diff --git a/vendor/rector/rector-symfony/rules/Configs/NodeVisitor/CollectServiceArgumentsNodeVisitor.php b/vendor/rector/rector-symfony/rules/Configs/NodeVisitor/CollectServiceArgumentsNodeVisitor.php index f57902496f7..643f9ff6197 100644 --- a/vendor/rector/rector-symfony/rules/Configs/NodeVisitor/CollectServiceArgumentsNodeVisitor.php +++ b/vendor/rector/rector-symfony/rules/Configs/NodeVisitor/CollectServiceArgumentsNodeVisitor.php @@ -6,13 +6,13 @@ namespace Rector\Symfony\Configs\NodeVisitor; use RectorPrefix202411\Nette\Utils\Strings; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\BinaryOp\Concat; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt; use PhpParser\NodeVisitorAbstract; @@ -32,12 +32,11 @@ final class CollectServiceArgumentsNodeVisitor extends NodeVisitorAbstract /** * @var array>> */ - private $servicesArgumentsByClass = []; + private array $servicesArgumentsByClass = []; /** * @readonly - * @var \Rector\Symfony\Configs\NodeAnalyser\SetServiceClassNameResolver */ - private $setServiceClassNameResolver; + private SetServiceClassNameResolver $setServiceClassNameResolver; public function __construct() { $this->setServiceClassNameResolver = new SetServiceClassNameResolver(); @@ -63,7 +62,7 @@ final class CollectServiceArgumentsNodeVisitor extends NodeVisitorAbstract } // 1. detect arg name + value $firstArg = $argMethodCall->getArgs()[0]; - if ($firstArg->value instanceof String_ || $firstArg->value instanceof LNumber) { + if ($firstArg->value instanceof String_ || $firstArg->value instanceof Int_) { $argumentLocation = $firstArg->value->value; if (\is_string($argumentLocation)) { // remove $ prefix diff --git a/vendor/rector/rector-symfony/rules/Configs/Rector/ClassMethod/AddRouteAnnotationRector.php b/vendor/rector/rector-symfony/rules/Configs/Rector/ClassMethod/AddRouteAnnotationRector.php index a335823a019..757dfd1d08c 100644 --- a/vendor/rector/rector-symfony/rules/Configs/Rector/ClassMethod/AddRouteAnnotationRector.php +++ b/vendor/rector/rector-symfony/rules/Configs/Rector/ClassMethod/AddRouteAnnotationRector.php @@ -28,29 +28,24 @@ final class AddRouteAnnotationRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\Contract\Bridge\Symfony\Routing\SymfonyRoutesProviderInterface */ - private $symfonyRoutesProvider; + private SymfonyRoutesProviderInterface $symfonyRoutesProvider; /** * @readonly - * @var \Rector\Symfony\PhpDocNode\SymfonyRouteTagValueNodeFactory */ - private $symfonyRouteTagValueNodeFactory; + private SymfonyRouteTagValueNodeFactory $symfonyRouteTagValueNodeFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\ArrayParser */ - private $arrayParser; + private ArrayParser $arrayParser; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(SymfonyRoutesProviderInterface $symfonyRoutesProvider, SymfonyRouteTagValueNodeFactory $symfonyRouteTagValueNodeFactory, ArrayParser $arrayParser, PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater) { $this->symfonyRoutesProvider = $symfonyRoutesProvider; diff --git a/vendor/rector/rector-symfony/rules/Configs/Rector/Class_/AutowireAttributeRector.php b/vendor/rector/rector-symfony/rules/Configs/Rector/Class_/AutowireAttributeRector.php index e3a440da4ad..b8c089d8e1b 100644 --- a/vendor/rector/rector-symfony/rules/Configs/Rector/Class_/AutowireAttributeRector.php +++ b/vendor/rector/rector-symfony/rules/Configs/Rector/Class_/AutowireAttributeRector.php @@ -35,17 +35,13 @@ final class AutowireAttributeRector extends AbstractRector implements Configurab { /** * @readonly - * @var \Rector\Symfony\Configs\NodeAnalyser\ConfigServiceArgumentsResolver */ - private $configServiceArgumentsResolver; + private ConfigServiceArgumentsResolver $configServiceArgumentsResolver; /** * @var string */ public const CONFIGS_DIRECTORY = 'configs_directory'; - /** - * @var string|null - */ - private $configsDirectory; + private ?string $configsDirectory = null; public function __construct(ConfigServiceArgumentsResolver $configServiceArgumentsResolver) { $this->configServiceArgumentsResolver = $configServiceArgumentsResolver; diff --git a/vendor/rector/rector-symfony/rules/Configs/Rector/Class_/ParameterBagToAutowireAttributeRector.php b/vendor/rector/rector-symfony/rules/Configs/Rector/Class_/ParameterBagToAutowireAttributeRector.php index 4b6e053446d..956b489bd5d 100644 --- a/vendor/rector/rector-symfony/rules/Configs/Rector/Class_/ParameterBagToAutowireAttributeRector.php +++ b/vendor/rector/rector-symfony/rules/Configs/Rector/Class_/ParameterBagToAutowireAttributeRector.php @@ -28,9 +28,8 @@ final class ParameterBagToAutowireAttributeRector extends AbstractRector impleme { /** * @readonly - * @var \Rector\Symfony\Configs\NodeFactory\AutowiredParamFactory */ - private $autowiredParamFactory; + private AutowiredParamFactory $autowiredParamFactory; /** * @var string */ diff --git a/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/MergeServiceNameTypeRector.php b/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/MergeServiceNameTypeRector.php index ca3ef263940..0c7a40f0b25 100644 --- a/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/MergeServiceNameTypeRector.php +++ b/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/MergeServiceNameTypeRector.php @@ -19,18 +19,13 @@ final class MergeServiceNameTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\SymfonyPhpClosureDetector */ - private $symfonyPhpClosureDetector; + private SymfonyPhpClosureDetector $symfonyPhpClosureDetector; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; - /** - * @var bool - */ - private $hasChanged = \false; + private ValueResolver $valueResolver; + private bool $hasChanged = \false; public function __construct(SymfonyPhpClosureDetector $symfonyPhpClosureDetector, ValueResolver $valueResolver) { $this->symfonyPhpClosureDetector = $symfonyPhpClosureDetector; diff --git a/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceArgsToServiceNamedArgRector.php b/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceArgsToServiceNamedArgRector.php index 419f19645c9..51a7f217ecf 100644 --- a/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceArgsToServiceNamedArgRector.php +++ b/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceArgsToServiceNamedArgRector.php @@ -5,9 +5,9 @@ namespace Rector\Symfony\Configs\Rector\Closure; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\MethodCall; @@ -28,19 +28,16 @@ final class ServiceArgsToServiceNamedArgRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\SymfonyPhpClosureDetector */ - private $symfonyPhpClosureDetector; + private SymfonyPhpClosureDetector $symfonyPhpClosureDetector; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(SymfonyPhpClosureDetector $symfonyPhpClosureDetector, ReflectionProvider $reflectionProvider, ValueResolver $valueResolver) { $this->symfonyPhpClosureDetector = $symfonyPhpClosureDetector; @@ -143,8 +140,8 @@ CODE_SAMPLE } $constructorParameterNames = []; $extendedMethodReflection = $serviceClassReflection->getConstructor(); - $parametersAcceptorWithPhpDocs = ParametersAcceptorSelector::combineAcceptors($extendedMethodReflection->getVariants()); - foreach ($parametersAcceptorWithPhpDocs->getParameters() as $parameterReflectionWithPhpDoc) { + $extendedParametersAcceptor = ParametersAcceptorSelector::combineAcceptors($extendedMethodReflection->getVariants()); + foreach ($extendedParametersAcceptor->getParameters() as $parameterReflectionWithPhpDoc) { /** @var PhpParameterReflection $parameterReflectionWithPhpDoc */ $constructorParameterNames[] = '$' . $parameterReflectionWithPhpDoc->getName(); } diff --git a/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceSetStringNameToClassNameRector.php b/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceSetStringNameToClassNameRector.php index 2483e6b0b0b..ab981d661da 100644 --- a/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceSetStringNameToClassNameRector.php +++ b/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceSetStringNameToClassNameRector.php @@ -18,14 +18,12 @@ final class ServiceSetStringNameToClassNameRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\SymfonyPhpClosureDetector */ - private $symfonyPhpClosureDetector; + private SymfonyPhpClosureDetector $symfonyPhpClosureDetector; /** * @readonly - * @var \Rector\Symfony\DataProvider\ServiceNameToTypeUniqueProvider */ - private $serviceNameToTypeUniqueProvider; + private ServiceNameToTypeUniqueProvider $serviceNameToTypeUniqueProvider; public function __construct(SymfonyPhpClosureDetector $symfonyPhpClosureDetector, ServiceNameToTypeUniqueProvider $serviceNameToTypeUniqueProvider) { $this->symfonyPhpClosureDetector = $symfonyPhpClosureDetector; diff --git a/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceSettersToSettersAutodiscoveryRector.php b/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceSettersToSettersAutodiscoveryRector.php index 5e83c6c0082..ca9a4386c5e 100644 --- a/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceSettersToSettersAutodiscoveryRector.php +++ b/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceSettersToSettersAutodiscoveryRector.php @@ -33,29 +33,24 @@ final class ServiceSettersToSettersAutodiscoveryRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\SymfonyPhpClosureDetector */ - private $symfonyPhpClosureDetector; + private SymfonyPhpClosureDetector $symfonyPhpClosureDetector; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Symfony\Component\Filesystem\Filesystem */ - private $filesystem; + private Filesystem $filesystem; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\Symfony\MinimalSharedStringSolver */ - private $minimalSharedStringSolver; + private MinimalSharedStringSolver $minimalSharedStringSolver; public function __construct(SymfonyPhpClosureDetector $symfonyPhpClosureDetector, ReflectionProvider $reflectionProvider, Filesystem $filesystem, ValueResolver $valueResolver) { $this->symfonyPhpClosureDetector = $symfonyPhpClosureDetector; @@ -115,9 +110,7 @@ CODE_SAMPLE return null; } $classNamesAndFilesPaths = $this->createClassNamesAndFilePaths($bareServicesSetMethodCallExpressions); - $classNames = \array_map(static function (ClassNameAndFilePath $classNameAndFilePath) : string { - return $classNameAndFilePath->getClassName(); - }, $classNamesAndFilesPaths); + $classNames = \array_map(static fn(ClassNameAndFilePath $classNameAndFilePath): string => $classNameAndFilePath->getClassName(), $classNamesAndFilesPaths); $sharedNamespace = $this->minimalSharedStringSolver->solve(...$classNames); $firstClassNameAndFilePath = $classNamesAndFilesPaths[0]; $classFilePath = $firstClassNameAndFilePath->getFilePath(); diff --git a/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceTagsToDefaultsAutoconfigureRector.php b/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceTagsToDefaultsAutoconfigureRector.php index e56776c7669..7ca3772914e 100644 --- a/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceTagsToDefaultsAutoconfigureRector.php +++ b/vendor/rector/rector-symfony/rules/Configs/Rector/Closure/ServiceTagsToDefaultsAutoconfigureRector.php @@ -22,14 +22,12 @@ final class ServiceTagsToDefaultsAutoconfigureRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\SymfonyPhpClosureDetector */ - private $symfonyPhpClosureDetector; + private SymfonyPhpClosureDetector $symfonyPhpClosureDetector; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var string[] */ diff --git a/vendor/rector/rector-symfony/rules/Configs/ValueObject/ServiceArguments.php b/vendor/rector/rector-symfony/rules/Configs/ValueObject/ServiceArguments.php index 7d6a5340d31..2e383a15a17 100644 --- a/vendor/rector/rector-symfony/rules/Configs/ValueObject/ServiceArguments.php +++ b/vendor/rector/rector-symfony/rules/Configs/ValueObject/ServiceArguments.php @@ -8,19 +8,18 @@ final class ServiceArguments { /** * @readonly - * @var string */ - private $className; + private string $className; /** * @var array<(string | int), (string | Expr)> * @readonly */ - private $params; + private array $params; /** * @var array<(string | int), (string | Expr)> * @readonly */ - private $envs; + private array $envs; /** * @param array $params * @param array $envs diff --git a/vendor/rector/rector-symfony/rules/DowngradeSymfony70/Rector/Class_/DowngradeSymfonyCommandAttributeRector.php b/vendor/rector/rector-symfony/rules/DowngradeSymfony70/Rector/Class_/DowngradeSymfonyCommandAttributeRector.php index 01a7d3c5a1c..101eca0c8a9 100644 --- a/vendor/rector/rector-symfony/rules/DowngradeSymfony70/Rector/Class_/DowngradeSymfonyCommandAttributeRector.php +++ b/vendor/rector/rector-symfony/rules/DowngradeSymfony70/Rector/Class_/DowngradeSymfonyCommandAttributeRector.php @@ -25,9 +25,8 @@ final class DowngradeSymfonyCommandAttributeRector extends AbstractRector { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ReflectionResolver $reflectionResolver) { $this->reflectionResolver = $reflectionResolver; diff --git a/vendor/rector/rector-symfony/rules/SwiftMailer/Rector/ClassMethod/SwiftMessageToEmailRector.php b/vendor/rector/rector-symfony/rules/SwiftMailer/Rector/ClassMethod/SwiftMessageToEmailRector.php index d088087ac7b..2c0dd7f36c7 100644 --- a/vendor/rector/rector-symfony/rules/SwiftMailer/Rector/ClassMethod/SwiftMessageToEmailRector.php +++ b/vendor/rector/rector-symfony/rules/SwiftMailer/Rector/ClassMethod/SwiftMessageToEmailRector.php @@ -5,8 +5,9 @@ namespace Rector\Symfony\SwiftMailer\Rector\ClassMethod; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; +use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\New_; use PhpParser\Node\Expr\StaticCall; @@ -35,11 +36,11 @@ final class SwiftMessageToEmailRector extends AbstractRector /** * @var array */ - private $basicMapping = ['setSubject' => 'subject', 'setPriority' => 'priority']; + private array $basicMapping = ['setSubject' => 'subject', 'setPriority' => 'priority']; /** * @var array */ - private $addressesMapping = ['addBcc' => null, 'addCc' => null, 'addFrom' => null, 'addReplyTo' => null, 'addTo' => null, 'setBcc' => 'bcc', 'setCc' => 'cc', 'setFrom' => 'from', 'setReplyTo' => 'replyTo', 'setTo' => 'to']; + private array $addressesMapping = ['addBcc' => null, 'addCc' => null, 'addFrom' => null, 'addReplyTo' => null, 'addTo' => null, 'setBcc' => 'bcc', 'setCc' => 'cc', 'setFrom' => 'from', 'setReplyTo' => 'replyTo', 'setTo' => 'to']; public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Convert \\Swift_Message into an \\Symfony\\Component\\Mime\\Email', [new CodeSample(<<<'CODE_SAMPLE' @@ -76,12 +77,15 @@ CODE_SAMPLE */ public function refactor(Node $node) : ?Node { - $this->traverseNodesWithCallable($node, function (Node $node) : ?Node { + $hasChanged = \false; + $this->traverseNodesWithCallable($node, function (Node $node) use(&$hasChanged) : ?Node { if ($node instanceof ClassMethod && $node->returnType instanceof FullyQualified && $this->isName($node->returnType, self::SWIFT_MESSAGE_FQN)) { $node->returnType = new FullyQualified(self::EMAIL_FQN); + $hasChanged = \true; } if ($node instanceof Param && $node->type instanceof FullyQualified && $this->isName($node->type, self::SWIFT_MESSAGE_FQN)) { $node->type = new FullyQualified(self::EMAIL_FQN); + $hasChanged = \true; } if ($node instanceof New_) { if (!$this->isName($node->class, self::SWIFT_MESSAGE_FQN)) { @@ -93,6 +97,7 @@ CODE_SAMPLE } else { $node->class = new FullyQualified(self::EMAIL_FQN); } + $hasChanged = \true; } if ($node instanceof MethodCall) { $name = $this->getName($node->name); @@ -104,6 +109,7 @@ CODE_SAMPLE if (!$objectType->isInstanceOf(self::SWIFT_MESSAGE_FQN)->yes() && !$objectType->isInstanceOf(self::EMAIL_FQN)->yes()) { return null; } + $hasChanged = \true; $this->handleBasicMapping($node, $name); $this->handleAddressMapping($node, $name); $this->handleBody($node, $name); @@ -117,6 +123,9 @@ CODE_SAMPLE } return $node; }); + if (!$hasChanged) { + return null; + } return $node; } private function handleBasicMapping(MethodCall $methodCall, string $name) : void @@ -141,7 +150,7 @@ CODE_SAMPLE $newArgs = []; foreach ($firstArg->value->items as $item) { if ($item instanceof ArrayItem) { - $newArgs[] = $this->nodeFactory->createArg($this->createAddress($item->key === null ? [new Arg($item->value)] : [new Arg($item->key), new Arg($item->value)])); + $newArgs[] = $this->nodeFactory->createArg($this->createAddress($item->key instanceof Expr ? [new Arg($item->key), new Arg($item->value)] : [new Arg($item->value)])); } } $methodCall->args = $newArgs; diff --git a/vendor/rector/rector-symfony/rules/SwiftMailer/Rector/MethodCall/SwiftSetBodyToHtmlPlainMethodCallRector.php b/vendor/rector/rector-symfony/rules/SwiftMailer/Rector/MethodCall/SwiftSetBodyToHtmlPlainMethodCallRector.php index b5bb4a340f5..d15251348d4 100644 --- a/vendor/rector/rector-symfony/rules/SwiftMailer/Rector/MethodCall/SwiftSetBodyToHtmlPlainMethodCallRector.php +++ b/vendor/rector/rector-symfony/rules/SwiftMailer/Rector/MethodCall/SwiftSetBodyToHtmlPlainMethodCallRector.php @@ -21,9 +21,8 @@ final class SwiftSetBodyToHtmlPlainMethodCallRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-symfony/rules/Symfony25/Rector/MethodCall/AddViolationToBuildViolationRector.php b/vendor/rector/rector-symfony/rules/Symfony25/Rector/MethodCall/AddViolationToBuildViolationRector.php index 2f1dba36dae..5257f41f087 100644 --- a/vendor/rector/rector-symfony/rules/Symfony25/Rector/MethodCall/AddViolationToBuildViolationRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony25/Rector/MethodCall/AddViolationToBuildViolationRector.php @@ -5,9 +5,9 @@ namespace Rector\Symfony\Symfony25\Rector\MethodCall; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Identifier; use PHPStan\Type\ObjectType; diff --git a/vendor/rector/rector-symfony/rules/Symfony25/Rector/MethodCall/MaxLengthSymfonyFormOptionToAttrRector.php b/vendor/rector/rector-symfony/rules/Symfony25/Rector/MethodCall/MaxLengthSymfonyFormOptionToAttrRector.php index 1b5a755aa81..af5f984dd6d 100644 --- a/vendor/rector/rector-symfony/rules/Symfony25/Rector/MethodCall/MaxLengthSymfonyFormOptionToAttrRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony25/Rector/MethodCall/MaxLengthSymfonyFormOptionToAttrRector.php @@ -5,8 +5,8 @@ namespace Rector\Symfony\Symfony25\Rector\MethodCall; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Scalar\String_; use PHPStan\Type\ObjectType; @@ -26,9 +26,8 @@ final class MaxLengthSymfonyFormOptionToAttrRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-symfony/rules/Symfony26/Rector/MethodCall/RedirectToRouteRector.php b/vendor/rector/rector-symfony/rules/Symfony26/Rector/MethodCall/RedirectToRouteRector.php index bd315beafe5..eb016d209cd 100644 --- a/vendor/rector/rector-symfony/rules/Symfony26/Rector/MethodCall/RedirectToRouteRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony26/Rector/MethodCall/RedirectToRouteRector.php @@ -19,14 +19,12 @@ final class RedirectToRouteRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer */ - private $controllerAnalyzer; + private ControllerAnalyzer $controllerAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ControllerAnalyzer $controllerAnalyzer, ValueResolver $valueResolver) { $this->controllerAnalyzer = $controllerAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Symfony27/Rector/MethodCall/ChangeCollectionTypeOptionNameFromTypeToEntryTypeRector.php b/vendor/rector/rector-symfony/rules/Symfony27/Rector/MethodCall/ChangeCollectionTypeOptionNameFromTypeToEntryTypeRector.php index 0d8d965c7c8..e5ef0e1e246 100644 --- a/vendor/rector/rector-symfony/rules/Symfony27/Rector/MethodCall/ChangeCollectionTypeOptionNameFromTypeToEntryTypeRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony27/Rector/MethodCall/ChangeCollectionTypeOptionNameFromTypeToEntryTypeRector.php @@ -4,9 +4,9 @@ declare (strict_types=1); namespace Rector\Symfony\Symfony27\Rector\MethodCall; use PhpParser\Node; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Scalar\String_; use Rector\PhpParser\Node\Value\ValueResolver; @@ -25,24 +25,20 @@ final class ChangeCollectionTypeOptionNameFromTypeToEntryTypeRector extends Abst { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormAddMethodCallAnalyzer */ - private $formAddMethodCallAnalyzer; + private FormAddMethodCallAnalyzer $formAddMethodCallAnalyzer; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormOptionsArrayMatcher */ - private $formOptionsArrayMatcher; + private FormOptionsArrayMatcher $formOptionsArrayMatcher; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormCollectionAnalyzer */ - private $formCollectionAnalyzer; + private FormCollectionAnalyzer $formCollectionAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var array */ diff --git a/vendor/rector/rector-symfony/rules/Symfony28/Rector/MethodCall/GetToConstructorInjectionRector.php b/vendor/rector/rector-symfony/rules/Symfony28/Rector/MethodCall/GetToConstructorInjectionRector.php index 03bf46d9990..bae90521566 100644 --- a/vendor/rector/rector-symfony/rules/Symfony28/Rector/MethodCall/GetToConstructorInjectionRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony28/Rector/MethodCall/GetToConstructorInjectionRector.php @@ -20,19 +20,16 @@ final class GetToConstructorInjectionRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\DependencyInjectionMethodCallAnalyzer */ - private $dependencyInjectionMethodCallAnalyzer; + private DependencyInjectionMethodCallAnalyzer $dependencyInjectionMethodCallAnalyzer; /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ContainerAwareAnalyzer */ - private $containerAwareAnalyzer; + private ContainerAwareAnalyzer $containerAwareAnalyzer; /** * @readonly - * @var \Rector\NodeManipulator\ClassDependencyManipulator */ - private $classDependencyManipulator; + private ClassDependencyManipulator $classDependencyManipulator; public function __construct(DependencyInjectionMethodCallAnalyzer $dependencyInjectionMethodCallAnalyzer, ContainerAwareAnalyzer $containerAwareAnalyzer, ClassDependencyManipulator $classDependencyManipulator) { $this->dependencyInjectionMethodCallAnalyzer = $dependencyInjectionMethodCallAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Symfony28/Rector/StaticCall/ParseFileRector.php b/vendor/rector/rector-symfony/rules/Symfony28/Rector/StaticCall/ParseFileRector.php index 0c671fe100f..931d400434a 100644 --- a/vendor/rector/rector-symfony/rules/Symfony28/Rector/StaticCall/ParseFileRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony28/Rector/StaticCall/ParseFileRector.php @@ -23,9 +23,8 @@ final class ParseFileRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ - private $betterStandardPrinter; + private BetterStandardPrinter $betterStandardPrinter; /** * @var string * @changelog https://regex101.com/r/ZaY42i/1 diff --git a/vendor/rector/rector-symfony/rules/Symfony30/Rector/ClassMethod/FormTypeGetParentRector.php b/vendor/rector/rector-symfony/rules/Symfony30/Rector/ClassMethod/FormTypeGetParentRector.php index 1a45b45cc0e..bb2268e36be 100644 --- a/vendor/rector/rector-symfony/rules/Symfony30/Rector/ClassMethod/FormTypeGetParentRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony30/Rector/ClassMethod/FormTypeGetParentRector.php @@ -21,9 +21,8 @@ final class FormTypeGetParentRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\FormHelper\FormTypeStringToTypeProvider */ - private $formTypeStringToTypeProvider; + private FormTypeStringToTypeProvider $formTypeStringToTypeProvider; public function __construct(FormTypeStringToTypeProvider $formTypeStringToTypeProvider) { $this->formTypeStringToTypeProvider = $formTypeStringToTypeProvider; diff --git a/vendor/rector/rector-symfony/rules/Symfony30/Rector/ClassMethod/GetRequestRector.php b/vendor/rector/rector-symfony/rules/Symfony30/Rector/ClassMethod/GetRequestRector.php index aadc273be4a..53d5353f515 100644 --- a/vendor/rector/rector-symfony/rules/Symfony30/Rector/ClassMethod/GetRequestRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony30/Rector/ClassMethod/GetRequestRector.php @@ -25,27 +25,21 @@ final class GetRequestRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\Bridge\NodeAnalyzer\ControllerMethodAnalyzer */ - private $controllerMethodAnalyzer; + private ControllerMethodAnalyzer $controllerMethodAnalyzer; /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer */ - private $controllerAnalyzer; + private ControllerAnalyzer $controllerAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @var string */ private const REQUEST_CLASS = 'Symfony\\Component\\HttpFoundation\\Request'; - /** - * @var string|null - */ - private $requestVariableAndParamName; + private ?string $requestVariableAndParamName = null; public function __construct(ControllerMethodAnalyzer $controllerMethodAnalyzer, ControllerAnalyzer $controllerAnalyzer, BetterNodeFinder $betterNodeFinder) { $this->controllerMethodAnalyzer = $controllerMethodAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Symfony30/Rector/ClassMethod/RemoveDefaultGetBlockPrefixRector.php b/vendor/rector/rector-symfony/rules/Symfony30/Rector/ClassMethod/RemoveDefaultGetBlockPrefixRector.php index 361e58bbcc6..9121d966d58 100644 --- a/vendor/rector/rector-symfony/rules/Symfony30/Rector/ClassMethod/RemoveDefaultGetBlockPrefixRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony30/Rector/ClassMethod/RemoveDefaultGetBlockPrefixRector.php @@ -23,9 +23,8 @@ final class RemoveDefaultGetBlockPrefixRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; @@ -62,7 +61,7 @@ CODE_SAMPLE /** * @param Class_ $node */ - public function refactor(Node $node) + public function refactor(Node $node) : ?Class_ { if (!$node->extends instanceof Name) { return null; diff --git a/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/ChangeStringCollectionOptionToConstantRector.php b/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/ChangeStringCollectionOptionToConstantRector.php index 43961c728f3..e419e583b87 100644 --- a/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/ChangeStringCollectionOptionToConstantRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/ChangeStringCollectionOptionToConstantRector.php @@ -4,9 +4,9 @@ declare (strict_types=1); namespace Rector\Symfony\Symfony30\Rector\MethodCall; use PhpParser\Node; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Scalar\String_; use Rector\PhpParser\Node\Value\ValueResolver; @@ -28,29 +28,24 @@ final class ChangeStringCollectionOptionToConstantRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormAddMethodCallAnalyzer */ - private $formAddMethodCallAnalyzer; + private FormAddMethodCallAnalyzer $formAddMethodCallAnalyzer; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormOptionsArrayMatcher */ - private $formOptionsArrayMatcher; + private FormOptionsArrayMatcher $formOptionsArrayMatcher; /** * @readonly - * @var \Rector\Symfony\FormHelper\FormTypeStringToTypeProvider */ - private $formTypeStringToTypeProvider; + private FormTypeStringToTypeProvider $formTypeStringToTypeProvider; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormCollectionAnalyzer */ - private $formCollectionAnalyzer; + private FormCollectionAnalyzer $formCollectionAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(FormAddMethodCallAnalyzer $formAddMethodCallAnalyzer, FormOptionsArrayMatcher $formOptionsArrayMatcher, FormTypeStringToTypeProvider $formTypeStringToTypeProvider, FormCollectionAnalyzer $formCollectionAnalyzer, ValueResolver $valueResolver) { $this->formAddMethodCallAnalyzer = $formAddMethodCallAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/FormTypeInstanceToClassConstRector.php b/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/FormTypeInstanceToClassConstRector.php index 8d103dfa2e4..dd8b3c16aea 100644 --- a/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/FormTypeInstanceToClassConstRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/FormTypeInstanceToClassConstRector.php @@ -4,9 +4,9 @@ declare (strict_types=1); namespace Rector\Symfony\Symfony30\Rector\MethodCall; use PhpParser\Node; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\New_; use PhpParser\Node\Name; @@ -34,34 +34,28 @@ final class FormTypeInstanceToClassConstRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormInstanceToFormClassConstFetchConverter */ - private $formInstanceToFormClassConstFetchConverter; + private FormInstanceToFormClassConstFetchConverter $formInstanceToFormClassConstFetchConverter; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormAddMethodCallAnalyzer */ - private $formAddMethodCallAnalyzer; + private FormAddMethodCallAnalyzer $formAddMethodCallAnalyzer; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormOptionsArrayMatcher */ - private $formOptionsArrayMatcher; + private FormOptionsArrayMatcher $formOptionsArrayMatcher; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormCollectionAnalyzer */ - private $formCollectionAnalyzer; + private FormCollectionAnalyzer $formCollectionAnalyzer; /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer */ - private $controllerAnalyzer; + private ControllerAnalyzer $controllerAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(FormInstanceToFormClassConstFetchConverter $formInstanceToFormClassConstFetchConverter, FormAddMethodCallAnalyzer $formAddMethodCallAnalyzer, FormOptionsArrayMatcher $formOptionsArrayMatcher, FormCollectionAnalyzer $formCollectionAnalyzer, ControllerAnalyzer $controllerAnalyzer, ValueResolver $valueResolver) { $this->formInstanceToFormClassConstFetchConverter = $formInstanceToFormClassConstFetchConverter; diff --git a/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/OptionNameRector.php b/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/OptionNameRector.php index d15c1c39a12..6595ba96f7b 100644 --- a/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/OptionNameRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/OptionNameRector.php @@ -4,8 +4,8 @@ declare (strict_types=1); namespace Rector\Symfony\Symfony30\Rector\MethodCall; use PhpParser\Node; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Scalar\String_; use Rector\Rector\AbstractRector; @@ -20,14 +20,12 @@ final class OptionNameRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormAddMethodCallAnalyzer */ - private $formAddMethodCallAnalyzer; + private FormAddMethodCallAnalyzer $formAddMethodCallAnalyzer; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormOptionsArrayMatcher */ - private $formOptionsArrayMatcher; + private FormOptionsArrayMatcher $formOptionsArrayMatcher; /** * @var array */ diff --git a/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/ReadOnlyOptionToAttributeRector.php b/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/ReadOnlyOptionToAttributeRector.php index 18c1b8bc169..3d464af6887 100644 --- a/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/ReadOnlyOptionToAttributeRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/ReadOnlyOptionToAttributeRector.php @@ -4,8 +4,8 @@ declare (strict_types=1); namespace Rector\Symfony\Symfony30\Rector\MethodCall; use PhpParser\Node; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Scalar\String_; use Rector\Rector\AbstractRector; @@ -21,19 +21,16 @@ final class ReadOnlyOptionToAttributeRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeManipulator\ArrayManipulator */ - private $arrayManipulator; + private ArrayManipulator $arrayManipulator; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormAddMethodCallAnalyzer */ - private $formAddMethodCallAnalyzer; + private FormAddMethodCallAnalyzer $formAddMethodCallAnalyzer; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormOptionsArrayMatcher */ - private $formOptionsArrayMatcher; + private FormOptionsArrayMatcher $formOptionsArrayMatcher; public function __construct(ArrayManipulator $arrayManipulator, FormAddMethodCallAnalyzer $formAddMethodCallAnalyzer, FormOptionsArrayMatcher $formOptionsArrayMatcher) { $this->arrayManipulator = $arrayManipulator; diff --git a/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/StringFormTypeToClassRector.php b/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/StringFormTypeToClassRector.php index 57ff25d70ff..cecadc213a2 100644 --- a/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/StringFormTypeToClassRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony30/Rector/MethodCall/StringFormTypeToClassRector.php @@ -21,14 +21,12 @@ final class StringFormTypeToClassRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormAddMethodCallAnalyzer */ - private $formAddMethodCallAnalyzer; + private FormAddMethodCallAnalyzer $formAddMethodCallAnalyzer; /** * @readonly - * @var \Rector\Symfony\FormHelper\FormTypeStringToTypeProvider */ - private $formTypeStringToTypeProvider; + private FormTypeStringToTypeProvider $formTypeStringToTypeProvider; /** * @var string */ diff --git a/vendor/rector/rector-symfony/rules/Symfony33/Rector/ClassConstFetch/ConsoleExceptionToErrorEventConstantRector.php b/vendor/rector/rector-symfony/rules/Symfony33/Rector/ClassConstFetch/ConsoleExceptionToErrorEventConstantRector.php index cc63c1557b8..e2004c2c735 100644 --- a/vendor/rector/rector-symfony/rules/Symfony33/Rector/ClassConstFetch/ConsoleExceptionToErrorEventConstantRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony33/Rector/ClassConstFetch/ConsoleExceptionToErrorEventConstantRector.php @@ -21,9 +21,8 @@ final class ConsoleExceptionToErrorEventConstantRector extends AbstractRector { /** * @readonly - * @var \PHPStan\Type\ObjectType */ - private $consoleEventsObjectType; + private ObjectType $consoleEventsObjectType; public function __construct() { $this->consoleEventsObjectType = new ObjectType('Symfony\\Component\\Console\\ConsoleEvents'); diff --git a/vendor/rector/rector-symfony/rules/Symfony34/Rector/ClassMethod/MergeMethodAnnotationToRouteAnnotationRector.php b/vendor/rector/rector-symfony/rules/Symfony34/Rector/ClassMethod/MergeMethodAnnotationToRouteAnnotationRector.php index 2dfb684ba1b..d08871b6541 100644 --- a/vendor/rector/rector-symfony/rules/Symfony34/Rector/ClassMethod/MergeMethodAnnotationToRouteAnnotationRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony34/Rector/ClassMethod/MergeMethodAnnotationToRouteAnnotationRector.php @@ -27,19 +27,16 @@ final class MergeMethodAnnotationToRouteAnnotationRector extends AbstractRector { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->phpDocTagRemover = $phpDocTagRemover; diff --git a/vendor/rector/rector-symfony/rules/Symfony34/Rector/ClassMethod/RemoveServiceFromSensioRouteRector.php b/vendor/rector/rector-symfony/rules/Symfony34/Rector/ClassMethod/RemoveServiceFromSensioRouteRector.php index 51e64e0d651..7a9b7871fcd 100644 --- a/vendor/rector/rector-symfony/rules/Symfony34/Rector/ClassMethod/RemoveServiceFromSensioRouteRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony34/Rector/ClassMethod/RemoveServiceFromSensioRouteRector.php @@ -20,14 +20,12 @@ final class RemoveServiceFromSensioRouteRector extends AbstractRector { /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory) { $this->docBlockUpdater = $docBlockUpdater; diff --git a/vendor/rector/rector-symfony/rules/Symfony34/Rector/ClassMethod/ReplaceSensioRouteAnnotationWithSymfonyRector.php b/vendor/rector/rector-symfony/rules/Symfony34/Rector/ClassMethod/ReplaceSensioRouteAnnotationWithSymfonyRector.php index 464dc02b3f4..bf41af63d70 100644 --- a/vendor/rector/rector-symfony/rules/Symfony34/Rector/ClassMethod/ReplaceSensioRouteAnnotationWithSymfonyRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony34/Rector/ClassMethod/ReplaceSensioRouteAnnotationWithSymfonyRector.php @@ -28,29 +28,24 @@ final class ReplaceSensioRouteAnnotationWithSymfonyRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\PhpDocNode\SymfonyRouteTagValueNodeFactory */ - private $symfonyRouteTagValueNodeFactory; + private SymfonyRouteTagValueNodeFactory $symfonyRouteTagValueNodeFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover */ - private $phpDocTagRemover; + private PhpDocTagRemover $phpDocTagRemover; /** * @readonly - * @var \Rector\Configuration\RenamedClassesDataCollector */ - private $renamedClassesDataCollector; + private RenamedClassesDataCollector $renamedClassesDataCollector; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @var string */ diff --git a/vendor/rector/rector-symfony/rules/Symfony34/Rector/Closure/ContainerGetNameToTypeInTestsRector.php b/vendor/rector/rector-symfony/rules/Symfony34/Rector/Closure/ContainerGetNameToTypeInTestsRector.php index 43ae6c3d343..1ecdc555f01 100644 --- a/vendor/rector/rector-symfony/rules/Symfony34/Rector/Closure/ContainerGetNameToTypeInTestsRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony34/Rector/Closure/ContainerGetNameToTypeInTestsRector.php @@ -22,14 +22,12 @@ final class ContainerGetNameToTypeInTestsRector extends AbstractRector { /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\ServiceTypeMethodCallResolver */ - private $serviceTypeMethodCallResolver; + private ServiceTypeMethodCallResolver $serviceTypeMethodCallResolver; public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, ServiceTypeMethodCallResolver $serviceTypeMethodCallResolver) { $this->testsNodeAnalyzer = $testsNodeAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Symfony40/Rector/ConstFetch/ConstraintUrlOptionRector.php b/vendor/rector/rector-symfony/rules/Symfony40/Rector/ConstFetch/ConstraintUrlOptionRector.php index 4e1a7768550..dcfd6ef3319 100644 --- a/vendor/rector/rector-symfony/rules/Symfony40/Rector/ConstFetch/ConstraintUrlOptionRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony40/Rector/ConstFetch/ConstraintUrlOptionRector.php @@ -4,9 +4,9 @@ declare (strict_types=1); namespace Rector\Symfony\Symfony40\Rector\ConstFetch; use PhpParser\Node; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\New_; use PHPStan\Type\ObjectType; use Rector\PhpParser\Node\Value\ValueResolver; @@ -22,9 +22,8 @@ final class ConstraintUrlOptionRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var string */ diff --git a/vendor/rector/rector-symfony/rules/Symfony42/Rector/MethodCall/ContainerGetToConstructorInjectionRector.php b/vendor/rector/rector-symfony/rules/Symfony42/Rector/MethodCall/ContainerGetToConstructorInjectionRector.php index a85d84e785e..5bc4cd80fe8 100644 --- a/vendor/rector/rector-symfony/rules/Symfony42/Rector/MethodCall/ContainerGetToConstructorInjectionRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony42/Rector/MethodCall/ContainerGetToConstructorInjectionRector.php @@ -29,19 +29,16 @@ final class ContainerGetToConstructorInjectionRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\DependencyInjectionMethodCallAnalyzer */ - private $dependencyInjectionMethodCallAnalyzer; + private DependencyInjectionMethodCallAnalyzer $dependencyInjectionMethodCallAnalyzer; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\NodeManipulator\ClassDependencyManipulator */ - private $classDependencyManipulator; + private ClassDependencyManipulator $classDependencyManipulator; public function __construct(DependencyInjectionMethodCallAnalyzer $dependencyInjectionMethodCallAnalyzer, TestsNodeAnalyzer $testsNodeAnalyzer, ClassDependencyManipulator $classDependencyManipulator) { $this->dependencyInjectionMethodCallAnalyzer = $dependencyInjectionMethodCallAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Symfony42/Rector/New_/RootNodeTreeBuilderRector.php b/vendor/rector/rector-symfony/rules/Symfony42/Rector/New_/RootNodeTreeBuilderRector.php index cc6be73f93e..659ed9da0a8 100644 --- a/vendor/rector/rector-symfony/rules/Symfony42/Rector/New_/RootNodeTreeBuilderRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony42/Rector/New_/RootNodeTreeBuilderRector.php @@ -25,9 +25,8 @@ final class RootNodeTreeBuilderRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(BetterNodeFinder $betterNodeFinder) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/vendor/rector/rector-symfony/rules/Symfony42/Rector/New_/StringToArrayArgumentProcessRector.php b/vendor/rector/rector-symfony/rules/Symfony42/Rector/New_/StringToArrayArgumentProcessRector.php index 86c4b9e34bd..46820507742 100644 --- a/vendor/rector/rector-symfony/rules/Symfony42/Rector/New_/StringToArrayArgumentProcessRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony42/Rector/New_/StringToArrayArgumentProcessRector.php @@ -29,9 +29,8 @@ final class StringToArrayArgumentProcessRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\NodeTransformer */ - private $nodeTransformer; + private NodeTransformer $nodeTransformer; /** * @var string[] */ diff --git a/vendor/rector/rector-symfony/rules/Symfony43/Rector/ClassMethod/EventDispatcherParentConstructRector.php b/vendor/rector/rector-symfony/rules/Symfony43/Rector/ClassMethod/EventDispatcherParentConstructRector.php index feabf161df5..2a912886b8d 100644 --- a/vendor/rector/rector-symfony/rules/Symfony43/Rector/ClassMethod/EventDispatcherParentConstructRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony43/Rector/ClassMethod/EventDispatcherParentConstructRector.php @@ -22,9 +22,8 @@ final class EventDispatcherParentConstructRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(BetterNodeFinder $betterNodeFinder) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/ConvertRenderTemplateShortNotationToBundleSyntaxRector.php b/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/ConvertRenderTemplateShortNotationToBundleSyntaxRector.php index 2e563fcbd12..1a6569b996f 100644 --- a/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/ConvertRenderTemplateShortNotationToBundleSyntaxRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/ConvertRenderTemplateShortNotationToBundleSyntaxRector.php @@ -25,9 +25,8 @@ final class ConvertRenderTemplateShortNotationToBundleSyntaxRector extends Abstr { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/GetCurrencyBundleMethodCallsToIntlRector.php b/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/GetCurrencyBundleMethodCallsToIntlRector.php index dde2de15d82..b8ee9277068 100644 --- a/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/GetCurrencyBundleMethodCallsToIntlRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/GetCurrencyBundleMethodCallsToIntlRector.php @@ -23,7 +23,7 @@ final class GetCurrencyBundleMethodCallsToIntlRector extends AbstractRector /** * @var IntlBundleClassToNewClass[] */ - private $intlBundleClassesToNewClasses = []; + private array $intlBundleClassesToNewClasses = []; public function __construct() { $this->intlBundleClassesToNewClasses[] = new IntlBundleClassToNewClass('Symfony\\Component\\Intl\\ResourceBundle\\LanguageBundleInterface', 'Symfony\\Component\\Intl\\Languages', ['getLanguageNames' => 'getNames', 'getLanguageName' => 'getName']); diff --git a/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/MakeDispatchFirstArgumentEventRector.php b/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/MakeDispatchFirstArgumentEventRector.php index 2b5d02856d9..db55e1dcd0d 100644 --- a/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/MakeDispatchFirstArgumentEventRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/MakeDispatchFirstArgumentEventRector.php @@ -24,14 +24,12 @@ final class MakeDispatchFirstArgumentEventRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeTypeResolver\TypeAnalyzer\StringTypeAnalyzer */ - private $stringTypeAnalyzer; + private StringTypeAnalyzer $stringTypeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(StringTypeAnalyzer $stringTypeAnalyzer, ValueResolver $valueResolver) { $this->stringTypeAnalyzer = $stringTypeAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/WebTestCaseAssertIsSuccessfulRector.php b/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/WebTestCaseAssertIsSuccessfulRector.php index f9ea30bb230..d4f0a20e068 100644 --- a/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/WebTestCaseAssertIsSuccessfulRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/WebTestCaseAssertIsSuccessfulRector.php @@ -25,24 +25,20 @@ final class WebTestCaseAssertIsSuccessfulRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\SymfonyTestCaseAnalyzer */ - private $symfonyTestCaseAnalyzer; + private SymfonyTestCaseAnalyzer $symfonyTestCaseAnalyzer; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(SymfonyTestCaseAnalyzer $symfonyTestCaseAnalyzer, TestsNodeAnalyzer $testsNodeAnalyzer, ExprAnalyzer $exprAnalyzer, ValueResolver $valueResolver) { $this->symfonyTestCaseAnalyzer = $symfonyTestCaseAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/WebTestCaseAssertResponseCodeRector.php b/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/WebTestCaseAssertResponseCodeRector.php index 36c84dd3518..71f7c7ff288 100644 --- a/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/WebTestCaseAssertResponseCodeRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony43/Rector/MethodCall/WebTestCaseAssertResponseCodeRector.php @@ -26,24 +26,20 @@ final class WebTestCaseAssertResponseCodeRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\SymfonyTestCaseAnalyzer */ - private $symfonyTestCaseAnalyzer; + private SymfonyTestCaseAnalyzer $symfonyTestCaseAnalyzer; /** * @readonly - * @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer */ - private $testsNodeAnalyzer; + private TestsNodeAnalyzer $testsNodeAnalyzer; /** * @readonly - * @var \Rector\NodeAnalyzer\ExprAnalyzer */ - private $exprAnalyzer; + private ExprAnalyzer $exprAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(SymfonyTestCaseAnalyzer $symfonyTestCaseAnalyzer, TestsNodeAnalyzer $testsNodeAnalyzer, ExprAnalyzer $exprAnalyzer, ValueResolver $valueResolver) { $this->symfonyTestCaseAnalyzer = $symfonyTestCaseAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector.php b/vendor/rector/rector-symfony/rules/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector.php index 0e1eb460597..95cf5ea2a90 100644 --- a/vendor/rector/rector-symfony/rules/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony44/Rector/ClassMethod/ConsoleExecuteReturnIntRector.php @@ -10,11 +10,10 @@ use PhpParser\Node\Expr\Cast\Int_; use PhpParser\Node\Expr\Ternary; use PhpParser\Node\FunctionLike; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Return_; -use PhpParser\NodeTraverser; +use PhpParser\NodeVisitor; use PHPStan\Type\IntegerType; use PHPStan\Type\ObjectType; use Rector\NodeAnalyzer\TerminatedNodeAnalyzer; @@ -30,18 +29,13 @@ final class ConsoleExecuteReturnIntRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\TerminatedNodeAnalyzer */ - private $terminatedNodeAnalyzer; + private TerminatedNodeAnalyzer $terminatedNodeAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; - /** - * @var bool - */ - private $hasChanged = \false; + private ValueResolver $valueResolver; + private bool $hasChanged = \false; public function __construct(TerminatedNodeAnalyzer $terminatedNodeAnalyzer, ValueResolver $valueResolver) { $this->terminatedNodeAnalyzer = $terminatedNodeAnalyzer; @@ -102,7 +96,7 @@ CODE_SAMPLE private function refactorReturnTypeDeclaration(ClassMethod $classMethod) : void { // already set - if ($classMethod->returnType !== null && $this->isName($classMethod->returnType, 'int')) { + if ($classMethod->returnType instanceof Node && $this->isName($classMethod->returnType, 'int')) { return; } $classMethod->returnType = new Identifier('int'); @@ -116,7 +110,7 @@ CODE_SAMPLE $this->traverseNodesWithCallable($classMethod->stmts, function (Node $node) : ?int { // skip anonymous class/function if ($node instanceof FunctionLike || $node instanceof Class_) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$node instanceof Return_) { return null; @@ -160,11 +154,8 @@ CODE_SAMPLE } private function processReturn0ToMethod(ClassMethod $classMethod) : void { - $stmts = (array) $classMethod->stmts; - \end($stmts); - $lastKey = \key($stmts); - \reset($stmts); - $return = new Return_(new LNumber(0)); + $lastKey = \array_key_last((array) $classMethod->stmts); + $return = new Return_(new \PhpParser\Node\Scalar\Int_(0)); if ($lastKey !== null && (isset($classMethod->stmts[$lastKey]) && $this->terminatedNodeAnalyzer->isAlwaysTerminated($classMethod, $classMethod->stmts[$lastKey], $return))) { return; } @@ -173,15 +164,15 @@ CODE_SAMPLE private function setReturnTo0InsteadOfNull(Return_ $return) : void { if (!$return->expr instanceof Expr) { - $return->expr = new LNumber(0); + $return->expr = new \PhpParser\Node\Scalar\Int_(0); return; } if ($this->valueResolver->isNull($return->expr)) { - $return->expr = new LNumber(0); + $return->expr = new \PhpParser\Node\Scalar\Int_(0); return; } if ($return->expr instanceof Coalesce && $this->valueResolver->isNull($return->expr->right)) { - $return->expr->right = new LNumber(0); + $return->expr->right = new \PhpParser\Node\Scalar\Int_(0); return; } if ($return->expr instanceof Ternary) { @@ -199,11 +190,11 @@ CODE_SAMPLE { $hasChanged = \false; if ($ternary->if instanceof Expr && $this->valueResolver->isNull($ternary->if)) { - $ternary->if = new LNumber(0); + $ternary->if = new \PhpParser\Node\Scalar\Int_(0); $hasChanged = \true; } if ($this->valueResolver->isNull($ternary->else)) { - $ternary->else = new LNumber(0); + $ternary->else = new \PhpParser\Node\Scalar\Int_(0); $hasChanged = \true; } return $hasChanged; diff --git a/vendor/rector/rector-symfony/rules/Symfony44/Rector/MethodCall/AuthorizationCheckerIsGrantedExtractorRector.php b/vendor/rector/rector-symfony/rules/Symfony44/Rector/MethodCall/AuthorizationCheckerIsGrantedExtractorRector.php index 6d46687c1c1..2acb540b8f7 100644 --- a/vendor/rector/rector-symfony/rules/Symfony44/Rector/MethodCall/AuthorizationCheckerIsGrantedExtractorRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony44/Rector/MethodCall/AuthorizationCheckerIsGrantedExtractorRector.php @@ -5,8 +5,8 @@ namespace Rector\Symfony\Symfony44\Rector\MethodCall; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\BinaryOp\BooleanOr; use PhpParser\Node\Expr\MethodCall; use PHPStan\Type\ObjectType; @@ -24,14 +24,12 @@ final class AuthorizationCheckerIsGrantedExtractorRector extends AbstractRector { /** * @readonly - * @var \Rector\NodeAnalyzer\ArgsAnalyzer */ - private $argsAnalyzer; + private ArgsAnalyzer $argsAnalyzer; /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer */ - private $controllerAnalyzer; + private ControllerAnalyzer $controllerAnalyzer; public function __construct(ArgsAnalyzer $argsAnalyzer, ControllerAnalyzer $controllerAnalyzer) { $this->argsAnalyzer = $argsAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Symfony51/Rector/ClassMethod/CommandConstantReturnCodeRector.php b/vendor/rector/rector-symfony/rules/Symfony51/Rector/ClassMethod/CommandConstantReturnCodeRector.php index 6a4b874e6ad..b9f0c2724cb 100644 --- a/vendor/rector/rector-symfony/rules/Symfony51/Rector/ClassMethod/CommandConstantReturnCodeRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony51/Rector/ClassMethod/CommandConstantReturnCodeRector.php @@ -5,7 +5,7 @@ namespace Rector\Symfony\Symfony51\Rector\ClassMethod; use PhpParser\Node; use PhpParser\Node\Expr\ClassConstFetch; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Return_; use PHPStan\Reflection\ClassReflection; @@ -24,14 +24,12 @@ final class CommandConstantReturnCodeRector extends AbstractRector { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(ReflectionResolver $reflectionResolver, BetterNodeFinder $betterNodeFinder) { $this->reflectionResolver = $reflectionResolver; @@ -87,7 +85,7 @@ CODE_SAMPLE /** @var Return_[] $returns */ $returns = $this->betterNodeFinder->findInstancesOfInFunctionLikeScoped($node, [Return_::class]); foreach ($returns as $return) { - if (!$return->expr instanceof LNumber) { + if (!$return->expr instanceof Int_) { continue; } $classConstFetch = $this->convertNumberToConstant($return->expr); @@ -102,11 +100,11 @@ CODE_SAMPLE } return null; } - private function convertNumberToConstant(LNumber $lNumber) : ?ClassConstFetch + private function convertNumberToConstant(Int_ $int) : ?ClassConstFetch { - if (!isset(SymfonyCommandConstantMap::RETURN_TO_CONST[$lNumber->value])) { + if (!isset(SymfonyCommandConstantMap::RETURN_TO_CONST[$int->value])) { return null; } - return $this->nodeFactory->createClassConstFetch('Symfony\\Component\\Console\\Command\\Command', SymfonyCommandConstantMap::RETURN_TO_CONST[$lNumber->value]); + return $this->nodeFactory->createClassConstFetch('Symfony\\Component\\Console\\Command\\Command', SymfonyCommandConstantMap::RETURN_TO_CONST[$int->value]); } } diff --git a/vendor/rector/rector-symfony/rules/Symfony51/Rector/Class_/LogoutHandlerToLogoutEventSubscriberRector.php b/vendor/rector/rector-symfony/rules/Symfony51/Rector/Class_/LogoutHandlerToLogoutEventSubscriberRector.php index eac4fbe48e8..25e6834547e 100644 --- a/vendor/rector/rector-symfony/rules/Symfony51/Rector/Class_/LogoutHandlerToLogoutEventSubscriberRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony51/Rector/Class_/LogoutHandlerToLogoutEventSubscriberRector.php @@ -25,24 +25,20 @@ final class LogoutHandlerToLogoutEventSubscriberRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeFactory\OnLogoutClassMethodFactory */ - private $onLogoutClassMethodFactory; + private OnLogoutClassMethodFactory $onLogoutClassMethodFactory; /** * @readonly - * @var \Rector\Symfony\NodeFactory\GetSubscribedEventsClassMethodFactory */ - private $getSubscribedEventsClassMethodFactory; + private GetSubscribedEventsClassMethodFactory $getSubscribedEventsClassMethodFactory; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \PHPStan\Type\ObjectType */ - private $logoutHandlerObjectType; + private ObjectType $logoutHandlerObjectType; public function __construct(OnLogoutClassMethodFactory $onLogoutClassMethodFactory, GetSubscribedEventsClassMethodFactory $getSubscribedEventsClassMethodFactory, ClassAnalyzer $classAnalyzer) { $this->onLogoutClassMethodFactory = $onLogoutClassMethodFactory; diff --git a/vendor/rector/rector-symfony/rules/Symfony51/Rector/Class_/LogoutSuccessHandlerToLogoutEventSubscriberRector.php b/vendor/rector/rector-symfony/rules/Symfony51/Rector/Class_/LogoutSuccessHandlerToLogoutEventSubscriberRector.php index 758d90f8216..7db83fa0d58 100644 --- a/vendor/rector/rector-symfony/rules/Symfony51/Rector/Class_/LogoutSuccessHandlerToLogoutEventSubscriberRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony51/Rector/Class_/LogoutSuccessHandlerToLogoutEventSubscriberRector.php @@ -24,24 +24,20 @@ final class LogoutSuccessHandlerToLogoutEventSubscriberRector extends AbstractRe { /** * @readonly - * @var \Rector\Symfony\NodeFactory\OnSuccessLogoutClassMethodFactory */ - private $onSuccessLogoutClassMethodFactory; + private OnSuccessLogoutClassMethodFactory $onSuccessLogoutClassMethodFactory; /** * @readonly - * @var \Rector\Symfony\NodeFactory\GetSubscribedEventsClassMethodFactory */ - private $getSubscribedEventsClassMethodFactory; + private GetSubscribedEventsClassMethodFactory $getSubscribedEventsClassMethodFactory; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \PHPStan\Type\ObjectType */ - private $successHandlerObjectType; + private ObjectType $successHandlerObjectType; public function __construct(OnSuccessLogoutClassMethodFactory $onSuccessLogoutClassMethodFactory, GetSubscribedEventsClassMethodFactory $getSubscribedEventsClassMethodFactory, ClassAnalyzer $classAnalyzer) { $this->onSuccessLogoutClassMethodFactory = $onSuccessLogoutClassMethodFactory; diff --git a/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/DefinitionAliasSetPrivateToSetPublicRector.php b/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/DefinitionAliasSetPrivateToSetPublicRector.php index 83230f93bef..5c8abe495a4 100644 --- a/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/DefinitionAliasSetPrivateToSetPublicRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/DefinitionAliasSetPrivateToSetPublicRector.php @@ -20,13 +20,12 @@ final class DefinitionAliasSetPrivateToSetPublicRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var ObjectType[] */ - private $definitionObjectTypes = []; + private array $definitionObjectTypes = []; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/FormBuilderSetDataMapperRector.php b/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/FormBuilderSetDataMapperRector.php index 28690a0f33a..96a9affb77f 100644 --- a/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/FormBuilderSetDataMapperRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/FormBuilderSetDataMapperRector.php @@ -28,14 +28,12 @@ final class FormBuilderSetDataMapperRector extends AbstractRector private const DATAMAPPER_CLASS = 'Symfony\\Component\\Form\\Extension\\Core\\DataMapper\\DataMapper'; /** * @readonly - * @var \PHPStan\Type\ObjectType */ - private $objectType; + private ObjectType $objectType; /** * @readonly - * @var \PHPStan\Type\ObjectType */ - private $dataMapperObjectType; + private ObjectType $dataMapperObjectType; public function __construct() { $this->objectType = new ObjectType(self::DATAMAPPER_INTERFACE); diff --git a/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/ReflectionExtractorEnableMagicCallExtractorRector.php b/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/ReflectionExtractorEnableMagicCallExtractorRector.php index 3dfa0ce1cbe..a4d33313440 100644 --- a/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/ReflectionExtractorEnableMagicCallExtractorRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/ReflectionExtractorEnableMagicCallExtractorRector.php @@ -5,8 +5,8 @@ namespace Rector\Symfony\Symfony52\Rector\MethodCall; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\BinaryOp\BitwiseOr; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Scalar\String_; @@ -23,9 +23,8 @@ final class ReflectionExtractorEnableMagicCallExtractorRector extends AbstractRe { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var string */ diff --git a/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/ValidatorBuilderEnableAnnotationMappingRector.php b/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/ValidatorBuilderEnableAnnotationMappingRector.php index 3ef004479b0..43abb33f7f4 100644 --- a/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/ValidatorBuilderEnableAnnotationMappingRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony52/Rector/MethodCall/ValidatorBuilderEnableAnnotationMappingRector.php @@ -19,9 +19,8 @@ final class ValidatorBuilderEnableAnnotationMappingRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-symfony/rules/Symfony52/Rector/New_/PropertyAccessorCreationBooleanToFlagsRector.php b/vendor/rector/rector-symfony/rules/Symfony52/Rector/New_/PropertyAccessorCreationBooleanToFlagsRector.php index 0890b791910..c751e9c9fbc 100644 --- a/vendor/rector/rector-symfony/rules/Symfony52/Rector/New_/PropertyAccessorCreationBooleanToFlagsRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony52/Rector/New_/PropertyAccessorCreationBooleanToFlagsRector.php @@ -21,9 +21,8 @@ final class PropertyAccessorCreationBooleanToFlagsRector extends AbstractRector { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-symfony/rules/Symfony53/Rector/StaticPropertyFetch/KernelTestCaseContainerPropertyDeprecationRector.php b/vendor/rector/rector-symfony/rules/Symfony53/Rector/StaticPropertyFetch/KernelTestCaseContainerPropertyDeprecationRector.php index 11db8ab674c..8d363acd55e 100644 --- a/vendor/rector/rector-symfony/rules/Symfony53/Rector/StaticPropertyFetch/KernelTestCaseContainerPropertyDeprecationRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony53/Rector/StaticPropertyFetch/KernelTestCaseContainerPropertyDeprecationRector.php @@ -17,9 +17,8 @@ final class KernelTestCaseContainerPropertyDeprecationRector extends AbstractRec { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\SymfonyTestCaseAnalyzer */ - private $symfonyTestCaseAnalyzer; + private SymfonyTestCaseAnalyzer $symfonyTestCaseAnalyzer; public function __construct(SymfonyTestCaseAnalyzer $symfonyTestCaseAnalyzer) { $this->symfonyTestCaseAnalyzer = $symfonyTestCaseAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Symfony60/Rector/FuncCall/ReplaceServiceArgumentRector.php b/vendor/rector/rector-symfony/rules/Symfony60/Rector/FuncCall/ReplaceServiceArgumentRector.php index a952967d8d9..d31a39545e1 100644 --- a/vendor/rector/rector-symfony/rules/Symfony60/Rector/FuncCall/ReplaceServiceArgumentRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony60/Rector/FuncCall/ReplaceServiceArgumentRector.php @@ -21,13 +21,12 @@ final class ReplaceServiceArgumentRector extends AbstractRector implements Confi { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @var ReplaceServiceArgument[] */ - private $replaceServiceArguments = []; + private array $replaceServiceArguments = []; public function __construct(ValueResolver $valueResolver) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-symfony/rules/Symfony60/Rector/MethodCall/GetHelperControllerToServiceRector.php b/vendor/rector/rector-symfony/rules/Symfony60/Rector/MethodCall/GetHelperControllerToServiceRector.php index 0d637f24486..31612b7d4ba 100644 --- a/vendor/rector/rector-symfony/rules/Symfony60/Rector/MethodCall/GetHelperControllerToServiceRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony60/Rector/MethodCall/GetHelperControllerToServiceRector.php @@ -27,19 +27,16 @@ final class GetHelperControllerToServiceRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer */ - private $controllerAnalyzer; + private ControllerAnalyzer $controllerAnalyzer; /** * @readonly - * @var \Rector\NodeManipulator\ClassDependencyManipulator */ - private $classDependencyManipulator; + private ClassDependencyManipulator $classDependencyManipulator; /** * @readonly - * @var \Rector\Naming\Naming\PropertyNaming */ - private $propertyNaming; + private PropertyNaming $propertyNaming; public function __construct(ControllerAnalyzer $controllerAnalyzer, ClassDependencyManipulator $classDependencyManipulator, PropertyNaming $propertyNaming) { $this->controllerAnalyzer = $controllerAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Symfony61/Rector/Class_/CommandConfigureToAttributeRector.php b/vendor/rector/rector-symfony/rules/Symfony61/Rector/Class_/CommandConfigureToAttributeRector.php index 942f9003576..9cbb33e9d1e 100644 --- a/vendor/rector/rector-symfony/rules/Symfony61/Rector/Class_/CommandConfigureToAttributeRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony61/Rector/Class_/CommandConfigureToAttributeRector.php @@ -32,14 +32,12 @@ final class CommandConfigureToAttributeRector extends AbstractRector implements { /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @var array */ @@ -150,7 +148,7 @@ CODE_SAMPLE private function findAndRemoveMethodExpr(ClassMethod $classMethod, string $methodName) : ?Expr { $expr = null; - $this->traverseNodesWithCallable((array) $classMethod->stmts, function (Node $node) use(&$expr, $methodName) { + $this->traverseNodesWithCallable((array) $classMethod->stmts, function (Node $node) use(&$expr, $methodName) : ?Expr { // find setName() method call if (!$node instanceof MethodCall) { return null; diff --git a/vendor/rector/rector-symfony/rules/Symfony61/Rector/Class_/CommandPropertyToAttributeRector.php b/vendor/rector/rector-symfony/rules/Symfony61/Rector/Class_/CommandPropertyToAttributeRector.php index a578409e1c8..6408e64656d 100644 --- a/vendor/rector/rector-symfony/rules/Symfony61/Rector/Class_/CommandPropertyToAttributeRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony61/Rector/Class_/CommandPropertyToAttributeRector.php @@ -32,19 +32,16 @@ final class CommandPropertyToAttributeRector extends AbstractRector implements M { /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttributeFinder */ - private $attributeFinder; + private AttributeFinder $attributeFinder; public function __construct(PhpAttributeGroupFactory $phpAttributeGroupFactory, ReflectionProvider $reflectionProvider, AttributeFinder $attributeFinder) { $this->phpAttributeGroupFactory = $phpAttributeGroupFactory; diff --git a/vendor/rector/rector-symfony/rules/Symfony61/Rector/Class_/MagicClosureTwigExtensionToNativeMethodsRector.php b/vendor/rector/rector-symfony/rules/Symfony61/Rector/Class_/MagicClosureTwigExtensionToNativeMethodsRector.php index f0e4fffd305..9d48f5af4d2 100644 --- a/vendor/rector/rector-symfony/rules/Symfony61/Rector/Class_/MagicClosureTwigExtensionToNativeMethodsRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony61/Rector/Class_/MagicClosureTwigExtensionToNativeMethodsRector.php @@ -28,9 +28,8 @@ final class MagicClosureTwigExtensionToNativeMethodsRector extends AbstractRecto { /** * @readonly - * @var \Rector\NodeCollector\NodeAnalyzer\ArrayCallableMethodMatcher */ - private $arrayCallableMethodMatcher; + private ArrayCallableMethodMatcher $arrayCallableMethodMatcher; public function __construct(ArrayCallableMethodMatcher $arrayCallableMethodMatcher) { $this->arrayCallableMethodMatcher = $arrayCallableMethodMatcher; diff --git a/vendor/rector/rector-symfony/rules/Symfony61/Rector/StaticPropertyFetch/ErrorNamesPropertyToConstantRector.php b/vendor/rector/rector-symfony/rules/Symfony61/Rector/StaticPropertyFetch/ErrorNamesPropertyToConstantRector.php index fed10694089..8d48538890c 100644 --- a/vendor/rector/rector-symfony/rules/Symfony61/Rector/StaticPropertyFetch/ErrorNamesPropertyToConstantRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony61/Rector/StaticPropertyFetch/ErrorNamesPropertyToConstantRector.php @@ -20,9 +20,8 @@ final class ErrorNamesPropertyToConstantRector extends AbstractRector { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ReflectionResolver $reflectionResolver) { $this->reflectionResolver = $reflectionResolver; diff --git a/vendor/rector/rector-symfony/rules/Symfony62/Rector/ClassMethod/ParamConverterAttributeToMapEntityAttributeRector.php b/vendor/rector/rector-symfony/rules/Symfony62/Rector/ClassMethod/ParamConverterAttributeToMapEntityAttributeRector.php index 050fb97ac87..cbfb2b27379 100644 --- a/vendor/rector/rector-symfony/rules/Symfony62/Rector/ClassMethod/ParamConverterAttributeToMapEntityAttributeRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony62/Rector/ClassMethod/ParamConverterAttributeToMapEntityAttributeRector.php @@ -5,11 +5,11 @@ namespace Rector\Symfony\Symfony62\Rector\ClassMethod; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Attribute; use PhpParser\Node\AttributeGroup; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Name\FullyQualified; diff --git a/vendor/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageHandlerInterfaceToAttributeRector.php b/vendor/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageHandlerInterfaceToAttributeRector.php index f3091b14346..ff9c506e034 100644 --- a/vendor/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageHandlerInterfaceToAttributeRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageHandlerInterfaceToAttributeRector.php @@ -22,24 +22,20 @@ final class MessageHandlerInterfaceToAttributeRector extends AbstractRector impl { /** * @readonly - * @var \Rector\Symfony\Helper\MessengerHelper */ - private $messengerHelper; + private MessengerHelper $messengerHelper; /** * @readonly - * @var \Rector\Symfony\NodeManipulator\ClassManipulator */ - private $classManipulator; + private ClassManipulator $classManipulator; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer */ - private $phpAttributeAnalyzer; + private PhpAttributeAnalyzer $phpAttributeAnalyzer; public function __construct(MessengerHelper $messengerHelper, ClassManipulator $classManipulator, ClassAnalyzer $classAnalyzer, PhpAttributeAnalyzer $phpAttributeAnalyzer) { $this->messengerHelper = $messengerHelper; diff --git a/vendor/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageSubscriberInterfaceToAttributeRector.php b/vendor/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageSubscriberInterfaceToAttributeRector.php index fdff74e4e11..c9b56e11729 100644 --- a/vendor/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageSubscriberInterfaceToAttributeRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony62/Rector/Class_/MessageSubscriberInterfaceToAttributeRector.php @@ -6,7 +6,6 @@ namespace Rector\Symfony\Symfony62\Rector\Class_; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\Yield_; use PhpParser\Node\Identifier; @@ -32,32 +31,22 @@ final class MessageSubscriberInterfaceToAttributeRector extends AbstractRector i { /** * @readonly - * @var \Rector\Symfony\Helper\MessengerHelper */ - private $messengerHelper; + private MessengerHelper $messengerHelper; /** * @readonly - * @var \Rector\Symfony\NodeManipulator\ClassManipulator */ - private $classManipulator; + private ClassManipulator $classManipulator; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; - /** - * @var \PhpParser\Node\Stmt\Class_ - */ - private $subscriberClass; - /** - * @var string - */ - private $newInvokeMethodName; + private ValueResolver $valueResolver; + private Class_ $subscriberClass; + private string $newInvokeMethodName; public function __construct(MessengerHelper $messengerHelper, ClassManipulator $classManipulator, ClassAnalyzer $classAnalyzer, ValueResolver $valueResolver) { $this->messengerHelper = $messengerHelper; @@ -186,7 +175,7 @@ CODE_SAMPLE private function parseArguments(Array_ $array, string &$method) : array { foreach ($array->items as $item) { - if (!$item instanceof ArrayItem || !$item->key instanceof Expr || !$item->value instanceof Expr) { + if (!$item->value instanceof Expr) { continue; } $key = (string) $this->valueResolver->getValue($item->key); diff --git a/vendor/rector/rector-symfony/rules/Symfony62/Rector/MethodCall/SimplifyFormRenderingRector.php b/vendor/rector/rector-symfony/rules/Symfony62/Rector/MethodCall/SimplifyFormRenderingRector.php index b079fac2758..4195941ac77 100644 --- a/vendor/rector/rector-symfony/rules/Symfony62/Rector/MethodCall/SimplifyFormRenderingRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony62/Rector/MethodCall/SimplifyFormRenderingRector.php @@ -5,8 +5,8 @@ namespace Rector\Symfony\Symfony62\Rector\MethodCall; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PHPStan\Type\ObjectType; use Rector\Rector\AbstractRector; @@ -20,9 +20,8 @@ final class SimplifyFormRenderingRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer */ - private $controllerAnalyzer; + private ControllerAnalyzer $controllerAnalyzer; public function __construct(ControllerAnalyzer $controllerAnalyzer) { $this->controllerAnalyzer = $controllerAnalyzer; @@ -94,17 +93,14 @@ CODE_SAMPLE return $node; } /** - * @param ArrayItem[]|null[] $arrayItems + * @param ArrayItem[]$arrayItems * - * @return array|null + * @return array<(ArrayItem)>|null */ private function processRemoveCreateView(array $arrayItems) : ?array { $replaced = \false; foreach ($arrayItems as $arrayItem) { - if (!$arrayItem instanceof ArrayItem) { - continue; - } if (!$arrayItem->value instanceof MethodCall) { continue; } diff --git a/vendor/rector/rector-symfony/rules/Symfony63/Rector/Class_/SignalableCommandInterfaceReturnTypeRector.php b/vendor/rector/rector-symfony/rules/Symfony63/Rector/Class_/SignalableCommandInterfaceReturnTypeRector.php index 74459d70f90..99ae8915279 100644 --- a/vendor/rector/rector-symfony/rules/Symfony63/Rector/Class_/SignalableCommandInterfaceReturnTypeRector.php +++ b/vendor/rector/rector-symfony/rules/Symfony63/Rector/Class_/SignalableCommandInterfaceReturnTypeRector.php @@ -24,19 +24,16 @@ final class SignalableCommandInterfaceReturnTypeRector extends AbstractRector { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\ClassAnalyzer */ - private $classAnalyzer; + private ClassAnalyzer $classAnalyzer; /** * @readonly - * @var \Rector\VendorLocker\ParentClassMethodTypeOverrideGuard */ - private $parentClassMethodTypeOverrideGuard; + private ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; public function __construct(ClassAnalyzer $classAnalyzer, ParentClassMethodTypeOverrideGuard $parentClassMethodTypeOverrideGuard, StaticTypeMapper $staticTypeMapper) { $this->classAnalyzer = $classAnalyzer; diff --git a/vendor/rector/rector-symfony/rules/Twig134/Rector/Return_/SimpleFunctionAndFilterRector.php b/vendor/rector/rector-symfony/rules/Twig134/Rector/Return_/SimpleFunctionAndFilterRector.php index e0e31608c6f..839ecaca9ee 100644 --- a/vendor/rector/rector-symfony/rules/Twig134/Rector/Return_/SimpleFunctionAndFilterRector.php +++ b/vendor/rector/rector-symfony/rules/Twig134/Rector/Return_/SimpleFunctionAndFilterRector.php @@ -5,9 +5,9 @@ namespace Rector\Symfony\Twig134\Rector\Return_; use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\New_; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Scalar\String_; @@ -30,16 +30,14 @@ final class SimpleFunctionAndFilterRector extends AbstractRector { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** - * @var array> + * @var array */ private const OLD_TO_NEW_CLASSES = ['Twig_Function_Method' => 'Twig_SimpleFunction', 'Twig_Filter_Method' => 'Twig_SimpleFilter']; public function __construct(ReflectionResolver $reflectionResolver, ValueResolver $valueResolver) diff --git a/vendor/rector/rector-symfony/src/Annotation/AnnotationAnalyzer.php b/vendor/rector/rector-symfony/src/Annotation/AnnotationAnalyzer.php index 2e8be33914a..4b747120e38 100644 --- a/vendor/rector/rector-symfony/src/Annotation/AnnotationAnalyzer.php +++ b/vendor/rector/rector-symfony/src/Annotation/AnnotationAnalyzer.php @@ -13,9 +13,8 @@ final class AnnotationAnalyzer { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; public function __construct(PhpDocInfoFactory $phpDocInfoFactory) { $this->phpDocInfoFactory = $phpDocInfoFactory; diff --git a/vendor/rector/rector-symfony/src/ApplicationMetadata/ListenerServiceDefinitionProvider.php b/vendor/rector/rector-symfony/src/ApplicationMetadata/ListenerServiceDefinitionProvider.php index 271c6dbd909..40e0d262559 100644 --- a/vendor/rector/rector-symfony/src/ApplicationMetadata/ListenerServiceDefinitionProvider.php +++ b/vendor/rector/rector-symfony/src/ApplicationMetadata/ListenerServiceDefinitionProvider.php @@ -11,22 +11,18 @@ final class ListenerServiceDefinitionProvider { /** * @readonly - * @var \Rector\Symfony\DataProvider\ServiceMapProvider */ - private $serviceMapProvider; + private ServiceMapProvider $serviceMapProvider; /** * @var string * @see https://regex101.com/r/j6SAga/1 */ private const SYMFONY_FAMILY_REGEX = '#^(Symfony|Sensio|Doctrine)\\b#'; - /** - * @var bool - */ - private $areListenerClassesLoaded = \false; + private bool $areListenerClassesLoaded = \false; /** * @var ServiceDefinition[][][] */ - private $listenerClassesToEvents = []; + private array $listenerClassesToEvents = []; public function __construct(ServiceMapProvider $serviceMapProvider) { $this->serviceMapProvider = $serviceMapProvider; diff --git a/vendor/rector/rector-symfony/src/Bridge/NodeAnalyzer/ControllerMethodAnalyzer.php b/vendor/rector/rector-symfony/src/Bridge/NodeAnalyzer/ControllerMethodAnalyzer.php index 54fe9a5ca86..945e1fdd3a9 100644 --- a/vendor/rector/rector-symfony/src/Bridge/NodeAnalyzer/ControllerMethodAnalyzer.php +++ b/vendor/rector/rector-symfony/src/Bridge/NodeAnalyzer/ControllerMethodAnalyzer.php @@ -9,9 +9,8 @@ final class ControllerMethodAnalyzer { /** * @readonly - * @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer */ - private $controllerAnalyzer; + private ControllerAnalyzer $controllerAnalyzer; public function __construct(ControllerAnalyzer $controllerAnalyzer) { $this->controllerAnalyzer = $controllerAnalyzer; diff --git a/vendor/rector/rector-symfony/src/Bridge/Symfony/ContainerServiceProvider.php b/vendor/rector/rector-symfony/src/Bridge/Symfony/ContainerServiceProvider.php index b4474f0716e..ad3079d67f7 100644 --- a/vendor/rector/rector-symfony/src/Bridge/Symfony/ContainerServiceProvider.php +++ b/vendor/rector/rector-symfony/src/Bridge/Symfony/ContainerServiceProvider.php @@ -10,10 +10,7 @@ use RectorPrefix202411\Symfony\Component\DependencyInjection\Container; use RectorPrefix202411\Webmozart\Assert\Assert; final class ContainerServiceProvider { - /** - * @var object|null - */ - private $container; + private ?object $container = null; public function provideByName(string $serviceName) : object { /** @var Container $symfonyContainer */ diff --git a/vendor/rector/rector-symfony/src/Bridge/Symfony/Routing/SymfonyRoutesProvider.php b/vendor/rector/rector-symfony/src/Bridge/Symfony/Routing/SymfonyRoutesProvider.php index 7da3cb2bb52..4ddd2884925 100644 --- a/vendor/rector/rector-symfony/src/Bridge/Symfony/Routing/SymfonyRoutesProvider.php +++ b/vendor/rector/rector-symfony/src/Bridge/Symfony/Routing/SymfonyRoutesProvider.php @@ -15,13 +15,12 @@ final class SymfonyRoutesProvider implements SymfonyRoutesProviderInterface { /** * @readonly - * @var \Rector\Symfony\Bridge\Symfony\ContainerServiceProvider */ - private $containerServiceProvider; + private ContainerServiceProvider $containerServiceProvider; /** * @var SymfonyRouteMetadata[] */ - private $symfonyRouteMetadatas = []; + private array $symfonyRouteMetadatas = []; public function __construct(ContainerServiceProvider $containerServiceProvider) { $this->containerServiceProvider = $containerServiceProvider; diff --git a/vendor/rector/rector-symfony/src/BundleClassResolver.php b/vendor/rector/rector-symfony/src/BundleClassResolver.php index 1272adc20fd..953a2da50a4 100644 --- a/vendor/rector/rector-symfony/src/BundleClassResolver.php +++ b/vendor/rector/rector-symfony/src/BundleClassResolver.php @@ -15,24 +15,20 @@ final class BundleClassResolver { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Parser\RectorParser */ - private $rectorParser; + private RectorParser $rectorParser; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver, RectorParser $rectorParser, ReflectionProvider $reflectionProvider) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/vendor/rector/rector-symfony/src/DataProvider/ServiceMapProvider.php b/vendor/rector/rector-symfony/src/DataProvider/ServiceMapProvider.php index b2ea9ec0a28..0367ecc00c9 100644 --- a/vendor/rector/rector-symfony/src/DataProvider/ServiceMapProvider.php +++ b/vendor/rector/rector-symfony/src/DataProvider/ServiceMapProvider.php @@ -14,13 +14,9 @@ final class ServiceMapProvider { /** * @readonly - * @var \Rector\Symfony\ValueObjectFactory\ServiceMapFactory */ - private $serviceMapFactory; - /** - * @var \Rector\Symfony\ValueObject\ServiceMap\ServiceMap|null - */ - private $serviceMap; + private ServiceMapFactory $serviceMapFactory; + private ?ServiceMap $serviceMap = null; public function __construct(ServiceMapFactory $serviceMapFactory, ?ServiceMap $serviceMap = null) { $this->serviceMapFactory = $serviceMapFactory; diff --git a/vendor/rector/rector-symfony/src/DataProvider/ServiceNameToTypeUniqueProvider.php b/vendor/rector/rector-symfony/src/DataProvider/ServiceNameToTypeUniqueProvider.php index 9bc22f6b5a1..279d58a3ccb 100644 --- a/vendor/rector/rector-symfony/src/DataProvider/ServiceNameToTypeUniqueProvider.php +++ b/vendor/rector/rector-symfony/src/DataProvider/ServiceNameToTypeUniqueProvider.php @@ -7,9 +7,8 @@ final class ServiceNameToTypeUniqueProvider { /** * @readonly - * @var \Rector\Symfony\DataProvider\ServiceMapProvider */ - private $serviceMapProvider; + private \Rector\Symfony\DataProvider\ServiceMapProvider $serviceMapProvider; public function __construct(\Rector\Symfony\DataProvider\ServiceMapProvider $serviceMapProvider) { $this->serviceMapProvider = $serviceMapProvider; diff --git a/vendor/rector/rector-symfony/src/FormHelper/FormTypeStringToTypeProvider.php b/vendor/rector/rector-symfony/src/FormHelper/FormTypeStringToTypeProvider.php index 992c53aa200..746e7d545e9 100644 --- a/vendor/rector/rector-symfony/src/FormHelper/FormTypeStringToTypeProvider.php +++ b/vendor/rector/rector-symfony/src/FormHelper/FormTypeStringToTypeProvider.php @@ -10,9 +10,8 @@ final class FormTypeStringToTypeProvider { /** * @readonly - * @var \Rector\Symfony\DataProvider\ServiceMapProvider */ - private $serviceMapProvider; + private ServiceMapProvider $serviceMapProvider; /** * @var array */ @@ -20,7 +19,7 @@ final class FormTypeStringToTypeProvider /** * @var array */ - private $customServiceFormTypeByAlias = []; + private array $customServiceFormTypeByAlias = []; public function __construct(ServiceMapProvider $serviceMapProvider) { $this->serviceMapProvider = $serviceMapProvider; diff --git a/vendor/rector/rector-symfony/src/Helper/MessengerHelper.php b/vendor/rector/rector-symfony/src/Helper/MessengerHelper.php index 12141b90e87..24405f366a9 100644 --- a/vendor/rector/rector-symfony/src/Helper/MessengerHelper.php +++ b/vendor/rector/rector-symfony/src/Helper/MessengerHelper.php @@ -16,26 +16,20 @@ final class MessengerHelper { /** * @readonly - * @var \Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory */ - private $phpAttributeGroupFactory; + private PhpAttributeGroupFactory $phpAttributeGroupFactory; /** * @readonly - * @var \Rector\PhpAttribute\AttributeArrayNameInliner */ - private $attributeArrayNameInliner; + private AttributeArrayNameInliner $attributeArrayNameInliner; /** * @readonly - * @var \Rector\Symfony\DataProvider\ServiceMapProvider */ - private $serviceMapProvider; + private ServiceMapProvider $serviceMapProvider; public const MESSAGE_HANDLER_INTERFACE = 'Symfony\\Component\\Messenger\\Handler\\MessageHandlerInterface'; public const MESSAGE_SUBSCRIBER_INTERFACE = 'Symfony\\Component\\Messenger\\Handler\\MessageSubscriberInterface'; public const AS_MESSAGE_HANDLER_ATTRIBUTE = 'Symfony\\Component\\Messenger\\Attribute\\AsMessageHandler'; - /** - * @var string - */ - private $messengerTagName = 'messenger.message_handler'; + private string $messengerTagName = 'messenger.message_handler'; public function __construct(PhpAttributeGroupFactory $phpAttributeGroupFactory, AttributeArrayNameInliner $attributeArrayNameInliner, ServiceMapProvider $serviceMapProvider) { $this->phpAttributeGroupFactory = $phpAttributeGroupFactory; diff --git a/vendor/rector/rector-symfony/src/Helper/TemplateGuesser.php b/vendor/rector/rector-symfony/src/Helper/TemplateGuesser.php index f75e873cade..b56791aff32 100644 --- a/vendor/rector/rector-symfony/src/Helper/TemplateGuesser.php +++ b/vendor/rector/rector-symfony/src/Helper/TemplateGuesser.php @@ -18,14 +18,12 @@ final class TemplateGuesser { /** * @readonly - * @var \Rector\Symfony\BundleClassResolver */ - private $bundleClassResolver; + private BundleClassResolver $bundleClassResolver; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @var string * @see https://regex101.com/r/yZAUAC/1 diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/ClassAnnotationAssertResolver.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/ClassAnnotationAssertResolver.php index 258b0f893e3..0c2b0c4155d 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/ClassAnnotationAssertResolver.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/ClassAnnotationAssertResolver.php @@ -13,14 +13,12 @@ final class ClassAnnotationAssertResolver { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\Annotations\StmtMethodCallMatcher */ - private $stmtMethodCallMatcher; + private \Rector\Symfony\NodeAnalyzer\Annotations\StmtMethodCallMatcher $stmtMethodCallMatcher; /** * @readonly - * @var \Rector\Symfony\NodeFactory\Annotations\DoctrineAnnotationFromNewFactory */ - private $doctrineAnnotationFromNewFactory; + private DoctrineAnnotationFromNewFactory $doctrineAnnotationFromNewFactory; public function __construct(\Rector\Symfony\NodeAnalyzer\Annotations\StmtMethodCallMatcher $stmtMethodCallMatcher, DoctrineAnnotationFromNewFactory $doctrineAnnotationFromNewFactory) { $this->stmtMethodCallMatcher = $stmtMethodCallMatcher; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/MethodCallAnnotationAssertResolver.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/MethodCallAnnotationAssertResolver.php index 150b1b0fbe8..f0f99521e6d 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/MethodCallAnnotationAssertResolver.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/MethodCallAnnotationAssertResolver.php @@ -13,19 +13,16 @@ final class MethodCallAnnotationAssertResolver { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\Symfony\NodeFactory\Annotations\DoctrineAnnotationFromNewFactory */ - private $doctrineAnnotationFromNewFactory; + private DoctrineAnnotationFromNewFactory $doctrineAnnotationFromNewFactory; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\Annotations\StmtMethodCallMatcher */ - private $stmtMethodCallMatcher; + private \Rector\Symfony\NodeAnalyzer\Annotations\StmtMethodCallMatcher $stmtMethodCallMatcher; public function __construct(ValueResolver $valueResolver, DoctrineAnnotationFromNewFactory $doctrineAnnotationFromNewFactory, \Rector\Symfony\NodeAnalyzer\Annotations\StmtMethodCallMatcher $stmtMethodCallMatcher) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/PropertyAnnotationAssertResolver.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/PropertyAnnotationAssertResolver.php index 344b3f4c327..aee32dee2c1 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/PropertyAnnotationAssertResolver.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/PropertyAnnotationAssertResolver.php @@ -13,19 +13,16 @@ final class PropertyAnnotationAssertResolver { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\Symfony\NodeFactory\Annotations\DoctrineAnnotationFromNewFactory */ - private $doctrineAnnotationFromNewFactory; + private DoctrineAnnotationFromNewFactory $doctrineAnnotationFromNewFactory; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\Annotations\StmtMethodCallMatcher */ - private $stmtMethodCallMatcher; + private \Rector\Symfony\NodeAnalyzer\Annotations\StmtMethodCallMatcher $stmtMethodCallMatcher; public function __construct(ValueResolver $valueResolver, DoctrineAnnotationFromNewFactory $doctrineAnnotationFromNewFactory, \Rector\Symfony\NodeAnalyzer\Annotations\StmtMethodCallMatcher $stmtMethodCallMatcher) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/StmtMethodCallMatcher.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/StmtMethodCallMatcher.php index f5149dd7eb6..1d0c2e9b6ed 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/StmtMethodCallMatcher.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/Annotations/StmtMethodCallMatcher.php @@ -11,9 +11,8 @@ final class StmtMethodCallMatcher { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/ClassAnalyzer.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/ClassAnalyzer.php index d1cd5800686..1c7d27f7710 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/ClassAnalyzer.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/ClassAnalyzer.php @@ -9,9 +9,8 @@ final class ClassAnalyzer { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/DependencyInjectionMethodCallAnalyzer.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/DependencyInjectionMethodCallAnalyzer.php index 5e6d890c803..3761605149d 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/DependencyInjectionMethodCallAnalyzer.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/DependencyInjectionMethodCallAnalyzer.php @@ -16,29 +16,24 @@ final class DependencyInjectionMethodCallAnalyzer { /** * @readonly - * @var \Rector\Naming\Naming\PropertyNaming */ - private $propertyNaming; + private PropertyNaming $propertyNaming; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\ServiceTypeMethodCallResolver */ - private $serviceTypeMethodCallResolver; + private \Rector\Symfony\NodeAnalyzer\ServiceTypeMethodCallResolver $serviceTypeMethodCallResolver; /** * @readonly - * @var \Rector\Php80\NodeAnalyzer\PromotedPropertyResolver */ - private $promotedPropertyResolver; + private PromotedPropertyResolver $promotedPropertyResolver; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeManipulator\PropertyManipulator */ - private $propertyManipulator; + private PropertyManipulator $propertyManipulator; public function __construct(PropertyNaming $propertyNaming, \Rector\Symfony\NodeAnalyzer\ServiceTypeMethodCallResolver $serviceTypeMethodCallResolver, PromotedPropertyResolver $promotedPropertyResolver, NodeNameResolver $nodeNameResolver, PropertyManipulator $propertyManipulator) { $this->propertyNaming = $propertyNaming; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/FormAddMethodCallAnalyzer.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/FormAddMethodCallAnalyzer.php index 2105fe896b9..435803ddfd7 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/FormAddMethodCallAnalyzer.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/FormAddMethodCallAnalyzer.php @@ -12,18 +12,16 @@ final class FormAddMethodCallAnalyzer { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @var ObjectType[] */ - private $formObjectTypes = []; + private array $formObjectTypes = []; public function __construct(NodeTypeResolver $nodeTypeResolver, NodeNameResolver $nodeNameResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/FormCollectionAnalyzer.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/FormCollectionAnalyzer.php index 270f3b95543..6d5bcb4f9d8 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/FormCollectionAnalyzer.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/FormCollectionAnalyzer.php @@ -11,14 +11,12 @@ final class FormCollectionAnalyzer { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(ValueResolver $valueResolver, NodeNameResolver $nodeNameResolver) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/FormInstanceToFormClassConstFetchConverter.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/FormInstanceToFormClassConstFetchConverter.php index 01bfc73ad15..95b1164f8a0 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/FormInstanceToFormClassConstFetchConverter.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/FormInstanceToFormClassConstFetchConverter.php @@ -18,24 +18,20 @@ final class FormInstanceToFormClassConstFetchConverter { /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormType\CreateFormTypeOptionsArgMover */ - private $createFormTypeOptionsArgMover; + private CreateFormTypeOptionsArgMover $createFormTypeOptionsArgMover; /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \Rector\Symfony\NodeAnalyzer\FormType\FormTypeClassResolver */ - private $formTypeClassResolver; + private FormTypeClassResolver $formTypeClassResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(CreateFormTypeOptionsArgMover $createFormTypeOptionsArgMover, NodeFactory $nodeFactory, FormTypeClassResolver $formTypeClassResolver, NodeTypeResolver $nodeTypeResolver) { $this->createFormTypeOptionsArgMover = $createFormTypeOptionsArgMover; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/FormType/CreateFormTypeOptionsArgMover.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/FormType/CreateFormTypeOptionsArgMover.php index 8e86d1510b7..213b0007779 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/FormType/CreateFormTypeOptionsArgMover.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/FormType/CreateFormTypeOptionsArgMover.php @@ -4,8 +4,8 @@ declare (strict_types=1); namespace Rector\Symfony\NodeAnalyzer\FormType; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Scalar\String_; use PHPStan\Reflection\ReflectionProvider; @@ -15,14 +15,12 @@ final class CreateFormTypeOptionsArgMover { /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(ReflectionProvider $reflectionProvider, NodeFactory $nodeFactory) { $this->reflectionProvider = $reflectionProvider; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/FormType/FormTypeClassResolver.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/FormType/FormTypeClassResolver.php index 6e4443948c1..6c125205704 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/FormType/FormTypeClassResolver.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/FormType/FormTypeClassResolver.php @@ -12,14 +12,12 @@ final class FormTypeClassResolver { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; public function __construct(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/LiteralCallLikeConstFetchReplacer.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/LiteralCallLikeConstFetchReplacer.php index 3a4ed52f4f3..44eb1df5467 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/LiteralCallLikeConstFetchReplacer.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/LiteralCallLikeConstFetchReplacer.php @@ -7,16 +7,15 @@ use PhpParser\Node\Expr\CallLike; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\New_; use PhpParser\Node\Expr\StaticCall; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; use Rector\PhpParser\Node\NodeFactory; final class LiteralCallLikeConstFetchReplacer { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; public function __construct(NodeFactory $nodeFactory) { $this->nodeFactory = $nodeFactory; @@ -35,7 +34,7 @@ final class LiteralCallLikeConstFetchReplacer return null; } $arg = $args[$argPosition]; - if (!$arg->value instanceof String_ && !$arg->value instanceof LNumber) { + if (!$arg->value instanceof String_ && !$arg->value instanceof Int_) { return null; } $scalar = $arg->value; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/RouteRequiredParamNameToTypesResolver.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/RouteRequiredParamNameToTypesResolver.php index 9f8f39bbc53..07e1e4dabc3 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/RouteRequiredParamNameToTypesResolver.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/RouteRequiredParamNameToTypesResolver.php @@ -3,9 +3,9 @@ declare (strict_types=1); namespace Rector\Symfony\NodeAnalyzer; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Attribute; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\Type\IntegerType; @@ -22,14 +22,12 @@ final class RouteRequiredParamNameToTypesResolver { /** * @readonly - * @var \Rector\Doctrine\NodeAnalyzer\AttrinationFinder */ - private $attrinationFinder; + private AttrinationFinder $attrinationFinder; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(AttrinationFinder $attrinationFinder, NodeNameResolver $nodeNameResolver) { $this->attrinationFinder = $attrinationFinder; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/ServiceTypeMethodCallResolver.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/ServiceTypeMethodCallResolver.php index 7ef1234883e..08da2871907 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/ServiceTypeMethodCallResolver.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/ServiceTypeMethodCallResolver.php @@ -16,14 +16,12 @@ final class ServiceTypeMethodCallResolver { /** * @readonly - * @var \Rector\Symfony\DataProvider\ServiceMapProvider */ - private $serviceMapProvider; + private ServiceMapProvider $serviceMapProvider; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(ServiceMapProvider $serviceMapProvider, NodeNameResolver $nodeNameResolver) { $this->serviceMapProvider = $serviceMapProvider; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/SymfonyClosureExtensionMatcher.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/SymfonyClosureExtensionMatcher.php index c25a1d76a3e..b05f2fc8ad7 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/SymfonyClosureExtensionMatcher.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/SymfonyClosureExtensionMatcher.php @@ -15,14 +15,12 @@ final class SymfonyClosureExtensionMatcher { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; public function __construct(NodeNameResolver $nodeNameResolver, ValueResolver $valueResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/SymfonyPhpClosureDetector.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/SymfonyPhpClosureDetector.php index 58d59ef5c14..9569687bf58 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/SymfonyPhpClosureDetector.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/SymfonyPhpClosureDetector.php @@ -7,7 +7,7 @@ use PhpParser\Node; use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Name\FullyQualified; -use PhpParser\NodeTraverser; +use PhpParser\NodeVisitor; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; use Rector\PhpParser\Node\BetterNodeFinder; @@ -15,19 +15,16 @@ final class SymfonyPhpClosureDetector { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; public function __construct(NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder, SimpleCallableNodeTraverser $simpleCallableNodeTraverser) { $this->nodeNameResolver = $nodeNameResolver; @@ -63,7 +60,7 @@ final class SymfonyPhpClosureDetector continue; } $hasDefaultsAutoconfigure = \true; - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } return null; }); diff --git a/vendor/rector/rector-symfony/src/NodeAnalyzer/SymfonyTestCaseAnalyzer.php b/vendor/rector/rector-symfony/src/NodeAnalyzer/SymfonyTestCaseAnalyzer.php index de3531d1efa..4fca26a36fe 100644 --- a/vendor/rector/rector-symfony/src/NodeAnalyzer/SymfonyTestCaseAnalyzer.php +++ b/vendor/rector/rector-symfony/src/NodeAnalyzer/SymfonyTestCaseAnalyzer.php @@ -10,9 +10,8 @@ final class SymfonyTestCaseAnalyzer { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ReflectionResolver $reflectionResolver) { $this->reflectionResolver = $reflectionResolver; diff --git a/vendor/rector/rector-symfony/src/NodeFactory/Annotations/DoctrineAnnotationFromNewFactory.php b/vendor/rector/rector-symfony/src/NodeFactory/Annotations/DoctrineAnnotationFromNewFactory.php index f001f58f862..dbbca40b327 100644 --- a/vendor/rector/rector-symfony/src/NodeFactory/Annotations/DoctrineAnnotationFromNewFactory.php +++ b/vendor/rector/rector-symfony/src/NodeFactory/Annotations/DoctrineAnnotationFromNewFactory.php @@ -13,9 +13,8 @@ final class DoctrineAnnotationFromNewFactory { /** * @readonly - * @var \Rector\Symfony\NodeFactory\Annotations\DoctrineAnnotationKeyToValuesResolver */ - private $doctrineAnnotationKeyToValuesResolver; + private \Rector\Symfony\NodeFactory\Annotations\DoctrineAnnotationKeyToValuesResolver $doctrineAnnotationKeyToValuesResolver; public function __construct(\Rector\Symfony\NodeFactory\Annotations\DoctrineAnnotationKeyToValuesResolver $doctrineAnnotationKeyToValuesResolver) { $this->doctrineAnnotationKeyToValuesResolver = $doctrineAnnotationKeyToValuesResolver; diff --git a/vendor/rector/rector-symfony/src/NodeFactory/Annotations/DoctrineAnnotationKeyToValuesResolver.php b/vendor/rector/rector-symfony/src/NodeFactory/Annotations/DoctrineAnnotationKeyToValuesResolver.php index 0b9fbe3ad47..9e697d7e295 100644 --- a/vendor/rector/rector-symfony/src/NodeFactory/Annotations/DoctrineAnnotationKeyToValuesResolver.php +++ b/vendor/rector/rector-symfony/src/NodeFactory/Annotations/DoctrineAnnotationKeyToValuesResolver.php @@ -3,22 +3,20 @@ declare (strict_types=1); namespace Rector\Symfony\NodeFactory\Annotations; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use Rector\PhpParser\Node\Value\ValueResolver; final class DoctrineAnnotationKeyToValuesResolver { /** * @readonly - * @var \Rector\PhpParser\Node\Value\ValueResolver */ - private $valueResolver; + private ValueResolver $valueResolver; /** * @readonly - * @var \Rector\Symfony\NodeFactory\Annotations\StringValueQuoteWrapper */ - private $stringValueQuoteWrapper; + private \Rector\Symfony\NodeFactory\Annotations\StringValueQuoteWrapper $stringValueQuoteWrapper; public function __construct(ValueResolver $valueResolver, \Rector\Symfony\NodeFactory\Annotations\StringValueQuoteWrapper $stringValueQuoteWrapper) { $this->valueResolver = $valueResolver; diff --git a/vendor/rector/rector-symfony/src/NodeFactory/Annotations/StringValueQuoteWrapper.php b/vendor/rector/rector-symfony/src/NodeFactory/Annotations/StringValueQuoteWrapper.php index 408a9a4e4b8..330c5203d09 100644 --- a/vendor/rector/rector-symfony/src/NodeFactory/Annotations/StringValueQuoteWrapper.php +++ b/vendor/rector/rector-symfony/src/NodeFactory/Annotations/StringValueQuoteWrapper.php @@ -10,9 +10,8 @@ final class StringValueQuoteWrapper { /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocParser\StaticDoctrineAnnotationParser\ArrayParser */ - private $arrayParser; + private ArrayParser $arrayParser; public function __construct(ArrayParser $arrayParser) { $this->arrayParser = $arrayParser; diff --git a/vendor/rector/rector-symfony/src/NodeFactory/ArrayFromCompactFactory.php b/vendor/rector/rector-symfony/src/NodeFactory/ArrayFromCompactFactory.php index 0ffd4b6bb4a..27fe83d975e 100644 --- a/vendor/rector/rector-symfony/src/NodeFactory/ArrayFromCompactFactory.php +++ b/vendor/rector/rector-symfony/src/NodeFactory/ArrayFromCompactFactory.php @@ -3,8 +3,8 @@ declare (strict_types=1); namespace Rector\Symfony\NodeFactory; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Scalar\String_; @@ -13,9 +13,8 @@ final class ArrayFromCompactFactory { /** * @readonly - * @var \Rector\NodeManipulator\FuncCallManipulator */ - private $funcCallManipulator; + private FuncCallManipulator $funcCallManipulator; public function __construct(FuncCallManipulator $funcCallManipulator) { $this->funcCallManipulator = $funcCallManipulator; diff --git a/vendor/rector/rector-symfony/src/NodeFactory/BareLogoutClassMethodFactory.php b/vendor/rector/rector-symfony/src/NodeFactory/BareLogoutClassMethodFactory.php index 104ed6a566c..f49c973e964 100644 --- a/vendor/rector/rector-symfony/src/NodeFactory/BareLogoutClassMethodFactory.php +++ b/vendor/rector/rector-symfony/src/NodeFactory/BareLogoutClassMethodFactory.php @@ -15,14 +15,12 @@ final class BareLogoutClassMethodFactory { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; public function __construct(NodeFactory $nodeFactory, PhpVersionProvider $phpVersionProvider) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-symfony/src/NodeFactory/EventReferenceFactory.php b/vendor/rector/rector-symfony/src/NodeFactory/EventReferenceFactory.php index d01f982e3f2..42b94ffe9f1 100644 --- a/vendor/rector/rector-symfony/src/NodeFactory/EventReferenceFactory.php +++ b/vendor/rector/rector-symfony/src/NodeFactory/EventReferenceFactory.php @@ -13,14 +13,12 @@ final class EventReferenceFactory { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \PHPStan\Reflection\ReflectionProvider */ - private $reflectionProvider; + private ReflectionProvider $reflectionProvider; public function __construct(NodeFactory $nodeFactory, ReflectionProvider $reflectionProvider) { $this->nodeFactory = $nodeFactory; diff --git a/vendor/rector/rector-symfony/src/NodeFactory/GetSubscribedEventsClassMethodFactory.php b/vendor/rector/rector-symfony/src/NodeFactory/GetSubscribedEventsClassMethodFactory.php index 337b052a418..52518f544e3 100644 --- a/vendor/rector/rector-symfony/src/NodeFactory/GetSubscribedEventsClassMethodFactory.php +++ b/vendor/rector/rector-symfony/src/NodeFactory/GetSubscribedEventsClassMethodFactory.php @@ -3,12 +3,12 @@ declare (strict_types=1); namespace Rector\Symfony\NodeFactory; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Identifier; -use PhpParser\Node\Scalar\LNumber; +use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Return_; @@ -32,34 +32,28 @@ final class GetSubscribedEventsClassMethodFactory { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \Rector\Privatization\NodeManipulator\VisibilityManipulator */ - private $visibilityManipulator; + private VisibilityManipulator $visibilityManipulator; /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger */ - private $phpDocTypeChanger; + private PhpDocTypeChanger $phpDocTypeChanger; /** * @readonly - * @var \Rector\Symfony\NodeFactory\EventReferenceFactory */ - private $eventReferenceFactory; + private \Rector\Symfony\NodeFactory\EventReferenceFactory $eventReferenceFactory; /** * @var string */ @@ -119,7 +113,7 @@ final class GetSubscribedEventsClassMethodFactory if ($priority !== null && $priority !== 0) { $methodNameWithPriorityArray = new Array_(); $methodNameWithPriorityArray->items[] = new ArrayItem(new String_($methodName)); - $methodNameWithPriorityArray->items[] = new ArrayItem(new LNumber($priority)); + $methodNameWithPriorityArray->items[] = new ArrayItem(new Int_($priority)); return new ArrayItem($methodNameWithPriorityArray, $expr); } return new ArrayItem(new String_($methodName), $expr); @@ -214,7 +208,7 @@ final class GetSubscribedEventsClassMethodFactory if ($eventListenerTag->getPriority() !== 0) { $methodNameWithPriorityArray = new Array_(); $methodNameWithPriorityArray->items[] = new ArrayItem(new String_($eventListenerTag->getMethod())); - $methodNameWithPriorityArray->items[] = new ArrayItem(new LNumber($eventListenerTag->getPriority())); + $methodNameWithPriorityArray->items[] = new ArrayItem(new Int_($eventListenerTag->getPriority())); return new ArrayItem($methodNameWithPriorityArray); } return new ArrayItem(new String_($eventListenerTag->getMethod())); diff --git a/vendor/rector/rector-symfony/src/NodeFactory/OnLogoutClassMethodFactory.php b/vendor/rector/rector-symfony/src/NodeFactory/OnLogoutClassMethodFactory.php index 0e62a3190b2..7d5183bb29b 100644 --- a/vendor/rector/rector-symfony/src/NodeFactory/OnLogoutClassMethodFactory.php +++ b/vendor/rector/rector-symfony/src/NodeFactory/OnLogoutClassMethodFactory.php @@ -16,19 +16,16 @@ final class OnLogoutClassMethodFactory { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\Symfony\NodeFactory\BareLogoutClassMethodFactory */ - private $bareLogoutClassMethodFactory; + private \Rector\Symfony\NodeFactory\BareLogoutClassMethodFactory $bareLogoutClassMethodFactory; /** * @readonly - * @var \Rector\NodeAnalyzer\ParamAnalyzer */ - private $paramAnalyzer; + private ParamAnalyzer $paramAnalyzer; /** * @var array */ diff --git a/vendor/rector/rector-symfony/src/NodeFactory/OnSuccessLogoutClassMethodFactory.php b/vendor/rector/rector-symfony/src/NodeFactory/OnSuccessLogoutClassMethodFactory.php index ccaf27b4d16..5832cfca9f6 100644 --- a/vendor/rector/rector-symfony/src/NodeFactory/OnSuccessLogoutClassMethodFactory.php +++ b/vendor/rector/rector-symfony/src/NodeFactory/OnSuccessLogoutClassMethodFactory.php @@ -13,7 +13,7 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\Return_; -use PhpParser\NodeTraverser; +use PhpParser\NodeVisitor; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; use Rector\PhpParser\Node\NodeFactory; @@ -21,24 +21,20 @@ final class OnSuccessLogoutClassMethodFactory { /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ - private $simpleCallableNodeTraverser; + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser; /** * @readonly - * @var \Rector\Symfony\NodeFactory\BareLogoutClassMethodFactory */ - private $bareLogoutClassMethodFactory; + private \Rector\Symfony\NodeFactory\BareLogoutClassMethodFactory $bareLogoutClassMethodFactory; /** * @var string */ @@ -82,7 +78,7 @@ final class OnSuccessLogoutClassMethodFactory { $this->simpleCallableNodeTraverser->traverseNodesWithCallable($classMethod, function (Node $node) { if ($node instanceof Param) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN; } if (!$node instanceof Variable) { return null; diff --git a/vendor/rector/rector-symfony/src/NodeFactory/ThisRenderFactory.php b/vendor/rector/rector-symfony/src/NodeFactory/ThisRenderFactory.php index cbb86200072..dff55e2d3f9 100644 --- a/vendor/rector/rector-symfony/src/NodeFactory/ThisRenderFactory.php +++ b/vendor/rector/rector-symfony/src/NodeFactory/ThisRenderFactory.php @@ -4,9 +4,9 @@ declare (strict_types=1); namespace Rector\Symfony\NodeFactory; use PhpParser\Node\Arg; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\Variable; @@ -26,29 +26,24 @@ final class ThisRenderFactory { /** * @readonly - * @var \Rector\Symfony\NodeFactory\ArrayFromCompactFactory */ - private $arrayFromCompactFactory; + private \Rector\Symfony\NodeFactory\ArrayFromCompactFactory $arrayFromCompactFactory; /** * @readonly - * @var \Rector\PhpParser\Node\NodeFactory */ - private $nodeFactory; + private NodeFactory $nodeFactory; /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @readonly - * @var \Rector\Symfony\Helper\TemplateGuesser */ - private $templateGuesser; + private TemplateGuesser $templateGuesser; public function __construct(\Rector\Symfony\NodeFactory\ArrayFromCompactFactory $arrayFromCompactFactory, NodeFactory $nodeFactory, NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, TemplateGuesser $templateGuesser) { $this->arrayFromCompactFactory = $arrayFromCompactFactory; diff --git a/vendor/rector/rector-symfony/src/NodeFinder/EmptyReturnNodeFinder.php b/vendor/rector/rector-symfony/src/NodeFinder/EmptyReturnNodeFinder.php index 93e9d5cda86..75f61355bcb 100644 --- a/vendor/rector/rector-symfony/src/NodeFinder/EmptyReturnNodeFinder.php +++ b/vendor/rector/rector-symfony/src/NodeFinder/EmptyReturnNodeFinder.php @@ -11,9 +11,8 @@ final class EmptyReturnNodeFinder { /** * @readonly - * @var \Rector\PhpParser\Node\BetterNodeFinder */ - private $betterNodeFinder; + private BetterNodeFinder $betterNodeFinder; public function __construct(BetterNodeFinder $betterNodeFinder) { $this->betterNodeFinder = $betterNodeFinder; diff --git a/vendor/rector/rector-symfony/src/NodeManipulator/ArrayManipulator.php b/vendor/rector/rector-symfony/src/NodeManipulator/ArrayManipulator.php index df7f91bee8e..082d91f52ae 100644 --- a/vendor/rector/rector-symfony/src/NodeManipulator/ArrayManipulator.php +++ b/vendor/rector/rector-symfony/src/NodeManipulator/ArrayManipulator.php @@ -3,8 +3,8 @@ declare (strict_types=1); namespace Rector\Symfony\NodeManipulator; +use PhpParser\Node\ArrayItem; use PhpParser\Node\Expr\Array_; -use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Scalar\String_; final class ArrayManipulator { diff --git a/vendor/rector/rector-symfony/src/NodeManipulator/ClassManipulator.php b/vendor/rector/rector-symfony/src/NodeManipulator/ClassManipulator.php index e9d6dc53e74..f99a0e1c5dc 100644 --- a/vendor/rector/rector-symfony/src/NodeManipulator/ClassManipulator.php +++ b/vendor/rector/rector-symfony/src/NodeManipulator/ClassManipulator.php @@ -9,9 +9,8 @@ final class ClassManipulator { /** * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver */ - private $nodeNameResolver; + private NodeNameResolver $nodeNameResolver; public function __construct(NodeNameResolver $nodeNameResolver) { $this->nodeNameResolver = $nodeNameResolver; diff --git a/vendor/rector/rector-symfony/src/PhpParser/NamedSimplePhpParser.php b/vendor/rector/rector-symfony/src/PhpParser/NamedSimplePhpParser.php index 348458db866..d0193bba7a0 100644 --- a/vendor/rector/rector-symfony/src/PhpParser/NamedSimplePhpParser.php +++ b/vendor/rector/rector-symfony/src/PhpParser/NamedSimplePhpParser.php @@ -12,13 +12,12 @@ final class NamedSimplePhpParser { /** * @readonly - * @var \PhpParser\Parser */ - private $phpParser; + private Parser $phpParser; public function __construct() { $parserFactory = new ParserFactory(); - $this->phpParser = $parserFactory->create(ParserFactory::ONLY_PHP7); + $this->phpParser = $parserFactory->createForNewestSupportedVersion(); } /** * @return Stmt[] diff --git a/vendor/rector/rector-symfony/src/TypeAnalyzer/ContainerAwareAnalyzer.php b/vendor/rector/rector-symfony/src/TypeAnalyzer/ContainerAwareAnalyzer.php index 62648d96402..d0430e0aa60 100644 --- a/vendor/rector/rector-symfony/src/TypeAnalyzer/ContainerAwareAnalyzer.php +++ b/vendor/rector/rector-symfony/src/TypeAnalyzer/ContainerAwareAnalyzer.php @@ -10,13 +10,12 @@ final class ContainerAwareAnalyzer { /** * @readonly - * @var \Rector\NodeTypeResolver\NodeTypeResolver */ - private $nodeTypeResolver; + private NodeTypeResolver $nodeTypeResolver; /** * @var ObjectType[] */ - private $getMethodAwareObjectTypes = []; + private array $getMethodAwareObjectTypes = []; public function __construct(NodeTypeResolver $nodeTypeResolver) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/vendor/rector/rector-symfony/src/TypeAnalyzer/ControllerAnalyzer.php b/vendor/rector/rector-symfony/src/TypeAnalyzer/ControllerAnalyzer.php index e0ea804e1e0..b6c4be73439 100644 --- a/vendor/rector/rector-symfony/src/TypeAnalyzer/ControllerAnalyzer.php +++ b/vendor/rector/rector-symfony/src/TypeAnalyzer/ControllerAnalyzer.php @@ -17,9 +17,8 @@ final class ControllerAnalyzer { /** * @readonly - * @var \Rector\Reflection\ReflectionResolver */ - private $reflectionResolver; + private ReflectionResolver $reflectionResolver; public function __construct(ReflectionResolver $reflectionResolver) { $this->reflectionResolver = $reflectionResolver; diff --git a/vendor/rector/rector-symfony/src/TypeDeclaration/ReturnTypeDeclarationUpdater.php b/vendor/rector/rector-symfony/src/TypeDeclaration/ReturnTypeDeclarationUpdater.php index 0d9652cade4..d86be635d71 100644 --- a/vendor/rector/rector-symfony/src/TypeDeclaration/ReturnTypeDeclarationUpdater.php +++ b/vendor/rector/rector-symfony/src/TypeDeclaration/ReturnTypeDeclarationUpdater.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\Symfony\TypeDeclaration; +use PhpParser\Node; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode; @@ -19,24 +20,20 @@ final class ReturnTypeDeclarationUpdater { /** * @readonly - * @var \Rector\Php\PhpVersionProvider */ - private $phpVersionProvider; + private PhpVersionProvider $phpVersionProvider; /** * @readonly - * @var \Rector\StaticTypeMapper\StaticTypeMapper */ - private $staticTypeMapper; + private StaticTypeMapper $staticTypeMapper; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory */ - private $phpDocInfoFactory; + private PhpDocInfoFactory $phpDocInfoFactory; /** * @readonly - * @var \Rector\Comments\NodeDocBlock\DocBlockUpdater */ - private $docBlockUpdater; + private DocBlockUpdater $docBlockUpdater; public function __construct(PhpVersionProvider $phpVersionProvider, StaticTypeMapper $staticTypeMapper, PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater) { $this->phpVersionProvider = $phpVersionProvider; @@ -78,7 +75,7 @@ final class ReturnTypeDeclarationUpdater } $objectType = new ObjectType($className); // change return type - if ($classMethod->returnType !== null) { + if ($classMethod->returnType instanceof Node) { $returnType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($classMethod->returnType); if ($objectType->isSuperTypeOf($returnType)->yes()) { return; diff --git a/vendor/rector/rector-symfony/src/ValueObject/ClassNameAndFilePath.php b/vendor/rector/rector-symfony/src/ValueObject/ClassNameAndFilePath.php index 19cdd6e554b..962ff65ac19 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/ClassNameAndFilePath.php +++ b/vendor/rector/rector-symfony/src/ValueObject/ClassNameAndFilePath.php @@ -7,14 +7,12 @@ final class ClassNameAndFilePath { /** * @readonly - * @var string */ - private $className; + private string $className; /** * @readonly - * @var string */ - private $filePath; + private string $filePath; public function __construct(string $className, string $filePath) { $this->className = $className; diff --git a/vendor/rector/rector-symfony/src/ValueObject/EventNameToClassAndConstant.php b/vendor/rector/rector-symfony/src/ValueObject/EventNameToClassAndConstant.php index 512143744c5..362d30bf23e 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/EventNameToClassAndConstant.php +++ b/vendor/rector/rector-symfony/src/ValueObject/EventNameToClassAndConstant.php @@ -7,19 +7,16 @@ final class EventNameToClassAndConstant { /** * @readonly - * @var string */ - private $eventName; + private string $eventName; /** * @readonly - * @var string */ - private $eventClass; + private string $eventClass; /** * @readonly - * @var string */ - private $eventConstant; + private string $eventConstant; public function __construct(string $eventName, string $eventClass, string $eventConstant) { $this->eventName = $eventName; diff --git a/vendor/rector/rector-symfony/src/ValueObject/EventReferenceToMethodName.php b/vendor/rector/rector-symfony/src/ValueObject/EventReferenceToMethodName.php index e371f9386b8..5aafae70fac 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/EventReferenceToMethodName.php +++ b/vendor/rector/rector-symfony/src/ValueObject/EventReferenceToMethodName.php @@ -9,14 +9,12 @@ final class EventReferenceToMethodName implements EventReferenceToMethodNameInte { /** * @readonly - * @var \PhpParser\Node\Expr\ClassConstFetch */ - private $classConstFetch; + private ClassConstFetch $classConstFetch; /** * @readonly - * @var string */ - private $methodName; + private string $methodName; public function __construct(ClassConstFetch $classConstFetch, string $methodName) { $this->classConstFetch = $classConstFetch; diff --git a/vendor/rector/rector-symfony/src/ValueObject/EventReferenceToMethodNameWithPriority.php b/vendor/rector/rector-symfony/src/ValueObject/EventReferenceToMethodNameWithPriority.php index 14baaa54f41..3643416b75f 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/EventReferenceToMethodNameWithPriority.php +++ b/vendor/rector/rector-symfony/src/ValueObject/EventReferenceToMethodNameWithPriority.php @@ -9,19 +9,16 @@ final class EventReferenceToMethodNameWithPriority implements EventReferenceToMe { /** * @readonly - * @var \PhpParser\Node\Expr\ClassConstFetch */ - private $classConstFetch; + private ClassConstFetch $classConstFetch; /** * @readonly - * @var string */ - private $methodName; + private string $methodName; /** * @readonly - * @var int */ - private $priority; + private int $priority; public function __construct(ClassConstFetch $classConstFetch, string $methodName, int $priority) { $this->classConstFetch = $classConstFetch; diff --git a/vendor/rector/rector-symfony/src/ValueObject/ExtensionKeyAndConfiguration.php b/vendor/rector/rector-symfony/src/ValueObject/ExtensionKeyAndConfiguration.php index 3c1ceaf12ed..82d0780226c 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/ExtensionKeyAndConfiguration.php +++ b/vendor/rector/rector-symfony/src/ValueObject/ExtensionKeyAndConfiguration.php @@ -8,14 +8,12 @@ final class ExtensionKeyAndConfiguration { /** * @readonly - * @var string */ - private $key; + private string $key; /** * @readonly - * @var \PhpParser\Node\Expr\Array_ */ - private $array; + private Array_ $array; public function __construct(string $key, Array_ $array) { $this->key = $key; diff --git a/vendor/rector/rector-symfony/src/ValueObject/IntlBundleClassToNewClass.php b/vendor/rector/rector-symfony/src/ValueObject/IntlBundleClassToNewClass.php index 54a27c8145a..b6cf9cd56f0 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/IntlBundleClassToNewClass.php +++ b/vendor/rector/rector-symfony/src/ValueObject/IntlBundleClassToNewClass.php @@ -9,19 +9,17 @@ final class IntlBundleClassToNewClass { /** * @readonly - * @var string */ - private $oldClass; + private string $oldClass; /** * @readonly - * @var string */ - private $newClass; + private string $newClass; /** * @var array * @readonly */ - private $oldToNewMethods; + private array $oldToNewMethods; /** * @param array $oldToNewMethods */ diff --git a/vendor/rector/rector-symfony/src/ValueObject/ReplaceServiceArgument.php b/vendor/rector/rector-symfony/src/ValueObject/ReplaceServiceArgument.php index e8aa1783f49..c5ff47dabc9 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/ReplaceServiceArgument.php +++ b/vendor/rector/rector-symfony/src/ValueObject/ReplaceServiceArgument.php @@ -13,9 +13,8 @@ final class ReplaceServiceArgument private $oldValue; /** * @readonly - * @var \PhpParser\Node\Expr */ - private $newValueExpr; + private Expr $newValueExpr; /** * @param mixed $oldValue */ diff --git a/vendor/rector/rector-symfony/src/ValueObject/ServiceDefinition.php b/vendor/rector/rector-symfony/src/ValueObject/ServiceDefinition.php index 9b401c59614..f6a1025dff4 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/ServiceDefinition.php +++ b/vendor/rector/rector-symfony/src/ValueObject/ServiceDefinition.php @@ -8,34 +8,29 @@ final class ServiceDefinition { /** * @readonly - * @var string */ - private $id; + private string $id; /** * @readonly - * @var string|null */ - private $class; + private ?string $class; /** * @readonly - * @var bool */ - private $isPublic; + private bool $isPublic; /** * @readonly - * @var bool */ - private $isSynthetic; + private bool $isSynthetic; /** * @readonly - * @var string|null */ - private $alias; + private ?string $alias; /** * @var TagInterface[] * @readonly */ - private $tags; + private array $tags; /** * @param TagInterface[] $tags */ diff --git a/vendor/rector/rector-symfony/src/ValueObject/ServiceMap/ServiceMap.php b/vendor/rector/rector-symfony/src/ValueObject/ServiceMap/ServiceMap.php index 57643f49717..2d6eb580a06 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/ServiceMap/ServiceMap.php +++ b/vendor/rector/rector-symfony/src/ValueObject/ServiceMap/ServiceMap.php @@ -12,7 +12,7 @@ final class ServiceMap * @var ServiceDefinition[] * @readonly */ - private $services; + private array $services; /** * @param ServiceDefinition[] $services */ diff --git a/vendor/rector/rector-symfony/src/ValueObject/SymfonyRouteMetadata.php b/vendor/rector/rector-symfony/src/ValueObject/SymfonyRouteMetadata.php index 98ddb8f7c75..79895cdcf4d 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/SymfonyRouteMetadata.php +++ b/vendor/rector/rector-symfony/src/ValueObject/SymfonyRouteMetadata.php @@ -7,55 +7,50 @@ final class SymfonyRouteMetadata { /** * @readonly - * @var string */ - private $name; + private string $name; /** * @readonly - * @var string */ - private $path; + private string $path; /** * @var array * @readonly */ - private $defaults; + private array $defaults; /** * @var array * @readonly */ - private $requirements; + private array $requirements; /** * @readonly - * @var string */ - private $host; + private string $host; /** * @var string[] * @readonly */ - private $schemes; + private array $schemes; /** * @var string[] * @readonly */ - private $methods; + private array $methods; /** * @readonly - * @var string */ - private $condition; + private string $condition; /** * @var array * @readonly */ - private $options; + private array $options; /** * Format :: * @readonly - * @var string|null */ - private $controllerReference; + private ?string $controllerReference; /** * @param array $defaults * @param array $requirements diff --git a/vendor/rector/rector-symfony/src/ValueObject/Tag.php b/vendor/rector/rector-symfony/src/ValueObject/Tag.php index d391fa34232..79bdd290eb9 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/Tag.php +++ b/vendor/rector/rector-symfony/src/ValueObject/Tag.php @@ -8,14 +8,13 @@ final class Tag implements TagInterface { /** * @readonly - * @var string */ - private $name; + private string $name; /** * @var array * @readonly */ - private $data = []; + private array $data = []; /** * @param array $data */ diff --git a/vendor/rector/rector-symfony/src/ValueObject/Tag/EventListenerTag.php b/vendor/rector/rector-symfony/src/ValueObject/Tag/EventListenerTag.php index 28b64bc05cb..00fbee23841 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/Tag/EventListenerTag.php +++ b/vendor/rector/rector-symfony/src/ValueObject/Tag/EventListenerTag.php @@ -8,19 +8,16 @@ final class EventListenerTag implements TagInterface { /** * @readonly - * @var string */ - private $event; + private string $event; /** * @readonly - * @var string */ - private $method; + private string $method; /** * @readonly - * @var int */ - private $priority; + private int $priority; public function __construct(string $event, string $method, int $priority) { $this->event = $event; diff --git a/vendor/rector/rector-symfony/src/ValueObject/ValidatorAssert/ClassMethodAndAnnotation.php b/vendor/rector/rector-symfony/src/ValueObject/ValidatorAssert/ClassMethodAndAnnotation.php index c6870fd6d5d..88b1d8d2457 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/ValidatorAssert/ClassMethodAndAnnotation.php +++ b/vendor/rector/rector-symfony/src/ValueObject/ValidatorAssert/ClassMethodAndAnnotation.php @@ -10,12 +10,11 @@ final class ClassMethodAndAnnotation * @var string[] * @readonly */ - private $possibleMethodNames; + private array $possibleMethodNames; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode */ - private $doctrineAnnotationTagValueNode; + private DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode; /** * @param string[] $possibleMethodNames */ diff --git a/vendor/rector/rector-symfony/src/ValueObject/ValidatorAssert/PropertyAndAnnotation.php b/vendor/rector/rector-symfony/src/ValueObject/ValidatorAssert/PropertyAndAnnotation.php index 45fd6fab215..ee2d6dc61bb 100644 --- a/vendor/rector/rector-symfony/src/ValueObject/ValidatorAssert/PropertyAndAnnotation.php +++ b/vendor/rector/rector-symfony/src/ValueObject/ValidatorAssert/PropertyAndAnnotation.php @@ -8,14 +8,12 @@ final class PropertyAndAnnotation { /** * @readonly - * @var string */ - private $property; + private string $property; /** * @readonly - * @var \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode */ - private $doctrineAnnotationTagValueNode; + private DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode; public function __construct(string $property, DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode) { $this->property = $property; diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index 83f3eb16ce5..21230fa2e7e 100644 --- a/vendor/scoper-autoload.php +++ b/vendor/scoper-autoload.php @@ -30,7 +30,7 @@ if (!function_exists('humbug_phpscoper_expose_class')) { } } humbug_phpscoper_expose_class('AutoloadIncluder', 'RectorPrefix202411\AutoloadIncluder'); -humbug_phpscoper_expose_class('ComposerAutoloaderInit274d85655bbeae08896bd1a845bbbd57', 'RectorPrefix202411\ComposerAutoloaderInit274d85655bbeae08896bd1a845bbbd57'); +humbug_phpscoper_expose_class('ComposerAutoloaderInitc12d7e0a7ec6f5f877903ca571cd9ab7', 'RectorPrefix202411\ComposerAutoloaderInitc12d7e0a7ec6f5f877903ca571cd9ab7'); humbug_phpscoper_expose_class('Product', 'RectorPrefix202411\Product'); humbug_phpscoper_expose_class('SomeTest', 'RectorPrefix202411\SomeTest'); diff --git a/vendor/sebastian/diff/src/Chunk.php b/vendor/sebastian/diff/src/Chunk.php index 0452dbdea4e..800b614b5fe 100644 --- a/vendor/sebastian/diff/src/Chunk.php +++ b/vendor/sebastian/diff/src/Chunk.php @@ -19,26 +19,11 @@ use Traversable; */ final class Chunk implements IteratorAggregate { - /** - * @var int - */ - private $start; - /** - * @var int - */ - private $startRange; - /** - * @var int - */ - private $end; - /** - * @var int - */ - private $endRange; - /** - * @var mixed[] - */ - private $lines; + private int $start; + private int $startRange; + private int $end; + private int $endRange; + private array $lines; public function __construct(int $start = 0, int $startRange = 1, int $end = 0, int $endRange = 1, array $lines = []) { $this->start = $start; diff --git a/vendor/sebastian/diff/src/Diff.php b/vendor/sebastian/diff/src/Diff.php index a2ef00e09ec..ff83a760ba8 100644 --- a/vendor/sebastian/diff/src/Diff.php +++ b/vendor/sebastian/diff/src/Diff.php @@ -21,19 +21,16 @@ final class Diff implements IteratorAggregate { /** * @psalm-var non-empty-string - * @var string */ - private $from; + private string $from; /** * @psalm-var non-empty-string - * @var string */ - private $to; + private string $to; /** * @psalm-var list - * @var mixed[] */ - private $chunks; + private array $chunks; /** * @psalm-param non-empty-string $from * @psalm-param non-empty-string $to diff --git a/vendor/sebastian/diff/src/Differ.php b/vendor/sebastian/diff/src/Differ.php index e00ae91c3ce..10e6a3acc0a 100644 --- a/vendor/sebastian/diff/src/Differ.php +++ b/vendor/sebastian/diff/src/Differ.php @@ -36,10 +36,7 @@ final class Differ public const REMOVED = 2; public const DIFF_LINE_END_WARNING = 3; public const NO_LINE_END_EOF_WARNING = 4; - /** - * @var \SebastianBergmann\Diff\Output\DiffOutputBuilderInterface - */ - private $outputBuilder; + private DiffOutputBuilderInterface $outputBuilder; public function __construct(DiffOutputBuilderInterface $outputBuilder) { $this->outputBuilder = $outputBuilder; diff --git a/vendor/sebastian/diff/src/Line.php b/vendor/sebastian/diff/src/Line.php index b589f35b485..6c19ed30afa 100644 --- a/vendor/sebastian/diff/src/Line.php +++ b/vendor/sebastian/diff/src/Line.php @@ -16,14 +16,8 @@ final class Line public const ADDED = 1; public const REMOVED = 2; public const UNCHANGED = 3; - /** - * @var int - */ - private $type; - /** - * @var string - */ - private $content; + private int $type; + private string $content; public function __construct(int $type = self::UNCHANGED, string $content = '') { $this->type = $type; diff --git a/vendor/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php b/vendor/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php index 3d77f285401..70c973919a0 100644 --- a/vendor/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php +++ b/vendor/sebastian/diff/src/Output/DiffOnlyOutputBuilder.php @@ -24,10 +24,7 @@ use RectorPrefix202411\SebastianBergmann\Diff\Differ; */ final class DiffOnlyOutputBuilder implements DiffOutputBuilderInterface { - /** - * @var string - */ - private $header; + private string $header; public function __construct(string $header = "--- Original\n+++ New\n") { $this->header = $header; diff --git a/vendor/sebastian/diff/src/Output/StrictUnifiedDiffOutputBuilder.php b/vendor/sebastian/diff/src/Output/StrictUnifiedDiffOutputBuilder.php index b624ea54ead..eae6a1a2adc 100644 --- a/vendor/sebastian/diff/src/Output/StrictUnifiedDiffOutputBuilder.php +++ b/vendor/sebastian/diff/src/Output/StrictUnifiedDiffOutputBuilder.php @@ -34,10 +34,7 @@ use RectorPrefix202411\SebastianBergmann\Diff\Differ; */ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface { - /** - * @var mixed[] - */ - private static $default = [ + private static array $default = [ 'collapseRanges' => \true, // ranges of length one are rendered with the trailing `,1` 'commonLineThreshold' => 6, @@ -49,28 +46,17 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface 'toFile' => null, 'toFileDate' => null, ]; - /** - * @var bool - */ - private $changed; - /** - * @var bool - */ - private $collapseRanges; + private bool $changed; + private bool $collapseRanges; /** * @psalm-var positive-int - * @var int */ - private $commonLineThreshold; - /** - * @var string - */ - private $header; + private int $commonLineThreshold; + private string $header; /** * @psalm-var positive-int - * @var int */ - private $contextLines; + private int $contextLines; public function __construct(array $options = []) { $options = array_merge(self::$default, $options); diff --git a/vendor/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php b/vendor/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php index a67863b6de7..81821fe0914 100644 --- a/vendor/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php +++ b/vendor/sebastian/diff/src/Output/UnifiedDiffOutputBuilder.php @@ -27,27 +27,14 @@ use RectorPrefix202411\SebastianBergmann\Diff\Differ; */ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder { - /** - * @var bool - */ - private $collapseRanges = \true; - /** - * @var int - */ - private $commonLineThreshold = 6; + private bool $collapseRanges = \true; + private int $commonLineThreshold = 6; /** * @psalm-var positive-int - * @var int */ - private $contextLines = 3; - /** - * @var string - */ - private $header; - /** - * @var bool - */ - private $addLineNumbers; + private int $contextLines = 3; + private string $header; + private bool $addLineNumbers; public function __construct(string $header = "--- Original\n+++ New\n", bool $addLineNumbers = \false) { $this->header = $header; diff --git a/vendor/symfony/console/Application.php b/vendor/symfony/console/Application.php index e806dd2a793..b9034b54e7a 100644 --- a/vendor/symfony/console/Application.php +++ b/vendor/symfony/console/Application.php @@ -70,78 +70,24 @@ use RectorPrefix202411\Symfony\Contracts\Service\ResetInterface; */ class Application implements ResetInterface { - /** - * @var mixed[] - */ - private $commands = []; - /** - * @var bool - */ - private $wantHelps = \false; - /** - * @var \Symfony\Component\Console\Command\Command|null - */ - private $runningCommand; - /** - * @var string - */ - private $name; - /** - * @var string - */ - private $version; - /** - * @var \Symfony\Component\Console\CommandLoader\CommandLoaderInterface|null - */ - private $commandLoader; - /** - * @var bool - */ - private $catchExceptions = \true; - /** - * @var bool - */ - private $catchErrors = \false; - /** - * @var bool - */ - private $autoExit = \true; - /** - * @var \Symfony\Component\Console\Input\InputDefinition - */ - private $definition; - /** - * @var \Symfony\Component\Console\Helper\HelperSet - */ - private $helperSet; - /** - * @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface|null - */ - private $dispatcher; - /** - * @var \Symfony\Component\Console\Terminal - */ - private $terminal; - /** - * @var string - */ - private $defaultCommand; - /** - * @var bool - */ - private $singleCommand = \false; - /** - * @var bool - */ - private $initialized = \false; - /** - * @var \Symfony\Component\Console\SignalRegistry\SignalRegistry|null - */ - private $signalRegistry; - /** - * @var mixed[] - */ - private $signalsToDispatchEvent = []; + private array $commands = []; + private bool $wantHelps = \false; + private ?Command $runningCommand = null; + private string $name; + private string $version; + private ?CommandLoaderInterface $commandLoader = null; + private bool $catchExceptions = \true; + private bool $catchErrors = \false; + private bool $autoExit = \true; + private InputDefinition $definition; + private HelperSet $helperSet; + private ?EventDispatcherInterface $dispatcher = null; + private Terminal $terminal; + private string $defaultCommand; + private bool $singleCommand = \false; + private bool $initialized = \false; + private ?SignalRegistry $signalRegistry = null; + private array $signalsToDispatchEvent = []; public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN') { $this->name = $name; @@ -194,8 +140,8 @@ class Application implements ResetInterface @\putenv('LINES=' . $this->terminal->getHeight()); @\putenv('COLUMNS=' . $this->terminal->getWidth()); } - $input = $input ?? new ArgvInput(); - $output = $output ?? new ConsoleOutput(); + $input ??= new ArgvInput(); + $output ??= new ConsoleOutput(); $renderException = function (\Throwable $e) use($output) { if ($output instanceof ConsoleOutputInterface) { $this->renderThrowable($e, $output->getErrorOutput()); @@ -352,7 +298,7 @@ class Application implements ResetInterface */ public function getHelperSet() : HelperSet { - return $this->helperSet = $this->helperSet ?? $this->getDefaultHelperSet(); + return $this->helperSet ??= $this->getDefaultHelperSet(); } /** * @return void @@ -366,7 +312,7 @@ class Application implements ResetInterface */ public function getDefinition() : InputDefinition { - $this->definition = $this->definition ?? $this->getDefaultInputDefinition(); + $this->definition ??= $this->getDefaultInputDefinition(); if ($this->singleCommand) { $inputDefinition = $this->definition; $inputDefinition->setArguments(); @@ -663,9 +609,7 @@ class Application implements ResetInterface $message = \sprintf('Command "%s" is not defined.', $name); if ($alternatives = $this->findAlternatives($name, $allCommands)) { // remove hidden commands - $alternatives = \array_filter($alternatives, function ($name) { - return !$this->get($name)->isHidden(); - }); + $alternatives = \array_filter($alternatives, fn($name) => !$this->get($name)->isHidden()); if (1 == \count($alternatives)) { $message .= "\n\nDid you mean this?\n "; } else { @@ -787,9 +731,7 @@ class Application implements ResetInterface $len = 0; } if (\strpos($message, "@anonymous\x00") !== \false) { - $message = \preg_replace_callback('/[a-zA-Z_\\x7f-\\xff][\\\\a-zA-Z0-9_\\x7f-\\xff]*+@anonymous\\x00.*?\\.php(?:0x?|:[0-9]++\\$)?[0-9a-fA-F]++/', function ($m) { - return \class_exists($m[0], \false) ? ((\get_parent_class($m[0]) ?: \key(\class_implements($m[0]))) ?: 'class') . '@anonymous' : $m[0]; - }, $message); + $message = \preg_replace_callback('/[a-zA-Z_\\x7f-\\xff][\\\\a-zA-Z0-9_\\x7f-\\xff]*+@anonymous\\x00.*?\\.php(?:0x?|:[0-9]++\\$)?[0-9a-fA-F]++/', fn($m) => \class_exists($m[0], \false) ? ((\get_parent_class($m[0]) ?: \key(\class_implements($m[0]))) ?: 'class') . '@anonymous' : $m[0], $message); } $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : \PHP_INT_MAX; $lines = []; @@ -911,9 +853,7 @@ class Application implements ResetInterface if (Terminal::hasSttyAvailable()) { $sttyMode = \shell_exec('stty -g'); foreach ([\SIGINT, \SIGTERM] as $signal) { - $this->signalRegistry->register($signal, static function () use($sttyMode) { - return \shell_exec('stty ' . $sttyMode); - }); + $this->signalRegistry->register($signal, static fn() => \shell_exec('stty ' . $sttyMode)); } } if ($this->dispatcher) { @@ -1074,9 +1014,7 @@ class Application implements ResetInterface $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev; } } - $alternatives = \array_filter($alternatives, function ($lev) use($threshold) { - return $lev < 2 * $threshold; - }); + $alternatives = \array_filter($alternatives, fn($lev) => $lev < 2 * $threshold); \ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE); return \array_keys($alternatives); } diff --git a/vendor/symfony/console/Attribute/AsCommand.php b/vendor/symfony/console/Attribute/AsCommand.php index ca207074162..1f3ad5335b7 100644 --- a/vendor/symfony/console/Attribute/AsCommand.php +++ b/vendor/symfony/console/Attribute/AsCommand.php @@ -16,14 +16,8 @@ namespace RectorPrefix202411\Symfony\Component\Console\Attribute; #[\Attribute(\Attribute::TARGET_CLASS)] class AsCommand { - /** - * @var string - */ - public $name; - /** - * @var string|null - */ - public $description; + public string $name; + public ?string $description = null; public function __construct(string $name, ?string $description = null, array $aliases = [], bool $hidden = \false) { $this->name = $name; diff --git a/vendor/symfony/console/CI/GithubActionReporter.php b/vendor/symfony/console/CI/GithubActionReporter.php index d4b8c18d7d9..920d059bcc0 100644 --- a/vendor/symfony/console/CI/GithubActionReporter.php +++ b/vendor/symfony/console/CI/GithubActionReporter.php @@ -18,10 +18,7 @@ use RectorPrefix202411\Symfony\Component\Console\Output\OutputInterface; */ class GithubActionReporter { - /** - * @var \Symfony\Component\Console\Output\OutputInterface - */ - private $output; + private OutputInterface $output; /** * @see https://github.com/actions/toolkit/blob/5e5e1b7aacba68a53836a34db4a288c3c1c1585b/packages/core/src/command.ts#L80-L85 */ diff --git a/vendor/symfony/console/Color.php b/vendor/symfony/console/Color.php index f6dd50df687..315c84ade05 100644 --- a/vendor/symfony/console/Color.php +++ b/vendor/symfony/console/Color.php @@ -19,18 +19,9 @@ final class Color private const COLORS = ['black' => 0, 'red' => 1, 'green' => 2, 'yellow' => 3, 'blue' => 4, 'magenta' => 5, 'cyan' => 6, 'white' => 7, 'default' => 9]; private const BRIGHT_COLORS = ['gray' => 0, 'bright-red' => 1, 'bright-green' => 2, 'bright-yellow' => 3, 'bright-blue' => 4, 'bright-magenta' => 5, 'bright-cyan' => 6, 'bright-white' => 7]; private const AVAILABLE_OPTIONS = ['bold' => ['set' => 1, 'unset' => 22], 'underscore' => ['set' => 4, 'unset' => 24], 'blink' => ['set' => 5, 'unset' => 25], 'reverse' => ['set' => 7, 'unset' => 27], 'conceal' => ['set' => 8, 'unset' => 28]]; - /** - * @var string - */ - private $foreground; - /** - * @var string - */ - private $background; - /** - * @var mixed[] - */ - private $options = []; + private string $foreground; + private string $background; + private array $options = []; public function __construct(string $foreground = '', string $background = '', array $options = []) { $this->foreground = $this->parseColor($foreground); diff --git a/vendor/symfony/console/Command/Command.php b/vendor/symfony/console/Command/Command.php index 381f988c581..56f6d194a11 100644 --- a/vendor/symfony/console/Command/Command.php +++ b/vendor/symfony/console/Command/Command.php @@ -48,62 +48,20 @@ class Command * @deprecated since Symfony 6.1, use the AsCommand attribute instead */ protected static $defaultDescription; - /** - * @var \Symfony\Component\Console\Application|null - */ - private $application; - /** - * @var string|null - */ - private $name; - /** - * @var string|null - */ - private $processTitle; - /** - * @var mixed[] - */ - private $aliases = []; - /** - * @var \Symfony\Component\Console\Input\InputDefinition - */ - private $definition; - /** - * @var bool - */ - private $hidden = \false; - /** - * @var string - */ - private $help = ''; - /** - * @var string - */ - private $description = ''; - /** - * @var \Symfony\Component\Console\Input\InputDefinition|null - */ - private $fullDefinition; - /** - * @var bool - */ - private $ignoreValidationErrors = \false; - /** - * @var \Closure|null - */ - private $code; - /** - * @var mixed[] - */ - private $synopsis = []; - /** - * @var mixed[] - */ - private $usages = []; - /** - * @var \Symfony\Component\Console\Helper\HelperSet|null - */ - private $helperSet; + private ?Application $application = null; + private ?string $name = null; + private ?string $processTitle = null; + private array $aliases = []; + private InputDefinition $definition; + private bool $hidden = \false; + private string $help = ''; + private string $description = ''; + private ?InputDefinition $fullDefinition = null; + private bool $ignoreValidationErrors = \false; + private ?\Closure $code = null; + private array $synopsis = []; + private array $usages = []; + private ?HelperSet $helperSet = null; public static function getDefaultName() : ?string { $class = static::class; diff --git a/vendor/symfony/console/Command/CompleteCommand.php b/vendor/symfony/console/Command/CompleteCommand.php index 76ca835cfba..572e9f6f587 100644 --- a/vendor/symfony/console/Command/CompleteCommand.php +++ b/vendor/symfony/console/Command/CompleteCommand.php @@ -38,14 +38,8 @@ final class CompleteCommand extends Command * @deprecated since Symfony 6.1 */ protected static $defaultDescription = 'Internal command to provide shell completion suggestions'; - /** - * @var mixed[] - */ - private $completionOutputs; - /** - * @var bool - */ - private $isDebug = \false; + private array $completionOutputs; + private bool $isDebug = \false; /** * @param array> $completionOutputs A list of additional completion outputs, with shell name as key and FQCN as value */ @@ -110,9 +104,7 @@ final class CompleteCommand extends Command $completionOutput = new $completionOutput(); $this->log('Suggestions:'); if ($options = $suggestions->getOptionSuggestions()) { - $this->log(' --' . \implode(' --', \array_map(function ($o) { - return $o->getName(); - }, $options))); + $this->log(' --' . \implode(' --', \array_map(fn($o) => $o->getName(), $options))); } elseif ($values = $suggestions->getValueSuggestions()) { $this->log(' ' . \implode(' ', $values)); } else { diff --git a/vendor/symfony/console/Command/DumpCompletionCommand.php b/vendor/symfony/console/Command/DumpCompletionCommand.php index eff8e22a461..757b4785517 100644 --- a/vendor/symfony/console/Command/DumpCompletionCommand.php +++ b/vendor/symfony/console/Command/DumpCompletionCommand.php @@ -32,10 +32,7 @@ final class DumpCompletionCommand extends Command * @deprecated since Symfony 6.1 */ protected static $defaultDescription = 'Dump the shell completion script'; - /** - * @var mixed[] - */ - private $supportedShells; + private array $supportedShells; protected function configure() : void { $fullCommand = $_SERVER['PHP_SELF']; diff --git a/vendor/symfony/console/Command/HelpCommand.php b/vendor/symfony/console/Command/HelpCommand.php index 3a6c5c59a23..47794fed8d4 100644 --- a/vendor/symfony/console/Command/HelpCommand.php +++ b/vendor/symfony/console/Command/HelpCommand.php @@ -23,21 +23,14 @@ use RectorPrefix202411\Symfony\Component\Console\Output\OutputInterface; */ class HelpCommand extends Command { - /** - * @var \Symfony\Component\Console\Command\Command - */ - private $command; + private Command $command; /** * @return void */ protected function configure() { $this->ignoreValidationErrors(); - $this->setName('help')->setDefinition([new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help', function () { - return \array_keys((new ApplicationDescription($this->getApplication()))->getCommands()); - }), new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt', function () { - return (new DescriptorHelper())->getFormats(); - }), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help')])->setDescription('Display help for a command')->setHelp(<<<'EOF' + $this->setName('help')->setDefinition([new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help', fn() => \array_keys((new ApplicationDescription($this->getApplication()))->getCommands())), new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt', fn() => (new DescriptorHelper())->getFormats()), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help')])->setDescription('Display help for a command')->setHelp(<<<'EOF' The %command.name% command displays help for a given command: %command.full_name% list @@ -59,7 +52,7 @@ EOF } protected function execute(InputInterface $input, OutputInterface $output) : int { - $this->command = $this->command ?? $this->getApplication()->find($input->getArgument('command_name')); + $this->command ??= $this->getApplication()->find($input->getArgument('command_name')); $helper = new DescriptorHelper(); $helper->describe($output, $this->command, ['format' => $input->getOption('format'), 'raw_text' => $input->getOption('raw')]); unset($this->command); diff --git a/vendor/symfony/console/Command/LazyCommand.php b/vendor/symfony/console/Command/LazyCommand.php index ea086095717..b3003439418 100644 --- a/vendor/symfony/console/Command/LazyCommand.php +++ b/vendor/symfony/console/Command/LazyCommand.php @@ -28,10 +28,7 @@ final class LazyCommand extends Command * @var \Closure|\Symfony\Component\Console\Command\Command */ private $command; - /** - * @var bool|null - */ - private $isEnabled; + private ?bool $isEnabled; public function __construct(string $name, array $aliases, string $description, bool $isHidden, \Closure $commandFactory, ?bool $isEnabled = \true) { $this->setName($name)->setAliases($aliases)->setHidden($isHidden)->setDescription($description); diff --git a/vendor/symfony/console/Command/ListCommand.php b/vendor/symfony/console/Command/ListCommand.php index 10c8a094eac..dd6a5a6f251 100644 --- a/vendor/symfony/console/Command/ListCommand.php +++ b/vendor/symfony/console/Command/ListCommand.php @@ -28,11 +28,7 @@ class ListCommand extends Command */ protected function configure() { - $this->setName('list')->setDefinition([new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name', null, function () { - return \array_keys((new ApplicationDescription($this->getApplication()))->getNamespaces()); - }), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'), new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt', function () { - return (new DescriptorHelper())->getFormats(); - }), new InputOption('short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments')])->setDescription('List commands')->setHelp(<<<'EOF' + $this->setName('list')->setDefinition([new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name', null, fn() => \array_keys((new ApplicationDescription($this->getApplication()))->getNamespaces())), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'), new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt', fn() => (new DescriptorHelper())->getFormats()), new InputOption('short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments')])->setDescription('List commands')->setHelp(<<<'EOF' The %command.name% command lists all commands: %command.full_name% diff --git a/vendor/symfony/console/Command/LockableTrait.php b/vendor/symfony/console/Command/LockableTrait.php index d1785fc58fa..0e4193b3906 100644 --- a/vendor/symfony/console/Command/LockableTrait.php +++ b/vendor/symfony/console/Command/LockableTrait.php @@ -22,10 +22,7 @@ use RectorPrefix202411\Symfony\Component\Lock\Store\SemaphoreStore; */ trait LockableTrait { - /** - * @var \Symfony\Component\Lock\LockInterface|null - */ - private $lock; + private ?LockInterface $lock = null; /** * Locks a command. */ diff --git a/vendor/symfony/console/Command/TraceableCommand.php b/vendor/symfony/console/Command/TraceableCommand.php index 6eb8e3d22a8..4809a94a790 100644 --- a/vendor/symfony/console/Command/TraceableCommand.php +++ b/vendor/symfony/console/Command/TraceableCommand.php @@ -29,56 +29,27 @@ final class TraceableCommand extends Command implements SignalableCommandInterfa { /** * @readonly - * @var \Symfony\Component\Stopwatch\Stopwatch */ - private $stopwatch; + private Stopwatch $stopwatch; /** * @readonly - * @var \Symfony\Component\Console\Command\Command */ - public $command; - /** - * @var int - */ - public $exitCode; - /** - * @var int|null - */ - public $interruptedBySignal; - /** - * @var bool - */ - public $ignoreValidation; - /** - * @var bool - */ - public $isInteractive = \false; - /** - * @var string - */ - public $duration = 'n/a'; - /** - * @var string - */ - public $maxMemoryUsage = 'n/a'; - /** - * @var \Symfony\Component\Console\Input\InputInterface - */ - public $input; - /** - * @var \Symfony\Component\Console\Output\OutputInterface - */ - public $output; + public Command $command; + public int $exitCode; + public ?int $interruptedBySignal = null; + public bool $ignoreValidation; + public bool $isInteractive = \false; + public string $duration = 'n/a'; + public string $maxMemoryUsage = 'n/a'; + public InputInterface $input; + public OutputInterface $output; /** @var array */ - public $arguments; + public array $arguments; /** @var array */ - public $options; + public array $options; /** @var array */ - public $interactiveInputs = []; - /** - * @var mixed[] - */ - public $handledSignals = []; + public array $interactiveInputs = []; + public array $handledSignals = []; public function __construct(Command $command, Stopwatch $stopwatch) { $this->stopwatch = $stopwatch; diff --git a/vendor/symfony/console/CommandLoader/ContainerCommandLoader.php b/vendor/symfony/console/CommandLoader/ContainerCommandLoader.php index 2e15cbb8fcc..752eb148cd5 100644 --- a/vendor/symfony/console/CommandLoader/ContainerCommandLoader.php +++ b/vendor/symfony/console/CommandLoader/ContainerCommandLoader.php @@ -20,14 +20,8 @@ use RectorPrefix202411\Symfony\Component\Console\Exception\CommandNotFoundExcept */ class ContainerCommandLoader implements CommandLoaderInterface { - /** - * @var \Psr\Container\ContainerInterface - */ - private $container; - /** - * @var mixed[] - */ - private $commandMap; + private ContainerInterface $container; + private array $commandMap; /** * @param array $commandMap An array with command names as keys and service ids as values */ diff --git a/vendor/symfony/console/CommandLoader/FactoryCommandLoader.php b/vendor/symfony/console/CommandLoader/FactoryCommandLoader.php index 59d29f02e12..846b777f01b 100644 --- a/vendor/symfony/console/CommandLoader/FactoryCommandLoader.php +++ b/vendor/symfony/console/CommandLoader/FactoryCommandLoader.php @@ -19,10 +19,7 @@ use RectorPrefix202411\Symfony\Component\Console\Exception\CommandNotFoundExcept */ class FactoryCommandLoader implements CommandLoaderInterface { - /** - * @var mixed[] - */ - private $factories; + private array $factories; /** * @param callable[] $factories Indexed by command names */ diff --git a/vendor/symfony/console/Completion/CompletionInput.php b/vendor/symfony/console/Completion/CompletionInput.php index ea1dd6c3f9e..8f557a98962 100644 --- a/vendor/symfony/console/Completion/CompletionInput.php +++ b/vendor/symfony/console/Completion/CompletionInput.php @@ -28,26 +28,11 @@ final class CompletionInput extends ArgvInput public const TYPE_OPTION_VALUE = 'option_value'; public const TYPE_OPTION_NAME = 'option_name'; public const TYPE_NONE = 'none'; - /** - * @var mixed[] - */ - private $tokens; - /** - * @var int - */ - private $currentIndex; - /** - * @var string - */ - private $completionType; - /** - * @var string|null - */ - private $completionName; - /** - * @var string - */ - private $completionValue = ''; + private array $tokens; + private int $currentIndex; + private string $completionType; + private ?string $completionName = null; + private string $completionValue = ''; /** * Converts a terminal string into tokens. * @@ -111,9 +96,7 @@ final class CompletionInput extends ArgvInput $argumentValue = $this->arguments[$argumentName]; $this->completionName = $argumentName; if (\is_array($argumentValue)) { - \end($argumentValue); - $this->completionValue = $argumentValue ? $argumentValue[\key($argumentValue)] : null; - \reset($argumentValue); + $this->completionValue = $argumentValue ? $argumentValue[\array_key_last($argumentValue)] : null; } else { $this->completionValue = $argumentValue; } diff --git a/vendor/symfony/console/Completion/CompletionSuggestions.php b/vendor/symfony/console/Completion/CompletionSuggestions.php index bf862445fd5..8564b7c570d 100644 --- a/vendor/symfony/console/Completion/CompletionSuggestions.php +++ b/vendor/symfony/console/Completion/CompletionSuggestions.php @@ -18,14 +18,8 @@ use RectorPrefix202411\Symfony\Component\Console\Input\InputOption; */ final class CompletionSuggestions { - /** - * @var mixed[] - */ - private $valueSuggestions = []; - /** - * @var mixed[] - */ - private $optionSuggestions = []; + private array $valueSuggestions = []; + private array $optionSuggestions = []; /** * Add a suggested value for an input option or argument. * diff --git a/vendor/symfony/console/Completion/Suggestion.php b/vendor/symfony/console/Completion/Suggestion.php index 49a2a744b86..e0a64e67c50 100644 --- a/vendor/symfony/console/Completion/Suggestion.php +++ b/vendor/symfony/console/Completion/Suggestion.php @@ -19,14 +19,12 @@ class Suggestion { /** * @readonly - * @var string */ - private $value; + private string $value; /** * @readonly - * @var string */ - private $description = ''; + private string $description = ''; public function __construct(string $value, string $description = '') { $this->value = $value; diff --git a/vendor/symfony/console/Cursor.php b/vendor/symfony/console/Cursor.php index 7c9d35bb8e0..68b36b5999c 100644 --- a/vendor/symfony/console/Cursor.php +++ b/vendor/symfony/console/Cursor.php @@ -16,10 +16,7 @@ use RectorPrefix202411\Symfony\Component\Console\Output\OutputInterface; */ final class Cursor { - /** - * @var \Symfony\Component\Console\Output\OutputInterface - */ - private $output; + private OutputInterface $output; /** @var resource */ private $input; /** @@ -154,7 +151,7 @@ final class Cursor public function getCurrentPosition() : array { static $isTtySupported; - if (!($isTtySupported = $isTtySupported ?? '/' === \DIRECTORY_SEPARATOR && \stream_isatty(\STDOUT))) { + if (!($isTtySupported ??= '/' === \DIRECTORY_SEPARATOR && \stream_isatty(\STDOUT))) { return [1, 1]; } $sttyMode = \shell_exec('stty -g'); diff --git a/vendor/symfony/console/DataCollector/CommandDataCollector.php b/vendor/symfony/console/DataCollector/CommandDataCollector.php index 1882b6dd1db..69ee5252da0 100644 --- a/vendor/symfony/console/DataCollector/CommandDataCollector.php +++ b/vendor/symfony/console/DataCollector/CommandDataCollector.php @@ -157,15 +157,11 @@ final class CommandDataCollector extends DataCollector } public function getSignalable() : array { - return \array_map(static function (int $signal) : string { - return \sprintf('%s (%d)', SignalMap::getSignalName($signal), $signal); - }, $this->data['signalable']); + return \array_map(static fn(int $signal): string => \sprintf('%s (%d)', SignalMap::getSignalName($signal), $signal), $this->data['signalable']); } public function getHandledSignals() : array { - $keys = \array_map(static function (int $signal) : string { - return \sprintf('%s (%d)', SignalMap::getSignalName($signal), $signal); - }, \array_keys($this->data['handled_signals'])); + $keys = \array_map(static fn(int $signal): string => \sprintf('%s (%d)', SignalMap::getSignalName($signal), $signal), \array_keys($this->data['handled_signals'])); return \array_combine($keys, \array_values($this->data['handled_signals'])); } /** diff --git a/vendor/symfony/console/Debug/CliRequest.php b/vendor/symfony/console/Debug/CliRequest.php index 6d22a589c83..7443df955d1 100644 --- a/vendor/symfony/console/Debug/CliRequest.php +++ b/vendor/symfony/console/Debug/CliRequest.php @@ -20,9 +20,8 @@ final class CliRequest extends Request { /** * @readonly - * @var \Symfony\Component\Console\Command\TraceableCommand */ - public $command; + public TraceableCommand $command; public function __construct(TraceableCommand $command) { $this->command = $command; @@ -48,9 +47,8 @@ final class CliRequest extends Request { /** * @readonly - * @var int */ - private $exitCode; + private int $exitCode; public function __construct(int $exitCode) { $this->exitCode = $exitCode; diff --git a/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php b/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php index 58335bc4e2e..b64b72c633a 100644 --- a/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php +++ b/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php @@ -77,7 +77,7 @@ class AddConsoleCommandPass implements CompilerPassInterface $aliases[] = $tag['command']; $lazyCommandMap[$tag['command']] = $id; } - $description = $description ?? $tag['description'] ?? null; + $description ??= $tag['description'] ?? null; } $definition->addMethodCall('setName', [$commandName]); if ($aliases) { diff --git a/vendor/symfony/console/Descriptor/ApplicationDescription.php b/vendor/symfony/console/Descriptor/ApplicationDescription.php index 2bde48b4b55..0b07e31e6ad 100644 --- a/vendor/symfony/console/Descriptor/ApplicationDescription.php +++ b/vendor/symfony/console/Descriptor/ApplicationDescription.php @@ -21,30 +21,18 @@ use RectorPrefix202411\Symfony\Component\Console\Exception\CommandNotFoundExcept class ApplicationDescription { public const GLOBAL_NAMESPACE = '_global'; - /** - * @var \Symfony\Component\Console\Application - */ - private $application; - /** - * @var string|null - */ - private $namespace; - /** - * @var bool - */ - private $showHidden; - /** - * @var mixed[] - */ - private $namespaces; + private Application $application; + private ?string $namespace; + private bool $showHidden; + private array $namespaces; /** * @var array */ - private $commands; + private array $commands; /** * @var array */ - private $aliases = []; + private array $aliases = []; public function __construct(Application $application, ?string $namespace = null, bool $showHidden = \false) { $this->application = $application; diff --git a/vendor/symfony/console/Descriptor/Descriptor.php b/vendor/symfony/console/Descriptor/Descriptor.php index 1c2f5c01633..ab4a8b902b6 100644 --- a/vendor/symfony/console/Descriptor/Descriptor.php +++ b/vendor/symfony/console/Descriptor/Descriptor.php @@ -24,10 +24,7 @@ use RectorPrefix202411\Symfony\Component\Console\Output\OutputInterface; */ abstract class Descriptor implements DescriptorInterface { - /** - * @var \Symfony\Component\Console\Output\OutputInterface - */ - protected $output; + protected OutputInterface $output; public function describe(OutputInterface $output, object $object, array $options = []) : void { $this->output = $output; diff --git a/vendor/symfony/console/Descriptor/MarkdownDescriptor.php b/vendor/symfony/console/Descriptor/MarkdownDescriptor.php index 6419ab188aa..5c92b518bb9 100644 --- a/vendor/symfony/console/Descriptor/MarkdownDescriptor.php +++ b/vendor/symfony/console/Descriptor/MarkdownDescriptor.php @@ -75,15 +75,11 @@ class MarkdownDescriptor extends Descriptor protected function describeCommand(Command $command, array $options = []) : void { if ($options['short'] ?? \false) { - $this->write('`' . $command->getName() . "`\n" . \str_repeat('-', Helper::width($command->getName()) + 2) . "\n\n" . ($command->getDescription() ? $command->getDescription() . "\n\n" : '') . '### Usage' . "\n\n" . \array_reduce($command->getAliases(), function ($carry, $usage) { - return $carry . '* `' . $usage . '`' . "\n"; - })); + $this->write('`' . $command->getName() . "`\n" . \str_repeat('-', Helper::width($command->getName()) + 2) . "\n\n" . ($command->getDescription() ? $command->getDescription() . "\n\n" : '') . '### Usage' . "\n\n" . \array_reduce($command->getAliases(), fn($carry, $usage) => $carry . '* `' . $usage . '`' . "\n")); return; } $command->mergeApplicationDefinition(\false); - $this->write('`' . $command->getName() . "`\n" . \str_repeat('-', Helper::width($command->getName()) + 2) . "\n\n" . ($command->getDescription() ? $command->getDescription() . "\n\n" : '') . '### Usage' . "\n\n" . \array_reduce(\array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) { - return $carry . '* `' . $usage . '`' . "\n"; - })); + $this->write('`' . $command->getName() . "`\n" . \str_repeat('-', Helper::width($command->getName()) + 2) . "\n\n" . ($command->getDescription() ? $command->getDescription() . "\n\n" : '') . '### Usage' . "\n\n" . \array_reduce(\array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), fn($carry, $usage) => $carry . '* `' . $usage . '`' . "\n")); if ($help = $command->getProcessedHelp()) { $this->write("\n"); $this->write($help); @@ -106,9 +102,7 @@ class MarkdownDescriptor extends Descriptor $this->write('**' . $namespace['id'] . ':**'); } $this->write("\n\n"); - $this->write(\implode("\n", \array_map(function ($commandName) use($description) { - return \sprintf('* [`%s`](#%s)', $commandName, \str_replace(':', '', $description->getCommand($commandName)->getName())); - }, $namespace['commands']))); + $this->write(\implode("\n", \array_map(fn($commandName) => \sprintf('* [`%s`](#%s)', $commandName, \str_replace(':', '', $description->getCommand($commandName)->getName())), $namespace['commands']))); } foreach ($description->getCommands() as $command) { $this->write("\n\n"); diff --git a/vendor/symfony/console/Descriptor/ReStructuredTextDescriptor.php b/vendor/symfony/console/Descriptor/ReStructuredTextDescriptor.php index ff2a35a1f5e..4c46f9d16b0 100644 --- a/vendor/symfony/console/Descriptor/ReStructuredTextDescriptor.php +++ b/vendor/symfony/console/Descriptor/ReStructuredTextDescriptor.php @@ -21,39 +21,18 @@ use RectorPrefix202411\Symfony\Component\String\UnicodeString; class ReStructuredTextDescriptor extends Descriptor { //

- /** - * @var string - */ - private $partChar = '='; + private string $partChar = '='; //

- /** - * @var string - */ - private $chapterChar = '-'; + private string $chapterChar = '-'; //

- /** - * @var string - */ - private $sectionChar = '~'; + private string $sectionChar = '~'; //

- /** - * @var string - */ - private $subsectionChar = '.'; + private string $subsectionChar = '.'; //

- /** - * @var string - */ - private $subsubsectionChar = '^'; + private string $subsubsectionChar = '^'; //
- /** - * @var string - */ - private $paragraphsChar = '"'; - /** - * @var mixed[] - */ - private $visibleNamespaces = []; + private string $paragraphsChar = '"'; + private array $visibleNamespaces = []; public function describe(OutputInterface $output, object $object, array $options = []) : void { $decorated = $output->isDecorated(); @@ -108,18 +87,14 @@ class ReStructuredTextDescriptor extends Descriptor protected function describeCommand(Command $command, array $options = []) : void { if ($options['short'] ?? \false) { - $this->write('``' . $command->getName() . "``\n" . \str_repeat($this->subsectionChar, Helper::width($command->getName())) . "\n\n" . ($command->getDescription() ? $command->getDescription() . "\n\n" : '') . "Usage\n" . \str_repeat($this->paragraphsChar, 5) . "\n\n" . \array_reduce($command->getAliases(), static function ($carry, $usage) { - return $carry . '- ``' . $usage . '``' . "\n"; - })); + $this->write('``' . $command->getName() . "``\n" . \str_repeat($this->subsectionChar, Helper::width($command->getName())) . "\n\n" . ($command->getDescription() ? $command->getDescription() . "\n\n" : '') . "Usage\n" . \str_repeat($this->paragraphsChar, 5) . "\n\n" . \array_reduce($command->getAliases(), static fn($carry, $usage) => $carry . '- ``' . $usage . '``' . "\n")); return; } $command->mergeApplicationDefinition(\false); foreach ($command->getAliases() as $alias) { $this->write('.. _' . $alias . ":\n\n"); } - $this->write($command->getName() . "\n" . \str_repeat($this->subsectionChar, Helper::width($command->getName())) . "\n\n" . ($command->getDescription() ? $command->getDescription() . "\n\n" : '') . "Usage\n" . \str_repeat($this->subsubsectionChar, 5) . "\n\n" . \array_reduce(\array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), static function ($carry, $usage) { - return $carry . '- ``' . $usage . '``' . "\n"; - })); + $this->write($command->getName() . "\n" . \str_repeat($this->subsectionChar, Helper::width($command->getName())) . "\n\n" . ($command->getDescription() ? $command->getDescription() . "\n\n" : '') . "Usage\n" . \str_repeat($this->subsubsectionChar, 5) . "\n\n" . \array_reduce(\array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), static fn($carry, $usage) => $carry . '- ``' . $usage . '``' . "\n")); if ($help = $command->getProcessedHelp()) { $this->write("\n"); $this->write($help); @@ -181,9 +156,7 @@ class ReStructuredTextDescriptor extends Descriptor } $commands = $this->removeAliasesAndHiddenCommands($commands); $this->write("\n\n"); - $this->write(\implode("\n", \array_map(static function ($commandName) { - return \sprintf('- `%s`_', $commandName); - }, \array_keys($commands)))); + $this->write(\implode("\n", \array_map(static fn($commandName) => \sprintf('- `%s`_', $commandName), \array_keys($commands)))); } } private function getNonDefaultOptions(InputDefinition $definition) : array diff --git a/vendor/symfony/console/Descriptor/TextDescriptor.php b/vendor/symfony/console/Descriptor/TextDescriptor.php index b1bfc0bcfd2..6a54376978d 100644 --- a/vendor/symfony/console/Descriptor/TextDescriptor.php +++ b/vendor/symfony/console/Descriptor/TextDescriptor.php @@ -164,18 +164,14 @@ class TextDescriptor extends Descriptor } } // calculate max. width based on available commands per namespace - $width = $this->getColumnWidth(\array_merge(...\array_values(\array_map(function ($namespace) use($commands) { - return \array_intersect($namespace['commands'], \array_keys($commands)); - }, \array_values($namespaces))))); + $width = $this->getColumnWidth(\array_merge(...\array_values(\array_map(fn($namespace) => \array_intersect($namespace['commands'], \array_keys($commands)), \array_values($namespaces))))); if ($describedNamespace) { $this->writeText(\sprintf('Available commands for the "%s" namespace:', $describedNamespace), $options); } else { $this->writeText('Available commands:', $options); } foreach ($namespaces as $namespace) { - $namespace['commands'] = \array_filter($namespace['commands'], function ($name) use($commands) { - return isset($commands[$name]); - }); + $namespace['commands'] = \array_filter($namespace['commands'], fn($name) => isset($commands[$name])); if (!$namespace['commands']) { continue; } diff --git a/vendor/symfony/console/Exception/CommandNotFoundException.php b/vendor/symfony/console/Exception/CommandNotFoundException.php index 4af29ce06d6..6b3641023a2 100644 --- a/vendor/symfony/console/Exception/CommandNotFoundException.php +++ b/vendor/symfony/console/Exception/CommandNotFoundException.php @@ -17,10 +17,7 @@ namespace RectorPrefix202411\Symfony\Component\Console\Exception; */ class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface { - /** - * @var mixed[] - */ - private $alternatives; + private array $alternatives; /** * @param string $message Exception message to throw * @param string[] $alternatives List of similar defined names diff --git a/vendor/symfony/console/Exception/RunCommandFailedException.php b/vendor/symfony/console/Exception/RunCommandFailedException.php index e72fb3343d5..001d9c28d29 100644 --- a/vendor/symfony/console/Exception/RunCommandFailedException.php +++ b/vendor/symfony/console/Exception/RunCommandFailedException.php @@ -18,9 +18,8 @@ final class RunCommandFailedException extends RuntimeException { /** * @readonly - * @var \Symfony\Component\Console\Messenger\RunCommandContext */ - public $context; + public RunCommandContext $context; /** * @param \Throwable|string $exception */ diff --git a/vendor/symfony/console/Formatter/NullOutputFormatter.php b/vendor/symfony/console/Formatter/NullOutputFormatter.php index 24abc9dbfe4..c4fbec1c4c9 100644 --- a/vendor/symfony/console/Formatter/NullOutputFormatter.php +++ b/vendor/symfony/console/Formatter/NullOutputFormatter.php @@ -15,10 +15,7 @@ namespace RectorPrefix202411\Symfony\Component\Console\Formatter; */ final class NullOutputFormatter implements OutputFormatterInterface { - /** - * @var \Symfony\Component\Console\Formatter\NullOutputFormatterStyle - */ - private $style; + private NullOutputFormatterStyle $style; public function format(?string $message) : ?string { return null; @@ -26,7 +23,7 @@ final class NullOutputFormatter implements OutputFormatterInterface public function getStyle(string $name) : OutputFormatterStyleInterface { // to comply with the interface we must return a OutputFormatterStyleInterface - return $this->style = $this->style ?? new NullOutputFormatterStyle(); + return $this->style ??= new NullOutputFormatterStyle(); } public function hasStyle(string $name) : bool { diff --git a/vendor/symfony/console/Formatter/OutputFormatter.php b/vendor/symfony/console/Formatter/OutputFormatter.php index 2e634fc72b8..71c63a61838 100644 --- a/vendor/symfony/console/Formatter/OutputFormatter.php +++ b/vendor/symfony/console/Formatter/OutputFormatter.php @@ -20,18 +20,9 @@ use function RectorPrefix202411\Symfony\Component\String\b; */ class OutputFormatter implements WrappableOutputFormatterInterface { - /** - * @var bool - */ - private $decorated; - /** - * @var mixed[] - */ - private $styles = []; - /** - * @var \Symfony\Component\Console\Formatter\OutputFormatterStyleStack - */ - private $styleStack; + private bool $decorated; + private array $styles = []; + private OutputFormatterStyleStack $styleStack; public function __clone() { $this->styleStack = clone $this->styleStack; diff --git a/vendor/symfony/console/Formatter/OutputFormatterStyle.php b/vendor/symfony/console/Formatter/OutputFormatterStyle.php index b449e74c5ae..7f11d2869d2 100644 --- a/vendor/symfony/console/Formatter/OutputFormatterStyle.php +++ b/vendor/symfony/console/Formatter/OutputFormatterStyle.php @@ -18,30 +18,12 @@ use RectorPrefix202411\Symfony\Component\Console\Color; */ class OutputFormatterStyle implements OutputFormatterStyleInterface { - /** - * @var \Symfony\Component\Console\Color - */ - private $color; - /** - * @var string - */ - private $foreground; - /** - * @var string - */ - private $background; - /** - * @var mixed[] - */ - private $options; - /** - * @var string|null - */ - private $href; - /** - * @var bool - */ - private $handlesHrefGracefully; + private Color $color; + private string $foreground; + private string $background; + private array $options; + private ?string $href = null; + private bool $handlesHrefGracefully; /** * Initializes output formatter style. * @@ -104,7 +86,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface } public function apply(string $text) : string { - $this->handlesHrefGracefully = $this->handlesHrefGracefully ?? 'JetBrains-JediTerm' !== \getenv('TERMINAL_EMULATOR') && (!\getenv('KONSOLE_VERSION') || (int) \getenv('KONSOLE_VERSION') > 201100) && !isset($_SERVER['IDEA_INITIAL_DIRECTORY']); + $this->handlesHrefGracefully ??= 'JetBrains-JediTerm' !== \getenv('TERMINAL_EMULATOR') && (!\getenv('KONSOLE_VERSION') || (int) \getenv('KONSOLE_VERSION') > 201100) && !isset($_SERVER['IDEA_INITIAL_DIRECTORY']); if (null !== $this->href && $this->handlesHrefGracefully) { $text = "\x1b]8;;{$this->href}\x1b\\{$text}\x1b]8;;\x1b\\"; } diff --git a/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php b/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php index 21e632809c6..51eb3e9eb06 100644 --- a/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php +++ b/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php @@ -20,11 +20,8 @@ class OutputFormatterStyleStack implements ResetInterface /** * @var OutputFormatterStyleInterface[] */ - private $styles = []; - /** - * @var \Symfony\Component\Console\Formatter\OutputFormatterStyleInterface - */ - private $emptyStyle; + private array $styles = []; + private OutputFormatterStyleInterface $emptyStyle; public function __construct(?OutputFormatterStyleInterface $emptyStyle = null) { $this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle(); diff --git a/vendor/symfony/console/Helper/DebugFormatterHelper.php b/vendor/symfony/console/Helper/DebugFormatterHelper.php index 7d90acdb71b..d617f5efda0 100644 --- a/vendor/symfony/console/Helper/DebugFormatterHelper.php +++ b/vendor/symfony/console/Helper/DebugFormatterHelper.php @@ -20,14 +20,8 @@ namespace RectorPrefix202411\Symfony\Component\Console\Helper; class DebugFormatterHelper extends Helper { private const COLORS = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default']; - /** - * @var mixed[] - */ - private $started = []; - /** - * @var int - */ - private $count = -1; + private array $started = []; + private int $count = -1; /** * Starts a debug formatting session. */ diff --git a/vendor/symfony/console/Helper/DescriptorHelper.php b/vendor/symfony/console/Helper/DescriptorHelper.php index 3db8ec92aa3..a8ef9649b0e 100644 --- a/vendor/symfony/console/Helper/DescriptorHelper.php +++ b/vendor/symfony/console/Helper/DescriptorHelper.php @@ -28,7 +28,7 @@ class DescriptorHelper extends Helper /** * @var DescriptorInterface[] */ - private $descriptors = []; + private array $descriptors = []; public function __construct() { $this->register('txt', new TextDescriptor())->register('xml', new XmlDescriptor())->register('json', new JsonDescriptor())->register('md', new MarkdownDescriptor())->register('rst', new ReStructuredTextDescriptor()); diff --git a/vendor/symfony/console/Helper/Dumper.php b/vendor/symfony/console/Helper/Dumper.php index d5a34600b73..3d80fa34ab3 100644 --- a/vendor/symfony/console/Helper/Dumper.php +++ b/vendor/symfony/console/Helper/Dumper.php @@ -19,22 +19,10 @@ use RectorPrefix202411\Symfony\Component\VarDumper\Dumper\CliDumper; */ final class Dumper { - /** - * @var \Symfony\Component\Console\Output\OutputInterface - */ - private $output; - /** - * @var \Symfony\Component\VarDumper\Dumper\CliDumper|null - */ - private $dumper; - /** - * @var \Symfony\Component\VarDumper\Cloner\ClonerInterface|null - */ - private $cloner; - /** - * @var \Closure - */ - private $handler; + private OutputInterface $output; + private ?CliDumper $dumper; + private ?ClonerInterface $cloner; + private \Closure $handler; public function __construct(OutputInterface $output, ?CliDumper $dumper = null, ?ClonerInterface $cloner = null) { $this->output = $output; @@ -42,9 +30,9 @@ final class Dumper $this->cloner = $cloner; if (\class_exists(CliDumper::class)) { $this->handler = function ($var) : string { - $dumper = $this->dumper = $this->dumper ?? new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR); + $dumper = $this->dumper ??= new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR); $dumper->setColors($this->output->isDecorated()); - return \rtrim($dumper->dump(($this->cloner = $this->cloner ?? new VarCloner())->cloneVar($var)->withRefHandles(\false), \true)); + return \rtrim($dumper->dump(($this->cloner ??= new VarCloner())->cloneVar($var)->withRefHandles(\false), \true)); }; } else { $this->handler = function ($var) : string { diff --git a/vendor/symfony/console/Helper/Helper.php b/vendor/symfony/console/Helper/Helper.php index 23231a5cd72..4c555ca8843 100644 --- a/vendor/symfony/console/Helper/Helper.php +++ b/vendor/symfony/console/Helper/Helper.php @@ -40,7 +40,7 @@ abstract class Helper implements HelperInterface */ public static function width(?string $string) : int { - $string = $string ?? ''; + $string ??= ''; return \mb_strlen($string); if (\preg_match('//u', $string)) { return (new UnicodeString($string))->width(\false); @@ -56,7 +56,7 @@ abstract class Helper implements HelperInterface */ public static function length(?string $string) : int { - $string = $string ?? ''; + $string ??= ''; return \mb_strlen($string); if (\preg_match('//u', $string)) { return (new UnicodeString($string))->length(); @@ -71,7 +71,7 @@ abstract class Helper implements HelperInterface */ public static function substr(?string $string, int $from, ?int $length = null) : string { - $string = $string ?? ''; + $string ??= ''; if (\false === ($encoding = \mb_detect_encoding($string, null, \true))) { return \substr($string, $from, $length); } diff --git a/vendor/symfony/console/Helper/HelperSet.php b/vendor/symfony/console/Helper/HelperSet.php index 05c68702334..5d2fd92a729 100644 --- a/vendor/symfony/console/Helper/HelperSet.php +++ b/vendor/symfony/console/Helper/HelperSet.php @@ -21,7 +21,7 @@ use RectorPrefix202411\Symfony\Component\Console\Exception\InvalidArgumentExcept class HelperSet implements \IteratorAggregate { /** @var array */ - private $helpers = []; + private array $helpers = []; /** * @param HelperInterface[] $helpers */ diff --git a/vendor/symfony/console/Helper/OutputWrapper.php b/vendor/symfony/console/Helper/OutputWrapper.php index e5175cd9978..afdbe9666d3 100644 --- a/vendor/symfony/console/Helper/OutputWrapper.php +++ b/vendor/symfony/console/Helper/OutputWrapper.php @@ -43,10 +43,7 @@ namespace RectorPrefix202411\Symfony\Component\Console\Helper; */ final class OutputWrapper { - /** - * @var bool - */ - private $allowCutUrls = \false; + private bool $allowCutUrls = \false; private const TAG_OPEN_REGEX_SEGMENT = '[a-z](?:[^\\\\<>]*+ | \\\\.)*'; private const TAG_CLOSE_REGEX_SEGMENT = '[a-z][^<>]*+'; private const URL_PATTERN = 'https?://\\S+'; diff --git a/vendor/symfony/console/Helper/ProgressBar.php b/vendor/symfony/console/Helper/ProgressBar.php index b97670fc00f..96bb9a4737b 100644 --- a/vendor/symfony/console/Helper/ProgressBar.php +++ b/vendor/symfony/console/Helper/ProgressBar.php @@ -32,110 +32,32 @@ final class ProgressBar private const FORMAT_VERY_VERBOSE_NOMAX = 'very_verbose_nomax'; private const FORMAT_DEBUG_NOMAX = 'debug_nomax'; private const FORMAT_NORMAL_NOMAX = 'normal_nomax'; - /** - * @var int - */ - private $barWidth = 28; - /** - * @var string - */ - private $barChar; - /** - * @var string - */ - private $emptyBarChar = '-'; - /** - * @var string - */ - private $progressChar = '>'; - /** - * @var string|null - */ - private $format; - /** - * @var string|null - */ - private $internalFormat; - /** - * @var int|null - */ - private $redrawFreq = 1; - /** - * @var int - */ - private $writeCount = 0; - /** - * @var float - */ - private $lastWriteTime = 0; - /** - * @var float - */ - private $minSecondsBetweenRedraws = 0; - /** - * @var float - */ - private $maxSecondsBetweenRedraws = 1; - /** - * @var \Symfony\Component\Console\Output\OutputInterface - */ - private $output; - /** - * @var int - */ - private $step = 0; - /** - * @var int - */ - private $startingStep = 0; - /** - * @var int|null - */ - private $max; - /** - * @var int - */ - private $startTime; - /** - * @var int - */ - private $stepWidth; - /** - * @var float - */ - private $percent = 0.0; - /** - * @var mixed[] - */ - private $messages = []; - /** - * @var bool - */ - private $overwrite = \true; - /** - * @var \Symfony\Component\Console\Terminal - */ - private $terminal; - /** - * @var string|null - */ - private $previousMessage; - /** - * @var \Symfony\Component\Console\Cursor - */ - private $cursor; - /** - * @var mixed[] - */ - private $placeholders = []; - /** - * @var mixed[] - */ - private static $formatters; - /** - * @var mixed[] - */ - private static $formats; + private int $barWidth = 28; + private string $barChar; + private string $emptyBarChar = '-'; + private string $progressChar = '>'; + private ?string $format = null; + private ?string $internalFormat = null; + private ?int $redrawFreq = 1; + private int $writeCount = 0; + private float $lastWriteTime = 0; + private float $minSecondsBetweenRedraws = 0; + private float $maxSecondsBetweenRedraws = 1; + private OutputInterface $output; + private int $step = 0; + private int $startingStep = 0; + private ?int $max = null; + private int $startTime; + private int $stepWidth; + private float $percent = 0.0; + private array $messages = []; + private bool $overwrite = \true; + private Terminal $terminal; + private ?string $previousMessage = null; + private Cursor $cursor; + private array $placeholders = []; + private static array $formatters; + private static array $formats; /** * @param int $max Maximum steps (0 if unknown) */ @@ -170,7 +92,7 @@ final class ProgressBar */ public static function setPlaceholderFormatterDefinition(string $name, callable $callable) : void { - self::$formatters = self::$formatters ?? self::initPlaceholderFormatters(); + self::$formatters ??= self::initPlaceholderFormatters(); self::$formatters[$name] = $callable; } /** @@ -180,7 +102,7 @@ final class ProgressBar */ public static function getPlaceholderFormatterDefinition(string $name) : ?callable { - self::$formatters = self::$formatters ?? self::initPlaceholderFormatters(); + self::$formatters ??= self::initPlaceholderFormatters(); return self::$formatters[$name] ?? null; } /** @@ -211,7 +133,7 @@ final class ProgressBar */ public static function setFormatDefinition(string $name, string $format) : void { - self::$formats = self::$formats ?? self::initFormats(); + self::$formats ??= self::initFormats(); self::$formats[$name] = $format; } /** @@ -221,7 +143,7 @@ final class ProgressBar */ public static function getFormatDefinition(string $name) : ?string { - self::$formats = self::$formats ?? self::initFormats(); + self::$formats ??= self::initFormats(); return self::$formats[$name] ?? null; } /** @@ -347,7 +269,7 @@ final class ProgressBar */ public function iterate(iterable $iterable, ?int $max = null) : iterable { - $this->start($max ?? (\is_array($iterable) || $iterable instanceof \Countable ? \count($iterable) : 0)); + $this->start($max ?? (\is_countable($iterable) ? \count($iterable) : 0)); foreach ($iterable as $key => $value) { (yield $key => $value); $this->advance(); @@ -538,9 +460,7 @@ final class ProgressBar $display .= $bar->getProgressCharacter() . \str_repeat($bar->getEmptyBarCharacter(), $emptyBars); } return $display; - }, 'elapsed' => function (self $bar) { - return Helper::formatTime(\time() - $bar->getStartTime(), 2); - }, 'remaining' => function (self $bar) { + }, 'elapsed' => fn(self $bar) => Helper::formatTime(\time() - $bar->getStartTime(), 2), 'remaining' => function (self $bar) { if (!$bar->getMaxSteps()) { throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.'); } @@ -550,15 +470,7 @@ final class ProgressBar throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.'); } return Helper::formatTime($bar->getEstimated(), 2); - }, 'memory' => function (self $bar) { - return Helper::formatMemory(\memory_get_usage(\true)); - }, 'current' => function (self $bar) { - return \str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT); - }, 'max' => function (self $bar) { - return $bar->getMaxSteps(); - }, 'percent' => function (self $bar) { - return \floor($bar->getProgressPercent() * 100); - }]; + }, 'memory' => fn(self $bar) => Helper::formatMemory(\memory_get_usage(\true)), 'current' => fn(self $bar) => \str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT), 'max' => fn(self $bar) => $bar->getMaxSteps(), 'percent' => fn(self $bar) => \floor($bar->getProgressPercent() * 100)]; } private static function initFormats() : array { @@ -583,9 +495,7 @@ final class ProgressBar }; $line = \preg_replace_callback($regex, $callback, $this->format); // gets string length for each sub line with multiline format - $linesLength = \array_map(function ($subLine) { - return Helper::width(Helper::removeDecoration($this->output->getFormatter(), \rtrim($subLine, "\r"))); - }, \explode("\n", $line)); + $linesLength = \array_map(fn($subLine) => Helper::width(Helper::removeDecoration($this->output->getFormatter(), \rtrim($subLine, "\r"))), \explode("\n", $line)); $linesWidth = \max($linesLength); $terminalWidth = $this->terminal->getWidth(); if ($linesWidth <= $terminalWidth) { diff --git a/vendor/symfony/console/Helper/ProgressIndicator.php b/vendor/symfony/console/Helper/ProgressIndicator.php index 1a85e306aa2..0a4565a9f6f 100644 --- a/vendor/symfony/console/Helper/ProgressIndicator.php +++ b/vendor/symfony/console/Helper/ProgressIndicator.php @@ -19,46 +19,19 @@ use RectorPrefix202411\Symfony\Component\Console\Output\OutputInterface; class ProgressIndicator { private const FORMATS = ['normal' => ' %indicator% %message%', 'normal_no_ansi' => ' %message%', 'verbose' => ' %indicator% %message% (%elapsed:6s%)', 'verbose_no_ansi' => ' %message% (%elapsed:6s%)', 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)', 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)']; - /** - * @var \Symfony\Component\Console\Output\OutputInterface - */ - private $output; - /** - * @var int - */ - private $startTime; - /** - * @var string|null - */ - private $format; - /** - * @var string|null - */ - private $message; - /** - * @var mixed[] - */ - private $indicatorValues; - /** - * @var int - */ - private $indicatorCurrent; - /** - * @var int - */ - private $indicatorChangeInterval; - /** - * @var float - */ - private $indicatorUpdateTime; - /** - * @var bool - */ - private $started = \false; + private OutputInterface $output; + private int $startTime; + private ?string $format = null; + private ?string $message = null; + private array $indicatorValues; + private int $indicatorCurrent; + private int $indicatorChangeInterval; + private float $indicatorUpdateTime; + private bool $started = \false; /** * @var array */ - private static $formatters; + private static array $formatters; /** * @param int $indicatorChangeInterval Change interval in milliseconds * @param array|null $indicatorValues Animated indicator characters @@ -66,8 +39,8 @@ class ProgressIndicator public function __construct(OutputInterface $output, ?string $format = null, int $indicatorChangeInterval = 100, ?array $indicatorValues = null) { $this->output = $output; - $format = $format ?? $this->determineBestFormat(); - $indicatorValues = $indicatorValues ?? ['-', '\\', '|', '/']; + $format ??= $this->determineBestFormat(); + $indicatorValues ??= ['-', '\\', '|', '/']; $indicatorValues = \array_values($indicatorValues); if (2 > \count($indicatorValues)) { throw new InvalidArgumentException('Must have at least 2 indicator value characters.'); @@ -156,7 +129,7 @@ class ProgressIndicator */ public static function setPlaceholderFormatterDefinition(string $name, callable $callable) { - self::$formatters = self::$formatters ?? self::initPlaceholderFormatters(); + self::$formatters ??= self::initPlaceholderFormatters(); self::$formatters[$name] = $callable; } /** @@ -164,7 +137,7 @@ class ProgressIndicator */ public static function getPlaceholderFormatterDefinition(string $name) : ?callable { - self::$formatters = self::$formatters ?? self::initPlaceholderFormatters(); + self::$formatters ??= self::initPlaceholderFormatters(); return self::$formatters[$name] ?? null; } private function display() : void @@ -212,14 +185,6 @@ class ProgressIndicator */ private static function initPlaceholderFormatters() : array { - return ['indicator' => function (self $indicator) { - return $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)]; - }, 'message' => function (self $indicator) { - return $indicator->message; - }, 'elapsed' => function (self $indicator) { - return Helper::formatTime(\time() - $indicator->startTime, 2); - }, 'memory' => function () { - return Helper::formatMemory(\memory_get_usage(\true)); - }]; + return ['indicator' => fn(self $indicator) => $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)], 'message' => fn(self $indicator) => $indicator->message, 'elapsed' => fn(self $indicator) => Helper::formatTime(\time() - $indicator->startTime, 2), 'memory' => fn() => Helper::formatMemory(\memory_get_usage(\true))]; } } diff --git a/vendor/symfony/console/Helper/QuestionHelper.php b/vendor/symfony/console/Helper/QuestionHelper.php index 160129d2305..a25031a5312 100644 --- a/vendor/symfony/console/Helper/QuestionHelper.php +++ b/vendor/symfony/console/Helper/QuestionHelper.php @@ -35,14 +35,8 @@ class QuestionHelper extends Helper * @var resource|null */ private $inputStream; - /** - * @var bool - */ - private static $stty = \true; - /** - * @var bool - */ - private static $stdinIsInteractive; + private static bool $stty = \true; + private static bool $stdinIsInteractive; /** * Asks a question to the user. * @@ -65,9 +59,7 @@ class QuestionHelper extends Helper if (!$question->getValidator()) { return $this->doAsk($output, $question); } - $interviewer = function () use($output, $question) { - return $this->doAsk($output, $question); - }; + $interviewer = fn() => $this->doAsk($output, $question); return $this->validateAttempts($interviewer, $output, $question); } catch (MissingInputException $exception) { $input->setInteractive(\false); @@ -281,9 +273,7 @@ class QuestionHelper extends Helper $output->write($remainingCharacters); $fullChoice .= $remainingCharacters; $i = \false === ($encoding = \mb_detect_encoding($fullChoice, null, \true)) ? \strlen($fullChoice) : \mb_strlen($fullChoice, $encoding); - $matches = \array_filter($autocomplete($ret), function ($match) use($ret) { - return '' === $ret || \strncmp($match, $ret, \strlen($ret)) === 0; - }); + $matches = \array_filter($autocomplete($ret), fn($match) => '' === $ret || \strncmp($match, $ret, \strlen($ret)) === 0); $numMatches = \count($matches); $ofs = -1; } diff --git a/vendor/symfony/console/Helper/Table.php b/vendor/symfony/console/Helper/Table.php index 84c76164f19..6308ed23f16 100644 --- a/vendor/symfony/console/Helper/Table.php +++ b/vendor/symfony/console/Helper/Table.php @@ -36,66 +36,24 @@ class Table private const DISPLAY_ORIENTATION_DEFAULT = 'default'; private const DISPLAY_ORIENTATION_HORIZONTAL = 'horizontal'; private const DISPLAY_ORIENTATION_VERTICAL = 'vertical'; - /** - * @var string|null - */ - private $headerTitle; - /** - * @var string|null - */ - private $footerTitle; - /** - * @var mixed[] - */ - private $headers = []; - /** - * @var mixed[] - */ - private $rows = []; - /** - * @var mixed[] - */ - private $effectiveColumnWidths = []; - /** - * @var int - */ - private $numberOfColumns; - /** - * @var \Symfony\Component\Console\Output\OutputInterface - */ - private $output; - /** - * @var \Symfony\Component\Console\Helper\TableStyle - */ - private $style; - /** - * @var mixed[] - */ - private $columnStyles = []; - /** - * @var mixed[] - */ - private $columnWidths = []; - /** - * @var mixed[] - */ - private $columnMaxWidths = []; - /** - * @var bool - */ - private $rendered = \false; - /** - * @var string - */ - private $displayOrientation = self::DISPLAY_ORIENTATION_DEFAULT; - /** - * @var mixed[] - */ - private static $styles; + private ?string $headerTitle = null; + private ?string $footerTitle = null; + private array $headers = []; + private array $rows = []; + private array $effectiveColumnWidths = []; + private int $numberOfColumns; + private OutputInterface $output; + private TableStyle $style; + private array $columnStyles = []; + private array $columnWidths = []; + private array $columnMaxWidths = []; + private bool $rendered = \false; + private string $displayOrientation = self::DISPLAY_ORIENTATION_DEFAULT; + private static array $styles; public function __construct(OutputInterface $output) { $this->output = $output; - self::$styles = self::$styles ?? self::initStyles(); + self::$styles ??= self::initStyles(); $this->setStyle('default'); } /** @@ -105,7 +63,7 @@ class Table */ public static function setStyleDefinition(string $name, TableStyle $style) { - self::$styles = self::$styles ?? self::initStyles(); + self::$styles ??= self::initStyles(); self::$styles[$name] = $style; } /** @@ -113,7 +71,7 @@ class Table */ public static function getStyleDefinition(string $name) : TableStyle { - self::$styles = self::$styles ?? self::initStyles(); + self::$styles ??= self::initStyles(); if (!isset(self::$styles[$name])) { throw new InvalidArgumentException(\sprintf('Style "%s" is not defined.', $name)); } @@ -317,9 +275,7 @@ class Table public function render() { $divider = new TableSeparator(); - $isCellWithColspan = static function ($cell) { - return $cell instanceof TableCell && $cell->getColspan() >= 2; - }; + $isCellWithColspan = static fn($cell) => $cell instanceof TableCell && $cell->getColspan() >= 2; $horizontal = self::DISPLAY_ORIENTATION_HORIZONTAL === $this->displayOrientation; $vertical = self::DISPLAY_ORIENTATION_VERTICAL === $this->displayOrientation; $rows = []; @@ -341,9 +297,7 @@ class Table } } elseif ($vertical) { $formatter = $this->output->getFormatter(); - $maxHeaderLength = \array_reduce($this->headers[0] ?? [], static function ($max, $header) use($formatter) { - return \max($max, Helper::width(Helper::removeDecoration($formatter, $header))); - }, 0); + $maxHeaderLength = \array_reduce($this->headers[0] ?? [], static fn($max, $header) => \max($max, Helper::width(Helper::removeDecoration($formatter, $header))), 0); foreach ($this->rows as $row) { if ($row instanceof TableSeparator) { continue; diff --git a/vendor/symfony/console/Helper/TableCell.php b/vendor/symfony/console/Helper/TableCell.php index e02c7476cb3..ee7ae16401e 100644 --- a/vendor/symfony/console/Helper/TableCell.php +++ b/vendor/symfony/console/Helper/TableCell.php @@ -16,14 +16,8 @@ use RectorPrefix202411\Symfony\Component\Console\Exception\InvalidArgumentExcept */ class TableCell { - /** - * @var string - */ - private $value; - /** - * @var mixed[] - */ - private $options = ['rowspan' => 1, 'colspan' => 1, 'style' => null]; + private string $value; + private array $options = ['rowspan' => 1, 'colspan' => 1, 'style' => null]; public function __construct(string $value = '', array $options = []) { $this->value = $value; diff --git a/vendor/symfony/console/Helper/TableCellStyle.php b/vendor/symfony/console/Helper/TableCellStyle.php index 77c459b29eb..59d5f10d046 100644 --- a/vendor/symfony/console/Helper/TableCellStyle.php +++ b/vendor/symfony/console/Helper/TableCellStyle.php @@ -19,10 +19,7 @@ class TableCellStyle public const DEFAULT_ALIGN = 'left'; private const TAG_OPTIONS = ['fg', 'bg', 'options']; private const ALIGN_MAP = ['left' => \STR_PAD_RIGHT, 'center' => \STR_PAD_BOTH, 'right' => \STR_PAD_LEFT]; - /** - * @var mixed[] - */ - private $options = ['fg' => 'default', 'bg' => 'default', 'options' => null, 'align' => self::DEFAULT_ALIGN, 'cellFormat' => null]; + private array $options = ['fg' => 'default', 'bg' => 'default', 'options' => null, 'align' => self::DEFAULT_ALIGN, 'cellFormat' => null]; public function __construct(array $options = []) { if ($diff = \array_diff(\array_keys($options), \array_keys($this->options))) { @@ -44,9 +41,7 @@ class TableCellStyle */ public function getTagOptions() : array { - return \array_filter($this->getOptions(), function ($key) { - return \in_array($key, self::TAG_OPTIONS) && isset($this->options[$key]); - }, \ARRAY_FILTER_USE_KEY); + return \array_filter($this->getOptions(), fn($key) => \in_array($key, self::TAG_OPTIONS) && isset($this->options[$key]), \ARRAY_FILTER_USE_KEY); } public function getPadByAlign() : int { diff --git a/vendor/symfony/console/Helper/TableRows.php b/vendor/symfony/console/Helper/TableRows.php index 5254f307e0e..3acac0eb94a 100644 --- a/vendor/symfony/console/Helper/TableRows.php +++ b/vendor/symfony/console/Helper/TableRows.php @@ -15,10 +15,7 @@ namespace RectorPrefix202411\Symfony\Component\Console\Helper; */ class TableRows implements \IteratorAggregate { - /** - * @var \Closure - */ - private $generator; + private \Closure $generator; public function __construct(\Closure $generator) { $this->generator = $generator; diff --git a/vendor/symfony/console/Helper/TableStyle.php b/vendor/symfony/console/Helper/TableStyle.php index 53e8a1814c9..cfde062c396 100644 --- a/vendor/symfony/console/Helper/TableStyle.php +++ b/vendor/symfony/console/Helper/TableStyle.php @@ -21,102 +21,30 @@ use RectorPrefix202411\Symfony\Component\Console\Exception\LogicException; */ class TableStyle { - /** - * @var string - */ - private $paddingChar = ' '; - /** - * @var string - */ - private $horizontalOutsideBorderChar = '-'; - /** - * @var string - */ - private $horizontalInsideBorderChar = '-'; - /** - * @var string - */ - private $verticalOutsideBorderChar = '|'; - /** - * @var string - */ - private $verticalInsideBorderChar = '|'; - /** - * @var string - */ - private $crossingChar = '+'; - /** - * @var string - */ - private $crossingTopRightChar = '+'; - /** - * @var string - */ - private $crossingTopMidChar = '+'; - /** - * @var string - */ - private $crossingTopLeftChar = '+'; - /** - * @var string - */ - private $crossingMidRightChar = '+'; - /** - * @var string - */ - private $crossingBottomRightChar = '+'; - /** - * @var string - */ - private $crossingBottomMidChar = '+'; - /** - * @var string - */ - private $crossingBottomLeftChar = '+'; - /** - * @var string - */ - private $crossingMidLeftChar = '+'; - /** - * @var string - */ - private $crossingTopLeftBottomChar = '+'; - /** - * @var string - */ - private $crossingTopMidBottomChar = '+'; - /** - * @var string - */ - private $crossingTopRightBottomChar = '+'; - /** - * @var string - */ - private $headerTitleFormat = ' %s '; - /** - * @var string - */ - private $footerTitleFormat = ' %s '; - /** - * @var string - */ - private $cellHeaderFormat = '%s'; - /** - * @var string - */ - private $cellRowFormat = '%s'; - /** - * @var string - */ - private $cellRowContentFormat = ' %s '; - /** - * @var string - */ - private $borderFormat = '%s'; - /** - * @var int - */ - private $padType = \STR_PAD_RIGHT; + private string $paddingChar = ' '; + private string $horizontalOutsideBorderChar = '-'; + private string $horizontalInsideBorderChar = '-'; + private string $verticalOutsideBorderChar = '|'; + private string $verticalInsideBorderChar = '|'; + private string $crossingChar = '+'; + private string $crossingTopRightChar = '+'; + private string $crossingTopMidChar = '+'; + private string $crossingTopLeftChar = '+'; + private string $crossingMidRightChar = '+'; + private string $crossingBottomRightChar = '+'; + private string $crossingBottomMidChar = '+'; + private string $crossingBottomLeftChar = '+'; + private string $crossingMidLeftChar = '+'; + private string $crossingTopLeftBottomChar = '+'; + private string $crossingTopMidBottomChar = '+'; + private string $crossingTopRightBottomChar = '+'; + private string $headerTitleFormat = ' %s '; + private string $footerTitleFormat = ' %s '; + private string $cellHeaderFormat = '%s'; + private string $cellRowFormat = '%s'; + private string $cellRowContentFormat = ' %s '; + private string $borderFormat = '%s'; + private int $padType = \STR_PAD_RIGHT; /** * Sets padding character, used for cell padding. * diff --git a/vendor/symfony/console/Input/ArgvInput.php b/vendor/symfony/console/Input/ArgvInput.php index aba7855179b..f850e14caad 100644 --- a/vendor/symfony/console/Input/ArgvInput.php +++ b/vendor/symfony/console/Input/ArgvInput.php @@ -38,17 +38,11 @@ use RectorPrefix202411\Symfony\Component\Console\Exception\RuntimeException; */ class ArgvInput extends Input { - /** - * @var mixed[] - */ - private $tokens; - /** - * @var mixed[] - */ - private $parsed; + private array $tokens; + private array $parsed; public function __construct(?array $argv = null, ?InputDefinition $definition = null) { - $argv = $argv ?? $_SERVER['argv'] ?? []; + $argv ??= $_SERVER['argv'] ?? []; // strip the application name \array_shift($argv); $this->tokens = $argv; @@ -161,8 +155,7 @@ class ArgvInput extends Input } else { $all = $this->definition->getArguments(); $symfonyCommandName = null; - \reset($all); - if (($inputArgument = $all[$key = \key($all)] ?? null) && 'command' === $inputArgument->getName()) { + if (($inputArgument = $all[$key = \array_key_first($all)] ?? null) && 'command' === $inputArgument->getName()) { $symfonyCommandName = $this->arguments['command'] ?? null; unset($all[$key]); } diff --git a/vendor/symfony/console/Input/ArrayInput.php b/vendor/symfony/console/Input/ArrayInput.php index f1ae5220fc2..9da662a8ce5 100644 --- a/vendor/symfony/console/Input/ArrayInput.php +++ b/vendor/symfony/console/Input/ArrayInput.php @@ -23,10 +23,7 @@ use RectorPrefix202411\Symfony\Component\Console\Exception\InvalidOptionExceptio */ class ArrayInput extends Input { - /** - * @var mixed[] - */ - private $parameters; + private array $parameters; public function __construct(array $parameters, ?InputDefinition $definition = null) { $this->parameters = $parameters; diff --git a/vendor/symfony/console/Input/Input.php b/vendor/symfony/console/Input/Input.php index 566c54aa546..41470a93c13 100644 --- a/vendor/symfony/console/Input/Input.php +++ b/vendor/symfony/console/Input/Input.php @@ -63,9 +63,7 @@ abstract class Input implements InputInterface, StreamableInputInterface { $definition = $this->definition; $givenArguments = $this->arguments; - $missingArguments = \array_filter(\array_keys($definition->getArguments()), function ($argument) use($givenArguments, $definition) { - return !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired(); - }); + $missingArguments = \array_filter(\array_keys($definition->getArguments()), fn($argument) => !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired()); if (\count($missingArguments) > 0) { throw new RuntimeException(\sprintf('Not enough arguments (missing: "%s").', \implode(', ', $missingArguments))); } diff --git a/vendor/symfony/console/Input/InputArgument.php b/vendor/symfony/console/Input/InputArgument.php index bb68479d767..7a80283f6ce 100644 --- a/vendor/symfony/console/Input/InputArgument.php +++ b/vendor/symfony/console/Input/InputArgument.php @@ -26,14 +26,8 @@ class InputArgument public const REQUIRED = 1; public const OPTIONAL = 2; public const IS_ARRAY = 4; - /** - * @var string - */ - private $name; - /** - * @var int - */ - private $mode; + private string $name; + private int $mode; /** * @var mixed[]|bool|float|int|string|null */ @@ -42,10 +36,7 @@ class InputArgument * @var mixed[]|\Closure */ private $suggestedValues; - /** - * @var string - */ - private $description; + private string $description; /** * @param string $name The argument name * @param int|null $mode The argument mode: a bit mask of self::REQUIRED, self::OPTIONAL and self::IS_ARRAY diff --git a/vendor/symfony/console/Input/InputDefinition.php b/vendor/symfony/console/Input/InputDefinition.php index f4ffc3b7b25..b47ecb4f46e 100644 --- a/vendor/symfony/console/Input/InputDefinition.php +++ b/vendor/symfony/console/Input/InputDefinition.php @@ -26,34 +26,13 @@ use RectorPrefix202411\Symfony\Component\Console\Exception\LogicException; */ class InputDefinition { - /** - * @var mixed[] - */ - private $arguments = []; - /** - * @var int - */ - private $requiredCount = 0; - /** - * @var \Symfony\Component\Console\Input\InputArgument|null - */ - private $lastArrayArgument; - /** - * @var \Symfony\Component\Console\Input\InputArgument|null - */ - private $lastOptionalArgument; - /** - * @var mixed[] - */ - private $options = []; - /** - * @var mixed[] - */ - private $negations = []; - /** - * @var mixed[] - */ - private $shortcuts = []; + private array $arguments = []; + private int $requiredCount = 0; + private ?InputArgument $lastArrayArgument = null; + private ?InputArgument $lastOptionalArgument = null; + private array $options = []; + private array $negations = []; + private array $shortcuts = []; /** * @param array $definition An array of InputArgument and InputOption instance */ diff --git a/vendor/symfony/console/Input/InputOption.php b/vendor/symfony/console/Input/InputOption.php index d35c4da56d7..5b600c2420d 100644 --- a/vendor/symfony/console/Input/InputOption.php +++ b/vendor/symfony/console/Input/InputOption.php @@ -43,18 +43,12 @@ class InputOption * The option may have either positive or negative value (e.g. --ansi or --no-ansi). */ public const VALUE_NEGATABLE = 16; - /** - * @var string - */ - private $name; + private string $name; /** * @var mixed[]|string|null */ private $shortcut; - /** - * @var int - */ - private $mode; + private int $mode; /** * @var mixed[]|bool|float|int|string|null */ @@ -63,10 +57,7 @@ class InputOption * @var mixed[]|\Closure */ private $suggestedValues; - /** - * @var string - */ - private $description; + private string $description; /** * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts * @param int|null $mode The option mode: One of the VALUE_* constants diff --git a/vendor/symfony/console/Logger/ConsoleLogger.php b/vendor/symfony/console/Logger/ConsoleLogger.php index 06eaaf90853..883f3111c8f 100644 --- a/vendor/symfony/console/Logger/ConsoleLogger.php +++ b/vendor/symfony/console/Logger/ConsoleLogger.php @@ -26,22 +26,10 @@ class ConsoleLogger extends AbstractLogger { public const INFO = 'info'; public const ERROR = 'error'; - /** - * @var \Symfony\Component\Console\Output\OutputInterface - */ - private $output; - /** - * @var mixed[] - */ - private $verbosityLevelMap = [LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL, LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL, LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL, LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL, LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL, LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE, LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE, LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG]; - /** - * @var mixed[] - */ - private $formatLevelMap = [LogLevel::EMERGENCY => self::ERROR, LogLevel::ALERT => self::ERROR, LogLevel::CRITICAL => self::ERROR, LogLevel::ERROR => self::ERROR, LogLevel::WARNING => self::INFO, LogLevel::NOTICE => self::INFO, LogLevel::INFO => self::INFO, LogLevel::DEBUG => self::INFO]; - /** - * @var bool - */ - private $errored = \false; + private OutputInterface $output; + private array $verbosityLevelMap = [LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL, LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL, LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL, LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL, LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL, LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE, LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE, LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG]; + private array $formatLevelMap = [LogLevel::EMERGENCY => self::ERROR, LogLevel::ALERT => self::ERROR, LogLevel::CRITICAL => self::ERROR, LogLevel::ERROR => self::ERROR, LogLevel::WARNING => self::INFO, LogLevel::NOTICE => self::INFO, LogLevel::INFO => self::INFO, LogLevel::DEBUG => self::INFO]; + private bool $errored = \false; public function __construct(OutputInterface $output, array $verbosityLevelMap = [], array $formatLevelMap = []) { $this->output = $output; diff --git a/vendor/symfony/console/Messenger/RunCommandContext.php b/vendor/symfony/console/Messenger/RunCommandContext.php index 45f6da0aa70..e785a3c076a 100644 --- a/vendor/symfony/console/Messenger/RunCommandContext.php +++ b/vendor/symfony/console/Messenger/RunCommandContext.php @@ -17,19 +17,16 @@ final class RunCommandContext { /** * @readonly - * @var \Symfony\Component\Console\Messenger\RunCommandMessage */ - public $message; + public RunCommandMessage $message; /** * @readonly - * @var int */ - public $exitCode; + public int $exitCode; /** * @readonly - * @var string */ - public $output; + public string $output; public function __construct(RunCommandMessage $message, int $exitCode, string $output) { $this->message = $message; diff --git a/vendor/symfony/console/Messenger/RunCommandMessage.php b/vendor/symfony/console/Messenger/RunCommandMessage.php index 2599610068c..a84334ea0fa 100644 --- a/vendor/symfony/console/Messenger/RunCommandMessage.php +++ b/vendor/symfony/console/Messenger/RunCommandMessage.php @@ -18,19 +18,18 @@ class RunCommandMessage { /** * @readonly - * @var string */ - public $input; + public string $input; /** * @var bool * @readonly */ - public $throwOnFailure = \true; + public bool $throwOnFailure = \true; /** * @var bool * @readonly */ - public $catchExceptions = \false; + public bool $catchExceptions = \false; /** * @param bool $throwOnFailure If the command has a non-zero exit code, throw {@see RunCommandFailedException} * @param bool $catchExceptions @see Application::setCatchExceptions() diff --git a/vendor/symfony/console/Messenger/RunCommandMessageHandler.php b/vendor/symfony/console/Messenger/RunCommandMessageHandler.php index b3cc1d46260..b1fdb41c602 100644 --- a/vendor/symfony/console/Messenger/RunCommandMessageHandler.php +++ b/vendor/symfony/console/Messenger/RunCommandMessageHandler.php @@ -22,9 +22,8 @@ final class RunCommandMessageHandler { /** * @readonly - * @var \Symfony\Component\Console\Application */ - private $application; + private Application $application; public function __construct(Application $application) { $this->application = $application; diff --git a/vendor/symfony/console/Output/BufferedOutput.php b/vendor/symfony/console/Output/BufferedOutput.php index 64980ffbbb8..fa2ea8992c6 100644 --- a/vendor/symfony/console/Output/BufferedOutput.php +++ b/vendor/symfony/console/Output/BufferedOutput.php @@ -15,10 +15,7 @@ namespace RectorPrefix202411\Symfony\Component\Console\Output; */ class BufferedOutput extends Output { - /** - * @var string - */ - private $buffer = ''; + private string $buffer = ''; /** * Empties buffer and returns its content. */ diff --git a/vendor/symfony/console/Output/ConsoleOutput.php b/vendor/symfony/console/Output/ConsoleOutput.php index a8ca03c0a76..555df62ba67 100644 --- a/vendor/symfony/console/Output/ConsoleOutput.php +++ b/vendor/symfony/console/Output/ConsoleOutput.php @@ -27,14 +27,8 @@ use RectorPrefix202411\Symfony\Component\Console\Formatter\OutputFormatterInterf */ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface { - /** - * @var \Symfony\Component\Console\Output\OutputInterface - */ - private $stderr; - /** - * @var mixed[] - */ - private $consoleSectionOutputs = []; + private OutputInterface $stderr; + private array $consoleSectionOutputs = []; /** * @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) * @param bool|null $decorated Whether to decorate messages (null for auto-guessing) diff --git a/vendor/symfony/console/Output/ConsoleSectionOutput.php b/vendor/symfony/console/Output/ConsoleSectionOutput.php index ae18ee0b1ec..c27e2ebd973 100644 --- a/vendor/symfony/console/Output/ConsoleSectionOutput.php +++ b/vendor/symfony/console/Output/ConsoleSectionOutput.php @@ -19,26 +19,11 @@ use RectorPrefix202411\Symfony\Component\Console\Terminal; */ class ConsoleSectionOutput extends StreamOutput { - /** - * @var mixed[] - */ - private $content = []; - /** - * @var int - */ - private $lines = 0; - /** - * @var mixed[] - */ - private $sections; - /** - * @var \Symfony\Component\Console\Terminal - */ - private $terminal; - /** - * @var int - */ - private $maxHeight = 0; + private array $content = []; + private int $lines = 0; + private array $sections; + private Terminal $terminal; + private int $maxHeight = 0; /** * @param resource $stream * @param ConsoleSectionOutput[] $sections diff --git a/vendor/symfony/console/Output/NullOutput.php b/vendor/symfony/console/Output/NullOutput.php index 1d848d65532..98dd8c3c271 100644 --- a/vendor/symfony/console/Output/NullOutput.php +++ b/vendor/symfony/console/Output/NullOutput.php @@ -22,10 +22,7 @@ use RectorPrefix202411\Symfony\Component\Console\Formatter\OutputFormatterInterf */ class NullOutput implements OutputInterface { - /** - * @var \Symfony\Component\Console\Formatter\NullOutputFormatter - */ - private $formatter; + private NullOutputFormatter $formatter; /** * @return void */ @@ -36,7 +33,7 @@ class NullOutput implements OutputInterface public function getFormatter() : OutputFormatterInterface { // to comply with the interface we must return a OutputFormatterInterface - return $this->formatter = $this->formatter ?? new NullOutputFormatter(); + return $this->formatter ??= new NullOutputFormatter(); } /** * @return void diff --git a/vendor/symfony/console/Output/Output.php b/vendor/symfony/console/Output/Output.php index c2d3a0a4e72..438fbfc1f97 100644 --- a/vendor/symfony/console/Output/Output.php +++ b/vendor/symfony/console/Output/Output.php @@ -27,14 +27,8 @@ use RectorPrefix202411\Symfony\Component\Console\Formatter\OutputFormatterInterf */ abstract class Output implements OutputInterface { - /** - * @var int - */ - private $verbosity; - /** - * @var \Symfony\Component\Console\Formatter\OutputFormatterInterface - */ - private $formatter; + private int $verbosity; + private OutputFormatterInterface $formatter; /** * @param int|null $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) * @param bool $decorated Whether to decorate messages diff --git a/vendor/symfony/console/Output/StreamOutput.php b/vendor/symfony/console/Output/StreamOutput.php index ea3cf26ce2c..a9e493cb569 100644 --- a/vendor/symfony/console/Output/StreamOutput.php +++ b/vendor/symfony/console/Output/StreamOutput.php @@ -43,7 +43,7 @@ class StreamOutput extends Output throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.'); } $this->stream = $stream; - $decorated = $decorated ?? $this->hasColorSupport(); + $decorated ??= $this->hasColorSupport(); parent::__construct($verbosity, $decorated, $formatter); } /** diff --git a/vendor/symfony/console/Output/TrimmedBufferOutput.php b/vendor/symfony/console/Output/TrimmedBufferOutput.php index 5571338ab3a..478959e4dfe 100644 --- a/vendor/symfony/console/Output/TrimmedBufferOutput.php +++ b/vendor/symfony/console/Output/TrimmedBufferOutput.php @@ -19,14 +19,8 @@ use RectorPrefix202411\Symfony\Component\Console\Formatter\OutputFormatterInterf */ class TrimmedBufferOutput extends Output { - /** - * @var int - */ - private $maxLength; - /** - * @var string - */ - private $buffer = ''; + private int $maxLength; + private string $buffer = ''; public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = \false, ?OutputFormatterInterface $formatter = null) { if ($maxLength <= 0) { diff --git a/vendor/symfony/console/Question/ChoiceQuestion.php b/vendor/symfony/console/Question/ChoiceQuestion.php index 2071649b3f0..c62f0907bd3 100644 --- a/vendor/symfony/console/Question/ChoiceQuestion.php +++ b/vendor/symfony/console/Question/ChoiceQuestion.php @@ -18,22 +18,10 @@ use RectorPrefix202411\Symfony\Component\Console\Exception\InvalidArgumentExcept */ class ChoiceQuestion extends Question { - /** - * @var mixed[] - */ - private $choices; - /** - * @var bool - */ - private $multiselect = \false; - /** - * @var string - */ - private $prompt = ' > '; - /** - * @var string - */ - private $errorMessage = 'Value "%s" is invalid'; + private array $choices; + private bool $multiselect = \false; + private string $prompt = ' > '; + private string $errorMessage = 'Value "%s" is invalid'; /** * @param string $question The question to ask to the user * @param array $choices The list of available choices diff --git a/vendor/symfony/console/Question/ConfirmationQuestion.php b/vendor/symfony/console/Question/ConfirmationQuestion.php index a18ee56862f..9ede400f3bb 100644 --- a/vendor/symfony/console/Question/ConfirmationQuestion.php +++ b/vendor/symfony/console/Question/ConfirmationQuestion.php @@ -17,10 +17,7 @@ namespace RectorPrefix202411\Symfony\Component\Console\Question; */ class ConfirmationQuestion extends Question { - /** - * @var string - */ - private $trueAnswerRegex; + private string $trueAnswerRegex; /** * @param string $question The question to ask to the user * @param bool $default The default answer to return, true or false diff --git a/vendor/symfony/console/Question/Question.php b/vendor/symfony/console/Question/Question.php index 67a55c24e57..203eec5eb2e 100644 --- a/vendor/symfony/console/Question/Question.php +++ b/vendor/symfony/console/Question/Question.php @@ -19,46 +19,19 @@ use RectorPrefix202411\Symfony\Component\Console\Exception\LogicException; */ class Question { - /** - * @var string - */ - private $question; - /** - * @var int|null - */ - private $attempts; - /** - * @var bool - */ - private $hidden = \false; - /** - * @var bool - */ - private $hiddenFallback = \true; - /** - * @var \Closure|null - */ - private $autocompleterCallback; - /** - * @var \Closure|null - */ - private $validator; + private string $question; + private ?int $attempts = null; + private bool $hidden = \false; + private bool $hiddenFallback = \true; + private ?\Closure $autocompleterCallback = null; + private ?\Closure $validator = null; /** * @var bool|float|int|string|null */ private $default; - /** - * @var \Closure|null - */ - private $normalizer; - /** - * @var bool - */ - private $trimmable = \true; - /** - * @var bool - */ - private $multiline = \false; + private ?\Closure $normalizer = null; + private bool $trimmable = \true; + private bool $multiline = \false; /** * @param string $question The question to ask to the user * @param string|bool|int|float|null $default The default answer to return if the user enters nothing @@ -158,13 +131,11 @@ class Question { if (\is_array($values)) { $values = $this->isAssoc($values) ? \array_merge(\array_keys($values), \array_values($values)) : \array_values($values); - $callback = static function () use($values) { - return $values; - }; + $callback = static fn() => $values; } elseif ($values instanceof \Traversable) { $callback = static function () use($values) { static $valueCache; - return $valueCache = $valueCache ?? \iterator_to_array($values, \false); + return $valueCache ??= \iterator_to_array($values, \false); }; } else { $callback = null; diff --git a/vendor/symfony/console/SignalRegistry/SignalMap.php b/vendor/symfony/console/SignalRegistry/SignalMap.php index 925aa5a4e18..a6a9d9c6ef9 100644 --- a/vendor/symfony/console/SignalRegistry/SignalMap.php +++ b/vendor/symfony/console/SignalRegistry/SignalMap.php @@ -15,10 +15,7 @@ namespace RectorPrefix202411\Symfony\Component\Console\SignalRegistry; */ class SignalMap { - /** - * @var mixed[] - */ - private static $map; + private static array $map; public static function getSignalName(int $signal) : ?string { if (!\extension_loaded('pcntl')) { @@ -27,9 +24,7 @@ class SignalMap if (!isset(self::$map)) { $r = new \ReflectionExtension('pcntl'); $c = $r->getConstants(); - $map = \array_filter($c, function ($k) { - return \strncmp($k, 'SIG', \strlen('SIG')) === 0 && \strncmp($k, 'SIG_', \strlen('SIG_')) !== 0; - }, \ARRAY_FILTER_USE_KEY); + $map = \array_filter($c, fn($k) => \strncmp($k, 'SIG', \strlen('SIG')) === 0 && \strncmp($k, 'SIG_', \strlen('SIG_')) !== 0, \ARRAY_FILTER_USE_KEY); self::$map = \array_flip($map); } return self::$map[$signal] ?? null; diff --git a/vendor/symfony/console/SignalRegistry/SignalRegistry.php b/vendor/symfony/console/SignalRegistry/SignalRegistry.php index dfb4a1e1d36..fa4b1024e9b 100644 --- a/vendor/symfony/console/SignalRegistry/SignalRegistry.php +++ b/vendor/symfony/console/SignalRegistry/SignalRegistry.php @@ -12,10 +12,7 @@ namespace RectorPrefix202411\Symfony\Component\Console\SignalRegistry; final class SignalRegistry { - /** - * @var mixed[] - */ - private $signalHandlers = []; + private array $signalHandlers = []; public function __construct() { if (\function_exists('pcntl_async_signals')) { diff --git a/vendor/symfony/console/SingleCommandApplication.php b/vendor/symfony/console/SingleCommandApplication.php index ee2b7bf8953..bb00a9bffad 100644 --- a/vendor/symfony/console/SingleCommandApplication.php +++ b/vendor/symfony/console/SingleCommandApplication.php @@ -18,18 +18,9 @@ use RectorPrefix202411\Symfony\Component\Console\Output\OutputInterface; */ class SingleCommandApplication extends Command { - /** - * @var string - */ - private $version = 'UNKNOWN'; - /** - * @var bool - */ - private $autoExit = \true; - /** - * @var bool - */ - private $running = \false; + private string $version = 'UNKNOWN'; + private bool $autoExit = \true; + private bool $running = \false; /** * @return $this */ diff --git a/vendor/symfony/console/Style/OutputStyle.php b/vendor/symfony/console/Style/OutputStyle.php index 62add6fffa4..dbe594a3079 100644 --- a/vendor/symfony/console/Style/OutputStyle.php +++ b/vendor/symfony/console/Style/OutputStyle.php @@ -21,10 +21,7 @@ use RectorPrefix202411\Symfony\Component\Console\Output\OutputInterface; */ abstract class OutputStyle implements OutputInterface, StyleInterface { - /** - * @var \Symfony\Component\Console\Output\OutputInterface - */ - private $output; + private OutputInterface $output; public function __construct(OutputInterface $output) { $this->output = $output; diff --git a/vendor/symfony/console/Style/SymfonyStyle.php b/vendor/symfony/console/Style/SymfonyStyle.php index 03e77ca3efb..1bd6144afcb 100644 --- a/vendor/symfony/console/Style/SymfonyStyle.php +++ b/vendor/symfony/console/Style/SymfonyStyle.php @@ -37,30 +37,12 @@ use RectorPrefix202411\Symfony\Component\Console\Terminal; class SymfonyStyle extends OutputStyle { public const MAX_LINE_LENGTH = 120; - /** - * @var \Symfony\Component\Console\Input\InputInterface - */ - private $input; - /** - * @var \Symfony\Component\Console\Output\OutputInterface - */ - private $output; - /** - * @var \Symfony\Component\Console\Helper\SymfonyQuestionHelper - */ - private $questionHelper; - /** - * @var \Symfony\Component\Console\Helper\ProgressBar - */ - private $progressBar; - /** - * @var int - */ - private $lineLength; - /** - * @var \Symfony\Component\Console\Output\TrimmedBufferOutput - */ - private $bufferedOutput; + private InputInterface $input; + private OutputInterface $output; + private SymfonyQuestionHelper $questionHelper; + private ProgressBar $progressBar; + private int $lineLength; + private TrimmedBufferOutput $bufferedOutput; public function __construct(InputInterface $input, OutputInterface $output) { $this->input = $input; @@ -107,9 +89,7 @@ class SymfonyStyle extends OutputStyle public function listing(array $elements) { $this->autoPrependText(); - $elements = \array_map(function ($element) { - return \sprintf(' * %s', $element); - }, $elements); + $elements = \array_map(fn($element) => \sprintf(' * %s', $element), $elements); $this->writeln($elements); $this->newLine(); } @@ -334,7 +314,7 @@ class SymfonyStyle extends OutputStyle if ($this->input->isInteractive()) { $this->autoPrependBlock(); } - $this->questionHelper = $this->questionHelper ?? new SymfonyQuestionHelper(); + $this->questionHelper ??= new SymfonyQuestionHelper(); $answer = $this->questionHelper->ask($this->input, $this, $question); if ($this->input->isInteractive()) { if ($this->output instanceof ConsoleSectionOutput) { diff --git a/vendor/symfony/console/Terminal.php b/vendor/symfony/console/Terminal.php index c9a521f3f2c..464282814e3 100644 --- a/vendor/symfony/console/Terminal.php +++ b/vendor/symfony/console/Terminal.php @@ -14,22 +14,10 @@ use RectorPrefix202411\Symfony\Component\Console\Output\AnsiColorMode; class Terminal { public const DEFAULT_COLOR_MODE = AnsiColorMode::Ansi4; - /** - * @var \Symfony\Component\Console\Output\AnsiColorMode|null - */ - private static $colorMode; - /** - * @var int|null - */ - private static $width; - /** - * @var int|null - */ - private static $height; - /** - * @var bool|null - */ - private static $stty; + private static ?AnsiColorMode $colorMode = null; + private static ?int $width = null; + private static ?int $height = null; + private static ?bool $stty = null; /** * About Ansi color types: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors * For more information about true color support with terminals https://github.com/termstandard/colors/. @@ -193,7 +181,7 @@ class Terminal } $descriptorspec = [1 => ['pipe', 'w'], 2 => ['pipe', 'w']]; $cp = \function_exists('sapi_windows_cp_set') ? \sapi_windows_cp_get() : 0; - if (!($process = @\proc_open(\is_array($command) ? \implode(' ', \array_map('escapeshellarg', $command)) : $command, $descriptorspec, $pipes, null, null, ['suppress_errors' => \true]))) { + if (!($process = @\proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => \true]))) { return null; } $info = \stream_get_contents($pipes[1]); diff --git a/vendor/symfony/filesystem/Exception/IOException.php b/vendor/symfony/filesystem/Exception/IOException.php index cbef82c8ad5..f86aa4c8bf8 100644 --- a/vendor/symfony/filesystem/Exception/IOException.php +++ b/vendor/symfony/filesystem/Exception/IOException.php @@ -19,10 +19,7 @@ namespace RectorPrefix202411\Symfony\Component\Filesystem\Exception; */ class IOException extends \RuntimeException implements IOExceptionInterface { - /** - * @var string|null - */ - private $path; + private ?string $path; public function __construct(string $message, int $code = 0, ?\Throwable $previous = null, ?string $path = null) { $this->path = $path; diff --git a/vendor/symfony/filesystem/Filesystem.php b/vendor/symfony/filesystem/Filesystem.php index 056647442ad..04999732df7 100644 --- a/vendor/symfony/filesystem/Filesystem.php +++ b/vendor/symfony/filesystem/Filesystem.php @@ -20,10 +20,7 @@ use RectorPrefix202411\Symfony\Component\Filesystem\Exception\IOException; */ class Filesystem { - /** - * @var string|null - */ - private static $lastError; + private static ?string $lastError = null; /** * Copies a file. * @@ -422,9 +419,7 @@ class Filesystem $endPath = \str_replace('\\', '/', $endPath); $startPath = \str_replace('\\', '/', $startPath); } - $splitDriveLetter = function ($path) { - return \strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && \ctype_alpha($path[0]) ? [\substr($path, 2), \strtoupper($path[0])] : [$path, null]; - }; + $splitDriveLetter = fn($path) => \strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && \ctype_alpha($path[0]) ? [\substr($path, 2), \strtoupper($path[0])] : [$path, null]; $splitPath = function ($path) { $result = []; foreach (\explode('/', \trim($path, '/')) as $segment) { diff --git a/vendor/symfony/filesystem/Path.php b/vendor/symfony/filesystem/Path.php index 9137dc9ea5e..bfc3d623b01 100644 --- a/vendor/symfony/filesystem/Path.php +++ b/vendor/symfony/filesystem/Path.php @@ -38,11 +38,8 @@ final class Path * * @var array */ - private static $buffer = []; - /** - * @var int - */ - private static $bufferSize = 0; + private static array $buffer = []; + private static int $bufferSize = 0; /** * Canonicalizes the given path. * diff --git a/vendor/symfony/finder/Comparator/Comparator.php b/vendor/symfony/finder/Comparator/Comparator.php index 7d5dee03f15..df3dd3dbf2b 100644 --- a/vendor/symfony/finder/Comparator/Comparator.php +++ b/vendor/symfony/finder/Comparator/Comparator.php @@ -15,14 +15,8 @@ namespace RectorPrefix202411\Symfony\Component\Finder\Comparator; */ class Comparator { - /** - * @var string - */ - private $target; - /** - * @var string - */ - private $operator; + private string $target; + private string $operator; public function __construct(string $target, string $operator = '==') { if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) { diff --git a/vendor/symfony/finder/Finder.php b/vendor/symfony/finder/Finder.php index 93626dca6ba..7b3cf6e5cd1 100644 --- a/vendor/symfony/finder/Finder.php +++ b/vendor/symfony/finder/Finder.php @@ -42,90 +42,30 @@ class Finder implements \IteratorAggregate, \Countable public const IGNORE_VCS_FILES = 1; public const IGNORE_DOT_FILES = 2; public const IGNORE_VCS_IGNORED_FILES = 4; - /** - * @var int - */ - private $mode = 0; - /** - * @var mixed[] - */ - private $names = []; - /** - * @var mixed[] - */ - private $notNames = []; - /** - * @var mixed[] - */ - private $exclude = []; - /** - * @var mixed[] - */ - private $filters = []; - /** - * @var mixed[] - */ - private $pruneFilters = []; - /** - * @var mixed[] - */ - private $depths = []; - /** - * @var mixed[] - */ - private $sizes = []; - /** - * @var bool - */ - private $followLinks = \false; - /** - * @var bool - */ - private $reverseSorting = \false; + private int $mode = 0; + private array $names = []; + private array $notNames = []; + private array $exclude = []; + private array $filters = []; + private array $pruneFilters = []; + private array $depths = []; + private array $sizes = []; + private bool $followLinks = \false; + private bool $reverseSorting = \false; /** * @var \Closure|int|false */ private $sort = \false; - /** - * @var int - */ - private $ignore = 0; - /** - * @var mixed[] - */ - private $dirs = []; - /** - * @var mixed[] - */ - private $dates = []; - /** - * @var mixed[] - */ - private $iterators = []; - /** - * @var mixed[] - */ - private $contains = []; - /** - * @var mixed[] - */ - private $notContains = []; - /** - * @var mixed[] - */ - private $paths = []; - /** - * @var mixed[] - */ - private $notPaths = []; - /** - * @var bool - */ - private $ignoreUnreadableDirs = \false; - /** - * @var mixed[] - */ - private static $vcsPatterns = ['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg']; + private int $ignore = 0; + private array $dirs = []; + private array $dates = []; + private array $iterators = []; + private array $contains = []; + private array $notContains = []; + private array $paths = []; + private array $notPaths = []; + private bool $ignoreUnreadableDirs = \false; + private static array $vcsPatterns = ['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg']; public function __construct() { $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES; @@ -672,9 +612,7 @@ class Finder implements \IteratorAggregate, \Countable } $iterator = new \AppendIterator(); foreach ($this->dirs as $dir) { - $iterator->append(new \IteratorIterator(new LazyIterator(function () use($dir) { - return $this->searchInDirectory($dir); - }))); + $iterator->append(new \IteratorIterator(new LazyIterator(fn() => $this->searchInDirectory($dir)))); } foreach ($this->iterators as $it) { $iterator->append($it); diff --git a/vendor/symfony/finder/Gitignore.php b/vendor/symfony/finder/Gitignore.php index e0a633171eb..272e6348194 100644 --- a/vendor/symfony/finder/Gitignore.php +++ b/vendor/symfony/finder/Gitignore.php @@ -70,9 +70,7 @@ class Gitignore $isAbsolute = \false; } $regex = \preg_quote(\str_replace('\\', '', $gitignoreLine), '~'); - $regex = \preg_replace_callback('~\\\\\\[((?:\\\\!)?)([^\\[\\]]*)\\\\\\]~', function (array $matches) : string { - return '[' . ('' !== $matches[1] ? '^' : '') . \str_replace('\\-', '-', $matches[2]) . ']'; - }, $regex); + $regex = \preg_replace_callback('~\\\\\\[((?:\\\\!)?)([^\\[\\]]*)\\\\\\]~', fn(array $matches): string => '[' . ('' !== $matches[1] ? '^' : '') . \str_replace('\\-', '-', $matches[2]) . ']', $regex); $regex = \preg_replace('~(?:(?:\\\\\\*){2,}(/?))+~', '(?:(?:(?!//).(? $iterator The Iterator to filter * @param callable[] $filters An array of PHP callbacks diff --git a/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php b/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php index ca117157d9b..92fb0bf72ef 100644 --- a/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php +++ b/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php @@ -20,10 +20,7 @@ use RectorPrefix202411\Symfony\Component\Finder\Comparator\DateComparator; */ class DateRangeFilterIterator extends \FilterIterator { - /** - * @var mixed[] - */ - private $comparators = []; + private array $comparators = []; /** * @param \Iterator $iterator * @param DateComparator[] $comparators diff --git a/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php b/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php index d1a6caae0dc..db2fb718bf7 100644 --- a/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php +++ b/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php @@ -22,10 +22,7 @@ namespace RectorPrefix202411\Symfony\Component\Finder\Iterator; */ class DepthRangeFilterIterator extends \FilterIterator { - /** - * @var int - */ - private $minDepth = 0; + private int $minDepth = 0; /** * @param \RecursiveIteratorIterator<\RecursiveIterator> $iterator The Iterator to filter * @param int $minDepth The min depth diff --git a/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php b/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php index 08adee9af01..3175d4640fe 100644 --- a/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php +++ b/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php @@ -23,19 +23,13 @@ use RectorPrefix202411\Symfony\Component\Finder\SplFileInfo; class ExcludeDirectoryFilterIterator extends \FilterIterator implements \RecursiveIterator { /** @var \Iterator */ - private $iterator; - /** - * @var bool - */ - private $isRecursive; + private \Iterator $iterator; + private bool $isRecursive; /** @var array */ - private $excludedDirs = []; - /** - * @var string|null - */ - private $excludedPattern; + private array $excludedDirs = []; + private ?string $excludedPattern = null; /** @var list */ - private $pruneFilters = []; + private array $pruneFilters = []; /** * @param \Iterator $iterator The Iterator to filter * @param list $directories An array of directories to exclude diff --git a/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php b/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php index 414bc1c321c..75da7fa13f8 100644 --- a/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php +++ b/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php @@ -21,10 +21,7 @@ class FileTypeFilterIterator extends \FilterIterator { public const ONLY_FILES = 1; public const ONLY_DIRECTORIES = 2; - /** - * @var int - */ - private $mode; + private int $mode; /** * @param \Iterator $iterator The Iterator to filter * @param int $mode The mode (self::ONLY_FILES or self::ONLY_DIRECTORIES) diff --git a/vendor/symfony/finder/Iterator/LazyIterator.php b/vendor/symfony/finder/Iterator/LazyIterator.php index 60fd7949253..49ff28d7749 100644 --- a/vendor/symfony/finder/Iterator/LazyIterator.php +++ b/vendor/symfony/finder/Iterator/LazyIterator.php @@ -17,10 +17,7 @@ namespace RectorPrefix202411\Symfony\Component\Finder\Iterator; */ class LazyIterator implements \IteratorAggregate { - /** - * @var \Closure - */ - private $iteratorFactory; + private \Closure $iteratorFactory; public function __construct(callable $iteratorFactory) { $this->iteratorFactory = \Closure::fromCallable($iteratorFactory); diff --git a/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php b/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php index d510527bb6f..0afdc2113d3 100644 --- a/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php +++ b/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php @@ -21,27 +21,12 @@ use RectorPrefix202411\Symfony\Component\Finder\SplFileInfo; */ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator { - /** - * @var bool - */ - private $ignoreUnreadableDirs; - /** - * @var bool - */ - private $ignoreFirstRewind = \true; + private bool $ignoreUnreadableDirs; + private bool $ignoreFirstRewind = \true; // these 3 properties take part of the performance optimization to avoid redoing the same work in all iterations - /** - * @var string - */ - private $rootPath; - /** - * @var string - */ - private $subPath; - /** - * @var string - */ - private $directorySeparator = '/'; + private string $rootPath; + private string $subPath; + private string $directorySeparator = '/'; /** * @throws \RuntimeException */ diff --git a/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php b/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php index 628ddd14105..fd1ce6051df 100644 --- a/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php +++ b/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php @@ -20,10 +20,7 @@ use RectorPrefix202411\Symfony\Component\Finder\Comparator\NumberComparator; */ class SizeRangeFilterIterator extends \FilterIterator { - /** - * @var mixed[] - */ - private $comparators = []; + private array $comparators = []; /** * @param \Iterator $iterator * @param NumberComparator[] $comparators diff --git a/vendor/symfony/finder/Iterator/SortableIterator.php b/vendor/symfony/finder/Iterator/SortableIterator.php index fc3cb50b3b5..5ffeede5b8f 100644 --- a/vendor/symfony/finder/Iterator/SortableIterator.php +++ b/vendor/symfony/finder/Iterator/SortableIterator.php @@ -31,7 +31,7 @@ class SortableIterator implements \IteratorAggregate public const SORT_BY_EXTENSION = 9; public const SORT_BY_SIZE = 10; /** @var \Traversable */ - private $iterator; + private \Traversable $iterator; /** * @var \Closure|int */ @@ -47,21 +47,13 @@ class SortableIterator implements \IteratorAggregate $this->iterator = $iterator; $order = $reverseOrder ? -1 : 1; if (self::SORT_BY_NAME === $sort) { - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use($order) { - return $order * \strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname()); - }; + $this->sort = static fn(\SplFileInfo $a, \SplFileInfo $b) => $order * \strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname()); } elseif (self::SORT_BY_NAME_NATURAL === $sort) { - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use($order) { - return $order * \strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname()); - }; + $this->sort = static fn(\SplFileInfo $a, \SplFileInfo $b) => $order * \strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname()); } elseif (self::SORT_BY_NAME_CASE_INSENSITIVE === $sort) { - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use($order) { - return $order * \strcasecmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname()); - }; + $this->sort = static fn(\SplFileInfo $a, \SplFileInfo $b) => $order * \strcasecmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname()); } elseif (self::SORT_BY_NAME_NATURAL_CASE_INSENSITIVE === $sort) { - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use($order) { - return $order * \strnatcasecmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname()); - }; + $this->sort = static fn(\SplFileInfo $a, \SplFileInfo $b) => $order * \strnatcasecmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname()); } elseif (self::SORT_BY_TYPE === $sort) { $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use($order) { if ($a->isDir() && $b->isFile()) { @@ -72,31 +64,19 @@ class SortableIterator implements \IteratorAggregate return $order * \strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname()); }; } elseif (self::SORT_BY_ACCESSED_TIME === $sort) { - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use($order) { - return $order * ($a->getATime() - $b->getATime()); - }; + $this->sort = static fn(\SplFileInfo $a, \SplFileInfo $b) => $order * ($a->getATime() - $b->getATime()); } elseif (self::SORT_BY_CHANGED_TIME === $sort) { - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use($order) { - return $order * ($a->getCTime() - $b->getCTime()); - }; + $this->sort = static fn(\SplFileInfo $a, \SplFileInfo $b) => $order * ($a->getCTime() - $b->getCTime()); } elseif (self::SORT_BY_MODIFIED_TIME === $sort) { - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use($order) { - return $order * ($a->getMTime() - $b->getMTime()); - }; + $this->sort = static fn(\SplFileInfo $a, \SplFileInfo $b) => $order * ($a->getMTime() - $b->getMTime()); } elseif (self::SORT_BY_EXTENSION === $sort) { - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use($order) { - return $order * \strnatcmp($a->getExtension(), $b->getExtension()); - }; + $this->sort = static fn(\SplFileInfo $a, \SplFileInfo $b) => $order * \strnatcmp($a->getExtension(), $b->getExtension()); } elseif (self::SORT_BY_SIZE === $sort) { - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use($order) { - return $order * ($a->getSize() - $b->getSize()); - }; + $this->sort = static fn(\SplFileInfo $a, \SplFileInfo $b) => $order * ($a->getSize() - $b->getSize()); } elseif (self::SORT_BY_NONE === $sort) { $this->sort = $order; } elseif (\is_callable($sort)) { - $this->sort = $reverseOrder ? static function (\SplFileInfo $a, \SplFileInfo $b) use($sort) { - return -$sort($a, $b); - } : \Closure::fromCallable($sort); + $this->sort = $reverseOrder ? static fn(\SplFileInfo $a, \SplFileInfo $b) => -$sort($a, $b) : \Closure::fromCallable($sort); } else { throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.'); } diff --git a/vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.php b/vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.php index 8dbddf3c2a3..aa8c4fa1c45 100644 --- a/vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.php +++ b/vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.php @@ -16,18 +16,15 @@ use RectorPrefix202411\Symfony\Component\Finder\Gitignore; */ final class VcsIgnoredFilterIterator extends \FilterIterator { - /** - * @var string - */ - private $baseDir; + private string $baseDir; /** * @var array */ - private $gitignoreFilesCache = []; + private array $gitignoreFilesCache = []; /** * @var array */ - private $ignoredPathsCache = []; + private array $ignoredPathsCache = []; /** * @param \Iterator $iterator */ @@ -96,9 +93,7 @@ final class VcsIgnoredFilterIterator extends \FilterIterator } private function parentDirectoriesUpTo(string $from, string $upTo) : array { - return \array_filter($this->parentDirectoriesUpwards($from), static function (string $directory) use($upTo) : bool { - return \strncmp($directory, $upTo, \strlen($upTo)) === 0; - }); + return \array_filter($this->parentDirectoriesUpwards($from), static fn(string $directory): bool => \strncmp($directory, $upTo, \strlen($upTo)) === 0); } /** * @return list diff --git a/vendor/symfony/finder/SplFileInfo.php b/vendor/symfony/finder/SplFileInfo.php index ccf4f71b85d..42b060b6903 100644 --- a/vendor/symfony/finder/SplFileInfo.php +++ b/vendor/symfony/finder/SplFileInfo.php @@ -17,14 +17,8 @@ namespace RectorPrefix202411\Symfony\Component\Finder; */ class SplFileInfo extends \SplFileInfo { - /** - * @var string - */ - private $relativePath; - /** - * @var string - */ - private $relativePathname; + private string $relativePath; + private string $relativePathname; /** * @param string $file The file name * @param string $relativePath The relative path diff --git a/vendor/symfony/polyfill-mbstring/bootstrap80.php b/vendor/symfony/polyfill-mbstring/bootstrap80.php index 9226d5df561..cb5bf62e09d 100644 --- a/vendor/symfony/polyfill-mbstring/bootstrap80.php +++ b/vendor/symfony/polyfill-mbstring/bootstrap80.php @@ -193,7 +193,7 @@ if (!function_exists('mb_chr')) { function mb_chr(?int $codepoint, ?string $encoding = null) { return p\Mbstring::mb_chr((int) $codepoint, $encoding); } } if (!function_exists('mb_scrub')) { - function mb_scrub(?string $string, ?string $encoding = null): string { $encoding = $encoding ?? mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); } + function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); } } if (!function_exists('mb_str_split')) { function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); } diff --git a/vendor/symfony/process/Exception/ProcessFailedException.php b/vendor/symfony/process/Exception/ProcessFailedException.php index 371d572d812..83783684028 100644 --- a/vendor/symfony/process/Exception/ProcessFailedException.php +++ b/vendor/symfony/process/Exception/ProcessFailedException.php @@ -18,10 +18,7 @@ use RectorPrefix202411\Symfony\Component\Process\Process; */ class ProcessFailedException extends RuntimeException { - /** - * @var \Symfony\Component\Process\Process - */ - private $process; + private Process $process; public function __construct(Process $process) { if ($process->isSuccessful()) { diff --git a/vendor/symfony/process/Exception/ProcessSignaledException.php b/vendor/symfony/process/Exception/ProcessSignaledException.php index 7f68d1de158..9fd20a99a7e 100644 --- a/vendor/symfony/process/Exception/ProcessSignaledException.php +++ b/vendor/symfony/process/Exception/ProcessSignaledException.php @@ -18,10 +18,7 @@ use RectorPrefix202411\Symfony\Component\Process\Process; */ final class ProcessSignaledException extends RuntimeException { - /** - * @var \Symfony\Component\Process\Process - */ - private $process; + private Process $process; public function __construct(Process $process) { $this->process = $process; diff --git a/vendor/symfony/process/Exception/ProcessTimedOutException.php b/vendor/symfony/process/Exception/ProcessTimedOutException.php index 68cd6195aaf..17ce8875c93 100644 --- a/vendor/symfony/process/Exception/ProcessTimedOutException.php +++ b/vendor/symfony/process/Exception/ProcessTimedOutException.php @@ -20,14 +20,8 @@ class ProcessTimedOutException extends RuntimeException { public const TYPE_GENERAL = 1; public const TYPE_IDLE = 2; - /** - * @var \Symfony\Component\Process\Process - */ - private $process; - /** - * @var int - */ - private $timeoutType; + private Process $process; + private int $timeoutType; public function __construct(Process $process, int $timeoutType) { $this->process = $process; diff --git a/vendor/symfony/process/Exception/RunProcessFailedException.php b/vendor/symfony/process/Exception/RunProcessFailedException.php index 8c82d1cb47a..6e0f7dc5213 100644 --- a/vendor/symfony/process/Exception/RunProcessFailedException.php +++ b/vendor/symfony/process/Exception/RunProcessFailedException.php @@ -18,9 +18,8 @@ final class RunProcessFailedException extends RuntimeException { /** * @readonly - * @var \Symfony\Component\Process\Messenger\RunProcessContext */ - public $context; + public RunProcessContext $context; public function __construct(ProcessFailedException $exception, RunProcessContext $context) { $this->context = $context; diff --git a/vendor/symfony/process/ExecutableFinder.php b/vendor/symfony/process/ExecutableFinder.php index a074fa54e62..6db95b68eb4 100644 --- a/vendor/symfony/process/ExecutableFinder.php +++ b/vendor/symfony/process/ExecutableFinder.php @@ -19,10 +19,7 @@ namespace RectorPrefix202411\Symfony\Component\Process; class ExecutableFinder { private const CMD_BUILTINS = ['assoc', 'break', 'call', 'cd', 'chdir', 'cls', 'color', 'copy', 'date', 'del', 'dir', 'echo', 'endlocal', 'erase', 'exit', 'for', 'ftype', 'goto', 'help', 'if', 'label', 'md', 'mkdir', 'mklink', 'move', 'path', 'pause', 'popd', 'prompt', 'pushd', 'rd', 'rem', 'ren', 'rename', 'rmdir', 'set', 'setlocal', 'shift', 'start', 'time', 'title', 'type', 'ver', 'vol']; - /** - * @var mixed[] - */ - private $suffixes = []; + private array $suffixes = []; /** * Replaces default suffixes of executable. * diff --git a/vendor/symfony/process/InputStream.php b/vendor/symfony/process/InputStream.php index 83951fbb3da..76c6ebdd491 100644 --- a/vendor/symfony/process/InputStream.php +++ b/vendor/symfony/process/InputStream.php @@ -20,18 +20,9 @@ use RectorPrefix202411\Symfony\Component\Process\Exception\RuntimeException; */ class InputStream implements \IteratorAggregate { - /** - * @var \Closure|null - */ - private $onEmpty; - /** - * @var mixed[] - */ - private $input = []; - /** - * @var bool - */ - private $open = \true; + private ?\Closure $onEmpty = null; + private array $input = []; + private bool $open = \true; /** * Sets a callback that is called when the write buffer becomes empty. * diff --git a/vendor/symfony/process/Messenger/RunProcessContext.php b/vendor/symfony/process/Messenger/RunProcessContext.php index c54489e7890..ca9b9b6e159 100644 --- a/vendor/symfony/process/Messenger/RunProcessContext.php +++ b/vendor/symfony/process/Messenger/RunProcessContext.php @@ -18,24 +18,20 @@ final class RunProcessContext { /** * @readonly - * @var \Symfony\Component\Process\Messenger\RunProcessMessage */ - public $message; + public RunProcessMessage $message; /** * @readonly - * @var int|null */ - public $exitCode; + public ?int $exitCode; /** * @readonly - * @var string|null */ - public $output; + public ?string $output; /** * @readonly - * @var string|null */ - public $errorOutput; + public ?string $errorOutput; public function __construct(RunProcessMessage $message, Process $process) { $this->message = $message; diff --git a/vendor/symfony/process/Messenger/RunProcessMessage.php b/vendor/symfony/process/Messenger/RunProcessMessage.php index aaa15957e31..82ea9d8b7f0 100644 --- a/vendor/symfony/process/Messenger/RunProcessMessage.php +++ b/vendor/symfony/process/Messenger/RunProcessMessage.php @@ -17,19 +17,16 @@ class RunProcessMessage { /** * @readonly - * @var mixed[] */ - public $command; + public array $command; /** * @readonly - * @var string|null */ - public $cwd; + public ?string $cwd = null; /** * @readonly - * @var mixed[]|null */ - public $env; + public ?array $env = null; /** * @readonly * @var mixed @@ -37,9 +34,8 @@ class RunProcessMessage public $input = null; /** * @readonly - * @var float|null */ - public $timeout = 60.0; + public ?float $timeout = 60.0; /** * @param mixed $input */ diff --git a/vendor/symfony/process/PhpExecutableFinder.php b/vendor/symfony/process/PhpExecutableFinder.php index 0625c35a535..45c8afd6308 100644 --- a/vendor/symfony/process/PhpExecutableFinder.php +++ b/vendor/symfony/process/PhpExecutableFinder.php @@ -18,10 +18,7 @@ namespace RectorPrefix202411\Symfony\Component\Process; */ class PhpExecutableFinder { - /** - * @var \Symfony\Component\Process\ExecutableFinder - */ - private $executableFinder; + private ExecutableFinder $executableFinder; public function __construct() { $this->executableFinder = new ExecutableFinder(); diff --git a/vendor/symfony/process/Pipes/AbstractPipes.php b/vendor/symfony/process/Pipes/AbstractPipes.php index d9fc28c3881..6fa0656518e 100644 --- a/vendor/symfony/process/Pipes/AbstractPipes.php +++ b/vendor/symfony/process/Pipes/AbstractPipes.php @@ -18,24 +18,12 @@ use RectorPrefix202411\Symfony\Component\Process\Exception\InvalidArgumentExcept */ abstract class AbstractPipes implements PipesInterface { - /** - * @var mixed[] - */ - public $pipes = []; - /** - * @var string - */ - private $inputBuffer = ''; + public array $pipes = []; + private string $inputBuffer = ''; /** @var resource|string|\Iterator */ private $input; - /** - * @var bool - */ - private $blocked = \true; - /** - * @var string|null - */ - private $lastError; + private bool $blocked = \true; + private ?string $lastError = null; /** * @param resource|string|\Iterator $input */ diff --git a/vendor/symfony/process/Pipes/UnixPipes.php b/vendor/symfony/process/Pipes/UnixPipes.php index 9ff4c4f8da7..7d169f12108 100644 --- a/vendor/symfony/process/Pipes/UnixPipes.php +++ b/vendor/symfony/process/Pipes/UnixPipes.php @@ -20,18 +20,9 @@ use RectorPrefix202411\Symfony\Component\Process\Process; */ class UnixPipes extends AbstractPipes { - /** - * @var bool|null - */ - private $ttyMode; - /** - * @var bool - */ - private $ptyMode; - /** - * @var bool - */ - private $haveReadSupport; + private ?bool $ttyMode; + private bool $ptyMode; + private bool $haveReadSupport; /** * @param mixed $input */ diff --git a/vendor/symfony/process/Pipes/WindowsPipes.php b/vendor/symfony/process/Pipes/WindowsPipes.php index 3d0566fe4bf..6f5d05d9f89 100644 --- a/vendor/symfony/process/Pipes/WindowsPipes.php +++ b/vendor/symfony/process/Pipes/WindowsPipes.php @@ -24,26 +24,11 @@ use RectorPrefix202411\Symfony\Component\Process\Process; */ class WindowsPipes extends AbstractPipes { - /** - * @var mixed[] - */ - private $files = []; - /** - * @var mixed[] - */ - private $fileHandles = []; - /** - * @var mixed[] - */ - private $lockHandles = []; - /** - * @var mixed[] - */ - private $readBytes = [Process::STDOUT => 0, Process::STDERR => 0]; - /** - * @var bool - */ - private $haveReadSupport; + private array $files = []; + private array $fileHandles = []; + private array $lockHandles = []; + private array $readBytes = [Process::STDOUT => 0, Process::STDERR => 0]; + private bool $haveReadSupport; /** * @param mixed $input */ diff --git a/vendor/symfony/process/Process.php b/vendor/symfony/process/Process.php index 22a4eafcf0b..b460ab22c37 100644 --- a/vendor/symfony/process/Process.php +++ b/vendor/symfony/process/Process.php @@ -47,102 +47,42 @@ class Process implements \IteratorAggregate // Use this flag to skip STDOUT while iterating public const ITER_SKIP_ERR = 8; // Use this flag to skip STDERR while iterating - /** - * @var \Closure|null - */ - private $callback; + private ?\Closure $callback = null; /** * @var mixed[]|string */ private $commandline; - /** - * @var string|null - */ - private $cwd; - /** - * @var mixed[] - */ - private $env = []; + private ?string $cwd; + private array $env = []; /** @var resource|string|\Iterator|null */ private $input; - /** - * @var float|null - */ - private $starttime; - /** - * @var float|null - */ - private $lastOutputTime; - /** - * @var float|null - */ - private $timeout; - /** - * @var float|null - */ - private $idleTimeout; - /** - * @var int|null - */ - private $exitcode; - /** - * @var mixed[] - */ - private $fallbackStatus = []; - /** - * @var mixed[] - */ - private $processInformation; - /** - * @var bool - */ - private $outputDisabled = \false; + private ?float $starttime = null; + private ?float $lastOutputTime = null; + private ?float $timeout = null; + private ?float $idleTimeout = null; + private ?int $exitcode = null; + private array $fallbackStatus = []; + private array $processInformation; + private bool $outputDisabled = \false; /** @var resource */ private $stdout; /** @var resource */ private $stderr; /** @var resource|null */ private $process; - /** - * @var string - */ - private $status = self::STATUS_READY; - /** - * @var int - */ - private $incrementalOutputOffset = 0; - /** - * @var int - */ - private $incrementalErrorOutputOffset = 0; - /** - * @var bool - */ - private $tty = \false; - /** - * @var bool - */ - private $pty; - /** - * @var mixed[] - */ - private $options = ['suppress_errors' => \true, 'bypass_shell' => \true]; + private string $status = self::STATUS_READY; + private int $incrementalOutputOffset = 0; + private int $incrementalErrorOutputOffset = 0; + private bool $tty = \false; + private bool $pty; + private array $options = ['suppress_errors' => \true, 'bypass_shell' => \true]; /** * @var \Symfony\Component\Process\Pipes\WindowsPipes|\Symfony\Component\Process\Pipes\UnixPipes */ private $processPipes; - /** - * @var int|null - */ - private $latestSignal; - /** - * @var int|null - */ - private $cachedExitCode; - /** - * @var bool|null - */ - private static $sigchild; + private ?int $latestSignal = null; + private ?int $cachedExitCode = null; + private static ?bool $sigchild = null; /** * Exit codes translation table. * @@ -1117,7 +1057,7 @@ class Process implements \IteratorAggregate public static function isTtySupported() : bool { static $isTtySupported; - return $isTtySupported = $isTtySupported ?? '/' === \DIRECTORY_SEPARATOR && \stream_isatty(\STDOUT) && @\is_writable('/dev/tty'); + return $isTtySupported ??= '/' === \DIRECTORY_SEPARATOR && \stream_isatty(\STDOUT) && @\is_writable('/dev/tty'); } /** * Returns whether PTY is supported on the current operating system. @@ -1159,9 +1099,7 @@ class Process implements \IteratorAggregate protected function buildCallback(?callable $callback = null) : \Closure { if ($this->outputDisabled) { - return function ($type, $data) use($callback) : bool { - return null !== $callback && $callback($type, $data); - }; + return fn($type, $data): bool => null !== $callback && $callback($type, $data); } $out = self::OUT; return function ($type, $data) use($callback, $out) : bool { diff --git a/vendor/symfony/service-contracts/Attribute/SubscribedService.php b/vendor/symfony/service-contracts/Attribute/SubscribedService.php index a5796b42441..e241c5e9396 100644 --- a/vendor/symfony/service-contracts/Attribute/SubscribedService.php +++ b/vendor/symfony/service-contracts/Attribute/SubscribedService.php @@ -28,17 +28,17 @@ final class SubscribedService /** * @var string|null */ - public $key; + public ?string $key = null; /** * @var class-string|null */ - public $type; + public ?string $type = null; /** * @var bool */ - public $nullable = \false; + public bool $nullable = \false; /** @var object[] */ - public $attributes; + public array $attributes; /** * @param string|null $key The key to use for the service * @param class-string|null $type The service class diff --git a/vendor/symfony/service-contracts/ServiceLocatorTrait.php b/vendor/symfony/service-contracts/ServiceLocatorTrait.php index e8a14656675..d56c526127b 100644 --- a/vendor/symfony/service-contracts/ServiceLocatorTrait.php +++ b/vendor/symfony/service-contracts/ServiceLocatorTrait.php @@ -23,18 +23,9 @@ use RectorPrefix202411\Psr\Container\NotFoundExceptionInterface; */ trait ServiceLocatorTrait { - /** - * @var mixed[] - */ - private $factories; - /** - * @var mixed[] - */ - private $loading = []; - /** - * @var mixed[] - */ - private $providedTypes; + private array $factories; + private array $loading = []; + private array $providedTypes; /** * @param array $factories */ diff --git a/vendor/symfony/service-contracts/ServiceMethodsSubscriberTrait.php b/vendor/symfony/service-contracts/ServiceMethodsSubscriberTrait.php index e6c615a0990..7f5dd4dbc49 100644 --- a/vendor/symfony/service-contracts/ServiceMethodsSubscriberTrait.php +++ b/vendor/symfony/service-contracts/ServiceMethodsSubscriberTrait.php @@ -24,10 +24,7 @@ use RectorPrefix202411\Symfony\Contracts\Service\Attribute\SubscribedService; */ trait ServiceMethodsSubscriberTrait { - /** - * @var \Psr\Container\ContainerInterface - */ - protected $container; + protected ContainerInterface $container; public static function getSubscribedServices() : array { $services = \method_exists(\get_parent_class(self::class) ?: '', __FUNCTION__) ? parent::getSubscribedServices() : []; @@ -46,8 +43,8 @@ trait ServiceMethodsSubscriberTrait } /* @var SubscribedService $attribute */ $attribute = $attribute->newInstance(); - $attribute->key = $attribute->key ?? self::class . '::' . $method->name; - $attribute->type = $attribute->type ?? ($returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType); + $attribute->key ??= self::class . '::' . $method->name; + $attribute->type ??= $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType; $attribute->nullable = $returnType->allowsNull(); if ($attribute->attributes) { $services[] = $attribute; diff --git a/vendor/symfony/service-contracts/ServiceSubscriberTrait.php b/vendor/symfony/service-contracts/ServiceSubscriberTrait.php index 78d6aff1a66..8e24c656498 100644 --- a/vendor/symfony/service-contracts/ServiceSubscriberTrait.php +++ b/vendor/symfony/service-contracts/ServiceSubscriberTrait.php @@ -47,8 +47,8 @@ trait ServiceSubscriberTrait } /* @var SubscribedService $attribute */ $attribute = $attribute->newInstance(); - $attribute->key = $attribute->key ?? self::class . '::' . $method->name; - $attribute->type = $attribute->type ?? ($returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType); + $attribute->key ??= self::class . '::' . $method->name; + $attribute->type ??= $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType; $attribute->nullable = $returnType->allowsNull(); if ($attribute->attributes) { $services[] = $attribute; diff --git a/vendor/symfony/yaml/Command/LintCommand.php b/vendor/symfony/yaml/Command/LintCommand.php index da674576029..1dfac560e8a 100644 --- a/vendor/symfony/yaml/Command/LintCommand.php +++ b/vendor/symfony/yaml/Command/LintCommand.php @@ -33,26 +33,11 @@ use RectorPrefix202411\Symfony\Component\Yaml\Yaml; */ class LintCommand extends Command { - /** - * @var \Symfony\Component\Yaml\Parser - */ - private $parser; - /** - * @var string|null - */ - private $format; - /** - * @var bool - */ - private $displayCorrectFiles; - /** - * @var \Closure|null - */ - private $directoryIteratorProvider; - /** - * @var \Closure|null - */ - private $isReadableProvider; + private Parser $parser; + private ?string $format = null; + private bool $displayCorrectFiles; + private ?\Closure $directoryIteratorProvider; + private ?\Closure $isReadableProvider; public function __construct(?string $name = null, ?callable $directoryIteratorProvider = null, ?callable $isReadableProvider = null) { parent::__construct($name); @@ -207,13 +192,11 @@ EOF } private function getParser() : Parser { - return $this->parser = $this->parser ?? new Parser(); + return $this->parser ??= new Parser(); } private function getDirectoryIterator(string $directory) : iterable { - $default = function ($directory) { - return new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), \RecursiveIteratorIterator::LEAVES_ONLY); - }; + $default = fn($directory) => new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), \RecursiveIteratorIterator::LEAVES_ONLY); if (null !== $this->directoryIteratorProvider) { return ($this->directoryIteratorProvider)($directory, $default); } diff --git a/vendor/symfony/yaml/Dumper.php b/vendor/symfony/yaml/Dumper.php index 0218d2bd86c..09814437f56 100644 --- a/vendor/symfony/yaml/Dumper.php +++ b/vendor/symfony/yaml/Dumper.php @@ -22,9 +22,8 @@ class Dumper { /** * The amount of spaces to use for indentation of nested nodes. - * @var int */ - private $indentation; + private int $indentation; public function __construct(int $indentation = 4) { if ($indentation < 1) { diff --git a/vendor/symfony/yaml/Exception/ParseException.php b/vendor/symfony/yaml/Exception/ParseException.php index 0eee01968c9..a11c92ad90e 100644 --- a/vendor/symfony/yaml/Exception/ParseException.php +++ b/vendor/symfony/yaml/Exception/ParseException.php @@ -20,19 +20,19 @@ class ParseException extends RuntimeException /** * @var string */ - private $rawMessage; + private string $rawMessage; /** * @var int */ - private $parsedLine = -1; + private int $parsedLine = -1; /** * @var string|null */ - private $snippet; + private ?string $snippet = null; /** * @var string|null */ - private $parsedFile; + private ?string $parsedFile = null; /** * @param string $rawMessage The error message * @param int $parsedLine The line where the error occurred diff --git a/vendor/symfony/yaml/Inline.php b/vendor/symfony/yaml/Inline.php index 42bbe0236bf..a7cf60a4eb7 100644 --- a/vendor/symfony/yaml/Inline.php +++ b/vendor/symfony/yaml/Inline.php @@ -23,30 +23,12 @@ use RectorPrefix202411\Symfony\Component\Yaml\Tag\TaggedValue; class Inline { public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*+(?:\\\\.[^"\\\\]*+)*+)"|\'([^\']*+(?:\'\'[^\']*+)*+)\')'; - /** - * @var int - */ - public static $parsedLineNumber = -1; - /** - * @var string|null - */ - public static $parsedFilename; - /** - * @var bool - */ - private static $exceptionOnInvalidType = \false; - /** - * @var bool - */ - private static $objectSupport = \false; - /** - * @var bool - */ - private static $objectForMap = \false; - /** - * @var bool - */ - private static $constantSupport = \false; + public static int $parsedLineNumber = -1; + public static ?string $parsedFilename = null; + private static bool $exceptionOnInvalidType = \false; + private static bool $objectSupport = \false; + private static bool $objectForMap = \false; + private static bool $constantSupport = \false; public static function initialize(int $flags, ?int $parsedLineNumber = null, ?string $parsedFilename = null) : void { self::$exceptionOnInvalidType = (bool) (Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE & $flags); diff --git a/vendor/symfony/yaml/Parser.php b/vendor/symfony/yaml/Parser.php index b66602a402c..1ce01473bd7 100644 --- a/vendor/symfony/yaml/Parser.php +++ b/vendor/symfony/yaml/Parser.php @@ -24,50 +24,17 @@ class Parser public const TAG_PATTERN = '(?P![\\w!.\\/:-]+)'; public const BLOCK_SCALAR_HEADER_PATTERN = '(?P\\||>)(?P\\+|\\-|\\d+|\\+\\d+|\\-\\d+|\\d+\\+|\\d+\\-)?(?P +#.*)?'; public const REFERENCE_PATTERN = '#^&(?P[^ ]++) *+(?P.*)#u'; - /** - * @var string|null - */ - private $filename; - /** - * @var int - */ - private $offset = 0; - /** - * @var int - */ - private $numberOfParsedLines = 0; - /** - * @var int|null - */ - private $totalNumberOfLines; - /** - * @var mixed[] - */ - private $lines = []; - /** - * @var int - */ - private $currentLineNb = -1; - /** - * @var string - */ - private $currentLine = ''; - /** - * @var mixed[] - */ - private $refs = []; - /** - * @var mixed[] - */ - private $skippedLineNumbers = []; - /** - * @var mixed[] - */ - private $locallySkippedLineNumbers = []; - /** - * @var mixed[] - */ - private $refsBeingParsed = []; + private ?string $filename = null; + private int $offset = 0; + private int $numberOfParsedLines = 0; + private ?int $totalNumberOfLines = null; + private array $lines = []; + private int $currentLineNb = -1; + private string $currentLine = ''; + private array $refs = []; + private array $skippedLineNumbers = []; + private array $locallySkippedLineNumbers = []; + private array $refsBeingParsed = []; /** * Parses a YAML file into a PHP value. * @@ -133,7 +100,7 @@ class Parser $this->lines = \explode("\n", $value); $this->numberOfParsedLines = \count($this->lines); $this->locallySkippedLineNumbers = []; - $this->totalNumberOfLines = $this->totalNumberOfLines ?? $this->numberOfParsedLines; + $this->totalNumberOfLines ??= $this->numberOfParsedLines; if (!$this->moveToNextLine()) { return null; } diff --git a/vendor/symfony/yaml/Tag/TaggedValue.php b/vendor/symfony/yaml/Tag/TaggedValue.php index 5a71453968e..790df9e995b 100644 --- a/vendor/symfony/yaml/Tag/TaggedValue.php +++ b/vendor/symfony/yaml/Tag/TaggedValue.php @@ -16,10 +16,7 @@ namespace RectorPrefix202411\Symfony\Component\Yaml\Tag; */ final class TaggedValue { - /** - * @var string - */ - private $tag; + private string $tag; /** * @var mixed */ diff --git a/vendor/symfony/yaml/Unescaper.php b/vendor/symfony/yaml/Unescaper.php index 5bf1ac14cb0..a189fa7f942 100644 --- a/vendor/symfony/yaml/Unescaper.php +++ b/vendor/symfony/yaml/Unescaper.php @@ -41,9 +41,7 @@ class Unescaper */ public function unescapeDoubleQuotedString(string $value) : string { - $callback = function ($match) { - return $this->unescapeCharacter($match[0]); - }; + $callback = fn($match) => $this->unescapeCharacter($match[0]); // evaluate the string return \preg_replace_callback('/' . self::REGEX_ESCAPED_CHARACTER . '/u', $callback, $value); } diff --git a/vendor/symplify/easy-parallel/src/CommandLine/WorkerCommandLineFactory.php b/vendor/symplify/easy-parallel/src/CommandLine/WorkerCommandLineFactory.php index 8efa442e1c0..61985c86656 100644 --- a/vendor/symplify/easy-parallel/src/CommandLine/WorkerCommandLineFactory.php +++ b/vendor/symplify/easy-parallel/src/CommandLine/WorkerCommandLineFactory.php @@ -25,9 +25,8 @@ final class WorkerCommandLineFactory private const EXCLUDED_OPTION_NAMES = ['output-format']; /** * @readonly - * @var \Symplify\EasyParallel\Reflection\CommandFromReflectionFactory */ - private $commandFromReflectionFactory; + private CommandFromReflectionFactory $commandFromReflectionFactory; public function __construct() { $this->commandFromReflectionFactory = new CommandFromReflectionFactory(); diff --git a/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php b/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php index 1e48a00c7ce..51a8fc935ea 100644 --- a/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php +++ b/vendor/symplify/easy-parallel/src/ValueObject/ParallelProcess.php @@ -24,27 +24,18 @@ final class ParallelProcess { /** * @readonly - * @var string */ - private $command; + private string $command; /** * @readonly - * @var \React\EventLoop\LoopInterface */ - private $loop; + private LoopInterface $loop; /** * @readonly - * @var int */ - private $timetoutInSeconds; - /** - * @var \React\ChildProcess\Process - */ - private $process; - /** - * @var \Clue\React\NDJson\Encoder - */ - private $encoder; + private int $timetoutInSeconds; + private Process $process; + private Encoder $encoder; /** * @var resource|null */ @@ -57,10 +48,7 @@ final class ParallelProcess * @var callable(Throwable): void */ private $onError; - /** - * @var \React\EventLoop\TimerInterface|null - */ - private $timer; + private ?TimerInterface $timer = null; public function __construct(string $command, LoopInterface $loop, int $timetoutInSeconds) { $this->command = $command; diff --git a/vendor/symplify/easy-parallel/src/ValueObject/ProcessPool.php b/vendor/symplify/easy-parallel/src/ValueObject/ProcessPool.php index 50e48250b6e..343edea1855 100644 --- a/vendor/symplify/easy-parallel/src/ValueObject/ProcessPool.php +++ b/vendor/symplify/easy-parallel/src/ValueObject/ProcessPool.php @@ -14,13 +14,12 @@ final class ProcessPool { /** * @readonly - * @var \React\Socket\TcpServer */ - private $tcpServer; + private TcpServer $tcpServer; /** * @var array */ - private $processes = []; + private array $processes = []; public function __construct(TcpServer $tcpServer) { $this->tcpServer = $tcpServer; diff --git a/vendor/symplify/easy-parallel/src/ValueObject/Schedule.php b/vendor/symplify/easy-parallel/src/ValueObject/Schedule.php index c5f8c962664..391237e6e5c 100644 --- a/vendor/symplify/easy-parallel/src/ValueObject/Schedule.php +++ b/vendor/symplify/easy-parallel/src/ValueObject/Schedule.php @@ -13,14 +13,13 @@ final class Schedule { /** * @readonly - * @var int */ - private $numberOfProcesses; + private int $numberOfProcesses; /** * @var array> * @readonly */ - private $jobs; + private array $jobs; /** * @param array> $jobs */ diff --git a/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/AbstractCodeSample.php b/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/AbstractCodeSample.php index 9652d163607..5b8c5090950 100644 --- a/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/AbstractCodeSample.php +++ b/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/AbstractCodeSample.php @@ -11,12 +11,12 @@ abstract class AbstractCodeSample implements CodeSampleInterface * @var non-empty-string * @readonly */ - private $goodCode; + private string $goodCode; /** * @var non-empty-string * @readonly */ - private $badCode; + private string $badCode; public function __construct(string $badCode, string $goodCode) { $badCode = \trim($badCode); diff --git a/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/CodeSample/ComposerJsonAwareCodeSample.php b/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/CodeSample/ComposerJsonAwareCodeSample.php index 465805f52c4..71503ca1d5a 100644 --- a/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/CodeSample/ComposerJsonAwareCodeSample.php +++ b/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/CodeSample/ComposerJsonAwareCodeSample.php @@ -8,9 +8,8 @@ final class ComposerJsonAwareCodeSample extends AbstractCodeSample { /** * @readonly - * @var string */ - private $composerJson; + private string $composerJson; public function __construct(string $badCode, string $goodCode, string $composerJson) { $this->composerJson = $composerJson; diff --git a/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/CodeSample/ConfiguredCodeSample.php b/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/CodeSample/ConfiguredCodeSample.php index f5c92f0efbe..9a18d8a9566 100644 --- a/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/CodeSample/ConfiguredCodeSample.php +++ b/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/CodeSample/ConfiguredCodeSample.php @@ -11,7 +11,7 @@ final class ConfiguredCodeSample extends AbstractCodeSample implements CodeSampl /** * @var mixed[] */ - private $configuration = []; + private array $configuration = []; /** * @param mixed[] $configuration */ diff --git a/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/CodeSample/ExtraFileCodeSample.php b/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/CodeSample/ExtraFileCodeSample.php index 51728aab8c2..94743084fdd 100644 --- a/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/CodeSample/ExtraFileCodeSample.php +++ b/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/CodeSample/ExtraFileCodeSample.php @@ -8,9 +8,8 @@ final class ExtraFileCodeSample extends AbstractCodeSample { /** * @readonly - * @var string */ - private $extraFile; + private string $extraFile; public function __construct(string $badCode, string $goodCode, string $extraFile) { $this->extraFile = $extraFile; diff --git a/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/RuleDefinition.php b/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/RuleDefinition.php index 5e76c95b197..a70ac25394d 100644 --- a/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/RuleDefinition.php +++ b/vendor/symplify/rule-doc-generator-contracts/src/ValueObject/RuleDefinition.php @@ -11,21 +11,14 @@ final class RuleDefinition { /** * @readonly - * @var string */ - private $description; - /** - * @var string|null - */ - private $ruleClass; - /** - * @var string|null - */ - private $ruleFilePath; + private string $description; + private ?string $ruleClass = null; + private ?string $ruleFilePath = null; /** * @var CodeSampleInterface[] */ - private $codeSamples = []; + private array $codeSamples = []; /** * @param CodeSampleInterface[] $codeSamples */