Commit graph

17 commits

Author SHA1 Message Date
Henrique Moody c946f16f60
Move mixin classes to the "Mixin" namespace
Just to make the root directory cleaner.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-03-03 16:52:29 +01:00
Henrique Moody 2b59e3df49
Only pass the necessary parameters to the exceptions
Currently, we convert the properties of a rule into parameters and pass
them to the exceptions. That complicates things for a few reasons:

1. The exception knows too much: there's a lot of information in an
   object, and the exception would only need a few parameters to work
   correctly.

2. Any variable change becomes a backward compatibility break: if we
   change the name of the variable type in a rule, even if it's a
   private one, we may need to change the template, which is a backward
   compatibility break.

3. The factory is bloated because of introspection tricks: it reads the
   properties from the class, even from the parent, and then passes it
   to the exception.

Of course, that means we introduce another method to `Validatable`, but
in most cases, extending `AbstractRule` is enough to create a new rule.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-01-29 23:30:38 +01:00
Henrique Moody bd953f99f0
Ignore PHPStan errors
I want to get the build green. Currently, PHPStan is complaining about a
couple of issues that are not so critical. It's especially concerning
that strict_types must be the very first statement on PHPT files, but
that's fine since PHPUnit parses its content.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-01-27 20:04:16 +01:00
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
Henrique Moody be7e6672a1
Remove ignored error from PHPStan
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2021-03-19 15:12:43 +01:00
Henrique Moody 44a60f67d9
Fix PHPStan issues
This commit will fix an issue but ignore two of them because it will
require some refactoring that won't be possible in a PATCH version.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2021-02-06 12:51:56 +01:00
Henrique Moody d532e942a5
Create mixin with rules names as methods
One of the reasons for this change is to spare some space on the
Validator class, leaving only real code there. However, the biggest
reason is that IDEs can auto-complete rules after Validator creates the
first rule.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-10-04 13:04:20 +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 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 d00ed89f3c
Apply "phpstan/phpstan-phpunit" rules
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-05-05 15:04:56 +02:00
Henrique Moody 985b6fac25
Increate PHPStan level to 7
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-04 01:12:08 +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 103a47e134
Increate PHPStan level to 5
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-02-04 00:49:35 +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
Gus Antoniassi b392fbb92e
Apply contribution guidelines to "SymbolicLink" rule
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
2018-12-06 20:56:51 +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