Skip to content

Commit 81d5b22

Browse files
authored
Fix Castables issue #1312 (#1388)
* Return Castable class if failed to detect it from return types * fix-style * Add CHANGELOG.md entry
1 parent ce24d4b commit 81d5b22

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
@@ -1347,7 +1347,7 @@ protected function checkForCastableCasts(string $type, array $params = []): stri
13471347

13481348
return $this->getReturnTypeFromReflection($methodReflection) ??
13491349
$this->getReturnTypeFromDocBlock($methodReflection, $reflection) ??
1350-
'mixed';
1350+
$type;
13511351
}
13521352

13531353
/**

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)