The never type means "no value at all," and today you can only use it as a return type. This RFC from Daniel Scherzer would have allowed it as a parameter type too, but only on methods without a body, which means interface methods and abstract methods.

Why you'd want it

Think about the BackedEnum interface. Today it looks like this:

interface BackedEnum extends UnitEnum {
  public static function from(int|string $value): static;
  public static function tryFrom(int|string $value): ?static;
}

That isn't quite accurate. A string-backed enum only accepts strings, and an int-backed enum only accepts ints. But a class implementing an interface can only widen a parameter type, never narrow it, so the interface has to declare int|string.

A never parameter accepts nothing, which means every other type is wider than it. The interface could declare never, and each enum could then declare string or int:

interface BackedEnum extends UnitEnum {
  public static function from(never $value): static;
  public static function tryFrom(never $value): ?static;
}

The RFC also points to the renderers in league/commonmark. Each one only handles one kind of node, so it checks the type by hand and throws. With never on the interface, PHP could do that type check for you.

The rules

  • You can't use never on a method with a body. No value fits the type, so the method could never be called.
  • You can't use it on plain functions, since they always have a body.
  • You can't use it in a set property hook.
  • A never parameter can't have a default value.

The RFC also changes BackedEnum::from() and BackedEnum::tryFrom() to use never.

What it means for existing code

Calling from() and tryFrom() would work the same, because PHP already checks their values internally. Code that inspects the exact types of those methods, such as through reflection, would see the new signatures. Static analysis tools and IDEs would need updates.

The vote

It was declined 3 to 23, far below the two-thirds majority it needed. Voting closed on May 5, 2025.