From ad83c89e467305084e0deb36b03a68db55655e60 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 27 May 2024 18:48:13 +0900 Subject: [PATCH] Move type-declaration-related rules to type-perfect package (#128) * remove NoArrayAccessOnObjectRule, moved to new rector/type-perfect package * remove NoIssetOnObjectRule, moved to new rector/type-perfect package * remove ForbiddenParamTypeRemovalRule, moved to new rector/type-perfect package * remove NoMixedMethodCallerRule, moved to new rector/type-perfect package * remove NoMixedPropertyFetcherRule, moved to new rector/type-perfect package * remove RequireSpecificReturnTypeOverAbstractRule, moved to new rector/type-perfect package * remove NoReturnFalseInNonBoolClassMethodRule, moved to new rector/type-perfect package * remove NarrowPublicClassMethodParamTypeByCallerTypeRule, moved to new rector/type-perfect package * remove unused services * remove CheckTypehintCallerTypeRule, moved to new rector/type-perfect package * sets --- README.md | 1 - config/code-complexity-rules.neon | 2 - config/collector-rules.neon | 18 -- config/naming-rules.neon | 1 - config/services/services.neon | 9 - config/static-rules.neon | 7 - config/symplify-rules.neon | 1 - phpstan.neon | 3 - .../PublicClassMethodParamTypesCollector.php | 71 ------ .../MethodCallArgTypesCollector.php | 59 ----- .../MethodCallableCollector.php | 58 ----- src/Enum/Types/ResolvedTypes.php | 13 -- .../ClassMethodCallReferenceResolver.php | 53 ----- .../Collector/PublicClassMethodMatcher.php | 78 ------- src/NodeFinder/ClassMethodNodeFinder.php | 52 ----- src/NodeFinder/MethodCallNodeFinder.php | 52 ----- src/NodeFinder/ReturnNodeFinder.php | 61 ----- src/PhpDoc/ApiDocStmtAnalyzer.php | 30 --- src/Printer/CollectorMetadataPrinter.php | 147 ------------ src/Printer/NodeComparator.php | 26 --- src/Reflection/MethodNodeAnalyser.php | 46 ---- src/Rules/CheckTypehintCallerTypeRule.php | 213 ------------------ .../Explicit/NoMixedMethodCallerRule.php | 81 ------- .../Explicit/NoMixedPropertyFetcherRule.php | 76 ------- ...uireSpecificReturnTypeOverAbstractRule.php | 165 -------------- src/Rules/ForbiddenParamTypeRemovalRule.php | 124 ---------- ...icClassMethodParamTypeByCallerTypeRule.php | 186 --------------- .../NoReturnFalseInNonBoolClassMethodRule.php | 126 ----------- src/Rules/NoArrayAccessOnObjectRule.php | 85 ------- src/Rules/NoIssetOnObjectRule.php | 127 ----------- src/ValueObject/MethodCallReference.php | 24 -- .../CheckTypehintCallerTypeRuleTest.php | 67 ------ .../DifferentClassSameMethodCallName.php | 31 --- .../Fixture/DoubleShot.php | 18 -- .../Fixture/Fixture.php | 22 -- .../Fixture/SkipAbstractBase.php | 16 -- .../Fixture/SkipAlreadyCorrectType.php | 22 -- .../Fixture/SkipCorrectUnionType.php | 32 --- ...pDuplicatedCallOfSameMethodWithComment.php | 26 --- .../Fixture/SkipGenericType.php | 31 --- .../Fixture/SkipMayOverrideArg.php | 27 --- .../Fixture/SkipMixed.php | 18 -- .../Fixture/SkipMultipleUsed.php | 27 --- .../Fixture/SkipNoArgs.php | 15 -- .../Fixture/SkipNotFromThis.php | 14 -- .../Fixture/SkipNotPrivate.php | 22 -- .../Fixture/SkipOptedOut.php | 23 -- .../Fixture/SkipParentNotIf.php | 15 -- .../Fixture/SkipRecursive.php | 30 --- .../Source/AnotherClassWithRun.php | 15 -- .../Source/ConceptBase.php | 10 - .../Source/ConceptImpl1.php | 9 - .../config/configured_rule.neon | 5 - .../Fixture/MagicMethodName.php | 13 -- .../Fixture/SkipKnownCallerType.php | 15 -- .../Fixture/SkipMockObject.php | 19 -- .../Fixture/UnknownCallerType.php | 13 -- .../NoMixedMethodCallerRuleTest.php | 48 ---- .../Source/KnownType.php | 12 - .../config/configured_rule.neon | 5 - .../Fixture/DynamicName.php | 15 -- .../Fixture/SkipDynamicNameWithKnownType.php | 15 -- .../Fixture/SkipKnownFetcherType.php | 15 -- .../Fixture/UnknownPropertyFetcher.php | 13 -- .../NoMixedPropertyFetcherRuleTest.php | 48 ---- .../Source/KnownType.php | 10 - .../config/configured_rule.neon | 5 - .../Fixture/SkipSomeContract.php | 17 -- .../Fixture/SkipSpecificReturnType.php | 15 -- .../Fixture/SomeAbstractReturnType.php | 16 -- ...SpecificReturnTypeOverAbstractRuleTest.php | 46 ---- .../Source/AbstractControl.php | 9 - .../Source/SomeContract.php | 12 - .../Source/SpecificControl.php | 11 - .../config/configured_rule.neon | 5 - .../Fixture/AnInterface.php | 10 - .../Fixture/AnInterfaceOther.php | 12 - ...sDifferentParameterWithInterfaceMethod.php | 16 -- .../HasDifferentParameterWithParentMethod.php | 12 - .../Fixture/ParentClass.php | 12 - .../Fixture/RemoveParentType.php | 14 -- ...kipHasSameParameterWithInterfaceMethod.php | 18 -- .../SkipHasSameParameterWithParentMethod.php | 12 - .../Fixture/SkipIndirectRemoval.php | 18 -- .../Fixture/SkipNoParent.php | 9 - .../Fixture/SkipNoType.php | 14 -- .../Fixture/SkipNotHasParentMethod.php | 12 - .../Fixture/SkipPhpDocType.php | 17 -- .../Fixture/SkipPresentType.php | 15 -- .../ForbiddenParamTypeRemovalRuleTest.php | 64 ------ .../Source/NoTypeInterface.php | 10 - .../Source/PhpDocType.php | 15 -- .../Source/SomeNode.php | 10 - .../Source/SomeRectorInterface.php | 10 - .../config/configured_rule.neon | 5 - .../FirstClassCallables/CallVariadics.php | 17 -- .../FirstClassCallables/SomeCalledMethod.php | 12 - .../Fixture/PublicDoubleShot.php | 12 - .../Fixture/SkipApiMarked.php | 17 -- .../Fixture/SkipClassStringPassed.php | 12 - .../Fixture/SkipEqualUnionType.php | 44 ---- .../Fixture/SkipExpectedClassType.php | 14 -- .../Fixture/SkipMixedAndString.php | 12 - .../Fixture/SkipNonPublicClassMethod.php | 17 -- .../Fixture/SkipNullableCompare.php | 14 -- .../Fixture/SkipProperlyFilledParamType.php | 12 - .../Fixture/SkipThisPassedExactType.php | 14 -- .../SkipUsedInternallyForSecondType.php | 20 -- .../Fixture/ThisPassedFromInterface.php | 14 -- ...assMethodParamTypeByCallerTypeRuleTest.php | 169 -------------- .../ExpectedClassString/FirstTypedCaller.php | 17 -- .../ExpectedClassString/SecondTypedCaller.php | 17 -- .../FirstClassTypedCaller.php | 17 -- .../SecondClassTypedCaller.php | 17 -- .../ExpectedNodeApi/CallWithProperty.php | 17 -- .../Source/ExpectedThisType/CallByThis.php | 15 -- .../CallByThisFromInterface.php | 16 -- .../Source/ExpectedType/FirstTypedCaller.php | 15 -- .../OnlyFirstTypeCalledOutside.php | 16 -- .../Source/ExpectedType/SecondTypedCaller.php | 15 -- .../ExpectedUnion/CallUnionArrayType.php | 31 --- .../Source/ExpectedUnion/CallUnionType.php | 22 -- .../ExpectedUnion/CallUnionTypeFlipped.php | 22 -- .../CallUnionTypeTernaryIfElse.php | 22 -- .../CallUnionTypeTernaryIfElseFlipped.php | 22 -- .../Source/FirstCaller.php | 15 -- .../Source/MixedAndString/FirstCaller.php | 15 -- .../Source/MixedAndString/SecondCaller.php | 15 -- .../Source/MixedAndString/ThirdCaller.php | 15 -- .../Source/NullableParam/FirstNullable.php | 16 -- .../Source/NullableParam/SecondNullable.php | 16 -- .../Source/PassMeAsType.php | 10 - .../Source/SecondCaller.php | 15 -- .../Source/SomeInterface.php | 8 - .../config/configured_rule.neon | 21 -- .../Fixture/ReturnFalseOnly.php | 17 -- .../Fixture/SkipReturnBool.php | 17 -- ...eturnFalseInNonBoolClassMethodRuleTest.php | 48 ---- .../config/configured_rule.neon | 2 - .../Fixture/ArrayAccessOnNestedObject.php | 16 -- .../Fixture/ArrayAccessOnObject.php | 16 -- .../Fixture/SkipIterator.php | 15 -- .../Fixture/SkipOnArray.php | 13 -- .../Fixture/SkipSplFixedArray.php | 15 -- .../Fixture/SkipXml.php | 15 -- .../Fixture/SkipXmlElementForeach.php | 17 -- .../NoArrayAccessOnObjectRuleTest.php | 48 ---- .../ChildOfSomeClassWithArrayAccess.php | 9 - .../Source/SomeClassWithArrayAccess.php | 26 --- .../Source/SomeClassWithSplFixedArray.php | 11 - .../config/configured_rule.neon | 5 - .../Fixture/IssetOnObject.php | 21 -- .../Fixture/SkipIssetOnArray.php | 15 -- .../SkipIssetOnArrayNestedOnObject.php | 17 -- .../NoIssetOnObjectRuleTest.php | 44 ---- .../config/configured_rule.neon | 5 - 156 files changed, 4391 deletions(-) delete mode 100644 config/collector-rules.neon delete mode 100644 src/Collector/ClassMethod/PublicClassMethodParamTypesCollector.php delete mode 100644 src/Collector/MethodCall/MethodCallArgTypesCollector.php delete mode 100644 src/Collector/MethodCallableNode/MethodCallableCollector.php delete mode 100644 src/Enum/Types/ResolvedTypes.php delete mode 100644 src/Matcher/ClassMethodCallReferenceResolver.php delete mode 100644 src/Matcher/Collector/PublicClassMethodMatcher.php delete mode 100644 src/NodeFinder/ClassMethodNodeFinder.php delete mode 100644 src/NodeFinder/MethodCallNodeFinder.php delete mode 100644 src/NodeFinder/ReturnNodeFinder.php delete mode 100644 src/PhpDoc/ApiDocStmtAnalyzer.php delete mode 100644 src/Printer/CollectorMetadataPrinter.php delete mode 100644 src/Printer/NodeComparator.php delete mode 100644 src/Reflection/MethodNodeAnalyser.php delete mode 100644 src/Rules/CheckTypehintCallerTypeRule.php delete mode 100644 src/Rules/Explicit/NoMixedMethodCallerRule.php delete mode 100644 src/Rules/Explicit/NoMixedPropertyFetcherRule.php delete mode 100644 src/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule.php delete mode 100644 src/Rules/ForbiddenParamTypeRemovalRule.php delete mode 100644 src/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule.php delete mode 100644 src/Rules/NarrowType/NoReturnFalseInNonBoolClassMethodRule.php delete mode 100644 src/Rules/NoArrayAccessOnObjectRule.php delete mode 100644 src/Rules/NoIssetOnObjectRule.php delete mode 100644 src/ValueObject/MethodCallReference.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/CheckTypehintCallerTypeRuleTest.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/DifferentClassSameMethodCallName.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/DoubleShot.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/Fixture.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipAbstractBase.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipAlreadyCorrectType.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipCorrectUnionType.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipDuplicatedCallOfSameMethodWithComment.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipGenericType.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipMayOverrideArg.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipMixed.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipMultipleUsed.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipNoArgs.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipNotFromThis.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipNotPrivate.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipOptedOut.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipParentNotIf.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipRecursive.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Source/AnotherClassWithRun.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Source/ConceptBase.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/Source/ConceptImpl1.php delete mode 100644 tests/Rules/CheckTypehintCallerTypeRule/config/configured_rule.neon delete mode 100644 tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/MagicMethodName.php delete mode 100644 tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/SkipKnownCallerType.php delete mode 100644 tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/SkipMockObject.php delete mode 100644 tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/UnknownCallerType.php delete mode 100644 tests/Rules/Explicit/NoMixedMethodCallerRule/NoMixedMethodCallerRuleTest.php delete mode 100644 tests/Rules/Explicit/NoMixedMethodCallerRule/Source/KnownType.php delete mode 100644 tests/Rules/Explicit/NoMixedMethodCallerRule/config/configured_rule.neon delete mode 100644 tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/DynamicName.php delete mode 100644 tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/SkipDynamicNameWithKnownType.php delete mode 100644 tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/SkipKnownFetcherType.php delete mode 100644 tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/UnknownPropertyFetcher.php delete mode 100644 tests/Rules/Explicit/NoMixedPropertyFetcherRule/NoMixedPropertyFetcherRuleTest.php delete mode 100644 tests/Rules/Explicit/NoMixedPropertyFetcherRule/Source/KnownType.php delete mode 100644 tests/Rules/Explicit/NoMixedPropertyFetcherRule/config/configured_rule.neon delete mode 100644 tests/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule/Fixture/SkipSomeContract.php delete mode 100644 tests/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule/Fixture/SkipSpecificReturnType.php delete mode 100644 tests/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule/Fixture/SomeAbstractReturnType.php delete mode 100644 tests/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule/RequireSpecificReturnTypeOverAbstractRuleTest.php delete mode 100644 tests/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule/Source/AbstractControl.php delete mode 100644 tests/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule/Source/SomeContract.php delete mode 100644 tests/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule/Source/SpecificControl.php delete mode 100644 tests/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule/config/configured_rule.neon delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/AnInterface.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/AnInterfaceOther.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/HasDifferentParameterWithInterfaceMethod.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/HasDifferentParameterWithParentMethod.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/ParentClass.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/RemoveParentType.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/SkipHasSameParameterWithInterfaceMethod.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/SkipHasSameParameterWithParentMethod.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/SkipIndirectRemoval.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/SkipNoParent.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/SkipNoType.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/SkipNotHasParentMethod.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/SkipPhpDocType.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Fixture/SkipPresentType.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/ForbiddenParamTypeRemovalRuleTest.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Source/NoTypeInterface.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Source/PhpDocType.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Source/SomeNode.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/Source/SomeRectorInterface.php delete mode 100644 tests/Rules/ForbiddenParamTypeRemovalRule/config/configured_rule.neon delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/FirstClassCallables/CallVariadics.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/FirstClassCallables/SomeCalledMethod.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/PublicDoubleShot.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipApiMarked.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipClassStringPassed.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipEqualUnionType.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipExpectedClassType.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipMixedAndString.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipNonPublicClassMethod.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipNullableCompare.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipProperlyFilledParamType.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipThisPassedExactType.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipUsedInternallyForSecondType.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/ThisPassedFromInterface.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/NarrowPublicClassMethodParamTypeByCallerTypeRuleTest.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassString/FirstTypedCaller.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassString/SecondTypedCaller.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassType/FirstClassTypedCaller.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassType/SecondClassTypedCaller.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedNodeApi/CallWithProperty.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedThisType/CallByThis.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedThisType/CallByThisFromInterface.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedType/FirstTypedCaller.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedType/OnlyFirstTypeCalledOutside.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedType/SecondTypedCaller.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionArrayType.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionType.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionTypeFlipped.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionTypeTernaryIfElse.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionTypeTernaryIfElseFlipped.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/FirstCaller.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/MixedAndString/FirstCaller.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/MixedAndString/SecondCaller.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/MixedAndString/ThirdCaller.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/NullableParam/FirstNullable.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/NullableParam/SecondNullable.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/PassMeAsType.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/SecondCaller.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/SomeInterface.php delete mode 100644 tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/config/configured_rule.neon delete mode 100644 tests/Rules/NarrowType/NoReturnFalseInNonBoolClassMethodRule/Fixture/ReturnFalseOnly.php delete mode 100644 tests/Rules/NarrowType/NoReturnFalseInNonBoolClassMethodRule/Fixture/SkipReturnBool.php delete mode 100644 tests/Rules/NarrowType/NoReturnFalseInNonBoolClassMethodRule/NoReturnFalseInNonBoolClassMethodRuleTest.php delete mode 100644 tests/Rules/NarrowType/NoReturnFalseInNonBoolClassMethodRule/config/configured_rule.neon delete mode 100644 tests/Rules/NoArrayAccessOnObjectRule/Fixture/ArrayAccessOnNestedObject.php delete mode 100644 tests/Rules/NoArrayAccessOnObjectRule/Fixture/ArrayAccessOnObject.php delete mode 100644 tests/Rules/NoArrayAccessOnObjectRule/Fixture/SkipIterator.php delete mode 100644 tests/Rules/NoArrayAccessOnObjectRule/Fixture/SkipOnArray.php delete mode 100644 tests/Rules/NoArrayAccessOnObjectRule/Fixture/SkipSplFixedArray.php delete mode 100644 tests/Rules/NoArrayAccessOnObjectRule/Fixture/SkipXml.php delete mode 100644 tests/Rules/NoArrayAccessOnObjectRule/Fixture/SkipXmlElementForeach.php delete mode 100644 tests/Rules/NoArrayAccessOnObjectRule/NoArrayAccessOnObjectRuleTest.php delete mode 100644 tests/Rules/NoArrayAccessOnObjectRule/Source/ChildOfSomeClassWithArrayAccess.php delete mode 100644 tests/Rules/NoArrayAccessOnObjectRule/Source/SomeClassWithArrayAccess.php delete mode 100644 tests/Rules/NoArrayAccessOnObjectRule/Source/SomeClassWithSplFixedArray.php delete mode 100644 tests/Rules/NoArrayAccessOnObjectRule/config/configured_rule.neon delete mode 100644 tests/Rules/NoIssetOnObjectRule/Fixture/IssetOnObject.php delete mode 100644 tests/Rules/NoIssetOnObjectRule/Fixture/SkipIssetOnArray.php delete mode 100644 tests/Rules/NoIssetOnObjectRule/Fixture/SkipIssetOnArrayNestedOnObject.php delete mode 100644 tests/Rules/NoIssetOnObjectRule/NoIssetOnObjectRuleTest.php delete mode 100644 tests/Rules/NoIssetOnObjectRule/config/configured_rule.neon diff --git a/README.md b/README.md index 310a1645..b82eb47d 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ Sets are bunch of rules grouped by a common area, e.g. improve naming. You can p ```yaml includes: - vendor/symplify/phpstan-rules/config/code-complexity-rules.neon - - vendor/symplify/phpstan-rules/config/collector-rules.neon - vendor/symplify/phpstan-rules/config/naming-rules.neon - vendor/symplify/phpstan-rules/config/regex-rules.neon - vendor/symplify/phpstan-rules/config/static-rules.neon diff --git a/config/code-complexity-rules.neon b/config/code-complexity-rules.neon index e980dec4..74417803 100644 --- a/config/code-complexity-rules.neon +++ b/config/code-complexity-rules.neon @@ -1,5 +1,3 @@ rules: - - Symplify\PHPStanRules\Rules\Explicit\NoMixedPropertyFetcherRule - - Symplify\PHPStanRules\Rules\Explicit\NoMixedMethodCallerRule - Symplify\PHPStanRules\Rules\NoDynamicNameRule - Symplify\PHPStanRules\Rules\NoReturnArrayVariableListRule diff --git a/config/collector-rules.neon b/config/collector-rules.neon deleted file mode 100644 index c2d08990..00000000 --- a/config/collector-rules.neon +++ /dev/null @@ -1,18 +0,0 @@ -# these rule focus on the whole-project analysis, see https://phpstan.org/developing-extensions/collectors -rules: - - Symplify\PHPStanRules\Rules\NarrowType\NarrowPublicClassMethodParamTypeByCallerTypeRule - -services: - # for NarrowPublicClassMethodParamTypeByCallerTypeRule - - - class: Symplify\PHPStanRules\Collector\ClassMethod\PublicClassMethodParamTypesCollector - tags: [phpstan.collector] - - - - class: Symplify\PHPStanRules\Collector\MethodCall\MethodCallArgTypesCollector - tags: [phpstan.collector] - - - - class: Symplify\PHPStanRules\Collector\MethodCallableNode\MethodCallableCollector - tags: - - phpstan.collector diff --git a/config/naming-rules.neon b/config/naming-rules.neon index e0bad68d..aecaf6f4 100644 --- a/config/naming-rules.neon +++ b/config/naming-rules.neon @@ -3,5 +3,4 @@ rules: - Symplify\PHPStanRules\Rules\NoReturnSetterMethodRule - Symplify\PHPStanRules\Rules\UppercaseConstantRule - Symplify\PHPStanRules\Rules\ClassNameRespectsParentSuffixRule - - Symplify\PHPStanRules\Rules\CheckTypehintCallerTypeRule - Symplify\PHPStanRules\Rules\CheckClassNamespaceFollowPsr4Rule diff --git a/config/services/services.neon b/config/services/services.neon index 15bee9ba..bf7650d1 100644 --- a/config/services/services.neon +++ b/config/services/services.neon @@ -17,16 +17,7 @@ services: - Symplify\PHPStanRules\NodeAnalyzer\EnumAnalyzer - Symplify\PHPStanRules\NodeAnalyzer\RegexFuncCallAnalyzer - Symplify\PHPStanRules\NodeAnalyzer\RegexStaticCallAnalyzer - - Symplify\PHPStanRules\NodeFinder\ClassMethodNodeFinder - - Symplify\PHPStanRules\NodeFinder\MethodCallNodeFinder - - Symplify\PHPStanRules\NodeFinder\ReturnNodeFinder - Symplify\PHPStanRules\ParentClassMethodNodeResolver - - Symplify\PHPStanRules\PhpDoc\ApiDocStmtAnalyzer - Symplify\PHPStanRules\PhpDoc\BarePhpDocParser - Symplify\PHPStanRules\PhpDoc\PhpDocResolver - - Symplify\PHPStanRules\Printer\NodeComparator - - Symplify\PHPStanRules\Reflection\MethodNodeAnalyser - Symplify\PHPStanRules\TypeAnalyzer\CallableTypeAnalyzer - - Symplify\PHPStanRules\Matcher\Collector\PublicClassMethodMatcher - - Symplify\PHPStanRules\Matcher\ClassMethodCallReferenceResolver - - Symplify\PHPStanRules\Printer\CollectorMetadataPrinter diff --git a/config/static-rules.neon b/config/static-rules.neon index ed643bea..8f254f14 100644 --- a/config/static-rules.neon +++ b/config/static-rules.neon @@ -5,24 +5,17 @@ rules: - Symplify\PHPStanRules\Rules\Domain\RequireExceptionNamespaceRule - Symplify\PHPStanRules\Rules\Domain\RequireAttributeNamespaceRule - Symplify\PHPStanRules\Rules\Enum\RequireUniqueEnumConstantRule - - Symplify\PHPStanRules\Rules\ForbiddenParamTypeRemovalRule - Symplify\PHPStanRules\Rules\PreventParentMethodVisibilityOverrideRule # paths - Symplify\PHPStanRules\Rules\NoMissingDirPathRule - Symplify\PHPStanRules\Rules\NoReferenceRule - - Symplify\PHPStanRules\Rules\NoArrayAccessOnObjectRule - Symplify\PHPStanRules\Rules\NoNullableArrayPropertyRule - # dead-code - - Symplify\PHPStanRules\Rules\NoIssetOnObjectRule - # explicit naming - Symplify\PHPStanRules\Rules\ForbiddenMultipleClassLikeInOneFileRule - # comlexity - - Symplify\PHPStanRules\Rules\NarrowType\NoReturnFalseInNonBoolClassMethodRule - Symplify\PHPStanRules\Rules\Complexity\ForbiddenArrayMethodCallRule - Symplify\PHPStanRules\Rules\CheckRequiredInterfaceInContractNamespaceRule diff --git a/config/symplify-rules.neon b/config/symplify-rules.neon index 36313039..2c96c831 100644 --- a/config/symplify-rules.neon +++ b/config/symplify-rules.neon @@ -1,6 +1,5 @@ includes: - code-complexity-rules.neon - - collector-rules.neon - configurable-rules.neon - naming-rules.neon - regex-rules.neon diff --git a/phpstan.neon b/phpstan.neon index b50a6406..208b2d1e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -34,7 +34,6 @@ parameters: # needless generics - '#Class Symplify\\PHPStanRules\\(.*?)Rule implements generic interface PHPStan\\Rules\\Rule but does not specify its types\: TNodeType#' - - '#Method (.*?)::getCollectors\(\) return type with generic interface PHPStan\\Collectors\\Collector does not specify its types\: TNodeType, TValue#' - '#Parameter \#1 \$values of method Symplify\\PHPStanRules\\Rules\\Enum\\RequireUniqueEnumConstantRule\:\:filterDuplicatedValues\(\) expects array, array given#' @@ -44,8 +43,6 @@ parameters: - '#Method Symplify\\PHPStanRules\\NodeFinder\\TypeAwareNodeFinder\:\:findFirstInstanceOf\(\) should return \(TNode of PhpParser\\Node\)\|null but returns PhpParser\\Node\|null#' - - '#Method Symplify\\PHPStanRules\\NodeFinder\\MethodCallNodeFinder\:\:findUsages\(\) should return array but returns array#' - # overly detailed - '#Class Symplify\\PHPStanRules\\(.*?) extends generic class PHPStan\\Testing\\RuleTestCase but does not specify its types\: TRule#' - '#Method Symplify\\PHPStanRules\\(.*?)\:\:getRule\(\) return type with generic interface PHPStan\\Rules\\Rule does not specify its types\: TNodeType#' diff --git a/src/Collector/ClassMethod/PublicClassMethodParamTypesCollector.php b/src/Collector/ClassMethod/PublicClassMethodParamTypesCollector.php deleted file mode 100644 index 7201ad25..00000000 --- a/src/Collector/ClassMethod/PublicClassMethodParamTypesCollector.php +++ /dev/null @@ -1,71 +0,0 @@ - - */ -final class PublicClassMethodParamTypesCollector implements Collector -{ - public function __construct( - private readonly ApiDocStmtAnalyzer $apiDocStmtAnalyzer, - private readonly PublicClassMethodMatcher $publicClassMethodMatcher, - private readonly CollectorMetadataPrinter $collectorMetadataPrinter - ) { - } - - public function getNodeType(): string - { - return ClassMethod::class; - } - - /** - * @param ClassMethod $node - * @return array{class-string, string, string, int}|null - */ - public function processNode(Node $node, Scope $scope): ?array - { - if ($node->params === []) { - return null; - } - - if ($this->publicClassMethodMatcher->shouldSkipClassMethod($node)) { - return null; - } - - // only if the class has no parents/implementers, to avoid class method required by contracts - $classReflection = $scope->getClassReflection(); - if (! $classReflection instanceof ClassReflection) { - return null; - } - - if ($this->apiDocStmtAnalyzer->isApiDoc($node, $classReflection)) { - return null; - } - - if ($this->publicClassMethodMatcher->shouldSkipClassReflection($classReflection)) { - return null; - } - - $methodName = $node->name->toString(); - - // is this method required by parent contract? skip it - if ($this->publicClassMethodMatcher->isUsedByParentClassOrInterface($classReflection, $methodName)) { - return null; - } - - $printedParamTypesString = $this->collectorMetadataPrinter->printParamTypesToString($node); - return [$classReflection->getName(), $methodName, $printedParamTypesString, $node->getLine()]; - } -} diff --git a/src/Collector/MethodCall/MethodCallArgTypesCollector.php b/src/Collector/MethodCall/MethodCallArgTypesCollector.php deleted file mode 100644 index 7371d461..00000000 --- a/src/Collector/MethodCall/MethodCallArgTypesCollector.php +++ /dev/null @@ -1,59 +0,0 @@ -|null> - */ -final class MethodCallArgTypesCollector implements Collector -{ - public function __construct( - private readonly ClassMethodCallReferenceResolver $classMethodCallReferenceResolver, - private readonly CollectorMetadataPrinter $collectorMetadataPrinter, - ) { - } - - public function getNodeType(): string - { - return MethodCall::class; - } - - /** - * @param MethodCall $node - * @return array{string, string}|null - */ - public function processNode(Node $node, Scope $scope): ?array - { - if ($node->getArgs() === []) { - return null; - } - - $classMethodCallReference = $this->classMethodCallReferenceResolver->resolve($node, $scope, true); - if (! $classMethodCallReference instanceof MethodCallReference) { - return null; - } - - $classMethodReference = $this->createClassMethodReference($classMethodCallReference); - - $stringArgTypesString = $this->collectorMetadataPrinter->printArgTypesAsString($node, $scope); - return [$classMethodReference, $stringArgTypesString]; - } - - private function createClassMethodReference(MethodCallReference $classMethodCallReference): string - { - $className = $classMethodCallReference->getClass(); - $methodName = $classMethodCallReference->getMethod(); - - return $className . '::' . $methodName; - } -} diff --git a/src/Collector/MethodCallableNode/MethodCallableCollector.php b/src/Collector/MethodCallableNode/MethodCallableCollector.php deleted file mode 100644 index e8f33b82..00000000 --- a/src/Collector/MethodCallableNode/MethodCallableCollector.php +++ /dev/null @@ -1,58 +0,0 @@ -|null> - * - * PHPStan has special node for first class callables of MethodCall - * - * @see https://github.com/phpstan/phpstan-src/blob/511c1e435fb43b8eb0ac310e6aa3230147963790/src/Analyser/NodeScopeResolver.php#L1936 - */ -final class MethodCallableCollector implements Collector -{ - public function __construct( - private readonly ClassMethodCallReferenceResolver $classMethodCallReferenceResolver, - ) { - } - - public function getNodeType(): string - { - return MethodCallableNode::class; - } - - /** - * @param MethodCallableNode $node - * @return array{string}|null - */ - public function processNode(Node $node, Scope $scope): ?array - { - $classMethodCallReference = $this->classMethodCallReferenceResolver->resolve($node, $scope, true); - if (! $classMethodCallReference instanceof MethodCallReference) { - return null; - } - - $classMethodReference = $this->createClassMethodReference($classMethodCallReference); - - // special case that should skip everything - return [$classMethodReference]; - } - - private function createClassMethodReference(MethodCallReference $classMethodCallReference): string - { - $className = $classMethodCallReference->getClass(); - $methodName = $classMethodCallReference->getMethod(); - - return $className . '::' . $methodName; - } -} diff --git a/src/Enum/Types/ResolvedTypes.php b/src/Enum/Types/ResolvedTypes.php deleted file mode 100644 index 959cf81f..00000000 --- a/src/Enum/Types/ResolvedTypes.php +++ /dev/null @@ -1,13 +0,0 @@ -getName(); - $variable = $methodCallOrMethodCallable->getVar(); - } else { - $methodName = $methodCallOrMethodCallable->name; - $variable = $methodCallOrMethodCallable->var; - } - - if ($methodName instanceof Expr) { - return null; - } - - $callerType = $scope->getType($variable); - - // remove optional nullable type - if (TypeCombinator::containsNull($callerType)) { - $callerType = TypeCombinator::removeNull($callerType); - } - - if (! $allowThisType && $callerType instanceof ThisType) { - return null; - } - - if (! $callerType instanceof TypeWithClassName) { - return null; - } - - // move to the class where method is defined, e.g. parent class defines the method, so it should be checked there - $className = $callerType->getClassName(); - $methodNameString = $methodName->toString(); - - return new MethodCallReference($className, $methodNameString); - } -} diff --git a/src/Matcher/Collector/PublicClassMethodMatcher.php b/src/Matcher/Collector/PublicClassMethodMatcher.php deleted file mode 100644 index 50b6ec3d..00000000 --- a/src/Matcher/Collector/PublicClassMethodMatcher.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ - private const SKIPPED_TYPES = [TestCase::class, ContainerConfigurator::class]; - - public function shouldSkipClassReflection(ClassReflection $classReflection): bool - { - // skip interface as required, traits as unable to detect for sure - if (! $classReflection->isClass()) { - return true; - } - - foreach (self::SKIPPED_TYPES as $skippedType) { - if ($classReflection->isSubclassOf($skippedType)) { - return true; - } - } - - return false; - } - - public function isUsedByParentClassOrInterface(ClassReflection $classReflection, string $methodName): bool - { - // is this method required by parent contract? skip it - foreach ($classReflection->getInterfaces() as $parentInterfaceReflection) { - if ($parentInterfaceReflection->hasMethod($methodName)) { - return true; - } - } - - foreach ($classReflection->getParents() as $parentClassReflection) { - if ($parentClassReflection->hasMethod($methodName)) { - return true; - } - } - - return false; - } - - public function shouldSkipClassMethod(ClassMethod $classMethod): bool - { - if ($classMethod->isMagic()) { - return true; - } - - if ($classMethod->isStatic()) { - return true; - } - - // skip attributes - if ($classMethod->attrGroups !== []) { - return true; - } - - if (! $classMethod->isPublic()) { - return true; - } - - $doc = $classMethod->getDocComment(); - - // skip symfony action - return $doc instanceof Doc && str_contains($doc->getText(), '@Route'); - } -} diff --git a/src/NodeFinder/ClassMethodNodeFinder.php b/src/NodeFinder/ClassMethodNodeFinder.php deleted file mode 100644 index bd1e8b65..00000000 --- a/src/NodeFinder/ClassMethodNodeFinder.php +++ /dev/null @@ -1,52 +0,0 @@ -getClassReflection(); - if (! $classReflection instanceof ClassReflection) { - return null; - } - - $classLike = $this->reflectionParser->parseClassReflection($classReflection); - if (! $classLike instanceof Class_) { - return null; - } - - if (! $methodCall->name instanceof Identifier) { - return null; - } - - $methodCallName = $methodCall->name->toString(); - - /** @var ClassMethod|null $classMethod */ - $classMethod = $classLike->getMethod($methodCallName); - if (! $classMethod instanceof ClassMethod) { - return null; - } - - if (! $classMethod->isPrivate()) { - return null; - } - - return $classMethod; - } -} diff --git a/src/NodeFinder/MethodCallNodeFinder.php b/src/NodeFinder/MethodCallNodeFinder.php deleted file mode 100644 index 77832c77..00000000 --- a/src/NodeFinder/MethodCallNodeFinder.php +++ /dev/null @@ -1,52 +0,0 @@ -getClassReflection(); - if (! $classReflection instanceof ClassReflection) { - return []; - } - - $classLike = $this->reflectionParser->parseClassReflection($classReflection); - if (! $classLike instanceof Class_) { - return []; - } - - return $this->nodeFinder->find($classLike, function (Node $node) use ($methodCall): bool { - if (! $node instanceof MethodCall) { - return false; - } - - if (! $this->nodeComparator->areNodesEqual($node->var, $methodCall->var)) { - return false; - } - - return $this->nodeComparator->areNodesEqual($node->name, $methodCall->name); - }); - } -} diff --git a/src/NodeFinder/ReturnNodeFinder.php b/src/NodeFinder/ReturnNodeFinder.php deleted file mode 100644 index becdd1ec..00000000 --- a/src/NodeFinder/ReturnNodeFinder.php +++ /dev/null @@ -1,61 +0,0 @@ -findReturnsWithValues($classMethod); - if (count($returns) !== 1) { - return null; - } - - $onlyReturn = $returns[0]; - return $onlyReturn->expr; - } - - /** - * @return Return_[] - */ - public function findReturnsWithValues(ClassMethod $classMethod): array - { - $returns = []; - - $this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->stmts, static function ( - Node $node - ) use (&$returns) { - // skip different scope - if ($node instanceof FunctionLike) { - return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; - } - - if (! $node instanceof Return_) { - return null; - } - - if (! $node->expr instanceof Expr) { - return null; - } - - $returns[] = $node; - }); - - return $returns; - } -} diff --git a/src/PhpDoc/ApiDocStmtAnalyzer.php b/src/PhpDoc/ApiDocStmtAnalyzer.php deleted file mode 100644 index baac14ee..00000000 --- a/src/PhpDoc/ApiDocStmtAnalyzer.php +++ /dev/null @@ -1,30 +0,0 @@ -getResolvedPhpDoc() instanceof ResolvedPhpDocBlock) { - $resolvedPhpDoc = $classReflection->getResolvedPhpDoc(); - if (str_contains($resolvedPhpDoc->getPhpDocString(), '@api')) { - return true; - } - } - - $docComment = $classMethod->getDocComment(); - if (! $docComment instanceof Doc) { - return false; - } - - return str_contains($docComment->getText(), '@api'); - } -} diff --git a/src/Printer/CollectorMetadataPrinter.php b/src/Printer/CollectorMetadataPrinter.php deleted file mode 100644 index 60748ac6..00000000 --- a/src/Printer/CollectorMetadataPrinter.php +++ /dev/null @@ -1,147 +0,0 @@ -printerStandard = new Standard(); - } - - public function printArgTypesAsString(MethodCall $methodCall, Scope $scope): string - { - $stringArgTypes = []; - - foreach ($methodCall->getArgs() as $arg) { - $argType = $scope->getType($arg->value); - - // we have no idea, nothing we can do - if ($argType instanceof MixedType) { - return ResolvedTypes::UNKNOWN_TYPES; - } - - if ($argType instanceof IntersectionType) { - return ResolvedTypes::UNKNOWN_TYPES; - } - - if ($argType instanceof PHPStanUnionType) { - return ResolvedTypes::UNKNOWN_TYPES; - } - - if ($argType instanceof ThisType) { - $argType = new ObjectType($argType->getClassName()); - } - - $stringArgTypes[] = $this->printTypeToString($argType); - } - - return implode('|', $stringArgTypes); - } - - public function printParamTypesToString(ClassMethod $classMethod): string - { - $printedParamTypes = []; - foreach ($classMethod->params as $param) { - if ($param->type === null) { - $printedParamTypes[] = ''; - continue; - } - - $paramType = $param->type; - if ($paramType instanceof NullableType) { - // unite to phpstan type - $paramType = new UnionType([$paramType->type, new Identifier('null')]); - } - - if ($paramType instanceof UnionType) { - $paramType = $this->resolveSortedUnionType($paramType); - } - - $printedParamType = $this->printerStandard->prettyPrint([$paramType]); - $printedParamType = ltrim($printedParamType, '\\'); - $printedParamType = str_replace('|\\', '|', $printedParamType); - - $printedParamTypes[] = $printedParamType; - } - - return implode('|', $printedParamTypes); - } - - private function resolveSortedUnionType(UnionType $unionType): UnionType - { - $typeNames = []; - - foreach ($unionType->types as $type) { - if ($type instanceof NodeIntersectionType) { - foreach ($type->types as $intersectionType) { - $typeNames[] = (string) $intersectionType; - } - - continue; - } - - $typeNames[] = (string) $type; - } - - sort($typeNames); - - $types = []; - foreach ($typeNames as $typeName) { - $types[] = new Identifier($typeName); - } - - return new UnionType($types); - } - - private function printTypeToString(Type $type): string - { - if ($type instanceof ClassStringType) { - return 'string'; - } - - if ($type instanceof ArrayType) { - return 'array'; - } - - if ($type instanceof BooleanType) { - return 'bool'; - } - - if ($type instanceof IntegerRangeType) { - return 'int'; - } - - if ($type instanceof ClosureType) { - return 'callable'; - } - - return $type->describe(VerbosityLevel::typeOnly()); - } -} diff --git a/src/Printer/NodeComparator.php b/src/Printer/NodeComparator.php deleted file mode 100644 index 3493e1ca..00000000 --- a/src/Printer/NodeComparator.php +++ /dev/null @@ -1,26 +0,0 @@ -setAttribute(AttributeKey::COMMENTS, null); - $secondNode->setAttribute(AttributeKey::COMMENTS, null); - - return $this->standard->prettyPrint([$firstNode]) === $this->standard->prettyPrint([$secondNode]); - } -} diff --git a/src/Reflection/MethodNodeAnalyser.php b/src/Reflection/MethodNodeAnalyser.php deleted file mode 100644 index 1cf02921..00000000 --- a/src/Reflection/MethodNodeAnalyser.php +++ /dev/null @@ -1,46 +0,0 @@ -matchFirstParentClassMethod($scope, $methodName) instanceof MethodReflection; - } - - public function matchFirstParentClassMethod(Scope $scope, string $methodName): ?MethodReflection - { - $classReflection = $scope->getClassReflection(); - if (! $classReflection instanceof ClassReflection) { - return null; - } - - // the classes have highter priority, e.g. priority in class covariance - foreach ($classReflection->getParents() as $parentClassReflection) { - if ($parentClassReflection->hasNativeMethod($methodName)) { - return $parentClassReflection->getNativeMethod($methodName); - } - } - - foreach ($classReflection->getAncestors() as $ancestorClassReflection) { - if ($classReflection === $ancestorClassReflection) { - continue; - } - - if (! $ancestorClassReflection->hasNativeMethod($methodName)) { - continue; - } - - return $ancestorClassReflection->getNativeMethod($methodName); - } - - return null; - } -} diff --git a/src/Rules/CheckTypehintCallerTypeRule.php b/src/Rules/CheckTypehintCallerTypeRule.php deleted file mode 100644 index d428c8ff..00000000 --- a/src/Rules/CheckTypehintCallerTypeRule.php +++ /dev/null @@ -1,213 +0,0 @@ - - */ - public function getNodeType(): string - { - return MethodCall::class; - } - - /** - * @param MethodCall $node - * @return RuleError[] - */ - public function processNode(Node $node, Scope $scope): array - { - $args = $node->getArgs(); - if ($args === []) { - return []; - } - - if (! $node->var instanceof Variable - || ! is_string($node->var->name) - || $node->var->name !== 'this' - ) { - return []; - } - - return $this->validateArgVsParamTypes($args, $node, $scope); - } - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition(self::ERROR_MESSAGE, [ - new CodeSample( - <<<'CODE_SAMPLE' -use PhpParser\Node; -use PhpParser\Node\Expr\MethodCall; - -class SomeClass -{ - public function run(MethodCall $node) - { - $this->isCheck($node); - } - - private function isCheck(Node $node) - { - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -use PhpParser\Node\Expr\MethodCall; - -class SomeClass -{ - public function run(MethodCall $node) - { - $this->isCheck($node); - } - - private function isCheck(MethodCall $node) - { - } -} -CODE_SAMPLE - ), - ]); - } - - /** - * @param Arg[] $args - * @return RuleError[] - */ - private function validateArgVsParamTypes(array $args, MethodCall $methodCall, Scope $scope): array - { - $methodCallUses = $this->methodCallNodeFinder->findUsages($methodCall, $scope); - if (count($methodCallUses) > 1) { - return []; - } - - $classMethod = $this->classMethodNodeFinder->findByMethodCall($methodCall, $scope); - if (! $classMethod instanceof ClassMethod) { - return []; - } - - /** @var Param[] $params */ - $params = $classMethod->getParams(); - - $errorMessages = []; - - foreach ($args as $position => $arg) { - $param = $params[$position] ?? []; - if (! $param instanceof Param) { - continue; - } - - if (! $arg instanceof Arg) { - continue; - } - - $paramErrorMessage = $this->validateParam($param, $position, $arg->value, $scope); - if (! $paramErrorMessage instanceof RuleError) { - continue; - } - - // @todo test double failed type - $errorMessages[] = $paramErrorMessage; - } - - return $errorMessages; - } - - private function validateParam(Param $param, int $position, Expr $expr, Scope $scope): ?RuleError - { - $type = $param->type; - - // @todo some static type mapper from php-parser to PHPStan? - if (! $type instanceof FullyQualified) { - return null; - } - - $argType = $scope->getType($expr); - if ($argType instanceof MixedType) { - return null; - } - - if ($argType instanceof TemplateType) { - return null; - } - - // not solveable yet, work with PHP 8 code only - if ($argType instanceof UnionType) { - return null; - } - - if ($argType instanceof IntersectionType) { - return null; - } - - $objectType = new ObjectType($type->toString()); - - if ($objectType->equals($argType)) { - return null; - } - - $classReflection = $objectType->getClassReflection(); - if ($classReflection instanceof ClassReflection && $classReflection->isAbstract()) { - return null; - } - - // handle weird type substration cases - $paramTypeAsString = $objectType->describe(VerbosityLevel::typeOnly()); - $argTypeAsString = $argType->describe(VerbosityLevel::typeOnly()); - - if ($paramTypeAsString === $argTypeAsString) { - return null; - } - - $errorMessage = sprintf(self::ERROR_MESSAGE, $position + 1, $argTypeAsString); - - return RuleErrorBuilder::message($errorMessage) - ->line($param->getLine()) - ->build(); - } -} diff --git a/src/Rules/Explicit/NoMixedMethodCallerRule.php b/src/Rules/Explicit/NoMixedMethodCallerRule.php deleted file mode 100644 index 2369482b..00000000 --- a/src/Rules/Explicit/NoMixedMethodCallerRule.php +++ /dev/null @@ -1,81 +0,0 @@ -...()` method call can lead to false dead methods. Make sure the variable type is known'; - - public function __construct( - private readonly Standard $printerStandard, - ) { - } - - /** - * @return class-string - */ - public function getNodeType(): string - { - return MethodCall::class; - } - - /** - * @param MethodCall $node - * @return mixed[] - */ - public function processNode(Node $node, Scope $scope): array - { - $callerType = $scope->getType($node->var); - if (! $callerType instanceof MixedType) { - return []; - } - - if ($callerType instanceof ErrorType) { - return []; - } - - $printedMethodCall = $this->printerStandard->prettyPrintExpr($node->var); - - return [sprintf(self::ERROR_MESSAGE, $printedMethodCall)]; - } - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition(self::ERROR_MESSAGE, [ - new CodeSample( - <<<'CODE_SAMPLE' -function run($unknownType) -{ - return $unknownType->call(); -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -function run(KnownType $knownType) -{ - return $knownType->call(); -} -CODE_SAMPLE - ), - ]); - } -} diff --git a/src/Rules/Explicit/NoMixedPropertyFetcherRule.php b/src/Rules/Explicit/NoMixedPropertyFetcherRule.php deleted file mode 100644 index d170b543..00000000 --- a/src/Rules/Explicit/NoMixedPropertyFetcherRule.php +++ /dev/null @@ -1,76 +0,0 @@ -..." property fetch can lead to false dead property. Make sure the variable type is known'; - - public function __construct( - private readonly Standard $standard, - ) { - } - - /** - * @return class-string - */ - public function getNodeType(): string - { - return PropertyFetch::class; - } - - /** - * @param PropertyFetch $node - * @return mixed[] - */ - public function processNode(Node $node, Scope $scope): array - { - $callerType = $scope->getType($node->var); - if (! $callerType instanceof MixedType) { - return []; - } - - $printedVar = $this->standard->prettyPrintExpr($node->var); - - return [sprintf(self::ERROR_MESSAGE, $printedVar)]; - } - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition(self::ERROR_MESSAGE, [ - new CodeSample( - <<<'CODE_SAMPLE' -function run($unknownType) -{ - return $unknownType->name; -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -function run(KnownType $knownType) -{ - return $knownType->name; -} -CODE_SAMPLE - ), - ]); - } -} diff --git a/src/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule.php b/src/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule.php deleted file mode 100644 index fdf57cf4..00000000 --- a/src/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule.php +++ /dev/null @@ -1,165 +0,0 @@ - - */ - public function getNodeType(): string - { - return ClassMethod::class; - } - - /** - * @param ClassMethod $node - * @return mixed[] - */ - public function processNode(Node $node, Scope $scope): array - { - if (! $node->returnType instanceof FullyQualified) { - return []; - } - - if ($this->shouldSkipScope($scope)) { - return []; - } - - $returnObjectType = new ObjectType($node->returnType->toString()); - if ($this->shouldSkipReturnObjectType($returnObjectType)) { - return []; - } - - $methodName = $node->name->toString(); - if ($this->methodNodeAnalyser->hasParentVendorLock($scope, $methodName)) { - return []; - } - - $returnExpr = $this->returnNodeFinder->findOnlyReturnsExpr($node); - if (! $returnExpr instanceof Expr) { - return []; - } - - $returnExprType = $scope->getType($returnExpr); - if ($this->shouldSkipReturnExprType($returnExprType)) { - return []; - } - - if ($returnObjectType->equals($returnExprType)) { - return []; - } - - // is subtype? - if (! $returnObjectType->isSuperTypeOf($returnExprType)->yes()) { - return []; - } - - /** @var TypeWithClassName $returnExprType */ - $errorMessage = sprintf(self::ERROR_MESSAGE, $returnExprType->getClassName()); - return [$errorMessage]; - } - - private function shouldSkipReturnObjectType(ObjectType $objectType): bool - { - $classReflection = $objectType->getClassReflection(); - if (! $classReflection instanceof ClassReflection) { - return true; - } - - // cannot be more precise if final class - return $classReflection->isFinal(); - } - - private function shouldSkipScope(Scope $scope): bool - { - $classReflection = $scope->getClassReflection(); - if (! $classReflection instanceof ClassReflection) { - return true; - } - - return ! $classReflection->isClass(); - } - - private function shouldSkipReturnExprType(Type $type): bool - { - if (! $type instanceof TypeWithClassName) { - return true; - } - - $classReflection = $type->getClassReflection(); - if (! $classReflection instanceof ClassReflection) { - return true; - } - - return $classReflection->isAnonymous(); - } -} diff --git a/src/Rules/ForbiddenParamTypeRemovalRule.php b/src/Rules/ForbiddenParamTypeRemovalRule.php deleted file mode 100644 index dacb42c0..00000000 --- a/src/Rules/ForbiddenParamTypeRemovalRule.php +++ /dev/null @@ -1,124 +0,0 @@ - - */ - public function getNodeType(): string - { - return ClassMethod::class; - } - - /** - * @param ClassMethod $node - * @return string[] - */ - public function processNode(Node $node, Scope $scope): array - { - if ($node->params === []) { - return []; - } - - $classMethodName = (string) $node->name; - $parentClassMethodReflection = $this->methodNodeAnalyser->matchFirstParentClassMethod($scope, $classMethodName); - if (! $parentClassMethodReflection instanceof PhpMethodReflection) { - return []; - } - - foreach ($node->params as $paramPosition => $param) { - if ($param->type !== null) { - continue; - } - - $parentParamType = $this->resolveParentParamType($parentClassMethodReflection, $paramPosition); - if ($parentParamType instanceof MixedType) { - continue; - } - - // removed param type! - return [self::ERROR_MESSAGE]; - } - - return []; - } - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition(self::ERROR_MESSAGE, [ - new CodeSample( - <<<'CODE_SAMPLE' -interface RectorInterface -{ - public function refactor(Node $node); -} - -final class SomeRector implements RectorInterface -{ - public function refactor($node) - { - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -interface RectorInterface -{ - public function refactor(Node $node); -} - -final class SomeRector implements RectorInterface -{ - public function refactor(Node $node) - { - } -} -CODE_SAMPLE - ), - ]); - } - - private function resolveParentParamType(PhpMethodReflection $phpMethodReflection, int $paramPosition): Type - { - foreach ($phpMethodReflection->getVariants() as $parametersAcceptorWithPhpDoc) { - foreach ($parametersAcceptorWithPhpDoc->getParameters() as $parentParamPosition => $parameterReflectionWithPhpDoc) { - if ($paramPosition !== $parentParamPosition) { - continue; - } - - return $parameterReflectionWithPhpDoc->getNativeType(); - } - } - - return new MixedType(); - } -} diff --git a/src/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule.php b/src/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule.php deleted file mode 100644 index d2224d3a..00000000 --- a/src/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule.php +++ /dev/null @@ -1,186 +0,0 @@ - - */ -final class NarrowPublicClassMethodParamTypeByCallerTypeRule implements Rule, DocumentedRuleInterface -{ - /** - * @var string - */ - public const ERROR_MESSAGE = 'Parameters should use "%s" types as the only types passed to this method'; - - /** - * @return class-string - */ - public function getNodeType(): string - { - return CollectedDataNode::class; - } - - /** - * @param CollectedDataNode $node - * @return RuleError[] - */ - public function processNode(Node $node, Scope $scope): array - { - $publicClassMethodCollector = $node->get(PublicClassMethodParamTypesCollector::class); - - $classMethodReferenceToArgTypes = $this->resolveClassMethodReferenceToArgTypes($node); - - $ruleErrors = []; - - foreach ($publicClassMethodCollector as $filePath => $declarations) { - foreach ($declarations as [$className, $methodName, $paramTypesString, $line]) { - $uniqueCollectedArgTypesString = $this->resolveUniqueArgTypesString( - $classMethodReferenceToArgTypes, - $className, - $methodName - ); - - if ($uniqueCollectedArgTypesString === null) { - continue; - } - - if ($paramTypesString === $uniqueCollectedArgTypesString) { - continue; - } - - $errorMessage = sprintf(self::ERROR_MESSAGE, $uniqueCollectedArgTypesString); - $ruleErrors[] = RuleErrorBuilder::message($errorMessage) - ->file($filePath) - ->line($line) - ->build(); - } - } - - return $ruleErrors; - } - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition(self::ERROR_MESSAGE, [ - new CodeSample( - <<<'CODE_SAMPLE' -use PhpParser\Node\Expr\MethodCall; - -final class SomeClass -{ - public function run(SomeService $someService, MethodCall $methodCall) - { - $someService->isCheck($node); - } -} - -final class SomeService -{ - public function isCheck($methodCall) - { - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -use PhpParser\Node\Expr\MethodCall; - -final class SomeClass -{ - public function run(SomeService $someService, MethodCall $methodCall) - { - $someService->isCheck($node); - } -} - -final class SomeService -{ - public function isCheck(MethodCall $methodCall) - { - } -} -CODE_SAMPLE - ), - ]); - } - - /** - * @return array - */ - private function resolveClassMethodReferenceToArgTypes(CollectedDataNode $collectedDataNode): array - { - $methodCallArgTypesByFilePath = $collectedDataNode->get(MethodCallArgTypesCollector::class); - - // these should be skipped completely, as we have no idea what is being passed there - $methodCallablesByFilePath = $collectedDataNode->get(MethodCallableCollector::class); - $methodFirstClassCallables = Arrays::flatten($methodCallablesByFilePath); - - // group call references and types - $classMethodReferenceToTypes = []; - - foreach ($methodCallArgTypesByFilePath as $methodCallArgTypes) { - foreach ($methodCallArgTypes as [$classMethodReference, $argTypesString]) { - // skip it - if (in_array($classMethodReference, $methodFirstClassCallables, true)) { - continue; - } - - $classMethodReferenceToTypes[$classMethodReference][] = $argTypesString; - } - } - - // resolve unique values - foreach ($classMethodReferenceToTypes as $key => $value) { - $classMethodReferenceToTypes[$key] = array_unique($value); - } - - return $classMethodReferenceToTypes; - } - - /** - * @param array $classMethodReferenceToArgTypes - */ - private function resolveUniqueArgTypesString( - array $classMethodReferenceToArgTypes, - string $className, - string $methodName - ): ?string { - $currentClassMethodReference = $className . '::' . $methodName; - - $collectedArgTypes = $classMethodReferenceToArgTypes[$currentClassMethodReference] ?? null; - if ($collectedArgTypes === null) { - return null; - } - - // we need exactly one type - if (count($collectedArgTypes) !== 1) { - return null; - } - - // one of the arg types could not be resolved, we're not sure - if (in_array(ResolvedTypes::UNKNOWN_TYPES, $collectedArgTypes, true)) { - return null; - } - - return $collectedArgTypes[0]; - } -} diff --git a/src/Rules/NarrowType/NoReturnFalseInNonBoolClassMethodRule.php b/src/Rules/NarrowType/NoReturnFalseInNonBoolClassMethodRule.php deleted file mode 100644 index d63b405b..00000000 --- a/src/Rules/NarrowType/NoReturnFalseInNonBoolClassMethodRule.php +++ /dev/null @@ -1,126 +0,0 @@ - - */ -final class NoReturnFalseInNonBoolClassMethodRule implements Rule, DocumentedRuleInterface -{ - /** - * @api - * @var string - */ - public const ERROR_MESSAGE = 'Returning false in non return bool class method. Use null instead'; - - private readonly NodeFinder $nodeFinder; - - public function __construct( - ) { - $this->nodeFinder = new NodeFinder(); - } - - /** - * @return class-string - */ - public function getNodeType(): string - { - return ClassMethod::class; - } - - /** - * @param ClassMethod $node - * @retur string[] - */ - public function processNode(Node $node, Scope $scope): array - { - if ($node->stmts === null) { - return []; - } - - if ($node->returnType instanceof Node) { - return []; - } - - /** @var Return_[] $returns */ - $returns = $this->nodeFinder->findInstanceOf($node->stmts, Return_::class); - - foreach ($returns as $return) { - if (! $return->expr instanceof Expr) { - continue; - } - - $exprType = $scope->getType($return->expr); - if (! $exprType instanceof ConstantBooleanType) { - continue; - } - - if ($exprType->getValue()) { - continue; - } - - return [self::ERROR_MESSAGE]; - } - - return []; - } - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition(self::ERROR_MESSAGE, [ - new CodeSample( - <<<'CODE_SAMPLE' -class SomeClass -{ - /** - * @var Item[] - */ - private $items = []; - - public function getItem($key) - { - if (isset($this->items[$key])) { - return $this->items[$key]; - } - - return false; - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -class SomeClass -{ - /** - * @var Item[] - */ - private $items = []; - - public function getItem($key): ?Item - { - if (isset($this->items[$key])) { - return $this->items[$key]; - } - - return null; - } -} -CODE_SAMPLE - ), - ]); - } -} diff --git a/src/Rules/NoArrayAccessOnObjectRule.php b/src/Rules/NoArrayAccessOnObjectRule.php deleted file mode 100644 index 73796bec..00000000 --- a/src/Rules/NoArrayAccessOnObjectRule.php +++ /dev/null @@ -1,85 +0,0 @@ - - */ - public function getNodeType(): string - { - return ArrayDimFetch::class; - } - - /** - * @param ArrayDimFetch $node - * @return string[] - */ - public function processNode(Node $node, Scope $scope): array - { - $varType = $scope->getType($node->var); - if (! $varType instanceof ObjectType) { - return []; - } - - foreach (self::ALLOWED_CLASSES as $allowedClass) { - if ($varType->isInstanceOf($allowedClass)->yes()) { - return []; - } - } - - return [self::ERROR_MESSAGE]; - } - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition(self::ERROR_MESSAGE, [ - new CodeSample( - <<<'CODE_SAMPLE' -class SomeClass -{ - public function run(MagicArrayObject $magicArrayObject) - { - return $magicArrayObject['more_magic']; - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -class SomeClass -{ - public function run(MagicArrayObject $magicArrayObject) - { - return $magicArrayObject->getExplicitValue(); - } -} -CODE_SAMPLE - ), - ]); - } -} diff --git a/src/Rules/NoIssetOnObjectRule.php b/src/Rules/NoIssetOnObjectRule.php deleted file mode 100644 index 1e0c4a6b..00000000 --- a/src/Rules/NoIssetOnObjectRule.php +++ /dev/null @@ -1,127 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Empty_::class, Isset_::class]; - } - - /** - * @param Empty_|Isset_ $node - * @return string[] - */ - public function process(Node $node, Scope $scope): array - { - if ($node instanceof Isset_) { - return $this->processIsset($node, $scope); - } - - return $this->processEmpty($node, $scope); - } - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition(self::ERROR_MESSAGE, [ - new CodeSample( - <<<'CODE_SAMPLE' -class SomeClass -{ - public function run() - { - if (random_int(0, 1)) { - $object = new SomeClass(); - } - - if (isset($object)) { - return $object; - } - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -class SomeClass -{ - public function run() - { - $object = null; - if (random_int(0, 1)) { - $object = new SomeClass(); - } - - if ($object !== null) { - return $object; - } - } -} -CODE_SAMPLE - ), - ]); - } - - /** - * @return string[] - */ - private function processIsset(Isset_ $isset, Scope $scope): array - { - foreach ($isset->vars as $var) { - if ($this->shouldSkipVariable($var, $scope)) { - continue; - } - - return [self::ERROR_MESSAGE]; - } - - return []; - } - - /** - * @return string[] - */ - private function processEmpty(Empty_ $empty, Scope $scope): array - { - $expr = $empty->expr; - - if ($this->shouldSkipVariable($expr, $scope)) { - return []; - } - - return [self::ERROR_MESSAGE]; - } - - private function shouldSkipVariable(Expr $expr, Scope $scope): bool - { - if ($expr instanceof ArrayDimFetch) { - return true; - } - - $varType = $scope->getType($expr); - - return $varType->getObjectClassNames() === []; - } -} diff --git a/src/ValueObject/MethodCallReference.php b/src/ValueObject/MethodCallReference.php deleted file mode 100644 index 023b289a..00000000 --- a/src/ValueObject/MethodCallReference.php +++ /dev/null @@ -1,24 +0,0 @@ -class; - } - - public function getMethod(): string - { - return $this->method; - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/CheckTypehintCallerTypeRuleTest.php b/tests/Rules/CheckTypehintCallerTypeRule/CheckTypehintCallerTypeRuleTest.php deleted file mode 100644 index 06652c6a..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/CheckTypehintCallerTypeRuleTest.php +++ /dev/null @@ -1,67 +0,0 @@ -analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SkipDuplicatedCallOfSameMethodWithComment.php', []]; - - yield [__DIR__ . '/Fixture/SkipCorrectUnionType.php', []]; - yield [__DIR__ . '/Fixture/SkipRecursive.php', []]; - yield [__DIR__ . '/Fixture/SkipMixed.php', []]; - yield [__DIR__ . '/Fixture/SkipOptedOut.php', []]; - yield [__DIR__ . '/Fixture/SkipNotFromThis.php', []]; - - yield [__DIR__ . '/Fixture/SkipParentNotIf.php', []]; - yield [__DIR__ . '/Fixture/SkipNoArgs.php', []]; - yield [__DIR__ . '/Fixture/SkipAlreadyCorrectType.php', []]; - yield [__DIR__ . '/Fixture/SkipMayOverrideArg.php', []]; - yield [__DIR__ . '/Fixture/SkipMultipleUsed.php', []]; - yield [__DIR__ . '/Fixture/SkipNotPrivate.php', []]; - - $errorMessage = sprintf(CheckTypehintCallerTypeRule::ERROR_MESSAGE, 1, MethodCall::class); - yield [__DIR__ . '/Fixture/Fixture.php', [[$errorMessage, 19]]]; - yield [__DIR__ . '/Fixture/DifferentClassSameMethodCallName.php', [[$errorMessage, 25]]]; - - $argErrorMessage = sprintf(CheckTypehintCallerTypeRule::ERROR_MESSAGE, 1, Arg::class); - $paramErrorMessage = sprintf(CheckTypehintCallerTypeRule::ERROR_MESSAGE, 2, Param::class); - yield [__DIR__ . '/Fixture/DoubleShot.php', [[$argErrorMessage, 15], [$paramErrorMessage, 15]]]; - yield [__DIR__ . '/Fixture/SkipGenericType.php', []]; - yield [__DIR__ . '/Fixture/SkipAbstractBase.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(CheckTypehintCallerTypeRule::class); - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/DifferentClassSameMethodCallName.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/DifferentClassSameMethodCallName.php deleted file mode 100644 index b915601b..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/DifferentClassSameMethodCallName.php +++ /dev/null @@ -1,31 +0,0 @@ -run($anotherClassWithRun); - } - - /** - * @param SomeStaticCall|MethodCall $node - */ - private function run(Node $node) - { - if ($node->name instanceof MethodCall) { - $this->run($node->name); - } - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/DoubleShot.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/DoubleShot.php deleted file mode 100644 index 189b34b1..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/DoubleShot.php +++ /dev/null @@ -1,18 +0,0 @@ -isCheck($arg, $param); - } - private function isCheck(\PhpParser\Node $arg, \PhpParser\Node $param) - { - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/Fixture.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/Fixture.php deleted file mode 100644 index d018bc45..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/Fixture.php +++ /dev/null @@ -1,22 +0,0 @@ -isCheck($node); - } - } - - private function isCheck(Node $node) - { - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipAbstractBase.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipAbstractBase.php deleted file mode 100644 index 50436649..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipAbstractBase.php +++ /dev/null @@ -1,16 +0,0 @@ -isCheck($arg); - } - private function isCheck(ConceptBase $arg) - { - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipAlreadyCorrectType.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipAlreadyCorrectType.php deleted file mode 100644 index 02afd973..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipAlreadyCorrectType.php +++ /dev/null @@ -1,22 +0,0 @@ -isCheck($node); - } - } - - private function isCheck(MethodCall $node) - { - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipCorrectUnionType.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipCorrectUnionType.php deleted file mode 100644 index d65fe635..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipCorrectUnionType.php +++ /dev/null @@ -1,32 +0,0 @@ -isIncludeOnceOrRequireOnce($node)) { - return []; - } - - return []; - } - - /** - * @param Assign|Return_ $node - */ - private function isIncludeOnceOrRequireOnce(\PhpParser\Node $node) - { - return true; - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipDuplicatedCallOfSameMethodWithComment.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipDuplicatedCallOfSameMethodWithComment.php deleted file mode 100644 index a639dd02..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipDuplicatedCallOfSameMethodWithComment.php +++ /dev/null @@ -1,26 +0,0 @@ -printFile(new FileWithoutNamespace([])); - } - - private function printFile(\PhpParser\Node $node) - { - } - - public function secondMethod() - { - // some comment - $this->printFile(new FileNode([])); - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipGenericType.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipGenericType.php deleted file mode 100644 index 431d5019..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipGenericType.php +++ /dev/null @@ -1,31 +0,0 @@ -getsAGeneric($node); - } - - /** - * @param T $node - * @return void - */ - private function getsAGeneric(Node $node) - { - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipMayOverrideArg.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipMayOverrideArg.php deleted file mode 100644 index f6ad3ced..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipMayOverrideArg.php +++ /dev/null @@ -1,27 +0,0 @@ -mayOverrideNode(); - - $this->isCheck($node); - - } - } - - private function isCheck(Node $node) - { - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipMixed.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipMixed.php deleted file mode 100644 index b82eca26..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipMixed.php +++ /dev/null @@ -1,18 +0,0 @@ -isCheck($arg); - } - private function isCheck(\PhpParser\Node $arg) - { - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipMultipleUsed.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipMultipleUsed.php deleted file mode 100644 index df663df6..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipMultipleUsed.php +++ /dev/null @@ -1,27 +0,0 @@ -isCheck($node); - } - - if ($node instanceof PropertyFetch) { - $this->isCheck($node); - } - } - - private function isCheck(Node $node) - { - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipNoArgs.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipNoArgs.php deleted file mode 100644 index c308ec73..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipNoArgs.php +++ /dev/null @@ -1,15 +0,0 @@ -execute(); - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipNotFromThis.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipNotFromThis.php deleted file mode 100644 index 5fc6fa71..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipNotFromThis.php +++ /dev/null @@ -1,14 +0,0 @@ -format('Y-m-d'); - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipNotPrivate.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipNotPrivate.php deleted file mode 100644 index 54dcfea8..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipNotPrivate.php +++ /dev/null @@ -1,22 +0,0 @@ -isCheckNotPrivate($node); - } - } - - public function isCheckNotPrivate(Node $node) - { - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipOptedOut.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipOptedOut.php deleted file mode 100644 index 6c6091e5..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipOptedOut.php +++ /dev/null @@ -1,23 +0,0 @@ -isCheck($type); - } - - private function isCheck(\PHPStan\Type\Type $type) - { - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipParentNotIf.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipParentNotIf.php deleted file mode 100644 index 455b9ee9..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipParentNotIf.php +++ /dev/null @@ -1,15 +0,0 @@ -execute($node); - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipRecursive.php b/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipRecursive.php deleted file mode 100644 index 192a14c6..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Fixture/SkipRecursive.php +++ /dev/null @@ -1,30 +0,0 @@ -run($node); - } - - /** - * @param SomeStaticCall|MethodCall $node - */ - private function run(Node $node) - { - if ($node->name instanceof MethodCall) { - $this->run($node->name); - } - } -} diff --git a/tests/Rules/CheckTypehintCallerTypeRule/Source/AnotherClassWithRun.php b/tests/Rules/CheckTypehintCallerTypeRule/Source/AnotherClassWithRun.php deleted file mode 100644 index 24f6228f..00000000 --- a/tests/Rules/CheckTypehintCallerTypeRule/Source/AnotherClassWithRun.php +++ /dev/null @@ -1,15 +0,0 @@ -$magic(); - } -} diff --git a/tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/SkipKnownCallerType.php b/tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/SkipKnownCallerType.php deleted file mode 100644 index c655b48b..00000000 --- a/tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/SkipKnownCallerType.php +++ /dev/null @@ -1,15 +0,0 @@ -call(); - } -} diff --git a/tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/SkipMockObject.php b/tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/SkipMockObject.php deleted file mode 100644 index 169f00c8..00000000 --- a/tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/SkipMockObject.php +++ /dev/null @@ -1,19 +0,0 @@ -createMock(MagicMethodName::class); - - $mock - ->method('run') - ->willReturn(true); - } -} diff --git a/tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/UnknownCallerType.php b/tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/UnknownCallerType.php deleted file mode 100644 index adbf92c7..00000000 --- a/tests/Rules/Explicit/NoMixedMethodCallerRule/Fixture/UnknownCallerType.php +++ /dev/null @@ -1,13 +0,0 @@ -call(); - } -} diff --git a/tests/Rules/Explicit/NoMixedMethodCallerRule/NoMixedMethodCallerRuleTest.php b/tests/Rules/Explicit/NoMixedMethodCallerRule/NoMixedMethodCallerRuleTest.php deleted file mode 100644 index 42d767dc..00000000 --- a/tests/Rules/Explicit/NoMixedMethodCallerRule/NoMixedMethodCallerRuleTest.php +++ /dev/null @@ -1,48 +0,0 @@ -> $expectedErrorsWithLines - */ - #[DataProvider('provideData')] - public function testRule(string $filePath, array $expectedErrorsWithLines): void - { - $this->analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SkipKnownCallerType.php', []]; - yield [__DIR__ . '/Fixture/SkipMockObject.php', []]; - - $errorMessage = sprintf(NoMixedMethodCallerRule::ERROR_MESSAGE, '$someType'); - yield [__DIR__ . '/Fixture/MagicMethodName.php', [[$errorMessage, 11]]]; - - $errorMessage = sprintf(NoMixedMethodCallerRule::ERROR_MESSAGE, '$mixedType'); - yield [__DIR__ . '/Fixture/UnknownCallerType.php', [[$errorMessage, 11]]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoMixedMethodCallerRule::class); - } -} diff --git a/tests/Rules/Explicit/NoMixedMethodCallerRule/Source/KnownType.php b/tests/Rules/Explicit/NoMixedMethodCallerRule/Source/KnownType.php deleted file mode 100644 index 0a8907b4..00000000 --- a/tests/Rules/Explicit/NoMixedMethodCallerRule/Source/KnownType.php +++ /dev/null @@ -1,12 +0,0 @@ -{$name}; - } -} diff --git a/tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/SkipDynamicNameWithKnownType.php b/tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/SkipDynamicNameWithKnownType.php deleted file mode 100644 index 8ffba3b0..00000000 --- a/tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/SkipDynamicNameWithKnownType.php +++ /dev/null @@ -1,15 +0,0 @@ -{$name}; - } -} diff --git a/tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/SkipKnownFetcherType.php b/tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/SkipKnownFetcherType.php deleted file mode 100644 index 588d7930..00000000 --- a/tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/SkipKnownFetcherType.php +++ /dev/null @@ -1,15 +0,0 @@ -name; - } -} diff --git a/tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/UnknownPropertyFetcher.php b/tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/UnknownPropertyFetcher.php deleted file mode 100644 index 7e40c237..00000000 --- a/tests/Rules/Explicit/NoMixedPropertyFetcherRule/Fixture/UnknownPropertyFetcher.php +++ /dev/null @@ -1,13 +0,0 @@ -name; - } -} diff --git a/tests/Rules/Explicit/NoMixedPropertyFetcherRule/NoMixedPropertyFetcherRuleTest.php b/tests/Rules/Explicit/NoMixedPropertyFetcherRule/NoMixedPropertyFetcherRuleTest.php deleted file mode 100644 index 54a2018f..00000000 --- a/tests/Rules/Explicit/NoMixedPropertyFetcherRule/NoMixedPropertyFetcherRuleTest.php +++ /dev/null @@ -1,48 +0,0 @@ -> $expectedErrorsWithLines - */ - #[DataProvider('provideData')] - public function testRule(string $filePath, array $expectedErrorsWithLines): void - { - $this->analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SkipDynamicNameWithKnownType.php', []]; - yield [__DIR__ . '/Fixture/SkipKnownFetcherType.php', []]; - - $message = sprintf(NoMixedPropertyFetcherRule::ERROR_MESSAGE, '$unknownType'); - yield [__DIR__ . '/Fixture/DynamicName.php', [[$message, 13]]]; - - $message = sprintf(NoMixedPropertyFetcherRule::ERROR_MESSAGE, '$unknownType'); - yield [__DIR__ . '/Fixture/UnknownPropertyFetcher.php', [[$message, 11]]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoMixedPropertyFetcherRule::class); - } -} diff --git a/tests/Rules/Explicit/NoMixedPropertyFetcherRule/Source/KnownType.php b/tests/Rules/Explicit/NoMixedPropertyFetcherRule/Source/KnownType.php deleted file mode 100644 index b99e5da7..00000000 --- a/tests/Rules/Explicit/NoMixedPropertyFetcherRule/Source/KnownType.php +++ /dev/null @@ -1,10 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SkipSpecificReturnType.php', []]; - yield [__DIR__ . '/Fixture/SkipSomeContract.php', []]; - - $errorMessage = sprintf(RequireSpecificReturnTypeOverAbstractRule::ERROR_MESSAGE, SpecificControl::class); - yield [__DIR__ . '/Fixture/SomeAbstractReturnType.php', [[$errorMessage, 12]]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(RequireSpecificReturnTypeOverAbstractRule::class); - } -} diff --git a/tests/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule/Source/AbstractControl.php b/tests/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule/Source/AbstractControl.php deleted file mode 100644 index 7eba6f80..00000000 --- a/tests/Rules/Explicit/RequireSpecificReturnTypeOverAbstractRule/Source/AbstractControl.php +++ /dev/null @@ -1,9 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SkipPhpDocType.php', []]; - yield [__DIR__ . '/Fixture/SkipPresentType.php', []]; - yield [__DIR__ . '/Fixture/SkipNoType.php', []]; - - yield [__DIR__ . '/Fixture/SkipIndirectRemoval.php', []]; - - yield [__DIR__ . '/Fixture/RemoveParentType.php', [[ForbiddenParamTypeRemovalRule::ERROR_MESSAGE, 11]]]; - - yield [__DIR__ . '/Fixture/SkipNoParent.php', []]; - yield [__DIR__ . '/Fixture/SkipNotHasParentMethod.php', []]; - yield [__DIR__ . '/Fixture/SkipHasSameParameterWithParentMethod.php', []]; - yield [__DIR__ . '/Fixture/SkipHasSameParameterWithInterfaceMethod.php', []]; - - yield [ - __DIR__ . '/Fixture/HasDifferentParameterWithParentMethod.php', - [[ForbiddenParamTypeRemovalRule::ERROR_MESSAGE, 9]], - ]; - yield [ - __DIR__ . '/Fixture/HasDifferentParameterWithInterfaceMethod.php', - [[ForbiddenParamTypeRemovalRule::ERROR_MESSAGE, 9], [ - ForbiddenParamTypeRemovalRule::ERROR_MESSAGE, - 13, - ]], - ]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(ForbiddenParamTypeRemovalRule::class); - } -} diff --git a/tests/Rules/ForbiddenParamTypeRemovalRule/Source/NoTypeInterface.php b/tests/Rules/ForbiddenParamTypeRemovalRule/Source/NoTypeInterface.php deleted file mode 100644 index aeeccbf3..00000000 --- a/tests/Rules/ForbiddenParamTypeRemovalRule/Source/NoTypeInterface.php +++ /dev/null @@ -1,10 +0,0 @@ -callMe(...); - - $someCalledMethod->callMe(1000); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/FirstClassCallables/SomeCalledMethod.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/FirstClassCallables/SomeCalledMethod.php deleted file mode 100644 index 0ac659b3..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/FirstClassCallables/SomeCalledMethod.php +++ /dev/null @@ -1,12 +0,0 @@ -class - : $obj->var; - } - - public function runTernaryFlipped(StaticCall|MethodCall $obj) - { - return $obj instanceof MethodCall - ? $obj->var - : $obj->class; - } - - /** - * @param Node[]|Node $node - */ - public function runArrayTyped(array | Node $node) - { - } - - /** - * @param array|Node $node - */ - public function runArrayTyped2(array | Node $node) - { - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipExpectedClassType.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipExpectedClassType.php deleted file mode 100644 index a999b186..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipExpectedClassType.php +++ /dev/null @@ -1,14 +0,0 @@ -callMe(1000); - } - - private function callMe($number) - { - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipNullableCompare.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipNullableCompare.php deleted file mode 100644 index b0f7bf95..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/SkipNullableCompare.php +++ /dev/null @@ -1,14 +0,0 @@ -run(new DateTime('now')); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/ThisPassedFromInterface.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/ThisPassedFromInterface.php deleted file mode 100644 index 8203b416..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Fixture/ThisPassedFromInterface.php +++ /dev/null @@ -1,14 +0,0 @@ -analyse($filePaths, $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [[__DIR__ . '/Fixture/SkipNonPublicClassMethod.php'], []]; - - // skip first class callables as anything can be passed there - yield [[ - __DIR__ . '/Fixture/FirstClassCallables/CallVariadics.php', - __DIR__ . '/Fixture/FirstClassCallables/SomeCalledMethod.php', - ], []]; - - // skip expected scalar type - yield [[ - __DIR__ . '/Fixture/SkipProperlyFilledParamType.php', - __DIR__ . '/Source/ExpectedType/FirstTypedCaller.php', - __DIR__ . '/Source/ExpectedType/SecondTypedCaller.php', - ], []]; - - // skip expected object type - yield [[ - __DIR__ . '/Fixture/SkipExpectedClassType.php', - __DIR__ . '/Source/ExpectedClassType/FirstClassTypedCaller.php', - __DIR__ . '/Source/ExpectedClassType/SecondClassTypedCaller.php', - ], []]; - - // skip class-string - yield [[ - __DIR__ . '/Fixture/SkipClassStringPassed.php', - __DIR__ . '/Source/ExpectedClassString/FirstTypedCaller.php', - __DIR__ . '/Source/ExpectedClassString/SecondTypedCaller.php', - ], []]; - - // skip everything in case of values is mixed - yield [[ - __DIR__ . '/Fixture/SkipMixedAndString.php', - __DIR__ . '/Source/MixedAndString/FirstCaller.php', - __DIR__ . '/Source/MixedAndString/SecondCaller.php', - ], []]; - - // skip int + string values - yield [[ - __DIR__ . '/Fixture/SkipMixedAndString.php', - __DIR__ . '/Source/MixedAndString/FirstCaller.php', - __DIR__ . '/Source/MixedAndString/ThirdCaller.php', - ], []]; - - // skip nullable compare - yield [[ - __DIR__ . '/Fixture/SkipNullableCompare.php', - __DIR__ . '/Source/NullableParam/FirstNullable.php', - __DIR__ . '/Source/NullableParam/SecondNullable.php', - ], []]; - - // skip api - yield [[ - __DIR__ . '/Fixture/SkipApiMarked.php', - __DIR__ . '/Source/ExpectedNodeApi/CallWithProperty.php', - ], []]; - - // skip equal union type - yield [[ - __DIR__ . '/Fixture/SkipEqualUnionType.php', - __DIR__ . '/Source/ExpectedUnion/CallUnionType.php', - ], []]; - - // skip equal union type flipped - yield [[ - __DIR__ . '/Fixture/SkipEqualUnionType.php', - __DIR__ . '/Source/ExpectedUnion/CallUnionTypeFlipped.php', - ], []]; - - // skip equal union type ternary if else - yield [[ - __DIR__ . '/Fixture/SkipEqualUnionType.php', - __DIR__ . '/Source/ExpectedUnion/CallUnionTypeTernaryIfElse.php', - ], []]; - - // skip equal union type ternary if else flipped - yield [[ - __DIR__ . '/Fixture/SkipEqualUnionType.php', - __DIR__ . '/Source/ExpectedUnion/CallUnionTypeTernaryIfElseFlipped.php', - ], []]; - - // skip equal union type array typed - yield [[ - __DIR__ . '/Fixture/SkipEqualUnionType.php', - __DIR__ . '/Source/ExpectedUnion/CallUnionArrayType.php', - ], []]; - - // skip this passed exact type - yield [[ - __DIR__ . '/Fixture/SkipThisPassedExactType.php', - __DIR__ . '/Source/ExpectedThisType/CallByThis.php', - ], []]; - - // skip used internally for second type - yield [[ - __DIR__ . '/Fixture/SkipUsedInternallyForSecondType.php', - __DIR__ . '/Source/ExpectedType/OnlyFirstTypeCalledOutside.php', - ], []]; - - $argErrorMessage = sprintf(NarrowPublicClassMethodParamTypeByCallerTypeRule::ERROR_MESSAGE, 'int'); - yield [[ - __DIR__ . '/Fixture/PublicDoubleShot.php', - __DIR__ . '/Source/FirstCaller.php', - __DIR__ . '/Source/SecondCaller.php', - ], [[$argErrorMessage, 9]]]; - - // this passed from interface - $argErrorMessage = sprintf( - NarrowPublicClassMethodParamTypeByCallerTypeRule::ERROR_MESSAGE, - CallByThisFromInterface::class - ); - yield [[ - __DIR__ . '/Fixture/ThisPassedFromInterface.php', - __DIR__ . '/Source/ExpectedThisType/CallByThisFromInterface.php', - ], [[$argErrorMessage, 11]]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NarrowPublicClassMethodParamTypeByCallerTypeRule::class); - } - - /** - * Warning, just spent hour looking for why the test does not run :D This should be implicit part of the parent - * class. - * - * @return Collector[] - */ - protected function getCollectors(): array - { - return self::getContainer()->getServicesByTag('phpstan.collector'); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassString/FirstTypedCaller.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassString/FirstTypedCaller.php deleted file mode 100644 index 87ae41d6..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassString/FirstTypedCaller.php +++ /dev/null @@ -1,17 +0,0 @@ -resolve($classReflection->getName()); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassString/SecondTypedCaller.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassString/SecondTypedCaller.php deleted file mode 100644 index 3ddaf19e..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassString/SecondTypedCaller.php +++ /dev/null @@ -1,17 +0,0 @@ -resolve($classReflection->getName()); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassType/FirstClassTypedCaller.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassType/FirstClassTypedCaller.php deleted file mode 100644 index 7559c85d..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassType/FirstClassTypedCaller.php +++ /dev/null @@ -1,17 +0,0 @@ -callMeWithClassType($knownType); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassType/SecondClassTypedCaller.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassType/SecondClassTypedCaller.php deleted file mode 100644 index 2115fb45..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedClassType/SecondClassTypedCaller.php +++ /dev/null @@ -1,17 +0,0 @@ -callMeWithClassType($knownType); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedNodeApi/CallWithProperty.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedNodeApi/CallWithProperty.php deleted file mode 100644 index 953fc231..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedNodeApi/CallWithProperty.php +++ /dev/null @@ -1,17 +0,0 @@ -callNode($property); - } - -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedThisType/CallByThis.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedThisType/CallByThis.php deleted file mode 100644 index 25550ad7..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedThisType/CallByThis.php +++ /dev/null @@ -1,15 +0,0 @@ -run($this); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedThisType/CallByThisFromInterface.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedThisType/CallByThisFromInterface.php deleted file mode 100644 index 43c47ccb..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedThisType/CallByThisFromInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -run($this); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedType/FirstTypedCaller.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedType/FirstTypedCaller.php deleted file mode 100644 index d8e8f8f0..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedType/FirstTypedCaller.php +++ /dev/null @@ -1,15 +0,0 @@ -callMeTwice(100); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedType/OnlyFirstTypeCalledOutside.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedType/OnlyFirstTypeCalledOutside.php deleted file mode 100644 index 6f87ec43..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedType/OnlyFirstTypeCalledOutside.php +++ /dev/null @@ -1,16 +0,0 @@ -run(new stdClass()); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedType/SecondTypedCaller.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedType/SecondTypedCaller.php deleted file mode 100644 index f3e4b63b..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedType/SecondTypedCaller.php +++ /dev/null @@ -1,15 +0,0 @@ -callMeTwice(100); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionArrayType.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionArrayType.php deleted file mode 100644 index f6e620ef..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionArrayType.php +++ /dev/null @@ -1,31 +0,0 @@ -runArrayTyped($node); - } - - public function run2(SkipEqualUnionType $skipEqualUnionType, Node $node): void - { - /** @var Node[]|Node $node */ - $node = rand(0, 1) - ? $node - : [$node]; - - $skipEqualUnionType->runArrayTyped2($node); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionType.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionType.php deleted file mode 100644 index fd0997b2..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionType.php +++ /dev/null @@ -1,22 +0,0 @@ -run($value); - } - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionTypeFlipped.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionTypeFlipped.php deleted file mode 100644 index 3d11e4b7..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionTypeFlipped.php +++ /dev/null @@ -1,22 +0,0 @@ -run($value); - } - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionTypeTernaryIfElse.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionTypeTernaryIfElse.php deleted file mode 100644 index 06b448a2..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionTypeTernaryIfElse.php +++ /dev/null @@ -1,22 +0,0 @@ -runTernary($value); - } - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionTypeTernaryIfElseFlipped.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionTypeTernaryIfElseFlipped.php deleted file mode 100644 index 44354627..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/ExpectedUnion/CallUnionTypeTernaryIfElseFlipped.php +++ /dev/null @@ -1,22 +0,0 @@ -runTernaryFlipped($value); - } - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/FirstCaller.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/FirstCaller.php deleted file mode 100644 index 96b2d77d..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/FirstCaller.php +++ /dev/null @@ -1,15 +0,0 @@ -callMeTwice(100); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/MixedAndString/FirstCaller.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/MixedAndString/FirstCaller.php deleted file mode 100644 index 34668e2a..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/MixedAndString/FirstCaller.php +++ /dev/null @@ -1,15 +0,0 @@ -resolve('string'); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/MixedAndString/SecondCaller.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/MixedAndString/SecondCaller.php deleted file mode 100644 index 45aebda1..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/MixedAndString/SecondCaller.php +++ /dev/null @@ -1,15 +0,0 @@ -resolve($mixedValue); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/MixedAndString/ThirdCaller.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/MixedAndString/ThirdCaller.php deleted file mode 100644 index 7a45e1d0..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/MixedAndString/ThirdCaller.php +++ /dev/null @@ -1,15 +0,0 @@ -resolve(1000); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/NullableParam/FirstNullable.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/NullableParam/FirstNullable.php deleted file mode 100644 index c1fae48d..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/NullableParam/FirstNullable.php +++ /dev/null @@ -1,16 +0,0 @@ -callNode($node); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/NullableParam/SecondNullable.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/NullableParam/SecondNullable.php deleted file mode 100644 index 45ebf77a..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/NullableParam/SecondNullable.php +++ /dev/null @@ -1,16 +0,0 @@ -callNode($node); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/PassMeAsType.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/PassMeAsType.php deleted file mode 100644 index 68b73bff..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/PassMeAsType.php +++ /dev/null @@ -1,10 +0,0 @@ -callMeTwice(100); - } -} diff --git a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/SomeInterface.php b/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/SomeInterface.php deleted file mode 100644 index 2cc7e62f..00000000 --- a/tests/Rules/NarrowType/NarrowPublicClassMethodParamTypeByCallerTypeRule/Source/SomeInterface.php +++ /dev/null @@ -1,8 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [ - __DIR__ . '/Fixture/ReturnFalseOnly.php', - [[NoReturnFalseInNonBoolClassMethodRule::ERROR_MESSAGE, 9]], - ]; - - yield [__DIR__ . '/Fixture/SkipReturnBool.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [ - __DIR__ . '/config/configured_rule.neon', - ]; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoReturnFalseInNonBoolClassMethodRule::class); - } -} diff --git a/tests/Rules/NarrowType/NoReturnFalseInNonBoolClassMethodRule/config/configured_rule.neon b/tests/Rules/NarrowType/NoReturnFalseInNonBoolClassMethodRule/config/configured_rule.neon deleted file mode 100644 index 9ba875e7..00000000 --- a/tests/Rules/NarrowType/NoReturnFalseInNonBoolClassMethodRule/config/configured_rule.neon +++ /dev/null @@ -1,2 +0,0 @@ -rules: - - Symplify\PHPStanRules\Rules\NarrowType\NoReturnFalseInNonBoolClassMethodRule diff --git a/tests/Rules/NoArrayAccessOnObjectRule/Fixture/ArrayAccessOnNestedObject.php b/tests/Rules/NoArrayAccessOnObjectRule/Fixture/ArrayAccessOnNestedObject.php deleted file mode 100644 index c929dad1..00000000 --- a/tests/Rules/NoArrayAccessOnObjectRule/Fixture/ArrayAccessOnNestedObject.php +++ /dev/null @@ -1,16 +0,0 @@ -children() as $name => $childElement) { - return isset($childElement['some']); - } - } -} diff --git a/tests/Rules/NoArrayAccessOnObjectRule/NoArrayAccessOnObjectRuleTest.php b/tests/Rules/NoArrayAccessOnObjectRule/NoArrayAccessOnObjectRuleTest.php deleted file mode 100644 index 8a8343fc..00000000 --- a/tests/Rules/NoArrayAccessOnObjectRule/NoArrayAccessOnObjectRuleTest.php +++ /dev/null @@ -1,48 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/ArrayAccessOnObject.php', [[NoArrayAccessOnObjectRule::ERROR_MESSAGE, 14]]]; - yield [__DIR__ . '/Fixture/ArrayAccessOnNestedObject.php', [[NoArrayAccessOnObjectRule::ERROR_MESSAGE, 14]]]; - - yield [__DIR__ . '/Fixture/SkipIterator.php', []]; - yield [__DIR__ . '/Fixture/SkipOnArray.php', []]; - yield [__DIR__ . '/Fixture/SkipSplFixedArray.php', []]; - yield [__DIR__ . '/Fixture/SkipXml.php', []]; - yield [__DIR__ . '/Fixture/SkipXmlElementForeach.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoArrayAccessOnObjectRule::class); - } -} diff --git a/tests/Rules/NoArrayAccessOnObjectRule/Source/ChildOfSomeClassWithArrayAccess.php b/tests/Rules/NoArrayAccessOnObjectRule/Source/ChildOfSomeClassWithArrayAccess.php deleted file mode 100644 index 4d59b53d..00000000 --- a/tests/Rules/NoArrayAccessOnObjectRule/Source/ChildOfSomeClassWithArrayAccess.php +++ /dev/null @@ -1,9 +0,0 @@ -args[9])) { - return $methodCall->args[9]; - } - } -} diff --git a/tests/Rules/NoIssetOnObjectRule/NoIssetOnObjectRuleTest.php b/tests/Rules/NoIssetOnObjectRule/NoIssetOnObjectRuleTest.php deleted file mode 100644 index a39ec0e3..00000000 --- a/tests/Rules/NoIssetOnObjectRule/NoIssetOnObjectRuleTest.php +++ /dev/null @@ -1,44 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/IssetOnObject.php', [[NoIssetOnObjectRule::ERROR_MESSAGE, 17]]]; - - yield [__DIR__ . '/Fixture/SkipIssetOnArray.php', []]; - yield [__DIR__ . '/Fixture/SkipIssetOnArrayNestedOnObject.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoIssetOnObjectRule::class); - } -} diff --git a/tests/Rules/NoIssetOnObjectRule/config/configured_rule.neon b/tests/Rules/NoIssetOnObjectRule/config/configured_rule.neon deleted file mode 100644 index 753ee29d..00000000 --- a/tests/Rules/NoIssetOnObjectRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\NoIssetOnObjectRule