Typed methods to get configuration values #50139
Unanswered
AlexandreGerault
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I've been struggling sometimes with Laravel and Larastan on high levels. Indeed, the configuration helper
config
give values asmixed
which requires annotation or assertion each time it is used to satisfy static analysis.I think it can be great to have, like the
Request
object, typed getters, like->string($key);
,->integer($key);
etc. I made a PR to provide some simple solution that would easily integrate in Laravel codebase (I believe so, correct me if I'm wrong).This would make it much more easier to satisfy static analysis. Only array might be complaining sometimes.
Beta Was this translation helpful? Give feedback.
All reactions