myth-auth
myth-auth copied to clipboard
Deprecate Validator Class
BaseValidator
and ValidatorInterface
provide almost identical offerings. One of these should be deprecated, depending on whether the intent. Either:
- keep the base, adding
abstract public function check()
(less restriction, more changes elsewhere) - keep the interface, possibly convert the base to an optional trait
Either solution should account for the following:
- The interface still uses
CodeIgniter\Entity
which is deprecated - The interface method specifies
Entity
input when most validators requireUser
-
PasswordValidator
is not a valid interface class because of 2)
Maybe keep them both and use an interface to specify the contract and an abstract class as just one implementation thereof?
Shield has figured this out, it would probably make sense to imitate the solution there: https://github.com/codeigniter4/shield/tree/develop/src/Authentication/Passwords
So we should modify ValidatorInterface.php :
- Replace use CodeIgniter\Entity with Myth\Auth\Entities\User
- Replace public function check(string $password, ?Entity $user = null): bool method with public function check(string $password, ?User $user = null): bool
- Do all necessary changes to all validators to use User class instead of Entity class.
Is that's all or am i missing something else?