rectorphp/rector-doctrine

Doctrine decimal column type mapped incorrectly as float

aszenz opened this issue · 1 comments

When applying the rule TypedPropertyFromColumnTypeRector

See https://getrector.org/demo/1ec73834-ba14-69bc-8cfe-29f5df412c73

Doctrine decimal type should be mapped to string to preserve precision as per:

https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#mapping-matrix
https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#decimal

In this case we can also use numeric-string var annotation to specify that it's a numeric string and not just any other string.

Hi, thanks for reporting and links.

The fix might require to change this type to StringType: