Skip to content

Conversation

@derrabus
Copy link
Member

@derrabus derrabus commented Nov 9, 2022

Q A
Branch? 6.2
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #48168, Replaces #48169
License MIT
Doc PR N/A

@carsonbot carsonbot added this to the 6.2 milestone Nov 9, 2022
MatTheCat added a commit to MatTheCat/symfony that referenced this pull request Nov 9, 2022
@nicolas-grekas
Copy link
Member

Thank you @derrabus.

@nicolas-grekas nicolas-grekas merged commit 91b2bca into symfony:6.2 Nov 9, 2022
@stof
Copy link
Member

stof commented Nov 9, 2022

shouldn't this also skip enums ?

@derrabus derrabus deleted the bugfix/psr4-routing-abstract branch November 9, 2022 13:21
@derrabus
Copy link
Member Author

derrabus commented Nov 9, 2022

Enums don't cause an issue as far as I can tell. Shall I add one to the fixtures just in case?

@derrabus
Copy link
Member Author

derrabus commented Nov 9, 2022

#48177

@stof
Copy link
Member

stof commented Nov 9, 2022

The fact that they don't have an issue is probably because the AnnotationClassLoader for the routing does not validate them (and so tries to load routes defined on them but it is unlikely to find some)

@derrabus
Copy link
Member Author

derrabus commented Nov 9, 2022

Yes. Not sure what happens though if someone tried to add Route attributes to a enum method. 🙈

@stof
Copy link
Member

stof commented Nov 10, 2022

Probably a WTF error when trying to instantiate the controller (unless that part takes care of giving a better error message). However, I'm fine with failing for such case, as there is no valid reason for that (while a route in an abstract class might make sense in some cases where you have a child class belong loaded as well)

fabpot added a commit that referenced this pull request Nov 11, 2022
… (derrabus)

This PR was merged into the 6.2 branch.

Discussion
----------

[Routing] Make sure enums don't confuse the PSR-4 loader

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | #48170 (comment)
| License       | MIT
| Doc PR        | N/A

Commits
-------

6ae6af0 [Routing] Make sure enums don't confuse the PSR-4 loader
@fabpot fabpot mentioned this pull request Nov 19, 2022
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.

[Routing] Psr4DirectoryLoader issue with abstract classes

5 participants