This commit will update the list of postal codes using the command
below:
curl -L http://download.geonames.org/export/dump/countryInfo.txt |
sed 's,\t,\;,g' |
sort --unique |
cut --delimiter ';' --field 1,15 |
sed --regexp-extended "/^#/d; /^[A-Z]{2}\;$/d; s,([A-Z]{2})\;(.+),'\1' => '/\2/'\,,g"
The changes that broke existing tests were reverted.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
According to Wikipedia[1]:
> Postal codes in Armenia consist of four digits. Until April 1, 2006,
> they consisted of six digits.
[1]: https://en.wikipedia.org/wiki/Postal_codes_in_Armenia
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
According to Wikipedia[1]:
> A postal code typically consists of an island code, a hyphen
> separator, and a section code.
>
> There are only three island codes: KY1 for Grand Cayman, KY2 for
> Cayman Brac, and KY3 for Little Cayman.
[1]: https://en.wikipedia.org/wiki/Postal_codes_in_the_Cayman_Islands
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
According to Wikipedia [1]:
> Until February 2013, Israel postal codes were 5-digit. Officially the
> 5-digit codes remained valid until 31 January 2013, though they
> continue to be widely used.
This commit changes the "PostalCode" rule to allow either 5 or 7 digits.
[1]: https://en.wikipedia.org/wiki/List_of_postal_codes
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
The intention of the "assert()" method is to show all the errors that a
given input may have. The implementation of the "assert()" method in the
"Each" rule, on the other hand, only reports the first error of each
element of the input.
This commit makes "Each" show all the validation failures of each
element of the input. Also, the implementation of
"AbstractRule::check()" is simply a proxy for the "assert()" method,
and since the "Each" rule extends that class, this commit creates a
custom implementation of the "check()" method.
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
The "Call" validator, the "assert()" and "check()" methods, define a
custom error handler so it can handle the validation in case of a PHP
error. However, it does not restor the previous error handler when the
validation fails.
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
Since there will still be secutiry support until 30 Nov 2020 and there
was something happening in Travis when generating coverage with newer
versions of PHP which I'm not in the mood to debug, I decided to change
the support again, this time to version 7.2.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
I don't know whether the next version will be a MINOR or a MAJOR
version, therefore it makes no sense to keep an alias for "dev-master".
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
I am about to release version 2.0, and it's been way too much time since
I created a MINOR or MAJOR version.
Because I don't know when will be the next time I will release the next
version and it is troublesome to keep support to old PHP versions, I
decided to only give support to the versions PHP is actively supporting.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
The method "current()" from NestedValidationException can return any
instance of ValidationException, but the implementation of
"getChildren()" requires it to return an instance of
"NestedValidationException".
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit will revert the update of subdivision codes [1] since the
way we store this data is very different from the merged branch.
[1]: 8b8f7db713
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
To update the list of subdivisions, I decided to use the iso-codes [1]
instead of GeoNames [2] as it seems like that one is more often updated.
This commit will also create a Bash script to update that list in the
future.
[1]: https://salsa.debian.org/iso-codes-team/iso-codes
[2]: http://www.geonames.org/
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
To update the list of countries, I decided to use the iso-codes [1]
instead of GeoNames [2] as it seems like that one is more often updated.
This commit will also create a Bash script to update that list in the
future.
[1]: https://salsa.debian.org/iso-codes-team/iso-codes
[2]: http://www.geonames.org/
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
There is quite some duplication between the "README.md" file and the
"docs/index.md". This commit will separate what belongs to the
documentation and what is specific of the repository.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
We have seen users that want to change the default behavior of parameter
stringifier:
* Change the depth level shown from an array.
* Change the number of elements shown from an array.
* Not add quotes to some parameters.
Because of that, this commit will allow users to customize the parameter
stringifier.
This commit will also update the documentation to instruct how to
customize it.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
There should not be too much code in the ValidationException. It is hard
to test and debug code in exceptions because PHP does not trace further
than their constructor.
This commit will move the message formatting from ValidationException
into a Formatter class (inside a Message namespace).
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>