Problem/Motivation
According to \Drupal\Core\Url::createFromRequest:
/**
* @throws \Drupal\Core\Routing\MatchingRouteNotFoundException
* Thrown when the request cannot be matched.
*/
public static function createFromRequest(Request $request) {
But really it throws Symfony\Component\Routing\Exception\ResourceNotFoundException, which is NOT handled with code like this:
try {
$url = Url::createFromRequest($request);
} catch (MatchingRouteNotFoundException) {
return;
}
The class is used nowhere else.
Proposed resolution
Remove or deprecate the class, fix docs.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #2
geek-merlinComment #4
ranjit1032002Created a patch for Removing unused MatchingRouteNotFoundException and wrong docs, please review.
Thank You.
Comment #6
geek-merlinThat was a sporadic test failure, re-test is green.
Comment #7
geek-merlinLet's replace this with what is really thrown, copied over from \Symfony\Component\Routing\Matcher\RequestMatcherInterface::matchRequest
NW for that, otherwise RTBC.
Comment #8
akram khanadded updated patch and address #7
Comment #9
akram khanComment #10
smustgrave commentedPart of me is saying this should be deprecated vs just removing but searching
https://git.drupalcode.org/search?group_id=2&scope=blobs&search=Matching...
I couldn't find any usage other then core forks.
Out of scope change added in #8 that should be fixed if committed. But won't hold for that 1 space.
Comment #12
geek-merlin(Yers, 4 is red, but 8 is green...)
Comment #13
larowlanYes, I agree we need to deprecate the class before we can remove it - see the policy for how we deprecate concrete classes.
Comment #17
quietone commentedUpdate the MR, created a CR.
Comment #18
longwaveLooks good, nothing more to add.
Comment #19
catchCommitted/pushed to 11.x, thanks!
Comment #21
catch