psalm / psalm-plugin-laravel

A Psalm plugin for Laravel
MIT License
306 stars 71 forks source link

feature: tighten return types of config helper by using dynamic analysis #229

Open mr-feek opened 2 years ago

mr-feek commented 2 years ago

This PR should tighten the return types of the config helper to be the actual resolved type at runtime, rather than Repository|mixed.

This should result in proper types being returned, and reducing the number of PossiblyInvalidCast that psalm emits after using the config helper

mr-feek commented 2 years ago

Going to leave this open while i ponder how types might change depending on environment configuration

mr-feek commented 2 years ago

note: always add the type of the default value to the return union type

mr-feek commented 2 years ago

I made a preliminary PR to at least correct the basic typehint of config which i will ship first https://github.com/psalm/psalm-plugin-laravel/pull/230