laravel-ide-helper icon indicating copy to clipboard operation
laravel-ide-helper copied to clipboard

`unsignedTinyInteger` column has `bool` PHPDoc in generated `_ide_helper_models.php` file

Open canvural opened this issue 4 years ago • 1 comments

Versions:

  • ide-helper Version: 2.10.0
  • PHP Version: 8.0.8

Description:

I have a column in my migration which uses unsignedTinyInteger And in database it's type is TINYINT(3) with unsigned flag on.

When I run php artisan ide-helper:models -N ide-helper generates the file and this column has * @property bool $quantity above the class.

I expected it to just have int

Steps To Reproduce:

  1. Have a migration with $table->unsignedTinyInteger('quantity'); in it
  2. Run php artisan ide-helper:models -N

canvural avatar Aug 17 '21 20:08 canvural

I couldn't quickly locate any code in this library having a special case for the tiny* variants.

Maybe this is a doctrine/dbal behaviour? I found e.g. https://github.com/doctrine/dbal/blob/e974d4deca8c430d9eba0975f441538145a5a8f1/src/Platforms/MySQLPlatform.php#L1083

There's also https://github.com/doctrine/dbal/blob/e974d4deca8c430d9eba0975f441538145a5a8f1/src/Platforms/MySQLPlatform.php#L299-L302 but I think this is for the reverse.

So maybe the issue is that the tinyint check there does not honor the "precision"?

Note: I don't know dbal well, this is a lot of guessing and I may have miss-analyzed things here.

mfn avatar Aug 18 '21 08:08 mfn

Any updated if this is still an issue?

mfn avatar Feb 16 '24 22:02 mfn

Will be fixed with the doctrine removal.

barryvdh avatar Feb 17 '24 07:02 barryvdh