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>
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>
- 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>
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>
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>
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>
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>
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>
- Add documentation to the class and its methods;
- Move RuleTestCase to Test namespace;
- Use PHP 7 type hinting;
- Rename getRuleMock() to createValidatableMock().
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.
As the project already is installed via composer, this command
could save a few keystrokes!
Besides that, is just one command for all OS, because will not be
needed to change slashes to backslashes in Windows.
*X (21 keystrokes): `./vendor/bin/phpunit`
Windows (21 keystrokes): `.\vendor\bin\phpunit`
New (14 keystrokes): `composer test`
https://getcomposer.org/doc/articles/scripts.md#writing-custom-commands