staabm / phpstan-dba

PHPStan based SQL static analysis and type inference for the database access layer
https://staabm.github.io/archive.html#phpstan-dba
MIT License
250 stars 17 forks source link

Fix mysql type mapper #583

Closed jakubvojacek closed 1 year ago

jakubvojacek commented 1 year ago

as discussed here https://github.com/staabm/phpstan-dba/pull/582#issuecomment-1475752161, the mapping from mysql native type to phpstan type was not working properly.

This PR attempts to fix that

jakubvojacek commented 1 year ago

not sure about the phpstan failures in tests @staabm, i guess they're related to php version? I dont think I was doing changes in this part of code. I only changed like 10 lines in MysqlMapper

hemberger commented 1 year ago

I agree with this change, because MySQL explicitly states:

The display width does not constrain the range of values that can be stored in the column. Nor does it prevent values wider than the column display width from being displayed correctly.

(source: https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html)

staabm commented 1 year ago

not sure about the phpstan failures in tests

I think this error was ignored before here

https://github.com/staabm/phpstan-dba/blob/154022382a7f809c8ddfc51e5241d8b62010d1f8/phpstan.neon.dist#L28

please adjust the ignore rule

jakubvojacek commented 1 year ago

finally green :)