Hello internals,

Since union types have landed in PHP, this allows us the possibility to
have literal types support as well and I would like to hear your
thoughts about an RFC for it.

I think a feature like this would greatly improve the way we model our code
in very common use cases. For example, let's consider having a function
that returns the status of a post.

```php
/**
/** @return "draft"|"published"
*/
function getStatus(): string { }
```

Would become

```php
function getStatus(): "draft" | "published" { }
```

Of course this could become quite messy if there are more than a few
literal types, in which case separate RFCs could be created for type
aliases and valueof/keyof features.

I would also like to mention that I also worked on a basic implementation
for the first phase of the implementation; it's nowhere near to be
completed, but I think I can finish it with some guidance/help from you.

Regards,
Bogdan Ungureanu

Reply via email to