@ -30,7 +30,7 @@ class HttpRequest implements ArrayAccess {
* This is a simple function that only supports flat schemas (non-composed, the data must only be a k/v array pair.)
* This is a simple function that only supports flat schemas (non-composed, the data must only be a k/v array pair.)
* @param array<string,mixed> $request the request's data
* @param array<string,mixed> $request the request's data
* @param array<string,ValidationFail> $fails a reference to a failure array, that will contain the reported validation failures.
* @param array<string,ValidationFail> $fails a reference to a failure array, that will contain the reported validation failures.
* @param array<string,array<int,Validator>> $schema the schema to satisfy. a schema is a simple array with a string key (which is the top-level field name), and a set of validators
* @param array<string, Validator[]> $schema the schema to satisfy. a schema is a simple array with a string key (which is the top-level field name), and a set of validators
* @return HttpRequest|null the built HttpRequest instance, or null if a field is missing, or if any of the schema validator failed
* @return HttpRequest|null the built HttpRequest instance, or null if a field is missing, or if any of the schema validator failed
*/
*/
public static function from(array $request, array &$fails, array $schema): ?HttpRequest {
public static function from(array $request, array &$fails, array $schema): ?HttpRequest {
@ -65,7 +65,6 @@ class HttpRequest implements ArrayAccess {
* @param callable $validate_fn the validate function. Must have the same signature as the {@link Validator::validate()} method.
* @param callable(string, mixed): ValidationFail[] $validate_fn the validate function. Must have the same signature as the {@link Validator::validate()} method.
*/
*/
public function __construct(callable $validate_fn) {
public function __construct(callable $validate_fn) {
* @param callable $predicate a function predicate with signature: `(string) => bool`, to validate the given string
* @param callable(mixed): bool $predicate a function predicate with signature: `(string) => bool`, to validate the given string
* @param callable $errorsFactory a factory function with signature `(string) => array` to emit failures when the predicate fails
* @param callable(string): ValidationFail[] $errorsFactory a factory function with signature `(string) => array` to emit failures when the predicate fails
*/
*/
public function __construct(callable $predicate, callable $errorsFactory) {
public function __construct(callable $predicate, callable $errorsFactory) {