We currently use a GitHub action to automate updating this file.
That action has the ability to ignore making the PR if the file
didn't changed.
Having the version number, which changed a line, was causing
several useless PR.
Users can still check if Tld.php changed by seeing the git log,
and a manual note should be issued by the maintainer on the
CHANGELOG.md file when a release containing such changes is
made.
The `filter_var` function is more of a sanitizer, but we as
a validation library do not care for that use case.
We should treat its sanitizings as a signal for checking if
the type after sanitization matches the option provided.
This fixes#1387
[`json_validate` function](https://wiki.php.net/rfc/json_validate)
[added in PHP 8.3](https://php.watch/versions/8.3/json_validate) validates a
given string input to contain valid JSON without decoding it in memory.
This adds a function availability check to `Rules\Json`, and uses the new
function instead of decoding the given input, followed by a last-error check.
The functions from the mbstring can deal find with strings without
forcing an specific encoding. However, sometimes "mb_detect_encoding()"
cannot identify the encoding therefore the functions that expect a valid
encoding will trigger a PHP error.
This commit will remove the unnecessary use of "mb_detect_encoding()."
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
We could simply add version 3.0 instead of replacing it, but I would
like to stimulate people to keep their libraries up-to-date.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
Since we already have that library as a dependency of our repository, it
makes sense to use it as a source of country codes instead of keeping a
list of currencies ourselves.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
Since we already have that library as a dependency of our repository, it
makes sense to use it as a source of language codes instead of keeping a
list of currencies ourselves.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
Since "sokil/php-isocodes" is a dependency of our repository already, it
makes sense to use it as a source of currency codes instead of keeping a
list of currencies ourselves.
By using that library, we can also validate currency codes using
different sets.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
Inside the "data/" directory, we have files with lists of subdivisions
that need to be updated. We have to update them manually, or we automate
that task with a script and GitHub actions.
The two options are very time consuming and also not ideal. We don't
want to deal with that problem and, thinking that the user of this
library may want to show the data that we validate, we should create a
whole library to make it more usable.
The "sokil/php-isocodes" is a simple library that, even supports
translations. It's frequently updated and has gone to major performance
updates.
I am not fond of the idea of requiring an external library to install
Validation, as I have seen that gone wrong before [1]. Ideally, that
would be an optional dependency for people who would like to use those
rules, but to make that happen, we need to release a MAJOR version.
[1]: d072b4de6a
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
We have three workflows that automatically update the code. They are
using version 2.0 as a base to create their changes. We need to update
that because the last supported version is 2.1.
Since I do not think it is a good idea to change code every time a new
MINOR version is released, I moved that value to a repository secret.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit will fix an issue but ignore two of them because it will
require some refactoring that won't be possible in a PATCH version.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>