File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -70,20 +70,26 @@ public function matchFromPath(string $path, string $method): Route
7070        /** 
7171         * @var Route $route 
7272         */ 
73+         $ routeMatchedButMethodNotAllowedfalse ;
7374        foreach  ($ this routes  as  $ route
7475            if  ($ routematch ($ pathfalse ) {
7576                continue ;
7677            }
7778
7879            if  (!in_array ($ method$ routegetMethods ())) {
79-                 throw  new  MethodNotAllowed (
80-                     'Method Not Allowed :  '  . $ method
81-                     self ::METHOD_NOT_ALLOWED 
82-                 );
80+                 $ routeMatchedButMethodNotAllowedtrue ;
81+                 continue ;
8382            }
8483            return  $ route
8584        }
8685
86+         if  ($ routeMatchedButMethodNotAllowed
87+             throw  new  MethodNotAllowed (
88+                 'Method Not Allowed :  '  . $ method
89+                 self ::METHOD_NOT_ALLOWED 
90+             );
91+         }
92+ 
8793        throw  new  RouteNotFound (
8894            'No route found for  '  . $ path
8995            self ::NO_ROUTE 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments