1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00

Add PHPUnit

This commit is contained in:
Daniel Neto 2025-04-02 10:53:30 -03:00
parent 1467777757
commit 5959dd49d7
1366 changed files with 118633 additions and 13161 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 = [];
}
}