Closed valdezet closed 2 years ago
It's late and I didn't fully think it through, but I think both cases are expected this way.
Can you check this?
I don't know when I'll get the time to check this out.
I agree with you with the datetime.
And, while I didn't expect decimal fields to not give a float, I think it makes sense for people who work with high-precision floats. I just didn't have experience having to work with one though.
Just checked it out using VSCode XDebug and Chrome DevTools.
The XDebug gets the type as double
but the variable gets sent to the browser as string.
$total_amount = $model->total_amount;
$typeof_total_amount = gettype($model->total_amount);
$total_amount = 255.16
$typeof_total_amount = "double"
total_amount: "255.16"
So no error in ide-helper \o/
, that's just the way how it works ™️
And indeed, if you want a different type in PHP, setting casts it the way to go and ide-helper will pick it up correctly.
Closing, as I don't see an issue with this library!
Versions:
Description:
Timestamps
Timestamp datatypes are documented as
string
without the Eloquent$casts
attributeDecimals
decimal()->nullable()
migration fields get documented asstring|null
instead offloat
.Steps To Reproduce:
Timestamps
One of the fields included in Users table migration is
$email_verified_at
and with the migration:$table->timestamp('email_verified_at')->nullable();
With
$casts
eloquent attribute, this gets documented properly as a timestampCast
Resulting Docblock property:
But without the cast, this gets documented as
string|null
.Decimals / Floats
decimals get documented as a
string|null
property instead of floatMigration:
resulting Docblock