File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,23 +135,13 @@ public function getHook(): bool
135135 }
136136
137137 /**
138- * Get alias paths .
138+ * Get additional methods this route is registered under .
139139 *
140140 * @return array<string>
141141 */
142- public function getAliasPaths (): array
142+ public function getAdditionalMethods (): array
143143 {
144- return $ this ->aliasPaths ;
145- }
146-
147- /**
148- * Get methods this route is registered under.
149- *
150- * @return array<string>
151- */
152- public function getMethods (): array
153- {
154- return array_merge ([$ this ->method ], $ this ->additionalMethods );
144+ return $ this ->additionalMethods ;
155145 }
156146
157147 /**
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ public static function addRoute(Route $route): void
8989
9090 self ::$ routes [$ route ->getMethod ()][$ path ] = $ route ;
9191
92- foreach (\array_slice ( $ route ->getMethods (), 1 ) as $ method ) {
92+ foreach ($ route ->getAdditionalMethods ( ) as $ method ) {
9393 self ::addRouteMethod ($ method , $ route );
9494 }
9595 }
Original file line number Diff line number Diff line change @@ -151,7 +151,6 @@ public function testCanMatchRouteWithMultipleMethods(): void
151151 $ this ->assertNull (Router::match (Http::REQUEST_METHOD_PUT , '/userinfo ' ));
152152
153153 $ this ->assertSame (Http::REQUEST_METHOD_GET , $ route ->getMethod ());
154- $ this ->assertSame ([Http::REQUEST_METHOD_GET , Http::REQUEST_METHOD_POST ], $ route ->getMethods ());
155154 }
156155
157156 public function testCanMatchRouteWithStringMethod (): void
@@ -160,7 +159,6 @@ public function testCanMatchRouteWithStringMethod(): void
160159
161160 $ this ->assertEquals ($ route , Router::match (Http::REQUEST_METHOD_GET , '/userinfo ' )?->route);
162161 $ this ->assertNull (Router::match (Http::REQUEST_METHOD_POST , '/userinfo ' ));
163- $ this ->assertSame ([Http::REQUEST_METHOD_GET ], $ route ->getMethods ());
164162 }
165163
166164 public function testCanMatchRouteWithMultipleMethodsAndPlaceholder (): void
@@ -209,7 +207,6 @@ public function testCanOverrideRouteMethod(): void
209207 ], '/userinfo ' );
210208
211209 $ this ->assertEquals ($ routeGET , Router::match (Http::REQUEST_METHOD_POST , '/userinfo ' )?->route);
212- $ this ->assertSame ([Http::REQUEST_METHOD_GET , Http::REQUEST_METHOD_POST ], $ routeGET ->getMethods ());
213210 } finally {
214211 Router::setAllowOverride (false );
215212 }
You can’t perform that action at this time.
0 commit comments