I have this controller annotation :
/**
* @Route("/", name="list", defaults={"_format": "html", "tag": ""})
*/
I want to convert it to PHP 8 attributes. But how to pass the associative array of the defaults
parameter? This works:
#[Route("/", name: "list", defaults: [])]
But this isn't:
#[Route("/", name: "list", defaults: ["_format": "html", "tag": ""])]
How should I do?
OK, found the answer while writing the question, that was quite obvious. We have to use the PHP standard syntax:
#[Route("/", name: "list", defaults: ["_format" => "html", "tag" => ""])]