_args = $args; } public function isValid(): bool { foreach ($this->_args as $value) if (!in_array(static::ALLOWED_VALUES, $value)) return false; return true; } } class NamesValidator extends AbstractValidator { //type could be omitted since it has to follow the parents signature protected const ALLOWED_VALUES = [ 'Mark', 'Bill', 'Dan' ]; } class InvalidNamesValidator extends AbstractValidator { //this would throw a TypeError protected const ALLOWED_VALUES = 0; }