Never Is The Lowest Ranking Type

<?php

class x {
    function foo() : int {}
}

class y extends x {
    function foo() : never {}
}

It is always possible to use never as a compatible type in a return type. It is the lowest ranking type, and is compatible with anything else.

Of course, to finish implementing it, the method would also have to never return.

See Also

PHP Error Messages

PHP Features

Last updated: 14 July 2026