Add a new key custom_mappings to the config, allows the user to override existing mappings, or add new ones like Point from geometry, or missing ones like character from #73.
For this, a new Action was created GetMappings, This action takes the package mappings, merges them with the ones in config, and set all the keys to lowercase (because MapReturnType::class expects them to be lowercase).
Add a new key
custom_mappings
to the config, allows the user to override existing mappings, or add new ones likePoint
from geometry, or missing ones likecharacter
from #73.For this, a new Action was created
GetMappings
, This action takes the package mappings, merges them with the ones in config, and set all the keys to lowercase (becauseMapReturnType::class
expects them to be lowercase).It's initialized in
Generator
class, passed down toGenerateJsonOutput/GenerateCliOutput
, then toWriteColumnAttribute
and finally toMapReturnType
.It's not pretty, but it works, I would prefer to access those mappings and the commands arguments from a Facade.
A side effect is that you now can cast classes like
Custom Casts
globally, instead of per model.Added some test, for
GetMappings
, andComplexModel
withCustom Casts
casted from config.Rename
phpstan.neon
tophpstan.neon.dist
to allow per machine config, fix ignored error in phpstan.Update github workflows, remove unsupported Laravel 9 from matrix, update actions (Warning: Node.js 16 actions are deprecated), use phpstan.neon.dist in phpstan.yml
Added
character
as string toTypescriptMappings
, fixes #73.Update
readme.md