chore: Аннотации к типам

This commit is contained in:
origami11@yandex.ru 2025-10-30 12:59:36 +03:00
parent 5e8958969f
commit f964472e62
28 changed files with 140 additions and 36 deletions

View file

@ -7,6 +7,7 @@ abstract class AbstractRule
{
public string $field;
protected ?string $errorMsg;
/** @var object */
protected $ctx;
public function __construct(string $field, ?string $errorMsg = null)
@ -46,6 +47,9 @@ abstract class AbstractRule
return true;
}
/**
* @param object $ctx
*/
public function setContext($ctx): void
{
$this->ctx = $ctx;

View file

@ -17,6 +17,10 @@ class Count extends AbstractRule
return "Количество записей должно быть не менне {$this->size} и не более {$this->max}";
}
/**
* @param string $s
* @return bool
*/
function notEmpty($s): bool {
return $s != "";
}

View file

@ -9,6 +9,7 @@ use ctiso\Validator\Rule\AbstractRule,
class MatchRule extends AbstractRule
{
/** @var string */
public $same;
public function getErrorMsg(): string

View file

@ -147,7 +147,7 @@ class Validator
return $this->isValid();
}
public function addError(string $name, string $message)
public function addError(string $name, string $message): void
{
$this->errorMsg[$name] = $message;
}