Skip to content

Commit

Permalink
Fix incorrect PHPDoc for Response in TestResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
kayw-geek committed Sep 25, 2024
1 parent b17b2bd commit 1010a2d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Illuminate/Testing/TestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TestResponse implements ArrayAccess
/**
* The response to delegate to.
*
* @var \Illuminate\Http\Response
* @var \Symfony\Component\HttpFoundation\Response
*/
public $baseResponse;

Expand All @@ -67,7 +67,7 @@ class TestResponse implements ArrayAccess
/**
* Create a new test response instance.
*
* @param \Illuminate\Http\Response $response
* @param \Symfony\Component\HttpFoundation\Response $response
* @param \Illuminate\Http\Request|null $request
* @return void
*/
Expand All @@ -81,7 +81,7 @@ public function __construct($response, $request = null)
/**
* Create a new TestResponse from another response.
*
* @param \Illuminate\Http\Response $response
* @param \Symfony\Component\HttpFoundation\Response $response
* @param \Illuminate\Http\Request|null $request
* @return static
*/
Expand Down
20 changes: 20 additions & 0 deletions types/Testing/TestResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use Illuminate\Http\RedirectResponse;
use Illuminate\Testing\TestResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;

use function PHPStan\Testing\assertType;

$response = TestResponse::fromBaseResponse(new StreamedResponse());
assertType(Response::class, $response->baseResponse);

$response = TestResponse::fromBaseResponse(new RedirectResponse(''));
assertType(Response::class, $response->baseResponse);

$response = TestResponse::fromBaseResponse(response()->redirectTo(''));
assertType(Response::class, $response->baseResponse);

$response = TestResponse::fromBaseResponse(response()->download(''));
assertType(Response::class, $response->baseResponse);

0 comments on commit 1010a2d

Please sign in to comment.