Exception

Exceptions are a mechanism for handling errors and exceptional situations in a more structured and controlled way compared to traditional error handling methods like using error codes or die() statements. Exceptions provide a way to separate the normal flow of code from error-handling code, making it easier to manage errors and maintain clean and readable code.

Exceptions are thrown at the point of detection of the issue, and processed somewhere else in the code, when they are caught by a try-catch statement. Ultimately, exceptions block the execution of the application when they are not caught.

<?php

class x {
    final const X = 1;

    final function method() { }
}

?>

Documentation

See also Modern Error handling in PHP, PHP try & catch: what are exceptions and how to handle them?, The PHP Exception Class Hierarchy, Mastering Exception Handling in PHP: Ensuring Code Resilience

Related : throw, Try-catch, Chaining Exceptions