protected function errorsToArray(): array
    {
        $errors = [];

        foreach ($this->errors as $error)
        {
            $errors[] = $error->toArray();
        }

        return $errors;
    }
protected function errorsToArray(): array
    {
        $errors = [];

        foreach ($this->errors as $error)
        {
            $errors[] = $error->toArray();
        }

        return $errors;
    }
protected function errorsToArray ( ) : array { $ errors = [ ] ; foreach ( $ this -> errors as $ error ) { $ errors [ ] = $ error -> toArray ( ) ; } return $ errors ; }
Cast errors to an array

@return array
Cast errors to an array