Closed
Description
I sometimes see route definitions like the following where a requirement for a variable is no real regex but static text:
export:
path: /export.{_format}
defaults: { _controller: "Acme:Action:export" }
requirements:
_format: csv
This is equivalent to
export:
path: /export.csv
defaults: { _controller: "Acme:Action:export", _format: csv }
It can be optimized at compile time and would safe subpattern or even a complete regex match as in this case because the path is static now.
I already know how to implement this. This is just a reminder for me. ^^
Use if (preg_quote($requirement) === $requirement)
for detection.