This commit is contained in:
TiclemFR
2024-01-20 23:14:52 +01:00
parent a068f54957
commit 031f7071e6
881 changed files with 241469 additions and 247870 deletions

View File

@@ -10,12 +10,11 @@ use PhpParser\ErrorHandler;
*
* This allows graceful handling of errors.
*/
class Collecting implements ErrorHandler
{
class Collecting implements ErrorHandler {
/** @var Error[] Collected errors */
private $errors = [];
private array $errors = [];
public function handleError(Error $error) {
public function handleError(Error $error): void {
$this->errors[] = $error;
}
@@ -24,23 +23,21 @@ class Collecting implements ErrorHandler
*
* @return Error[]
*/
public function getErrors() : array {
public function getErrors(): array {
return $this->errors;
}
/**
* Check whether there are any errors.
*
* @return bool
*/
public function hasErrors() : bool {
public function hasErrors(): bool {
return !empty($this->errors);
}
/**
* Reset/clear collected errors.
*/
public function clearErrors() {
public function clearErrors(): void {
$this->errors = [];
}
}

View File

@@ -10,9 +10,8 @@ use PhpParser\ErrorHandler;
*
* This is the default strategy used by all components.
*/
class Throwing implements ErrorHandler
{
public function handleError(Error $error) {
class Throwing implements ErrorHandler {
public function handleError(Error $error): void {
throw $error;
}
}