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,14 @@
<?php

declare(strict_types=1);

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

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

final class SkipParamFetcher extends AbstractController
{
public function someAction(\FOS\RestBundle\Request\ParamFetcher $paramFetcher)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Rector\Rector\AbstractRector;
use Rector\StaticTypeMapper\StaticTypeMapper;
use Rector\Symfony\Bridge\NodeAnalyzer\ControllerMethodAnalyzer;
use Rector\Symfony\Enum\FosClass;
use Rector\Symfony\Enum\SensioAttribute;
use Rector\Symfony\Enum\SymfonyClass;
use Rector\Symfony\TypeAnalyzer\ControllerAnalyzer;
Expand Down Expand Up @@ -127,7 +128,7 @@ public function refactor(Node $node): ?Node
}

// request is allowed
if ($this->isName($param->type, SymfonyClass::REQUEST)) {
if ($this->isNames($param->type, [SymfonyClass::REQUEST, FosClass::PARAM_FETCHER])) {
continue;
}

Expand Down
13 changes: 13 additions & 0 deletions src/Enum/FosClass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Rector\Symfony\Enum;

final class FosClass
{
/**
* @var string
*/
public const PARAM_FETCHER = 'FOS\RestBundle\Request\ParamFetcher';
}