You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?phpenum ReservationState: string {
case Pending = 'pending';
case Confirmed = 'confirmed';
case Cancelled = 'cancelled';
}
/** * @param value-of<ReservationState> $value */functionmakeState(string$value): ReservationState {
return ReservationState::from($value);
}
makeState(ReservationState::Pending->value); // WorksmakeState('confirmed'); // WorksmakeState('foo'); // Doesn't work
Psalm output (using commit b5b5c20):
ERROR: InvalidDocblock - 10:11 - Untemplated value-of param ReservationState should be an array in docblock for makeState
Psalm doesn't support backed enums as a type argument for
value-of
:https://psalm.dev/r/1277567ae5
Expected:
No errors
Actual:
ERROR: InvalidDocblock - 10:11 - Untemplated value-of param ReservationState should be an array in docblock for makeState
PHPStan supports this use of
value-of
.(I've searched the existing issues for this, but surprisingly, I couldn't find one. I'm sorry if I've missed it.)
The text was updated successfully, but these errors were encountered: