Skip to content

Commit

Permalink
Fine tune constructor types
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobion committed Jun 17, 2019
1 parent 9b04ae9 commit daa0601
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions RedirectResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RedirectResponse extends Response
*
* @see http://tools.ietf.org/html/rfc2616#section-10.3
*/
public function __construct(?string $url, int $status = 302, array $headers = [])
public function __construct(string $url, int $status = 302, array $headers = [])
{
parent::__construct('', $status, $headers);

Expand Down Expand Up @@ -82,7 +82,7 @@ public function getTargetUrl()
*/
public function setTargetUrl($url)
{
if (empty($url)) {
if ('' == $url) {
throw new \InvalidArgumentException('Cannot redirect to an empty URL.');
}

Expand Down
5 changes: 3 additions & 2 deletions Tests/RedirectResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ public function testGenerateMetaRedirect()

/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Cannot redirect to an empty URL.
*/
public function testRedirectResponseConstructorNullUrl()
public function testRedirectResponseConstructorEmptyUrl()
{
$response = new RedirectResponse(null);
$response = new RedirectResponse('');
}

/**
Expand Down

0 comments on commit daa0601

Please sign in to comment.