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
Example of use: When we use old orms, we often don't have the ability to specify Enum as a data type without writing custom logic, but with value-of we can specify a specific range of values.
Example VSCode:
enum PublishedStates: int {
case Draft = 0;
case Published = 1;
case Indexed = 2;
}
finalclass Post extends \OldOrm\BaseModel
{
public ?int$id = null;
/** @var value-of<PublishedStates> */publicint$published;
}
$post = newPost();
$post->published = 0; // suggestion 0 | 1 | 2$post->create();
The text was updated successfully, but these errors were encountered:
Feature description or problem with existing feature
https://phpstan.org/writing-php-code/phpdoc-types#key-and-value-types-of-arrays-and-iterables
Example of use: When we use old orms, we often don't have the ability to specify Enum as a data type without writing custom logic, but with value-of we can specify a specific range of values.
Example VSCode:
The text was updated successfully, but these errors were encountered: