Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Collecting.php

class Collecting

Error handler that collects all errors into an array.

This allows graceful handling of errors.

Hierarchy

  • class \PhpParser\ErrorHandler\Collecting implements \PhpParser\ErrorHandler

Expanded class hierarchy of Collecting

File

vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php, line 13

Namespace

PhpParser\ErrorHandler
View source
class Collecting implements ErrorHandler {
    
    /** @var Error[] Collected errors */
    private array $errors = [];
    public function handleError(Error $error) : void {
        $this->errors[] = $error;
    }
    
    /**
     * Get collected errors.
     *
     * @return Error[]
     */
    public function getErrors() : array {
        return $this->errors;
    }
    
    /**
     * Check whether there are any errors.
     */
    public function hasErrors() : bool {
        return !empty($this->errors);
    }
    
    /**
     * Reset/clear collected errors.
     */
    public function clearErrors() : void {
        $this->errors = [];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
Collecting::$errors private property @var Error[] Collected errors
Collecting::clearErrors public function Reset/clear collected errors.
Collecting::getErrors public function Get collected errors.
Collecting::handleError public function Handle an error generated during lexing, parsing or some other operation. Overrides ErrorHandler::handleError
Collecting::hasErrors public function Check whether there are any errors.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal