Replies: 1 comment 6 replies
-
Hi, I don't get it, is the typehint declared in a PHPDoc or natively? class User {
// this function is from a library, it defines that it expects a Gender,
// but it actually wants a string (one of the constants of the Gender class)
function setGender(Gender $g): void {}
} |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi.
Is it possible to override the type of a (class) constant in a stub? I.e.
I tried to override the type of the constants in a stub file:
Seems that it this not supported... phpstan still insists that the argument given to the function (
$u->setGender(Gender::MALE);
) is a string...(of course, I can fix the
setGender
function to accept a string, but the other way around would have more charm...)TIA
Beta Was this translation helpful? Give feedback.
All reactions