You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
825 B
PHP
34 lines
825 B
PHP
<?php
|
|
|
|
namespace jrosset\CliProgram\Validation\Validators;
|
|
|
|
/**
|
|
* An argument/option value validator
|
|
*
|
|
* @template TValue
|
|
*/
|
|
interface IValidator {
|
|
/**
|
|
* Get a valid default value from the initial/given default value
|
|
*
|
|
* @param mixed $default The initial/given default value
|
|
*
|
|
* @return string|bool|int|float|array|null The valid default value
|
|
*/
|
|
public function getValidDefault (mixed $default): string|bool|int|float|array|null;
|
|
|
|
/**
|
|
* Validate a value
|
|
*
|
|
* @param mixed $value The value to validate
|
|
*
|
|
* @return bool True if the value is valid, else False
|
|
*/
|
|
public function validate (mixed $value): bool;
|
|
/**
|
|
* Get the value, after it's validation
|
|
*
|
|
* @return TValue|null The value
|
|
*/
|
|
public function getValue ();
|
|
} |