Commit graph

95 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 4c21a7ffc9
Revert "Use "sokil/php-isocodes" on SubdivisionCode"
This reverts commit 9c9c76ebfb.
2021-03-19 15:12:45 +01:00
Henrique Moody 3dcd859d98
Upgrade supported version of "egulias/email-validator"
We could simply add version 3.0 instead of replacing it, but I would
like to stimulate people to keep their libraries up-to-date.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2021-02-06 16:29:39 +01:00
Henrique Moody 9c9c76ebfb
Use "sokil/php-isocodes" on SubdivisionCode
Inside the "data/" directory, we have files with lists of subdivisions
that need to be updated. We have to update them manually, or we automate
that task with a script and GitHub actions.

The two options are very time consuming and also not ideal. We don't
want to deal with that problem and, thinking that the user of this
library may want to show the data that we validate, we should create a
whole library to make it more usable.

The "sokil/php-isocodes" is a simple library that, even supports
translations. It's frequently updated and has gone to major performance
updates.

I am not fond of the idea of requiring an external library to install
Validation, as I have seen that gone wrong before [1]. Ideally, that
would be an optional dependency for people who would like to use those
rules, but to make that happen, we need to release a MAJOR version.

[1]: d072b4de6a

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2021-02-06 15:09:04 +01:00
v0idpwn ff253c78b3
Allow file-related rules to validate PSR-7 interfaces
The PSR-7 has two interfaces that allow us to validate them as files.
This commit will allow some rules to validate those interfaces.

Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-10-04 12:03:22 +02:00
Henrique Moody f53b77a186
Add support for PHP 8.0
We already supported PHP 8.0 as our constrains in the "composer.json"
file was ">=7.3", but we were not testing it before.

Because of that, I found a bug on "EndsWith" which is fixed now.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-08-28 08:53:41 +02:00
Henrique Moody 72dd88144e
Update version of "respect/coding-standard"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-08-27 16:21:02 +02:00
Henrique Moody 5150428b27
Drop support for PHP 7.2
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-08-26 09:47:48 +02: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 b4ad2f6413
Change the PHP support to version 7.2 or aboce
Since there will still be secutiry support until 30 Nov 2020 and there
was something happening in Travis when generating coverage with newer
versions of PHP which I'm not in the mood to debug, I decided to change
the support again, this time to version 7.2.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-04-04 23:55:05 +02:00
Henrique Moody fb28332417
Remove version alias for "dev-master"
I don't know whether the next version will be a MINOR or a MAJOR
version, therefore it makes no sense to keep an alias for "dev-master".

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-04-04 23:29:52 +02:00
Henrique Moody f4593b7479
Drop support for PHP < 7.3
I am about to release version 2.0, and it's been way too much time since
I created a MINOR or MAJOR version.

Because I don't know when will be the next time I will release the next
version and it is troublesome to keep support to old PHP versions, I
decided to only give support to the versions PHP is actively supporting.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-04-04 23:23:23 +02:00
Henrique Moody 9a868f6e5f
Update "egulias/email-validator" version
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-04-04 22:12:06 +02:00
Henrique Moody 2a8b0770d6
Update "malukenho/docheader" version
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-04-04 22:11:04 +02:00
Henrique Moody 2fb08236c5
Update PHP_CodeSniffer version
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-04-04 22:10:00 +02:00
Henrique Moody 42300ef48e
Update PHPUnit version
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-04-04 21:06:23 +02:00
Henrique Moody 16376306f8
Use "Respect" coding standard
There are too many PHP_CodeSniffer configurations in this repository.

I have created "respect/coding-standard" to deal with all the
configuration so in this repository we only need to add "Respect" as our
PHP_CodeSniffer rule.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-05-11 20:51:39 +02:00
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 95b499b627
Apply "phpstan/phpstan-deprecation-rules" rules
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-05-05 15:18:09 +02:00
Henrique Moody 1303a935bf
Convert case of "mikey179/vfsstream" package
Package names in Composer should not contain uppercase characters, and
after the version 2.0, it will error.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-04-23 20:13:12 +02:00
Henrique Moody 166501804f
Refactor "Zend" rule
- Only create objects that are instantiable.

- Validate if validator is a valid Zend Validator after its creation.

- Parse messages from Zend Validator on "assert()" and "check()."

- Upgrade supported version of Zend Validator: version 2.0 has some PHP
  deprecations therefore there is no used to support it.

Co-authored-by: Danilo Correa <danilosilva87@gmail.com>
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-03-10 22:13:16 +01:00
Henrique Moody 0c4a278709
Add some code sniffs that we already use
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-09 14:07:47 +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 b7043b2652
Set up "squizlabs/php_codesniffer"
The tool we used to verify whether the code base has the correct coding
standard was removed [1].

This commit will set up one that works best for us and will also make
sure we have fully compliant to PS1 and PSR2.

[1]: ffec95acda

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-03 19:39:14 +01:00
Henrique Moody 2b86e5443e
Update paths of Composer scripts
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-03 19:01:12 +01:00
Henrique Moody ffec95acda
Remove PHP-CS-Fixer
It is not the first time that after a PHP-CS-Fixer upgrade our build
fails. Also, I've seemed a couple of files that have a wrong coding
standard, but PHP-CS-Fixer does not indicate failure for them.

This commit will remove the library as a dependency.

I plan to introduce PHP_CodeSniffer as soon as possible.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-03 16:26:23 +01:00
Danilo Correa b399bfe1c1
Create Composer scripts to help during development
This commit will create Composer scripts for commands that are
frequently used during the development of the library.

Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
2018-10-03 00:04:10 +02:00
Henrique Moody c7fcc09af6
Upgrade PHPUnit version
The changes you see in this commit had to be made due to the upgrade of
PHPunit version.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-09-03 17:37:44 +02: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 1da164a26e
Change how "Sf" rule works
Instead of creating the Symfony constraints itself "Sf" accepts an
instance of "Symfony\Component\Validator\Constraint".

Creating objects inside a rule, specially from an external library,
makes the rule too complex and also limits the possibilities with the
"Sf" rule since Symfony allows users to create complex validations (even
thought their API is not as simple as ours).

This commit also simplifies the way the messages are passed from Symfony
to the "Sf" when only one constraint has failed; instead of passing
the message of the whole constraint violation list, only the fist
constraint violation message it passed.

The problem that this rule will always have is that when using "Not" to
invert the validation we have a way to get a proper message since
Symfony Validator only return the result of constraints that failed.
That's something the Respect\Validation does in a similar way and to
change it a lot has to be changed.

These changes were checked in "symfony/validator" 4.0 and the version
was added to the "composer.json" file.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-08-22 17:46:21 +02:00
Burhan Ali f03a09aa24 Replace fabpot/php-cs-fixer with friendsofphp/php-cs-fixer
The fapbot version is abandoned accord to packagist and suggests the
friendsofphp version.
2018-03-08 13:11:30 +00:00
Henrique Moody a796d9e981
Update license to MIT 2018-03-03 19:06:38 +01:00
Henrique Moody fe3654b270
Improve RuleTestCase class
- Add documentation to the class and its methods;
- Move RuleTestCase to Test namespace;
- Use PHP 7 type hinting;
- Rename getRuleMock() to createValidatableMock().
2018-01-07 14:32:05 +01:00
Henrique Moody 2d7e2ea48f
Add "respect/stringifier" as dependency
Due to this change it was possible to identify that NotEmptyException,
and NotOptionalException where not working as they should. A fix was
made along with this commit.
2018-01-06 14:07:03 +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 0bb9b14658
Drop support for PHP 7.0 2018-01-03 11:09:02 +01:00
Gabriel Caruso 93ce9cb93a
Updated to PHPUnit 6 2017-11-12 14:22:22 +01:00
Henrique Moody d8e5f305a7
Remove "malkusch/bav" as a dependency
This packages is not maintained anymore, therefore it should be removed
from our codebase.
2017-11-12 13:59:05 +01:00
Henrique Moody 2f7a479b58
Add "ext-fileinfo" as suggestion 2017-04-11 11:27:21 +02:00
Henrique Moody 07a120d058
Upgrade "symfony/validator" version 2016-11-05 14:14:39 +01:00
Henrique Moody 867f12b8d3
Update version constraints on composer.json file 2016-11-05 14:14:38 +01:00
Henrique Moody 0512ff4866
Drop support for HHVM and PHP 5.6
Also make some improvements on .travis.yml file.
2016-11-05 13:20:07 +01:00
Henrique Moody f2bb77bb8e
Create tests for "egulias/email-validator" ~2.1 2016-10-29 15:37:09 +02:00
Jefersson Nathan e1678be8f2 Add license check by file to build
* composer require --dev malukenho/docheader
* Add license layout
* Add check license to the build
2016-10-29 12:31:13 +02:00
Henrique Moody d2efb6923f
Merge branch '1.1' 2016-09-17 23:00:41 +02:00
Henrique Moody d30b3d1b49
Merge branch '1.0' into 1.1 2016-09-17 22:59:31 +02:00
Henrique Moody 8b32270d28
Add "symfony/polyfill-mbstring" as a dependency 2016-09-17 22:30:35 +02:00
Henrique Moody 8b7f48c3b7 Upgrade PHPUnit version 2016-05-25 23:25:28 +02:00
Henrique Moody bc190e0eb0 Drop support for PHP <5.6 2016-05-06 11:12:56 +02:00