Commit graph

29 commits

Author SHA1 Message Date
Henrique Moody 272f18dcf5
Apply "Symfony.Functions.ScopeOrder"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-05-11 20:00:19 +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 cd2390a9b0
Refactor "Domain" rule
The "Domain" rule duplicates a lot of its logic among the methods
"check()," "validate()," and "assert()." Such duplication makes it hard
to maintain and hard to understand.

Besides that:

- It triggers a PHP error when trying to validate a non-scalar value;

- It does not show the exceptions in the correct hierarchy;

- It allows to change the TLD validation after to object is created.

This commit will fix those issues and create better tests for the rule.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-04-05 18:57:22 +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 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 99b912ff87
Apply "SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-09 14:19:22 +01:00
Henrique Moody 3abf64f496
Apply "SlevomatCodingStandard.ControlStructures.RequireTernaryOperator"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-09 14:18:59 +01:00
Henrique Moody 880103c55f
Apply "SlevomatCodingStandard.Functions.StaticClosure"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-09 14:13:35 +01:00
Henrique Moody 7e3bf36f8d
Apply "SlevomatCodingStandard.ControlStructures.AssignmentInCondition"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-09 14:12:38 +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 8e59ec5d4a
Apply "Squiz.WhiteSpace.MemberVarSpacing"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-09 14:08:43 +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 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 258a456eec
Setup PHPStan (PHP Static Analysis Tool)
Require "phpstan/phpstan" for development and add to the Travis CI
configuration file to execute the analysis when Travis executes the
build with the version 7.2 of PHP.

The level of the configuration is very week for now (just "1") and still
quite some changes had to be made in order to make the analysis pass. I
hope it does not take much time to increase the level of the strictness
of the analyses.

I tried to configure that before but because of dependencies with
"symfony/validator" it was not possible.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-08-22 19:10:20 +02: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 c80524b457
Method assert() should not have a return value
One this method should throw an exception when the input is not valid,
returning `TRUE` when it succeeds is not really consistent.
2018-01-28 17:38:40 +01:00
Henrique Moody 30dc089565
Method check() should not have a return value
One this method should throw an exception when the input is not valid,
returning `TRUE` when it succeeds is not really consistent.
2018-01-28 17:38:40 +01:00
Henrique Moody ccf60f0ee3
Method validate() should always return a boolean 2018-01-28 17:38: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
Henrique Moody b10206bd28
Merge branch '1.1' 2018-01-02 22:57:58 +01:00
Henrique Moody c931e2504b
Change conditions for Domain validation
Domains can have `--` as long as they don't start or end with `-` in its
parts.
2018-01-02 22:24:43 +01:00
Henrique Moody 7ee4ae47d5
Rename "OneOf" to "AnyOf" 2017-02-05 12:28:08 +01:00
Henrique Moody f34a34c0b2
Always use mbstring functions 2016-10-30 10:45:30 +01:00
Henrique Moody 9c49dd3bcf Use short array syntax 2015-10-17 22:56:32 -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
Róbert Nagy 14d65f47ea Allow support for IDN with subdomains
I just moved the IDN rule from checks array to otherParts validation,
because the old approach did not supported an IDN with subdomain.
2015-01-03 12:29:52 -02:00
Graham Campbell ae056920b4 PSR-4 autoloading 2014-07-12 20:20:43 +01:00
Renamed from library/Respect/Validation/Rules/Domain.php (Browse further)