-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Versions:
- ide-helper Version: 3.6.0
- Laravel Version: 12.35.0
- PHP Version: 8.4.13
Description:
Currently the decimal column type gets it's typehint as string instead of numeric as intended.
From what I understand decimal columns no longer have a cast associated with them but instead have a their own column type now.
So the check in the function
| public function castPropertiesType($model) |
match statement here laravel-ide-helper/src/Console/ModelsCommand.php
Lines 575 to 588 in 9ef25f6
| $type = match ($column['type_name']) { | |
| 'tinyint', 'bit', | |
| 'integer', 'int', 'int4', | |
| 'smallint', 'int2', | |
| 'mediumint', | |
| 'bigint', 'int8' => 'int', | |
| 'boolean', 'bool' => 'bool', | |
| 'float', 'real', 'float4', | |
| 'double', 'float8' => 'float', | |
| default => 'string', | |
| }; |
decimal, which then returns numeric.
I have locally tested adding the case 'decimal' => 'numeric' and now the generated type hints are working as intended.
Steps To Reproduce:
- Get table with a decimal column
- Generate model helpers
- Check generated typehint (should be
numeric, isstring)