Skip to content

Commit

Permalink
Move mixin classes to the "Mixin" namespace
Browse files Browse the repository at this point in the history
Just to make the root directory cleaner.

Signed-off-by: Henrique Moody <[email protected]>
  • Loading branch information
henriquemoody committed Mar 3, 2024
1 parent cea77d2 commit c946f16
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

declare(strict_types=1);

namespace Respect\Validation;
namespace Respect\Validation\Mixins;

use finfo;
use Respect\Validation\Validatable;

interface ChainedValidator extends Validatable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

declare(strict_types=1);

namespace Respect\Validation;
namespace Respect\Validation\Mixins;

use finfo;
use Respect\Validation\Validatable;

interface StaticValidator
{
Expand Down
3 changes: 3 additions & 0 deletions library/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Respect\Validation\Message\StandardFormatter;
use Respect\Validation\Message\StandardRenderer;
use Respect\Validation\Message\Template;
use Respect\Validation\Mixins\ChainedValidator;
use Respect\Validation\Mixins\StaticValidator;
use Respect\Validation\Rules\AbstractRule;
use Respect\Validation\Rules\AllOf;

Expand All @@ -25,6 +27,7 @@

/**
* @mixin StaticValidator
* @mixin ChainedValidator
*/
#[ExceptionClass(NestedValidationException::class)]
#[Template(
Expand Down
10 changes: 0 additions & 10 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ parameters:
message: '/Instanceof between mixed and SimpleXMLElement will always evaluate to false\./'
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
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./'
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public function staticCreateShouldReturnNewValidator(): void
public function invalidRuleClassShouldThrowComponentException(): void
{
$this->expectException(ComponentException::class);

// @phpstan-ignore-next-line
Validator::iDoNotExistSoIShouldThrowException();
}

Expand All @@ -35,6 +37,7 @@ public function shouldReturnValidatorInstanceWhenTheNotRuleIsCalledWithArguments
{
$validator = Validator::create();

// @phpstan-ignore-next-line
self::assertSame($validator, $validator->not($validator->notEmpty()));
}
}

0 comments on commit c946f16

Please sign in to comment.