return $user ?? throw new IllegalStateException('No such user');
Inside ternary operator (?:)
return $user ?: throw new IllegalStateException('No such user');
return $args ? $args[0] : throw new IllegalStateException('At least one argument expected');
Inside arrow functions
$raise= $message ==> throw new IllegalStateException($message);
$raise('No such user');
Inside compact functions and methods
class Test {
public function setup() ==> throw new MethodNotImplementedException(__METHOD__);
}
As suggested in #51:
Inside null-coalescing operator (??)
Inside ternary operator (?:)
Inside arrow functions
Inside compact functions and methods