Merge pull request #340 from pestphp/better-tap-type-hinting

Better tap type hinting
This commit is contained in:
Nuno Maduro
2021-07-09 16:34:18 +01:00
committed by GitHub
2 changed files with 7 additions and 8 deletions

View File

@ -5,6 +5,8 @@ declare(strict_types=1);
namespace Pest\Support;
use Pest\Expectation;
use Pest\PendingObjects\TestCall;
use PHPUnit\Framework\TestCase;
/**
* @internal
@ -50,11 +52,9 @@ final class HigherOrderCallables
}
/**
* @template TValue
* Tap into the test case to perform an action and return the test case.
*
* @param callable(): TValue $callable
*
* @return TValue|object
* @return TestCall|TestCase|object
*/
public function tap(callable $callable)
{

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Pest\Support;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use Throwable;
@ -17,16 +18,14 @@ final class HigherOrderTapProxy
/**
* The target being tapped.
*
* @var mixed
* @var TestCase
*/
public $target;
/**
* Create a new tap proxy instance.
*
* @param mixed $target
*/
public function __construct($target)
public function __construct(TestCase $target)
{
$this->target = $target;
}