mirror of
https://github.com/pestphp/pest.git
synced 2026-03-11 18:27:23 +01:00
Merge pull request #340 from pestphp/better-tap-type-hinting
Better tap type hinting
This commit is contained in:
@ -5,6 +5,8 @@ declare(strict_types=1);
|
|||||||
namespace Pest\Support;
|
namespace Pest\Support;
|
||||||
|
|
||||||
use Pest\Expectation;
|
use Pest\Expectation;
|
||||||
|
use Pest\PendingObjects\TestCall;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @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 TestCall|TestCase|object
|
||||||
*
|
|
||||||
* @return TValue|object
|
|
||||||
*/
|
*/
|
||||||
public function tap(callable $callable)
|
public function tap(callable $callable)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Pest\Support;
|
namespace Pest\Support;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
@ -17,16 +18,14 @@ final class HigherOrderTapProxy
|
|||||||
/**
|
/**
|
||||||
* The target being tapped.
|
* The target being tapped.
|
||||||
*
|
*
|
||||||
* @var mixed
|
* @var TestCase
|
||||||
*/
|
*/
|
||||||
public $target;
|
public $target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new tap proxy instance.
|
* Create a new tap proxy instance.
|
||||||
*
|
|
||||||
* @param mixed $target
|
|
||||||
*/
|
*/
|
||||||
public function __construct($target)
|
public function __construct(TestCase $target)
|
||||||
{
|
{
|
||||||
$this->target = $target;
|
$this->target = $target;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user