Commit graph

13 commits

Author SHA1 Message Date
Alexandre Gomes Gaigalas 15f148da24 Dusting off. See CHANGELOG.md for more details on this commit 2023-02-13 03:59:11 -03:00
Henrique Moody ef8a8f4b27
Turn LICENSE file into plain/text
There is no need for that file to be a Markdown, and it can be a plain
text file.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-05-23 16:21:34 +02:00
Henrique Moody f3bc39066b
Make default templates non-static and protected
The only reason why those templates are static is so users can overwrite
the exception messages. That was useful when we didn't have a handy
translator, but now that we can define a translator through the Factory,
this is not needed anymore.

Besides, having those properties public adds complexity to the code.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-05-12 09:57:07 +02:00
Henrique Moody 6040ddee42
Fix the case of the "@inheritDoc" tag
According to the official documentation [1] the correct way of writing
the "inheritDoc" tag is with the uppercase "D".

[1]: https://docs.phpdoc.org/guides/inheritance.html

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-04-05 19:02:12 +02:00
Henrique Moody 3601adf6db
Create "FilteredValidationException" class
All the classes that were extending "AbstractFilterRule" were throwing
exceptions that were extending "AlphaException". That can cause some
issues when the user has a validation chain with "Alpha" and another
child of "AbstractFilterRule" and expects "AlphaException" specifically.

This commit creates "FilteredValidationException" that can be used as
the parent of the exceptions thrown by rules that extend the class
"AbstractFilterRule".

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-09-11 11:02:17 +02:00
Henrique Moody 779c0c1503
Do not accept whitespace by default in "Alnum" rule
The "Alnum" rule is supposed to validate alphanumeric values, but
instead, it also validates any whitespace character as valid.

The rule also accepts a list of characters on its constructor, so it the
users intentionally want some specific characters to also be allowed it
is better than they also defined these characters on the rule's
constructor.

While refactoring the rule I could notice that "AbstractCtypeRule" is
just an overhead that does not add much to it, so instead of extending
it "Alnum" now extends "AbstractFilterRule" directly (which is the
parent of "AbstractCtypeRule").

And since we want all rules to follow our contribution guidelines, this
commit also make sure the "Alnum" rule is in accordance with that.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-09-04 00:05:24 +02:00
Henrique Moody ef975629f3
Changes on PHP-CS-Fixer configuration
Because of `declare(strict_types=1)` some changes were necessary.
2018-01-04 17:59:37 +01:00
Henrique Moody 9c49dd3bcf Use short array syntax 2015-10-17 22:56:32 -03:00
Henrique Moody 748b280c34 Update conversion to strings on exceptions
Many changes were made on `ValidationException::stringify`:
- Add support for instances of `Exception`;
- Add support for instances of `Traversable`;
- Add support for resources;
- Improve `Array` conversion;
- Improve `Object` conversion;
- Improve conversion of all values by using JSON.

Now, all the parameters of the exception classes are just converted to
string when replacing parameters on exceptions, so the exception classes
now keep the original value of all parameters.
2015-09-04 17:11:40 -03:00
Henrique Moody a3c945aa51 Add license information and copyright in all files 2015-06-08 12:09:25 -03:00
Henrique Moody b8c76e3054 Fix some coding standards 2015-06-08 11:51:45 -03:00
Henrique Moody da193b75e0 Use PSR-2 standard
Most changes was made by php-cs-fixer.
Also removes unused `RecursiveTreeIterator` class.
2015-01-08 00:44:12 -02:00
Graham Campbell ae056920b4 PSR-4 autoloading 2014-07-12 20:20:43 +01:00
Renamed from library/Respect/Validation/Exceptions/AlnumException.php (Browse further)