From 9c202fa2d74d11149c2171c04ddb48e8b45edbca Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 9 Jul 2021 16:07:37 +0100 Subject: [PATCH 1/2] Improves type-hinting for tap method --- src/Support/HigherOrderCallables.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Support/HigherOrderCallables.php b/src/Support/HigherOrderCallables.php index 46503e67..a6ecccf3 100644 --- a/src/Support/HigherOrderCallables.php +++ b/src/Support/HigherOrderCallables.php @@ -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) { From 50ece576a715950cd8698942058d4e51067faed4 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 9 Jul 2021 16:09:53 +0100 Subject: [PATCH 2/2] Improves type-hinting for target in HigherOrderTapProxy --- src/Support/HigherOrderTapProxy.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Support/HigherOrderTapProxy.php b/src/Support/HigherOrderTapProxy.php index 4b5664d3..3c4f3968 100644 --- a/src/Support/HigherOrderTapProxy.php +++ b/src/Support/HigherOrderTapProxy.php @@ -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; }