Narrowing return type based on the previously called method #10797
-
https://phpstan.org/r/59a4d153-91fc-4d09-8129-2e2675dcd065 I know PHPStan has conditional return types but from this docs I can see those can only consider arguments passed. |
Beta Was this translation helpful? Give feedback.
Answered by
ondrejmirtes
Mar 28, 2024
Replies: 1 comment 1 reply
-
This example needs Documentation: https://phpstan.org/writing-php-code/narrowing-types#custom-type-checking-functions-and-methods |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
javaDeveloperKid
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This example needs
@phpstan-assert
annotation: https://phpstan.org/r/4c0d1bc8-3c67-42fc-9ba0-b22d718b3c26Documentation: https://phpstan.org/writing-php-code/narrowing-types#custom-type-checking-functions-and-methods