Skip to content

Commit 94b8bad

Browse files
kwarcud3v2a
authored andcommitted
Fix Castables issue barryvdh#1312 (barryvdh#1388)
* Return Castable class if failed to detect it from return types * fix-style * Add CHANGELOG.md entry
1 parent 5254b87 commit 94b8bad

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
1111
- Fix issue where \Eloquent is not included when using write_mixin [#1352 / Jefemy](https://github.com/barryvdh/laravel-ide-helper/pull/1352)
1212
- Fix model factory method arguments for Laravel >= 9 [#1361 / wimski](https://github.com/barryvdh/laravel-ide-helper/pull/1361)
1313
- Improve return type of mock helper methods in tests [#1405 / bentleyo](https://github.com/barryvdh/laravel-ide-helper/pull/1405)
14+
- Fix Castable class if failed to detect it from return types [#1388 / kwarcu](https://github.com/barryvdh/laravel-ide-helper/pull/1388)
1415

1516
### Added
1617
- Added Laravel 10 support [#1407 / lptn](https://github.com/barryvdh/laravel-ide-helper/pull/1407)

src/Console/ModelsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ protected function checkForCastableCasts(string $type, array $params = []): stri
13581358

13591359
return $this->getReturnTypeFromReflection($methodReflection) ??
13601360
$this->getReturnTypeFromDocBlock($methodReflection, $reflection) ??
1361-
'mixed';
1361+
$type;
13621362
}
13631363

13641364
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* @property SelfCastingCasterWithStaticDocblockReturn $casted_property_with_static_return_docblock_and_param
4141
* @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_castable
4242
* @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_anonymous_cast
43-
* @property mixed $casted_property_without_return_type
43+
* @property CastableWithoutReturnType $casted_property_without_return_type
4444
* @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $cast_without_property
4545
* @property mixed $cast_inbound_attribute
4646
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast newModelQuery()

0 commit comments

Comments
 (0)