Source: betterprogramming.pub

The “never” Return Type for PHP

Category: PHP, PHP, api, api

We think you might be interested in this job:

There was one RFC (Request for Comments) for a new capability of the PHP language itself that closed voting just recently, and it’s called never. PHP 8.1 is planned for the end of the year, and in addition to Fibers, the new never keyword will allow you to mark a function as “never” returning.

when they loop forever): Well, if you’re using a function that only throws an exception for pure convenience or it stops the script execution, you can use never once PHP 8.1 lands in your server.

If you use static analysis code tools, you may catch an error if you pass through a function that never returns and expect normal execution, as it will be easier to catch and fix it.

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox.Explore
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Community Partners