Closed AlexOlival closed 3 years ago
InvalidLengthException is a good example of am internal exception with a nice DX for people contributing to the codebase. Clearly, our recent contributors know how to use it: https://github.com/reducktion/socrates/blob/4b6174df1e2e62091ed787e0dd2f23c953a383be/src/Core/SouthAmerica/Peru/PeruIdValidator.php#L65
InvalidLengthException
We can go a bit further though and document the constructor with each parameter being described in the constructor, rather than what we have now:
https://github.com/reducktion/socrates/blob/1278365b26451cb75bd5e4d703121dc6efeac492/src/Exceptions/InvalidLengthException.php#L28-L35
Additionally, we don't need a $designation field in the class, as it is not being used anywhere else.
$designation
InvalidLengthException
is a good example of am internal exception with a nice DX for people contributing to the codebase. Clearly, our recent contributors know how to use it: https://github.com/reducktion/socrates/blob/4b6174df1e2e62091ed787e0dd2f23c953a383be/src/Core/SouthAmerica/Peru/PeruIdValidator.php#L65We can go a bit further though and document the constructor with each parameter being described in the constructor, rather than what we have now:
https://github.com/reducktion/socrates/blob/1278365b26451cb75bd5e4d703121dc6efeac492/src/Exceptions/InvalidLengthException.php#L28-L35
Additionally, we don't need a
$designation
field in the class, as it is not being used anywhere else.