src/main/php/response/Error.php
public static function inParams(ParamErrors $errors, ParamErrorMessages $errorMessages): self
    {
        return new self(Sequence::of($errors)->map(
                function(array $errors, $paramName) use ($errorMessages): array
                {
                    $resolved = ['field' => $paramName, 'errors' => []];
                    foreach ($errors as $id => $error) {
                        $resolved['errors'][] = [
                                'id'      => $id,
                                'details' => $error->details(),
                                'message' => $errorMessages->messageFor($error)->message()
                        ];
                    }

                    return $resolved;
                }
        ));
    }
public static function inParams(ParamErrors $errors, ParamErrorMessages $errorMessages): self
    {
        return new self(Sequence::of($errors)->map(
                function(array $errors, $paramName) use ($errorMessages): array
                {
                    $resolved = ['field' => $paramName, 'errors' => []];
                    foreach ($errors as $id => $error) {
                        $resolved['errors'][] = [
                                'id'      => $id,
                                'details' => $error->details(),
                                'message' => $errorMessages->messageFor($error)->message()
                        ];
                    }

                    return $resolved;
                }
        ));
    }
public static function inParams ( ParamErrors $ errors , ParamErrorMessages $ errorMessages ) : self { return new self ( Sequence :: of ( $ errors ) -> map ( function ( array $ errors , $ paramName ) use ( $ errorMessages ) : array { $ resolved = [ 'field' => $ paramName , 'errors' => [ ] ] ; foreach ( $ errors as $ id => $ error ) { $ resolved [ 'errors' ] [ ] = [ 'id' => $ id , 'details' => $ error -> details ( ) , 'message' => $ errorMessages -> messageFor ( $ error ) -> message ( ) ] ; } return $ resolved ; } ) ) ; }
creates error with given list of param errors

@param   \stubbles\input\errors\ParamErrors            $errors
@param   \stubbles\webapp\response\ParamErrorMessages  $errorMessages
@return  self
@since   6.2.0
creates error with given list of param errors