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
20 changes: 18 additions & 2 deletions .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,33 @@ jobs:
name: 'Active Classes'
run: vendor/bin/class-leak check config src rules --skip-suffix "Rector"

-
name: 'Tests'
run: vendor/bin/phpunit

-
name: 'Finalise classes'
run: vendor/bin/swiss-knife finalize-classes src rules tests

-
name: 'Composer Validate'
run: composer validate

-
name: 'PHPStan'
run: vendor/bin/phpstan

name: ${{ matrix.actions.name }}
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 5

steps:
- uses: actions/checkout@v4

-
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
coverage: none

- uses: "ramsey/composer-install@v2"
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/code_analysis_reusable.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/rector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
-
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
coverage: none

- uses: "ramsey/composer-install@v2"
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/tests.yaml

This file was deleted.

5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"description": "Rector upgrades rules for Doctrine",
"require": {
"php": ">=8.2",
"php": ">=8.3",
"symfony/yaml": "^7.4|8.0.*"
},
"require-dev": {
Expand All @@ -16,8 +16,9 @@
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpunit/phpunit": "^11.5|^12.0",
"rector/jack": "^0.4.0",
"rector/jack": "^0.5.0",
"rector/rector-src": "dev-main",
"rector/swiss-knife": "^2.3",
"rector/type-perfect": "^2.1",
"symplify/phpstan-extensions": "^12.0",
"symplify/phpstan-rules": "^14.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

namespace Rector\Doctrine\Tests\CodeQuality\Rector\Property\TypedPropertyFromToOneRelationTypeRector\Source;

class Company
final class Company
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

namespace Rector\Doctrine\Tests\Dbal40\Rector\StmtsAwareInterface\ExecuteQueryParamsToBindValueRector\Source;

class Statement
final class Statement
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

namespace Rector\Doctrine\Tests\DoctrineFixture\Rector\MethodCall\AddGetReferenceTypeRector\Source;

class SomePassedEntity
final class SomePassedEntity
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

namespace Rector\Doctrine\Tests\TypedCollections\Rector\ClassMethod\CollectionDocblockGenericTypeRector\Source;

class RandomHouse
final class RandomHouse
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

namespace Rector\Doctrine\Tests\TypedCollections\Rector\ClassMethod\NarrowParamUnionToCollectionRector\Source;

class AnyEntity
final class AnyEntity
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Rector\Doctrine\Tests\TypedCollections\Rector\Class_\CompletePropertyDocblockFromToManyRector\Source\ValueObject;

class DoctrineType
final class DoctrineType
{
public const INTEGER = 'integer';
public const STRING = 'string';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Rector\Doctrine\Tests\TypedCollections\Rector\If_\RemoveIfInstanceofCollectionRector\Source;

class SomeInstance
final class SomeInstance
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

namespace Rector\Doctrine\Tests\TypedCollections\Rector\MethodCall\SetArrayToNewCollectionRector\Source;

class ItemType
final class ItemType
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Rector\Doctrine\Tests\TypedCollections\Rector\Property\NarrowPropertyUnionToCollectionRector\Source;

class SomeIterableObject
final class SomeIterableObject
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@

final class EntityClassAttributeTransformer implements ClassAttributeTransformerInterface
{
/**
* @var string
*/
private const REPOSITORY_CLASS_KEY = 'repositoryClass';
private const string REPOSITORY_CLASS_KEY = 'repositoryClass';

public function transform(EntityMapping $entityMapping, Class_ $class): bool
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@

final readonly class TableClassAttributeTransformer implements ClassAttributeTransformerInterface
{
/**
* @var string
*/
private const TABLE_KEY = 'table';
private const string TABLE_KEY = 'table';

public function __construct(
private NodeFactory $nodeFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/3.0/reference/basic-mapping.html#identifier-generation-strategies
* @var string[]
*/
private const AVAILABLE_STRATEGIES = ['auto', 'sequence', 'identity', 'none', 'custom'];
private const array AVAILABLE_STRATEGIES = ['auto', 'sequence', 'identity', 'none', 'custom'];

public function __construct(
// private ArrayItemNodeFactory $arrayItemNodeFactory
Expand Down
4 changes: 2 additions & 2 deletions rules/CodeQuality/Enum/CollectionMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class CollectionMapping
/**
* @var string[]
*/
public const TO_MANY_CLASSES = [
public const array TO_MANY_CLASSES = [
MappingClass::ONE_TO_MANY,
MappingClass::MANY_TO_MANY,
OdmMappingClass::REFERENCE_MANY,
Expand All @@ -22,7 +22,7 @@ final class CollectionMapping
/**
* @var string[]
*/
public const TO_ONE_CLASSES = [
public const array TO_ONE_CLASSES = [
MappingClass::MANY_TO_ONE,
MappingClass::ONE_TO_ONE,
OdmMappingClass::REFERENCE_ONE,
Expand Down
2 changes: 1 addition & 1 deletion rules/CodeQuality/Enum/DoctrineClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
/**
* @deprecated BC only
*/
public const COLLECTION = \Rector\Doctrine\Enum\DoctrineClass::COLLECTION;
public const string COLLECTION = \Rector\Doctrine\Enum\DoctrineClass::COLLECTION;
}
5 changes: 1 addition & 4 deletions rules/CodeQuality/Enum/DocumentMappingKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@
*/
final class DocumentMappingKey
{
/**
* @var string
*/
public const TARGET_DOCUMENT = 'targetDocument';
public const string TARGET_DOCUMENT = 'targetDocument';
}
54 changes: 15 additions & 39 deletions rules/CodeQuality/Enum/EntityMappingKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,19 @@
*/
final class EntityMappingKey
{
/**
* @var string
*/
public const NULLABLE = 'nullable';

/**
* @var string
*/
public const COLUMN_PREFIX = 'columnPrefix';

/**
* @var string
*/
public const COLUMN = 'column';

/**
* @var string
*/
public const STRATEGY = 'strategy';

/**
* @var string
*/
public const GENERATOR = 'generator';

/**
* @var string
*/
public const ORDER_BY = 'orderBy';

/**
* @var string
*/
public const NAME = 'name';

/**
* @var string
*/
public const TARGET_ENTITY = 'targetEntity';
public const string NULLABLE = 'nullable';

public const string COLUMN_PREFIX = 'columnPrefix';

public const string COLUMN = 'column';

public const string STRATEGY = 'strategy';

public const string GENERATOR = 'generator';

public const string ORDER_BY = 'orderBy';

public const string NAME = 'name';

public const string TARGET_ENTITY = 'targetEntity';
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
*/
final class GetRepositoryServiceLocatorToRepositoryServiceInjectionRector extends AbstractRector
{
/**
* @var string
*/
private const GET_REPOSITORY_METHOD = 'getRepository';
private const string GET_REPOSITORY_METHOD = 'getRepository';

public function __construct(
private readonly ValueResolver $valueResolver,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
final class TypedPropertyFromToOneRelationTypeRector extends AbstractRector implements MinPhpVersionInterface, ConfigurableRectorInterface
{
public const FORCE_NULLABLE = 'force_nullable';
public const string FORCE_NULLABLE = 'force_nullable';

private bool $forceNullable = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class MigrateQueryBuilderResetQueryPartRector extends AbstractRector
/**
* @var array<string, string>
*/
private const PART_TO_METHOD_MAP = [
private const array PART_TO_METHOD_MAP = [
'where' => 'resetWhere',
'groupBy' => 'resetGroupBy',
'having' => 'resetHaving',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class ReplaceLifecycleEventArgsByDedicatedEventArgsRector extends Abstract
/**
* @var array<string, EventClass::*>
*/
private const EVENT_CLASSES = [
private const array EVENT_CLASSES = [
'prePersist' => EventClass::PRE_PERSIST_EVENT_ARGS,
'preUpdate' => EventClass::PRE_UPDATE_EVENT_ARGS,
'preRemove' => EventClass::PRE_REMOVE_EVENT_ARGS,
Expand Down
Loading