From c117396f4d7fe30704233c033244114e0fbea3f0 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 23 Aug 2024 09:02:23 +0000 Subject: [PATCH] release PHP 7.2 downgraded --- .editorconfig | 9 --- .../workflows/standalone_install.yaml | 0 build/rector-downgrade-php-72.php | 23 ------ build/target-repository/.github/FUNDING.yml | 3 - build/target-repository/composer.json | 24 ------ .../target-repository/phpstan-for-tests.neon | 9 --- .../target-repository/tests/SomeClass.php.inc | 13 ---- composer.json | 47 +----------- ecs.php | 18 ----- full-tool-build.sh | 15 ---- phpstan.neon | 54 -------------- phpunit.xml | 7 -- rector.php | 41 ----------- src/Composer/ClassNamespaceMatcher.php | 13 +++- .../PhpDocNodeVisitorInterface.php | 7 +- src/Location/DirectoryChecker.php | 2 +- src/Naming/ClassToSuffixResolver.php | 8 +- src/NodeAnalyzer/AttributeFinder.php | 13 +++- src/NodeAnalyzer/EnumAnalyzer.php | 13 +++- src/NodeFinder/TypeAwareNodeFinder.php | 10 ++- .../SimpleCallableNodeTraverser.php | 4 +- src/NodeVisitor/CallableNodeVisitor.php | 5 +- .../HasScopedReturnNodeVisitor.php | 15 +++- src/ParentClassMethodNodeResolver.php | 22 ++++-- src/PhpDoc/BarePhpDocParser.php | 18 ++++- src/PhpDoc/PhpDocResolver.php | 11 ++- src/PhpDocParser/PhpDocNodeTraverser.php | 4 +- .../AbstractPhpDocNodeVisitor.php | 7 +- .../CallablePhpDocNodeVisitor.php | 13 +++- src/Reflection/ReflectionParser.php | 30 ++++++-- src/Rules/AbstractSymplifyRule.php | 2 +- ...notateRegexClassConstWithRegexLinkRule.php | 6 +- .../CheckClassNamespaceFollowPsr4Rule.php | 20 ++++- ...quiredInterfaceInContractNamespaceRule.php | 2 +- .../ClassNameRespectsParentSuffixRule.php | 18 +++-- .../ForbiddenArrayMethodCallRule.php | 2 +- .../Domain/RequireAttributeNamespaceRule.php | 4 +- .../Domain/RequireExceptionNamespaceRule.php | 4 +- .../Enum/RequireUniqueEnumConstantRule.php | 13 +++- .../ExplicitClassPrefixSuffixRule.php | 16 ++-- .../ForbiddenExtendOfNonAbstractClassRule.php | 4 +- src/Rules/ForbiddenFuncCallRule.php | 27 +++++-- ...orbiddenMultipleClassLikeInOneFileRule.php | 8 +- src/Rules/ForbiddenNodeRule.php | 12 ++- .../ForbiddenStaticClassConstFetchRule.php | 2 +- src/Rules/NoDynamicNameRule.php | 11 ++- .../NoEntityOutsideEntityNamespaceRule.php | 2 +- src/Rules/NoGlobalConstRule.php | 2 +- src/Rules/NoInlineStringRegexRule.php | 20 +++-- src/Rules/NoReferenceRule.php | 11 ++- src/Rules/NoReturnArrayVariableListRule.php | 17 +++-- src/Rules/NoReturnSetterMethodRule.php | 13 +++- .../NoSingleInterfaceImplementerRule.php | 13 +++- src/Rules/PHPUnit/NoTestMocksRule.php | 13 +++- src/Rules/PreferredClassRule.php | 24 +++--- ...ventParentMethodVisibilityOverrideRule.php | 13 +++- .../NoInstanceOfStaticReflectionRule.php | 5 +- .../Rector/NoLeadingBackslashInNameRule.php | 2 +- ...PhpUpgradeDowngradeRegisteredInSetRule.php | 2 +- ...deImplementsMinPhpVersionInterfaceRule.php | 2 +- ...reAssertConfigureValueObjectRectorRule.php | 6 +- src/Rules/RegexSuffixInRegexConstantRule.php | 22 ++++-- src/Rules/RequireAttributeNameRule.php | 4 +- src/Rules/SeeAnnotationToTestRule.php | 27 +++++-- src/Rules/UppercaseConstantRule.php | 2 +- .../SymfonyControllerAnalyzer.php | 2 +- .../Rules/RequireInvokableControllerRule.php | 2 +- .../ClassNamespaceAndDirectory.php | 25 +++++-- .../Configuration/RequiredWithMessage.php | 18 ++++- tests/Composer/Psr4PathValidatorTest.php | 64 ---------------- tests/Naming/ClassToSuffixResolverTest.php | 39 ---------- .../NodeGetAttributeTypeExtensionTest.php | 34 --------- .../config/type_extension.neon | 5 -- .../data/get_parent_node.php.inc | 11 --- ...teRegexClassConstWithRegexLinkRuleTest.php | 49 ------------- .../Fixture/ClassConstMissingLink.php | 13 ---- .../Fixture/SkipAlphabet.php | 13 ---- .../Fixture/SkipPlaceholder.php | 13 ---- .../Fixture/SkipShort.php | 13 ---- .../Fixture/SkipWithLink.php | 14 ---- .../config/configured_rule.neon | 5 -- .../CheckClassNamespaceFollowPsr4RuleTest.php | 58 --------------- .../Fixture/InvalidNamespaceClass.php | 10 --- .../Fixture/InvalidNamespaceInterface.php | 10 --- .../Fixture/InvalidNamespaceTrait.php | 10 --- .../Fixture/MissingFixtureNamespaceClass.php | 10 --- .../Fixture/SkipAnonymousClass.php | 15 ---- .../Fixture/SkipValidNamespaceInterface.php | 10 --- .../Fixture/ValidNamespaceTrait.php | 10 --- .../config/configured_rule.neon | 5 -- ...edInterfaceInContractNamespaceRuleTest.php | 45 ------------ .../Fixture/AnInterfaceNotInContract.php | 10 --- .../Contract/SkipInterfaceInContract.php | 9 --- .../Illuminate/Contracts/View/View.php | 9 --- .../config/configured_rule.neon | 5 -- .../ClassNameRespectsParentSuffixRuleTest.php | 55 -------------- .../Fixture/NonTestSuffix.php | 11 --- .../Fixture/SkipAbstractTestCase.php | 11 --- .../Fixture/SkipAnonymousClass.php | 17 ----- .../Fixture/SkipCommand.php | 11 --- .../Fixture/SkipFixer.php | 11 --- .../Fixture/SkipSomeEventSubscriber.php | 14 ---- .../Fixture/SkipTest.php | 11 --- .../Fixture/SomeController.php | 11 --- .../Fixture/SomeEventSubscriberFalse.php | 14 ---- .../Source/SuperFixerInterface.php | 10 --- .../config/configured_rule.neon | 5 -- .../Fixture/ReturnCallable.php | 17 ----- .../Fixture/SkipNormalArray.php | 13 ---- .../ForbiddenArrayMethodCallRuleTest.php | 42 ----------- .../config/configured_rule.neon | 5 -- .../Attribute/SkipCorrectAttribute.php | 10 --- .../Fixture/MisslocatedAttribute.php | 10 --- .../RequireAttributeNamespaceRuleTest.php | 42 ----------- .../config/configured_rule.neon | 5 -- .../Exception/SkipCorrectException.php | 11 --- .../Fixture/MisslocatedException.php | 11 --- .../RequireExceptionNamespaceRuleTest.php | 42 ----------- .../config/configured_rule.neon | 5 -- .../Fixture/InvalidAnnotationEnum.php | 15 ---- .../Fixture/InvalidEnum.php | 15 ---- .../Fixture/SkipValidEnum.php | 14 ---- .../RequireUniqueEnumConstantRuleTest.php | 45 ------------ .../config/configured_rule.neon | 5 -- .../ExplicitClassPrefixSuffixRuleTest.php | 63 ---------------- .../Fixture/AbstractCorrectClass.php | 8 -- .../Fixture/AbstractIncorrectClass.php | 8 -- .../Fixture/CorrectInterface.php | 8 -- .../Fixture/CorrectTrait.php | 8 -- .../Fixture/IncorrectClassInterface.php | 8 -- .../Fixture/WrongInterfaceSuffix.php | 7 -- .../Fixture/WrongSuffixTrait.php | 7 -- .../Fixture/WrongTraitSuffix.php | 7 -- .../config/configured_rule.neon | 5 -- .../ClassExtendingNonAbstractClass.php | 11 --- .../Fixture/SkipAnonymousExtend.php | 15 ---- .../SkipClassExtendingAbstractClass.php | 11 --- .../Fixture/SkipException.php | 9 --- .../Fixture/SkipVendorBasedClasses.php | 11 --- ...biddenExtendOfNonAbstractClassRuleTest.php | 48 ------------ .../Source/NonAbstractClass.php | 9 --- .../Source/SimpleAbstractClass.php | 9 --- .../config/configured_rule.neon | 5 -- .../Fixture/CurlCall.php | 13 ---- .../Fixture/DebugFuncCall.php | 13 ---- .../Fixture/ExtractCall.php | 13 ---- .../Fixture/PropertyExists.php | 13 ---- .../Fixture/SkipPropertyExistsOnXml.php | 26 ------- .../ForbiddenFuncCallRuleTest.php | 53 -------------- ...biddenFuncCallRuleWithDeprecationsTest.php | 59 --------------- .../config/configured_rule.neon | 13 ---- .../configured_rule_with_deprecations.neon | 13 ---- .../Fixture/MultipleClassLike.php | 17 ----- .../Fixture/SkipOneClass.php | 9 --- .../SkipOneClassWithAnonymousClass.php | 13 ---- .../Fixture/SkipOneInterface.php | 9 --- .../Fixture/SkipOneTrait.php | 9 --- ...ddenMultipleClassLikeInOneFileRuleTest.php | 49 ------------- .../config/configured_rule.neon | 5 -- .../ForbiddenNodeRule/Fixture/EmptyCall.php | 13 ---- .../ForbiddenNodeRuleTest.php | 42 ----------- .../config/configured_rule.neon | 12 --- .../Fixture/SomeClassWithStaticConstFetch.php | 13 ---- ...ForbiddenStaticClassConstFetchRuleTest.php | 44 ----------- .../config/configured_rule.neon | 5 -- .../DynamicClassOnStaticPropertyFetch.php | 12 --- .../Fixture/DynamicConstantName.php | 12 --- .../Fixture/DynamicFuncCallName.php | 13 ---- .../Fixture/DynamicMethodCallName.php | 13 ---- .../Fixture/DynamicPropertyFetch.php | 12 --- .../Fixture/DynamicStaticMethodCallName.php | 13 ---- .../Fixture/SkipCallable.php | 15 ---- .../NoDynamicNameRule/Fixture/SkipClosure.php | 15 ---- ...ipImmediatelyInvokedFunctionExpression.php | 15 ---- .../Fixture/SkipInvokable.php | 14 ---- .../Fixture/SkipNullableClosure.php | 15 ---- .../Fixture/SkipObjectClassOnPhp8.php | 15 ---- .../NoDynamicNameRuleTest.php | 54 -------------- .../Source/SomeInvokableClass.php | 13 ---- .../config/configured_rule.neon | 5 -- .../Fixture/SomeGlobalConst.php | 7 -- .../NoGlobalConstRuleTest.php | 43 ----------- .../config/configured_rule.neon | 5 -- .../Fixture/InlineMatchRegex.php | 13 ---- .../NetteUtilsStringsInlineMatchRegex.php | 15 ---- .../Fixture/SkipConstRegex.php | 15 ---- .../SkipNetteUtilsStringsConstRegex.php | 17 ----- .../Fixture/SkipSingleLetter.php | 15 ---- .../Fixture/SkipVariable.php | 20 ----- .../NoInlineStringRegexRuleTest.php | 50 ------------- .../config/configured_rule.neon | 5 -- .../Fixture/AssignReference.php | 16 ---- .../Fixture/FunctionWithReference.php | 9 --- .../Fixture/MethodWithReference.php | 12 --- .../Fixture/ReferenceArgument.php | 17 ----- .../Fixture/SkipParentMethodWithReference.php | 14 ---- .../Fixture/SkipUseInReference.php | 20 ----- .../Fixture/VariableReference.php | 15 ---- .../NoReferenceRule/NoReferenceRuleTest.php | 48 ------------ .../AbstractSomeParentClassWithReference.php | 12 --- .../config/configured_rule.neon | 5 -- .../Fixture/Enum/SkipEnum.php | 22 ------ .../Fixture/ReturnVariables.php | 14 ---- .../Fixture/SkipArraySpreads.php | 16 ---- .../Fixture/SkipNews.php | 17 ----- .../Fixture/SkipParentMethod.php | 24 ------ .../Fixture/SkipReturnOne.php | 14 ---- .../Fixture/ValueObject/SkipValueObject.php | 13 ---- .../NoReturnArrayVariableListRuleTest.php | 48 ------------ .../config/configured_rule.neon | 5 -- .../Fixture/SkipArrayFilter.php | 15 ---- .../Fixture/SkipEmptyReturn.php | 19 ----- .../Fixture/SkipRoute.php | 17 ----- .../Fixture/SkipSetUp.php | 13 ---- .../Fixture/SkipVoidSetter.php | 15 ---- .../Fixture/SomeSetterClass.php | 13 ---- .../NoReturnSetterMethodRuleTest.php | 47 ------------ .../config/configured_rule.neon | 5 -- .../Fixture/AllowAbstract.php | 9 --- .../Fixture/ImplementsSimpleInterface.php | 9 --- .../Fixture/SimpleInterface.php | 9 --- .../NoSingleInterfaceImplementerRuleTest.php | 73 ------------------- .../Source/SomeType.php | 7 -- .../config/configured_rule.neon | 3 - .../NoTestMocksRule/Fixture/SkipApiMock.php | 16 ---- .../NoTestMocksRule/Fixture/SomeMocking.php | 15 ---- .../NoTestMocksRule/NoTestMocksRuleTest.php | 45 ------------ .../Source/SomeAllowedType.php | 7 -- .../config/configured_rule.neon | 7 -- .../Fixture/ClassExtendingOld.php | 11 --- .../Fixture/ClassMethodParameterUsingOld.php | 15 ---- .../Fixture/ClassUsingOld.php | 16 ---- .../Fixture/InstanceOfName.php | 19 ----- .../SkipPreferredExtendingTheOldOne.php | 12 --- .../Fixture/SomeStaticCall.php | 15 ---- .../PreferredClassRuleTest.php | 58 --------------- .../Source/AbstractNotWhatYouWant.php | 10 --- .../Source/SplFileInfoContract.php | 12 --- .../config/configured_rule.neon | 12 --- .../Fixture/ClassWithOverridingVisibility.php | 12 --- .../Fixture/GoodVisibility.php | 13 ---- ...ParentMethodVisibilityOverrideRuleTest.php | 42 ----------- .../config/configured_rule.neon | 5 -- .../Fixture/NewOnExternal.php | 15 ---- .../Fixture/SkipAllowedType.php | 15 ---- .../Fixture/SkipNonReflectionNew.php | 16 ---- ...lassReflectionStaticReflectionRuleTest.php | 41 ----------- .../config/configured_rule.neon | 2 - .../Fixture/InstanceofWithType.php | 19 ----- .../Fixture/IsAWithType.php | 15 ---- .../Fixture/SkipAllowedType.php | 13 ---- .../Fixture/SkipArrayClassString.php | 29 -------- .../Fixture/SkipGenericNodeType.php | 21 ------ .../Fixture/SkipIsAGenericClassString.php | 26 ------- .../Fixture/SkipIsAsClassString.php | 20 ----- .../Fixture/SkipPHPStanType.php | 15 ---- .../Fixture/SkipPhpDocNode.php | 18 ----- .../Fixture/SkipReflection.php | 19 ----- .../Fixture/SkipSelfType.php | 15 ---- .../Fixture/SkipSymfony.php | 15 ---- .../Fixture/SkipTypesArray.php | 46 ------------ .../NoInstanceOfStaticReflectionRuleTest.php | 54 -------------- .../config/configured_rule.neon | 2 - .../Fixture/LeadingBackslashInName.php | 15 ---- .../Fixture/SkipNoBackslash.php | 15 ---- .../Fixture/SkipUseFullyQualified.php | 15 ---- .../NoLeadingBackslashInNameRuleTest.php | 42 ----------- .../config/configured_rule.neon | 2 - .../DowngradePhp80/SomePhpFeature2Rector.php | 27 ------- .../Fixture/Php80/SkipConfigurableRector.php | 20 ----- .../Fixture/Php80/SomePhpFeatureRector.php | 15 ---- .../Fixture/SkipSomePhpFeatureRector.php | 9 --- ...pgradeDowngradeRegisteredInSetRuleTest.php | 55 -------------- .../Source/Set/downgrade-php80.php | 5 -- .../Source/Set/php80.php | 5 -- .../config/configured_rule.neon | 2 - ...ipAlreadyImplementsMinPhpVersionRector.php | 11 --- .../Fixture/SkipDowngradeRector.php | 9 --- .../Fixture/SomePhpFeatureRector.php | 9 --- ...plementsMinPhpVersionInterfaceRuleTest.php | 49 ------------- .../config/configured_rule.neon | 3 - .../Fixture/MissingConfigureWithAssert.php | 42 ----------- .../Fixture/SkipConfigureWithAssert.php | 26 ------- .../SkipConfigureWithAssertInstanceof.php | 26 ------- .../Fixture/SkipNoArray.php | 23 ------ ...sertConfigureValueObjectRectorRuleTest.php | 42 ----------- .../Source/SomeValueObject.php | 9 --- .../config/configured_rule.neon | 2 - .../Fixture/DifferentSuffix.php | 17 ----- .../RegexSuffixInRegexConstantRuleTest.php | 43 ----------- .../config/configured_rule.neon | 5 -- .../Fixture/MissingName.php | 15 ---- .../Fixture/SkipCorrectName.php | 15 ---- .../Fixture/SkipDefaultName.php | 12 --- .../Fixture/SkipPHPUnitAttributes.php | 15 ---- .../RequireAttributeNameRuleTest.php | 45 ------------ .../config/configured_rule.neon | 5 -- .../Fixture/RuleWithSee.php | 24 ------ .../Fixture/RuleWithSeeRandom.php | 24 ------ .../Fixture/RuleWithoutSee.php | 21 ------ .../Fixture/SkipDeprecatedRuleWithoutSee.php | 24 ------ .../SeeAnnotationToTestRuleTest.php | 49 ------------- .../config/configured_rule.neon | 10 --- .../Fixture/ConstantLower.php | 10 --- .../UppercaseConstantRuleTest.php | 42 ----------- .../config/configured_rule.neon | 5 -- tests/SomeClass.php.inc | 13 ---- .../Fixture/MissnamedController.php | 18 ----- .../MissnamedRouteAttributeController.php | 16 ---- .../Fixture/SkipInvokableController.php | 18 ----- .../SkipRandomPublicMethodController.php | 14 ---- ...equireInvokableControllerRulePhp80Test.php | 44 ----------- .../RequireInvokableControllerRuleTest.php | 44 ----------- .../config/configured_rule.neon | 5 -- tests/config/included_services.neon | 2 - 315 files changed, 417 insertions(+), 4956 deletions(-) delete mode 100644 .editorconfig rename {build/target-repository/.github => .github}/workflows/standalone_install.yaml (100%) delete mode 100644 build/rector-downgrade-php-72.php delete mode 100644 build/target-repository/.github/FUNDING.yml delete mode 100644 build/target-repository/composer.json delete mode 100644 build/target-repository/phpstan-for-tests.neon delete mode 100644 build/target-repository/tests/SomeClass.php.inc delete mode 100644 ecs.php delete mode 100644 full-tool-build.sh delete mode 100644 phpstan.neon delete mode 100644 phpunit.xml delete mode 100644 rector.php delete mode 100644 tests/Composer/Psr4PathValidatorTest.php delete mode 100644 tests/Naming/ClassToSuffixResolverTest.php delete mode 100644 tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/NodeGetAttributeTypeExtensionTest.php delete mode 100644 tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/config/type_extension.neon delete mode 100644 tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/data/get_parent_node.php.inc delete mode 100644 tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/AnnotateRegexClassConstWithRegexLinkRuleTest.php delete mode 100644 tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/Fixture/ClassConstMissingLink.php delete mode 100644 tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/Fixture/SkipAlphabet.php delete mode 100644 tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/Fixture/SkipPlaceholder.php delete mode 100644 tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/Fixture/SkipShort.php delete mode 100644 tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/Fixture/SkipWithLink.php delete mode 100644 tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/config/configured_rule.neon delete mode 100644 tests/Rules/CheckClassNamespaceFollowPsr4Rule/CheckClassNamespaceFollowPsr4RuleTest.php delete mode 100644 tests/Rules/CheckClassNamespaceFollowPsr4Rule/Fixture/InvalidNamespaceClass.php delete mode 100644 tests/Rules/CheckClassNamespaceFollowPsr4Rule/Fixture/InvalidNamespaceInterface.php delete mode 100644 tests/Rules/CheckClassNamespaceFollowPsr4Rule/Fixture/InvalidNamespaceTrait.php delete mode 100644 tests/Rules/CheckClassNamespaceFollowPsr4Rule/Fixture/MissingFixtureNamespaceClass.php delete mode 100644 tests/Rules/CheckClassNamespaceFollowPsr4Rule/Fixture/SkipAnonymousClass.php delete mode 100644 tests/Rules/CheckClassNamespaceFollowPsr4Rule/Fixture/SkipValidNamespaceInterface.php delete mode 100644 tests/Rules/CheckClassNamespaceFollowPsr4Rule/Fixture/ValidNamespaceTrait.php delete mode 100644 tests/Rules/CheckClassNamespaceFollowPsr4Rule/config/configured_rule.neon delete mode 100644 tests/Rules/CheckRequiredInterfaceInContractNamespaceRule/CheckRequiredInterfaceInContractNamespaceRuleTest.php delete mode 100644 tests/Rules/CheckRequiredInterfaceInContractNamespaceRule/Fixture/AnInterfaceNotInContract.php delete mode 100644 tests/Rules/CheckRequiredInterfaceInContractNamespaceRule/Fixture/Contract/SkipInterfaceInContract.php delete mode 100644 tests/Rules/CheckRequiredInterfaceInContractNamespaceRule/Fixture/Illuminate/Contracts/View/View.php delete mode 100644 tests/Rules/CheckRequiredInterfaceInContractNamespaceRule/config/configured_rule.neon delete mode 100644 tests/Rules/ClassNameRespectsParentSuffixRule/ClassNameRespectsParentSuffixRuleTest.php delete mode 100644 tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/NonTestSuffix.php delete mode 100644 tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/SkipAbstractTestCase.php delete mode 100644 tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/SkipAnonymousClass.php delete mode 100644 tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/SkipCommand.php delete mode 100644 tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/SkipFixer.php delete mode 100644 tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/SkipSomeEventSubscriber.php delete mode 100644 tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/SkipTest.php delete mode 100644 tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/SomeController.php delete mode 100644 tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/SomeEventSubscriberFalse.php delete mode 100644 tests/Rules/ClassNameRespectsParentSuffixRule/Source/SuperFixerInterface.php delete mode 100644 tests/Rules/ClassNameRespectsParentSuffixRule/config/configured_rule.neon delete mode 100644 tests/Rules/Complexity/ForbiddenArrayMethodCallRule/Fixture/ReturnCallable.php delete mode 100644 tests/Rules/Complexity/ForbiddenArrayMethodCallRule/Fixture/SkipNormalArray.php delete mode 100644 tests/Rules/Complexity/ForbiddenArrayMethodCallRule/ForbiddenArrayMethodCallRuleTest.php delete mode 100644 tests/Rules/Complexity/ForbiddenArrayMethodCallRule/config/configured_rule.neon delete mode 100644 tests/Rules/Domain/RequireAttributeNamespaceRule/Fixture/Attribute/SkipCorrectAttribute.php delete mode 100644 tests/Rules/Domain/RequireAttributeNamespaceRule/Fixture/MisslocatedAttribute.php delete mode 100644 tests/Rules/Domain/RequireAttributeNamespaceRule/RequireAttributeNamespaceRuleTest.php delete mode 100644 tests/Rules/Domain/RequireAttributeNamespaceRule/config/configured_rule.neon delete mode 100644 tests/Rules/Domain/RequireExceptionNamespaceRule/Fixture/Exception/SkipCorrectException.php delete mode 100644 tests/Rules/Domain/RequireExceptionNamespaceRule/Fixture/MisslocatedException.php delete mode 100644 tests/Rules/Domain/RequireExceptionNamespaceRule/RequireExceptionNamespaceRuleTest.php delete mode 100644 tests/Rules/Domain/RequireExceptionNamespaceRule/config/configured_rule.neon delete mode 100644 tests/Rules/Enum/RequireUniqueEnumConstantRule/Fixture/InvalidAnnotationEnum.php delete mode 100644 tests/Rules/Enum/RequireUniqueEnumConstantRule/Fixture/InvalidEnum.php delete mode 100644 tests/Rules/Enum/RequireUniqueEnumConstantRule/Fixture/SkipValidEnum.php delete mode 100644 tests/Rules/Enum/RequireUniqueEnumConstantRule/RequireUniqueEnumConstantRuleTest.php delete mode 100644 tests/Rules/Enum/RequireUniqueEnumConstantRule/config/configured_rule.neon delete mode 100644 tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/ExplicitClassPrefixSuffixRuleTest.php delete mode 100644 tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/Fixture/AbstractCorrectClass.php delete mode 100644 tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/Fixture/AbstractIncorrectClass.php delete mode 100644 tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/Fixture/CorrectInterface.php delete mode 100644 tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/Fixture/CorrectTrait.php delete mode 100644 tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/Fixture/IncorrectClassInterface.php delete mode 100644 tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/Fixture/WrongInterfaceSuffix.php delete mode 100644 tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/Fixture/WrongSuffixTrait.php delete mode 100644 tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/Fixture/WrongTraitSuffix.php delete mode 100644 tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/config/configured_rule.neon delete mode 100644 tests/Rules/ForbiddenExtendOfNonAbstractClassRule/Fixture/ClassExtendingNonAbstractClass.php delete mode 100644 tests/Rules/ForbiddenExtendOfNonAbstractClassRule/Fixture/SkipAnonymousExtend.php delete mode 100644 tests/Rules/ForbiddenExtendOfNonAbstractClassRule/Fixture/SkipClassExtendingAbstractClass.php delete mode 100644 tests/Rules/ForbiddenExtendOfNonAbstractClassRule/Fixture/SkipException.php delete mode 100644 tests/Rules/ForbiddenExtendOfNonAbstractClassRule/Fixture/SkipVendorBasedClasses.php delete mode 100644 tests/Rules/ForbiddenExtendOfNonAbstractClassRule/ForbiddenExtendOfNonAbstractClassRuleTest.php delete mode 100644 tests/Rules/ForbiddenExtendOfNonAbstractClassRule/Source/NonAbstractClass.php delete mode 100644 tests/Rules/ForbiddenExtendOfNonAbstractClassRule/Source/SimpleAbstractClass.php delete mode 100644 tests/Rules/ForbiddenExtendOfNonAbstractClassRule/config/configured_rule.neon delete mode 100644 tests/Rules/ForbiddenFuncCallRule/Fixture/CurlCall.php delete mode 100644 tests/Rules/ForbiddenFuncCallRule/Fixture/DebugFuncCall.php delete mode 100644 tests/Rules/ForbiddenFuncCallRule/Fixture/ExtractCall.php delete mode 100644 tests/Rules/ForbiddenFuncCallRule/Fixture/PropertyExists.php delete mode 100644 tests/Rules/ForbiddenFuncCallRule/Fixture/SkipPropertyExistsOnXml.php delete mode 100644 tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleTest.php delete mode 100644 tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleWithDeprecationsTest.php delete mode 100644 tests/Rules/ForbiddenFuncCallRule/config/configured_rule.neon delete mode 100644 tests/Rules/ForbiddenFuncCallRule/config/configured_rule_with_deprecations.neon delete mode 100644 tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/Fixture/MultipleClassLike.php delete mode 100644 tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/Fixture/SkipOneClass.php delete mode 100644 tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/Fixture/SkipOneClassWithAnonymousClass.php delete mode 100644 tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/Fixture/SkipOneInterface.php delete mode 100644 tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/Fixture/SkipOneTrait.php delete mode 100644 tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/ForbiddenMultipleClassLikeInOneFileRuleTest.php delete mode 100644 tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/config/configured_rule.neon delete mode 100644 tests/Rules/ForbiddenNodeRule/Fixture/EmptyCall.php delete mode 100644 tests/Rules/ForbiddenNodeRule/ForbiddenNodeRuleTest.php delete mode 100644 tests/Rules/ForbiddenNodeRule/config/configured_rule.neon delete mode 100644 tests/Rules/ForbiddenStaticClassConstFetchRule/Fixture/SomeClassWithStaticConstFetch.php delete mode 100644 tests/Rules/ForbiddenStaticClassConstFetchRule/ForbiddenStaticClassConstFetchRuleTest.php delete mode 100644 tests/Rules/ForbiddenStaticClassConstFetchRule/config/configured_rule.neon delete mode 100644 tests/Rules/NoDynamicNameRule/Fixture/DynamicClassOnStaticPropertyFetch.php delete mode 100644 tests/Rules/NoDynamicNameRule/Fixture/DynamicConstantName.php delete mode 100644 tests/Rules/NoDynamicNameRule/Fixture/DynamicFuncCallName.php delete mode 100644 tests/Rules/NoDynamicNameRule/Fixture/DynamicMethodCallName.php delete mode 100644 tests/Rules/NoDynamicNameRule/Fixture/DynamicPropertyFetch.php delete mode 100644 tests/Rules/NoDynamicNameRule/Fixture/DynamicStaticMethodCallName.php delete mode 100644 tests/Rules/NoDynamicNameRule/Fixture/SkipCallable.php delete mode 100644 tests/Rules/NoDynamicNameRule/Fixture/SkipClosure.php delete mode 100644 tests/Rules/NoDynamicNameRule/Fixture/SkipImmediatelyInvokedFunctionExpression.php delete mode 100644 tests/Rules/NoDynamicNameRule/Fixture/SkipInvokable.php delete mode 100644 tests/Rules/NoDynamicNameRule/Fixture/SkipNullableClosure.php delete mode 100644 tests/Rules/NoDynamicNameRule/Fixture/SkipObjectClassOnPhp8.php delete mode 100644 tests/Rules/NoDynamicNameRule/NoDynamicNameRuleTest.php delete mode 100644 tests/Rules/NoDynamicNameRule/Source/SomeInvokableClass.php delete mode 100644 tests/Rules/NoDynamicNameRule/config/configured_rule.neon delete mode 100644 tests/Rules/NoGlobalConstRule/Fixture/SomeGlobalConst.php delete mode 100644 tests/Rules/NoGlobalConstRule/NoGlobalConstRuleTest.php delete mode 100644 tests/Rules/NoGlobalConstRule/config/configured_rule.neon delete mode 100644 tests/Rules/NoInlineStringRegexRule/Fixture/InlineMatchRegex.php delete mode 100644 tests/Rules/NoInlineStringRegexRule/Fixture/NetteUtilsStringsInlineMatchRegex.php delete mode 100644 tests/Rules/NoInlineStringRegexRule/Fixture/SkipConstRegex.php delete mode 100644 tests/Rules/NoInlineStringRegexRule/Fixture/SkipNetteUtilsStringsConstRegex.php delete mode 100644 tests/Rules/NoInlineStringRegexRule/Fixture/SkipSingleLetter.php delete mode 100644 tests/Rules/NoInlineStringRegexRule/Fixture/SkipVariable.php delete mode 100644 tests/Rules/NoInlineStringRegexRule/NoInlineStringRegexRuleTest.php delete mode 100644 tests/Rules/NoInlineStringRegexRule/config/configured_rule.neon delete mode 100644 tests/Rules/NoReferenceRule/Fixture/AssignReference.php delete mode 100644 tests/Rules/NoReferenceRule/Fixture/FunctionWithReference.php delete mode 100644 tests/Rules/NoReferenceRule/Fixture/MethodWithReference.php delete mode 100644 tests/Rules/NoReferenceRule/Fixture/ReferenceArgument.php delete mode 100644 tests/Rules/NoReferenceRule/Fixture/SkipParentMethodWithReference.php delete mode 100644 tests/Rules/NoReferenceRule/Fixture/SkipUseInReference.php delete mode 100644 tests/Rules/NoReferenceRule/Fixture/VariableReference.php delete mode 100644 tests/Rules/NoReferenceRule/NoReferenceRuleTest.php delete mode 100644 tests/Rules/NoReferenceRule/Source/AbstractSomeParentClassWithReference.php delete mode 100644 tests/Rules/NoReferenceRule/config/configured_rule.neon delete mode 100644 tests/Rules/NoReturnArrayVariableListRule/Fixture/Enum/SkipEnum.php delete mode 100644 tests/Rules/NoReturnArrayVariableListRule/Fixture/ReturnVariables.php delete mode 100644 tests/Rules/NoReturnArrayVariableListRule/Fixture/SkipArraySpreads.php delete mode 100644 tests/Rules/NoReturnArrayVariableListRule/Fixture/SkipNews.php delete mode 100644 tests/Rules/NoReturnArrayVariableListRule/Fixture/SkipParentMethod.php delete mode 100644 tests/Rules/NoReturnArrayVariableListRule/Fixture/SkipReturnOne.php delete mode 100644 tests/Rules/NoReturnArrayVariableListRule/Fixture/ValueObject/SkipValueObject.php delete mode 100644 tests/Rules/NoReturnArrayVariableListRule/NoReturnArrayVariableListRuleTest.php delete mode 100644 tests/Rules/NoReturnArrayVariableListRule/config/configured_rule.neon delete mode 100644 tests/Rules/NoReturnSetterMethodRule/Fixture/SkipArrayFilter.php delete mode 100644 tests/Rules/NoReturnSetterMethodRule/Fixture/SkipEmptyReturn.php delete mode 100644 tests/Rules/NoReturnSetterMethodRule/Fixture/SkipRoute.php delete mode 100644 tests/Rules/NoReturnSetterMethodRule/Fixture/SkipSetUp.php delete mode 100644 tests/Rules/NoReturnSetterMethodRule/Fixture/SkipVoidSetter.php delete mode 100644 tests/Rules/NoReturnSetterMethodRule/Fixture/SomeSetterClass.php delete mode 100644 tests/Rules/NoReturnSetterMethodRule/NoReturnSetterMethodRuleTest.php delete mode 100644 tests/Rules/NoReturnSetterMethodRule/config/configured_rule.neon delete mode 100644 tests/Rules/NoSingleInterfaceImplementerRule/Fixture/AllowAbstract.php delete mode 100644 tests/Rules/NoSingleInterfaceImplementerRule/Fixture/ImplementsSimpleInterface.php delete mode 100644 tests/Rules/NoSingleInterfaceImplementerRule/Fixture/SimpleInterface.php delete mode 100644 tests/Rules/NoSingleInterfaceImplementerRule/NoSingleInterfaceImplementerRuleTest.php delete mode 100644 tests/Rules/NoSingleInterfaceImplementerRule/Source/SomeType.php delete mode 100644 tests/Rules/NoSingleInterfaceImplementerRule/config/configured_rule.neon delete mode 100644 tests/Rules/PHPUnit/NoTestMocksRule/Fixture/SkipApiMock.php delete mode 100644 tests/Rules/PHPUnit/NoTestMocksRule/Fixture/SomeMocking.php delete mode 100644 tests/Rules/PHPUnit/NoTestMocksRule/NoTestMocksRuleTest.php delete mode 100644 tests/Rules/PHPUnit/NoTestMocksRule/Source/SomeAllowedType.php delete mode 100644 tests/Rules/PHPUnit/NoTestMocksRule/config/configured_rule.neon delete mode 100644 tests/Rules/PreferredClassRule/Fixture/ClassExtendingOld.php delete mode 100644 tests/Rules/PreferredClassRule/Fixture/ClassMethodParameterUsingOld.php delete mode 100644 tests/Rules/PreferredClassRule/Fixture/ClassUsingOld.php delete mode 100644 tests/Rules/PreferredClassRule/Fixture/InstanceOfName.php delete mode 100644 tests/Rules/PreferredClassRule/Fixture/SkipPreferredExtendingTheOldOne.php delete mode 100644 tests/Rules/PreferredClassRule/Fixture/SomeStaticCall.php delete mode 100644 tests/Rules/PreferredClassRule/PreferredClassRuleTest.php delete mode 100644 tests/Rules/PreferredClassRule/Source/AbstractNotWhatYouWant.php delete mode 100644 tests/Rules/PreferredClassRule/Source/SplFileInfoContract.php delete mode 100644 tests/Rules/PreferredClassRule/config/configured_rule.neon delete mode 100644 tests/Rules/PreventParentMethodVisibilityOverrideRule/Fixture/ClassWithOverridingVisibility.php delete mode 100644 tests/Rules/PreventParentMethodVisibilityOverrideRule/Fixture/GoodVisibility.php delete mode 100644 tests/Rules/PreventParentMethodVisibilityOverrideRule/PreventParentMethodVisibilityOverrideRuleTest.php delete mode 100644 tests/Rules/PreventParentMethodVisibilityOverrideRule/config/configured_rule.neon delete mode 100644 tests/Rules/Rector/NoClassReflectionStaticReflectionRule/Fixture/NewOnExternal.php delete mode 100644 tests/Rules/Rector/NoClassReflectionStaticReflectionRule/Fixture/SkipAllowedType.php delete mode 100644 tests/Rules/Rector/NoClassReflectionStaticReflectionRule/Fixture/SkipNonReflectionNew.php delete mode 100644 tests/Rules/Rector/NoClassReflectionStaticReflectionRule/NoClassReflectionStaticReflectionRuleTest.php delete mode 100644 tests/Rules/Rector/NoClassReflectionStaticReflectionRule/config/configured_rule.neon delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/InstanceofWithType.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/IsAWithType.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipAllowedType.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipArrayClassString.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipGenericNodeType.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipIsAGenericClassString.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipIsAsClassString.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipPHPStanType.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipPhpDocNode.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipReflection.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipSelfType.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipSymfony.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipTypesArray.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/NoInstanceOfStaticReflectionRuleTest.php delete mode 100644 tests/Rules/Rector/NoInstanceOfStaticReflectionRule/config/configured_rule.neon delete mode 100644 tests/Rules/Rector/NoLeadingBackslashInNameRule/Fixture/LeadingBackslashInName.php delete mode 100644 tests/Rules/Rector/NoLeadingBackslashInNameRule/Fixture/SkipNoBackslash.php delete mode 100644 tests/Rules/Rector/NoLeadingBackslashInNameRule/Fixture/SkipUseFullyQualified.php delete mode 100644 tests/Rules/Rector/NoLeadingBackslashInNameRule/NoLeadingBackslashInNameRuleTest.php delete mode 100644 tests/Rules/Rector/NoLeadingBackslashInNameRule/config/configured_rule.neon delete mode 100644 tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/Fixture/DowngradePhp80/SomePhpFeature2Rector.php delete mode 100644 tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/Fixture/Php80/SkipConfigurableRector.php delete mode 100644 tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/Fixture/Php80/SomePhpFeatureRector.php delete mode 100644 tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/Fixture/SkipSomePhpFeatureRector.php delete mode 100644 tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/PhpUpgradeDowngradeRegisteredInSetRuleTest.php delete mode 100644 tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/Source/Set/downgrade-php80.php delete mode 100644 tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/Source/Set/php80.php delete mode 100644 tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/config/configured_rule.neon delete mode 100644 tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/Fixture/SkipAlreadyImplementsMinPhpVersionRector.php delete mode 100644 tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/Fixture/SkipDowngradeRector.php delete mode 100644 tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/Fixture/SomePhpFeatureRector.php delete mode 100644 tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/PhpUpgradeImplementsMinPhpVersionInterfaceRuleTest.php delete mode 100644 tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/config/configured_rule.neon delete mode 100644 tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/MissingConfigureWithAssert.php delete mode 100644 tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/SkipConfigureWithAssert.php delete mode 100644 tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/SkipConfigureWithAssertInstanceof.php delete mode 100644 tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/SkipNoArray.php delete mode 100644 tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/RequireAssertConfigureValueObjectRectorRuleTest.php delete mode 100644 tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Source/SomeValueObject.php delete mode 100644 tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/config/configured_rule.neon delete mode 100644 tests/Rules/RegexSuffixInRegexConstantRule/Fixture/DifferentSuffix.php delete mode 100644 tests/Rules/RegexSuffixInRegexConstantRule/RegexSuffixInRegexConstantRuleTest.php delete mode 100644 tests/Rules/RegexSuffixInRegexConstantRule/config/configured_rule.neon delete mode 100644 tests/Rules/RequireAttributeNameRule/Fixture/MissingName.php delete mode 100644 tests/Rules/RequireAttributeNameRule/Fixture/SkipCorrectName.php delete mode 100644 tests/Rules/RequireAttributeNameRule/Fixture/SkipDefaultName.php delete mode 100644 tests/Rules/RequireAttributeNameRule/Fixture/SkipPHPUnitAttributes.php delete mode 100644 tests/Rules/RequireAttributeNameRule/RequireAttributeNameRuleTest.php delete mode 100644 tests/Rules/RequireAttributeNameRule/config/configured_rule.neon delete mode 100644 tests/Rules/SeeAnnotationToTestRule/Fixture/RuleWithSee.php delete mode 100644 tests/Rules/SeeAnnotationToTestRule/Fixture/RuleWithSeeRandom.php delete mode 100644 tests/Rules/SeeAnnotationToTestRule/Fixture/RuleWithoutSee.php delete mode 100644 tests/Rules/SeeAnnotationToTestRule/Fixture/SkipDeprecatedRuleWithoutSee.php delete mode 100644 tests/Rules/SeeAnnotationToTestRule/SeeAnnotationToTestRuleTest.php delete mode 100644 tests/Rules/SeeAnnotationToTestRule/config/configured_rule.neon delete mode 100644 tests/Rules/UppercaseConstantRule/Fixture/ConstantLower.php delete mode 100644 tests/Rules/UppercaseConstantRule/UppercaseConstantRuleTest.php delete mode 100644 tests/Rules/UppercaseConstantRule/config/configured_rule.neon delete mode 100644 tests/SomeClass.php.inc delete mode 100644 tests/Symfony/Rules/RequireInvokableControllerRule/Fixture/MissnamedController.php delete mode 100644 tests/Symfony/Rules/RequireInvokableControllerRule/Fixture/MissnamedRouteAttributeController.php delete mode 100644 tests/Symfony/Rules/RequireInvokableControllerRule/Fixture/SkipInvokableController.php delete mode 100644 tests/Symfony/Rules/RequireInvokableControllerRule/Fixture/SkipRandomPublicMethodController.php delete mode 100644 tests/Symfony/Rules/RequireInvokableControllerRule/RequireInvokableControllerRulePhp80Test.php delete mode 100644 tests/Symfony/Rules/RequireInvokableControllerRule/RequireInvokableControllerRuleTest.php delete mode 100644 tests/Symfony/Rules/RequireInvokableControllerRule/config/configured_rule.neon delete mode 100644 tests/config/included_services.neon diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index bec95c44..00000000 --- a/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -charset = utf-8 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true -indent_style = space -indent_size = 4 diff --git a/build/target-repository/.github/workflows/standalone_install.yaml b/.github/workflows/standalone_install.yaml similarity index 100% rename from build/target-repository/.github/workflows/standalone_install.yaml rename to .github/workflows/standalone_install.yaml diff --git a/build/rector-downgrade-php-72.php b/build/rector-downgrade-php-72.php deleted file mode 100644 index 34d0c266..00000000 --- a/build/rector-downgrade-php-72.php +++ /dev/null @@ -1,23 +0,0 @@ -parallel(); - - $rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_72]); - - $rectorConfig->ruleWithConfiguration(RemoveInterfacesRector::class, [ - DocumentedRuleInterface::class, - ConfigurableRuleInterface::class, - ]); - - $rectorConfig->skip(['*/Tests/*', '*/tests/*', __DIR__ . '/../../tests']); -}; - diff --git a/build/target-repository/.github/FUNDING.yml b/build/target-repository/.github/FUNDING.yml deleted file mode 100644 index f797866a..00000000 --- a/build/target-repository/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -# These are supported funding model platforms -github: tomasvotruba -custom: https://www.paypal.me/rectorphp diff --git a/build/target-repository/composer.json b/build/target-repository/composer.json deleted file mode 100644 index d7e0856e..00000000 --- a/build/target-repository/composer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "symplify/phpstan-rules", - "type": "phpstan-extension", - "description": "Set of Symplify rules for PHPStan", - "license": "MIT", - "require": { - "php": "^7.2|^8.0", - "nette/utils": "^3.2.9 || ^4.0", - "phpstan/phpstan": "^1.10.30", - "webmozart/assert": "^1.11" - }, - "autoload": { - "psr-4": { - "Symplify\\PHPStanRules\\": "src" - } - }, - "extra": { - "phpstan": { - "includes": [ - "config/services/services.neon" - ] - } - } -} diff --git a/build/target-repository/phpstan-for-tests.neon b/build/target-repository/phpstan-for-tests.neon deleted file mode 100644 index 0d1b2a61..00000000 --- a/build/target-repository/phpstan-for-tests.neon +++ /dev/null @@ -1,9 +0,0 @@ -# this config is only for tests, it verifies all the rules are runnable -includes: - - vendor/symplify/phpstan-rules/config/symplify-rules.neon - -parameters: - level: 4 - - ignoreErrors: - - '#Class method "getName\(\)" is never used#' diff --git a/build/target-repository/tests/SomeClass.php.inc b/build/target-repository/tests/SomeClass.php.inc deleted file mode 100644 index 17ce8504..00000000 --- a/build/target-repository/tests/SomeClass.php.inc +++ /dev/null @@ -1,13 +0,0 @@ -name; - } -} diff --git a/composer.json b/composer.json index 7d6ecb53..d7e0856e 100644 --- a/composer.json +++ b/composer.json @@ -4,62 +4,21 @@ "description": "Set of Symplify rules for PHPStan", "license": "MIT", "require": { - "php": ">=8.1", + "php": "^7.2|^8.0", "nette/utils": "^3.2.9 || ^4.0", - "webmozart/assert": "^1.11", - "phpstan/phpstan": "^1.11", - "symplify/rule-doc-generator-contracts": "^11.2" - }, - "require-dev": { - "nikic/php-parser": "^4.19", - "symplify/phpstan-extensions": "^11.4", - "symplify/rule-doc-generator": "^12.2", - "phpunit/phpunit": "^10.5", - "symfony/framework-bundle": "6.1.*", - "rector/rector": "^1.2.3", - "symplify/easy-coding-standard": "^12.3", - "phpstan/extension-installer": "^1.4", - "tomasvotruba/class-leak": "^0.2", - "tomasvotruba/unused-public": "^0.3.10", - "tomasvotruba/type-coverage": "^0.3.1" + "phpstan/phpstan": "^1.10.30", + "webmozart/assert": "^1.11" }, "autoload": { "psr-4": { "Symplify\\PHPStanRules\\": "src" } }, - "autoload-dev": { - "psr-4": { - "Symplify\\PHPStanRules\\Tests\\": "tests" - }, - "classmap": [ - "stubs" - ], - "files": [ - "tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/Fixture/SomePhpFeatureRector.php", - "vendor/rector/rector/src/Contract/Rector/RectorInterface.php", - "vendor/rector/rector/src/Contract/Rector/ConfigurableRectorInterface.php", - "vendor/rector/rector/vendor/rector/rector-downgrade-php/src/Set/ValueObject/DowngradeSetList.php" - ] - }, "extra": { "phpstan": { "includes": [ "config/services/services.neon" ] } - }, - "config": { - "platform-check": false, - "allow-plugins": { - "phpstan/extension-installer": true - } - }, - "scripts": { - "check-cs": "vendor/bin/ecs check --ansi", - "fix-cs": "vendor/bin/ecs check --fix --ansi", - "phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify", - "rector": "vendor/bin/rector process --dry-run --ansi", - "docs": "vendor/bin/rule-doc-generator generate src --readme --ansi" } } diff --git a/ecs.php b/ecs.php deleted file mode 100644 index 7a5dab64..00000000 --- a/ecs.php +++ /dev/null @@ -1,18 +0,0 @@ -withPaths([ - __DIR__ . '/config', - __DIR__ . '/src', - __DIR__ . '/tests', - ]) - ->withRootFiles() - ->withPreparedSets(psr12: true, common: true) - ->withSkip([ - '*/Source/*', - '*/Fixture/*', - ]); diff --git a/full-tool-build.sh b/full-tool-build.sh deleted file mode 100644 index a2b95d50..00000000 --- a/full-tool-build.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -# add patches -composer install --ansi - -# but skip dev dependencies -composer update --no-dev --ansi - -# remove tests and useless files, to make downgraded, scoped and deployed codebase as small as possible -rm -rf tests - -# downgrade with rector -mkdir rector-local -composer require rector/rector --working-dir rector-local -rector-local/vendor/bin/rector process bin src vendor --config build/rector-downgrade-php-72.php --ansi diff --git a/phpstan.neon b/phpstan.neon deleted file mode 100644 index db7f3f3b..00000000 --- a/phpstan.neon +++ /dev/null @@ -1,54 +0,0 @@ -includes: - - config/services/services.neon - - config/naming-rules.neon - -parameters: - level: 8 - - paths: - - src - - config - - tests - - excludePaths: - # parallel - - packages/*-phpstan-printer/tests/*ToPhpCompiler/Fixture* - - # tests - - '*/tests/**/Source/*' - - */stubs/* - - */Fixture/* - - # https://github.com/TomasVotruba/unused-public - unused_public: - methods: true - properties: true - constants: true - - type_coverage: - return: 99 - param: 99 - property: 99 - - ignoreErrors: - # needless generics - - '#Class Symplify\\PHPStanRules\\(.*?)Rule implements generic interface PHPStan\\Rules\\Rule but does not specify its types\: TNodeType#' - - - '#Class PHP_CodeSniffer\\Sniffs\\Sniff not found#' - - - '#Method Symplify\\PHPStanRules\\Reflection\\ReflectionParser\:\:parseNativeClassReflection\(\) has parameter \$reflectionClass with generic class ReflectionClass but does not specify its types\: T#' - - - '#Method Symplify\\PHPStanRules\\NodeFinder\\TypeAwareNodeFinder\:\:findFirstInstanceOf\(\) should return \(TNode of PhpParser\\Node\)\|null but returns PhpParser\\Node\|null#' - - # 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#' - - # part of public contract - - '#Method Symplify\\PHPStanRules\\Tests\\Rules\\PHPUnit\\(.*?)\\(.*?)Test\:\:testRule\(\) has parameter \$expectedErrorMessagesWithLines with no value type specified in iterable type array#' - - # overly detailed - - '#Class Symplify\\PHPStanRules\\Collector\\(.*?) implements generic interface PHPStan\\Collectors\\Collector but does not specify its types\: TNodeType, TValue#' - - # used in tests - - '#Public constant "(.*?)\:\:ERROR_MESSAGE" is never used#' diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index a94c8d42..00000000 --- a/phpunit.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - tests - tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/ - - diff --git a/rector.php b/rector.php deleted file mode 100644 index e68c64ff..00000000 --- a/rector.php +++ /dev/null @@ -1,41 +0,0 @@ -sets([ - PHPUnitSetList::PHPUNIT_100, - SetList::CODE_QUALITY, - SetList::DEAD_CODE, - LevelSetList::UP_TO_PHP_81, - SetList::CODING_STYLE, - SetList::TYPE_DECLARATION, - SetList::NAMING, - SetList::PRIVATIZATION, - SetList::EARLY_RETURN, - PHPUnitSetList::PHPUNIT_CODE_QUALITY, - ]); - - $rectorConfig->paths([ - __DIR__ . '/config', - __DIR__ . '/src', - __DIR__ . '/tests', - ]); - - $rectorConfig->importNames(); - - $rectorConfig->skip([ - '*/Source/*', - '*/Fixture/*', - ]); - - $rectorConfig->ruleWithConfiguration(\Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class, [ - 'Symfony\Component\Console\*', - 'Rector\Contract\Rector\ConfigurableRectorInterface', - ]); -}; diff --git a/src/Composer/ClassNamespaceMatcher.php b/src/Composer/ClassNamespaceMatcher.php index d2279aac..5423aa7d 100644 --- a/src/Composer/ClassNamespaceMatcher.php +++ b/src/Composer/ClassNamespaceMatcher.php @@ -10,9 +10,14 @@ final class ClassNamespaceMatcher { - public function __construct( - private readonly DirectoryChecker $directoryChecker - ) { + /** + * @readonly + * @var \Symplify\PHPStanRules\Location\DirectoryChecker + */ + private $directoryChecker; + public function __construct(DirectoryChecker $directoryChecker) + { + $this->directoryChecker = $directoryChecker; } /** @@ -54,7 +59,7 @@ public function matchPossibleDirectoriesForClass( * @param string|string[] $items * @return string[] */ - private function standardizeToArray(string | array $items): array + private function standardizeToArray($items): array { if (! is_array($items)) { return [$items]; diff --git a/src/Contract/PhpDocParser/PhpDocNodeVisitorInterface.php b/src/Contract/PhpDocParser/PhpDocNodeVisitorInterface.php index 3081f405..3e68fbfa 100644 --- a/src/Contract/PhpDocParser/PhpDocNodeVisitorInterface.php +++ b/src/Contract/PhpDocParser/PhpDocNodeVisitorInterface.php @@ -13,12 +13,15 @@ interface PhpDocNodeVisitorInterface { public function beforeTraverse(Node $node): void; - public function enterNode(Node $node): int|Node|null; + /** + * @return int|\PHPStan\PhpDocParser\Ast\Node|null + */ + public function enterNode(Node $node); /** * @return null|int|\PhpParser\Node|Node[] Replacement node (or special return) */ - public function leaveNode(Node $node): int|\PhpParser\Node|array|null; + public function leaveNode(Node $node); public function afterTraverse(Node $node): void; } diff --git a/src/Location/DirectoryChecker.php b/src/Location/DirectoryChecker.php index 9fda237b..910d26f2 100644 --- a/src/Location/DirectoryChecker.php +++ b/src/Location/DirectoryChecker.php @@ -13,7 +13,7 @@ public function isInDirectoryNamed(Scope $scope, string $directoryName): bool $normalized = $this->normalizePath($directoryName); $directoryName = rtrim($normalized, '\/'); - return \str_contains($scope->getFile(), DIRECTORY_SEPARATOR . $directoryName . DIRECTORY_SEPARATOR); + return strpos($scope->getFile(), DIRECTORY_SEPARATOR . $directoryName . DIRECTORY_SEPARATOR) !== false; } private function normalizePath(string $directoryName): string diff --git a/src/Naming/ClassToSuffixResolver.php b/src/Naming/ClassToSuffixResolver.php index f235f5d9..bc4c39a2 100644 --- a/src/Naming/ClassToSuffixResolver.php +++ b/src/Naming/ClassToSuffixResolver.php @@ -13,7 +13,7 @@ final class ClassToSuffixResolver { public function resolveFromClass(string $parentClass): string { - $expectedSuffix = \str_contains($parentClass, '\\') ? (string) Strings::after( + $expectedSuffix = strpos($parentClass, '\\') !== false ? (string) Strings::after( $parentClass, '\\', -1 @@ -31,15 +31,15 @@ public function resolveFromClass(string $parentClass): string private function removeAbstractInterfacePrefixSuffix(string $parentType): string { - if (\str_ends_with($parentType, 'Interface')) { + if (substr_compare($parentType, 'Interface', -strlen('Interface')) === 0) { $parentType = Strings::substring($parentType, 0, -strlen('Interface')); } - if (\str_ends_with($parentType, 'Abstract')) { + if (substr_compare($parentType, 'Abstract', -strlen('Abstract')) === 0) { $parentType = Strings::substring($parentType, 0, -strlen('Abstract')); } - if (\str_starts_with($parentType, 'Abstract')) { + if (strncmp($parentType, 'Abstract', strlen('Abstract')) === 0) { return Strings::substring($parentType, strlen('Abstract')); } diff --git a/src/NodeAnalyzer/AttributeFinder.php b/src/NodeAnalyzer/AttributeFinder.php index ed0ebebf..a35793d6 100644 --- a/src/NodeAnalyzer/AttributeFinder.php +++ b/src/NodeAnalyzer/AttributeFinder.php @@ -13,15 +13,19 @@ final class AttributeFinder { - public function hasAttribute(ClassLike | ClassMethod | Property | Param $node, string $desiredAttributeClass): bool + /** + * @param \PhpParser\Node\Stmt\ClassLike|\PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Param $node + */ + public function hasAttribute($node, string $desiredAttributeClass): bool { return (bool) $this->findAttribute($node, $desiredAttributeClass); } /** * @return Attribute[] + * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Stmt\ClassLike|\PhpParser\Node\Param $node */ - private function findAttributes(ClassMethod | Property | ClassLike | Param $node): array + private function findAttributes($node): array { $attributes = []; @@ -32,8 +36,11 @@ private function findAttributes(ClassMethod | Property | ClassLike | Param $node return $attributes; } + /** + * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Stmt\ClassLike|\PhpParser\Node\Param $node + */ private function findAttribute( - ClassMethod | Property | ClassLike | Param $node, + $node, string $desiredAttributeClass ): ?Attribute { $attributes = $this->findAttributes($node); diff --git a/src/NodeAnalyzer/EnumAnalyzer.php b/src/NodeAnalyzer/EnumAnalyzer.php index b5f8f94f..87196124 100644 --- a/src/NodeAnalyzer/EnumAnalyzer.php +++ b/src/NodeAnalyzer/EnumAnalyzer.php @@ -14,9 +14,14 @@ final class EnumAnalyzer { - public function __construct( - private readonly BarePhpDocParser $barePhpDocParser - ) { + /** + * @readonly + * @var \Symplify\PHPStanRules\PhpDoc\BarePhpDocParser + */ + private $barePhpDocParser; + public function __construct(BarePhpDocParser $barePhpDocParser) + { + $this->barePhpDocParser = $barePhpDocParser; } public function detect(Scope $scope, ClassLike $classLike): bool @@ -39,7 +44,7 @@ public function detect(Scope $scope, ClassLike $classLike): bool } // is in /Enum/ namespace - return str_contains($classReflection->getName(), '\\Enum\\'); + return strpos($classReflection->getName(), '\\Enum\\') !== false; } private function hasEnumAnnotation(Class_ $class): bool diff --git a/src/NodeFinder/TypeAwareNodeFinder.php b/src/NodeFinder/TypeAwareNodeFinder.php index e00a884f..6b364e31 100644 --- a/src/NodeFinder/TypeAwareNodeFinder.php +++ b/src/NodeFinder/TypeAwareNodeFinder.php @@ -12,7 +12,11 @@ */ final class TypeAwareNodeFinder { - private readonly NodeFinder $nodeFinder; + /** + * @readonly + * @var \PhpParser\NodeFinder + */ + private $nodeFinder; public function __construct() { @@ -22,11 +26,11 @@ public function __construct() /** * @template TNode as Node * - * @param Node[]|Node $nodes + * @param mixed[]|\PhpParser\Node $nodes * @param class-string $type * @return TNode|null */ - public function findFirstInstanceOf(array|Node $nodes, string $type): ?Node + public function findFirstInstanceOf($nodes, string $type): ?Node { return $this->nodeFinder->findFirstInstanceOf($nodes, $type); } diff --git a/src/NodeTraverser/SimpleCallableNodeTraverser.php b/src/NodeTraverser/SimpleCallableNodeTraverser.php index 7bc87b63..e2a050c9 100644 --- a/src/NodeTraverser/SimpleCallableNodeTraverser.php +++ b/src/NodeTraverser/SimpleCallableNodeTraverser.php @@ -15,9 +15,9 @@ final class SimpleCallableNodeTraverser { /** * @param callable(Node $node): (int|Node|null) $callable - * @param Node|Node[]|null $nodes + * @param \PhpParser\Node|mixed[]|null $nodes */ - public function traverseNodesWithCallable(Node | array | null $nodes, callable $callable): void + public function traverseNodesWithCallable($nodes, callable $callable): void { if ($nodes === null) { return; diff --git a/src/NodeVisitor/CallableNodeVisitor.php b/src/NodeVisitor/CallableNodeVisitor.php index 99c77419..86545660 100644 --- a/src/NodeVisitor/CallableNodeVisitor.php +++ b/src/NodeVisitor/CallableNodeVisitor.php @@ -25,7 +25,10 @@ public function __construct(callable $callable) $this->callable = $callable; } - public function enterNode(Node $node): int|Node|null + /** + * @return int|\PhpParser\Node|null + */ + public function enterNode(Node $node) { $originalNode = $node; diff --git a/src/NodeVisitor/HasScopedReturnNodeVisitor.php b/src/NodeVisitor/HasScopedReturnNodeVisitor.php index 58fc19d4..4a3de962 100644 --- a/src/NodeVisitor/HasScopedReturnNodeVisitor.php +++ b/src/NodeVisitor/HasScopedReturnNodeVisitor.php @@ -13,12 +13,19 @@ final class HasScopedReturnNodeVisitor extends NodeVisitorAbstract { - public function __construct( - private bool $hasReturn = false - ) { + /** + * @var bool + */ + private $hasReturn = false; + public function __construct(bool $hasReturn = false) + { + $this->hasReturn = $hasReturn; } - public function enterNode(Node $node): int|Node|null + /** + * @return int|\PhpParser\Node|null + */ + public function enterNode(Node $node) { if ($node instanceof Closure) { return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; diff --git a/src/ParentClassMethodNodeResolver.php b/src/ParentClassMethodNodeResolver.php index 16bbf4d4..5a7898e5 100644 --- a/src/ParentClassMethodNodeResolver.php +++ b/src/ParentClassMethodNodeResolver.php @@ -12,10 +12,20 @@ final class ParentClassMethodNodeResolver { - public function __construct( - private readonly ReflectionParser $reflectionParser, - private readonly ReflectionProvider $reflectionProvider - ) { + /** + * @readonly + * @var \Symplify\PHPStanRules\Reflection\ReflectionParser + */ + private $reflectionParser; + /** + * @readonly + * @var \PHPStan\Reflection\ReflectionProvider + */ + private $reflectionProvider; + public function __construct(ReflectionParser $reflectionParser, ReflectionProvider $reflectionProvider) + { + $this->reflectionParser = $reflectionParser; + $this->reflectionProvider = $reflectionProvider; } public function resolveParentClassMethod(Scope $scope, string $methodName): ?ClassMethod @@ -48,7 +58,9 @@ private function getParentClassReflections(Scope $scope): array // all parent classes and interfaces return array_filter( $mainClassReflection->getAncestors(), - static fn (ClassReflection $classReflection): bool => $classReflection !== $mainClassReflection + static function (ClassReflection $classReflection) use ($mainClassReflection) : bool { + return $classReflection !== $mainClassReflection; + } ); } } diff --git a/src/PhpDoc/BarePhpDocParser.php b/src/PhpDoc/BarePhpDocParser.php index 0617eecf..0678bfef 100644 --- a/src/PhpDoc/BarePhpDocParser.php +++ b/src/PhpDoc/BarePhpDocParser.php @@ -14,10 +14,20 @@ final class BarePhpDocParser { - public function __construct( - private readonly PhpDocParser $phpDocParser, - private readonly Lexer $lexer - ) { + /** + * @readonly + * @var \PHPStan\PhpDocParser\Parser\PhpDocParser + */ + private $phpDocParser; + /** + * @readonly + * @var \PHPStan\PhpDocParser\Lexer\Lexer + */ + private $lexer; + public function __construct(PhpDocParser $phpDocParser, Lexer $lexer) + { + $this->phpDocParser = $phpDocParser; + $this->lexer = $lexer; } /** diff --git a/src/PhpDoc/PhpDocResolver.php b/src/PhpDoc/PhpDocResolver.php index fd892cb7..f1c47ae8 100644 --- a/src/PhpDoc/PhpDocResolver.php +++ b/src/PhpDoc/PhpDocResolver.php @@ -12,9 +12,14 @@ final class PhpDocResolver { - public function __construct( - private readonly FileTypeMapper $fileTypeMapper - ) { + /** + * @readonly + * @var \PHPStan\Type\FileTypeMapper + */ + private $fileTypeMapper; + public function __construct(FileTypeMapper $fileTypeMapper) + { + $this->fileTypeMapper = $fileTypeMapper; } public function resolve(Scope $scope, ClassReflection $classReflection, Doc $doc): ResolvedPhpDocBlock diff --git a/src/PhpDocParser/PhpDocNodeTraverser.php b/src/PhpDocParser/PhpDocNodeTraverser.php index eab2d3f4..9eba9e07 100644 --- a/src/PhpDocParser/PhpDocNodeTraverser.php +++ b/src/PhpDocParser/PhpDocNodeTraverser.php @@ -65,12 +65,12 @@ final class PhpDocNodeTraverser /** * @var bool Whether traversal should be stopped */ - private bool $stopTraversal = false; + private $stopTraversal = false; /** * @var PhpDocNodeVisitorInterface[] */ - private array $phpDocNodeVisitors = []; + private $phpDocNodeVisitors = []; public function addPhpDocNodeVisitor(PhpDocNodeVisitorInterface $phpDocNodeVisitor): void { diff --git a/src/PhpDocParser/PhpDocNodeVisitor/AbstractPhpDocNodeVisitor.php b/src/PhpDocParser/PhpDocNodeVisitor/AbstractPhpDocNodeVisitor.php index 773eea4e..c4a251ce 100644 --- a/src/PhpDocParser/PhpDocNodeVisitor/AbstractPhpDocNodeVisitor.php +++ b/src/PhpDocParser/PhpDocNodeVisitor/AbstractPhpDocNodeVisitor.php @@ -16,7 +16,10 @@ public function beforeTraverse(Node $node): void { } - public function enterNode(Node $node): int|Node|null + /** + * @return int|\PHPStan\PhpDocParser\Ast\Node|null + */ + public function enterNode(Node $node) { return null; } @@ -24,7 +27,7 @@ public function enterNode(Node $node): int|Node|null /** * @return null|int|\PhpParser\Node|Node[] Replacement node (or special return) */ - public function leaveNode(Node $node): int|\PhpParser\Node|array|null + public function leaveNode(Node $node) { return null; } diff --git a/src/PhpDocParser/PhpDocNodeVisitor/CallablePhpDocNodeVisitor.php b/src/PhpDocParser/PhpDocNodeVisitor/CallablePhpDocNodeVisitor.php index 3f6789dd..10294cc5 100644 --- a/src/PhpDocParser/PhpDocNodeVisitor/CallablePhpDocNodeVisitor.php +++ b/src/PhpDocParser/PhpDocNodeVisitor/CallablePhpDocNodeVisitor.php @@ -8,6 +8,11 @@ final class CallablePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor { + /** + * @readonly + * @var string|null + */ + private $docContent; /** * @var callable(Node, string|null): (int|null|Node) */ @@ -18,12 +23,16 @@ final class CallablePhpDocNodeVisitor extends AbstractPhpDocNodeVisitor */ public function __construct( callable $callable, - private readonly ?string $docContent + ?string $docContent ) { + $this->docContent = $docContent; $this->callable = $callable; } - public function enterNode(Node $node): int|Node|null + /** + * @return int|\PHPStan\PhpDocParser\Ast\Node|null + */ + public function enterNode(Node $node) { $callable = $this->callable; return $callable($node, $this->docContent); diff --git a/src/Reflection/ReflectionParser.php b/src/Reflection/ReflectionParser.php index a2c6bd41..2b32b47b 100644 --- a/src/Reflection/ReflectionParser.php +++ b/src/Reflection/ReflectionParser.php @@ -20,21 +20,34 @@ final class ReflectionParser { + /** + * @readonly + * @var \Symplify\PHPStanRules\NodeFinder\TypeAwareNodeFinder + */ + private $typeAwareNodeFinder; /** * @var array */ - private array $classesByFilename = []; + private $classesByFilename = []; - private readonly Parser $parser; + /** + * @readonly + * @var \PhpParser\Parser + */ + private $parser; public function __construct( - private readonly TypeAwareNodeFinder $typeAwareNodeFinder + TypeAwareNodeFinder $typeAwareNodeFinder ) { + $this->typeAwareNodeFinder = $typeAwareNodeFinder; $parserFactory = new ParserFactory(); $this->parser = $parserFactory->create(ParserFactory::PREFER_PHP7); } - public function parseMethodReflection(ReflectionMethod|MethodReflection $reflectionMethod): ?ClassMethod + /** + * @param \ReflectionMethod|\PHPStan\Reflection\MethodReflection $reflectionMethod + */ + public function parseMethodReflection($reflectionMethod): ?ClassMethod { $classLike = $this->parseNativeClassReflection($reflectionMethod->getDeclaringClass()); if (! $classLike instanceof ClassLike) { @@ -57,7 +70,10 @@ public function parseClassReflection(ClassReflection $classReflection): ?ClassLi return $this->parseFilenameToClass($fileName); } - private function parseNativeClassReflection(ReflectionClass|ClassReflection $reflectionClass): ?ClassLike + /** + * @param \ReflectionClass|\PHPStan\Reflection\ClassReflection $reflectionClass + */ + private function parseNativeClassReflection($reflectionClass): ?ClassLike { $fileName = $reflectionClass->getFileName(); if ($fileName === false) { @@ -71,7 +87,7 @@ private function parseNativeClassReflection(ReflectionClass|ClassReflection $ref return $this->parseFilenameToClass($fileName); } - private function parseFilenameToClass(string $fileName): ClassLike|null + private function parseFilenameToClass(string $fileName): ?\PhpParser\Node\Stmt\ClassLike { if (isset($this->classesByFilename[$fileName])) { return $this->classesByFilename[$fileName]; @@ -87,7 +103,7 @@ private function parseFilenameToClass(string $fileName): ClassLike|null $nodeTraverser = new NodeTraverser(); $nodeTraverser->addVisitor(new NameResolver()); $nodeTraverser->traverse($stmts); - } catch (Throwable) { + } catch (Throwable $exception) { // not reachable return null; } diff --git a/src/Rules/AbstractSymplifyRule.php b/src/Rules/AbstractSymplifyRule.php index 35ef5530..906fcd59 100644 --- a/src/Rules/AbstractSymplifyRule.php +++ b/src/Rules/AbstractSymplifyRule.php @@ -14,7 +14,7 @@ /** * @implements Rule */ -abstract class AbstractSymplifyRule implements Rule, ManyNodeRuleInterface, DocumentedRuleInterface +abstract class AbstractSymplifyRule implements Rule, ManyNodeRuleInterface { /** * @return class-string diff --git a/src/Rules/AnnotateRegexClassConstWithRegexLinkRule.php b/src/Rules/AnnotateRegexClassConstWithRegexLinkRule.php index 7b6b3582..b496d20f 100644 --- a/src/Rules/AnnotateRegexClassConstWithRegexLinkRule.php +++ b/src/Rules/AnnotateRegexClassConstWithRegexLinkRule.php @@ -18,7 +18,7 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\AnnotateRegexClassConstWithRegexLinkRule\AnnotateRegexClassConstWithRegexLinkRuleTest */ -final class AnnotateRegexClassConstWithRegexLinkRule implements Rule, DocumentedRuleInterface +final class AnnotateRegexClassConstWithRegexLinkRule implements Rule { /** * @var string @@ -126,11 +126,11 @@ private function hasDocBlockWithRegexLink(ClassConst $classConst): bool } $docCommentText = $docComment->getText(); - return \str_contains($docCommentText, '@see https://regex101.com/r'); + return strpos($docCommentText, '@see https://regex101.com/r') !== false; } private function isRegexPatternConstantName(string $constantName): bool { - return \str_ends_with($constantName, '_REGEX'); + return substr_compare($constantName, '_REGEX', -strlen('_REGEX')) === 0; } } diff --git a/src/Rules/CheckClassNamespaceFollowPsr4Rule.php b/src/Rules/CheckClassNamespaceFollowPsr4Rule.php index f09e453e..965598c2 100644 --- a/src/Rules/CheckClassNamespaceFollowPsr4Rule.php +++ b/src/Rules/CheckClassNamespaceFollowPsr4Rule.php @@ -19,8 +19,18 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\CheckClassNamespaceFollowPsr4Rule\CheckClassNamespaceFollowPsr4RuleTest */ -final class CheckClassNamespaceFollowPsr4Rule implements Rule, DocumentedRuleInterface +final class CheckClassNamespaceFollowPsr4Rule implements Rule { + /** + * @readonly + * @var \Symplify\PHPStanRules\Composer\Psr4PathValidator + */ + private $psr4PathValidator; + /** + * @readonly + * @var \Symplify\PHPStanRules\Composer\ClassNamespaceMatcher + */ + private $classNamespaceMatcher; /** * @var string */ @@ -29,13 +39,15 @@ final class CheckClassNamespaceFollowPsr4Rule implements Rule, DocumentedRuleInt /** * @var array */ - private array $autoloadPsr4Paths = []; + private $autoloadPsr4Paths = []; public function __construct( ComposerAutoloadResolver $composerAutoloadResolver, - private readonly Psr4PathValidator $psr4PathValidator, - private readonly ClassNamespaceMatcher $classNamespaceMatcher + Psr4PathValidator $psr4PathValidator, + ClassNamespaceMatcher $classNamespaceMatcher ) { + $this->psr4PathValidator = $psr4PathValidator; + $this->classNamespaceMatcher = $classNamespaceMatcher; $this->autoloadPsr4Paths = $composerAutoloadResolver->getPsr4Autoload(); } diff --git a/src/Rules/CheckRequiredInterfaceInContractNamespaceRule.php b/src/Rules/CheckRequiredInterfaceInContractNamespaceRule.php index c84e3424..d9a403d9 100644 --- a/src/Rules/CheckRequiredInterfaceInContractNamespaceRule.php +++ b/src/Rules/CheckRequiredInterfaceInContractNamespaceRule.php @@ -17,7 +17,7 @@ * @see \Symplify\PHPStanRules\Tests\Rules\CheckRequiredInterfaceInContractNamespaceRule\CheckRequiredInterfaceInContractNamespaceRuleTest * @implements Rule */ -final class CheckRequiredInterfaceInContractNamespaceRule implements Rule, DocumentedRuleInterface +final class CheckRequiredInterfaceInContractNamespaceRule implements Rule { /** * @var string diff --git a/src/Rules/ClassNameRespectsParentSuffixRule.php b/src/Rules/ClassNameRespectsParentSuffixRule.php index 298a07da..5bc52062 100644 --- a/src/Rules/ClassNameRespectsParentSuffixRule.php +++ b/src/Rules/ClassNameRespectsParentSuffixRule.php @@ -25,8 +25,13 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\ClassNameRespectsParentSuffixRule\ClassNameRespectsParentSuffixRuleTest */ -final class ClassNameRespectsParentSuffixRule implements Rule, DocumentedRuleInterface, ConfigurableRuleInterface +final class ClassNameRespectsParentSuffixRule implements Rule { + /** + * @readonly + * @var \Symplify\PHPStanRules\Naming\ClassToSuffixResolver + */ + private $classToSuffixResolver; /** * @var string */ @@ -50,15 +55,14 @@ final class ClassNameRespectsParentSuffixRule implements Rule, DocumentedRuleInt /** * @var string[] */ - private array $parentClasses = []; + private $parentClasses = []; /** * @param class-string[] $parentClasses */ - public function __construct( - private readonly ClassToSuffixResolver $classToSuffixResolver, - array $parentClasses = [], - ) { + public function __construct(ClassToSuffixResolver $classToSuffixResolver, array $parentClasses = []) + { + $this->classToSuffixResolver = $classToSuffixResolver; $this->parentClasses = array_merge($parentClasses, self::DEFAULT_PARENT_CLASSES); } @@ -127,7 +131,7 @@ private function processClassNameAndShort(ClassReflection $classReflection): arr } $expectedSuffix = $this->classToSuffixResolver->resolveFromClass($parentClass); - if (\str_ends_with($classReflection->getName(), $expectedSuffix)) { + if (substr_compare($classReflection->getName(), $expectedSuffix, -strlen($expectedSuffix)) === 0) { return []; } diff --git a/src/Rules/Complexity/ForbiddenArrayMethodCallRule.php b/src/Rules/Complexity/ForbiddenArrayMethodCallRule.php index 872afa46..2d0c4650 100644 --- a/src/Rules/Complexity/ForbiddenArrayMethodCallRule.php +++ b/src/Rules/Complexity/ForbiddenArrayMethodCallRule.php @@ -18,7 +18,7 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\Complexity\ForbiddenArrayMethodCallRule\ForbiddenArrayMethodCallRuleTest */ -final class ForbiddenArrayMethodCallRule implements Rule, DocumentedRuleInterface +final class ForbiddenArrayMethodCallRule implements Rule { /** * @var string diff --git a/src/Rules/Domain/RequireAttributeNamespaceRule.php b/src/Rules/Domain/RequireAttributeNamespaceRule.php index bab902cc..dafcd091 100644 --- a/src/Rules/Domain/RequireAttributeNamespaceRule.php +++ b/src/Rules/Domain/RequireAttributeNamespaceRule.php @@ -15,7 +15,7 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\Domain\RequireAttributeNamespaceRule\RequireAttributeNamespaceRuleTest */ -final class RequireAttributeNamespaceRule implements Rule, DocumentedRuleInterface +final class RequireAttributeNamespaceRule implements Rule { /** * @var string @@ -70,7 +70,7 @@ public function processNode(Node $node, Scope $scope): array // is class in "Attribute" namespace? $className = $classReflection->getName(); - if (str_contains($className, '\\Attribute\\')) { + if (strpos($className, '\\Attribute\\') !== false) { return []; } diff --git a/src/Rules/Domain/RequireExceptionNamespaceRule.php b/src/Rules/Domain/RequireExceptionNamespaceRule.php index afcd522c..bf922c56 100644 --- a/src/Rules/Domain/RequireExceptionNamespaceRule.php +++ b/src/Rules/Domain/RequireExceptionNamespaceRule.php @@ -15,7 +15,7 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\Domain\RequireExceptionNamespaceRule\RequireExceptionNamespaceRuleTest */ -final class RequireExceptionNamespaceRule implements Rule, DocumentedRuleInterface +final class RequireExceptionNamespaceRule implements Rule { /** * @var string @@ -73,7 +73,7 @@ public function processNode(Node $node, Scope $scope): array // is class in "Exception" namespace? $className = $classReflection->getName(); - if (str_contains($className, '\\Exception\\')) { + if (strpos($className, '\\Exception\\') !== false) { return []; } diff --git a/src/Rules/Enum/RequireUniqueEnumConstantRule.php b/src/Rules/Enum/RequireUniqueEnumConstantRule.php index 49d722b0..f02c8e53 100644 --- a/src/Rules/Enum/RequireUniqueEnumConstantRule.php +++ b/src/Rules/Enum/RequireUniqueEnumConstantRule.php @@ -18,16 +18,21 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\Enum\RequireUniqueEnumConstantRule\RequireUniqueEnumConstantRuleTest */ -final class RequireUniqueEnumConstantRule implements Rule, DocumentedRuleInterface +final class RequireUniqueEnumConstantRule implements Rule { + /** + * @readonly + * @var \Symplify\PHPStanRules\NodeAnalyzer\EnumAnalyzer + */ + private $enumAnalyzer; /** * @var string */ public const ERROR_MESSAGE = 'Enum constants "%s" are duplicated. Make them unique instead'; - public function __construct( - private readonly EnumAnalyzer $enumAnalyzer - ) { + public function __construct(EnumAnalyzer $enumAnalyzer) + { + $this->enumAnalyzer = $enumAnalyzer; } /** diff --git a/src/Rules/Explicit/ExplicitClassPrefixSuffixRule.php b/src/Rules/Explicit/ExplicitClassPrefixSuffixRule.php index 4768b1a5..5b132895 100644 --- a/src/Rules/Explicit/ExplicitClassPrefixSuffixRule.php +++ b/src/Rules/Explicit/ExplicitClassPrefixSuffixRule.php @@ -20,7 +20,7 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\Explicit\ExplicitClassPrefixSuffixRule\ExplicitClassPrefixSuffixRuleTest */ -final class ExplicitClassPrefixSuffixRule implements Rule, DocumentedRuleInterface +final class ExplicitClassPrefixSuffixRule implements Rule { /** * @api @@ -117,11 +117,11 @@ public function processNode(Node $node, Scope $scope): array */ private function processInterfaceSuffix(Identifier $identifier): array { - if (str_ends_with($identifier->toString(), 'Interface')) { + if (substr_compare($identifier->toString(), 'Interface', -strlen('Interface')) === 0) { return []; } - if (str_ends_with($identifier->toString(), 'Trait')) { + if (substr_compare($identifier->toString(), 'Trait', -strlen('Trait')) === 0) { return [self::TRAIT_ERROR_MESSAGE]; } @@ -133,7 +133,7 @@ private function processInterfaceSuffix(Identifier $identifier): array */ private function processTraitSuffix(Identifier $identifier): array { - if (str_ends_with($identifier->toString(), 'Trait')) { + if (substr_compare($identifier->toString(), 'Trait', -strlen('Trait')) === 0) { return []; } @@ -145,19 +145,19 @@ private function processTraitSuffix(Identifier $identifier): array */ private function processClassSuffix(Identifier $identifier, bool $isAbstract): array { - if ($isAbstract && ! str_starts_with($identifier->toString(), 'Abstract')) { + if ($isAbstract && strncmp($identifier->toString(), 'Abstract', strlen('Abstract')) !== 0) { return [self::ABSTRACT_ERROR_MESSAGE]; } - if (! $isAbstract && str_starts_with($identifier->toString(), 'Abstract')) { + if (! $isAbstract && strncmp($identifier->toString(), 'Abstract', strlen('Abstract')) === 0) { return [self::ABSTRACT_ERROR_MESSAGE]; } - if (str_ends_with($identifier->toString(), 'Interface')) { + if (substr_compare($identifier->toString(), 'Interface', -strlen('Interface')) === 0) { return [self::INTERFACE_ERROR_MESSAGE]; } - if (str_ends_with($identifier->toString(), 'Trait')) { + if (substr_compare($identifier->toString(), 'Trait', -strlen('Trait')) === 0) { return [self::TRAIT_ERROR_MESSAGE]; } diff --git a/src/Rules/ForbiddenExtendOfNonAbstractClassRule.php b/src/Rules/ForbiddenExtendOfNonAbstractClassRule.php index 20c622f8..4ea228c5 100644 --- a/src/Rules/ForbiddenExtendOfNonAbstractClassRule.php +++ b/src/Rules/ForbiddenExtendOfNonAbstractClassRule.php @@ -16,7 +16,7 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\ForbiddenExtendOfNonAbstractClassRule\ForbiddenExtendOfNonAbstractClassRuleTest */ -final class ForbiddenExtendOfNonAbstractClassRule implements Rule, DocumentedRuleInterface +final class ForbiddenExtendOfNonAbstractClassRule implements Rule { /** * @var string @@ -59,7 +59,7 @@ public function processNode(Node $node, Scope $scope): array // skip vendor based classes, as designed for extension $fileName = $parentClassReflection->getFileName(); - if (is_string($fileName) && str_contains($fileName, 'vendor')) { + if (is_string($fileName) && strpos($fileName, 'vendor') !== false) { return []; } diff --git a/src/Rules/ForbiddenFuncCallRule.php b/src/Rules/ForbiddenFuncCallRule.php index 6b633d1c..8fc93bbe 100644 --- a/src/Rules/ForbiddenFuncCallRule.php +++ b/src/Rules/ForbiddenFuncCallRule.php @@ -23,8 +23,23 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\ForbiddenFuncCallRule\ForbiddenFuncCallRuleTest */ -final class ForbiddenFuncCallRule implements Rule, DocumentedRuleInterface, ConfigurableRuleInterface +final class ForbiddenFuncCallRule implements Rule { + /** + * @var string[]|array<(string | int), string> + * @readonly + */ + private $forbiddenFunctions; + /** + * @readonly + * @var \Symplify\PHPStanRules\Matcher\ArrayStringAndFnMatcher + */ + private $arrayStringAndFnMatcher; + /** + * @readonly + * @var \Symplify\PHPStanRules\Formatter\RequiredWithMessageFormatter + */ + private $requiredWithMessageFormatter; /** * @var string */ @@ -33,11 +48,11 @@ final class ForbiddenFuncCallRule implements Rule, DocumentedRuleInterface, Conf /** * @param string[]|array $forbiddenFunctions */ - public function __construct( - private readonly array $forbiddenFunctions, - private readonly ArrayStringAndFnMatcher $arrayStringAndFnMatcher, - private readonly RequiredWithMessageFormatter $requiredWithMessageFormatter, - ) { + public function __construct(array $forbiddenFunctions, ArrayStringAndFnMatcher $arrayStringAndFnMatcher, RequiredWithMessageFormatter $requiredWithMessageFormatter) + { + $this->forbiddenFunctions = $forbiddenFunctions; + $this->arrayStringAndFnMatcher = $arrayStringAndFnMatcher; + $this->requiredWithMessageFormatter = $requiredWithMessageFormatter; } /** diff --git a/src/Rules/ForbiddenMultipleClassLikeInOneFileRule.php b/src/Rules/ForbiddenMultipleClassLikeInOneFileRule.php index 19afa4d9..01606d9f 100644 --- a/src/Rules/ForbiddenMultipleClassLikeInOneFileRule.php +++ b/src/Rules/ForbiddenMultipleClassLikeInOneFileRule.php @@ -18,14 +18,18 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\ForbiddenMultipleClassLikeInOneFileRule\ForbiddenMultipleClassLikeInOneFileRuleTest */ -final class ForbiddenMultipleClassLikeInOneFileRule implements Rule, DocumentedRuleInterface +final class ForbiddenMultipleClassLikeInOneFileRule implements Rule { /** * @var string */ public const ERROR_MESSAGE = 'Multiple class/interface/trait is not allowed in single file'; - private readonly NodeFinder $nodeFinder; + /** + * @readonly + * @var \PhpParser\NodeFinder + */ + private $nodeFinder; public function __construct( ) { diff --git a/src/Rules/ForbiddenNodeRule.php b/src/Rules/ForbiddenNodeRule.php index a2576f51..ade2d760 100644 --- a/src/Rules/ForbiddenNodeRule.php +++ b/src/Rules/ForbiddenNodeRule.php @@ -21,8 +21,13 @@ * @see \Symplify\PHPStanRules\Tests\Rules\ForbiddenNodeRule\ForbiddenNodeRuleTest * @implements Rule */ -final class ForbiddenNodeRule implements Rule, DocumentedRuleInterface, ConfigurableRuleInterface +final class ForbiddenNodeRule implements Rule { + /** + * @readonly + * @var \PhpParser\PrettyPrinter\Standard + */ + private $standard; /** * @var string */ @@ -31,15 +36,16 @@ final class ForbiddenNodeRule implements Rule, DocumentedRuleInterface, Configur /** * @var array> */ - private array $forbiddenNodes = []; + private $forbiddenNodes = []; /** * @param array> $forbiddenNodes */ public function __construct( - private readonly Standard $standard, + Standard $standard, array $forbiddenNodes ) { + $this->standard = $standard; Assert::allIsAOf($forbiddenNodes, Node::class); $this->forbiddenNodes = $forbiddenNodes; diff --git a/src/Rules/ForbiddenStaticClassConstFetchRule.php b/src/Rules/ForbiddenStaticClassConstFetchRule.php index aae53e98..480d2b53 100644 --- a/src/Rules/ForbiddenStaticClassConstFetchRule.php +++ b/src/Rules/ForbiddenStaticClassConstFetchRule.php @@ -16,7 +16,7 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\ForbiddenStaticClassConstFetchRule\ForbiddenStaticClassConstFetchRuleTest */ -final class ForbiddenStaticClassConstFetchRule implements Rule, DocumentedRuleInterface +final class ForbiddenStaticClassConstFetchRule implements Rule { /** * @var string diff --git a/src/Rules/NoDynamicNameRule.php b/src/Rules/NoDynamicNameRule.php index 35783553..e627ab3b 100644 --- a/src/Rules/NoDynamicNameRule.php +++ b/src/Rules/NoDynamicNameRule.php @@ -23,14 +23,19 @@ */ final class NoDynamicNameRule extends AbstractSymplifyRule { + /** + * @readonly + * @var \Symplify\PHPStanRules\TypeAnalyzer\CallableTypeAnalyzer + */ + private $callableTypeAnalyzer; /** * @var string */ public const ERROR_MESSAGE = 'Use explicit names over dynamic ones'; - public function __construct( - private readonly CallableTypeAnalyzer $callableTypeAnalyzer, - ) { + public function __construct(CallableTypeAnalyzer $callableTypeAnalyzer) + { + $this->callableTypeAnalyzer = $callableTypeAnalyzer; } /** diff --git a/src/Rules/NoEntityOutsideEntityNamespaceRule.php b/src/Rules/NoEntityOutsideEntityNamespaceRule.php index 44983726..1c0731c7 100644 --- a/src/Rules/NoEntityOutsideEntityNamespaceRule.php +++ b/src/Rules/NoEntityOutsideEntityNamespaceRule.php @@ -16,7 +16,7 @@ /** * @implements Rule */ -final class NoEntityOutsideEntityNamespaceRule implements Rule, DocumentedRuleInterface +final class NoEntityOutsideEntityNamespaceRule implements Rule { /** * @var string diff --git a/src/Rules/NoGlobalConstRule.php b/src/Rules/NoGlobalConstRule.php index 043f56d9..e1ae56fe 100644 --- a/src/Rules/NoGlobalConstRule.php +++ b/src/Rules/NoGlobalConstRule.php @@ -16,7 +16,7 @@ * @implements Rule * @see \Symplify\PHPStanRules\Tests\Rules\NoGlobalConstRule\NoGlobalConstRuleTest */ -final class NoGlobalConstRule implements Rule, DocumentedRuleInterface +final class NoGlobalConstRule implements Rule { /** * @var string diff --git a/src/Rules/NoInlineStringRegexRule.php b/src/Rules/NoInlineStringRegexRule.php index 32e75cd8..f4fd1875 100644 --- a/src/Rules/NoInlineStringRegexRule.php +++ b/src/Rules/NoInlineStringRegexRule.php @@ -21,17 +21,27 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\NoInlineStringRegexRule\NoInlineStringRegexRuleTest */ -final class NoInlineStringRegexRule implements Rule, DocumentedRuleInterface +final class NoInlineStringRegexRule implements Rule { + /** + * @readonly + * @var \Symplify\PHPStanRules\NodeAnalyzer\RegexFuncCallAnalyzer + */ + private $regexFuncCallAnalyzer; + /** + * @readonly + * @var \Symplify\PHPStanRules\NodeAnalyzer\RegexStaticCallAnalyzer + */ + private $regexStaticCallAnalyzer; /** * @var string */ public const ERROR_MESSAGE = 'Use local named constant instead of inline string for regex to explain meaning by constant name'; - public function __construct( - private readonly RegexFuncCallAnalyzer $regexFuncCallAnalyzer, - private readonly RegexStaticCallAnalyzer $regexStaticCallAnalyzer - ) { + public function __construct(RegexFuncCallAnalyzer $regexFuncCallAnalyzer, RegexStaticCallAnalyzer $regexStaticCallAnalyzer) + { + $this->regexFuncCallAnalyzer = $regexFuncCallAnalyzer; + $this->regexStaticCallAnalyzer = $regexStaticCallAnalyzer; } /** diff --git a/src/Rules/NoReferenceRule.php b/src/Rules/NoReferenceRule.php index 47b584e4..22cec296 100644 --- a/src/Rules/NoReferenceRule.php +++ b/src/Rules/NoReferenceRule.php @@ -24,14 +24,19 @@ */ final class NoReferenceRule extends AbstractSymplifyRule { + /** + * @readonly + * @var \Symplify\PHPStanRules\ParentClassMethodNodeResolver + */ + private $parentClassMethodNodeResolver; /** * @var string */ public const ERROR_MESSAGE = 'Use explicit return value over magic &reference'; - public function __construct( - private readonly ParentClassMethodNodeResolver $parentClassMethodNodeResolver, - ) { + public function __construct(ParentClassMethodNodeResolver $parentClassMethodNodeResolver) + { + $this->parentClassMethodNodeResolver = $parentClassMethodNodeResolver; } /** diff --git a/src/Rules/NoReturnArrayVariableListRule.php b/src/Rules/NoReturnArrayVariableListRule.php index f5055602..11f3c01f 100644 --- a/src/Rules/NoReturnArrayVariableListRule.php +++ b/src/Rules/NoReturnArrayVariableListRule.php @@ -23,8 +23,13 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\NoReturnArrayVariableListRule\NoReturnArrayVariableListRuleTest */ -final class NoReturnArrayVariableListRule implements Rule, DocumentedRuleInterface +final class NoReturnArrayVariableListRule implements Rule { + /** + * @readonly + * @var \Symplify\PHPStanRules\ParentClassMethodNodeResolver + */ + private $parentClassMethodNodeResolver; /** * @var string */ @@ -36,9 +41,9 @@ final class NoReturnArrayVariableListRule implements Rule, DocumentedRuleInterfa */ private const TESTS_DIRECTORY_REGEX = '#\/Tests\/#i'; - public function __construct( - private readonly ParentClassMethodNodeResolver $parentClassMethodNodeResolver, - ) { + public function __construct(ParentClassMethodNodeResolver $parentClassMethodNodeResolver) + { + $this->parentClassMethodNodeResolver = $parentClassMethodNodeResolver; } /** @@ -117,11 +122,11 @@ private function shouldSkip(Scope $scope, Return_ $return): bool return true; } - if (str_contains($namespace, 'Enum')) { + if (strpos($namespace, 'Enum') !== false) { return true; } - if (str_contains($namespace, 'ValueObject')) { + if (strpos($namespace, 'ValueObject') !== false) { return true; } diff --git a/src/Rules/NoReturnSetterMethodRule.php b/src/Rules/NoReturnSetterMethodRule.php index 0a4ee1ba..132b3e15 100644 --- a/src/Rules/NoReturnSetterMethodRule.php +++ b/src/Rules/NoReturnSetterMethodRule.php @@ -21,8 +21,13 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\NoReturnSetterMethodRule\NoReturnSetterMethodRuleTest */ -final class NoReturnSetterMethodRule implements Rule, DocumentedRuleInterface +final class NoReturnSetterMethodRule implements Rule { + /** + * @readonly + * @var \Symplify\PHPStanRules\NodeFinder\TypeAwareNodeFinder + */ + private $typeAwareNodeFinder; /** * @var string */ @@ -34,9 +39,9 @@ final class NoReturnSetterMethodRule implements Rule, DocumentedRuleInterface */ private const SETTER_START_REGEX = '#^set[A-Z]#'; - public function __construct( - private readonly TypeAwareNodeFinder $typeAwareNodeFinder - ) { + public function __construct(TypeAwareNodeFinder $typeAwareNodeFinder) + { + $this->typeAwareNodeFinder = $typeAwareNodeFinder; } /** diff --git a/src/Rules/NoSingleInterfaceImplementerRule.php b/src/Rules/NoSingleInterfaceImplementerRule.php index 95d9bd88..fe62e577 100644 --- a/src/Rules/NoSingleInterfaceImplementerRule.php +++ b/src/Rules/NoSingleInterfaceImplementerRule.php @@ -21,17 +21,22 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\NoSingleInterfaceImplementerRule\NoSingleInterfaceImplementerRuleTest */ -final class NoSingleInterfaceImplementerRule implements Rule, DocumentedRuleInterface +final class NoSingleInterfaceImplementerRule implements Rule { + /** + * @readonly + * @var \PHPStan\Reflection\ReflectionProvider + */ + private $reflectionProvider; /** * @api used in test * @var string */ public const ERROR_MESSAGE = 'Interface "%s" has only single implementer. Consider using the class directly as there is no point in using the interface.'; - public function __construct( - private readonly ReflectionProvider $reflectionProvider - ) { + public function __construct(ReflectionProvider $reflectionProvider) + { + $this->reflectionProvider = $reflectionProvider; } public function getNodeType(): string diff --git a/src/Rules/PHPUnit/NoTestMocksRule.php b/src/Rules/PHPUnit/NoTestMocksRule.php index bfc705e4..9ba5d762 100644 --- a/src/Rules/PHPUnit/NoTestMocksRule.php +++ b/src/Rules/PHPUnit/NoTestMocksRule.php @@ -17,8 +17,13 @@ /** * @implements Rule */ -final class NoTestMocksRule implements Rule, DocumentedRuleInterface +final class NoTestMocksRule implements Rule { + /** + * @var string[] + * @readonly + */ + private $allowedTypes = []; /** * @api * @var string @@ -33,9 +38,9 @@ final class NoTestMocksRule implements Rule, DocumentedRuleInterface /** * @param string[] $allowedTypes */ - public function __construct( - private readonly array $allowedTypes = [] - ) { + public function __construct(array $allowedTypes = []) + { + $this->allowedTypes = $allowedTypes; } /** diff --git a/src/Rules/PreferredClassRule.php b/src/Rules/PreferredClassRule.php index c7a703a0..45284184 100644 --- a/src/Rules/PreferredClassRule.php +++ b/src/Rules/PreferredClassRule.php @@ -22,21 +22,24 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\PreferredClassRule\PreferredClassRuleTest */ -final class PreferredClassRule extends AbstractSymplifyRule implements ConfigurableRuleInterface +final class PreferredClassRule extends AbstractSymplifyRule { + /** + * @var string[] + * @readonly + */ + private $oldToPreferredClasses; /** * @var string */ public const ERROR_MESSAGE = 'Instead of "%s" class/interface use "%s"'; - /** * @param string[] $oldToPreferredClasses */ - public function __construct( - private readonly array $oldToPreferredClasses - ) { + public function __construct(array $oldToPreferredClasses) + { + $this->oldToPreferredClasses = $oldToPreferredClasses; } - /** * @return array> */ @@ -44,7 +47,6 @@ public function getNodeTypes(): array { return [New_::class, Name::class, InClassNode::class, StaticCall::class, Instanceof_::class]; } - /** * @param New_|Name|InClassNode|StaticCall|Instanceof_ $node * @return string[] @@ -65,7 +67,6 @@ public function process(Node $node, Scope $scope): array return $this->processClassName($node->toString()); } - public function getRuleDefinition(): RuleDefinition { return new RuleDefinition(self::ERROR_MESSAGE, [ @@ -98,7 +99,6 @@ public function run() ), ]); } - /** * @return string[] */ @@ -111,7 +111,6 @@ private function processNew(New_ $new): array $className = $new->class->toString(); return $this->processClassName($className); } - /** * @return string[] */ @@ -143,7 +142,6 @@ private function processClass(InClassNode $inClassNode): array return []; } - /** * @return string[] */ @@ -160,11 +158,11 @@ private function processClassName(string $className): array return []; } - /** * @return string[] + * @param \PhpParser\Node\Expr\StaticCall|\PhpParser\Node\Expr\Instanceof_ $node */ - private function processExprWithClass(StaticCall|Instanceof_ $node): array + private function processExprWithClass($node): array { if ($node->class instanceof Expr) { return []; diff --git a/src/Rules/PreventParentMethodVisibilityOverrideRule.php b/src/Rules/PreventParentMethodVisibilityOverrideRule.php index a6e8c489..c6056df8 100644 --- a/src/Rules/PreventParentMethodVisibilityOverrideRule.php +++ b/src/Rules/PreventParentMethodVisibilityOverrideRule.php @@ -18,16 +18,21 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\PreventParentMethodVisibilityOverrideRule\PreventParentMethodVisibilityOverrideRuleTest */ -final class PreventParentMethodVisibilityOverrideRule implements Rule, DocumentedRuleInterface +final class PreventParentMethodVisibilityOverrideRule implements Rule { + /** + * @readonly + * @var \PHPStan\Reflection\ReflectionProvider + */ + private $reflectionProvider; /** * @var string */ public const ERROR_MESSAGE = 'Change "%s()" method visibility to "%s" to respect parent method visibility.'; - public function __construct( - private readonly ReflectionProvider $reflectionProvider - ) { + public function __construct(ReflectionProvider $reflectionProvider) + { + $this->reflectionProvider = $reflectionProvider; } /** diff --git a/src/Rules/Rector/NoInstanceOfStaticReflectionRule.php b/src/Rules/Rector/NoInstanceOfStaticReflectionRule.php index 14ee0e8b..5179a9b0 100644 --- a/src/Rules/Rector/NoInstanceOfStaticReflectionRule.php +++ b/src/Rules/Rector/NoInstanceOfStaticReflectionRule.php @@ -59,7 +59,10 @@ public function processNode(Node $node, Scope $scope): array return [self::ERROR_MESSAGE]; } - private function resolveExprStaticType(FuncCall|Instanceof_ $node, Scope $scope): ?Type + /** + * @param \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\Instanceof_ $node + */ + private function resolveExprStaticType($node, Scope $scope): ?Type { if ($node instanceof Instanceof_) { return $this->resolveInstanceOfType($node, $scope); diff --git a/src/Rules/Rector/NoLeadingBackslashInNameRule.php b/src/Rules/Rector/NoLeadingBackslashInNameRule.php index 27f0ac06..8f8f2aa0 100644 --- a/src/Rules/Rector/NoLeadingBackslashInNameRule.php +++ b/src/Rules/Rector/NoLeadingBackslashInNameRule.php @@ -56,7 +56,7 @@ public function processNode(Node $node, Scope $scope): array return []; } - if (! str_starts_with($argType->getValue(), '\\')) { + if (strncmp($argType->getValue(), '\\', strlen('\\')) !== 0) { return []; } diff --git a/src/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule.php b/src/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule.php index de3d1d5b..44e9409f 100644 --- a/src/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule.php +++ b/src/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule.php @@ -60,7 +60,7 @@ public function processNode(Node $node, Scope $scope): array $configContent = FileSystem::read($configFilePath); // is rule registered? - if (str_contains($configContent, $className)) { + if (strpos($configContent, $className) !== false) { return []; } diff --git a/src/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule.php b/src/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule.php index 1c49f584..a186cb49 100644 --- a/src/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule.php +++ b/src/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule.php @@ -43,7 +43,7 @@ public function processNode(Node $node, Scope $scope): array { /** @var string $className */ $className = (string) $node->namespacedName; - if (! str_ends_with($className, 'Rector')) { + if (substr_compare($className, 'Rector', -strlen('Rector')) !== 0) { return []; } diff --git a/src/Rules/Rector/RequireAssertConfigureValueObjectRectorRule.php b/src/Rules/Rector/RequireAssertConfigureValueObjectRectorRule.php index 57905363..0c3ded29 100644 --- a/src/Rules/Rector/RequireAssertConfigureValueObjectRectorRule.php +++ b/src/Rules/Rector/RequireAssertConfigureValueObjectRectorRule.php @@ -31,7 +31,11 @@ final class RequireAssertConfigureValueObjectRectorRule implements Rule */ public const ERROR_MESSAGE = 'Method configure() with passed value object must contain assert to verify passed type'; - private readonly NodeFinder $nodeFinder; + /** + * @readonly + * @var \PhpParser\NodeFinder + */ + private $nodeFinder; public function __construct( ) { diff --git a/src/Rules/RegexSuffixInRegexConstantRule.php b/src/Rules/RegexSuffixInRegexConstantRule.php index 1f57440d..67bad613 100644 --- a/src/Rules/RegexSuffixInRegexConstantRule.php +++ b/src/Rules/RegexSuffixInRegexConstantRule.php @@ -21,17 +21,27 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\RegexSuffixInRegexConstantRule\RegexSuffixInRegexConstantRuleTest */ -final class RegexSuffixInRegexConstantRule implements Rule, DocumentedRuleInterface +final class RegexSuffixInRegexConstantRule implements Rule { + /** + * @readonly + * @var \Symplify\PHPStanRules\NodeAnalyzer\RegexFuncCallAnalyzer + */ + private $regexFuncCallAnalyzer; + /** + * @readonly + * @var \Symplify\PHPStanRules\NodeAnalyzer\RegexStaticCallAnalyzer + */ + private $regexStaticCallAnalyzer; /** * @var string */ public const ERROR_MESSAGE = 'Name your constant with "_REGEX" suffix, instead of "%s"'; - public function __construct( - private readonly RegexFuncCallAnalyzer $regexFuncCallAnalyzer, - private readonly RegexStaticCallAnalyzer $regexStaticCallAnalyzer - ) { + public function __construct(RegexFuncCallAnalyzer $regexFuncCallAnalyzer, RegexStaticCallAnalyzer $regexStaticCallAnalyzer) + { + $this->regexFuncCallAnalyzer = $regexFuncCallAnalyzer; + $this->regexStaticCallAnalyzer = $regexStaticCallAnalyzer; } /** @@ -104,7 +114,7 @@ private function processConstantName(Expr $expr): array } $constantName = (string) $expr->name; - if (\str_ends_with($constantName, '_REGEX')) { + if (substr_compare($constantName, '_REGEX', -strlen('_REGEX')) === 0) { return []; } diff --git a/src/Rules/RequireAttributeNameRule.php b/src/Rules/RequireAttributeNameRule.php index 06943c8b..a1fb18fb 100644 --- a/src/Rules/RequireAttributeNameRule.php +++ b/src/Rules/RequireAttributeNameRule.php @@ -20,7 +20,7 @@ * @see \Symplify\PHPStanRules\Tests\Rules\RequireAttributeNameRule\RequireAttributeNameRuleTest * @implements Rule */ -final class RequireAttributeNameRule implements Rule, DocumentedRuleInterface +final class RequireAttributeNameRule implements Rule { /** * @var string @@ -78,7 +78,7 @@ public function processNode(Node $node, Scope $scope): array } // skip PHPUnit - if (str_starts_with($attributeName, 'PHPUnit\Framework\Attributes\\')) { + if (strncmp($attributeName, 'PHPUnit\Framework\Attributes\\', strlen('PHPUnit\Framework\Attributes\\')) === 0) { continue; } diff --git a/src/Rules/SeeAnnotationToTestRule.php b/src/Rules/SeeAnnotationToTestRule.php index 19c1dd3b..907153f1 100644 --- a/src/Rules/SeeAnnotationToTestRule.php +++ b/src/Rules/SeeAnnotationToTestRule.php @@ -25,8 +25,23 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\SeeAnnotationToTestRule\SeeAnnotationToTestRuleTest */ -final class SeeAnnotationToTestRule implements Rule, DocumentedRuleInterface, ConfigurableRuleInterface +final class SeeAnnotationToTestRule implements Rule { + /** + * @readonly + * @var \Symplify\PHPStanRules\PhpDoc\PhpDocResolver + */ + private $phpDocResolver; + /** + * @readonly + * @var \Symplify\PHPStanRules\PhpDoc\SeePhpDocTagNodesFinder + */ + private $seePhpDocTagNodesFinder; + /** + * @var string[] + * @readonly + */ + private $requiredSeeTypes; /** * @var string */ @@ -35,11 +50,11 @@ final class SeeAnnotationToTestRule implements Rule, DocumentedRuleInterface, Co /** * @param string[] $requiredSeeTypes */ - public function __construct( - private readonly PhpDocResolver $phpDocResolver, - private readonly SeePhpDocTagNodesFinder $seePhpDocTagNodesFinder, - private readonly array $requiredSeeTypes - ) { + public function __construct(PhpDocResolver $phpDocResolver, SeePhpDocTagNodesFinder $seePhpDocTagNodesFinder, array $requiredSeeTypes) + { + $this->phpDocResolver = $phpDocResolver; + $this->seePhpDocTagNodesFinder = $seePhpDocTagNodesFinder; + $this->requiredSeeTypes = $requiredSeeTypes; } /** diff --git a/src/Rules/UppercaseConstantRule.php b/src/Rules/UppercaseConstantRule.php index cf885671..cce7d720 100644 --- a/src/Rules/UppercaseConstantRule.php +++ b/src/Rules/UppercaseConstantRule.php @@ -15,7 +15,7 @@ /** * @see \Symplify\PHPStanRules\Tests\Rules\UppercaseConstantRule\UppercaseConstantRuleTest */ -final class UppercaseConstantRule implements Rule, DocumentedRuleInterface +final class UppercaseConstantRule implements Rule { /** * @var string diff --git a/src/Symfony/NodeAnalyzer/SymfonyControllerAnalyzer.php b/src/Symfony/NodeAnalyzer/SymfonyControllerAnalyzer.php index d07c66a4..94968e8f 100644 --- a/src/Symfony/NodeAnalyzer/SymfonyControllerAnalyzer.php +++ b/src/Symfony/NodeAnalyzer/SymfonyControllerAnalyzer.php @@ -32,6 +32,6 @@ public static function isControllerActionMethod(ClassMethod $classMethod): bool return false; } - return \str_contains($docComment->getText(), '@Route'); + return strpos($docComment->getText(), '@Route') !== false; } } diff --git a/src/Symfony/Rules/RequireInvokableControllerRule.php b/src/Symfony/Rules/RequireInvokableControllerRule.php index 156a9915..aad75516 100644 --- a/src/Symfony/Rules/RequireInvokableControllerRule.php +++ b/src/Symfony/Rules/RequireInvokableControllerRule.php @@ -20,7 +20,7 @@ /** * @see \Symplify\PHPStanRules\Tests\Symfony\Rules\RequireInvokableControllerRule\RequireInvokableControllerRuleTest */ -final class RequireInvokableControllerRule implements Rule, DocumentedRuleInterface +final class RequireInvokableControllerRule implements Rule { /** * @var string diff --git a/src/ValueObject/ClassNamespaceAndDirectory.php b/src/ValueObject/ClassNamespaceAndDirectory.php index bf129c84..db9fdd94 100644 --- a/src/ValueObject/ClassNamespaceAndDirectory.php +++ b/src/ValueObject/ClassNamespaceAndDirectory.php @@ -6,11 +6,26 @@ final class ClassNamespaceAndDirectory { - public function __construct( - private readonly string $namespace, - private readonly string $directory, - private readonly string $namespaceBeforeClass - ) { + /** + * @readonly + * @var string + */ + private $namespace; + /** + * @readonly + * @var string + */ + private $directory; + /** + * @readonly + * @var string + */ + private $namespaceBeforeClass; + public function __construct(string $namespace, string $directory, string $namespaceBeforeClass) + { + $this->namespace = $namespace; + $this->directory = $directory; + $this->namespaceBeforeClass = $namespaceBeforeClass; } public function getNamespace(): string diff --git a/src/ValueObject/Configuration/RequiredWithMessage.php b/src/ValueObject/Configuration/RequiredWithMessage.php index d052ad3f..2478ab8d 100644 --- a/src/ValueObject/Configuration/RequiredWithMessage.php +++ b/src/ValueObject/Configuration/RequiredWithMessage.php @@ -6,10 +6,20 @@ final class RequiredWithMessage { - public function __construct( - private readonly string $required, - private readonly ?string $message - ) { + /** + * @readonly + * @var string + */ + private $required; + /** + * @readonly + * @var string|null + */ + private $message; + public function __construct(string $required, ?string $message) + { + $this->required = $required; + $this->message = $message; } public function getRequired(): string diff --git a/tests/Composer/Psr4PathValidatorTest.php b/tests/Composer/Psr4PathValidatorTest.php deleted file mode 100644 index 5c5b364d..00000000 --- a/tests/Composer/Psr4PathValidatorTest.php +++ /dev/null @@ -1,64 +0,0 @@ -psr4PathValidator = new Psr4PathValidator(); - } - - #[DataProvider('provideCorrectData')] - public function testCorrectCase(string $namespace, string $directory): void - { - $isClassNamespaceCorrect = $this->isNamespaceAndDirectoryCorrect($namespace, $directory); - - $this->assertTrue($isClassNamespaceCorrect); - } - - #[DataProvider('provideFailingData')] - public function testFailingCase(string $namespace, string $directory): void - { - $isClassNamespaceCorrect = $this->isNamespaceAndDirectoryCorrect($namespace, $directory); - - $this->assertFalse($isClassNamespaceCorrect); - } - - /** - * @return Iterator - */ - public static function provideCorrectData(): Iterator - { - yield ['Symplify\\PHPStanRules\\Tests\\', 'tests']; - yield ['Symplify\\PHPStanRules\\Tests\\', 'tests/']; - } - - public static function provideFailingData(): Iterator - { - yield ['Symplify\\PHPStanRules\\Tests\\', 'test/']; - yield ['Symplify\\PHPStanRules\\Tests\\', '/']; - yield ['PHPStanRules\\Tests', '/']; - } - - private function isNamespaceAndDirectoryCorrect(string $namespace, string $directory): bool - { - $classNamespaceAndDirectory = new ClassNamespaceAndDirectory( - $namespace, - $directory, - sprintf('%sComposer\\', $namespace) - ); - - return $this->psr4PathValidator->isClassNamespaceCorrect($classNamespaceAndDirectory, __FILE__); - } -} diff --git a/tests/Naming/ClassToSuffixResolverTest.php b/tests/Naming/ClassToSuffixResolverTest.php deleted file mode 100644 index 6f26ff7f..00000000 --- a/tests/Naming/ClassToSuffixResolverTest.php +++ /dev/null @@ -1,39 +0,0 @@ -classToSuffixResolver = new ClassToSuffixResolver(); - } - - #[DataProvider('provideData')] - public function test(string $className, string $expectedSuffix): void - { - $resolvedSuffix = $this->classToSuffixResolver->resolveFromClass($className); - $this->assertSame($expectedSuffix, $resolvedSuffix); - } - - /** - * @return Iterator - */ - public static function provideData(): Iterator - { - yield ['Exception', 'Exception']; - yield ['Symfony\Component\Console\Command\Command', 'Command']; - yield [TestCase::class, 'Test']; - yield [EventSubscriberInterface::class, 'EventSubscriber']; - } -} diff --git a/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/NodeGetAttributeTypeExtensionTest.php b/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/NodeGetAttributeTypeExtensionTest.php deleted file mode 100644 index 66d55b9a..00000000 --- a/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/NodeGetAttributeTypeExtensionTest.php +++ /dev/null @@ -1,34 +0,0 @@ -assertFileAsserts($assertType, $file, ...$args); - } - - public static function dataAsserts(): Iterator - { - yield from self::gatherAssertTypes(__DIR__ . '/data/get_parent_node.php.inc'); - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/type_extension.neon']; - } -} diff --git a/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/config/type_extension.neon b/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/config/type_extension.neon deleted file mode 100644 index f8cef7ee..00000000 --- a/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/config/type_extension.neon +++ /dev/null @@ -1,5 +0,0 @@ -services: - # $node->getAttribute($1) => Type|null by $1 - - - class: Symplify\PHPStanRules\ReturnTypeExtension\NodeGetAttributeTypeExtension - tags: [phpstan.broker.dynamicMethodReturnTypeExtension] diff --git a/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/data/get_parent_node.php.inc b/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/data/get_parent_node.php.inc deleted file mode 100644 index 4adb58ed..00000000 --- a/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/data/get_parent_node.php.inc +++ /dev/null @@ -1,11 +0,0 @@ -getAttribute(AttributeKey::SCOPE); -\PHPStan\Testing\assertType('PHPStan\Analyser\Scope|null', $scope); diff --git a/tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/AnnotateRegexClassConstWithRegexLinkRuleTest.php b/tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/AnnotateRegexClassConstWithRegexLinkRuleTest.php deleted file mode 100644 index 77c5e7a5..00000000 --- a/tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/AnnotateRegexClassConstWithRegexLinkRuleTest.php +++ /dev/null @@ -1,49 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [ - __DIR__ . '/Fixture/ClassConstMissingLink.php', - [[AnnotateRegexClassConstWithRegexLinkRule::ERROR_MESSAGE, 12]], - ]; - - yield [__DIR__ . '/Fixture/SkipShort.php', []]; - yield [__DIR__ . '/Fixture/SkipWithLink.php', []]; - yield [__DIR__ . '/Fixture/SkipAlphabet.php', []]; - yield [__DIR__ . '/Fixture/SkipPlaceholder.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(AnnotateRegexClassConstWithRegexLinkRule::class); - } -} diff --git a/tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/Fixture/ClassConstMissingLink.php b/tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/Fixture/ClassConstMissingLink.php deleted file mode 100644 index 4756d3b7..00000000 --- a/tests/Rules/AnnotateRegexClassConstWithRegexLinkRule/Fixture/ClassConstMissingLink.php +++ /dev/null @@ -1,13 +0,0 @@ -analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SkipAnonymousClass.php', []]; - yield [__DIR__ . '/Fixture/SkipValidNamespaceInterface.php', []]; - - yield [__DIR__ . '/Fixture/InvalidNamespaceClass.php', [ - [sprintf(CheckClassNamespaceFollowPsr4Rule::ERROR_MESSAGE, 'Foo\Bar'), 7], - ]]; - yield [__DIR__ . '/Fixture/InvalidNamespaceInterface.php', [ - [sprintf(CheckClassNamespaceFollowPsr4Rule::ERROR_MESSAGE, 'Foo\Bar'), 7], - ]]; - yield [__DIR__ . '/Fixture/InvalidNamespaceTrait.php', [ - [sprintf(CheckClassNamespaceFollowPsr4Rule::ERROR_MESSAGE, 'Foo\Bar'), 7], - ]]; - - $errorMessage = sprintf( - CheckClassNamespaceFollowPsr4Rule::ERROR_MESSAGE, - 'Symplify\PHPStanRules\Tests\Rules\CheckClassNamespaceFollowPsr4Rule' - ); - yield [__DIR__ . '/Fixture/MissingFixtureNamespaceClass.php', [[$errorMessage, 7]]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(CheckClassNamespaceFollowPsr4Rule::class); - } -} diff --git a/tests/Rules/CheckClassNamespaceFollowPsr4Rule/Fixture/InvalidNamespaceClass.php b/tests/Rules/CheckClassNamespaceFollowPsr4Rule/Fixture/InvalidNamespaceClass.php deleted file mode 100644 index 75cb9f95..00000000 --- a/tests/Rules/CheckClassNamespaceFollowPsr4Rule/Fixture/InvalidNamespaceClass.php +++ /dev/null @@ -1,10 +0,0 @@ -analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/Contract/SkipInterfaceInContract.php', []]; - yield [__DIR__ . '/Fixture/Illuminate/Contracts/View/View.php', []]; - yield [ - __DIR__ . '/Fixture/AnInterfaceNotInContract.php', - [[CheckRequiredInterfaceInContractNamespaceRule::ERROR_MESSAGE, 7]], ]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(CheckRequiredInterfaceInContractNamespaceRule::class); - } -} diff --git a/tests/Rules/CheckRequiredInterfaceInContractNamespaceRule/Fixture/AnInterfaceNotInContract.php b/tests/Rules/CheckRequiredInterfaceInContractNamespaceRule/Fixture/AnInterfaceNotInContract.php deleted file mode 100644 index 08a2d7dd..00000000 --- a/tests/Rules/CheckRequiredInterfaceInContractNamespaceRule/Fixture/AnInterfaceNotInContract.php +++ /dev/null @@ -1,10 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SkipCommand.php', []]; - yield [__DIR__ . '/Fixture/SkipSomeEventSubscriber.php', []]; - yield [__DIR__ . '/Fixture/SkipFixer.php', []]; - yield [__DIR__ . '/Fixture/SkipAnonymousClass.php', []]; - yield [__DIR__ . '/Fixture/SkipTest.php', []]; - yield [__DIR__ . '/Fixture/SkipAbstractTestCase.php', []]; - - $errorMessage = sprintf(ClassNameRespectsParentSuffixRule::ERROR_MESSAGE, 'Test'); - yield [__DIR__ . '/Fixture/NonTestSuffix.php', [[$errorMessage, 9]]]; - - $errorMessage = sprintf(ClassNameRespectsParentSuffixRule::ERROR_MESSAGE, 'Command'); - yield [__DIR__ . '/Fixture/SomeController.php', [[$errorMessage, 9]]]; - - $errorMessage = sprintf(ClassNameRespectsParentSuffixRule::ERROR_MESSAGE, 'EventSubscriber'); - yield [__DIR__ . '/Fixture/SomeEventSubscriberFalse.php', [[$errorMessage, 9]]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(ClassNameRespectsParentSuffixRule::class); - } -} diff --git a/tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/NonTestSuffix.php b/tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/NonTestSuffix.php deleted file mode 100644 index 6da9fb6a..00000000 --- a/tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/NonTestSuffix.php +++ /dev/null @@ -1,11 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SkipNormalArray.php', []]; - yield [__DIR__ . '/Fixture/ReturnCallable.php', [[ForbiddenArrayMethodCallRule::ERROR_MESSAGE, 11]]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(ForbiddenArrayMethodCallRule::class); - } -} diff --git a/tests/Rules/Complexity/ForbiddenArrayMethodCallRule/config/configured_rule.neon b/tests/Rules/Complexity/ForbiddenArrayMethodCallRule/config/configured_rule.neon deleted file mode 100644 index 6273d331..00000000 --- a/tests/Rules/Complexity/ForbiddenArrayMethodCallRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\Complexity\ForbiddenArrayMethodCallRule diff --git a/tests/Rules/Domain/RequireAttributeNamespaceRule/Fixture/Attribute/SkipCorrectAttribute.php b/tests/Rules/Domain/RequireAttributeNamespaceRule/Fixture/Attribute/SkipCorrectAttribute.php deleted file mode 100644 index bfc2a1dd..00000000 --- a/tests/Rules/Domain/RequireAttributeNamespaceRule/Fixture/Attribute/SkipCorrectAttribute.php +++ /dev/null @@ -1,10 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/MisslocatedAttribute.php', [[RequireAttributeNamespaceRule::ERROR_MESSAGE, 7]]]; - yield [__DIR__ . '/Fixture/Attribute/SkipCorrectAttribute.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(RequireAttributeNamespaceRule::class); - } -} diff --git a/tests/Rules/Domain/RequireAttributeNamespaceRule/config/configured_rule.neon b/tests/Rules/Domain/RequireAttributeNamespaceRule/config/configured_rule.neon deleted file mode 100644 index 5443e442..00000000 --- a/tests/Rules/Domain/RequireAttributeNamespaceRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\Domain\RequireAttributeNamespaceRule diff --git a/tests/Rules/Domain/RequireExceptionNamespaceRule/Fixture/Exception/SkipCorrectException.php b/tests/Rules/Domain/RequireExceptionNamespaceRule/Fixture/Exception/SkipCorrectException.php deleted file mode 100644 index c09aae43..00000000 --- a/tests/Rules/Domain/RequireExceptionNamespaceRule/Fixture/Exception/SkipCorrectException.php +++ /dev/null @@ -1,11 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/MisslocatedException.php', [[RequireExceptionNamespaceRule::ERROR_MESSAGE, 9]]]; - yield [__DIR__ . '/Fixture/Exception/SkipCorrectException.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(RequireExceptionNamespaceRule::class); - } -} diff --git a/tests/Rules/Domain/RequireExceptionNamespaceRule/config/configured_rule.neon b/tests/Rules/Domain/RequireExceptionNamespaceRule/config/configured_rule.neon deleted file mode 100644 index d344fc41..00000000 --- a/tests/Rules/Domain/RequireExceptionNamespaceRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\Domain\RequireExceptionNamespaceRule diff --git a/tests/Rules/Enum/RequireUniqueEnumConstantRule/Fixture/InvalidAnnotationEnum.php b/tests/Rules/Enum/RequireUniqueEnumConstantRule/Fixture/InvalidAnnotationEnum.php deleted file mode 100644 index a50ff5c8..00000000 --- a/tests/Rules/Enum/RequireUniqueEnumConstantRule/Fixture/InvalidAnnotationEnum.php +++ /dev/null @@ -1,15 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - $expectedErrorMessage = sprintf(RequireUniqueEnumConstantRule::ERROR_MESSAGE, 'yes'); - yield [__DIR__ . '/Fixture/InvalidEnum.php', [[$expectedErrorMessage, 8]]]; - yield [__DIR__ . '/Fixture/InvalidAnnotationEnum.php', [[$expectedErrorMessage, 8]]]; - - yield [__DIR__ . '/Fixture/SkipValidEnum.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(RequireUniqueEnumConstantRule::class); - } -} diff --git a/tests/Rules/Enum/RequireUniqueEnumConstantRule/config/configured_rule.neon b/tests/Rules/Enum/RequireUniqueEnumConstantRule/config/configured_rule.neon deleted file mode 100644 index 317a3057..00000000 --- a/tests/Rules/Enum/RequireUniqueEnumConstantRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\Enum\RequireUniqueEnumConstantRule diff --git a/tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/ExplicitClassPrefixSuffixRuleTest.php b/tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/ExplicitClassPrefixSuffixRuleTest.php deleted file mode 100644 index 92f581bc..00000000 --- a/tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/ExplicitClassPrefixSuffixRuleTest.php +++ /dev/null @@ -1,63 +0,0 @@ -analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/CorrectInterface.php', []]; - yield [__DIR__ . '/Fixture/CorrectTrait.php', []]; - - yield [__DIR__ . '/Fixture/AbstractCorrectClass.php', []]; - yield [__DIR__ . '/Fixture/AbstractIncorrectClass.php', [ - [ExplicitClassPrefixSuffixRule::ABSTRACT_ERROR_MESSAGE, 5], - ]]; - - yield [__DIR__ . '/Fixture/WrongTraitSuffix.php', [ - [ExplicitClassPrefixSuffixRule::TRAIT_ERROR_MESSAGE, 5], - ]]; - - yield [__DIR__ . '/Fixture/WrongSuffixTrait.php', [ - [ExplicitClassPrefixSuffixRule::TRAIT_ERROR_MESSAGE, 5], - ]]; - - yield [__DIR__ . '/Fixture/WrongInterfaceSuffix.php', [ - [ExplicitClassPrefixSuffixRule::INTERFACE_ERROR_MESSAGE, 5], - ]]; - - yield [__DIR__ . '/Fixture/IncorrectClassInterface.php', [ - [ExplicitClassPrefixSuffixRule::INTERFACE_ERROR_MESSAGE, 5], - ]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(ExplicitClassPrefixSuffixRule::class); - } -} diff --git a/tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/Fixture/AbstractCorrectClass.php b/tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/Fixture/AbstractCorrectClass.php deleted file mode 100644 index 12a71150..00000000 --- a/tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/Fixture/AbstractCorrectClass.php +++ /dev/null @@ -1,8 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [ - __DIR__ . '/Fixture/ClassExtendingNonAbstractClass.php', - [[ForbiddenExtendOfNonAbstractClassRule::ERROR_MESSAGE, 9]], ]; - - yield [__DIR__ . '/Fixture/SkipVendorBasedClasses.php', []]; - yield [__DIR__ . '/Fixture/SkipClassExtendingAbstractClass.php', []]; - yield [__DIR__ . '/Fixture/SkipException.php', []]; - yield [__DIR__ . '/Fixture/SkipAnonymousExtend.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(ForbiddenExtendOfNonAbstractClassRule::class); - } -} diff --git a/tests/Rules/ForbiddenExtendOfNonAbstractClassRule/Source/NonAbstractClass.php b/tests/Rules/ForbiddenExtendOfNonAbstractClassRule/Source/NonAbstractClass.php deleted file mode 100644 index 68a5b0ab..00000000 --- a/tests/Rules/ForbiddenExtendOfNonAbstractClassRule/Source/NonAbstractClass.php +++ /dev/null @@ -1,9 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - $errorMessage = sprintf(ForbiddenFuncCallRule::ERROR_MESSAGE, 'dump'); - yield [__DIR__ . '/Fixture/DebugFuncCall.php', [[$errorMessage, 11]]]; - - $errorMessage = sprintf(ForbiddenFuncCallRule::ERROR_MESSAGE, 'extract'); - yield [__DIR__ . '/Fixture/ExtractCall.php', [[$errorMessage, 11]]]; - - $errorMessage = sprintf(ForbiddenFuncCallRule::ERROR_MESSAGE, 'curl_init'); - yield [__DIR__ . '/Fixture/CurlCall.php', [[$errorMessage, 11]]]; - - $errorMessage = sprintf(ForbiddenFuncCallRule::ERROR_MESSAGE, 'property_exists'); - yield [__DIR__ . '/Fixture/PropertyExists.php', [[$errorMessage, 11]]]; - - yield [__DIR__ . '/Fixture/SkipPropertyExistsOnXml.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(ForbiddenFuncCallRule::class); - } -} diff --git a/tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleWithDeprecationsTest.php b/tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleWithDeprecationsTest.php deleted file mode 100644 index eb0c08bf..00000000 --- a/tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleWithDeprecationsTest.php +++ /dev/null @@ -1,59 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - // custom messages are defined in the config file - - $errorMessage = sprintf(ForbiddenFuncCallRule::ERROR_MESSAGE, 'dump'); - $errorMessage .= ': seems you missed some debugging function'; - yield [__DIR__ . '/Fixture/DebugFuncCall.php', [[$errorMessage, 11]]]; - - $errorMessage = sprintf(ForbiddenFuncCallRule::ERROR_MESSAGE, 'extract'); - $errorMessage .= ': you shouldn"t use this dynamic things'; - yield [__DIR__ . '/Fixture/ExtractCall.php', [[$errorMessage, 11]]]; - - $errorMessage = sprintf(ForbiddenFuncCallRule::ERROR_MESSAGE, 'curl_init'); - $errorMessage .= ': we use a proper http client these days'; - yield [__DIR__ . '/Fixture/CurlCall.php', [[$errorMessage, 11]]]; - - // custom error defined as empty-string -> just prints the default message - $errorMessage = sprintf(ForbiddenFuncCallRule::ERROR_MESSAGE, 'property_exists'); - yield [__DIR__ . '/Fixture/PropertyExists.php', [[$errorMessage, 11]]]; - - yield [__DIR__ . '/Fixture/SkipPropertyExistsOnXml.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule_with_deprecations.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(ForbiddenFuncCallRule::class); - } -} diff --git a/tests/Rules/ForbiddenFuncCallRule/config/configured_rule.neon b/tests/Rules/ForbiddenFuncCallRule/config/configured_rule.neon deleted file mode 100644 index bcc99b22..00000000 --- a/tests/Rules/ForbiddenFuncCallRule/config/configured_rule.neon +++ /dev/null @@ -1,13 +0,0 @@ -includes: - - ../../../config/included_services.neon - -services: - - - class: Symplify\PHPStanRules\Rules\ForbiddenFuncCallRule - tags: [phpstan.rules.rule] - arguments: - forbiddenFunctions: - - 'extract' - - 'dump' - - 'curl_*' - - 'property_exists' diff --git a/tests/Rules/ForbiddenFuncCallRule/config/configured_rule_with_deprecations.neon b/tests/Rules/ForbiddenFuncCallRule/config/configured_rule_with_deprecations.neon deleted file mode 100644 index 0442c12b..00000000 --- a/tests/Rules/ForbiddenFuncCallRule/config/configured_rule_with_deprecations.neon +++ /dev/null @@ -1,13 +0,0 @@ -includes: - - ../../../config/included_services.neon - -services: - - - class: Symplify\PHPStanRules\Rules\ForbiddenFuncCallRule - tags: [phpstan.rules.rule] - arguments: - forbiddenFunctions: - 'extract': 'you shouldn"t use this dynamic things' - 'dump': 'seems you missed some debugging function' - 'curl_*': 'we use a proper http client these days' - - 'property_exists' diff --git a/tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/Fixture/MultipleClassLike.php b/tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/Fixture/MultipleClassLike.php deleted file mode 100644 index ebe21580..00000000 --- a/tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/Fixture/MultipleClassLike.php +++ /dev/null @@ -1,17 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SkipOneInterface.php', []]; - yield [__DIR__ . '/Fixture/SkipOneClassWithAnonymousClass.php', []]; - yield [__DIR__ . '/Fixture/SkipOneClass.php', []]; - yield [__DIR__ . '/Fixture/SkipOneTrait.php', []]; - - yield [ - __DIR__ . '/Fixture/MultipleClassLike.php', - [[ForbiddenMultipleClassLikeInOneFileRule::ERROR_MESSAGE, 3]], - ]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(ForbiddenMultipleClassLikeInOneFileRule::class); - } -} diff --git a/tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/config/configured_rule.neon b/tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/config/configured_rule.neon deleted file mode 100644 index e641c8bf..00000000 --- a/tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\ForbiddenMultipleClassLikeInOneFileRule diff --git a/tests/Rules/ForbiddenNodeRule/Fixture/EmptyCall.php b/tests/Rules/ForbiddenNodeRule/Fixture/EmptyCall.php deleted file mode 100644 index c65359f3..00000000 --- a/tests/Rules/ForbiddenNodeRule/Fixture/EmptyCall.php +++ /dev/null @@ -1,13 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - $errorMessage = sprintf(ForbiddenNodeRule::ERROR_MESSAGE, 'empty($value)'); - yield [__DIR__ . '/Fixture/EmptyCall.php', [[$errorMessage, 11]]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(ForbiddenNodeRule::class); - } -} diff --git a/tests/Rules/ForbiddenNodeRule/config/configured_rule.neon b/tests/Rules/ForbiddenNodeRule/config/configured_rule.neon deleted file mode 100644 index ea9c437a..00000000 --- a/tests/Rules/ForbiddenNodeRule/config/configured_rule.neon +++ /dev/null @@ -1,12 +0,0 @@ -includes: - - ../../../config/included_services.neon - -services: - - - class: Symplify\PHPStanRules\Rules\ForbiddenNodeRule - tags: [phpstan.rules.rule] - arguments: - forbiddenNodes: - - PhpParser\Node\Expr\Empty_ - - PhpParser\Node\Stmt\Switch_ - - PhpParser\Node\Expr\ErrorSuppress diff --git a/tests/Rules/ForbiddenStaticClassConstFetchRule/Fixture/SomeClassWithStaticConstFetch.php b/tests/Rules/ForbiddenStaticClassConstFetchRule/Fixture/SomeClassWithStaticConstFetch.php deleted file mode 100644 index 4caef847..00000000 --- a/tests/Rules/ForbiddenStaticClassConstFetchRule/Fixture/SomeClassWithStaticConstFetch.php +++ /dev/null @@ -1,13 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [ - __DIR__ . '/Fixture/SomeClassWithStaticConstFetch.php', - [[ForbiddenStaticClassConstFetchRule::ERROR_MESSAGE, 11]], - ]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(ForbiddenStaticClassConstFetchRule::class); - } -} diff --git a/tests/Rules/ForbiddenStaticClassConstFetchRule/config/configured_rule.neon b/tests/Rules/ForbiddenStaticClassConstFetchRule/config/configured_rule.neon deleted file mode 100644 index 7edb61a5..00000000 --- a/tests/Rules/ForbiddenStaticClassConstFetchRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\ForbiddenStaticClassConstFetchRule diff --git a/tests/Rules/NoDynamicNameRule/Fixture/DynamicClassOnStaticPropertyFetch.php b/tests/Rules/NoDynamicNameRule/Fixture/DynamicClassOnStaticPropertyFetch.php deleted file mode 100644 index ae1b4f97..00000000 --- a/tests/Rules/NoDynamicNameRule/Fixture/DynamicClassOnStaticPropertyFetch.php +++ /dev/null @@ -1,12 +0,0 @@ -$value(); - } -} diff --git a/tests/Rules/NoDynamicNameRule/Fixture/DynamicPropertyFetch.php b/tests/Rules/NoDynamicNameRule/Fixture/DynamicPropertyFetch.php deleted file mode 100644 index f6ed6c91..00000000 --- a/tests/Rules/NoDynamicNameRule/Fixture/DynamicPropertyFetch.php +++ /dev/null @@ -1,12 +0,0 @@ -$value; - } -} diff --git a/tests/Rules/NoDynamicNameRule/Fixture/DynamicStaticMethodCallName.php b/tests/Rules/NoDynamicNameRule/Fixture/DynamicStaticMethodCallName.php deleted file mode 100644 index 3c137a47..00000000 --- a/tests/Rules/NoDynamicNameRule/Fixture/DynamicStaticMethodCallName.php +++ /dev/null @@ -1,13 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/DynamicConstantName.php', [[NoDynamicNameRule::ERROR_MESSAGE, 10]]]; - yield [__DIR__ . '/Fixture/DynamicMethodCallName.php', [[NoDynamicNameRule::ERROR_MESSAGE, 11]]]; - yield [__DIR__ . '/Fixture/DynamicStaticMethodCallName.php', [[NoDynamicNameRule::ERROR_MESSAGE, 11]]]; - yield [__DIR__ . '/Fixture/DynamicFuncCallName.php', [[NoDynamicNameRule::ERROR_MESSAGE, 11]]]; - - yield [__DIR__ . '/Fixture/DynamicPropertyFetch.php', [[NoDynamicNameRule::ERROR_MESSAGE, 10]]]; - yield [__DIR__ . '/Fixture/DynamicClassOnStaticPropertyFetch.php', [[NoDynamicNameRule::ERROR_MESSAGE, 10]]]; - - yield [__DIR__ . '/Fixture/SkipObjectClassOnPhp8.php', []]; - yield [__DIR__ . '/Fixture/SkipInvokable.php', []]; - yield [__DIR__ . '/Fixture/SkipClosure.php', []]; - yield [__DIR__ . '/Fixture/SkipCallable.php', []]; - yield [__DIR__ . '/Fixture/SkipNullableClosure.php', []]; - yield [__DIR__ . '/Fixture/SkipImmediatelyInvokedFunctionExpression.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoDynamicNameRule::class); - } -} diff --git a/tests/Rules/NoDynamicNameRule/Source/SomeInvokableClass.php b/tests/Rules/NoDynamicNameRule/Source/SomeInvokableClass.php deleted file mode 100644 index 670950b5..00000000 --- a/tests/Rules/NoDynamicNameRule/Source/SomeInvokableClass.php +++ /dev/null @@ -1,13 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SomeGlobalConst.php', [ - [NoGlobalConstRule::ERROR_MESSAGE, 7], - ]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoGlobalConstRule::class); - } -} diff --git a/tests/Rules/NoGlobalConstRule/config/configured_rule.neon b/tests/Rules/NoGlobalConstRule/config/configured_rule.neon deleted file mode 100644 index 4b1dd907..00000000 --- a/tests/Rules/NoGlobalConstRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\NoGlobalConstRule diff --git a/tests/Rules/NoInlineStringRegexRule/Fixture/InlineMatchRegex.php b/tests/Rules/NoInlineStringRegexRule/Fixture/InlineMatchRegex.php deleted file mode 100644 index 00eb31e1..00000000 --- a/tests/Rules/NoInlineStringRegexRule/Fixture/InlineMatchRegex.php +++ /dev/null @@ -1,13 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/InlineMatchRegex.php', [[NoInlineStringRegexRule::ERROR_MESSAGE, 11]]]; - yield [ - __DIR__ . '/Fixture/NetteUtilsStringsInlineMatchRegex.php', - [[NoInlineStringRegexRule::ERROR_MESSAGE, 13]], - ]; - - yield [__DIR__ . '/Fixture/SkipVariable.php', []]; - yield [__DIR__ . '/Fixture/SkipSingleLetter.php', []]; - yield [__DIR__ . '/Fixture/SkipConstRegex.php', []]; - yield [__DIR__ . '/Fixture/SkipNetteUtilsStringsConstRegex.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoInlineStringRegexRule::class); - } -} diff --git a/tests/Rules/NoInlineStringRegexRule/config/configured_rule.neon b/tests/Rules/NoInlineStringRegexRule/config/configured_rule.neon deleted file mode 100644 index 06c63f38..00000000 --- a/tests/Rules/NoInlineStringRegexRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\NoInlineStringRegexRule diff --git a/tests/Rules/NoReferenceRule/Fixture/AssignReference.php b/tests/Rules/NoReferenceRule/Fixture/AssignReference.php deleted file mode 100644 index ee683365..00000000 --- a/tests/Rules/NoReferenceRule/Fixture/AssignReference.php +++ /dev/null @@ -1,16 +0,0 @@ -args[1]; - $some = &$arg->value; - } -} diff --git a/tests/Rules/NoReferenceRule/Fixture/FunctionWithReference.php b/tests/Rules/NoReferenceRule/Fixture/FunctionWithReference.php deleted file mode 100644 index cdd88fec..00000000 --- a/tests/Rules/NoReferenceRule/Fixture/FunctionWithReference.php +++ /dev/null @@ -1,9 +0,0 @@ -run([&$argument]); - } - - private function run(array $array) - { - } -} diff --git a/tests/Rules/NoReferenceRule/Fixture/SkipParentMethodWithReference.php b/tests/Rules/NoReferenceRule/Fixture/SkipParentMethodWithReference.php deleted file mode 100644 index 597703d2..00000000 --- a/tests/Rules/NoReferenceRule/Fixture/SkipParentMethodWithReference.php +++ /dev/null @@ -1,14 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/MethodWithReference.php', [[NoReferenceRule::ERROR_MESSAGE, 9]]]; - yield [__DIR__ . '/Fixture/FunctionWithReference.php', [[NoReferenceRule::ERROR_MESSAGE, 7]]]; - yield [__DIR__ . '/Fixture/VariableReference.php', [[NoReferenceRule::ERROR_MESSAGE, 11]]]; - yield [__DIR__ . '/Fixture/ReferenceArgument.php', [[NoReferenceRule::ERROR_MESSAGE, 11]]]; - yield [__DIR__ . '/Fixture/AssignReference.php', [[NoReferenceRule::ERROR_MESSAGE, 14]]]; - - yield [__DIR__ . '/Fixture/SkipUseInReference.php', []]; - yield [__DIR__ . '/Fixture/SkipParentMethodWithReference.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoReferenceRule::class); - } -} diff --git a/tests/Rules/NoReferenceRule/Source/AbstractSomeParentClassWithReference.php b/tests/Rules/NoReferenceRule/Source/AbstractSomeParentClassWithReference.php deleted file mode 100644 index 35001a16..00000000 --- a/tests/Rules/NoReferenceRule/Source/AbstractSomeParentClassWithReference.php +++ /dev/null @@ -1,12 +0,0 @@ - 'Yes', - self::NO => 'No', - ]; - } -} diff --git a/tests/Rules/NoReturnArrayVariableListRule/Fixture/ReturnVariables.php b/tests/Rules/NoReturnArrayVariableListRule/Fixture/ReturnVariables.php deleted file mode 100644 index a0267e1f..00000000 --- a/tests/Rules/NoReturnArrayVariableListRule/Fixture/ReturnVariables.php +++ /dev/null @@ -1,14 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/ReturnVariables.php', [[NoReturnArrayVariableListRule::ERROR_MESSAGE, 11]]]; - - yield [__DIR__ . '/Fixture/Enum/SkipEnum.php', []]; - yield [__DIR__ . '/Fixture/SkipReturnOne.php', []]; - yield [__DIR__ . '/Fixture/SkipNews.php', []]; - yield [__DIR__ . '/Fixture/ValueObject/SkipValueObject.php', []]; - yield [__DIR__ . '/Fixture/SkipParentMethod.php', []]; - yield [__DIR__ . '/Fixture/SkipArraySpreads.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoReturnArrayVariableListRule::class); - } -} diff --git a/tests/Rules/NoReturnArrayVariableListRule/config/configured_rule.neon b/tests/Rules/NoReturnArrayVariableListRule/config/configured_rule.neon deleted file mode 100644 index 176c5712..00000000 --- a/tests/Rules/NoReturnArrayVariableListRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\NoReturnArrayVariableListRule diff --git a/tests/Rules/NoReturnSetterMethodRule/Fixture/SkipArrayFilter.php b/tests/Rules/NoReturnSetterMethodRule/Fixture/SkipArrayFilter.php deleted file mode 100644 index 9c136278..00000000 --- a/tests/Rules/NoReturnSetterMethodRule/Fixture/SkipArrayFilter.php +++ /dev/null @@ -1,15 +0,0 @@ -name === 'hey') { - return; - } - - $this->name = $name; - } -} diff --git a/tests/Rules/NoReturnSetterMethodRule/Fixture/SkipRoute.php b/tests/Rules/NoReturnSetterMethodRule/Fixture/SkipRoute.php deleted file mode 100644 index 8a3bca10..00000000 --- a/tests/Rules/NoReturnSetterMethodRule/Fixture/SkipRoute.php +++ /dev/null @@ -1,17 +0,0 @@ -name = $name; - } -} diff --git a/tests/Rules/NoReturnSetterMethodRule/Fixture/SomeSetterClass.php b/tests/Rules/NoReturnSetterMethodRule/Fixture/SomeSetterClass.php deleted file mode 100644 index 1f3c43ff..00000000 --- a/tests/Rules/NoReturnSetterMethodRule/Fixture/SomeSetterClass.php +++ /dev/null @@ -1,13 +0,0 @@ -analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SomeSetterClass.php', [[NoReturnSetterMethodRule::ERROR_MESSAGE, 9]]]; - - yield [__DIR__ . '/Fixture/SkipRoute.php', []]; - yield [__DIR__ . '/Fixture/SkipEmptyReturn.php', []]; - yield [__DIR__ . '/Fixture/SkipVoidSetter.php', []]; - yield [__DIR__ . '/Fixture/SkipSetUp.php', []]; - yield [__DIR__ . '/Fixture/SkipArrayFilter.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoReturnSetterMethodRule::class); - } -} diff --git a/tests/Rules/NoReturnSetterMethodRule/config/configured_rule.neon b/tests/Rules/NoReturnSetterMethodRule/config/configured_rule.neon deleted file mode 100644 index 21f69cee..00000000 --- a/tests/Rules/NoReturnSetterMethodRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\NoReturnSetterMethodRule diff --git a/tests/Rules/NoSingleInterfaceImplementerRule/Fixture/AllowAbstract.php b/tests/Rules/NoSingleInterfaceImplementerRule/Fixture/AllowAbstract.php deleted file mode 100644 index a67c3395..00000000 --- a/tests/Rules/NoSingleInterfaceImplementerRule/Fixture/AllowAbstract.php +++ /dev/null @@ -1,9 +0,0 @@ - - */ -final class NoSingleInterfaceImplementerRuleTest extends RuleTestCase -{ - /** - * @param string[] $filePaths - * @param mixed[] $expectedErrorMessagesWithLines - */ - #[DataProvider('provideData')] - public function testRule(array $filePaths, array $expectedErrorMessagesWithLines): void - { - $this->analyse($filePaths, $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [[__DIR__ . '/Fixture/SimpleInterface.php'], []]; - yield [[__DIR__ . '/Fixture/AllowAbstract.php', __DIR__ . '/Fixture/SimpleInterface.php'], []]; - - // already counted in abstract class - yield [[__DIR__ . '/Fixture/AllowAbstract.php', __DIR__ . '/Fixture/SimpleInterface.php', __DIR__ . '/Fixture/ImplementsSimpleInterface.php'], []]; - - yield [ - [ - __DIR__ . '/Fixture/SimpleInterface.php', - __DIR__ . '/Fixture/ImplementsSimpleInterface.php', - ], [ - [ - sprintf(NoSingleInterfaceImplementerRule::ERROR_MESSAGE, SimpleInterface::class), - -1, - ], - ]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getCollectors(): array - { - return [ - self::getContainer()->getByType(ImplementedInterfaceCollector::class), - self::getContainer()->getByType(InterfaceCollector::class), - self::getContainer()->getByType(InterfaceOfAbstractClassCollector::class), - ]; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoSingleInterfaceImplementerRule::class); - } -} diff --git a/tests/Rules/NoSingleInterfaceImplementerRule/Source/SomeType.php b/tests/Rules/NoSingleInterfaceImplementerRule/Source/SomeType.php deleted file mode 100644 index f0033281..00000000 --- a/tests/Rules/NoSingleInterfaceImplementerRule/Source/SomeType.php +++ /dev/null @@ -1,7 +0,0 @@ -createMock(SomeAllowedType::class); - } -} diff --git a/tests/Rules/PHPUnit/NoTestMocksRule/Fixture/SomeMocking.php b/tests/Rules/PHPUnit/NoTestMocksRule/Fixture/SomeMocking.php deleted file mode 100644 index 66df9c7d..00000000 --- a/tests/Rules/PHPUnit/NoTestMocksRule/Fixture/SomeMocking.php +++ /dev/null @@ -1,15 +0,0 @@ -createMock('SomeClass'); - } -} diff --git a/tests/Rules/PHPUnit/NoTestMocksRule/NoTestMocksRuleTest.php b/tests/Rules/PHPUnit/NoTestMocksRule/NoTestMocksRuleTest.php deleted file mode 100644 index 9cd4738a..00000000 --- a/tests/Rules/PHPUnit/NoTestMocksRule/NoTestMocksRuleTest.php +++ /dev/null @@ -1,45 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [ - __DIR__ . '/Fixture/SomeMocking.php', - [[sprintf(NoTestMocksRule::ERROR_MESSAGE, 'SomeClass'), 13]], - ]; - - yield [__DIR__ . '/Fixture/SkipApiMock.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [ - __DIR__ . '/config/configured_rule.neon', - ]; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoTestMocksRule::class); - } -} diff --git a/tests/Rules/PHPUnit/NoTestMocksRule/Source/SomeAllowedType.php b/tests/Rules/PHPUnit/NoTestMocksRule/Source/SomeAllowedType.php deleted file mode 100644 index 16c9e7fb..00000000 --- a/tests/Rules/PHPUnit/NoTestMocksRule/Source/SomeAllowedType.php +++ /dev/null @@ -1,7 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - $errorMessage = sprintf(PreferredClassRule::ERROR_MESSAGE, NativeDateTime::class, DateTime::class); - yield [__DIR__ . '/Fixture/ClassUsingOld.php', [[$errorMessage, 13]]]; - yield [__DIR__ . '/Fixture/ClassExtendingOld.php', [[$errorMessage, 9]]]; - yield [__DIR__ . '/Fixture/ClassMethodParameterUsingOld.php', [[$errorMessage, 11]]]; - yield [__DIR__ . '/Fixture/SomeStaticCall.php', [[$errorMessage, 13]]]; - - $errorMessage = sprintf( - PreferredClassRule::ERROR_MESSAGE, - AbstractNotWhatYouWant::class, - SkipPreferredExtendingTheOldOne::class - ); - yield [__DIR__ . '/Fixture/InstanceOfName.php', [[$errorMessage, 13]]]; - - yield [__DIR__ . '/Fixture/SkipPreferredExtendingTheOldOne.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(PreferredClassRule::class); - } -} diff --git a/tests/Rules/PreferredClassRule/Source/AbstractNotWhatYouWant.php b/tests/Rules/PreferredClassRule/Source/AbstractNotWhatYouWant.php deleted file mode 100644 index e0bfb566..00000000 --- a/tests/Rules/PreferredClassRule/Source/AbstractNotWhatYouWant.php +++ /dev/null @@ -1,10 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - $errorMessage = sprintf(PreventParentMethodVisibilityOverrideRule::ERROR_MESSAGE, 'run', 'protected'); - yield [__DIR__ . '/Fixture/ClassWithOverridingVisibility.php', [[$errorMessage, 9]]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(PreventParentMethodVisibilityOverrideRule::class); - } -} diff --git a/tests/Rules/PreventParentMethodVisibilityOverrideRule/config/configured_rule.neon b/tests/Rules/PreventParentMethodVisibilityOverrideRule/config/configured_rule.neon deleted file mode 100644 index a8f51950..00000000 --- a/tests/Rules/PreventParentMethodVisibilityOverrideRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\PreventParentMethodVisibilityOverrideRule diff --git a/tests/Rules/Rector/NoClassReflectionStaticReflectionRule/Fixture/NewOnExternal.php b/tests/Rules/Rector/NoClassReflectionStaticReflectionRule/Fixture/NewOnExternal.php deleted file mode 100644 index e4865298..00000000 --- a/tests/Rules/Rector/NoClassReflectionStaticReflectionRule/Fixture/NewOnExternal.php +++ /dev/null @@ -1,15 +0,0 @@ -analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/NewOnExternal.php', [[NoClassReflectionStaticReflectionRule::ERROR_MESSAGE, 13]]]; - - yield [__DIR__ . '/Fixture/SkipAllowedType.php', []]; - yield [__DIR__ . '/Fixture/SkipNonReflectionNew.php', []]; - } - - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoClassReflectionStaticReflectionRule::class); - } -} diff --git a/tests/Rules/Rector/NoClassReflectionStaticReflectionRule/config/configured_rule.neon b/tests/Rules/Rector/NoClassReflectionStaticReflectionRule/config/configured_rule.neon deleted file mode 100644 index 03e55f2d..00000000 --- a/tests/Rules/Rector/NoClassReflectionStaticReflectionRule/config/configured_rule.neon +++ /dev/null @@ -1,2 +0,0 @@ -rules: - - Symplify\PHPStanRules\Rules\Rector\NoClassReflectionStaticReflectionRule diff --git a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/InstanceofWithType.php b/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/InstanceofWithType.php deleted file mode 100644 index c305dfd9..00000000 --- a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/InstanceofWithType.php +++ /dev/null @@ -1,19 +0,0 @@ -> - */ - private const BEFORE_TRAIT_TYPES = [TraitUse::class, Property::class, ClassMethod::class]; - - public function find(object $node): bool - { - foreach (self::BEFORE_TRAIT_TYPES as $beforeTraitType) { - if (is_a($node, $beforeTraitType, true)) { - return true; - } - } - - return false; - } -} diff --git a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipGenericNodeType.php b/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipGenericNodeType.php deleted file mode 100644 index f52533e5..00000000 --- a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipGenericNodeType.php +++ /dev/null @@ -1,21 +0,0 @@ - $type - */ - public function find(object $node, string $type): bool - { - if (is_a($node, $type, true)) { - return true; - } - - return true; - } -} diff --git a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipIsAGenericClassString.php b/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipIsAGenericClassString.php deleted file mode 100644 index 6ddee56e..00000000 --- a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipIsAGenericClassString.php +++ /dev/null @@ -1,26 +0,0 @@ - $type - * @return T|null - */ - public function findParentType(Node $parent, string $type) - { - do { - if (is_a($parent, $type, true)) { - return $parent; - } - } while ($parent = $parent->getAttribute('parent_node')); - - return null; - } -} diff --git a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipIsAsClassString.php b/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipIsAsClassString.php deleted file mode 100644 index cde6580d..00000000 --- a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipIsAsClassString.php +++ /dev/null @@ -1,20 +0,0 @@ - $desiredType - */ - private function hasOnlyStmtOfType(If_ $if, string $desiredType): bool - { - $stmts = $if->stmts; - return is_a($stmts[0], $desiredType); - } -} diff --git a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipPHPStanType.php b/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipPHPStanType.php deleted file mode 100644 index c5d00698..00000000 --- a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipPHPStanType.php +++ /dev/null @@ -1,15 +0,0 @@ - $type - */ - public function find(object $node, $type): bool - { - return is_a($node, $type, true); - } -} diff --git a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipReflection.php b/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipReflection.php deleted file mode 100644 index 3aa42a0f..00000000 --- a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/Fixture/SkipReflection.php +++ /dev/null @@ -1,19 +0,0 @@ -> - */ - private const COLLECTABLE_NODE_TYPES = [ - Class_::class, - Interface_::class, - ClassConst::class, - ClassConstFetch::class, - New_::class, - StaticCall::class, - MethodCall::class, - Array_::class, - Param::class, - ]; - - public function isCollectableNode(Node $node): bool - { - foreach (self::COLLECTABLE_NODE_TYPES as $collectableNodeType) { - /** @var class-string $collectableNodeType */ - if (is_a($node, $collectableNodeType, true)) { - return true; - } - } - - return false; - } -} diff --git a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/NoInstanceOfStaticReflectionRuleTest.php b/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/NoInstanceOfStaticReflectionRuleTest.php deleted file mode 100644 index 600c7ba1..00000000 --- a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/NoInstanceOfStaticReflectionRuleTest.php +++ /dev/null @@ -1,54 +0,0 @@ -analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - $errorMessage = NoInstanceOfStaticReflectionRule::ERROR_MESSAGE; - yield [__DIR__ . '/Fixture/InstanceofWithType.php', [[$errorMessage, 13]]]; - - $errorMessage = NoInstanceOfStaticReflectionRule::ERROR_MESSAGE; - yield [__DIR__ . '/Fixture/IsAWithType.php', [[$errorMessage, 13]]]; - - yield [__DIR__ . '/Fixture/SkipAllowedType.php', []]; - yield [__DIR__ . '/Fixture/SkipGenericNodeType.php', []]; - yield [__DIR__ . '/Fixture/SkipIsAGenericClassString.php', []]; - yield [__DIR__ . '/Fixture/SkipIsAsClassString.php', []]; - yield [__DIR__ . '/Fixture/SkipArrayClassString.php', []]; - yield [__DIR__ . '/Fixture/SkipReflection.php', []]; - yield [__DIR__ . '/Fixture/SkipTypesArray.php', []]; - yield [__DIR__ . '/Fixture/SkipSymfony.php', []]; - yield [__DIR__ . '/Fixture/SkipPhpDocNode.php', []]; - yield [__DIR__ . '/Fixture/SkipPHPStanType.php', []]; - yield [__DIR__ . '/Fixture/SkipSelfType.php', []]; - } - - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoInstanceOfStaticReflectionRule::class); - } -} diff --git a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/config/configured_rule.neon b/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/config/configured_rule.neon deleted file mode 100644 index 4b1c9d43..00000000 --- a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/config/configured_rule.neon +++ /dev/null @@ -1,2 +0,0 @@ -rules: - - Symplify\PHPStanRules\Rules\Rector\NoInstanceOfStaticReflectionRule diff --git a/tests/Rules/Rector/NoLeadingBackslashInNameRule/Fixture/LeadingBackslashInName.php b/tests/Rules/Rector/NoLeadingBackslashInNameRule/Fixture/LeadingBackslashInName.php deleted file mode 100644 index df6f7f7a..00000000 --- a/tests/Rules/Rector/NoLeadingBackslashInNameRule/Fixture/LeadingBackslashInName.php +++ /dev/null @@ -1,15 +0,0 @@ -analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - $errorMessage = NoLeadingBackslashInNameRule::ERROR_MESSAGE; - yield [__DIR__ . '/Fixture/LeadingBackslashInName.php', [[$errorMessage, 13]]]; - - yield [__DIR__ . '/Fixture/SkipNoBackslash.php', []]; - yield [__DIR__ . '/Fixture/SkipUseFullyQualified.php', []]; - } - - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(NoLeadingBackslashInNameRule::class); - } -} diff --git a/tests/Rules/Rector/NoLeadingBackslashInNameRule/config/configured_rule.neon b/tests/Rules/Rector/NoLeadingBackslashInNameRule/config/configured_rule.neon deleted file mode 100644 index c6649019..00000000 --- a/tests/Rules/Rector/NoLeadingBackslashInNameRule/config/configured_rule.neon +++ /dev/null @@ -1,2 +0,0 @@ -rules: - - Symplify\PHPStanRules\Rules\Rector\NoLeadingBackslashInNameRule diff --git a/tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/Fixture/DowngradePhp80/SomePhpFeature2Rector.php b/tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/Fixture/DowngradePhp80/SomePhpFeature2Rector.php deleted file mode 100644 index 532d17a0..00000000 --- a/tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/Fixture/DowngradePhp80/SomePhpFeature2Rector.php +++ /dev/null @@ -1,27 +0,0 @@ -analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SkipSomePhpFeatureRector.php', []]; - yield [__DIR__ . '/Fixture/Php80/SkipConfigurableRector.php', []]; - - $errorMessage = sprintf( - PhpUpgradeDowngradeRegisteredInSetRule::ERROR_MESSAGE, - SomePhpFeatureRector::class, - 'php80.php' - ); - yield [__DIR__ . '/Fixture/Php80/SomePhpFeatureRector.php', [[$errorMessage, 10]]]; - - $errorMessage = sprintf( - PhpUpgradeDowngradeRegisteredInSetRule::ERROR_MESSAGE, - SomePhpFeature2Rector::class, - 'downgrade-php80.php' - ); - yield [__DIR__ . '/Fixture/DowngradePhp80/SomePhpFeature2Rector.php', [[$errorMessage, 12]]]; - } - - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(PhpUpgradeDowngradeRegisteredInSetRule::class); - } -} diff --git a/tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/Source/Set/downgrade-php80.php b/tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/Source/Set/downgrade-php80.php deleted file mode 100644 index b1e0877e..00000000 --- a/tests/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule/Source/Set/downgrade-php80.php +++ /dev/null @@ -1,5 +0,0 @@ -analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SkipDowngradeRector.php', []]; - yield [__DIR__ . '/Fixture/SkipAlreadyImplementsMinPhpVersionRector.php', []]; - yield [__DIR__ . '/Fixture/SomePhpFeatureRector.php', [ - [ - sprintf( - PhpUpgradeImplementsMinPhpVersionInterfaceRule::ERROR_MESSAGE, - SomePhpFeatureRector::class - ), - 7, - ], - ]]; - } - - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(PhpUpgradeImplementsMinPhpVersionInterfaceRule::class); - } -} diff --git a/tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/config/configured_rule.neon b/tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/config/configured_rule.neon deleted file mode 100644 index 38b70a18..00000000 --- a/tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/config/configured_rule.neon +++ /dev/null @@ -1,3 +0,0 @@ -rules: - - Symplify\PHPStanRules\Rules\Rector\PhpUpgradeImplementsMinPhpVersionInterfaceRule - diff --git a/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/MissingConfigureWithAssert.php b/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/MissingConfigureWithAssert.php deleted file mode 100644 index 3cd894bd..00000000 --- a/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/MissingConfigureWithAssert.php +++ /dev/null @@ -1,42 +0,0 @@ - $configuration - */ - public function configure(array $configuration): void - { - $valueObjects = $configuration[self::SOME_KEY] ?? []; - } - - public function getRuleDefinition(): RuleDefinition - { - return new RuleDefinition('...', []); - } - - public function getNodeTypes(): array - { - return []; - } - - public function refactor(Node $node) - { - return null; - } -} diff --git a/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/SkipConfigureWithAssert.php b/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/SkipConfigureWithAssert.php deleted file mode 100644 index d69f7de4..00000000 --- a/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/SkipConfigureWithAssert.php +++ /dev/null @@ -1,26 +0,0 @@ - $configuration - */ - public function configure(array $configuration): void - { - $valueObjects = $configuration[self::SOME_KEY] ?? []; - Assert::allIsAOf($valueObjects, SomeValueObject::class); - } -} diff --git a/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/SkipConfigureWithAssertInstanceof.php b/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/SkipConfigureWithAssertInstanceof.php deleted file mode 100644 index 8bf96a38..00000000 --- a/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/SkipConfigureWithAssertInstanceof.php +++ /dev/null @@ -1,26 +0,0 @@ - $configuration - */ - public function configure(array $configuration): void - { - $valueObjects = $configuration[self::SOME_KEY] ?? []; - Assert::allIsInstanceOf($valueObjects, SomeValueObject::class); - } -} diff --git a/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/SkipNoArray.php b/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/SkipNoArray.php deleted file mode 100644 index 1956196a..00000000 --- a/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Fixture/SkipNoArray.php +++ /dev/null @@ -1,23 +0,0 @@ - $configuration - */ - public function configure(array $configuration): void - { - $valueObjects = $configuration[self::SOME_KEY] ?? []; - } -} diff --git a/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/RequireAssertConfigureValueObjectRectorRuleTest.php b/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/RequireAssertConfigureValueObjectRectorRuleTest.php deleted file mode 100644 index 6c69e57d..00000000 --- a/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/RequireAssertConfigureValueObjectRectorRuleTest.php +++ /dev/null @@ -1,42 +0,0 @@ -analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/MissingConfigureWithAssert.php', [[RequireAssertConfigureValueObjectRectorRule::ERROR_MESSAGE, 23]]]; - - yield [__DIR__ . '/Fixture/SkipConfigureWithAssert.php', []]; - yield [__DIR__ . '/Fixture/SkipConfigureWithAssertInstanceof.php', []]; - yield [__DIR__ . '/Fixture/SkipNoArray.php', []]; - } - - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(RequireAssertConfigureValueObjectRectorRule::class); - } -} diff --git a/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Source/SomeValueObject.php b/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Source/SomeValueObject.php deleted file mode 100644 index 55efb473..00000000 --- a/tests/Rules/Rector/RequireAssertConfigureValueObjectRectorRule/Source/SomeValueObject.php +++ /dev/null @@ -1,9 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - $errorMessage = sprintf(RegexSuffixInRegexConstantRule::ERROR_MESSAGE, 'SOME_NAME'); - - yield [__DIR__ . '/Fixture/DifferentSuffix.php', [[$errorMessage, 15]]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(RegexSuffixInRegexConstantRule::class); - } -} diff --git a/tests/Rules/RegexSuffixInRegexConstantRule/config/configured_rule.neon b/tests/Rules/RegexSuffixInRegexConstantRule/config/configured_rule.neon deleted file mode 100644 index 472dba51..00000000 --- a/tests/Rules/RegexSuffixInRegexConstantRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\RegexSuffixInRegexConstantRule diff --git a/tests/Rules/RequireAttributeNameRule/Fixture/MissingName.php b/tests/Rules/RequireAttributeNameRule/Fixture/MissingName.php deleted file mode 100644 index c0f10f7e..00000000 --- a/tests/Rules/RequireAttributeNameRule/Fixture/MissingName.php +++ /dev/null @@ -1,15 +0,0 @@ -analyse([$filePath], $expectedErrorsWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/MissingName.php', [[RequireAttributeNameRule::ERROR_MESSAGE, 11]]]; - - yield [__DIR__ . '/Fixture/SkipCorrectName.php', []]; - yield [__DIR__ . '/Fixture/SkipDefaultName.php', []]; - yield [__DIR__ . '/Fixture/SkipPHPUnitAttributes.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(RequireAttributeNameRule::class); - } -} diff --git a/tests/Rules/RequireAttributeNameRule/config/configured_rule.neon b/tests/Rules/RequireAttributeNameRule/config/configured_rule.neon deleted file mode 100644 index 5d8751d9..00000000 --- a/tests/Rules/RequireAttributeNameRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\RequireAttributeNameRule diff --git a/tests/Rules/SeeAnnotationToTestRule/Fixture/RuleWithSee.php b/tests/Rules/SeeAnnotationToTestRule/Fixture/RuleWithSee.php deleted file mode 100644 index 6d7ce2b6..00000000 --- a/tests/Rules/SeeAnnotationToTestRule/Fixture/RuleWithSee.php +++ /dev/null @@ -1,24 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - $errorMessage = sprintf(SeeAnnotationToTestRule::ERROR_MESSAGE, RuleWithoutSee::class); - yield [__DIR__ . '/Fixture/RuleWithoutSee.php', [[$errorMessage, 12]]]; - - $errorMessage = sprintf(SeeAnnotationToTestRule::ERROR_MESSAGE, RuleWithSeeRandom::class); - yield [__DIR__ . '/Fixture/RuleWithSeeRandom.php', [[$errorMessage, 15]]]; - - yield [__DIR__ . '/Fixture/SkipDeprecatedRuleWithoutSee.php', []]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(SeeAnnotationToTestRule::class); - } -} diff --git a/tests/Rules/SeeAnnotationToTestRule/config/configured_rule.neon b/tests/Rules/SeeAnnotationToTestRule/config/configured_rule.neon deleted file mode 100644 index 6de88d79..00000000 --- a/tests/Rules/SeeAnnotationToTestRule/config/configured_rule.neon +++ /dev/null @@ -1,10 +0,0 @@ -includes: - - ../../../config/included_services.neon - -services: - - - class: Symplify\PHPStanRules\Rules\SeeAnnotationToTestRule - tags: [phpstan.rules.rule] - arguments: - requiredSeeTypes: - - PHPStan\Rules\Rule diff --git a/tests/Rules/UppercaseConstantRule/Fixture/ConstantLower.php b/tests/Rules/UppercaseConstantRule/Fixture/ConstantLower.php deleted file mode 100644 index e0942c48..00000000 --- a/tests/Rules/UppercaseConstantRule/Fixture/ConstantLower.php +++ /dev/null @@ -1,10 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - $errorMessage = sprintf(UppercaseConstantRule::ERROR_MESSAGE, 'SMall'); - yield [__DIR__ . '/Fixture/ConstantLower.php', [[$errorMessage, 9]]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(UppercaseConstantRule::class); - } -} diff --git a/tests/Rules/UppercaseConstantRule/config/configured_rule.neon b/tests/Rules/UppercaseConstantRule/config/configured_rule.neon deleted file mode 100644 index 510e5da4..00000000 --- a/tests/Rules/UppercaseConstantRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../config/included_services.neon - -rules: - - Symplify\PHPStanRules\Rules\UppercaseConstantRule diff --git a/tests/SomeClass.php.inc b/tests/SomeClass.php.inc deleted file mode 100644 index 17ce8504..00000000 --- a/tests/SomeClass.php.inc +++ /dev/null @@ -1,13 +0,0 @@ -name; - } -} diff --git a/tests/Symfony/Rules/RequireInvokableControllerRule/Fixture/MissnamedController.php b/tests/Symfony/Rules/RequireInvokableControllerRule/Fixture/MissnamedController.php deleted file mode 100644 index 67d0eb2d..00000000 --- a/tests/Symfony/Rules/RequireInvokableControllerRule/Fixture/MissnamedController.php +++ /dev/null @@ -1,18 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [ - __DIR__ . '/Fixture/MissnamedRouteAttributeController.php', - [[RequireInvokableControllerRule::ERROR_MESSAGE, 12]], - ]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(RequireInvokableControllerRule::class); - } -} diff --git a/tests/Symfony/Rules/RequireInvokableControllerRule/RequireInvokableControllerRuleTest.php b/tests/Symfony/Rules/RequireInvokableControllerRule/RequireInvokableControllerRuleTest.php deleted file mode 100644 index 432a6d1e..00000000 --- a/tests/Symfony/Rules/RequireInvokableControllerRule/RequireInvokableControllerRuleTest.php +++ /dev/null @@ -1,44 +0,0 @@ -analyse([$filePath], $expectedErrorMessagesWithLines); - } - - public static function provideData(): Iterator - { - yield [__DIR__ . '/Fixture/SkipInvokableController.php', []]; - yield [__DIR__ . '/Fixture/SkipRandomPublicMethodController.php', []]; - - yield [__DIR__ . '/Fixture/MissnamedController.php', [[RequireInvokableControllerRule::ERROR_MESSAGE, 15]]]; - } - - /** - * @return string[] - */ - public static function getAdditionalConfigFiles(): array - { - return [__DIR__ . '/config/configured_rule.neon']; - } - - protected function getRule(): Rule - { - return self::getContainer()->getByType(RequireInvokableControllerRule::class); - } -} diff --git a/tests/Symfony/Rules/RequireInvokableControllerRule/config/configured_rule.neon b/tests/Symfony/Rules/RequireInvokableControllerRule/config/configured_rule.neon deleted file mode 100644 index f8313e81..00000000 --- a/tests/Symfony/Rules/RequireInvokableControllerRule/config/configured_rule.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - ../../../../../tests/config/included_services.neon - -rules: - - Symplify\PHPStanRules\Symfony\Rules\RequireInvokableControllerRule diff --git a/tests/config/included_services.neon b/tests/config/included_services.neon deleted file mode 100644 index bdcc782c..00000000 --- a/tests/config/included_services.neon +++ /dev/null @@ -1,2 +0,0 @@ -includes: - - ../../config/services/services.neon