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>
The data in this commit has been gathered, scrapped, organized and
treated based on the Emoji Unicode V11 specification [1].
[1]: https://unicode.org/Public/emoji/11.0/emoji-test.txt
Co-authored-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>
The "--EXPECTF--" is supposed to be used when the output of "--FILE--"
is random. In many cases, we are using "--EXPECTF--" section while we
could use "--EXPECT--" instead.
This commit will replace the usages of "--EXPECTF--" by "--EXPECT--"
when the output does "--FILE--" is not random.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
Because some classes extend the "Regex" class this commit will also
change the implementation of those classes to use "Regex" by composition
instead of extending the class.
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
While making sure that Validation uses PHP strict types [1] the compared
value in the "Contains" rule was cast to string. That is problematic
when someone wants to enforce the operation to compare if the input has
a value identical to the expected value.
This commit will fix that by not casting the expected value but also
make sure that string comparison will not be used when it's not a
string.
[1]: ef975629f3
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit will do many different things, but they are all improvements
to the "Ip" rules:
* Remove passing variables by reference: the "Ip" class uses that a lot
to define the start address, end address, and the mask used to
validate a network range;
* Remove double-typed argument from the constructor: the class "Ip"
class has only one argument that can be either a string with the range
of the IP or an integer with options for the "filter_var()" function.
This commit will split it into two different arguments, each of them
used for one of this functionalities;
* Update documentation to show how to validate IPv6.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
Because traits are behaviors that are added to a class, it makes sense
to name them with the behavior that they add the classes that use them.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
The documentation about custom rules does not specify that creating an
exception for the rule is necessary. This commit will add that to the
documentation with an example to make it explicit.
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
Due to the current status of the development of the library, it seems
like we will be supporting version 1.1 for a long time. Even when we
release version 2.0 we will still give support for version 1.1 for a
while.
This commit will make sure that version 1.1 is fully supported for PHP
7.2 and 7.3. Also, it will remove the support for HHVM since it will not
keep the compatibility with PHP anymore [1].
In order to make that happen, this commit will create a TestCase from
Validation so we can use the same API to create mocks in both PHPUnit
versions 4.0 and 5.0.
During the development of this commit, I noticed that PHPUnit 4.0 had
issues to mock "SplFileInfo" and for that reason, this commit will also
replace those mocks by "SplFileInfo" instances.
[1]: https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
All the PHP files have the "@author" annotation to make clear which
people have contributed to that specific file, however, there is no such
thing in the PHPT files.
This commit will add the "CREDITS" section to the PHPT files. The list
of authors is created from the output of the `git blame` command.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
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>
Some classes and one trait had some mismatch values for their "@author"
annotation and this commit will fix the mismatch putting the correct
authors.
I used the "git blame" command to find out which people changed the file
and created a list based on that information.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
The argument "parameters" which is meant to give the wrapped rule's
exception some extra information does not always need to be defined, for
example when the exception does not need any parameter.
The current version of "AbstractEnvelope" required that argument and the
rules that are extending this class are passing an empty array.
This commit will make the "parameters" argument optional. As an extra,
it will make sure the tests from the children of "AbstractEnvelope" are
also covering their parent.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
Removes the errant space in the CA PostalCode regex.
This space was introduced by 5a067fa.
It also adds unit tests for the CA PostalCode to validate
the fix.
Reviewed-by: Emmerson Siqueira <emmersonsiqueira@gmail.com>