Move mixin classes to the "Mixin" namespace

Just to make the root directory cleaner.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
Henrique Moody 2024-03-03 16:42:36 +01:00
parent cea77d2a46
commit c946f16f60
No known key found for this signature in database
GPG key ID: 221E9281655813A6
5 changed files with 10 additions and 12 deletions

View file

@ -7,9 +7,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Respect\Validation; namespace Respect\Validation\Mixins;
use finfo; use finfo;
use Respect\Validation\Validatable;
interface ChainedValidator extends Validatable interface ChainedValidator extends Validatable
{ {

View file

@ -7,9 +7,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Respect\Validation; namespace Respect\Validation\Mixins;
use finfo; use finfo;
use Respect\Validation\Validatable;
interface StaticValidator interface StaticValidator
{ {

View file

@ -17,6 +17,8 @@ use Respect\Validation\Message\Formatter;
use Respect\Validation\Message\StandardFormatter; use Respect\Validation\Message\StandardFormatter;
use Respect\Validation\Message\StandardRenderer; use Respect\Validation\Message\StandardRenderer;
use Respect\Validation\Message\Template; use Respect\Validation\Message\Template;
use Respect\Validation\Mixins\ChainedValidator;
use Respect\Validation\Mixins\StaticValidator;
use Respect\Validation\Rules\AbstractRule; use Respect\Validation\Rules\AbstractRule;
use Respect\Validation\Rules\AllOf; use Respect\Validation\Rules\AllOf;
@ -25,6 +27,7 @@ use function current;
/** /**
* @mixin StaticValidator * @mixin StaticValidator
* @mixin ChainedValidator
*/ */
#[ExceptionClass(NestedValidationException::class)] #[ExceptionClass(NestedValidationException::class)]
#[Template( #[Template(

View file

@ -12,16 +12,6 @@ parameters:
message: '/Instanceof between mixed and SimpleXMLElement will always evaluate to false\./' message: '/Instanceof between mixed and SimpleXMLElement will always evaluate to false\./'
path: library/Rules/ArrayVal.php path: library/Rules/ArrayVal.php
-
# Why: This error is intentional, so PHPunit can test an invalid __callStatic call
message: '/Call to an undefined static method Respect\\Validation\\Validator::iDoNotExistSoIShouldThrowException/'
path: tests/unit/ValidatorTest.php
-
# Why: StaticValidator is a stub interface that types __callStatic
message: '/Call to static method PHPUnit\\Framework\\Assert::assertSame\(\) with Respect\\Validation\\Validator and Respect\\Validation\\ChainedValidator will always evaluate to false./'
path: tests/unit/ValidatorTest.php
- -
# Why: I don't want to make changes to the code just to make phpstan happy # Why: I don't want to make changes to the code just to make phpstan happy
message: '/Parameter #2 \$values of function vsprintf expects array<bool\|float\|int\|string\|null>, array<string, array<bool\|int\|string>\|bool\|float\|int\|string> given./' message: '/Parameter #2 \$values of function vsprintf expects array<bool\|float\|int\|string\|null>, array<string, array<bool\|int\|string>\|bool\|float\|int\|string> given./'

View file

@ -27,6 +27,8 @@ final class ValidatorTest extends TestCase
public function invalidRuleClassShouldThrowComponentException(): void public function invalidRuleClassShouldThrowComponentException(): void
{ {
$this->expectException(ComponentException::class); $this->expectException(ComponentException::class);
// @phpstan-ignore-next-line
Validator::iDoNotExistSoIShouldThrowException(); Validator::iDoNotExistSoIShouldThrowException();
} }
@ -35,6 +37,7 @@ final class ValidatorTest extends TestCase
{ {
$validator = Validator::create(); $validator = Validator::create();
// @phpstan-ignore-next-line
self::assertSame($validator, $validator->not($validator->notEmpty())); self::assertSame($validator, $validator->not($validator->notEmpty()));
} }
} }