xp-framework / compiler

Compiles future PHP to today's PHP.
19 stars 0 forks source link

Allow `never` return type #109

Closed thekid closed 3 years ago

thekid commented 3 years ago

See https://wiki.php.net/rfc/noreturn_type.

This currently emits a reference to a class in the current namespace called never:

$ echo 'function bail(): never { exit(); }' | xp compile -q -
<?php function bail():\never{exit();};

For PHP 7.0 syntactic support only, for PHP 7.1 through PHP 8.0 will be emitted as void there but left unchecked otherwise.

thekid commented 3 years ago

Voting ends 2021-04-13, so we'll have to wait on the details of its naming.

thekid commented 3 years ago

The PHP project settled on never as the name, see the accepted RFC and php/php-src#6761 (yet to be merged)

thekid commented 3 years ago

Framework support was released in https://github.com/xp-framework/core/releases/tag/v10.10.0

thekid commented 3 years ago

Compiler support was released in https://github.com/xp-framework/compiler/releases/tag/v6.4.0