mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 19:53:14 +01:00
add single magic array support for @Method
This commit is contained in:
parent
2e78850f69
commit
7e348b4de1
@ -50,6 +50,15 @@ abstract class AbstractPhpDocInfoTest extends AbstractKernelTestCase
|
||||
*/
|
||||
protected function doTestPrintedPhpDocInfo(string $filePath, string $tagValueNodeType): void
|
||||
{
|
||||
if (! isset(TagValueToPhpParserNodeMap::MAP[$tagValueNodeType])) {
|
||||
throw new ShouldNotHappenException(sprintf(
|
||||
'[tests] Add "%s" to %s::%s constant',
|
||||
$tagValueNodeType,
|
||||
TagValueToPhpParserNodeMap::class,
|
||||
'MAP'
|
||||
));
|
||||
}
|
||||
|
||||
$nodeType = TagValueToPhpParserNodeMap::MAP[$tagValueNodeType];
|
||||
|
||||
$nodeWithPhpDocInfo = $this->parseFileAndGetFirstNodeOfType($filePath, $nodeType);
|
||||
|
@ -16,6 +16,7 @@ use Rector\BetterPhpDocParser\PhpDocNode\Doctrine\Property_\GeneratedValueTagVal
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Doctrine\Property_\JoinTableTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Gedmo\BlameableTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Gedmo\SlugTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Sensio\SensioMethodTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Sensio\SensioTemplateTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Symfony\SymfonyRouteTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Symfony\Validator\Constraints\AssertChoiceTagValueNode;
|
||||
@ -46,5 +47,6 @@ final class TagValueToPhpParserNodeMap
|
||||
GenericTagValueNode::class => Property::class,
|
||||
|
||||
SensioTemplateTagValueNode::class => Class_::class,
|
||||
SensioMethodTagValueNode::class => ClassMethod::class,
|
||||
];
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\BetterPhpDocParser\Tests\PhpDocParser\TagValueNodeReprint\Fixture\SensioMethod;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
|
||||
|
||||
final class SensioMethodSingle
|
||||
{
|
||||
/**
|
||||
* @Method("POST")
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ use Rector\BetterPhpDocParser\PhpDocNode\Doctrine\Property_\GeneratedValueTagVal
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Doctrine\Property_\JoinTableTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Gedmo\BlameableTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Gedmo\SlugTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Sensio\SensioMethodTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Sensio\SensioTemplateTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Symfony\SymfonyRouteTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocNode\Symfony\Validator\Constraints\AssertChoiceTagValueNode;
|
||||
@ -63,6 +64,7 @@ final class TagValueNodeReprintTest extends AbstractPhpDocInfoTest
|
||||
GenericTagValueNode::class => __DIR__ . '/Fixture/ConstantReference',
|
||||
|
||||
SensioTemplateTagValueNode::class => __DIR__ . '/Fixture/SensioTemplate',
|
||||
SensioMethodTagValueNode::class => __DIR__ . '/Fixture/SensioMethod',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user