Skip to content

Commit 26681eb

Browse files
committed
rename method
1 parent 5c07516 commit 26681eb

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/Illuminate/Http/Request.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,14 @@ public function is()
193193
}
194194

195195
/**
196-
* Check if route name matches string.
196+
* Check if the route name matches the given string.
197197
*
198198
* @param string $name
199-
*
200199
* @return bool
201200
*/
202-
public function isRouteName($name)
201+
public function routeIs($name)
203202
{
204-
return $this->route()->getName() === $name;
203+
return $this->route() && $this->route()->getName() === $name;
205204
}
206205

207206
/**

tests/Http/HttpRequestTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ public function testIsRouteNameMethod()
168168
return $route;
169169
});
170170

171-
$this->assertTrue($request->isRouteName('foo.bar'));
172-
$this->assertFalse($request->isRouteName('foo.foo'));
171+
$this->assertTrue($request->routeIs('foo.bar'));
172+
$this->assertFalse($request->routeIs('foo.foo'));
173173
}
174174

175175
public function testAjaxMethod()

0 commit comments

Comments
 (0)