Skip to content

Commit d9d5d03

Browse files
KentarouTakedad3v2a
authored andcommitted
Fix return type of methods provided by SoftDeletes (barryvdh#1345)
* Fix return type of methods provided by `SoftDeletes` * Update CHANGELOG * fix test / update snapshot
1 parent 2158a39 commit d9d5d03

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
66
--------------
77

88
### Fixes
9+
- Fix return type of methods provided by `SoftDeletes` [#1345 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1345)
910
- Handle PHP 8.1 deprecation warnings when passing `null` to `new \ReflectionClass` [#1351 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1351)
1011
- Fix model factory method arguments for Laravel >= 9 [#1361 / wimski](https://github.com/barryvdh/laravel-ide-helper/pull/1361)
1112

src/Console/ModelsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ protected function getSoftDeleteMethods($model)
12191219
$traits = class_uses_recursive($model);
12201220
if (in_array('Illuminate\\Database\\Eloquent\\SoftDeletes', $traits)) {
12211221
$modelName = $this->getClassNameInDestinationFile($model, get_class($model));
1222-
$builder = $this->getClassNameInDestinationFile($model, \Illuminate\Database\Query\Builder::class);
1222+
$builder = $this->getClassNameInDestinationFile($model, \Illuminate\Database\Eloquent\Builder::class);
12231223
$this->setMethod('withTrashed', $builder . '|' . $modelName, []);
12241224
$this->setMethod('withoutTrashed', $builder . '|' . $modelName, []);
12251225
$this->setMethod('onlyTrashed', $builder . '|' . $modelName, []);

tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newModelQuery()
9090
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newQuery()
9191
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post null(string $unusedParam)
92-
* @method static \Illuminate\Database\Query\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post onlyTrashed()
92+
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post onlyTrashed()
9393
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post query()
9494
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBigIntegerNotNullable($value)
9595
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBigIntegerNullable($value)
@@ -164,8 +164,8 @@
164164
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUuidNullable($value)
165165
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereYearNotNullable($value)
166166
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereYearNullable($value)
167-
* @method static \Illuminate\Database\Query\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post withTrashed()
168-
* @method static \Illuminate\Database\Query\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post withoutTrashed()
167+
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post withTrashed()
168+
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post withoutTrashed()
169169
* @mixin \Eloquent
170170
*/
171171
class Post extends Model

tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
* @method static EloquentBuilder|Post newModelQuery()
9696
* @method static EloquentBuilder|Post newQuery()
9797
* @method static EloquentBuilder|Post null(string $unusedParam)
98-
* @method static QueryBuilder|Post onlyTrashed()
98+
* @method static EloquentBuilder|Post onlyTrashed()
9999
* @method static EloquentBuilder|Post query()
100100
* @method static EloquentBuilder|Post whereBigIntegerNotNullable($value)
101101
* @method static EloquentBuilder|Post whereBigIntegerNullable($value)
@@ -170,8 +170,8 @@
170170
* @method static EloquentBuilder|Post whereUuidNullable($value)
171171
* @method static EloquentBuilder|Post whereYearNotNullable($value)
172172
* @method static EloquentBuilder|Post whereYearNullable($value)
173-
* @method static QueryBuilder|Post withTrashed()
174-
* @method static QueryBuilder|Post withoutTrashed()
173+
* @method static EloquentBuilder|Post withTrashed()
174+
* @method static EloquentBuilder|Post withoutTrashed()
175175
* @mixin Eloquent
176176
*/
177177
class Post extends Model

tests/Console/ModelsCommand/SoftDeletes/__snapshots__/Test__test__1.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
* @property integer $id
1414
* @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery()
1515
* @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery()
16-
* @method static \Illuminate\Database\Query\Builder|Simple onlyTrashed()
16+
* @method static \Illuminate\Database\Eloquent\Builder|Simple onlyTrashed()
1717
* @method static \Illuminate\Database\Eloquent\Builder|Simple query()
1818
* @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value)
19-
* @method static \Illuminate\Database\Query\Builder|Simple withTrashed()
20-
* @method static \Illuminate\Database\Query\Builder|Simple withoutTrashed()
19+
* @method static \Illuminate\Database\Eloquent\Builder|Simple withTrashed()
20+
* @method static \Illuminate\Database\Eloquent\Builder|Simple withoutTrashed()
2121
* @mixin \Eloquent
2222
*/
2323
class Simple extends Model

0 commit comments

Comments
 (0)