@@ -221,6 +221,44 @@ public function handle(?string $uri = null)
221221 // Restart filterInfo
222222 $ this ->filtersInfo = [];
223223
224+ <<<<<<< HEAD
225+ =======
226+ $ useDefinedRoutes = $ this ->collection ->shouldUseDefinedRoutes ();
227+ $ useAutoRoute = $ this ->collection ->shouldAutoRoute ();
228+
229+ // Let devs know if both are disabled
230+ if (! $ useDefinedRoutes && ! $ useAutoRoute ) {
231+ throw RouterException::forNoRoutingAvailable ();
232+ }
233+
234+ // Fast path 1: Auto-routing ONLY (no defined routes to check)
235+ if ($ useAutoRoute && ! $ useDefinedRoutes ) {
236+ $ this ->autoRoute ($ uri );
237+
238+ $ this ->processRouteAttributes ();
239+
240+ return $ this ->controllerName ();
241+ }
242+
243+ // Fast path 2: Defined routes ONLY (no auto-routing fallback)
244+ if ($ useDefinedRoutes && ! $ useAutoRoute ) {
245+ if ($ this ->checkRoutes ($ uri )) {
246+ if ($ this ->collection ->isFiltered ($ this ->matchedRoute [0 ])) {
247+ $ this ->filtersInfo = $ this ->collection ->getFiltersForRoute ($ this ->matchedRoute [0 ]);
248+ }
249+
250+ $ this ->processRouteAttributes ();
251+
252+ return $ this ->controller ;
253+ }
254+
255+ throw new PageNotFoundException (
256+ "Can't find a route for ' {$ this ->collection ->getHTTPVerb ()}: {$ uri }'. " ,
257+ );
258+ }
259+
260+ // Original path: BOTH enabled (check defined routes first, then auto-route)
261+ >>>>>>> 8 f675dc60a (Fixing tests after routing options PR was merged)
224262 // Checks defined routes
225263 if ($ this ->checkRoutes ($ uri )) {
226264 if ($ this ->collection ->isFiltered ($ this ->matchedRoute [0 ])) {
0 commit comments