diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index c752254e..5c8057e3 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -48,7 +48,7 @@ jobs: # see https://github.com/shivammathur/setup-php - uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.3 coverage: none # composer install cache - https://github.com/ramsey/composer-install diff --git a/.github/workflows/downgraded_release.yaml b/.github/workflows/downgraded_release.yaml index 176ffc9f..8017081a 100644 --- a/.github/workflows/downgraded_release.yaml +++ b/.github/workflows/downgraded_release.yaml @@ -20,7 +20,7 @@ jobs: - uses: "shivammathur/setup-php@v2" with: - php-version: 8.2 + php-version: 8.3 coverage: none # invoke patches diff --git a/composer.json b/composer.json index 5887ba97..f53355dc 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "description": "Set of Symplify rules for PHPStan", "license": "MIT", "require": { - "php": ">=8.2", + "php": ">=8.3", "webmozart/assert": "^1.12 || ^2.0", "phpstan/phpstan": "^2.1.30", "nette/utils": "^4.1", diff --git a/src/Doctrine/DoctrineEntityDocumentAnalyser.php b/src/Doctrine/DoctrineEntityDocumentAnalyser.php index ae6fec32..82c686f6 100644 --- a/src/Doctrine/DoctrineEntityDocumentAnalyser.php +++ b/src/Doctrine/DoctrineEntityDocumentAnalyser.php @@ -12,7 +12,7 @@ /** * @var string[] */ - private const ENTITY_DOCBLOCK_MARKERS = ['@Document', '@ORM\\Document', '@Entity', '@ORM\\Entity']; + private const array ENTITY_DOCBLOCK_MARKERS = ['@Document', '@ORM\\Document', '@Entity', '@ORM\\Entity']; public static function isEntityClass(ClassReflection $classReflection): bool { diff --git a/src/Doctrine/RepositoryClassResolver.php b/src/Doctrine/RepositoryClassResolver.php index 35ed6351..b71de200 100644 --- a/src/Doctrine/RepositoryClassResolver.php +++ b/src/Doctrine/RepositoryClassResolver.php @@ -11,25 +11,16 @@ final readonly class RepositoryClassResolver { - /** - * @var string - */ - private const QUOTED_REPOSITORY_CLASS_REGEX = '#repositoryClass=\"(?.*?)\"#'; + private const string QUOTED_REPOSITORY_CLASS_REGEX = '#repositoryClass=\"(?.*?)\"#'; - /** - * @var string - */ - private const REPOSITORY_CLASS_CONST_REGEX = '#repositoryClass=?(\\\\)(?.*?)::class#'; + private const string REPOSITORY_CLASS_CONST_REGEX = '#repositoryClass=?(\\\\)(?.*?)::class#'; - /** - * @var string - */ - private const USE_REPOSITORY_REGEX = '#use (?.*?Repository);#'; + private const string USE_REPOSITORY_REGEX = '#use (?.*?Repository);#'; /** * @var string[] */ - private const REGEX_TRAIN = [ + private const array REGEX_TRAIN = [ self::QUOTED_REPOSITORY_CLASS_REGEX, self::REPOSITORY_CLASS_CONST_REGEX, self::USE_REPOSITORY_REGEX, diff --git a/src/Enum/ClassName.php b/src/Enum/ClassName.php index 915c8a5f..2415778a 100644 --- a/src/Enum/ClassName.php +++ b/src/Enum/ClassName.php @@ -6,33 +6,15 @@ final class ClassName { - /** - * @var string - */ - public const SNIFF = 'PHP_CodeSniffer\Sniffs\Sniff'; - - /** - * @var string - */ - public const RECTOR = 'Rector\Contract\Rector\RectorInterface'; - - /** - * @var string - */ - public const ABSTRACT_RECTOR = 'Rector\Rector\AbstractRector'; - - /** - * @var string - */ - public const CONFIGURABLE_RECTOR = 'Rector\Contract\Rector\ConfigurableRectorInterface'; - - /** - * @var string - */ - public const RECTOR_ATTRIBUTE_KEY = 'Rector\NodeTypeResolver\Node\AttributeKey'; - - /** - * @var string - */ - public const MOCK_OBJECT_CLASS = 'PHPUnit\Framework\MockObject\MockObject'; + public const string SNIFF = 'PHP_CodeSniffer\Sniffs\Sniff'; + + public const string RECTOR = 'Rector\Contract\Rector\RectorInterface'; + + public const string ABSTRACT_RECTOR = 'Rector\Rector\AbstractRector'; + + public const string CONFIGURABLE_RECTOR = 'Rector\Contract\Rector\ConfigurableRectorInterface'; + + public const string RECTOR_ATTRIBUTE_KEY = 'Rector\NodeTypeResolver\Node\AttributeKey'; + + public const string MOCK_OBJECT_CLASS = 'PHPUnit\Framework\MockObject\MockObject'; } diff --git a/src/Enum/DoctrineClass.php b/src/Enum/DoctrineClass.php index 4ff53336..2200f1fe 100644 --- a/src/Enum/DoctrineClass.php +++ b/src/Enum/DoctrineClass.php @@ -6,38 +6,17 @@ final class DoctrineClass { - /** - * @var string - */ - public const ODM_SERVICE_REPOSITORY = 'Doctrine\Bundle\MongoDBBundle\Repository\ServiceDocumentRepository'; - - /** - * @var string - */ - public const ODM_SERVICE_REPOSITORY_INTERFACE = 'Doctrine\Bundle\MongoDBBundle\Repository\ServiceDocumentRepositoryInterface'; - - /** - * @var string - */ - public const ORM_SERVICE_REPOSITORY = 'Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository'; - - /** - * @var string - */ - public const FIXTURE_INTERFACE = 'Doctrine\Common\DataFixtures\FixtureInterface'; - - /** - * @var string - */ - public const ENTITY_REPOSITORY = 'Doctrine\ORM\EntityRepository'; - - /** - * @var string - */ - public const CONNECTION = 'Doctrine\DBAL\Connection'; - - /** - * @var string - */ - public const DOCUMENT_REPOSITORY = 'Doctrine\ODM\MongoDB\Repository\DocumentRepository'; + public const string ODM_SERVICE_REPOSITORY = 'Doctrine\Bundle\MongoDBBundle\Repository\ServiceDocumentRepository'; + + public const string ODM_SERVICE_REPOSITORY_INTERFACE = 'Doctrine\Bundle\MongoDBBundle\Repository\ServiceDocumentRepositoryInterface'; + + public const string ORM_SERVICE_REPOSITORY = 'Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository'; + + public const string FIXTURE_INTERFACE = 'Doctrine\Common\DataFixtures\FixtureInterface'; + + public const string ENTITY_REPOSITORY = 'Doctrine\ORM\EntityRepository'; + + public const string CONNECTION = 'Doctrine\DBAL\Connection'; + + public const string DOCUMENT_REPOSITORY = 'Doctrine\ODM\MongoDB\Repository\DocumentRepository'; } diff --git a/src/Enum/DoctrineEvents.php b/src/Enum/DoctrineEvents.php index 04f7e611..12d55545 100644 --- a/src/Enum/DoctrineEvents.php +++ b/src/Enum/DoctrineEvents.php @@ -9,7 +9,7 @@ final class DoctrineEvents /** * @see https://www.doctrine-project.org/projects/doctrine-orm/en/3.3/reference/events.html */ - public const ORM_LIST = [ + public const array ORM_LIST = [ 'preRemove', 'postRemove', 'prePersist', @@ -28,7 +28,7 @@ final class DoctrineEvents /** * @see https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/events.html#lifecycle-events */ - public const ODM_LIST = [ + public const array ODM_LIST = [ 'documentNotFound', 'onClear', 'postCollectionLoad', diff --git a/src/Enum/MethodName.php b/src/Enum/MethodName.php index 03e57bff..e9b63855 100644 --- a/src/Enum/MethodName.php +++ b/src/Enum/MethodName.php @@ -6,23 +6,11 @@ final class MethodName { - /** - * @var string - */ - public const INVOKE = '__invoke'; + public const string INVOKE = '__invoke'; - /** - * @var string - */ - public const CONSTRUCTOR = '__construct'; + public const string CONSTRUCTOR = '__construct'; - /** - * @var string - */ - public const SET_UP = 'setUp'; + public const string SET_UP = 'setUp'; - /** - * @var string - */ - public const TEAR_DOWN = 'tearDown'; + public const string TEAR_DOWN = 'tearDown'; } diff --git a/src/Enum/RuleIdentifier.php b/src/Enum/RuleIdentifier.php index bfcf582e..dba6c521 100644 --- a/src/Enum/RuleIdentifier.php +++ b/src/Enum/RuleIdentifier.php @@ -6,79 +6,79 @@ final class RuleIdentifier { - public const UPPERCASE_CONSTANT = 'symplify.uppercaseConstant'; + public const string UPPERCASE_CONSTANT = 'symplify.uppercaseConstant'; - public const SEE_ANNOTATION_TO_TEST = 'symplify.seeAnnotationToTest'; + public const string SEE_ANNOTATION_TO_TEST = 'symplify.seeAnnotationToTest'; - public const REQUIRE_ATTRIBUTE_NAME = 'symplify.requireAttributeName'; + public const string REQUIRE_ATTRIBUTE_NAME = 'symplify.requireAttributeName'; - public const PHP_PARSER_NO_LEADING_BACKSLASH_IN_NAME = 'phpParser.noLeadingBackslashInName'; + public const string PHP_PARSER_NO_LEADING_BACKSLASH_IN_NAME = 'phpParser.noLeadingBackslashInName'; - public const PARENT_METHOD_VISIBILITY_OVERRIDE = 'symplify.parentMethodVisibilityOverride'; + public const string PARENT_METHOD_VISIBILITY_OVERRIDE = 'symplify.parentMethodVisibilityOverride'; - public const NO_RETURN_SETTER_METHOD = 'symplify.noReturnSetterMethod'; + public const string NO_RETURN_SETTER_METHOD = 'symplify.noReturnSetterMethod'; - public const FORBIDDEN_STATIC_CLASS_CONST_FETCH = 'symplify.forbiddenStaticClassConstFetch'; + public const string FORBIDDEN_STATIC_CLASS_CONST_FETCH = 'symplify.forbiddenStaticClassConstFetch'; - public const PREFERRED_CLASS = 'symplify.preferredClass'; + public const string PREFERRED_CLASS = 'symplify.preferredClass'; - public const NO_TEST_MOCKS = 'symplify.noTestMocks'; + public const string NO_TEST_MOCKS = 'symplify.noTestMocks'; - public const NO_GLOBAL_CONST = 'symplify.noGlobalConst'; + public const string NO_GLOBAL_CONST = 'symplify.noGlobalConst'; - public const NO_ENTITY_OUTSIDE_ENTITY_NAMESPACE = 'symplify.noEntityOutsideEntityNamespace'; + public const string NO_ENTITY_OUTSIDE_ENTITY_NAMESPACE = 'symplify.noEntityOutsideEntityNamespace'; - public const FORBIDDEN_NODE = 'symplify.forbiddenNode'; + public const string FORBIDDEN_NODE = 'symplify.forbiddenNode'; - public const MULTIPLE_CLASS_LIKE_IN_FILE = 'symplify.multipleClassLikeInFile'; + public const string MULTIPLE_CLASS_LIKE_IN_FILE = 'symplify.multipleClassLikeInFile'; - public const FORBIDDEN_FUNC_CALL = 'symplify.forbiddenFuncCall'; + public const string FORBIDDEN_FUNC_CALL = 'symplify.forbiddenFuncCall'; - public const REQUIRE_ATTRIBUTE_NAMESPACE = 'symplify.requireAttributeNamespace'; + public const string REQUIRE_ATTRIBUTE_NAMESPACE = 'symplify.requireAttributeNamespace'; - public const FORBIDDEN_ARRAY_METHOD_CALL = 'symplify.forbiddenArrayMethodCall'; + public const string FORBIDDEN_ARRAY_METHOD_CALL = 'symplify.forbiddenArrayMethodCall'; - public const FORBIDDEN_EXTEND_OF_NON_ABSTRACT_CLASS = 'symplify.forbiddenExtendOfNonAbstractClass'; + public const string FORBIDDEN_EXTEND_OF_NON_ABSTRACT_CLASS = 'symplify.forbiddenExtendOfNonAbstractClass'; - public const EXPLICIT_ABSTRACT_PREFIX_NAME = 'symplify.explicitAbstractPrefixName'; + public const string EXPLICIT_ABSTRACT_PREFIX_NAME = 'symplify.explicitAbstractPrefixName'; - public const EXPLICIT_INTERFACE_SUFFIX_NAME = 'symplify.explicitInterfaceSuffixName'; + public const string EXPLICIT_INTERFACE_SUFFIX_NAME = 'symplify.explicitInterfaceSuffixName'; - public const EXPLICIT_TRAIT_SUFFIX_NAME = 'symplify.explicitTraitSuffixName'; + public const string EXPLICIT_TRAIT_SUFFIX_NAME = 'symplify.explicitTraitSuffixName'; - public const REQUIRE_UNIQUE_ENUM_CONSTANT = 'symplify.requireUniqueEnumConstant'; + public const string REQUIRE_UNIQUE_ENUM_CONSTANT = 'symplify.requireUniqueEnumConstant'; - public const REQUIRE_EXCEPTION_NAMESPACE = 'symplify.requireExceptionNamespace'; + public const string REQUIRE_EXCEPTION_NAMESPACE = 'symplify.requireExceptionNamespace'; - public const CLASS_NAME_RESPECTS_PARENT_SUFFIX = 'symplify.classNameRespectsParentSuffix'; + public const string CLASS_NAME_RESPECTS_PARENT_SUFFIX = 'symplify.classNameRespectsParentSuffix'; - public const REQUIRED_INTERFACE_CONTRACT_NAMESPACE = 'symplify.requiredInterfaceContractNamespace'; + public const string REQUIRED_INTERFACE_CONTRACT_NAMESPACE = 'symplify.requiredInterfaceContractNamespace'; - public const NO_VALUE_OBJECT_IN_SERVICE_CONSTRUCTOR = 'symplify.noValueObjectInServiceConstructor'; + public const string NO_VALUE_OBJECT_IN_SERVICE_CONSTRUCTOR = 'symplify.noValueObjectInServiceConstructor'; - public const NO_DYNAMIC_NAME = 'symplify.noDynamicName'; + public const string NO_DYNAMIC_NAME = 'symplify.noDynamicName'; - public const NO_REFERENCE = 'symplify.noReference'; + public const string NO_REFERENCE = 'symplify.noReference'; - public const NO_CONSTRUCTOR_OVERRIDE = 'symplify.noConstructorOverride'; + public const string NO_CONSTRUCTOR_OVERRIDE = 'symplify.noConstructorOverride'; - public const FORBIDDEN_NEW_INSTANCE = 'symplify.forbiddenNewInstance'; + public const string FORBIDDEN_NEW_INSTANCE = 'symplify.forbiddenNewInstance'; - public const MAXIMUM_IGNORED_ERROR_COUNT = 'symplify.maximumIgnoredErrorCount'; + public const string MAXIMUM_IGNORED_ERROR_COUNT = 'symplify.maximumIgnoredErrorCount'; - public const STRING_FILE_ABSOLUTE_PATH_EXISTS = 'symplify.stringFileAbsolutePathExists'; + public const string STRING_FILE_ABSOLUTE_PATH_EXISTS = 'symplify.stringFileAbsolutePathExists'; - public const NO_JUST_PROPERTY_ASSIGN = 'symplify.noJustPropertyAssign'; + public const string NO_JUST_PROPERTY_ASSIGN = 'symplify.noJustPropertyAssign'; - public const NO_PROTECTED_CLASS_STMT = 'symplify.noProtectedClassStmt'; + public const string NO_PROTECTED_CLASS_STMT = 'symplify.noProtectedClassStmt'; - public const CONVENTION_PARAM_NAME_TO_TYPE = 'symplify.conventionParamNameToType'; + public const string CONVENTION_PARAM_NAME_TO_TYPE = 'symplify.conventionParamNameToType'; - public const NO_ARRAY_MAP_WITH_ARRAY_CALLABLE = 'symplify.noArrayMapWithArrayCallable'; + public const string NO_ARRAY_MAP_WITH_ARRAY_CALLABLE = 'symplify.noArrayMapWithArrayCallable'; - public const RULE_IDENTIFIER = 'symplify.foreachCeption'; + public const string RULE_IDENTIFIER = 'symplify.foreachCeption'; - public const NO_MISSING_VARIABLE_DIM_FETCH = 'symplify.noMissingVariableDimFetch'; + public const string NO_MISSING_VARIABLE_DIM_FETCH = 'symplify.noMissingVariableDimFetch'; - public const NO_MISSNAMED_DOC_TAG = 'symplify.noMissnamedDocTag'; + public const string NO_MISSNAMED_DOC_TAG = 'symplify.noMissnamedDocTag'; } diff --git a/src/Enum/RuleIdentifier/DoctrineRuleIdentifier.php b/src/Enum/RuleIdentifier/DoctrineRuleIdentifier.php index ca1d9232..3a928b52 100644 --- a/src/Enum/RuleIdentifier/DoctrineRuleIdentifier.php +++ b/src/Enum/RuleIdentifier/DoctrineRuleIdentifier.php @@ -6,19 +6,19 @@ final class DoctrineRuleIdentifier { - public const NO_GET_REPOSITORY_OUTSIDE_SERVICE = 'doctrine.noGetRepositoryOutsideService'; + public const string NO_GET_REPOSITORY_OUTSIDE_SERVICE = 'doctrine.noGetRepositoryOutsideService'; - public const NO_REPOSITORY_CALL_IN_DATA_FIXTURES = 'doctrine.noRepositoryCallInDataFixtures'; + public const string NO_REPOSITORY_CALL_IN_DATA_FIXTURES = 'doctrine.noRepositoryCallInDataFixtures'; - public const NO_PARENT_REPOSITORY = 'doctrine.noParentRepository'; + public const string NO_PARENT_REPOSITORY = 'doctrine.noParentRepository'; - public const NO_ENTITY_MOCKING = 'doctrine.noEntityMocking'; + public const string NO_ENTITY_MOCKING = 'doctrine.noEntityMocking'; - public const REQUIRE_QUERY_BUILDER_ON_REPOSITORY = 'doctrine.requireQueryBuilderOnRepository'; + public const string REQUIRE_QUERY_BUILDER_ON_REPOSITORY = 'doctrine.requireQueryBuilderOnRepository'; - public const INJECT_SERVICE_REPOSITORY = 'doctrine.injectServiceRepository'; + public const string INJECT_SERVICE_REPOSITORY = 'doctrine.injectServiceRepository'; - public const NO_LISTENER_WITHOUT_CONTRACT = 'doctrine.noListenerWithoutContract'; + public const string NO_LISTENER_WITHOUT_CONTRACT = 'doctrine.noListenerWithoutContract'; - public const REQUIRE_SERVICE_PARENT_REPOSITORY = 'doctrine.requireServiceParentRepository'; + public const string REQUIRE_SERVICE_PARENT_REPOSITORY = 'doctrine.requireServiceParentRepository'; } diff --git a/src/Enum/RuleIdentifier/PHPUnitRuleIdentifier.php b/src/Enum/RuleIdentifier/PHPUnitRuleIdentifier.php index 6fc664b6..4e1e2591 100644 --- a/src/Enum/RuleIdentifier/PHPUnitRuleIdentifier.php +++ b/src/Enum/RuleIdentifier/PHPUnitRuleIdentifier.php @@ -6,15 +6,15 @@ final class PHPUnitRuleIdentifier { - public const NO_DOCUMENT_MOCKING = 'phpunit.noDocumentMocking'; + public const string NO_DOCUMENT_MOCKING = 'phpunit.noDocumentMocking'; - public const NO_MOCK_ONLY = 'phpunit.noMockOnly'; + public const string NO_MOCK_ONLY = 'phpunit.noMockOnly'; - public const PUBLIC_STATIC_DATA_PROVIDER = 'phpunit.publicStaticDataProvider'; + public const string PUBLIC_STATIC_DATA_PROVIDER = 'phpunit.publicStaticDataProvider'; - public const NO_MOCK_OBJECT_AND_REAL_OBJECT_PROPERTY = 'phpunit.noMockObjectAndRealObjectProperty'; + public const string NO_MOCK_OBJECT_AND_REAL_OBJECT_PROPERTY = 'phpunit.noMockObjectAndRealObjectProperty'; - public const NO_ASSERT_FUNC_CALL_IN_TESTS = 'phpunit.noAssertFuncCallInTests'; + public const string NO_ASSERT_FUNC_CALL_IN_TESTS = 'phpunit.noAssertFuncCallInTests'; - public const NO_DOUBLE_CONSECUTIVE_TEST_MOCK = 'phpunit.noDoubleConsecutiveTestMock'; + public const string NO_DOUBLE_CONSECUTIVE_TEST_MOCK = 'phpunit.noDoubleConsecutiveTestMock'; } diff --git a/src/Enum/RuleIdentifier/RectorRuleIdentifier.php b/src/Enum/RuleIdentifier/RectorRuleIdentifier.php index bb44a4e4..db6bfc50 100644 --- a/src/Enum/RuleIdentifier/RectorRuleIdentifier.php +++ b/src/Enum/RuleIdentifier/RectorRuleIdentifier.php @@ -6,21 +6,21 @@ final class RectorRuleIdentifier { - public const NO_INSTANCE_OF_STATIC_REFLECTION = 'rector.noInstanceOfStaticReflection'; + public const string NO_INSTANCE_OF_STATIC_REFLECTION = 'rector.noInstanceOfStaticReflection'; - public const UPGRADE_DOWNGRADE_REGISTERED_IN_SET = 'rector.upgradeDowngradeRegisteredInSet'; + public const string UPGRADE_DOWNGRADE_REGISTERED_IN_SET = 'rector.upgradeDowngradeRegisteredInSet'; - public const PHP_RULE_IMPLEMENTS_MIN_VERSION = 'rector.phpRuleImplementsMinVersion'; + public const string PHP_RULE_IMPLEMENTS_MIN_VERSION = 'rector.phpRuleImplementsMinVersion'; - public const NO_CLASS_REFLECTION_STATIC_REFLECTION = 'rector.noClassReflectionStaticReflection'; + public const string NO_CLASS_REFLECTION_STATIC_REFLECTION = 'rector.noClassReflectionStaticReflection'; - public const NO_PROPERTY_NODE_ASSIGN = 'rector.noPropertyNodeAssign'; + public const string NO_PROPERTY_NODE_ASSIGN = 'rector.noPropertyNodeAssign'; - public const PREFER_DIRECT_IS_NAME = 'rector.preferDirectIsName'; + public const string PREFER_DIRECT_IS_NAME = 'rector.preferDirectIsName'; - public const NO_ONLY_NULL_RETURN_IN_REFACTOR = 'rector.noOnlyNullReturnInRefactor'; + public const string NO_ONLY_NULL_RETURN_IN_REFACTOR = 'rector.noOnlyNullReturnInRefactor'; - public const NO_INTEGER_REFACTOR_RETURN = 'rector.noIntegerRefactorReturn'; + public const string NO_INTEGER_REFACTOR_RETURN = 'rector.noIntegerRefactorReturn'; - public const AVOID_FEATURE_SET_ATTRIBUTE_IN_RECTOR = 'rector.avoidFeatureSetAttributeInRector'; + public const string AVOID_FEATURE_SET_ATTRIBUTE_IN_RECTOR = 'rector.avoidFeatureSetAttributeInRector'; } diff --git a/src/Enum/RuleIdentifier/SymfonyRuleIdentifier.php b/src/Enum/RuleIdentifier/SymfonyRuleIdentifier.php index 4f01b1c6..c1b8f8b1 100644 --- a/src/Enum/RuleIdentifier/SymfonyRuleIdentifier.php +++ b/src/Enum/RuleIdentifier/SymfonyRuleIdentifier.php @@ -6,63 +6,63 @@ final class SymfonyRuleIdentifier { - public const NO_GET_IN_CONTROLLER = 'symfony.noGetInController'; + public const string NO_GET_IN_CONTROLLER = 'symfony.noGetInController'; - public const NO_GET_IN_COMMAND = 'symfony.noGetInCommand'; + public const string NO_GET_IN_COMMAND = 'symfony.noGetInCommand'; - public const NO_GET_DOCTRINE_IN_CONTROLLER = 'symfony.noGetDoctrineInController'; + public const string NO_GET_DOCTRINE_IN_CONTROLLER = 'symfony.noGetDoctrineInController'; - public const SINGLE_ARG_EVENT_DISPATCH = 'symfony.singleArgEventDispatch'; + public const string SINGLE_ARG_EVENT_DISPATCH = 'symfony.singleArgEventDispatch'; - public const NO_LISTENER_WITHOUT_CONTRACT = 'symfony.noListenerWithoutContract'; + public const string NO_LISTENER_WITHOUT_CONTRACT = 'symfony.noListenerWithoutContract'; - public const SYMFONY_REQUIRE_INVOKABLE_CONTROLLER = 'symfony.requireInvokableController'; + public const string SYMFONY_REQUIRE_INVOKABLE_CONTROLLER = 'symfony.requireInvokableController'; - public const SYMFONY_NO_REQUIRED_OUTSIDE_CLASS = 'symfony.noRequiredOutsideClass'; + public const string SYMFONY_NO_REQUIRED_OUTSIDE_CLASS = 'symfony.noRequiredOutsideClass'; - public const NO_STRING_IN_GET_SUBSCRIBED_EVENTS = 'symfony.noStringInGetSubscribedEvents'; + public const string NO_STRING_IN_GET_SUBSCRIBED_EVENTS = 'symfony.noStringInGetSubscribedEvents'; - public const SYMFONY_NO_ABSTRACT_CONTROLLER_CONSTRUCTOR = 'symfony.noAbstractControllerConstructor'; + public const string SYMFONY_NO_ABSTRACT_CONTROLLER_CONSTRUCTOR = 'symfony.noAbstractControllerConstructor'; - public const SINGLE_REQUIRED_METHOD = 'symfony.singleRequiredMethod'; + public const string SINGLE_REQUIRED_METHOD = 'symfony.singleRequiredMethod'; - public const SYMFONY_REQUIRED_ONLY_IN_ABSTRACT = 'symfony.requiredOnlyInAbstract'; + public const string SYMFONY_REQUIRED_ONLY_IN_ABSTRACT = 'symfony.requiredOnlyInAbstract'; - public const NO_CONSTRUCT_AND_REQUIRED = 'symfony.noConstructAndRequired'; + public const string NO_CONSTRUCT_AND_REQUIRED = 'symfony.noConstructAndRequired'; - public const FORM_TYPE_CLASS_NAME = 'symfony.formTypeClassName'; + public const string FORM_TYPE_CLASS_NAME = 'symfony.formTypeClassName'; - public const NO_ROUTING_PREFIX = 'symfony.noRoutingPrefix'; + public const string NO_ROUTING_PREFIX = 'symfony.noRoutingPrefix'; - public const NO_CLASS_LEVEL_ROUTE = 'symfony.noClassLevelRoute'; + public const string NO_CLASS_LEVEL_ROUTE = 'symfony.noClassLevelRoute'; - public const NO_ROUTE_TRAILING_SLASH_PATH = 'symfony.noRouteTrailingSlashPath'; + public const string NO_ROUTE_TRAILING_SLASH_PATH = 'symfony.noRouteTrailingSlashPath'; - public const NO_FIND_TAGGED_SERVICE_IDS_CALL = 'symfony.noFindTaggedServiceIdsCall'; + public const string NO_FIND_TAGGED_SERVICE_IDS_CALL = 'symfony.noFindTaggedServiceIdsCall'; - public const REQUIRE_ROUTE_NAME_TO_GENERATE_CONTROLLER_ROUTE = 'symfony.requireRouteNameToGenerateControllerRoute'; + public const string REQUIRE_ROUTE_NAME_TO_GENERATE_CONTROLLER_ROUTE = 'symfony.requireRouteNameToGenerateControllerRoute'; - public const SERVICES_EXCLUDED_DIRECTORY_MUST_EXIST = 'symfony.servicesExcludedDirectoryMustExist'; + public const string SERVICES_EXCLUDED_DIRECTORY_MUST_EXIST = 'symfony.servicesExcludedDirectoryMustExist'; - public const NO_BUNDLE_RESOURCE_CONFIG = 'symfony.noBundleResourceConfig'; + public const string NO_BUNDLE_RESOURCE_CONFIG = 'symfony.noBundleResourceConfig'; - public const ALREADY_REGISTERED_AUTODISCOVERY_SERVICE = 'symfony.alreadyRegisteredAutodiscoveryService'; + public const string ALREADY_REGISTERED_AUTODISCOVERY_SERVICE = 'symfony.alreadyRegisteredAutodiscoveryService'; - public const NO_DUPLICATE_ARGS_AUTOWIRE_BY_TYPE = 'symfony.noDuplicateArgsAutowireByType'; + public const string NO_DUPLICATE_ARGS_AUTOWIRE_BY_TYPE = 'symfony.noDuplicateArgsAutowireByType'; - public const NO_DUPLICATE_ARG_AUTOWIRE_BY_TYPE = 'symfony.noDuplicateArgAutowireByType'; + public const string NO_DUPLICATE_ARG_AUTOWIRE_BY_TYPE = 'symfony.noDuplicateArgAutowireByType'; - public const NO_SERVICE_SAME_NAME_SET_CLASS = 'symfony.noServiceSameNameSetClass'; + public const string NO_SERVICE_SAME_NAME_SET_CLASS = 'symfony.noServiceSameNameSetClass'; - public const REQUIRED_IS_GRANTED_ENUM = 'symfony.requiredIsGrantedEnum'; + public const string REQUIRED_IS_GRANTED_ENUM = 'symfony.requiredIsGrantedEnum'; - public const PREFER_AUTOWIRE_ATTRIBUTE_OVER_CONFIG_PARAM = 'symfony.preferAutowireAttributeOverConfigParam'; + public const string PREFER_AUTOWIRE_ATTRIBUTE_OVER_CONFIG_PARAM = 'symfony.preferAutowireAttributeOverConfigParam'; - public const RULE_IDENTIFIER = 'symfony.noServiceAutowireDuplicate'; + public const string RULE_IDENTIFIER = 'symfony.noServiceAutowireDuplicate'; - public const NO_SET_CLASS_SERVICE_DUPLICATE = 'symfony.noSetClassServiceDuplicate'; + public const string NO_SET_CLASS_SERVICE_DUPLICATE = 'symfony.noSetClassServiceDuplicate'; - public const NO_CONTROLLER_METHOD_INJECTION = 'symfony.noControllerMethodInjection'; + public const string NO_CONTROLLER_METHOD_INJECTION = 'symfony.noControllerMethodInjection'; - public const FILE_NAME_MATCHES_EXTENSION = 'symfony.fileNameMatchesExtension'; + public const string FILE_NAME_MATCHES_EXTENSION = 'symfony.fileNameMatchesExtension'; } diff --git a/src/Enum/SensioClass.php b/src/Enum/SensioClass.php index 547ef902..ab3a01d4 100644 --- a/src/Enum/SensioClass.php +++ b/src/Enum/SensioClass.php @@ -6,7 +6,7 @@ final class SensioClass { - public const IS_GRANTED = 'Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted'; + public const string IS_GRANTED = 'Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted'; - public const SECURITY = 'Sensio\Bundle\FrameworkExtraBundle\Configuration\Security'; + public const string SECURITY = 'Sensio\Bundle\FrameworkExtraBundle\Configuration\Security'; } diff --git a/src/Enum/SymfonyClass.php b/src/Enum/SymfonyClass.php index 9e754f42..f7bdfe3e 100644 --- a/src/Enum/SymfonyClass.php +++ b/src/Enum/SymfonyClass.php @@ -6,43 +6,43 @@ final class SymfonyClass { - public const SECURITY_LISTENER = 'Symfony\Component\Security\Http\Firewall\AbstractListener'; + public const string SECURITY_LISTENER = 'Symfony\Component\Security\Http\Firewall\AbstractListener'; - public const FORM_SECURITY_LISTENER = 'Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener'; + public const string FORM_SECURITY_LISTENER = 'Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener'; - public const ROUTE_ATTRIBUTE = 'Symfony\Component\Routing\Attribute\Route'; + public const string ROUTE_ATTRIBUTE = 'Symfony\Component\Routing\Attribute\Route'; - public const ROUTE_ANNOTATION = 'Symfony\Component\Routing\Annotation\Route'; + public const string ROUTE_ANNOTATION = 'Symfony\Component\Routing\Annotation\Route'; - public const CONTROLLER = 'Symfony\Bundle\FrameworkBundle\Controller\Controller'; + public const string CONTROLLER = 'Symfony\Bundle\FrameworkBundle\Controller\Controller'; - public const REQUIRED_ATTRIBUTE = 'Symfony\Contracts\Service\Attribute\Required'; + public const string REQUIRED_ATTRIBUTE = 'Symfony\Contracts\Service\Attribute\Required'; - public const ABSTRACT_CONTROLLER = 'Symfony\Bundle\FrameworkBundle\Controller\AbstractController'; + public const string ABSTRACT_CONTROLLER = 'Symfony\Bundle\FrameworkBundle\Controller\AbstractController'; - public const EVENT_LISTENER_ATTRIBUTE = 'Symfony\Component\EventDispatcher\Attribute\AsEventListener'; + public const string EVENT_LISTENER_ATTRIBUTE = 'Symfony\Component\EventDispatcher\Attribute\AsEventListener'; - public const EVENT_SUBSCRIBER_INTERFACE = 'Symfony\Component\EventDispatcher\EventSubscriberInterface'; + public const string EVENT_SUBSCRIBER_INTERFACE = 'Symfony\Component\EventDispatcher\EventSubscriberInterface'; - public const EVENT_DISPATCHER_INTERFACE = 'Symfony\Component\EventDispatcher\EventDispatcherInterface'; + public const string EVENT_DISPATCHER_INTERFACE = 'Symfony\Component\EventDispatcher\EventDispatcherInterface'; - public const FORM_TYPE = 'Symfony\Component\Form\AbstractType'; + public const string FORM_TYPE = 'Symfony\Component\Form\AbstractType'; - public const ROUTE_IMPORT_CONFIGURATOR = 'Symfony\Component\Routing\Loader\Configurator\ImportConfigurator'; + public const string ROUTE_IMPORT_CONFIGURATOR = 'Symfony\Component\Routing\Loader\Configurator\ImportConfigurator'; - public const FORM_EVENTS = 'Symfony\Component\Form\FormEvents'; + public const string FORM_EVENTS = 'Symfony\Component\Form\FormEvents'; - public const URL_GENERATOR = 'Symfony\Component\Routing\Generator\UrlGeneratorInterface'; + public const string URL_GENERATOR = 'Symfony\Component\Routing\Generator\UrlGeneratorInterface'; - public const COMMAND = 'Symfony\Component\Console\Command\Command'; + public const string COMMAND = 'Symfony\Component\Console\Command\Command'; - public const VALIDATOR_TEST_CASE = 'Symfony\Component\Validator\Test\ConstraintValidatorTestCase'; + public const string VALIDATOR_TEST_CASE = 'Symfony\Component\Validator\Test\ConstraintValidatorTestCase'; - public const CONTAINER_CONFIGURATOR = 'Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator'; + public const string CONTAINER_CONFIGURATOR = 'Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator'; - public const IS_GRANTED = 'Symfony\Component\Security\Http\Attribute\IsGranted'; + public const string IS_GRANTED = 'Symfony\Component\Security\Http\Attribute\IsGranted'; - public const ATTRIBUTE = 'Symfony\Component\DependencyInjection\Attribute\Autowire'; + public const string ATTRIBUTE = 'Symfony\Component\DependencyInjection\Attribute\Autowire'; - public const REQUEST = 'Symfony\Component\HttpFoundation\Request'; + public const string REQUEST = 'Symfony\Component\HttpFoundation\Request'; } diff --git a/src/Enum/SymfonyFunctionName.php b/src/Enum/SymfonyFunctionName.php index cd5a43e4..bfc5b61c 100644 --- a/src/Enum/SymfonyFunctionName.php +++ b/src/Enum/SymfonyFunctionName.php @@ -6,9 +6,9 @@ final class SymfonyFunctionName { - public const REF = 'Symfony\Component\DependencyInjection\Loader\Configurator\ref'; + public const string REF = 'Symfony\Component\DependencyInjection\Loader\Configurator\ref'; - public const SERVICE = 'Symfony\Component\DependencyInjection\Loader\Configurator\service'; + public const string SERVICE = 'Symfony\Component\DependencyInjection\Loader\Configurator\service'; - public const PARAM = 'Symfony\Component\DependencyInjection\Loader\Configurator\param'; + public const string PARAM = 'Symfony\Component\DependencyInjection\Loader\Configurator\param'; } diff --git a/src/Enum/TestClassName.php b/src/Enum/TestClassName.php index 6c56ae06..7301edc3 100644 --- a/src/Enum/TestClassName.php +++ b/src/Enum/TestClassName.php @@ -6,13 +6,7 @@ final class TestClassName { - /** - * @var string - */ - public const PHPUNIT_TEST_CASE = 'PHPUnit\Framework\TestCase'; + public const string PHPUNIT_TEST_CASE = 'PHPUnit\Framework\TestCase'; - /** - * @var string - */ - public const BEHAT_CONTEXT = 'Behat\Behat\Context\Context'; + public const string BEHAT_CONTEXT = 'Behat\Behat\Context\Context'; } diff --git a/src/PhpDocParser/PhpDocNodeTraverser.php b/src/PhpDocParser/PhpDocNodeTraverser.php index eab2d3f4..1f87f762 100644 --- a/src/PhpDocParser/PhpDocNodeTraverser.php +++ b/src/PhpDocParser/PhpDocNodeTraverser.php @@ -25,9 +25,8 @@ final class PhpDocNodeTraverser * for the current node. * * @api - * @var int */ - public const DONT_TRAVERSE_CHILDREN = 1; + public const int DONT_TRAVERSE_CHILDREN = 1; /** * If NodeVisitor::enterNode() or NodeVisitor::leaveNode() returns STOP_TRAVERSAL, traversal is aborted. @@ -35,9 +34,8 @@ final class PhpDocNodeTraverser * The afterTraverse() method will still be invoked. * * @api - * @var int */ - public const STOP_TRAVERSAL = 2; + public const int STOP_TRAVERSAL = 2; /** * If NodeVisitor::leaveNode() returns NODE_REMOVE for a node that occurs in an array, it will be removed from the @@ -46,9 +44,8 @@ final class PhpDocNodeTraverser * For subsequent visitors leaveNode() will still be invoked for the removed node. * * @api - * @var int */ - public const NODE_REMOVE = 3; + public const int NODE_REMOVE = 3; /** * If NodeVisitor::enterNode() returns DONT_TRAVERSE_CURRENT_AND_CHILDREN, child nodes of the current node will not @@ -58,9 +55,8 @@ final class PhpDocNodeTraverser * enterNode() method invoked. * * @api - * @var int */ - public const DONT_TRAVERSE_CURRENT_AND_CHILDREN = 4; + public const int DONT_TRAVERSE_CURRENT_AND_CHILDREN = 4; /** * @var bool Whether traversal should be stopped diff --git a/src/ReturnTypeExtension/NodeGetAttributeTypeExtension.php b/src/ReturnTypeExtension/NodeGetAttributeTypeExtension.php index 390d6ecc..59fbe430 100644 --- a/src/ReturnTypeExtension/NodeGetAttributeTypeExtension.php +++ b/src/ReturnTypeExtension/NodeGetAttributeTypeExtension.php @@ -29,7 +29,7 @@ final class NodeGetAttributeTypeExtension implements DynamicMethodReturnTypeExte /** * @var array */ - private const ARGUMENT_KEY_TO_RETURN_TYPE = [ + private const array ARGUMENT_KEY_TO_RETURN_TYPE = [ 'scope' => Scope::class, ClassName::RECTOR_ATTRIBUTE_KEY . '::SCOPE' => Scope::class, 'originalNode' => Node::class, diff --git a/src/Rules/CheckRequiredInterfaceInContractNamespaceRule.php b/src/Rules/CheckRequiredInterfaceInContractNamespaceRule.php index 72536530..29cec5c2 100644 --- a/src/Rules/CheckRequiredInterfaceInContractNamespaceRule.php +++ b/src/Rules/CheckRequiredInterfaceInContractNamespaceRule.php @@ -18,16 +18,12 @@ */ final class CheckRequiredInterfaceInContractNamespaceRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Interface must be located in "Contract" or "Contracts" namespace'; + public const string ERROR_MESSAGE = 'Interface must be located in "Contract" or "Contracts" namespace'; /** - * @var string * @see https://regex101.com/r/kmrIG1/2 */ - private const A_CONTRACT_NAMESPACE_REGEX = '#\bContracts?\b#'; + private const string A_CONTRACT_NAMESPACE_REGEX = '#\bContracts?\b#'; public function getNodeType(): string { diff --git a/src/Rules/ClassNameRespectsParentSuffixRule.php b/src/Rules/ClassNameRespectsParentSuffixRule.php index b2723fa7..b2d54853 100644 --- a/src/Rules/ClassNameRespectsParentSuffixRule.php +++ b/src/Rules/ClassNameRespectsParentSuffixRule.php @@ -25,15 +25,12 @@ */ final class ClassNameRespectsParentSuffixRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Class should have suffix "%s" to respect parent type'; + public const string ERROR_MESSAGE = 'Class should have suffix "%s" to respect parent type'; /** * @var string[] */ - private const DEFAULT_PARENT_CLASSES = [ + private const array DEFAULT_PARENT_CLASSES = [ SymfonyClass::COMMAND, SymfonyClass::EVENT_SUBSCRIBER_INTERFACE, SymfonyClass::ABSTRACT_CONTROLLER, diff --git a/src/Rules/Complexity/ForbiddenArrayMethodCallRule.php b/src/Rules/Complexity/ForbiddenArrayMethodCallRule.php index 68c42fe9..3c067f61 100644 --- a/src/Rules/Complexity/ForbiddenArrayMethodCallRule.php +++ b/src/Rules/Complexity/ForbiddenArrayMethodCallRule.php @@ -20,10 +20,7 @@ */ final class ForbiddenArrayMethodCallRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Array method calls [$this, "method"] are not allowed. Use explicit method instead to help PhpStorm, PHPStan and Rector understand your code'; + public const string ERROR_MESSAGE = 'Array method calls [$this, "method"] are not allowed. Use explicit method instead to help PhpStorm, PHPStan and Rector understand your code'; public function getNodeType(): string { diff --git a/src/Rules/Complexity/ForeachCeptionRule.php b/src/Rules/Complexity/ForeachCeptionRule.php index 84b91e44..862b9f06 100644 --- a/src/Rules/Complexity/ForeachCeptionRule.php +++ b/src/Rules/Complexity/ForeachCeptionRule.php @@ -17,12 +17,9 @@ */ final class ForeachCeptionRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'There is %d nested foreach nested in each other. Refactor to more flat approach or to collection to avoid high complexity'; + public const string ERROR_MESSAGE = 'There is %d nested foreach nested in each other. Refactor to more flat approach or to collection to avoid high complexity'; - private const MAX_NESTED_FOREACHES = 3; + private const int MAX_NESTED_FOREACHES = 3; public function getNodeType(): string { diff --git a/src/Rules/Complexity/NoArrayMapWithArrayCallableRule.php b/src/Rules/Complexity/NoArrayMapWithArrayCallableRule.php index bd38ddb1..9417930d 100644 --- a/src/Rules/Complexity/NoArrayMapWithArrayCallableRule.php +++ b/src/Rules/Complexity/NoArrayMapWithArrayCallableRule.php @@ -21,10 +21,7 @@ */ final class NoArrayMapWithArrayCallableRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Avoid using array callables in array_map(), as it cripples static analysis on used method'; + public const string ERROR_MESSAGE = 'Avoid using array callables in array_map(), as it cripples static analysis on used method'; public function getNodeType(): string { diff --git a/src/Rules/Complexity/NoConstructorOverrideRule.php b/src/Rules/Complexity/NoConstructorOverrideRule.php index 702869c5..5818f4db 100644 --- a/src/Rules/Complexity/NoConstructorOverrideRule.php +++ b/src/Rules/Complexity/NoConstructorOverrideRule.php @@ -18,15 +18,9 @@ */ final class NoConstructorOverrideRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Possible __construct() override, this can cause missing dependencies or setup'; + public const string ERROR_MESSAGE = 'Possible __construct() override, this can cause missing dependencies or setup'; - /** - * @var string - */ - private const CONSTRUCTOR_NAME = '__construct'; + private const string CONSTRUCTOR_NAME = '__construct'; public function getNodeType(): string { diff --git a/src/Rules/Complexity/NoJustPropertyAssignRule.php b/src/Rules/Complexity/NoJustPropertyAssignRule.php index 3457b20b..66aaac4d 100644 --- a/src/Rules/Complexity/NoJustPropertyAssignRule.php +++ b/src/Rules/Complexity/NoJustPropertyAssignRule.php @@ -25,10 +25,7 @@ */ final readonly class NoJustPropertyAssignRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of assigning service property to a variable, use the property directly'; + public const string ERROR_MESSAGE = 'Instead of assigning service property to a variable, use the property directly'; public function __construct( private PhpDocResolver $phpDocResolver diff --git a/src/Rules/Convention/ParamNameToTypeConventionRule.php b/src/Rules/Convention/ParamNameToTypeConventionRule.php index 04caf7cd..6432f221 100644 --- a/src/Rules/Convention/ParamNameToTypeConventionRule.php +++ b/src/Rules/Convention/ParamNameToTypeConventionRule.php @@ -20,10 +20,7 @@ */ final class ParamNameToTypeConventionRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Parameter name "$%s" should probably have "%s" type'; + public const string ERROR_MESSAGE = 'Parameter name "$%s" should probably have "%s" type'; /** * @param array $paramNamesToTypes diff --git a/src/Rules/Doctrine/NoDoctrineListenerWithoutContractRule.php b/src/Rules/Doctrine/NoDoctrineListenerWithoutContractRule.php index ea142c8a..1415d50d 100644 --- a/src/Rules/Doctrine/NoDoctrineListenerWithoutContractRule.php +++ b/src/Rules/Doctrine/NoDoctrineListenerWithoutContractRule.php @@ -23,10 +23,7 @@ */ final class NoDoctrineListenerWithoutContractRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'There should be no Doctrine listeners modified in config. Implement "Document\Event\EventSubscriber" to provide events in the class itself'; + public const string ERROR_MESSAGE = 'There should be no Doctrine listeners modified in config. Implement "Document\Event\EventSubscriber" to provide events in the class itself'; public function getNodeType(): string { diff --git a/src/Rules/Doctrine/NoDocumentMockingRule.php b/src/Rules/Doctrine/NoDocumentMockingRule.php index e4b9d928..202d81fe 100644 --- a/src/Rules/Doctrine/NoDocumentMockingRule.php +++ b/src/Rules/Doctrine/NoDocumentMockingRule.php @@ -17,10 +17,7 @@ */ final class NoDocumentMockingRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of document mocking, create object directly to get better type support'; + public const string ERROR_MESSAGE = 'Instead of document mocking, create object directly to get better type support'; public function getNodeType(): string { diff --git a/src/Rules/Doctrine/NoEntityMockingRule.php b/src/Rules/Doctrine/NoEntityMockingRule.php index 2396aa04..207cc61b 100644 --- a/src/Rules/Doctrine/NoEntityMockingRule.php +++ b/src/Rules/Doctrine/NoEntityMockingRule.php @@ -24,10 +24,7 @@ */ final readonly class NoEntityMockingRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of entity or document mocking, create object directly to get better type support'; + public const string ERROR_MESSAGE = 'Instead of entity or document mocking, create object directly to get better type support'; public function __construct( private ReflectionProvider $reflectionProvider diff --git a/src/Rules/Doctrine/NoGetRepositoryOnServiceRepositoryEntityRule.php b/src/Rules/Doctrine/NoGetRepositoryOnServiceRepositoryEntityRule.php index da4ee3c3..31db3bad 100644 --- a/src/Rules/Doctrine/NoGetRepositoryOnServiceRepositoryEntityRule.php +++ b/src/Rules/Doctrine/NoGetRepositoryOnServiceRepositoryEntityRule.php @@ -27,10 +27,7 @@ */ final readonly class NoGetRepositoryOnServiceRepositoryEntityRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of calling "->getRepository(%s::class)" service locator, inject service repository "%s" via constructor and use it directly'; + public const string ERROR_MESSAGE = 'Instead of calling "->getRepository(%s::class)" service locator, inject service repository "%s" via constructor and use it directly'; private RepositoryClassResolver $repositoryClassResolver; diff --git a/src/Rules/Doctrine/NoGetRepositoryOutsideServiceRule.php b/src/Rules/Doctrine/NoGetRepositoryOutsideServiceRule.php index 82564f75..9acb70df 100644 --- a/src/Rules/Doctrine/NoGetRepositoryOutsideServiceRule.php +++ b/src/Rules/Doctrine/NoGetRepositoryOutsideServiceRule.php @@ -22,10 +22,7 @@ */ final class NoGetRepositoryOutsideServiceRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of getting repository from EntityManager, use constructor injection and service pattern to keep code clean'; + public const string ERROR_MESSAGE = 'Instead of getting repository from EntityManager, use constructor injection and service pattern to keep code clean'; public function getNodeType(): string { diff --git a/src/Rules/Doctrine/NoParentRepositoryRule.php b/src/Rules/Doctrine/NoParentRepositoryRule.php index a7b81bc8..03dadcd6 100644 --- a/src/Rules/Doctrine/NoParentRepositoryRule.php +++ b/src/Rules/Doctrine/NoParentRepositoryRule.php @@ -23,10 +23,7 @@ */ final class NoParentRepositoryRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Extending EntityRepository is not allowed, use constructor injection and pass entity manager instead'; + public const string ERROR_MESSAGE = 'Extending EntityRepository is not allowed, use constructor injection and pass entity manager instead'; public function getNodeType(): string { diff --git a/src/Rules/Doctrine/NoRepositoryCallInDataFixtureRule.php b/src/Rules/Doctrine/NoRepositoryCallInDataFixtureRule.php index d2047174..c7a4e5bc 100644 --- a/src/Rules/Doctrine/NoRepositoryCallInDataFixtureRule.php +++ b/src/Rules/Doctrine/NoRepositoryCallInDataFixtureRule.php @@ -22,10 +22,7 @@ */ final class NoRepositoryCallInDataFixtureRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Refactor read-data fixtures to write-only, make use of references'; + public const string ERROR_MESSAGE = 'Refactor read-data fixtures to write-only, make use of references'; public function getNodeType(): string { diff --git a/src/Rules/Doctrine/RequireQueryBuilderOnRepositoryRule.php b/src/Rules/Doctrine/RequireQueryBuilderOnRepositoryRule.php index 2e8d2234..7b2b80ed 100644 --- a/src/Rules/Doctrine/RequireQueryBuilderOnRepositoryRule.php +++ b/src/Rules/Doctrine/RequireQueryBuilderOnRepositoryRule.php @@ -22,10 +22,7 @@ */ final class RequireQueryBuilderOnRepositoryRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Avoid calling ->createQueryBuilder() directly on EntityManager as it requires select() + from() calls with specific values. Use $repository->createQueryBuilder() to be safe instead'; + public const string ERROR_MESSAGE = 'Avoid calling ->createQueryBuilder() directly on EntityManager as it requires select() + from() calls with specific values. Use $repository->createQueryBuilder() to be safe instead'; public function getNodeType(): string { diff --git a/src/Rules/Doctrine/RequireServiceRepositoryParentRule.php b/src/Rules/Doctrine/RequireServiceRepositoryParentRule.php index 070fea8a..11ef0105 100644 --- a/src/Rules/Doctrine/RequireServiceRepositoryParentRule.php +++ b/src/Rules/Doctrine/RequireServiceRepositoryParentRule.php @@ -21,10 +21,7 @@ */ final class RequireServiceRepositoryParentRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Repository must extend "%s", "%s" or implement "%s", so it can be injected as a service'; + public const string ERROR_MESSAGE = 'Repository must extend "%s", "%s" or implement "%s", so it can be injected as a service'; public function getNodeType(): string { diff --git a/src/Rules/Domain/RequireAttributeNamespaceRule.php b/src/Rules/Domain/RequireAttributeNamespaceRule.php index 5a2646e0..5d033323 100644 --- a/src/Rules/Domain/RequireAttributeNamespaceRule.php +++ b/src/Rules/Domain/RequireAttributeNamespaceRule.php @@ -17,10 +17,7 @@ */ final class RequireAttributeNamespaceRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Attribute must be located in "Attribute" namespace'; + public const string ERROR_MESSAGE = 'Attribute must be located in "Attribute" namespace'; /** * @return class-string diff --git a/src/Rules/Domain/RequireExceptionNamespaceRule.php b/src/Rules/Domain/RequireExceptionNamespaceRule.php index f4720de3..ab67d9f6 100644 --- a/src/Rules/Domain/RequireExceptionNamespaceRule.php +++ b/src/Rules/Domain/RequireExceptionNamespaceRule.php @@ -17,10 +17,7 @@ */ final class RequireExceptionNamespaceRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Exception must be located in "Exception" namespace'; + public const string ERROR_MESSAGE = 'Exception must be located in "Exception" namespace'; public function getNodeType(): string { diff --git a/src/Rules/Enum/RequireUniqueEnumConstantRule.php b/src/Rules/Enum/RequireUniqueEnumConstantRule.php index e5432218..32495a79 100644 --- a/src/Rules/Enum/RequireUniqueEnumConstantRule.php +++ b/src/Rules/Enum/RequireUniqueEnumConstantRule.php @@ -20,10 +20,7 @@ */ final readonly class RequireUniqueEnumConstantRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Enum constants "%s" are duplicated. Make them unique instead'; + public const string ERROR_MESSAGE = 'Enum constants "%s" are duplicated. Make them unique instead'; public function __construct( private EnumAnalyzer $enumAnalyzer diff --git a/src/Rules/Explicit/ExplicitClassPrefixSuffixRule.php b/src/Rules/Explicit/ExplicitClassPrefixSuffixRule.php index c1be7eaf..c2b5574d 100644 --- a/src/Rules/Explicit/ExplicitClassPrefixSuffixRule.php +++ b/src/Rules/Explicit/ExplicitClassPrefixSuffixRule.php @@ -25,21 +25,18 @@ final class ExplicitClassPrefixSuffixRule implements Rule { /** * @api - * @var string */ - public const INTERFACE_ERROR_MESSAGE = 'Interface must be suffixed with "Interface" exclusively'; + public const string INTERFACE_ERROR_MESSAGE = 'Interface must be suffixed with "Interface" exclusively'; /** * @api - * @var string */ - public const TRAIT_ERROR_MESSAGE = 'Trait must be suffixed by "Trait" exclusively'; + public const string TRAIT_ERROR_MESSAGE = 'Trait must be suffixed by "Trait" exclusively'; /** * @api - * @var string */ - public const ABSTRACT_ERROR_MESSAGE = 'Abstract class must be prefixed by "Abstract" exclusively'; + public const string ABSTRACT_ERROR_MESSAGE = 'Abstract class must be prefixed by "Abstract" exclusively'; public function getNodeType(): string { diff --git a/src/Rules/Explicit/NoMissingVariableDimFetchRule.php b/src/Rules/Explicit/NoMissingVariableDimFetchRule.php index 3af6f801..5b92e98c 100644 --- a/src/Rules/Explicit/NoMissingVariableDimFetchRule.php +++ b/src/Rules/Explicit/NoMissingVariableDimFetchRule.php @@ -21,9 +21,8 @@ final class NoMissingVariableDimFetchRule implements Rule { /** * @api - * @var string */ - public const ERROR_MESSAGE = 'Dim fetch assign variable is missing, create it first'; + public const string ERROR_MESSAGE = 'Dim fetch assign variable is missing, create it first'; public function getNodeType(): string { diff --git a/src/Rules/Explicit/NoProtectedClassStmtRule.php b/src/Rules/Explicit/NoProtectedClassStmtRule.php index 53282f01..d094e784 100644 --- a/src/Rules/Explicit/NoProtectedClassStmtRule.php +++ b/src/Rules/Explicit/NoProtectedClassStmtRule.php @@ -25,10 +25,7 @@ */ final class NoProtectedClassStmtRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Avoid protected class stmts as they yield unexpected behavior. Use clear interface contract instead'; + public const string ERROR_MESSAGE = 'Avoid protected class stmts as they yield unexpected behavior. Use clear interface contract instead'; public function getNodeType(): string { diff --git a/src/Rules/ForbiddenExtendOfNonAbstractClassRule.php b/src/Rules/ForbiddenExtendOfNonAbstractClassRule.php index e808d13f..9ad513ef 100644 --- a/src/Rules/ForbiddenExtendOfNonAbstractClassRule.php +++ b/src/Rules/ForbiddenExtendOfNonAbstractClassRule.php @@ -18,10 +18,7 @@ */ final class ForbiddenExtendOfNonAbstractClassRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Only abstract classes can be extended'; + public const string ERROR_MESSAGE = 'Only abstract classes can be extended'; /** * @return class-string diff --git a/src/Rules/ForbiddenFuncCallRule.php b/src/Rules/ForbiddenFuncCallRule.php index ca552b48..1a405b3e 100644 --- a/src/Rules/ForbiddenFuncCallRule.php +++ b/src/Rules/ForbiddenFuncCallRule.php @@ -24,10 +24,7 @@ */ final readonly class ForbiddenFuncCallRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Function "%s()" cannot be used/left in the code'; + public const string ERROR_MESSAGE = 'Function "%s()" cannot be used/left in the code'; /** * @param array $forbiddenFunctions diff --git a/src/Rules/ForbiddenMultipleClassLikeInOneFileRule.php b/src/Rules/ForbiddenMultipleClassLikeInOneFileRule.php index 1473b411..83ba5e64 100644 --- a/src/Rules/ForbiddenMultipleClassLikeInOneFileRule.php +++ b/src/Rules/ForbiddenMultipleClassLikeInOneFileRule.php @@ -20,10 +20,7 @@ */ final readonly class ForbiddenMultipleClassLikeInOneFileRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Multiple class/interface/trait is not allowed in single file'; + public const string ERROR_MESSAGE = 'Multiple class/interface/trait is not allowed in single file'; private NodeFinder $nodeFinder; diff --git a/src/Rules/ForbiddenNodeRule.php b/src/Rules/ForbiddenNodeRule.php index c6004574..11ed1fae 100644 --- a/src/Rules/ForbiddenNodeRule.php +++ b/src/Rules/ForbiddenNodeRule.php @@ -20,10 +20,7 @@ */ final class ForbiddenNodeRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = '"%s" is forbidden to use'; + public const string ERROR_MESSAGE = '"%s" is forbidden to use'; /** * @var array> diff --git a/src/Rules/ForbiddenStaticClassConstFetchRule.php b/src/Rules/ForbiddenStaticClassConstFetchRule.php index ede0bf82..005d855c 100644 --- a/src/Rules/ForbiddenStaticClassConstFetchRule.php +++ b/src/Rules/ForbiddenStaticClassConstFetchRule.php @@ -18,10 +18,7 @@ */ final class ForbiddenStaticClassConstFetchRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Avoid static access of constants, as they can change value. Use interface and contract method instead'; + public const string ERROR_MESSAGE = 'Avoid static access of constants, as they can change value. Use interface and contract method instead'; public function getNodeType(): string { diff --git a/src/Rules/MaximumIgnoredErrorCountRule.php b/src/Rules/MaximumIgnoredErrorCountRule.php index 41429111..3d28bc57 100644 --- a/src/Rules/MaximumIgnoredErrorCountRule.php +++ b/src/Rules/MaximumIgnoredErrorCountRule.php @@ -17,10 +17,7 @@ */ final readonly class MaximumIgnoredErrorCountRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = "Ignored error count %d in phpstan.neon surpassed maximum limit %d.\nInstead of ignoring more errors, fix them to keep your codebase fit."; + public const string ERROR_MESSAGE = "Ignored error count %d in phpstan.neon surpassed maximum limit %d.\nInstead of ignoring more errors, fix them to keep your codebase fit."; private NeonAdapter $neonAdapter; diff --git a/src/Rules/NoDynamicNameRule.php b/src/Rules/NoDynamicNameRule.php index eb707ea8..910d521b 100644 --- a/src/Rules/NoDynamicNameRule.php +++ b/src/Rules/NoDynamicNameRule.php @@ -26,10 +26,7 @@ */ final readonly class NoDynamicNameRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Use explicit names over dynamic ones'; + public const string ERROR_MESSAGE = 'Use explicit names over dynamic ones'; public function __construct( private CallableTypeAnalyzer $callableTypeAnalyzer, diff --git a/src/Rules/NoEntityOutsideEntityNamespaceRule.php b/src/Rules/NoEntityOutsideEntityNamespaceRule.php index 797df7cf..040d8a0b 100644 --- a/src/Rules/NoEntityOutsideEntityNamespaceRule.php +++ b/src/Rules/NoEntityOutsideEntityNamespaceRule.php @@ -17,10 +17,7 @@ */ final class NoEntityOutsideEntityNamespaceRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Class with #[Entity] attribute must be located in "Entity" namespace to be loaded by Doctrine'; + public const string ERROR_MESSAGE = 'Class with #[Entity] attribute must be located in "Entity" namespace to be loaded by Doctrine'; public function getNodeType(): string { diff --git a/src/Rules/NoGlobalConstRule.php b/src/Rules/NoGlobalConstRule.php index ee211d04..bab69340 100644 --- a/src/Rules/NoGlobalConstRule.php +++ b/src/Rules/NoGlobalConstRule.php @@ -18,10 +18,7 @@ */ final class NoGlobalConstRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Global constants are forbidden. Use enum-like class list instead'; + public const string ERROR_MESSAGE = 'Global constants are forbidden. Use enum-like class list instead'; public function getNodeType(): string { diff --git a/src/Rules/NoMissnamedDocTagRule.php b/src/Rules/NoMissnamedDocTagRule.php index 5d30ed9b..0fb0be02 100644 --- a/src/Rules/NoMissnamedDocTagRule.php +++ b/src/Rules/NoMissnamedDocTagRule.php @@ -23,17 +23,17 @@ final class NoMissnamedDocTagRule implements Rule /** * @api used in tests */ - public const CONSTANT_ERROR_MESSAGE = 'Constant doc comment tag must be @var, "%s" given'; + public const string CONSTANT_ERROR_MESSAGE = 'Constant doc comment tag must be @var, "%s" given'; /** * @api used in tests */ - public const PROPERTY_ERROR_MESSAGE = 'Property doc comment tag must be @var, "%s" given'; + public const string PROPERTY_ERROR_MESSAGE = 'Property doc comment tag must be @var, "%s" given'; /** * @api used in tests */ - public const METHOD_ERROR_MESSAGE = 'Method doc comment tag must be @param or @return, "%s" given'; + public const string METHOD_ERROR_MESSAGE = 'Method doc comment tag must be @param or @return, "%s" given'; public function getNodeType(): string { diff --git a/src/Rules/NoReferenceRule.php b/src/Rules/NoReferenceRule.php index 21d69fd6..63f9d42a 100644 --- a/src/Rules/NoReferenceRule.php +++ b/src/Rules/NoReferenceRule.php @@ -28,10 +28,7 @@ */ final readonly class NoReferenceRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Use explicit return value over magic &reference'; + public const string ERROR_MESSAGE = 'Use explicit return value over magic &reference'; public function __construct( private ParentClassMethodNodeResolver $parentClassMethodNodeResolver, diff --git a/src/Rules/NoReturnSetterMethodRule.php b/src/Rules/NoReturnSetterMethodRule.php index 8defbbf3..374a78a4 100644 --- a/src/Rules/NoReturnSetterMethodRule.php +++ b/src/Rules/NoReturnSetterMethodRule.php @@ -23,16 +23,12 @@ */ final readonly class NoReturnSetterMethodRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Setter method cannot return anything, only set value'; + public const string ERROR_MESSAGE = 'Setter method cannot return anything, only set value'; /** - * @var string * @see https://regex101.com/r/IIvg8L/1 */ - private const SETTER_START_REGEX = '#^set[A-Z]#'; + private const string SETTER_START_REGEX = '#^set[A-Z]#'; public function __construct( private TypeAwareNodeFinder $typeAwareNodeFinder diff --git a/src/Rules/PHPUnit/NoAssertFuncCallInTestsRule.php b/src/Rules/PHPUnit/NoAssertFuncCallInTestsRule.php index ce1ea386..7b6cb4f8 100644 --- a/src/Rules/PHPUnit/NoAssertFuncCallInTestsRule.php +++ b/src/Rules/PHPUnit/NoAssertFuncCallInTestsRule.php @@ -16,12 +16,9 @@ */ final class NoAssertFuncCallInTestsRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of assert() that can miss important checks, use native PHPUnit assert call'; + public const string ERROR_MESSAGE = 'Instead of assert() that can miss important checks, use native PHPUnit assert call'; - private const TEST_FILE_SUFFIXES = [ + private const array TEST_FILE_SUFFIXES = [ 'Test.php', 'TestCase.php', 'Context.php', diff --git a/src/Rules/PHPUnit/NoDoubleConsecutiveTestMockRule.php b/src/Rules/PHPUnit/NoDoubleConsecutiveTestMockRule.php index ebaca0da..5dedcb0d 100644 --- a/src/Rules/PHPUnit/NoDoubleConsecutiveTestMockRule.php +++ b/src/Rules/PHPUnit/NoDoubleConsecutiveTestMockRule.php @@ -19,10 +19,7 @@ */ final class NoDoubleConsecutiveTestMockRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Do not use "willReturnOnConsecutiveCalls()" and "willReturnCallback()" on the same mock. Use "willReturnCallback() only instead to make test more clear.'; + public const string ERROR_MESSAGE = 'Do not use "willReturnOnConsecutiveCalls()" and "willReturnCallback()" on the same mock. Use "willReturnCallback() only instead to make test more clear.'; public function getNodeType(): string { diff --git a/src/Rules/PHPUnit/NoMockObjectAndRealObjectPropertyRule.php b/src/Rules/PHPUnit/NoMockObjectAndRealObjectPropertyRule.php index b76fb426..d322f007 100644 --- a/src/Rules/PHPUnit/NoMockObjectAndRealObjectPropertyRule.php +++ b/src/Rules/PHPUnit/NoMockObjectAndRealObjectPropertyRule.php @@ -21,10 +21,7 @@ */ final class NoMockObjectAndRealObjectPropertyRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of ambiguous mock + object mix, pick single type that is more relevant'; + public const string ERROR_MESSAGE = 'Instead of ambiguous mock + object mix, pick single type that is more relevant'; public function getNodeType(): string { diff --git a/src/Rules/PHPUnit/NoMockOnlyTestRule.php b/src/Rules/PHPUnit/NoMockOnlyTestRule.php index 3d1c960c..0385a2d1 100644 --- a/src/Rules/PHPUnit/NoMockOnlyTestRule.php +++ b/src/Rules/PHPUnit/NoMockOnlyTestRule.php @@ -23,10 +23,7 @@ */ final readonly class NoMockOnlyTestRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Test should have at least one non-mocked property, to test something'; + public const string ERROR_MESSAGE = 'Test should have at least one non-mocked property, to test something'; public function getNodeType(): string { diff --git a/src/Rules/PHPUnit/NoTestMocksRule.php b/src/Rules/PHPUnit/NoTestMocksRule.php index 5542f57e..06254403 100644 --- a/src/Rules/PHPUnit/NoTestMocksRule.php +++ b/src/Rules/PHPUnit/NoTestMocksRule.php @@ -20,14 +20,13 @@ { /** * @api - * @var string */ - public const ERROR_MESSAGE = 'Mocking "%s" class is forbidden. Use direct/anonymous class instead for better static analysis'; + public const string ERROR_MESSAGE = 'Mocking "%s" class is forbidden. Use direct/anonymous class instead for better static analysis'; /** * @var string[] */ - private const MOCKING_METHOD_NAMES = ['createMock', 'createPartialMock', 'createConfiguredMock', 'createStub']; + private const array MOCKING_METHOD_NAMES = ['createMock', 'createPartialMock', 'createConfiguredMock', 'createStub']; /** * @param string[] $allowedTypes diff --git a/src/Rules/PHPUnit/PublicStaticDataProviderRule.php b/src/Rules/PHPUnit/PublicStaticDataProviderRule.php index 5ced6eb6..e155ebb1 100644 --- a/src/Rules/PHPUnit/PublicStaticDataProviderRule.php +++ b/src/Rules/PHPUnit/PublicStaticDataProviderRule.php @@ -23,15 +23,13 @@ final class PublicStaticDataProviderRule implements Rule { /** * @api used in test - * @var string */ - public const PUBLIC_ERROR_MESSAGE = 'PHPUnit data provider method "%s" must be public'; + public const string PUBLIC_ERROR_MESSAGE = 'PHPUnit data provider method "%s" must be public'; /** * @api used in test - * @var string */ - public const STATIC_ERROR_MESSAGE = 'PHPUnit data provider method "%s" must be static'; + public const string STATIC_ERROR_MESSAGE = 'PHPUnit data provider method "%s" must be static'; public function getNodeType(): string { diff --git a/src/Rules/PreferredClassRule.php b/src/Rules/PreferredClassRule.php index 63b93866..3b865469 100644 --- a/src/Rules/PreferredClassRule.php +++ b/src/Rules/PreferredClassRule.php @@ -26,10 +26,7 @@ */ final readonly class PreferredClassRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of "%s" class/interface use "%s"'; + public const string ERROR_MESSAGE = 'Instead of "%s" class/interface use "%s"'; /** * @param string[] $oldToPreferredClasses diff --git a/src/Rules/PreventParentMethodVisibilityOverrideRule.php b/src/Rules/PreventParentMethodVisibilityOverrideRule.php index 673e886a..be44b963 100644 --- a/src/Rules/PreventParentMethodVisibilityOverrideRule.php +++ b/src/Rules/PreventParentMethodVisibilityOverrideRule.php @@ -20,10 +20,7 @@ */ final readonly class PreventParentMethodVisibilityOverrideRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Change "%s()" method visibility to "%s" to respect parent method visibility.'; + public const string ERROR_MESSAGE = 'Change "%s()" method visibility to "%s" to respect parent method visibility.'; public function __construct( private ReflectionProvider $reflectionProvider diff --git a/src/Rules/Rector/AvoidFeatureSetAttributeInRectorRule.php b/src/Rules/Rector/AvoidFeatureSetAttributeInRectorRule.php index 627f6088..26be7b34 100644 --- a/src/Rules/Rector/AvoidFeatureSetAttributeInRectorRule.php +++ b/src/Rules/Rector/AvoidFeatureSetAttributeInRectorRule.php @@ -24,15 +24,12 @@ */ final class AvoidFeatureSetAttributeInRectorRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of using Rector rule to setAttribute("%s") to be used later, create a service extending "DecoratingNodeVisitorInterface". This ensures attribute decoration and node changes are in 2 separated steps.'; + public const string ERROR_MESSAGE = 'Instead of using Rector rule to setAttribute("%s") to be used later, create a service extending "DecoratingNodeVisitorInterface". This ensures attribute decoration and node changes are in 2 separated steps.'; /** * @var string[] */ - private const ALLOWED_ATTRIBUTES = [ + private const array ALLOWED_ATTRIBUTES = [ // php-parser keys 'kind', 'origNode', 'comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos', 'rawValue', 'docLabel', // rector internal keys, designed to be changed and used by printer diff --git a/src/Rules/Rector/NoClassReflectionStaticReflectionRule.php b/src/Rules/Rector/NoClassReflectionStaticReflectionRule.php index a908b6bc..41782cc2 100644 --- a/src/Rules/Rector/NoClassReflectionStaticReflectionRule.php +++ b/src/Rules/Rector/NoClassReflectionStaticReflectionRule.php @@ -21,10 +21,7 @@ */ final class NoClassReflectionStaticReflectionRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of "new ClassReflection()" use ReflectionProvider service or "(new PHPStan\Reflection\ClassReflection())" for static reflection to work'; + public const string ERROR_MESSAGE = 'Instead of "new ClassReflection()" use ReflectionProvider service or "(new PHPStan\Reflection\ClassReflection())" for static reflection to work'; public function getNodeType(): string { diff --git a/src/Rules/Rector/NoInstanceOfStaticReflectionRule.php b/src/Rules/Rector/NoInstanceOfStaticReflectionRule.php index 56f1fa85..7f06c546 100644 --- a/src/Rules/Rector/NoInstanceOfStaticReflectionRule.php +++ b/src/Rules/Rector/NoInstanceOfStaticReflectionRule.php @@ -27,10 +27,7 @@ */ final class NoInstanceOfStaticReflectionRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of "instanceof/is_a()" use ReflectionProvider service or "(new ObjectType())->isSuperTypeOf()" for static reflection to work'; + public const string ERROR_MESSAGE = 'Instead of "instanceof/is_a()" use ReflectionProvider service or "(new ObjectType())->isSuperTypeOf()" for static reflection to work'; public function getNodeType(): string { diff --git a/src/Rules/Rector/NoIntegerRefactorReturnRule.php b/src/Rules/Rector/NoIntegerRefactorReturnRule.php index b2dca6b3..9b44d88c 100644 --- a/src/Rules/Rector/NoIntegerRefactorReturnRule.php +++ b/src/Rules/Rector/NoIntegerRefactorReturnRule.php @@ -26,10 +26,7 @@ */ final class NoIntegerRefactorReturnRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of using DONT_TRAVERSE_CHILDREN* or STOP_TRAVERSAL in refactor() method, make use of attributes. Return always node, null or REMOVE_NODE. Using traverser enums might lead to unexpected results'; + public const string ERROR_MESSAGE = 'Instead of using DONT_TRAVERSE_CHILDREN* or STOP_TRAVERSAL in refactor() method, make use of attributes. Return always node, null or REMOVE_NODE. Using traverser enums might lead to unexpected results'; public function getNodeType(): string { diff --git a/src/Rules/Rector/NoLeadingBackslashInNameRule.php b/src/Rules/Rector/NoLeadingBackslashInNameRule.php index 49010b2e..c8e65327 100644 --- a/src/Rules/Rector/NoLeadingBackslashInNameRule.php +++ b/src/Rules/Rector/NoLeadingBackslashInNameRule.php @@ -22,10 +22,7 @@ */ final class NoLeadingBackslashInNameRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of "new Name(\'\\\\Foo\')" use "new FullyQualified(\'Foo\')"'; + public const string ERROR_MESSAGE = 'Instead of "new Name(\'\\\\Foo\')" use "new FullyQualified(\'Foo\')"'; public function getNodeType(): string { diff --git a/src/Rules/Rector/NoOnlyNullReturnInRefactorRule.php b/src/Rules/Rector/NoOnlyNullReturnInRefactorRule.php index 867bcd80..572ef4d5 100644 --- a/src/Rules/Rector/NoOnlyNullReturnInRefactorRule.php +++ b/src/Rules/Rector/NoOnlyNullReturnInRefactorRule.php @@ -24,10 +24,7 @@ */ final class NoOnlyNullReturnInRefactorRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'The refactor() method returns always null, but it should return at least one modified node'; + public const string ERROR_MESSAGE = 'The refactor() method returns always null, but it should return at least one modified node'; public function getNodeType(): string { diff --git a/src/Rules/Rector/NoPropertyNodeAssignRule.php b/src/Rules/Rector/NoPropertyNodeAssignRule.php index dce3cf26..edb62126 100644 --- a/src/Rules/Rector/NoPropertyNodeAssignRule.php +++ b/src/Rules/Rector/NoPropertyNodeAssignRule.php @@ -22,10 +22,7 @@ */ final class NoPropertyNodeAssignRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Avoid assigning a node to property to avoid object juggling, pass it as argument instead'; + public const string ERROR_MESSAGE = 'Avoid assigning a node to property to avoid object juggling, pass it as argument instead'; public function getNodeType(): string { diff --git a/src/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule.php b/src/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule.php index 051c95c6..a36c91fe 100644 --- a/src/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule.php +++ b/src/Rules/Rector/PhpUpgradeDowngradeRegisteredInSetRule.php @@ -26,16 +26,12 @@ */ final class PhpUpgradeDowngradeRegisteredInSetRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Register "%s" service to "%s" config set'; + public const string ERROR_MESSAGE = 'Register "%s" service to "%s" config set'; /** - * @var string * @see https://regex101.com/r/VGmFKR/1 */ - private const DOWNGRADE_PREFIX_REGEX = '#(?Downgrade)?Php(?\d+)#'; + private const string DOWNGRADE_PREFIX_REGEX = '#(?Downgrade)?Php(?\d+)#'; public function getNodeType(): string { @@ -79,7 +75,7 @@ private function resolveRelatedConfigFilePath(string $className): ?string $constantName = 'PHP_' . $match['version']; if ($match['is_downgrade']) { - $resolvedValue = constant(DowngradeSetList::class . '::' . $constantName); + $resolvedValue = DowngradeSetList::{$constantName}; if (! is_string($resolvedValue)) { throw new ShouldNotHappenException(); } @@ -87,7 +83,7 @@ private function resolveRelatedConfigFilePath(string $className): ?string return $resolvedValue; } - $resolvedValue = constant(SetList::class . '::' . $constantName); + $resolvedValue = SetList::{$constantName}; if (! is_string($resolvedValue)) { throw new ShouldNotHappenException(); } diff --git a/src/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule.php b/src/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule.php index 565f088f..8eda4d45 100644 --- a/src/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule.php +++ b/src/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule.php @@ -21,16 +21,12 @@ */ final class PhpUpgradeImplementsMinPhpVersionInterfaceRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Rule %s must implements Rector\VersionBonding\Contract\MinPhpVersionInterface'; + public const string ERROR_MESSAGE = 'Rule %s must implements Rector\VersionBonding\Contract\MinPhpVersionInterface'; /** - * @var string * @see https://regex101.com/r/9d3jGP/2/ */ - private const PREFIX_REGEX = '#\\\\Php\d+\\\\#'; + private const string PREFIX_REGEX = '#\\\\Php\d+\\\\#'; public function getNodeType(): string { diff --git a/src/Rules/Rector/PreferDirectIsNameRule.php b/src/Rules/Rector/PreferDirectIsNameRule.php index f5dbeda7..6f3b9b22 100644 --- a/src/Rules/Rector/PreferDirectIsNameRule.php +++ b/src/Rules/Rector/PreferDirectIsNameRule.php @@ -21,10 +21,7 @@ */ final class PreferDirectIsNameRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Use direct $this->isName() instead of fetching NodeNameResolver service'; + public const string ERROR_MESSAGE = 'Use direct $this->isName() instead of fetching NodeNameResolver service'; public function getNodeType(): string { diff --git a/src/Rules/RequireAttributeNameRule.php b/src/Rules/RequireAttributeNameRule.php index c9cf139a..20e42ca6 100644 --- a/src/Rules/RequireAttributeNameRule.php +++ b/src/Rules/RequireAttributeNameRule.php @@ -19,10 +19,7 @@ */ final class RequireAttributeNameRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Attribute must have all names explicitly defined'; + public const string ERROR_MESSAGE = 'Attribute must have all names explicitly defined'; public function getNodeType(): string { diff --git a/src/Rules/SeeAnnotationToTestRule.php b/src/Rules/SeeAnnotationToTestRule.php index 68926958..414d2d4c 100644 --- a/src/Rules/SeeAnnotationToTestRule.php +++ b/src/Rules/SeeAnnotationToTestRule.php @@ -26,10 +26,7 @@ */ final readonly class SeeAnnotationToTestRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Class "%s" is missing @see annotation with test case class reference'; + public const string ERROR_MESSAGE = 'Class "%s" is missing @see annotation with test case class reference'; /** * @param string[] $requiredSeeTypes diff --git a/src/Rules/StringFileAbsolutePathExistsRule.php b/src/Rules/StringFileAbsolutePathExistsRule.php index 078e38b9..3e90c747 100644 --- a/src/Rules/StringFileAbsolutePathExistsRule.php +++ b/src/Rules/StringFileAbsolutePathExistsRule.php @@ -19,15 +19,12 @@ */ final class StringFileAbsolutePathExistsRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'File "%s" could not be found. Make sure it exists'; + public const string ERROR_MESSAGE = 'File "%s" could not be found. Make sure it exists'; /** * @var string[] */ - private const SUFFIXES_TO_CHECK = [ + private const array SUFFIXES_TO_CHECK = [ '.sql', '.php', '.yml', diff --git a/src/Rules/Symfony/ConfigClosure/AlreadyRegisteredAutodiscoveryServiceRule.php b/src/Rules/Symfony/ConfigClosure/AlreadyRegisteredAutodiscoveryServiceRule.php index 8345c0f5..884003ce 100644 --- a/src/Rules/Symfony/ConfigClosure/AlreadyRegisteredAutodiscoveryServiceRule.php +++ b/src/Rules/Symfony/ConfigClosure/AlreadyRegisteredAutodiscoveryServiceRule.php @@ -24,10 +24,7 @@ */ final readonly class AlreadyRegisteredAutodiscoveryServiceRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'The "%s" service is already registered via autodiscovery ->load(), no need to set it twice'; + public const string ERROR_MESSAGE = 'The "%s" service is already registered via autodiscovery ->load(), no need to set it twice'; public function __construct( private ReflectionProvider $reflectionProvider diff --git a/src/Rules/Symfony/ConfigClosure/FileNameMatchesExtensionRule.php b/src/Rules/Symfony/ConfigClosure/FileNameMatchesExtensionRule.php index 839dda73..4a8fedd6 100644 --- a/src/Rules/Symfony/ConfigClosure/FileNameMatchesExtensionRule.php +++ b/src/Rules/Symfony/ConfigClosure/FileNameMatchesExtensionRule.php @@ -24,10 +24,7 @@ */ final class FileNameMatchesExtensionRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'The config uses "%s" extension, but the file name is "%s". Sync them to ease discovery'; + public const string ERROR_MESSAGE = 'The config uses "%s" extension, but the file name is "%s". Sync them to ease discovery'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/ConfigClosure/NoBundleResourceConfigRule.php b/src/Rules/Symfony/ConfigClosure/NoBundleResourceConfigRule.php index 9d377a03..5ad385a8 100644 --- a/src/Rules/Symfony/ConfigClosure/NoBundleResourceConfigRule.php +++ b/src/Rules/Symfony/ConfigClosure/NoBundleResourceConfigRule.php @@ -18,10 +18,7 @@ */ final class NoBundleResourceConfigRule implements Rule { - /** - * @var string - */ - private const ERROR_MESSAGE = 'Avoid using configs in Bundle/Resources directory. Move them to "/config" directory instead'; + private const string ERROR_MESSAGE = 'Avoid using configs in Bundle/Resources directory. Move them to "/config" directory instead'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/ConfigClosure/NoDuplicateArgAutowireByTypeRule.php b/src/Rules/Symfony/ConfigClosure/NoDuplicateArgAutowireByTypeRule.php index 4a8f0a1b..1d4a02f2 100644 --- a/src/Rules/Symfony/ConfigClosure/NoDuplicateArgAutowireByTypeRule.php +++ b/src/Rules/Symfony/ConfigClosure/NoDuplicateArgAutowireByTypeRule.php @@ -34,17 +34,14 @@ */ final readonly class NoDuplicateArgAutowireByTypeRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of passing "%s" to arg(), remove the line and let autowiring handle it'; + public const string ERROR_MESSAGE = 'Instead of passing "%s" to arg(), remove the line and let autowiring handle it'; /** * @todo possible extract to an own rule, include more common Symfony services * * @var string[] */ - private const NAMED_AUTOWIRED_TYPES = ['request_stack']; + private const array NAMED_AUTOWIRED_TYPES = ['request_stack']; public function __construct( private ClassConstructorTypesResolver $classConstructorTypesResolver, diff --git a/src/Rules/Symfony/ConfigClosure/NoDuplicateArgsAutowireByTypeRule.php b/src/Rules/Symfony/ConfigClosure/NoDuplicateArgsAutowireByTypeRule.php index 41ddc478..72f42f3c 100644 --- a/src/Rules/Symfony/ConfigClosure/NoDuplicateArgsAutowireByTypeRule.php +++ b/src/Rules/Symfony/ConfigClosure/NoDuplicateArgsAutowireByTypeRule.php @@ -34,10 +34,7 @@ */ final readonly class NoDuplicateArgsAutowireByTypeRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of passing "%s" to args(), remove the line and let autowiring handle it'; + public const string ERROR_MESSAGE = 'Instead of passing "%s" to args(), remove the line and let autowiring handle it'; public function __construct( private ClassConstructorTypesResolver $classConstructorTypesResolver, diff --git a/src/Rules/Symfony/ConfigClosure/NoServiceSameNameSetClassRule.php b/src/Rules/Symfony/ConfigClosure/NoServiceSameNameSetClassRule.php index ea0a7b99..e211be17 100644 --- a/src/Rules/Symfony/ConfigClosure/NoServiceSameNameSetClassRule.php +++ b/src/Rules/Symfony/ConfigClosure/NoServiceSameNameSetClassRule.php @@ -25,10 +25,7 @@ */ final readonly class NoServiceSameNameSetClassRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'No need to duplicate service class and name. Use only "$services->set(%s::class)" instead'; + public const string ERROR_MESSAGE = 'No need to duplicate service class and name. Use only "$services->set(%s::class)" instead'; private NodeFinder $nodeFinder; diff --git a/src/Rules/Symfony/ConfigClosure/NoSetClassServiceDuplicationRule.php b/src/Rules/Symfony/ConfigClosure/NoSetClassServiceDuplicationRule.php index ee006888..46e29578 100644 --- a/src/Rules/Symfony/ConfigClosure/NoSetClassServiceDuplicationRule.php +++ b/src/Rules/Symfony/ConfigClosure/NoSetClassServiceDuplicationRule.php @@ -20,10 +20,7 @@ */ final readonly class NoSetClassServiceDuplicationRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of "$services->set(%s)->class(%s)" that brings no value, use simple $services->set(%s)'; + public const string ERROR_MESSAGE = 'Instead of "$services->set(%s)->class(%s)" that brings no value, use simple $services->set(%s)'; private Standard $standard; diff --git a/src/Rules/Symfony/ConfigClosure/PreferAutowireAttributeOverConfigParamRule.php b/src/Rules/Symfony/ConfigClosure/PreferAutowireAttributeOverConfigParamRule.php index ff6d4d50..ba657799 100644 --- a/src/Rules/Symfony/ConfigClosure/PreferAutowireAttributeOverConfigParamRule.php +++ b/src/Rules/Symfony/ConfigClosure/PreferAutowireAttributeOverConfigParamRule.php @@ -31,9 +31,8 @@ { /** * @api used in tests - * @var string */ - public const ERROR_MESSAGE = 'Instead of parameter reference in config, add #[Autowire(param: ...)] in the "%s" class constructor'; + public const string ERROR_MESSAGE = 'Instead of parameter reference in config, add #[Autowire(param: ...)] in the "%s" class constructor'; private NodeFinder $nodeFinder; diff --git a/src/Rules/Symfony/ConfigClosure/ServicesExcludedDirectoryMustExistRule.php b/src/Rules/Symfony/ConfigClosure/ServicesExcludedDirectoryMustExistRule.php index dba9179b..b42bb898 100644 --- a/src/Rules/Symfony/ConfigClosure/ServicesExcludedDirectoryMustExistRule.php +++ b/src/Rules/Symfony/ConfigClosure/ServicesExcludedDirectoryMustExistRule.php @@ -27,10 +27,7 @@ */ final class ServicesExcludedDirectoryMustExistRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Services excluded path "%s" does not exists. You can remove it'; + public const string ERROR_MESSAGE = 'Services excluded path "%s" does not exists. You can remove it'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/ConfigClosure/TaggedIteratorOverRepeatedServiceCallRule.php b/src/Rules/Symfony/ConfigClosure/TaggedIteratorOverRepeatedServiceCallRule.php index 44956c43..5a38dd2e 100644 --- a/src/Rules/Symfony/ConfigClosure/TaggedIteratorOverRepeatedServiceCallRule.php +++ b/src/Rules/Symfony/ConfigClosure/TaggedIteratorOverRepeatedServiceCallRule.php @@ -22,15 +22,9 @@ */ final class TaggedIteratorOverRepeatedServiceCallRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of repeated "->call(%s, ...)" calls, pass services as tagged iterator argument to the constructor'; + public const string ERROR_MESSAGE = 'Instead of repeated "->call(%s, ...)" calls, pass services as tagged iterator argument to the constructor'; - /** - * @var string - */ - private const RULE_IDENTIFIER = 'symfony.taggedIteratorOverRepeatedServiceCall'; + private const string RULE_IDENTIFIER = 'symfony.taggedIteratorOverRepeatedServiceCall'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/FormTypeClassNameRule.php b/src/Rules/Symfony/FormTypeClassNameRule.php index aeccb2a2..657b167a 100644 --- a/src/Rules/Symfony/FormTypeClassNameRule.php +++ b/src/Rules/Symfony/FormTypeClassNameRule.php @@ -22,10 +22,7 @@ */ final class FormTypeClassNameRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Class extends "%s" must have "FormType" suffix to make form explicit, "%s" given'; + public const string ERROR_MESSAGE = 'Class extends "%s" must have "FormType" suffix to make form explicit, "%s" given'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoAbstractControllerConstructorRule.php b/src/Rules/Symfony/NoAbstractControllerConstructorRule.php index 220437e8..9228931e 100644 --- a/src/Rules/Symfony/NoAbstractControllerConstructorRule.php +++ b/src/Rules/Symfony/NoAbstractControllerConstructorRule.php @@ -22,10 +22,7 @@ */ final class NoAbstractControllerConstructorRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Abstract controller should not have constructor, to avoid override by child classes. Use #[Require] or @require and autowire() method instead'; + public const string ERROR_MESSAGE = 'Abstract controller should not have constructor, to avoid override by child classes. Use #[Require] or @require and autowire() method instead'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoBareAndSecurityIsGrantedContentsRule.php b/src/Rules/Symfony/NoBareAndSecurityIsGrantedContentsRule.php index 2ae98756..8f4c5428 100644 --- a/src/Rules/Symfony/NoBareAndSecurityIsGrantedContentsRule.php +++ b/src/Rules/Symfony/NoBareAndSecurityIsGrantedContentsRule.php @@ -21,7 +21,7 @@ */ final class NoBareAndSecurityIsGrantedContentsRule implements Rule { - public const ERROR_MESSAGE = 'Instead of using one long "and" condition join, split into multiple standalone #[IsGranted] attributes'; + public const string ERROR_MESSAGE = 'Instead of using one long "and" condition join, split into multiple standalone #[IsGranted] attributes'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoClassLevelRouteRule.php b/src/Rules/Symfony/NoClassLevelRouteRule.php index 247ef031..6d61603f 100644 --- a/src/Rules/Symfony/NoClassLevelRouteRule.php +++ b/src/Rules/Symfony/NoClassLevelRouteRule.php @@ -20,10 +20,7 @@ */ final class NoClassLevelRouteRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Avoid class-level route prefixing. Use method route to keep single source of truth and focus'; + public const string ERROR_MESSAGE = 'Avoid class-level route prefixing. Use method route to keep single source of truth and focus'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoConstructorAndRequiredTogetherRule.php b/src/Rules/Symfony/NoConstructorAndRequiredTogetherRule.php index 6de18073..070b33b8 100644 --- a/src/Rules/Symfony/NoConstructorAndRequiredTogetherRule.php +++ b/src/Rules/Symfony/NoConstructorAndRequiredTogetherRule.php @@ -21,10 +21,7 @@ */ final class NoConstructorAndRequiredTogetherRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Avoid using __construct() and @required in the same class. Pick one to keep architecture clean'; + public const string ERROR_MESSAGE = 'Avoid using __construct() and @required in the same class. Pick one to keep architecture clean'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoControllerMethodInjectionRule.php b/src/Rules/Symfony/NoControllerMethodInjectionRule.php index 87fcfed5..349b6faf 100644 --- a/src/Rules/Symfony/NoControllerMethodInjectionRule.php +++ b/src/Rules/Symfony/NoControllerMethodInjectionRule.php @@ -21,10 +21,7 @@ */ final class NoControllerMethodInjectionRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of service "%s" action injection, use __construct() and invokable controller with __invoke() to clearly separate services and parameters'; + public const string ERROR_MESSAGE = 'Instead of service "%s" action injection, use __construct() and invokable controller with __invoke() to clearly separate services and parameters'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoFindTaggedServiceIdsCallRule.php b/src/Rules/Symfony/NoFindTaggedServiceIdsCallRule.php index 205bad67..abf9ddb3 100644 --- a/src/Rules/Symfony/NoFindTaggedServiceIdsCallRule.php +++ b/src/Rules/Symfony/NoFindTaggedServiceIdsCallRule.php @@ -18,10 +18,7 @@ */ final class NoFindTaggedServiceIdsCallRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Instead of "$this->findTaggedServiceIds()" use more reliable registerForAutoconfiguration() and tagged iterator attribute. Those work outside any configuration and avoid missed tag errors'; + public const string ERROR_MESSAGE = 'Instead of "$this->findTaggedServiceIds()" use more reliable registerForAutoconfiguration() and tagged iterator attribute. Those work outside any configuration and avoid missed tag errors'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoGetDoctrineInControllerRule.php b/src/Rules/Symfony/NoGetDoctrineInControllerRule.php index 39b9186c..8d8a6b41 100644 --- a/src/Rules/Symfony/NoGetDoctrineInControllerRule.php +++ b/src/Rules/Symfony/NoGetDoctrineInControllerRule.php @@ -18,10 +18,7 @@ */ final class NoGetDoctrineInControllerRule implements Rule { - /** - * @var string - */ - private const ERROR_MESSAGE = 'Do not use $this->getDoctrine() method in controller. Use __construct(EntityManagerInterface $entityManager) instead'; + private const string ERROR_MESSAGE = 'Do not use $this->getDoctrine() method in controller. Use __construct(EntityManagerInterface $entityManager) instead'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoGetInCommandRule.php b/src/Rules/Symfony/NoGetInCommandRule.php index 92bca0a7..85d0e671 100644 --- a/src/Rules/Symfony/NoGetInCommandRule.php +++ b/src/Rules/Symfony/NoGetInCommandRule.php @@ -18,10 +18,7 @@ */ final class NoGetInCommandRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Do not use $this->get(Type::class) method in commands to get services. Use __construct(Type $type) instead'; + public const string ERROR_MESSAGE = 'Do not use $this->get(Type::class) method in commands to get services. Use __construct(Type $type) instead'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoGetInControllerRule.php b/src/Rules/Symfony/NoGetInControllerRule.php index b4a65940..12f20ecc 100644 --- a/src/Rules/Symfony/NoGetInControllerRule.php +++ b/src/Rules/Symfony/NoGetInControllerRule.php @@ -18,10 +18,7 @@ */ final class NoGetInControllerRule implements Rule { - /** - * @var string - */ - private const ERROR_MESSAGE = 'Do not use $this->get(Type::class) method in controller to get services. Use __construct(Type $type) instead'; + private const string ERROR_MESSAGE = 'Do not use $this->get(Type::class) method in controller to get services. Use __construct(Type $type) instead'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoListenerWithoutContractRule.php b/src/Rules/Symfony/NoListenerWithoutContractRule.php index fc9e4c75..bcacf0d1 100644 --- a/src/Rules/Symfony/NoListenerWithoutContractRule.php +++ b/src/Rules/Symfony/NoListenerWithoutContractRule.php @@ -26,10 +26,7 @@ */ final class NoListenerWithoutContractRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'There should be no listeners modified in config. Use EventSubscriberInterface contract or #[AsEventListener] attribute and native PHP instead'; + public const string ERROR_MESSAGE = 'There should be no listeners modified in config. Use EventSubscriberInterface contract or #[AsEventListener] attribute and native PHP instead'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoRequiredOutsideClassRule.php b/src/Rules/Symfony/NoRequiredOutsideClassRule.php index e1ed5534..04422a01 100644 --- a/src/Rules/Symfony/NoRequiredOutsideClassRule.php +++ b/src/Rules/Symfony/NoRequiredOutsideClassRule.php @@ -19,10 +19,7 @@ */ final class NoRequiredOutsideClassRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Symfony #[Require]/@required should be used only in classes to avoid misuse'; + public const string ERROR_MESSAGE = 'Symfony #[Require]/@required should be used only in classes to avoid misuse'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoRouteTrailingSlashPathRule.php b/src/Rules/Symfony/NoRouteTrailingSlashPathRule.php index 01b1a620..f133ad97 100644 --- a/src/Rules/Symfony/NoRouteTrailingSlashPathRule.php +++ b/src/Rules/Symfony/NoRouteTrailingSlashPathRule.php @@ -19,10 +19,7 @@ */ final class NoRouteTrailingSlashPathRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Avoid trailing slash in route path "%s", to prevent redirects and SEO issues'; + public const string ERROR_MESSAGE = 'Avoid trailing slash in route path "%s", to prevent redirects and SEO issues'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoRoutingPrefixRule.php b/src/Rules/Symfony/NoRoutingPrefixRule.php index 12424b9d..d7645f6c 100644 --- a/src/Rules/Symfony/NoRoutingPrefixRule.php +++ b/src/Rules/Symfony/NoRoutingPrefixRule.php @@ -24,10 +24,7 @@ */ final class NoRoutingPrefixRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Avoid global route prefixing, to use single place for paths and improve static analysis'; + public const string ERROR_MESSAGE = 'Avoid global route prefixing, to use single place for paths and improve static analysis'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoServiceAutowireDuplicateRule.php b/src/Rules/Symfony/NoServiceAutowireDuplicateRule.php index 4a71637e..a354545d 100644 --- a/src/Rules/Symfony/NoServiceAutowireDuplicateRule.php +++ b/src/Rules/Symfony/NoServiceAutowireDuplicateRule.php @@ -21,10 +21,7 @@ */ final class NoServiceAutowireDuplicateRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Service autowire() is called as duplicate of $services->defaults()->autowire(). Remove it on the service'; + public const string ERROR_MESSAGE = 'Service autowire() is called as duplicate of $services->defaults()->autowire(). Remove it on the service'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/NoStringInGetSubscribedEventsRule.php b/src/Rules/Symfony/NoStringInGetSubscribedEventsRule.php index 7f2caf95..3ae89678 100644 --- a/src/Rules/Symfony/NoStringInGetSubscribedEventsRule.php +++ b/src/Rules/Symfony/NoStringInGetSubscribedEventsRule.php @@ -22,10 +22,7 @@ */ final class NoStringInGetSubscribedEventsRule implements Rule { - /** - * @var string - */ - private const ERROR_MESSAGE = 'Symfony getSubscribedEvents() method must contain only event class references, no strings'; + private const string ERROR_MESSAGE = 'Symfony getSubscribedEvents() method must contain only event class references, no strings'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/RequireInvokableControllerRule.php b/src/Rules/Symfony/RequireInvokableControllerRule.php index 69872953..32d8427c 100644 --- a/src/Rules/Symfony/RequireInvokableControllerRule.php +++ b/src/Rules/Symfony/RequireInvokableControllerRule.php @@ -19,10 +19,7 @@ */ final class RequireInvokableControllerRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Use invokable controller with __invoke() method instead of named action method'; + public const string ERROR_MESSAGE = 'Use invokable controller with __invoke() method instead of named action method'; /** * @return class-string diff --git a/src/Rules/Symfony/RequireIsGrantedEnumRule.php b/src/Rules/Symfony/RequireIsGrantedEnumRule.php index b0cef0db..0c0cec1a 100644 --- a/src/Rules/Symfony/RequireIsGrantedEnumRule.php +++ b/src/Rules/Symfony/RequireIsGrantedEnumRule.php @@ -21,7 +21,7 @@ */ final class RequireIsGrantedEnumRule implements Rule { - public const ERROR_MESSAGE = 'Instead of "%s" string, use enum constant for #[IsGranted]'; + public const string ERROR_MESSAGE = 'Instead of "%s" string, use enum constant for #[IsGranted]'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/RequireRouteNameToGenerateControllerRouteRule.php b/src/Rules/Symfony/RequireRouteNameToGenerateControllerRouteRule.php index e4964e72..44d2edb8 100644 --- a/src/Rules/Symfony/RequireRouteNameToGenerateControllerRouteRule.php +++ b/src/Rules/Symfony/RequireRouteNameToGenerateControllerRouteRule.php @@ -35,9 +35,8 @@ { /** * @api - * @var string */ - public const ERROR_MESSAGE = 'To pass a controller class to generate() method, the controller must have "#[Route(name: self::class)]" above the __invoke() method'; + public const string ERROR_MESSAGE = 'To pass a controller class to generate() method, the controller must have "#[Route(name: self::class)]" above the __invoke() method'; public function __construct( private ReflectionProvider $reflectionProvider, diff --git a/src/Rules/Symfony/RequiredOnlyInAbstractRule.php b/src/Rules/Symfony/RequiredOnlyInAbstractRule.php index 8375acc6..1fa7c04b 100644 --- a/src/Rules/Symfony/RequiredOnlyInAbstractRule.php +++ b/src/Rules/Symfony/RequiredOnlyInAbstractRule.php @@ -23,10 +23,7 @@ */ final class RequiredOnlyInAbstractRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = '#Symfony @required or #[Required] is reserved exclusively for abstract classes. For the rest of classes, use clean constructor injection'; + public const string ERROR_MESSAGE = '#Symfony @required or #[Required] is reserved exclusively for abstract classes. For the rest of classes, use clean constructor injection'; /** * Magic parent types that require constructor internally, @@ -34,7 +31,7 @@ final class RequiredOnlyInAbstractRule implements Rule * * @var string[] */ - private const SKIPPED_PARENT_TYPES = [ + private const array SKIPPED_PARENT_TYPES = [ DoctrineClass::DOCUMENT_REPOSITORY, ]; diff --git a/src/Rules/Symfony/SingleArgEventDispatchRule.php b/src/Rules/Symfony/SingleArgEventDispatchRule.php index c28dfaa2..e9ef4dfd 100644 --- a/src/Rules/Symfony/SingleArgEventDispatchRule.php +++ b/src/Rules/Symfony/SingleArgEventDispatchRule.php @@ -19,10 +19,7 @@ */ final class SingleArgEventDispatchRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'The event dispatch() method can have only 1 arg - the event object'; + public const string ERROR_MESSAGE = 'The event dispatch() method can have only 1 arg - the event object'; public function getNodeType(): string { diff --git a/src/Rules/Symfony/SingleRequiredMethodRule.php b/src/Rules/Symfony/SingleRequiredMethodRule.php index 3fa32511..b0dac735 100644 --- a/src/Rules/Symfony/SingleRequiredMethodRule.php +++ b/src/Rules/Symfony/SingleRequiredMethodRule.php @@ -16,7 +16,7 @@ */ final class SingleRequiredMethodRule implements Rule { - public const ERROR_MESSAGE = 'Found %d @required methods. Use only one method to avoid unexpected behavior.'; + public const string ERROR_MESSAGE = 'Found %d @required methods. Use only one method to avoid unexpected behavior.'; public function getNodeType(): string { diff --git a/src/Rules/UppercaseConstantRule.php b/src/Rules/UppercaseConstantRule.php index 752d8b2e..4f356457 100644 --- a/src/Rules/UppercaseConstantRule.php +++ b/src/Rules/UppercaseConstantRule.php @@ -18,10 +18,7 @@ */ final class UppercaseConstantRule implements Rule { - /** - * @var string - */ - public const ERROR_MESSAGE = 'Constant "%s" must be uppercase'; + public const string ERROR_MESSAGE = 'Constant "%s" must be uppercase'; public function getNodeType(): string { diff --git a/src/Symfony/NodeAnalyzer/SymfonyControllerAnalyzer.php b/src/Symfony/NodeAnalyzer/SymfonyControllerAnalyzer.php index 6bcdd101..7f04e28b 100644 --- a/src/Symfony/NodeAnalyzer/SymfonyControllerAnalyzer.php +++ b/src/Symfony/NodeAnalyzer/SymfonyControllerAnalyzer.php @@ -16,7 +16,7 @@ final class SymfonyControllerAnalyzer /** * @var string[] */ - private const CONTROLLER_TYPES = [ + private const array CONTROLLER_TYPES = [ SymfonyClass::CONTROLLER, SymfonyClass::ABSTRACT_CONTROLLER, ]; diff --git a/src/Symfony/NodeFinder/RepeatedServiceAdderCallNameFinder.php b/src/Symfony/NodeFinder/RepeatedServiceAdderCallNameFinder.php index ec15551c..ddd7e948 100644 --- a/src/Symfony/NodeFinder/RepeatedServiceAdderCallNameFinder.php +++ b/src/Symfony/NodeFinder/RepeatedServiceAdderCallNameFinder.php @@ -13,9 +13,9 @@ final class RepeatedServiceAdderCallNameFinder { - private const CALL_NAME = 'call'; + private const string CALL_NAME = 'call'; - private const MIN_ALERT_COUNT = 3; + private const int MIN_ALERT_COUNT = 3; public static function find(MethodCall $methodCall): ?string { diff --git a/src/Testing/PHPUnitTestAnalyser.php b/src/Testing/PHPUnitTestAnalyser.php index 91a25e13..da47e704 100644 --- a/src/Testing/PHPUnitTestAnalyser.php +++ b/src/Testing/PHPUnitTestAnalyser.php @@ -10,10 +10,7 @@ final class PHPUnitTestAnalyser { - /** - * @var string - */ - private const TEST_CASE_CLASS = 'PHPUnit\Framework\TestCase'; + private const string TEST_CASE_CLASS = 'PHPUnit\Framework\TestCase'; public static function isTestClass(Scope $scope): bool { diff --git a/src/TypeAnalyzer/RectorAllowedAutoloadedTypeAnalyzer.php b/src/TypeAnalyzer/RectorAllowedAutoloadedTypeAnalyzer.php index 6519607d..e6445c89 100644 --- a/src/TypeAnalyzer/RectorAllowedAutoloadedTypeAnalyzer.php +++ b/src/TypeAnalyzer/RectorAllowedAutoloadedTypeAnalyzer.php @@ -17,14 +17,13 @@ final class RectorAllowedAutoloadedTypeAnalyzer { /** * @see https://regex101.com/r/BBm9bf/1 - * @var string */ - private const AUTOLOADED_CLASS_PREFIX_REGEX = '#^(PhpParser|PHPStan|Rector|Reflection|Symfony\\\\Component\\\\Console)#'; + private const string AUTOLOADED_CLASS_PREFIX_REGEX = '#^(PhpParser|PHPStan|Rector|Reflection|Symfony\\\\Component\\\\Console)#'; /** * @var array */ - private const ALLOWED_CLASSES = [ + private const array ALLOWED_CLASSES = [ Node::class, PhpDocNode::class, ]; diff --git a/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/NodeGetAttributeTypeExtensionTest.php b/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/NodeGetAttributeTypeExtensionTest.php index 8f9c6c8c..255eb338 100644 --- a/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/NodeGetAttributeTypeExtensionTest.php +++ b/tests/ReturnTypeExtension/NodeGetAttributeTypeExtension/NodeGetAttributeTypeExtensionTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\ReturnTypeExtension\NodeGetAttributeTypeExtension; use Iterator; +use Override; use PHPStan\Testing\TypeInferenceTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -30,6 +31,7 @@ public static function dataAsserts(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/type_extension.neon']; diff --git a/tests/Rules/CheckRequiredInterfaceInContractNamespaceRule/CheckRequiredInterfaceInContractNamespaceRuleTest.php b/tests/Rules/CheckRequiredInterfaceInContractNamespaceRule/CheckRequiredInterfaceInContractNamespaceRuleTest.php index 666a76a8..bc480ec6 100644 --- a/tests/Rules/CheckRequiredInterfaceInContractNamespaceRule/CheckRequiredInterfaceInContractNamespaceRuleTest.php +++ b/tests/Rules/CheckRequiredInterfaceInContractNamespaceRule/CheckRequiredInterfaceInContractNamespaceRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\CheckRequiredInterfaceInContractNamespaceRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -36,6 +37,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/ClassNameRespectsParentSuffixRule/ClassNameRespectsParentSuffixRuleTest.php b/tests/Rules/ClassNameRespectsParentSuffixRule/ClassNameRespectsParentSuffixRuleTest.php index 7b6952d1..dd4b3a66 100644 --- a/tests/Rules/ClassNameRespectsParentSuffixRule/ClassNameRespectsParentSuffixRuleTest.php +++ b/tests/Rules/ClassNameRespectsParentSuffixRule/ClassNameRespectsParentSuffixRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\ClassNameRespectsParentSuffixRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -46,6 +47,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Complexity/ForbiddenArrayMethodCallRule/ForbiddenArrayMethodCallRuleTest.php b/tests/Rules/Complexity/ForbiddenArrayMethodCallRule/ForbiddenArrayMethodCallRuleTest.php index bccc909f..a31c1896 100644 --- a/tests/Rules/Complexity/ForbiddenArrayMethodCallRule/ForbiddenArrayMethodCallRuleTest.php +++ b/tests/Rules/Complexity/ForbiddenArrayMethodCallRule/ForbiddenArrayMethodCallRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Complexity\ForbiddenArrayMethodCallRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -33,6 +34,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Complexity/NoJustPropertyAssignRule/NoJustPropertyAssignRuleTest.php b/tests/Rules/Complexity/NoJustPropertyAssignRule/NoJustPropertyAssignRuleTest.php index de82be4a..55d05d0f 100644 --- a/tests/Rules/Complexity/NoJustPropertyAssignRule/NoJustPropertyAssignRuleTest.php +++ b/tests/Rules/Complexity/NoJustPropertyAssignRule/NoJustPropertyAssignRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Complexity\NoJustPropertyAssignRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -40,6 +41,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Convention/ParamNameToTypeConventionRule/ParamNameToTypeConventionRuleTest.php b/tests/Rules/Convention/ParamNameToTypeConventionRule/ParamNameToTypeConventionRuleTest.php index c9c2f00d..1ea54653 100644 --- a/tests/Rules/Convention/ParamNameToTypeConventionRule/ParamNameToTypeConventionRuleTest.php +++ b/tests/Rules/Convention/ParamNameToTypeConventionRule/ParamNameToTypeConventionRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Convention\ParamNameToTypeConventionRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -39,6 +40,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Domain/RequireAttributeNamespaceRule/RequireAttributeNamespaceRuleTest.php b/tests/Rules/Domain/RequireAttributeNamespaceRule/RequireAttributeNamespaceRuleTest.php index fbd9d0cc..ef49954f 100644 --- a/tests/Rules/Domain/RequireAttributeNamespaceRule/RequireAttributeNamespaceRuleTest.php +++ b/tests/Rules/Domain/RequireAttributeNamespaceRule/RequireAttributeNamespaceRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Domain\RequireAttributeNamespaceRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -33,6 +34,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Domain/RequireExceptionNamespaceRule/RequireExceptionNamespaceRuleTest.php b/tests/Rules/Domain/RequireExceptionNamespaceRule/RequireExceptionNamespaceRuleTest.php index 8fc3efa3..690a3aae 100644 --- a/tests/Rules/Domain/RequireExceptionNamespaceRule/RequireExceptionNamespaceRuleTest.php +++ b/tests/Rules/Domain/RequireExceptionNamespaceRule/RequireExceptionNamespaceRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Domain\RequireExceptionNamespaceRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -34,6 +35,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Enum/RequireUniqueEnumConstantRule/RequireUniqueEnumConstantRuleTest.php b/tests/Rules/Enum/RequireUniqueEnumConstantRule/RequireUniqueEnumConstantRuleTest.php index b9adbef3..e36023a1 100644 --- a/tests/Rules/Enum/RequireUniqueEnumConstantRule/RequireUniqueEnumConstantRuleTest.php +++ b/tests/Rules/Enum/RequireUniqueEnumConstantRule/RequireUniqueEnumConstantRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Enum\RequireUniqueEnumConstantRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -36,6 +37,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/ExplicitClassPrefixSuffixRuleTest.php b/tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/ExplicitClassPrefixSuffixRuleTest.php index c1b5b065..42e26722 100644 --- a/tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/ExplicitClassPrefixSuffixRuleTest.php +++ b/tests/Rules/Explicit/ExplicitClassPrefixSuffixRule/ExplicitClassPrefixSuffixRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Explicit\ExplicitClassPrefixSuffixRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -54,6 +55,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Explicit/NoMissingVariableDimFetchRule/NoMissingVariableDimFetchRuleTest.php b/tests/Rules/Explicit/NoMissingVariableDimFetchRule/NoMissingVariableDimFetchRuleTest.php index be52f5c9..2bb45796 100644 --- a/tests/Rules/Explicit/NoMissingVariableDimFetchRule/NoMissingVariableDimFetchRuleTest.php +++ b/tests/Rules/Explicit/NoMissingVariableDimFetchRule/NoMissingVariableDimFetchRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Explicit\NoMissingVariableDimFetchRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -37,6 +38,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/ForbiddenExtendOfNonAbstractClassRule/ForbiddenExtendOfNonAbstractClassRuleTest.php b/tests/Rules/ForbiddenExtendOfNonAbstractClassRule/ForbiddenExtendOfNonAbstractClassRuleTest.php index 200c702e..d20c2af6 100644 --- a/tests/Rules/ForbiddenExtendOfNonAbstractClassRule/ForbiddenExtendOfNonAbstractClassRuleTest.php +++ b/tests/Rules/ForbiddenExtendOfNonAbstractClassRule/ForbiddenExtendOfNonAbstractClassRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\ForbiddenExtendOfNonAbstractClassRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -39,6 +40,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleTest.php b/tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleTest.php index 58f44d46..a3a8b289 100644 --- a/tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleTest.php +++ b/tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\ForbiddenFuncCallRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -41,6 +42,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleWithDeprecationsTest.php b/tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleWithDeprecationsTest.php index 4f60c537..115d06c1 100644 --- a/tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleWithDeprecationsTest.php +++ b/tests/Rules/ForbiddenFuncCallRule/ForbiddenFuncCallRuleWithDeprecationsTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\ForbiddenFuncCallRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -46,6 +47,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule_with_deprecations.neon']; diff --git a/tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/ForbiddenMultipleClassLikeInOneFileRuleTest.php b/tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/ForbiddenMultipleClassLikeInOneFileRuleTest.php index c561dcc7..5e09d6f5 100644 --- a/tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/ForbiddenMultipleClassLikeInOneFileRuleTest.php +++ b/tests/Rules/ForbiddenMultipleClassLikeInOneFileRule/ForbiddenMultipleClassLikeInOneFileRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\ForbiddenMultipleClassLikeInOneFileRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -40,6 +41,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/ForbiddenNodeRule/ForbiddenNodeRuleTest.php b/tests/Rules/ForbiddenNodeRule/ForbiddenNodeRuleTest.php index daf23219..c6f7db42 100644 --- a/tests/Rules/ForbiddenNodeRule/ForbiddenNodeRuleTest.php +++ b/tests/Rules/ForbiddenNodeRule/ForbiddenNodeRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\ForbiddenNodeRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -33,6 +34,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/ForbiddenStaticClassConstFetchRule/ForbiddenStaticClassConstFetchRuleTest.php b/tests/Rules/ForbiddenStaticClassConstFetchRule/ForbiddenStaticClassConstFetchRuleTest.php index 13239d51..7ae4b975 100644 --- a/tests/Rules/ForbiddenStaticClassConstFetchRule/ForbiddenStaticClassConstFetchRuleTest.php +++ b/tests/Rules/ForbiddenStaticClassConstFetchRule/ForbiddenStaticClassConstFetchRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\ForbiddenStaticClassConstFetchRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -35,6 +36,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/NoArrayMapWithArrayCallableRule/NoArrayMapWithArrayCallableRuleTest.php b/tests/Rules/NoArrayMapWithArrayCallableRule/NoArrayMapWithArrayCallableRuleTest.php index 4b0ed5fe..8d0eb9aa 100644 --- a/tests/Rules/NoArrayMapWithArrayCallableRule/NoArrayMapWithArrayCallableRuleTest.php +++ b/tests/Rules/NoArrayMapWithArrayCallableRule/NoArrayMapWithArrayCallableRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\NoArrayMapWithArrayCallableRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -40,6 +41,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/NoDynamicNameRule/NoDynamicNameRuleTest.php b/tests/Rules/NoDynamicNameRule/NoDynamicNameRuleTest.php index b09c2f66..b5d5fbf3 100644 --- a/tests/Rules/NoDynamicNameRule/NoDynamicNameRuleTest.php +++ b/tests/Rules/NoDynamicNameRule/NoDynamicNameRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\NoDynamicNameRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -47,6 +48,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/NoGlobalConstRule/NoGlobalConstRuleTest.php b/tests/Rules/NoGlobalConstRule/NoGlobalConstRuleTest.php index 0ed822dd..60cc6112 100644 --- a/tests/Rules/NoGlobalConstRule/NoGlobalConstRuleTest.php +++ b/tests/Rules/NoGlobalConstRule/NoGlobalConstRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\NoGlobalConstRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -34,6 +35,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/NoMissnamedDocTagRule/NoMissnamedDocTagRuleTest.php b/tests/Rules/NoMissnamedDocTagRule/NoMissnamedDocTagRuleTest.php index d75305dc..d2f5cea3 100644 --- a/tests/Rules/NoMissnamedDocTagRule/NoMissnamedDocTagRuleTest.php +++ b/tests/Rules/NoMissnamedDocTagRule/NoMissnamedDocTagRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\NoMissnamedDocTagRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -45,6 +46,7 @@ public static function provideData(): Iterator /** * @return array */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/NoReferenceRule/NoReferenceRuleTest.php b/tests/Rules/NoReferenceRule/NoReferenceRuleTest.php index 6c7d2aa6..69eb5d29 100644 --- a/tests/Rules/NoReferenceRule/NoReferenceRuleTest.php +++ b/tests/Rules/NoReferenceRule/NoReferenceRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\NoReferenceRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -39,6 +40,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/NoReturnSetterMethodRule/NoReturnSetterMethodRuleTest.php b/tests/Rules/NoReturnSetterMethodRule/NoReturnSetterMethodRuleTest.php index e3b8645f..5321937a 100644 --- a/tests/Rules/NoReturnSetterMethodRule/NoReturnSetterMethodRuleTest.php +++ b/tests/Rules/NoReturnSetterMethodRule/NoReturnSetterMethodRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\NoReturnSetterMethodRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -38,6 +39,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/PHPUnit/NoEntityMockingRule/NoEntityMockingRuleTest.php b/tests/Rules/PHPUnit/NoEntityMockingRule/NoEntityMockingRuleTest.php index 5eec3b7c..20645f72 100644 --- a/tests/Rules/PHPUnit/NoEntityMockingRule/NoEntityMockingRuleTest.php +++ b/tests/Rules/PHPUnit/NoEntityMockingRule/NoEntityMockingRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\PHPUnit\NoEntityMockingRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -36,6 +37,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/PHPUnit/NoTestMocksRule/NoTestMocksRuleTest.php b/tests/Rules/PHPUnit/NoTestMocksRule/NoTestMocksRuleTest.php index 9ef65341..7664a49d 100644 --- a/tests/Rules/PHPUnit/NoTestMocksRule/NoTestMocksRuleTest.php +++ b/tests/Rules/PHPUnit/NoTestMocksRule/NoTestMocksRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\PHPUnit\NoTestMocksRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -37,6 +38,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [ diff --git a/tests/Rules/PreferredClassRule/PreferredClassRuleTest.php b/tests/Rules/PreferredClassRule/PreferredClassRuleTest.php index b3386856..b1ebb999 100644 --- a/tests/Rules/PreferredClassRule/PreferredClassRuleTest.php +++ b/tests/Rules/PreferredClassRule/PreferredClassRuleTest.php @@ -7,6 +7,7 @@ use DateTime as NativeDateTime; use Iterator; use Nette\Utils\DateTime; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -49,6 +50,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/PreventParentMethodVisibilityOverrideRule/PreventParentMethodVisibilityOverrideRuleTest.php b/tests/Rules/PreventParentMethodVisibilityOverrideRule/PreventParentMethodVisibilityOverrideRuleTest.php index 9a55597e..ecd239dd 100644 --- a/tests/Rules/PreventParentMethodVisibilityOverrideRule/PreventParentMethodVisibilityOverrideRuleTest.php +++ b/tests/Rules/PreventParentMethodVisibilityOverrideRule/PreventParentMethodVisibilityOverrideRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\PreventParentMethodVisibilityOverrideRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -33,6 +34,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Rector/NoClassReflectionStaticReflectionRule/NoClassReflectionStaticReflectionRuleTest.php b/tests/Rules/Rector/NoClassReflectionStaticReflectionRule/NoClassReflectionStaticReflectionRuleTest.php index 5e3e6121..1c6e15aa 100644 --- a/tests/Rules/Rector/NoClassReflectionStaticReflectionRule/NoClassReflectionStaticReflectionRuleTest.php +++ b/tests/Rules/Rector/NoClassReflectionStaticReflectionRule/NoClassReflectionStaticReflectionRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Rector\NoClassReflectionStaticReflectionRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -35,6 +36,7 @@ public static function provideData(): Iterator /** * @return array */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/NoInstanceOfStaticReflectionRuleTest.php b/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/NoInstanceOfStaticReflectionRuleTest.php index 5d4ef22f..0bb2cc0e 100644 --- a/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/NoInstanceOfStaticReflectionRuleTest.php +++ b/tests/Rules/Rector/NoInstanceOfStaticReflectionRule/NoInstanceOfStaticReflectionRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Rector\NoInstanceOfStaticReflectionRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -48,6 +49,7 @@ public static function provideData(): Iterator /** * @return array */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Rector/NoLeadingBackslashInNameRule/NoLeadingBackslashInNameRuleTest.php b/tests/Rules/Rector/NoLeadingBackslashInNameRule/NoLeadingBackslashInNameRuleTest.php index a265aed2..2712c8b4 100644 --- a/tests/Rules/Rector/NoLeadingBackslashInNameRule/NoLeadingBackslashInNameRuleTest.php +++ b/tests/Rules/Rector/NoLeadingBackslashInNameRule/NoLeadingBackslashInNameRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Rector\NoLeadingBackslashInNameRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -36,6 +37,7 @@ public static function provideData(): Iterator /** * @return array */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/PhpUpgradeImplementsMinPhpVersionInterfaceRuleTest.php b/tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/PhpUpgradeImplementsMinPhpVersionInterfaceRuleTest.php index ad674e9e..bd68e001 100644 --- a/tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/PhpUpgradeImplementsMinPhpVersionInterfaceRuleTest.php +++ b/tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/PhpUpgradeImplementsMinPhpVersionInterfaceRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Rector\PhpUpgradeImplementsMinPhpVersionInterfaceRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -43,6 +44,7 @@ public static function provideData(): Iterator /** * @return array */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/RequireAttributeNameRule/RequireAttributeNameRuleTest.php b/tests/Rules/RequireAttributeNameRule/RequireAttributeNameRuleTest.php index f766e248..c677b964 100644 --- a/tests/Rules/RequireAttributeNameRule/RequireAttributeNameRuleTest.php +++ b/tests/Rules/RequireAttributeNameRule/RequireAttributeNameRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\RequireAttributeNameRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -36,6 +37,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/SeeAnnotationToTestRule/SeeAnnotationToTestRuleTest.php b/tests/Rules/SeeAnnotationToTestRule/SeeAnnotationToTestRuleTest.php index 5862f012..2b13bc42 100644 --- a/tests/Rules/SeeAnnotationToTestRule/SeeAnnotationToTestRuleTest.php +++ b/tests/Rules/SeeAnnotationToTestRule/SeeAnnotationToTestRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\SeeAnnotationToTestRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -40,6 +41,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Symfony/ConfigClosure/AlreadyRegisteredAutodiscoveryServiceRule/AlreadyRegisteredAutodiscoveryServiceRuleTest.php b/tests/Rules/Symfony/ConfigClosure/AlreadyRegisteredAutodiscoveryServiceRule/AlreadyRegisteredAutodiscoveryServiceRuleTest.php index 760ef5c4..8ba1fcbd 100644 --- a/tests/Rules/Symfony/ConfigClosure/AlreadyRegisteredAutodiscoveryServiceRule/AlreadyRegisteredAutodiscoveryServiceRuleTest.php +++ b/tests/Rules/Symfony/ConfigClosure/AlreadyRegisteredAutodiscoveryServiceRule/AlreadyRegisteredAutodiscoveryServiceRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Symfony\ConfigClosure\AlreadyRegisteredAutodiscoveryServiceRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -39,6 +40,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [ diff --git a/tests/Rules/Symfony/ConfigClosure/NoDuplicateArgAutowireByTypeRule/NoDuplicateArgAutowireByTypeRuleTest.php b/tests/Rules/Symfony/ConfigClosure/NoDuplicateArgAutowireByTypeRule/NoDuplicateArgAutowireByTypeRuleTest.php index bd988b7f..5eb95506 100644 --- a/tests/Rules/Symfony/ConfigClosure/NoDuplicateArgAutowireByTypeRule/NoDuplicateArgAutowireByTypeRuleTest.php +++ b/tests/Rules/Symfony/ConfigClosure/NoDuplicateArgAutowireByTypeRule/NoDuplicateArgAutowireByTypeRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Symfony\ConfigClosure\NoDuplicateArgAutowireByTypeRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -38,6 +39,7 @@ public static function provideData(): Iterator /** * @return array */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Symfony/ConfigClosure/NoDuplicateArgsAutowireByTypeRule/NoDuplicateArgsAutowireByTypeRuleTest.php b/tests/Rules/Symfony/ConfigClosure/NoDuplicateArgsAutowireByTypeRule/NoDuplicateArgsAutowireByTypeRuleTest.php index 6deb60e3..e0ee4801 100644 --- a/tests/Rules/Symfony/ConfigClosure/NoDuplicateArgsAutowireByTypeRule/NoDuplicateArgsAutowireByTypeRuleTest.php +++ b/tests/Rules/Symfony/ConfigClosure/NoDuplicateArgsAutowireByTypeRule/NoDuplicateArgsAutowireByTypeRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Symfony\ConfigClosure\NoDuplicateArgsAutowireByTypeRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -38,6 +39,7 @@ public static function provideData(): Iterator /** * @return array */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Symfony/ConfigClosure/NoServiceSameNameSetClassRule/NoServiceSameNameSetClassRuleTest.php b/tests/Rules/Symfony/ConfigClosure/NoServiceSameNameSetClassRule/NoServiceSameNameSetClassRuleTest.php index 6f6aa192..2ba0cf2a 100644 --- a/tests/Rules/Symfony/ConfigClosure/NoServiceSameNameSetClassRule/NoServiceSameNameSetClassRuleTest.php +++ b/tests/Rules/Symfony/ConfigClosure/NoServiceSameNameSetClassRule/NoServiceSameNameSetClassRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Symfony\ConfigClosure\NoServiceSameNameSetClassRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -40,6 +41,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Symfony/ConfigClosure/PreferAutowireAttributeOverConfigParamRule/PreferAutowireAttributeOverConfigParamRuleTest.php b/tests/Rules/Symfony/ConfigClosure/PreferAutowireAttributeOverConfigParamRule/PreferAutowireAttributeOverConfigParamRuleTest.php index a606ddad..bfd55e7c 100644 --- a/tests/Rules/Symfony/ConfigClosure/PreferAutowireAttributeOverConfigParamRule/PreferAutowireAttributeOverConfigParamRuleTest.php +++ b/tests/Rules/Symfony/ConfigClosure/PreferAutowireAttributeOverConfigParamRule/PreferAutowireAttributeOverConfigParamRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Symfony\ConfigClosure\PreferAutowireAttributeOverConfigParamRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -47,6 +48,7 @@ public static function provideData(): Iterator /** * @return array */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/Symfony/RequireInvokableControllerRule/RequireInvokableControllerRulePhp80Test.php b/tests/Rules/Symfony/RequireInvokableControllerRule/RequireInvokableControllerRulePhp80Test.php index 7ef20201..8a19a49d 100644 --- a/tests/Rules/Symfony/RequireInvokableControllerRule/RequireInvokableControllerRulePhp80Test.php +++ b/tests/Rules/Symfony/RequireInvokableControllerRule/RequireInvokableControllerRulePhp80Test.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\Symfony\RequireInvokableControllerRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -35,6 +36,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon']; diff --git a/tests/Rules/UppercaseConstantRule/UppercaseConstantRuleTest.php b/tests/Rules/UppercaseConstantRule/UppercaseConstantRuleTest.php index e8ad9457..d64dc0c2 100644 --- a/tests/Rules/UppercaseConstantRule/UppercaseConstantRuleTest.php +++ b/tests/Rules/UppercaseConstantRule/UppercaseConstantRuleTest.php @@ -5,6 +5,7 @@ namespace Symplify\PHPStanRules\Tests\Rules\UppercaseConstantRule; use Iterator; +use Override; use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -33,6 +34,7 @@ public static function provideData(): Iterator /** * @return string[] */ + #[Override] public static function getAdditionalConfigFiles(): array { return [__DIR__ . '/config/configured_rule.neon'];