From 37a0c044617de4f847acadcb52ac7574927085a8 Mon Sep 17 00:00:00 2001 From: Sam Light Date: Wed, 10 Jun 2026 19:00:32 +0100 Subject: Renamed router route method to make --- src/Router.php | 14 +++++++------- tests/Unit/RouterTest.php | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Router.php b/src/Router.php index 9aa3b55..34d2695 100644 --- a/src/Router.php +++ b/src/Router.php @@ -117,7 +117,7 @@ class Router return $this->strategy->runRoute($call); } - public function route( + public function make( HttpMethod $method, string $path, callable $handler, @@ -137,32 +137,32 @@ class Router public function get(string $path, callable $handler): RouteDefinition { - return $this->route(HttpMethod::Get, $path, $handler); + return $this->make(HttpMethod::Get, $path, $handler); } public function post(string $path, callable $handler): RouteDefinition { - return $this->route(HttpMethod::Post, $path, $handler); + return $this->make(HttpMethod::Post, $path, $handler); } public function put(string $path, callable $handler): RouteDefinition { - return $this->route(HttpMethod::Put, $path, $handler); + return $this->make(HttpMethod::Put, $path, $handler); } public function patch(string $path, callable $handler): RouteDefinition { - return $this->route(HttpMethod::Patch, $path, $handler); + return $this->make(HttpMethod::Patch, $path, $handler); } public function delete(string $path, callable $handler): RouteDefinition { - return $this->route(HttpMethod::Delete, $path, $handler); + return $this->make(HttpMethod::Delete, $path, $handler); } public function any(string $path, callable $handler): RouteDefinition { - return $this->route(HttpMethod::Any, $path, $handler); + return $this->make(HttpMethod::Any, $path, $handler); } public function addNamedRoute(string $name, Route $route): void diff --git a/tests/Unit/RouterTest.php b/tests/Unit/RouterTest.php index 41b794d..0e270ca 100644 --- a/tests/Unit/RouterTest.php +++ b/tests/Unit/RouterTest.php @@ -188,7 +188,7 @@ it('calls strategy runRoute with dispatch on match', function () { it('make a route', function () { $router = new Router(); - $router->route(HttpMethod::Get, '/test1/test2/test3', fn () => null); + $router->make(HttpMethod::Get, '/test1/test2/test3', fn () => null); expect($router->findRoute(HttpMethod::Get, '/test1/test2/test3')) ->toBeInstanceOf(RouteMatch::class); @@ -228,7 +228,7 @@ it('makes a :dataset route') it('returns RouteDefinition when making route') ->expect(fn () => (new Router()) - ->route(HttpMethod::Get, '/test', fn () => null) + ->make(HttpMethod::Get, '/test', fn () => null) ) ->toBeInstanceOf(RouteDefinition::class); -- cgit v1.2.3