Skip to content

Fix #193: Add public constructors for routes and groups - #295

Open
samdark wants to merge 8 commits into
masterfrom
route-group-constructors
Open

Fix #193: Add public constructors for routes and groups#295
samdark wants to merge 8 commits into
masterfrom
route-group-constructors

Conversation

@samdark

@samdark samdark commented Aug 13, 2026

Copy link
Copy Markdown
Member

method-specific route classes

Q A
Is bugfix?
New feature? ✔️
Breaks BC?
Fixed issues #193

@samdark samdark self-assigned this Aug 13, 2026
Copilot AI lite review requested due to automatic review settings August 13, 2026 20:58
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
src/Route.php 0.00% 19 Missing ⚠️
src/Group.php 0.00% 12 Missing ⚠️
src/Route/Delete.php 0.00% 11 Missing ⚠️
src/Route/Get.php 0.00% 11 Missing ⚠️
src/Route/Head.php 0.00% 11 Missing ⚠️
src/Route/Options.php 0.00% 11 Missing ⚠️
src/Route/Patch.php 0.00% 11 Missing ⚠️
src/Route/Post.php 0.00% 11 Missing ⚠️
src/Route/Put.php 0.00% 11 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             master    #295   +/-   ##
========================================
  Coverage      0.00%   0.00%           
- Complexity      129     140   +11     
========================================
  Files            13      20    +7     
  Lines           400     493   +93     
========================================
- Misses          400     493   +93     

☔ 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements issue #193 by making Route and Group constructible via public constructors (supporting named arguments) and introducing method-specific route classes (e.g., Get, Post) to reduce bootstrap-time object churn while keeping the existing static factories and fluent immutable API.

Changes:

  • Make Route and Group constructors public and accept full configuration via named arguments.
  • Add Yiisoft\Router\Route\MethodRoute plus concrete HTTP method route classes (Get, Post, Put, Delete, Patch, Head, Options).
  • Extend tests and documentation to cover / describe constructor-based configuration and new route classes.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/RouteTest.php Adds coverage for the new Route constructor and method-specific route classes.
tests/GroupTest.php Adds coverage for the new Group constructor behavior (hosts/middlewares/CORS).
src/Route.php Makes Route non-final and introduces a public constructor accepting full configuration.
src/Group.php Adds a public constructor accepting full configuration (routes, middleware, hosts, etc.).
src/Route/MethodRoute.php Introduces a base class for method-specific routes that preconfigures methods.
src/Route/Get.php Adds GET-specific route class.
src/Route/Post.php Adds POST-specific route class.
src/Route/Put.php Adds PUT-specific route class.
src/Route/Delete.php Adds DELETE-specific route class.
src/Route/Patch.php Adds PATCH-specific route class.
src/Route/Head.php Adds HEAD-specific route class.
src/Route/Options.php Adds OPTIONS-specific route class.
README.md Documents constructor-based configuration and method-specific route classes.
CHANGELOG.md Adds an entry for the new feature under 4.0.3.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Route/MethodRoute.php Outdated
@samdark samdark changed the title Fix #193: Add public constructors for routes and groups and Fix #193: Add public constructors for routes and groups Aug 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.

Comment thread src/Route.php
Comment thread src/Route.php Outdated
Comment thread src/Route.php Outdated
Comment thread src/Route.php Outdated
Comment thread src/Route.php Outdated
Comment thread src/Route.php Outdated
Comment thread src/Group.php Outdated
@samdark
samdark requested a review from vjik August 14, 2026 21:19
Comment thread src/Group.php
@samdark
samdark requested a review from vjik August 16, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants