Why sometimes you use type mixed and sometimes you don't? #27
DominikStyp
started this conversation in
General
Replies: 1 comment
-
Depends on my mood. I find the mixed type sometimes helps me remember I shouldn't assume what to expect. If you want to PR something here, feel free :-) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is the point of using type mixed?
Sometimes it's in the closure's attribute:
https://github.com/worksome/request-factories/blob/main/src/Actions/CreateFactoryResultSteps/ResolveNestedRequestFactories.php#L21
Sometimes it's not:
https://github.com/worksome/request-factories/blob/main/src/Support/Result.php#L49
Isn't also better to use the expected array keys instead of mixed like here:
https://github.com/worksome/request-factories/blob/main/src/Support/ConfigBasedFinder.php#L13
Where you only use two keys from the config, so it could easily be:
...and this provides some useful information, which mixed doesn't
Beta Was this translation helpful? Give feedback.
All reactions