Skip to content

Allow to use backed enumerations as route name - #296

Open
KalimeroMK wants to merge 1 commit into
yiisoft:masterfrom
KalimeroMK:enum-route-name
Open

Allow to use backed enumerations as route name#296
KalimeroMK wants to merge 1 commit into
yiisoft:masterfrom
KalimeroMK:enum-route-name

Conversation

@KalimeroMK

@KalimeroMK KalimeroMK commented Sep 4, 2026

Copy link
Copy Markdown

Fixes #280.

Route::name() now accepts a backed enumeration in addition to a string. The enumeration is resolved to its backing value immediately, so route names are still stored and returned as strings.

Route is final and name() is not part of any interface, so there are no interface changes, no BC baseline entries and no yiisoft/router-implementation bump.

Widening the route name in RouteCollectionInterface and UrlGeneratorInterface is deliberately left out: it is not BC for classes implementing them and needs a coordinated dummy-provider + router-fastroute + router release. Discussed in #280.

RouteCollection.php is the only unrelated change — Rector rewrites that line on every run, and applying it keeps rector-cs from committing it.

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (cedd84c) to head (a4f1d95).

Files with missing lines Patch % Lines
src/Route.php 0.00% 2 Missing ⚠️
src/RouteCollection.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             master    #296   +/-   ##
========================================
  Coverage      0.00%   0.00%           
  Complexity      129     129           
========================================
  Files            13      13           
  Lines           400     399    -1     
========================================
+ Misses          400     399    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@KalimeroMK
KalimeroMK force-pushed the enum-route-name branch 2 times, most recently from 0d30772 to 002f5ac Compare September 4, 2026 15:06
@samdark samdark added the severity:BC breaking Breaks backwards compatibility label Sep 4, 2026
`Route::name()` now accepts a backed enumeration in addition to a string.
The enumeration is resolved to its backing value immediately, so route names
are still stored and returned as strings.

`Route` is final and `name()` is not part of any interface, so this needs no
backward-compatibility baseline entry and no bump of the
"yiisoft/router-implementation" version.

The change in `RouteCollection.php` is unrelated: Rector rewrites that line
on every run, and applying it keeps the "rector-cs" job from committing it.
@samdark

samdark commented Sep 5, 2026

Copy link
Copy Markdown
Member

https://github.com/yiisoft/router-fastroute should be adjusted and released along with this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

severity:BC breaking Breaks backwards compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to use backed enumerations as route name

3 participants