Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/downgraded_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
-
uses: "shivammathur/setup-php@v2"
with:
php-version: 8.2
php-version: 8.3
coverage: none

# invoke patches
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/DoctrineEntityDocumentAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
17 changes: 4 additions & 13 deletions src/Doctrine/RepositoryClassResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,16 @@

final readonly class RepositoryClassResolver
{
/**
* @var string
*/
private const QUOTED_REPOSITORY_CLASS_REGEX = '#repositoryClass=\"(?<repositoryClass>.*?)\"#';
private const string QUOTED_REPOSITORY_CLASS_REGEX = '#repositoryClass=\"(?<repositoryClass>.*?)\"#';

/**
* @var string
*/
private const REPOSITORY_CLASS_CONST_REGEX = '#repositoryClass=?(\\\\)(?<repositoryClass>.*?)::class#';
private const string REPOSITORY_CLASS_CONST_REGEX = '#repositoryClass=?(\\\\)(?<repositoryClass>.*?)::class#';

/**
* @var string
*/
private const USE_REPOSITORY_REGEX = '#use (?<repositoryClass>.*?Repository);#';
private const string USE_REPOSITORY_REGEX = '#use (?<repositoryClass>.*?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,
Expand Down
40 changes: 11 additions & 29 deletions src/Enum/ClassName.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
47 changes: 13 additions & 34 deletions src/Enum/DoctrineClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
4 changes: 2 additions & 2 deletions src/Enum/DoctrineEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down
20 changes: 4 additions & 16 deletions src/Enum/MethodName.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
76 changes: 38 additions & 38 deletions src/Enum/RuleIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
16 changes: 8 additions & 8 deletions src/Enum/RuleIdentifier/DoctrineRuleIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
12 changes: 6 additions & 6 deletions src/Enum/RuleIdentifier/PHPUnitRuleIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Loading