Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Routing][3.0] change constant values of UrlGeneratorInterface #14672

Closed
@Tobion

Description

@Tobion

Currently the UrlGeneratorInterface has @param bool|string $referenceType The type of reference to be generated (one of the constants). So a type bool|string for historic BC reasons which is bad especially considering possible future scalar type hints.

So we should change the values of the constants (probably to int) in symfony 3.0. In PHP code, people should be using the constants for calling code anyway. And for twig, there are helpers (url and path which both have a relative boolean parameter. So they are not influenced. The main change would be for PHP templates using the RouterHelper. Currently even the symfony documentation doesn't use constants (which would suck in templates), but the real values: http://symfony.com/doc/current/book/templating.html#linking-to-pages

So if we keep PHP templates in symfony (ref. #12897), we should IMO also deprecate the generate method of the helper and instead add path and url methods to the helper. This way php templates would be closer to twig equivalents and people would not be forced into using constants (or meaningless numeric values) in templates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions