Commit graph

22 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 b340b74cfd
Make classes final
The rules "AllOf," "NotEmpty," and "Xdigit" cannot be final because
other rules extend them.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-17 20:13:27 +01:00
Henrique Moody 99b912ff87
Apply "SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-09 14:19:22 +01:00
Henrique Moody cb24cc97d2
Apply "SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-09 14:12:05 +01:00
Henrique Moody c30603759e
Apply "SlevomatCodingStandard.TypeHints.TypeHintDeclaration"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-09 14:09:28 +01:00
Henrique Moody b007284857
Increate PHPStan level to 3
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-04 00:44:08 +01:00
Henrique Moody 9e7571fb98
Add missing "@author" annotations
This commit will make sure that every class, interface, or trait will
have the "@author" annotation in it.

In order to create a list of authors, I used the "git blame" command,
which means that if someone changed or even created the file but does
not have any remaining line will not be shown in the list; it's a
trade-off worth but it is worth it. The other way to do it would be
carefully checking each file.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-11-25 18:08:44 +01:00
Henrique Moody afab4eb2b4
Rename "Related" to "Child"
The "NestedValidationException" has exceptions that are its children.
However, we call them "related". This commit updates the term over the
library.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-08-02 11:18:33 +02:00
Henrique Moody 8c529c433e
Refactor ValidationException
Make the ValidationException a little bit less mutable than before. All
its dependencies are now passed into the constructor.

This commit also make the Factory pass the translator to the exceptions
allowing to define the translator before the exception gets created.
This change is not the ideal one, later I would like to not need the
Singleton from the Factory to do that, but for now it seems like a good
approach.

One more thing that this commit does is to introduce the "id" for
Exceptions. Key can be either the defined "name" or the name of the rule
that throwed the exception. This method will be handy to identify
exceptions better.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-05-27 16:12:05 +02:00
Henrique Moody d7ebb8c1a7
Remove "Interface" suffix from exceptions
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-05-27 16:12:05 +02:00
Henrique Moody d85668c359
Convert message keys to string
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-05-27 16:12:05 +02:00
Henrique Moody 5d0ecabfdc
Declare visibility for constants
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-05-27 16:12:05 +02:00
Henrique Moody b696070874
Refactor "KeySet" rule
Do not extend AllOf exception, but instead extend "AbstractWrapper".
2018-03-03 18:59:36 +01: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
Jonathan Stewmon 8851fb5abc
Always display message for AbstractRelated rule
`NestedValidationException` should include all `AbstractRelated` rule
exceptions.

`AbstractRelated` rule failures always indicate an interesting nested
context, which should not be omitted from the final result.

`NonOmissibleExceptionInterface` is a marker interface for
exceptions thrown by instances of `AbstractRelated`, which
facilitates identification of those rules' exceptions with
`instanceof`.
2017-03-27 10:21:45 +02:00
Henrique Moody 04db93bdad Remove prefix "Abstract" of non-abstract classes 2015-10-23 09:00:08 -02: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 7d9d19009a Create KeySet rule 2015-07-21 12:35:44 -03:00