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
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace Rector\Symfony\Tests\CodeQuality\Rector\Class_\ControllerMethodInjectionToConstructorRector\Fixture;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Uid\UuidV4;

final class SkipSymfonyUuidV4 extends AbstractController
{
public function someAction(UuidV4 $uuid)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ public function refactor(Node $node): ?Node
SymfonyClass::USER_INTERFACE,
SymfonyClass::REQUEST,
FosClass::PARAM_FETCHER,
SymfonyClass::UUID,
Throwable::class,
Exception::class,
...$entityClasses,
Expand All @@ -166,7 +165,11 @@ public function refactor(Node $node): ?Node

if ($this->nodeTypeResolver->isObjectTypes(
$param->type,
[new ObjectType(SymfonyClass::USER_INTERFACE), new ObjectType('DateTimeInterface')]
[
new ObjectType(SymfonyClass::USER_INTERFACE),
new ObjectType('DateTimeInterface'),
new ObjectType(SymfonyClass::UUID),
]
)) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Enum/SymfonyClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ final class SymfonyClass

public const string ACCESS_DECISION_MANAGER_INTERFACE = 'Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface';

public const string UUID = 'Symfony\Component\Uid\Uuid';
public const string UUID = 'Symfony\Component\Uid\AbstractUid';

public const string ROUTE_COLLECTION_BUILDER = 'Symfony\Component\Routing\RouteCollectionBuilder';

Expand Down
13 changes: 13 additions & 0 deletions stubs/Symfony/Component/Uid/AbstractUid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\Uid;

if (class_exists('Symfony\Component\Uid\AbstractUid')) {
return;
}

abstract class AbstractUid
{
}
13 changes: 13 additions & 0 deletions stubs/Symfony/Component/Uid/Uuid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\Uid;

if (class_exists('Symfony\Component\Uid\Uuid')) {
return;
}

class Uuid extends AbstractUid
{
}
13 changes: 13 additions & 0 deletions stubs/Symfony/Component/Uid/UuidV4.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\Uid;

if (class_exists('Symfony\Component\Uid\UuidV4')) {
return;
}

class UuidV4 extends Uuid
{
}