Closed as not planned
Description
Description
I'm trying to avoid strings as Route name
, so I've created a Page
class that holds const
s for it:
abstract class Page
{
public const HOME = 'SomeUselessStringThatNobodyNeeds';
}
Controller:
#[Route(path: '/', name: Page::HOME)]
I think this would be a perfect use-case for a pure enum:
enum Page
{
case Home;
}
Controller:
#[Route(path: '/', name: Page::Home)]
Right now, this leads to:
Symfony\Component\Routing\Annotation\Route::__construct(): Argument # 2 ($name) must be of type ?string, App\Enum\Page given
Example
No response