laminas / laminas-validator

Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria
https://docs.laminas.dev/laminas-validator/
BSD 3-Clause "New" or "Revised" License
126 stars 55 forks source link

Refactor `AbstractValidator` #358

Closed gsteel closed 2 months ago

gsteel commented 2 months ago
Q A
Documentation yes
BC Break yes
QA yes

Description

Removes methods from TranslatorAwareInterface and the implementations in AbstractValidator:

Leaving only setTranslator and getTranslator

Enabling and disabling translation can be done via options. The getters are unnecessary.

Removes methods from AbstractValidator:

Reduces the API surface of AbstractValidator making a number of previously protected methods private.

Removes abstractOptions property in favour of protected or private instance properties.

Remove a number of useless tests that verified the content of internal properties, i.e. ensuring that messageTemplates were identical to the declaration.

Appends the options relevant to the abstract class such as translator, messages etc to all the options declarations in concrete validators. Psalm does not support unions of array shapes in type declarations.

Adds more types: Down to ~230 psalm issues and 99.2% type coverage

gsteel commented 2 months ago

Need to look at docs - also tests are failing because of the Upload validator: See #347