Created
December 31, 2025 12:36
-
-
Save ace-of-aces/28502ff74ec8c875e00ea30451950150 to your computer and use it in GitHub Desktop.
A helper file to improve Intellisense for PestPHP tests in VSCode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Pest\Concerns\Expectable; | |
| use Pest\PendingCalls\BeforeEachCall; | |
| use Pest\PendingCalls\TestCall; | |
| use Pest\Support\HigherOrderTapProxy; | |
| use Tests\TestCase; | |
| /** | |
| * Runs the given closure before all tests in the current file. | |
| * | |
| * @param-closure-this TestCase $closure | |
| */ | |
| function beforeAll(Closure $closure): void {} | |
| /** | |
| * Runs the given closure before each test in the current file. | |
| * | |
| * @param-closure-this TestCase $closure | |
| * | |
| * @return HigherOrderTapProxy<Expectable|TestCall|TestCase>|Expectable|TestCall|TestCase|mixed | |
| * | |
| * @disregard P1075 Not all paths return a value. | |
| */ | |
| function beforeEach(?Closure $closure = null): BeforeEachCall {} | |
| /** | |
| * Adds the given closure as a test. The first argument | |
| * is the test description; the second argument is | |
| * a closure that contains the test expectations. | |
| * | |
| * @param-closure-this TestCase $closure | |
| * | |
| * @return Expectable|TestCall|TestCase|mixed | |
| * | |
| * @disregard P1075 Not all paths return a value. | |
| */ | |
| function test(?string $description = null, ?Closure $closure = null): HigherOrderTapProxy|TestCall {} | |
| /** | |
| * Adds the given closure as a test. The first argument | |
| * is the test description; the second argument is | |
| * a closure that contains the test expectations. | |
| * | |
| * @param-closure-this TestCase $closure | |
| * | |
| * @return Expectable|TestCall|TestCase|mixed | |
| * | |
| * @disregard P1075 Not all paths return a value. | |
| */ | |
| function it(string $description, ?Closure $closure = null): TestCall {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you so much, this helper works for me. Been pulling my hair out trying to figure out what's causing those annoying red squiggly lines, only for it to be an intelephense issue.