How to model throwing after N-th iteration #4312
Answered
by
ondrejmirtes
vojtech-dobes
asked this question in
Support
-
I have a method which is emitting candidate values. The responsibility of calling code is to accept one of these and prevent another iteration. Method accepts number of attempts - once all attempts are depleted, next iteration will throw instead. foreach (Attempts::tryAtMax(5) as $attempt) {
// 6th iteration will throw in `tryAtMax`
} Is it possible to model this method using PHPStan extension capabilities, so that PHPStan knows that nothing after the iteration will get called? |
Beta Was this translation helpful? Give feedback.
Answered by
ondrejmirtes
Jan 4, 2021
Replies: 1 comment
-
Hi, can you rephrase your question with a phpstan.org link and expected output? It’s not obvious for me. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ondrejmirtes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, can you rephrase your question with a phpstan.org link and expected output? It’s not obvious for me.