Summary: Taking Advantage of Error-Handling Enhancements

Let's get a quick overview of error-handling enhancements introduced in PHP 8.

We'll cover the following

Key takeaways

In this chapter, we received an overview of major changes in error handling in PHP 8. Following are the key points that we covered in this chapter:

  • We were given examples of situations where error conditions might arise, and now, we have an idea of how to properly manage errors in PHP 8. We now have a solid path toward refactoring code that, under PHP 8, now produces errors. If our code could potentially lead to any of the conditions described where former Warnings are now Errors, we risk having our code break.

  • We also learned about the second set of error conditions described only produced Notices in the past; these same conditions now cause a Warning. The new set of Warnings gives us a chance to adjust faulty code and prevent having our application devolve into a seriously unstable condition.

  • We learned how the use of the @ operator is strongly discouraged. In PHP 8, this syntax will no longer mask fatal errors.

Get hands-on with 1400+ tech skills courses.