When a template is set for a chain of rules, does not really matter
which messages the chain can have, the only message to be used should be
the one based on the defined template.
This commit set the same template of a parent rule to its children's
exception. Our first thought was to set the template to its children
however that would mean that if another rule would be added to the chain
we would have to set it as well. Doing that to the children's exception
make sure we only do that once.
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
Use the same condition to not include child exception into the iterator
to also not show the message of the main exception when using
"getFullMessage()".
The method created to validate that condition should probably be in the
"ValidationException" itself, but this commit is meant to be a bug fix,
which will be released in a PATH version, and creating this public
method would imply that a MINOR version should be released.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
The commit 54d17ab tried to fix the that "IntVal" would pass with values
that are not considered as an integer, but it does not change
Even thought the commit 54d17ab fixes part of the wrong behaviour it
left out the filter for boolean values.
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
Also removed the possibility of validating keys once it's possible to
reach the same behavior by combining this rule with "Call" rule.
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
Values like "500.00" or 1.0 should not be considered as integer values
even though there is no data loss when they're converted to integer.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
The "IpException" was triggering an error when the parameters
"networkRange" or "min" were not defined.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
Currently the build is failing because "friendsofphp/php-cs-fixer" does
not support PHP 7.3, but since we do not execute it in PHP 7.3 we can
ignore it for now.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
Also introduce "uopz" extension in order to create tests for "Uploaded"
rule.
Signed-off-by: Paul Karikari <paulkarikari1@gmail.com>
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
Also add integration test for Type rule.
Signed-off-by: Paul Karikari <paulkarikari1@gmail.com>
Co-Authored-By: Henrique Moody <henriquemoody@gmail.com>
Also check if input is scalar before validation.
Signed-off-by: Paul Karikari <paulkarikari1@gmail.com>
Co-Authored-By: Henrique Moody <henriquemoody@gmail.com>
The "AbstractSearcher" already does most of the job that "CountryCode"
was doing, so using it as parent class made more sense. That also makes
the validation case-sensitive which is not a problem since the standard
ISO 3166-1 in fact enforces an specific case for the country codes.
The documentation about the rule is also updated.
Co-Authored-By: Henrique Moody <henriquemoody@gmail.com>
Some codes in the documentation were not code that actually works which
can lead to some confusion of how to use Validation.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
Also change the constructor of the rule to accept charsets as arguments
instead of being either an array or a string.
Co-Authored-By: Henrique Moody <henriquemoody@gmail.com>