From f055d42b3917bf067b8316f27ce538245574cc84 Mon Sep 17 00:00:00 2001 From: Bentley O'Kane-Chase Date: Tue, 17 Jan 2023 21:37:15 +1000 Subject: [PATCH] Add phpstorm metadata for mock methods when testing (#1405) * Add phpstorm metadata for testing * Update CHANGELOG.md --- CHANGELOG.md | 1 + resources/views/meta.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 957ef79..d670d08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. - Handle PHP 8.1 deprecation warnings when passing `null` to `new \ReflectionClass` [#1351 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1351) - Fix issue where \Eloquent is not included when using write_mixin [#1352 / Jefemy](https://github.com/barryvdh/laravel-ide-helper/pull/1352) - Fix model factory method arguments for Laravel >= 9 [#1361 / wimski](https://github.com/barryvdh/laravel-ide-helper/pull/1361) +- Improve return type of mock helper methods in tests [#1405 / bentleyo](https://github.com/barryvdh/laravel-ide-helper/pull/1405) ### Added - Add support for custom casts that implement `CastsInboundAttributes` [#1329 / sforward](https://github.com/barryvdh/laravel-ide-helper/pull/1329) diff --git a/resources/views/meta.php b/resources/views/meta.php index 51d87da..2840d91 100644 --- a/resources/views/meta.php +++ b/resources/views/meta.php @@ -28,6 +28,10 @@ namespace PHPSTORM_META { ])); + override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::mock(0), map(["" => "@&\Mockery\MockInterface"])); + override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::partialMock(0), map(["" => "@&\Mockery\MockInterface"])); + override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::instance(0), type(1)); + override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::spy(0), map(["" => "@&\Mockery\MockInterface"])); override(\Illuminate\Support\Arr::add(0), type(0)); override(\Illuminate\Support\Arr::except(0), type(0)); override(\Illuminate\Support\Arr::first(0), elementType(0));