fix bracket mallform in annotations

This commit is contained in:
TomasVotruba 2020-03-27 22:51:44 +01:00
parent 062c323802
commit c00b8d4b75
4 changed files with 8 additions and 6 deletions

View File

@ -53,7 +53,9 @@ abstract class AbstractTagValueNode implements AttributeAwareNodeInterface, PhpD
{
$json = Json::encode($item);
$json = Strings::replace($json, '#,#', ', ');
$json = Strings::replace($json, '#\[(.*?)\]#', '{$1}');
// change brackets from json to annotations
$json = Strings::replace($json, '#^\[(.*?)\]$#', '{$1}');
// cleanup json encoded extra slashes
$json = Strings::replace($json, '#\\\\\\\\#', '\\');

View File

@ -128,9 +128,6 @@ final class SymfonyRouteTagValueNode extends AbstractTagValueNode implements Sho
return $this->printContentItems($contentItems);
}
/**
* @param mixed[] $methods
*/
public function changeMethods(array $methods): void
{
$this->orderedVisibleItems[] = 'methods';

View File

@ -0,0 +1,3 @@
/**
* @Route("/demo/{letter}", requirements={"letter"="[a-z]{1}"})
*/

View File

@ -9,7 +9,7 @@ use Symfony\Component\Routing\Annotation\Route;
class WithRouteOptions extends AbstractController
{
/**
* @Route("/{category}", name="report_overview", defaults={"category":null}, requirements={"category":"\d+"})
* @Route("/{category}", name="report_overview", defaults={"category":null}, requirements={"category":"[a-z]\d+"})
* @Template("PAPPReportBundle:Report:report_list.html.twig")
*/
public function index($category = null)
@ -33,7 +33,7 @@ use Symfony\Component\Routing\Annotation\Route;
class WithRouteOptions extends AbstractController
{
/**
* @Route("/{category}", name="report_overview", defaults={"category":null}, requirements={"category":"\d+"})
* @Route("/{category}", name="report_overview", defaults={"category":null}, requirements={"category":"[a-z]\d+"})
*/
public function index($category = null): \Symfony\Component\HttpFoundation\Response
{