Commit graph

34 commits

Author SHA1 Message Date
Alexandre Gomes Gaigalas 727e7ccbfa Increase phpstan level from 7 to 8
- Fixed all phpstan errors and ignoreds.
 - False positives now have a "Why:" comment on phpstan config.
2023-02-19 00:19:10 -03:00
Alexandre Gomes Gaigalas ab3732f91f Use SPDX IDs for licensing
SPDX IDs are shorter than licensing notes previously used, and
adhere better to FOSS standards. It is also machine-readable.
2023-02-19 00:19:10 -03:00
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 642602fd43
Update version of PHPStan packages
Some amazing features had to be ignored because it conflicts with out
coring standards. I hope to soon fix them so we can use PHPStan to its
fullest potential.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-07-25 22:50:59 +02:00
Henrique Moody 3145426472
Update version of "respect/coding-standard"
With that update, we will be fully following PSR-12.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-07-21 22:54:41 +02: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 c60ca7937b
Update the Coding Standards
This commit will add a couple of rules that we already use but also
introduce new ones and make sure all the code is in accordance with the
new coding standards.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-17 19:52:26 +01:00
Henrique Moody e8a50ea31b
Apply "SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-09 14:20:47 +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 d72d247ddc
Apply "SlevomatCodingStandard.ControlStructures.EarlyExit"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-09 14:13:06 +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 4519739f8b
Increate PHPStan level to 6
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-04 01:09:49 +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 f52097075b
Increase PHPStan level to 2
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-04 00:29:13 +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 a1bc0cd6b4
Apply contribution guidelines to "NestedValidationException"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-08-02 11:11:04 +02:00
Henrique Moody 3ad35ed545
Remove unneessary information from iterator
In the iterator in the "NestedValidationException" the only information
that is necessary is the depth of the message, for that reason all the
other information can (and should) be removed.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-08-02 11:09:30 +02:00
Henrique Moody 0cdd8c4546
Fix issues after merging 1.1
These two branches are very different, therefore merging is becoming
very hard.

I decided to not put these changes together with 5750952 because it
seems easy to track these changes with a specific commit.

While working on this merge I realized that would make more sense to
create "AbstractComparison" to handle the rules that compare values.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-08-01 20:46:34 +02:00
Henrique Moody 57509520a4
Merge branch '1.1' 2018-08-01 20:22:37 +02:00
Wojciech Frącz 83bb6e3fc9
Fix wrong behavior when using templates
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>
2018-07-02 07:57:21 +02:00
Henrique Moody 4fdd2da19e
Fix wrong behavior with nested exceptions
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>
2018-06-29 00:50:27 +01:00
Henrique Moody 71ecea32e6
Make getMessages() return the names or ids as keys
This method change the behavior of "getMessages()" by changin the keys
of its return to the "id" of the specific exception that was triggered.

It also allows users to overwrite the templates by passing an array to
it.

This is being requested by many users for a long time. It took that long
because I was thinking too much about how to improve the old method
called "findMesssage()" that I didn't realize that it could be done in a
easier way with the "getMessages()".

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-05-28 08:38:30 +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 64ec329663
Remove findMessages() from NestedValidationException 2018-05-27 16:12:05 +02:00
Tim Bond 4c996258a1
Update NestedValidationException doc block 2018-05-19 16:19:16 +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
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
Bartłomiej Krukowski c9b78789a7 Invalid doc comment 2017-01-23 12:42:47 +01:00
Henrique Moody 4d72af312f
Update PHP-CS-Fixer settings 2016-10-30 10:39:23 +01:00
Henrique Moody 98050476c6
Always return a valid exception
If calling the method `getExceptionForPath()` when the exception was
nested but had no child it was returning null. This commit ensures that
it always return a valid exception.
2016-09-19 18:22:39 +02:00
Henrique Moody 4bcc4027f8
Try to use the getRelatedByName() method first
Then using the `findMessages()` method, tries to use the method
`getRelatedByName()` before using the `findRelated()` method.

This change was made because since on `KeyNested` rule you may have
names with '.' we'll never get the proper exception using
`findRelated()`.
2016-09-17 21:11:55 +02:00
Henrique Moody 98443bad0c
Get the proper exception when using findMessage() 2016-09-17 21:04:24 +02:00
Henrique Moody 67e072ebd3 Remove "NestedValidationExceptionInterface" 2015-10-23 09:00:18 -02:00
Henrique Moody 04db93bdad Remove prefix "Abstract" of non-abstract classes 2015-10-23 09:00:08 -02:00
Renamed from library/Exceptions/AbstractNestedException.php (Browse further)