mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-25 20:23:49 +01:00
Merge pull request #1129 from rectorphp/nts-route-fix
[NetteToSymfony] Fix new route for already present annotation above method
This commit is contained in:
commit
a77d4618f1
@ -3,18 +3,23 @@
|
||||
namespace Rector\NetteToSymfony\Annotation;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use Symplify\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use Symplify\BetterPhpDocParser\Attributes\Contract\Ast\AttributeAwareNodeInterface;
|
||||
|
||||
final class RouteTagValueNode implements PhpDocChildNode
|
||||
final class SymfonyRoutePhpDocTagNode extends PhpDocTagNode implements PhpDocChildNode, AttributeAwareNodeInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $path;
|
||||
use AttributeTrait;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $name;
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* @var string
|
@ -9,7 +9,7 @@ use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\NetteToSymfony\Annotation\RouteTagValueNode;
|
||||
use Rector\NetteToSymfony\Annotation\SymfonyRoutePhpDocTagNode;
|
||||
use Rector\NetteToSymfony\Route\RouteInfo;
|
||||
use Rector\NetteToSymfony\Route\RouteInfoFactory;
|
||||
use Rector\NodeTypeResolver\Application\ClassLikeNodeCollector;
|
||||
@ -192,7 +192,7 @@ CODE_SAMPLE
|
||||
continue;
|
||||
}
|
||||
|
||||
$phpDocTagNode = new RouteTagValueNode(
|
||||
$phpDocTagNode = new SymfonyRoutePhpDocTagNode(
|
||||
$this->routeAnnotationClass,
|
||||
$routeInfo->getPath(),
|
||||
null,
|
||||
@ -283,7 +283,7 @@ CODE_SAMPLE
|
||||
|
||||
/** @var ClassMethod $classStmt */
|
||||
$path = $this->resolvePathFromClassAndMethodNodes($presenterClass, $classStmt);
|
||||
$phpDocTagNode = new RouteTagValueNode($this->routeAnnotationClass, $path);
|
||||
$phpDocTagNode = new SymfonyRoutePhpDocTagNode($this->routeAnnotationClass, $path);
|
||||
|
||||
$this->docBlockAnalyzer->addTag($classStmt, $phpDocTagNode);
|
||||
}
|
||||
|
@ -19,6 +19,9 @@ final class WithParameterRouterFactory
|
||||
|
||||
final class WithParameterSomePresenter
|
||||
{
|
||||
/**
|
||||
* @todo
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
}
|
||||
@ -46,6 +49,7 @@ final class WithParameterRouterFactory
|
||||
final class WithParameterSomePresenter
|
||||
{
|
||||
/**
|
||||
* @todo
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="some-path/{id}")
|
||||
*/
|
||||
public function run()
|
||||
|
@ -128,3 +128,5 @@ parameters:
|
||||
- '#Parameter \#2 \$constFetch of method Rector\\CodeQuality\\Rector\\Identical\\SimplifyArraySearchRector\:\:resolveIsNot\(\) expects PhpParser\\Node\\Expr\\ConstFetch, PhpParser\\Node given#'
|
||||
- '#Parameter \#1 \$binaryOp of method Rector\\CodeQuality\\Rector\\Identical\\SimplifyConditionsRector\:\:createInversedBooleanOp\(\) expects PhpParser\\Node\\Expr\\BinaryOp, PhpParser\\Node given#'
|
||||
- '#Parameter \#2 \$classMethod of method Rector\\NetteToSymfony\\Rector\\ClassMethod\\RouterListToControllerAnnotationsRector\:\:resolvePathFromClassAndMethodNodes\(\) expects PhpParser\\Node\\Stmt\\ClassMethod, PhpParser\\Node\\Stmt given#'
|
||||
|
||||
- '#Rector\\NetteToSymfony\\Annotation\\SymfonyRoutePhpDocTagNode\:\:__construct\(\) does not call parent constructor from PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode#'
|
||||
|
Loading…
x
Reference in New Issue
Block a user