Skip to content

Comments

[Routing] Fix incomplete warning about multiple PHP classes in the same file#22028

Open
OskarStark wants to merge 1 commit intosymfony:6.4from
OskarStark:fix-routing-warning-text
Open

[Routing] Fix incomplete warning about multiple PHP classes in the same file#22028
OskarStark wants to merge 1 commit intosymfony:6.4from
OskarStark:fix-routing-warning-text

Conversation

@OskarStark
Copy link
Contributor

No description provided.

@carsonbot carsonbot added this to the 6.4 milestone Feb 20, 2026
@OskarStark OskarStark changed the base branch from 6.4 to 7.4 February 20, 2026 10:43
@OskarStark OskarStark changed the base branch from 7.4 to 6.4 February 20, 2026 10:43
@OskarStark OskarStark requested a review from Copilot February 20, 2026 11:59
Copy link

Copilot AI left a comment

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 attempts to expand a warning in the routing documentation about defining multiple PHP classes in the same file. The change adds information about route attribute priority over other configuration formats.

Changes:

  • Added two sentences to an existing warning explaining that route attributes always take priority over routes defined in YAML, XML, or PHP configuration files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +91 to +93
routes of the first class, ignoring all the other routes. The route attribute
always wins over routes defined in YAML, XML or PHP files and Symfony will
always load the route attribute.
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The added sentences are confusing and don't logically connect to the warning's main topic. The warning starts by discussing the issue of multiple PHP classes in the same file, but then abruptly shifts to discussing route priority between different configuration formats (attributes vs YAML/XML/PHP). These are two separate concepts that need clarification. Additionally, the phrase "The route attribute always wins over routes defined in YAML, XML or PHP files and Symfony will always load the route attribute" is redundant and unclear - saying attributes "win" and are "always loaded" conveys the same idea twice. Consider either removing these sentences or clearly explaining how route format priority relates to the multiple-classes-per-file issue.

Suggested change
routes of the first class, ignoring all the other routes. The route attribute
always wins over routes defined in YAML, XML or PHP files and Symfony will
always load the route attribute.
routes of the first class, ignoring all the other routes.

Copilot uses AI. Check for mistakes.
Comment on lines +91 to +93
routes of the first class, ignoring all the other routes. The route attribute
always wins over routes defined in YAML, XML or PHP files and Symfony will
always load the route attribute.
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The phrase "The route attribute" is ambiguous. It's unclear whether this refers to route attributes in general (as a configuration format) or specifically to route attributes in the context of multiple classes in one file. Consider using more precise language such as "Routes defined with attributes" to make it clear you're referring to the attribute-based routing format.

Suggested change
routes of the first class, ignoring all the other routes. The route attribute
always wins over routes defined in YAML, XML or PHP files and Symfony will
always load the route attribute.
routes of the first class, ignoring all the other routes. Routes defined with
attributes always take precedence over routes defined in YAML, XML or PHP files
and Symfony will always load the attribute-based routes.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants