-
Notifications
You must be signed in to change notification settings - Fork 454
Description
Currently, the FastRoute class uses strings to indicate custom or override classes, then uses that string with a new call to create the override object. This means that the custom or override class cannot use an alternative constructor, which in turn limits additional or alternative functionality.
Allowing for the custom or override class to be specified as a string or callable, means that a callable can be invoked to return a fully-constructed object. This would let consumers add custom functionality to the custom or override class via a custom constructor. Cf. the as-yet-released CastRouteCollector which adds to the constructor parameters.
You could go further with this, and delegate object construction to a PSR-11 ContainerInterface, but that adds a dependency, and might over-complicate setup work.