-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Nette\Caching\Cache dynamic return type extensions #49
base: 1.1.x
Are you sure you want to change the base?
Conversation
3434ecc
to
e5b5c36
Compare
Hi, I worry that some cases will not work well, for example: /**
* @template TFallback
* @param mixed $key
* @param (callable(mixed): TFallback)|null $fallback
* @return TFallback
*/
public function load($key, callable $fallback = null) If the fallback is not passed, we have an unresolved TFallback. And in some other cases I'm not sure that |
Can we somehow tell that if no fallback is passed it should return null? In source is this https://github.com/nette/caching/blob/be02f7e/src/Caching/Cache.php#L104, so the parameter should be only one? |
|
492fbf8
to
68dbcda
Compare
|
} | ||
|
||
$fallbackParameterType = $scope->getType($methodCall->args[$fallbackParameterIndex]->value); | ||
if (!$fallbackParameterType instanceof ParametersAcceptor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better ask about ->isCallable()->yes()
, get ->getCallableParametersAcceptors()
and pass it to ParametersAcceptorSelector::selectFromArgs()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean like this? I hope i got it correctly :)
No description provided.