From c938580908064490229466f9822e580ffbd87e4e Mon Sep 17 00:00:00 2001 From: Ruben Van Assche Date: Wed, 21 Dec 2022 12:15:55 +0100 Subject: [PATCH] Rename RelativeRuleData --- ...RuleData.php => RelativeRuleGenerationData.php} | 2 +- src/Support/DataClass.php | 4 ++-- tests/ValidationTest.php | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) rename src/Contracts/{RelativeRuleData.php => RelativeRuleGenerationData.php} (58%) diff --git a/src/Contracts/RelativeRuleData.php b/src/Contracts/RelativeRuleGenerationData.php similarity index 58% rename from src/Contracts/RelativeRuleData.php rename to src/Contracts/RelativeRuleGenerationData.php index 32a75b45..9f4ba2d9 100644 --- a/src/Contracts/RelativeRuleData.php +++ b/src/Contracts/RelativeRuleGenerationData.php @@ -2,7 +2,7 @@ namespace Spatie\LaravelData\Contracts; -interface RelativeRuleData +interface RelativeRuleGenerationData { } diff --git a/src/Support/DataClass.php b/src/Support/DataClass.php index f281e57a..3d4c2e0e 100644 --- a/src/Support/DataClass.php +++ b/src/Support/DataClass.php @@ -11,7 +11,7 @@ use Spatie\LaravelData\Contracts\AppendableData; use Spatie\LaravelData\Contracts\DataObject; use Spatie\LaravelData\Contracts\IncludeableData; -use Spatie\LaravelData\Contracts\RelativeRuleData; +use Spatie\LaravelData\Contracts\RelativeRuleGenerationData; use Spatie\LaravelData\Contracts\ResponsableData; use Spatie\LaravelData\Contracts\TransformableData; use Spatie\LaravelData\Contracts\ValidateableData; @@ -71,7 +71,7 @@ public static function create(ReflectionClass $class): self validateable: $class->implementsInterface(ValidateableData::class), wrappable: $class->implementsInterface(WrappableData::class), attributes: $attributes, - relativeRuleGeneration: $class->implementsInterface(RelativeRuleData::class), + relativeRuleGeneration: $class->implementsInterface(RelativeRuleGenerationData::class), ); } diff --git a/tests/ValidationTest.php b/tests/ValidationTest.php index 306efed9..7c35ae49 100644 --- a/tests/ValidationTest.php +++ b/tests/ValidationTest.php @@ -10,7 +10,7 @@ use Spatie\LaravelData\Attributes\Validation\Min; use Spatie\LaravelData\Attributes\Validation\Required; use Spatie\LaravelData\Attributes\WithoutValidation; -use Spatie\LaravelData\Contracts\RelativeRuleData; +use Spatie\LaravelData\Contracts\RelativeRuleGenerationData; use Spatie\LaravelData\Data; use Spatie\LaravelData\DataCollection; use Spatie\LaravelData\Exceptions\CannotBuildRelativeRules; @@ -373,7 +373,7 @@ class NestedClassD extends Data { }); it('can use nested payloads in nested data', function () { - class NestedClassF extends Data implements RelativeRuleData + class NestedClassF extends Data implements RelativeRuleGenerationData { public bool $strict; @@ -599,7 +599,7 @@ class CollectionClassA extends Data { it('can nest data in collections using relative rule generation', function () { - class NestedClassH extends Data implements RelativeRuleData + class NestedClassH extends Data implements RelativeRuleGenerationData { public string $string; @@ -643,7 +643,7 @@ public static function rules(array $payload, ?string $path): array })->throwsIf(fn() => CannotBuildRelativeRules::shouldThrow(), CannotBuildRelativeRules::class); it('can nest data in classes inside collections using relative rule generation', function () { - class NestedClassJ extends Data implements RelativeRuleData { + class NestedClassJ extends Data implements RelativeRuleGenerationData { public string $string; #[Required] public bool $isEmail; @@ -697,7 +697,7 @@ class CollectionClassK extends Data { })->throwsIf(fn() => CannotBuildRelativeRules::shouldThrow(), CannotBuildRelativeRules::class); it('can nest data in deep collections using relative rule generation', function () { - class NestedClassL extends Data implements RelativeRuleData { + class NestedClassL extends Data implements RelativeRuleGenerationData { public string $deepString; #[Required] public bool $deepIsEmail; @@ -710,7 +710,7 @@ public static function rules(array $payload, ?string $path): array } } - class NestedClassM extends Data implements RelativeRuleData { + class NestedClassM extends Data implements RelativeRuleGenerationData { public string $string; #[Required] public bool $isEmail; @@ -820,7 +820,7 @@ public static function rules(array $payload , ?string $path): array it('can nest data using relative rule generation', function () { eval(<<<'PHP' use Spatie\LaravelData\Data; - class NestedClassI extends Data implements \Spatie\LaravelData\Contracts\RelativeRuleData { + class NestedClassI extends Data implements \Spatie\LaravelData\Contracts\RelativeRuleGenerationData { public string $string; #[\Spatie\LaravelData\Attributes\Validation\Required] public bool $isEmail;