From 0cb6dfa2a05a8dd4fc501dd4311e44328f72d3b7 Mon Sep 17 00:00:00 2001 From: Tom Wright Date: Fri, 3 Nov 2023 14:44:42 +0000 Subject: [PATCH] Formatted method argument spacing Signed-off-by: Tom Wright --- src/Constraint/Color/MaxLightness.php | 10 ++++++---- src/Constraint/Color/MaxSaturation.php | 10 ++++++---- src/Constraint/Color/MinLightness.php | 10 ++++++---- src/Constraint/Color/MinSaturation.php | 10 ++++++---- src/Constraint/Compass/Max.php | 10 ++++++---- src/Constraint/Compass/Min.php | 10 ++++++---- src/Constraint/Compass/Range.php | 10 ++++++---- src/Constraint/Compass/V4.php | 10 ++++++---- src/Constraint/Compass/V6.php | 10 ++++++---- src/Constraint/DateTime/Max.php | 10 ++++++---- src/Constraint/DateTime/Min.php | 10 ++++++---- src/Constraint/DateTime/Range.php | 5 +++-- src/Constraint/DefaultValue.php | 10 ++++++---- src/Constraint/Interval/Max.php | 10 ++++++---- src/Constraint/Interval/Min.php | 10 ++++++---- src/Constraint/Interval/Range.php | 5 +++-- src/Constraint/Number/Max.php | 10 ++++++---- src/Constraint/Number/Min.php | 10 ++++++---- src/Constraint/Number/Range.php | 5 +++-- src/Constraint/Required.php | 15 +++++++++------ src/Constraint/Sanitize.php | 10 ++++++---- src/Constraint/String/Emojis.php | 10 ++++++---- src/Constraint/String/MaxLength.php | 10 ++++++---- src/Constraint/String/MaxWords.php | 10 ++++++---- src/Constraint/String/MinLength.php | 10 ++++++---- src/Constraint/String/MinWords.php | 10 ++++++---- src/Constraint/String/Pattern.php | 10 ++++++---- src/Constraint/String/Trim.php | 10 ++++++---- src/Constraint/Validate.php | 10 ++++++---- src/ConstraintResolver.php | 5 +++-- src/Context.php | 5 +++-- src/Processor/BoolNative.php | 5 +++-- src/Processor/Camel.php | 5 +++-- src/Processor/Color.php | 5 +++-- src/Processor/Date.php | 5 +++-- src/Processor/Email.php | 10 ++++++---- src/Processor/FloatNative.php | 5 +++-- src/Processor/IntNative.php | 5 +++-- src/Processor/Interval.php | 5 +++-- src/Processor/Ip.php | 5 +++-- src/Processor/IpRange.php | 5 +++-- src/Processor/ListNative.php | 10 ++++++---- src/Processor/Name.php | 5 +++-- src/Processor/PathSlug.php | 5 +++-- src/Processor/Slug.php | 5 +++-- src/Processor/StringNative.php | 5 +++-- src/Processor/Url.php | 10 ++++++---- src/ProcessorTrait.php | 25 +++++++++++++++---------- src/Sanitizer/ValueContainer.php | 5 +++-- 49 files changed, 249 insertions(+), 166 deletions(-) diff --git a/src/Constraint/Color/MaxLightness.php b/src/Constraint/Color/MaxLightness.php index 78ce165..39be7c2 100644 --- a/src/Constraint/Color/MaxLightness.php +++ b/src/Constraint/Color/MaxLightness.php @@ -36,8 +36,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->max = (float)$param; return $this; } @@ -47,8 +48,9 @@ public function getParameter(): mixed return $this->max; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value === null) { return false; } diff --git a/src/Constraint/Color/MaxSaturation.php b/src/Constraint/Color/MaxSaturation.php index e8eda6f..c093b8f 100644 --- a/src/Constraint/Color/MaxSaturation.php +++ b/src/Constraint/Color/MaxSaturation.php @@ -36,8 +36,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->max = (float)$param; return $this; } @@ -47,8 +48,9 @@ public function getParameter(): mixed return $this->max; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value === null) { return false; } diff --git a/src/Constraint/Color/MinLightness.php b/src/Constraint/Color/MinLightness.php index f1bb0b3..5dc6873 100644 --- a/src/Constraint/Color/MinLightness.php +++ b/src/Constraint/Color/MinLightness.php @@ -36,8 +36,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->min = (float)$param; return $this; } @@ -47,8 +48,9 @@ public function getParameter(): mixed return $this->min; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value === null) { return false; } diff --git a/src/Constraint/Color/MinSaturation.php b/src/Constraint/Color/MinSaturation.php index f33a07f..07c44e8 100644 --- a/src/Constraint/Color/MinSaturation.php +++ b/src/Constraint/Color/MinSaturation.php @@ -36,8 +36,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->min = (float)$param; return $this; } @@ -47,8 +48,9 @@ public function getParameter(): mixed return $this->min; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value === null) { return false; } diff --git a/src/Constraint/Compass/Max.php b/src/Constraint/Compass/Max.php index c8f5a78..597f8c7 100644 --- a/src/Constraint/Compass/Max.php +++ b/src/Constraint/Compass/Max.php @@ -38,8 +38,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->max = Ip::parse($param); return $this; } @@ -49,8 +50,9 @@ public function getParameter(): mixed return $this->max; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ( $value === null || $this->max === null diff --git a/src/Constraint/Compass/Min.php b/src/Constraint/Compass/Min.php index 156f2f7..e1a6a13 100644 --- a/src/Constraint/Compass/Min.php +++ b/src/Constraint/Compass/Min.php @@ -38,8 +38,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->min = Ip::parse($param); return $this; } @@ -49,8 +50,9 @@ public function getParameter(): mixed return $this->min; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ( $value === null || $this->min === null diff --git a/src/Constraint/Compass/Range.php b/src/Constraint/Compass/Range.php index 0e5fc39..33061c5 100644 --- a/src/Constraint/Compass/Range.php +++ b/src/Constraint/Compass/Range.php @@ -39,8 +39,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->range = IpRange::parse($param); return $this; } @@ -50,8 +51,9 @@ public function getParameter(): mixed return $this->range; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ( $value === null || $this->range === null diff --git a/src/Constraint/Compass/V4.php b/src/Constraint/Compass/V4.php index 1062718..97f265f 100644 --- a/src/Constraint/Compass/V4.php +++ b/src/Constraint/Compass/V4.php @@ -37,8 +37,9 @@ public function getWeight(): int return 1; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->v4 = $param; return $this; } @@ -48,8 +49,9 @@ public function getParameter(): mixed return $this->v4; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value === null) { return false; } diff --git a/src/Constraint/Compass/V6.php b/src/Constraint/Compass/V6.php index 5cdc7aa..d559540 100644 --- a/src/Constraint/Compass/V6.php +++ b/src/Constraint/Compass/V6.php @@ -37,8 +37,9 @@ public function getWeight(): int return 1; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->v6 = $param; return $this; } @@ -48,8 +49,9 @@ public function getParameter(): mixed return $this->v6; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value === null) { return false; } diff --git a/src/Constraint/DateTime/Max.php b/src/Constraint/DateTime/Max.php index f8e39c6..727bb75 100644 --- a/src/Constraint/DateTime/Max.php +++ b/src/Constraint/DateTime/Max.php @@ -38,8 +38,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->max = $this->processor->coerce($param); return $this; } @@ -49,8 +50,9 @@ public function getParameter(): mixed return $this->max; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value === null) { return true; } diff --git a/src/Constraint/DateTime/Min.php b/src/Constraint/DateTime/Min.php index 88a498a..a0e3392 100644 --- a/src/Constraint/DateTime/Min.php +++ b/src/Constraint/DateTime/Min.php @@ -38,8 +38,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->min = $this->processor->coerce($param); return $this; } @@ -49,8 +50,9 @@ public function getParameter(): mixed return $this->min; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value === null) { return true; } diff --git a/src/Constraint/DateTime/Range.php b/src/Constraint/DateTime/Range.php index 9b32891..9330afc 100644 --- a/src/Constraint/DateTime/Range.php +++ b/src/Constraint/DateTime/Range.php @@ -34,8 +34,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->processor->test('min', $param[0] ?? 'now'); $this->processor->test('max', $param[1] ?? 'now'); return $this; diff --git a/src/Constraint/DefaultValue.php b/src/Constraint/DefaultValue.php index f5b503f..e233c19 100644 --- a/src/Constraint/DefaultValue.php +++ b/src/Constraint/DefaultValue.php @@ -30,8 +30,9 @@ public function getWeight(): int return 0; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->default = $param; return $this; } @@ -41,8 +42,9 @@ public function getParameter(): mixed return $this->default; } - public function prepareValue(mixed $value): mixed - { + public function prepareValue( + mixed $value + ): mixed { if ($value === '') { $value = null; } diff --git a/src/Constraint/Interval/Max.php b/src/Constraint/Interval/Max.php index b271a69..8e9a59d 100644 --- a/src/Constraint/Interval/Max.php +++ b/src/Constraint/Interval/Max.php @@ -38,8 +38,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->max = $this->processor->coerce($param); return $this; } @@ -49,8 +50,9 @@ public function getParameter(): mixed return $this->max; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value === null) { return true; } diff --git a/src/Constraint/Interval/Min.php b/src/Constraint/Interval/Min.php index 49f6e1a..b8366ea 100644 --- a/src/Constraint/Interval/Min.php +++ b/src/Constraint/Interval/Min.php @@ -38,8 +38,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->min = $this->processor->coerce($param); return $this; } @@ -49,8 +50,9 @@ public function getParameter(): mixed return $this->min; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value === null) { return true; } diff --git a/src/Constraint/Interval/Range.php b/src/Constraint/Interval/Range.php index a3ad189..63b5389 100644 --- a/src/Constraint/Interval/Range.php +++ b/src/Constraint/Interval/Range.php @@ -34,8 +34,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->processor->test('min', $param[0] ?? 0); $this->processor->test('max', $param[1] ?? 0); return $this; diff --git a/src/Constraint/Number/Max.php b/src/Constraint/Number/Max.php index 3a94336..2bf1923 100644 --- a/src/Constraint/Number/Max.php +++ b/src/Constraint/Number/Max.php @@ -35,8 +35,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->max = (float)$param; return $this; } @@ -46,8 +47,9 @@ public function getParameter(): mixed return $this->max; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value > $this->max) { yield new Error( $this, diff --git a/src/Constraint/Number/Min.php b/src/Constraint/Number/Min.php index 4f0e052..7180dbc 100644 --- a/src/Constraint/Number/Min.php +++ b/src/Constraint/Number/Min.php @@ -35,8 +35,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->min = (float)$param; return $this; } @@ -46,8 +47,9 @@ public function getParameter(): mixed return $this->min; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value < $this->min) { yield new Error( $this, diff --git a/src/Constraint/Number/Range.php b/src/Constraint/Number/Range.php index 9e1cf25..b124ff0 100644 --- a/src/Constraint/Number/Range.php +++ b/src/Constraint/Number/Range.php @@ -31,8 +31,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->processor->test('min', $param[0] ?? 0); $this->processor->test('max', $param[1] ?? \PHP_INT_MAX); return $this; diff --git a/src/Constraint/Required.php b/src/Constraint/Required.php index 74690c9..96cc7ab 100644 --- a/src/Constraint/Required.php +++ b/src/Constraint/Required.php @@ -32,8 +32,9 @@ public function getWeight(): int return 1; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->required = $param; return $this; } @@ -43,8 +44,9 @@ public function getParameter(): mixed return $this->required; } - public function prepareValue(mixed $value): mixed - { + public function prepareValue( + mixed $value + ): mixed { if ($value === '') { $value = null; } @@ -52,8 +54,9 @@ public function prepareValue(mixed $value): mixed return $value; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ( $this->required && $value === null diff --git a/src/Constraint/Sanitize.php b/src/Constraint/Sanitize.php index 3cedf6a..e6a90a1 100644 --- a/src/Constraint/Sanitize.php +++ b/src/Constraint/Sanitize.php @@ -30,8 +30,9 @@ public function getWeight(): int return 0; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->sanitizer = $param; return $this; } @@ -41,8 +42,9 @@ public function getParameter(): mixed return $this->sanitizer; } - public function prepareValue(mixed $value): mixed - { + public function prepareValue( + mixed $value + ): mixed { if (is_callable($this->sanitizer)) { $value = ($this->sanitizer)($value); } diff --git a/src/Constraint/String/Emojis.php b/src/Constraint/String/Emojis.php index 390b963..88662e7 100644 --- a/src/Constraint/String/Emojis.php +++ b/src/Constraint/String/Emojis.php @@ -41,8 +41,9 @@ public function getWeight(): int return 50; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->emojis = $param; return $this; } @@ -52,8 +53,9 @@ public function getParameter(): mixed return $this->emojis; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ($value === null) { return true; } diff --git a/src/Constraint/String/MaxLength.php b/src/Constraint/String/MaxLength.php index 00607f0..fb489a3 100644 --- a/src/Constraint/String/MaxLength.php +++ b/src/Constraint/String/MaxLength.php @@ -36,8 +36,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { if ($param <= 0) { throw Exceptional::InvalidArgument( 'Max length must be greater than 0' @@ -53,8 +54,9 @@ public function getParameter(): mixed return $this->length; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { $length = mb_strlen((string)$value); if ( diff --git a/src/Constraint/String/MaxWords.php b/src/Constraint/String/MaxWords.php index 1fd20ad..d5087c4 100644 --- a/src/Constraint/String/MaxWords.php +++ b/src/Constraint/String/MaxWords.php @@ -37,8 +37,9 @@ public function getWeight(): int return 25; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { if ($param <= 0) { throw Exceptional::InvalidArgument( 'Max words must be greater than 0' @@ -54,8 +55,9 @@ public function getParameter(): mixed return $this->words; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { $words = Dictum::countWords((string)$value); if ( diff --git a/src/Constraint/String/MinLength.php b/src/Constraint/String/MinLength.php index 79218f1..9c13271 100644 --- a/src/Constraint/String/MinLength.php +++ b/src/Constraint/String/MinLength.php @@ -36,8 +36,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { if ($param <= 0) { throw Exceptional::InvalidArgument( 'Max length must be greater than 0' @@ -53,8 +54,9 @@ public function getParameter(): mixed return $this->length; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { $length = mb_strlen((string)$value); if ( diff --git a/src/Constraint/String/MinWords.php b/src/Constraint/String/MinWords.php index e874a3b..a31c502 100644 --- a/src/Constraint/String/MinWords.php +++ b/src/Constraint/String/MinWords.php @@ -37,8 +37,9 @@ public function getWeight(): int return 25; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { if ($param <= 0) { throw Exceptional::InvalidArgument( 'Min words must be greater than 0' @@ -54,8 +55,9 @@ public function getParameter(): mixed return $this->words; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { $words = Dictum::countWords((string)$value); if ( diff --git a/src/Constraint/String/Pattern.php b/src/Constraint/String/Pattern.php index 67c3e19..b8a7863 100644 --- a/src/Constraint/String/Pattern.php +++ b/src/Constraint/String/Pattern.php @@ -35,8 +35,9 @@ public function getWeight(): int return 20; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->pattern = $param; return $this; } @@ -46,8 +47,9 @@ public function getParameter(): mixed return $this->pattern; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if ( $this->pattern !== null && !filter_var( diff --git a/src/Constraint/String/Trim.php b/src/Constraint/String/Trim.php index 2d75273..858cd44 100644 --- a/src/Constraint/String/Trim.php +++ b/src/Constraint/String/Trim.php @@ -33,8 +33,9 @@ public function getWeight(): int return 5; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->trim = $param; return $this; } @@ -44,8 +45,9 @@ public function getParameter(): mixed return $this->trim; } - public function alterValue(mixed $value): mixed - { + public function alterValue( + mixed $value + ): mixed { if ($this->trim) { $value = trim((string)$value); diff --git a/src/Constraint/Validate.php b/src/Constraint/Validate.php index 33927e9..4ebac13 100644 --- a/src/Constraint/Validate.php +++ b/src/Constraint/Validate.php @@ -32,8 +32,9 @@ public function getWeight(): int return 0; } - public function setParameter(mixed $param): static - { + public function setParameter( + mixed $param + ): static { $this->validator = $param; return $this; } @@ -43,8 +44,9 @@ public function getParameter(): mixed return $this->validator; } - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { if (!is_callable($this->validator)) { return true; } diff --git a/src/ConstraintResolver.php b/src/ConstraintResolver.php index e53c2f9..b418a3e 100644 --- a/src/ConstraintResolver.php +++ b/src/ConstraintResolver.php @@ -32,8 +32,9 @@ public function getPriority(): int /** * Resolve Archetype class location */ - public function resolve(string $name): ?string - { + public function resolve( + string $name + ): ?string { $parts = explode(':', $name); $name = ucfirst(array_pop($parts)); diff --git a/src/Context.php b/src/Context.php index d7595c2..7683d86 100644 --- a/src/Context.php +++ b/src/Context.php @@ -23,8 +23,9 @@ class Context implements DirectContext { use DirectContextTrait; - public function newSanitizer(mixed $value): Sanitizer - { + public function newSanitizer( + mixed $value + ): Sanitizer { return new ValueContainer($value); } } diff --git a/src/Processor/BoolNative.php b/src/Processor/BoolNative.php index 1333212..dd68513 100644 --- a/src/Processor/BoolNative.php +++ b/src/Processor/BoolNative.php @@ -32,8 +32,9 @@ public function getOutputTypes(): array /** * Convert prepared value to bool or null */ - public function coerce(mixed $value): ?bool - { + public function coerce( + mixed $value + ): ?bool { if ($value === null) { return $this->isRequired() ? false : null; } diff --git a/src/Processor/Camel.php b/src/Processor/Camel.php index 6049c5a..7df82a3 100644 --- a/src/Processor/Camel.php +++ b/src/Processor/Camel.php @@ -32,8 +32,9 @@ public function getOutputTypes(): array /** * Convert prepared value to string or null */ - public function coerce(mixed $value): ?string - { + public function coerce( + mixed $value + ): ?string { if ($value === null) { return null; } diff --git a/src/Processor/Color.php b/src/Processor/Color.php index d998e35..0d21fb1 100644 --- a/src/Processor/Color.php +++ b/src/Processor/Color.php @@ -32,8 +32,9 @@ public function getOutputTypes(): array /** * Convert prepared value to string or null */ - public function coerce(mixed $value): ?Spectrum - { + public function coerce( + mixed $value + ): ?Spectrum { if (!class_exists(Spectrum::class)) { throw Exceptional::ComponentUnavailable( 'Color validation requires decodelabs-spectrum package' diff --git a/src/Processor/Date.php b/src/Processor/Date.php index 4df6455..807e466 100644 --- a/src/Processor/Date.php +++ b/src/Processor/Date.php @@ -35,8 +35,9 @@ public function getOutputTypes(): array /** * Convert prepared value to DateTime or null */ - public function coerce(mixed $value): ?Carbon - { + public function coerce( + mixed $value + ): ?Carbon { if ($value === null) { return null; } diff --git a/src/Processor/Email.php b/src/Processor/Email.php index 43adc84..2dde233 100644 --- a/src/Processor/Email.php +++ b/src/Processor/Email.php @@ -33,8 +33,9 @@ public function getOutputTypes(): array /** * Convert prepared value to string or null */ - public function coerce(mixed $value): ?string - { + public function coerce( + mixed $value + ): ?string { if ($value === null) { return null; } @@ -55,8 +56,9 @@ public function coerce(mixed $value): ?string /** * Check email is valid */ - public function validateType(mixed $value): Generator - { + public function validateType( + mixed $value + ): Generator { if (!filter_var($value, \FILTER_VALIDATE_EMAIL)) { yield new Error( $this, diff --git a/src/Processor/FloatNative.php b/src/Processor/FloatNative.php index 3a28f35..0bb7edf 100644 --- a/src/Processor/FloatNative.php +++ b/src/Processor/FloatNative.php @@ -31,8 +31,9 @@ public function getOutputTypes(): array /** * Convert prepared value to float or null */ - public function coerce(mixed $value): ?float - { + public function coerce( + mixed $value + ): ?float { if ($value === null) { return $this->isRequired() ? 0 : null; } diff --git a/src/Processor/IntNative.php b/src/Processor/IntNative.php index 1d3da5a..a04b588 100644 --- a/src/Processor/IntNative.php +++ b/src/Processor/IntNative.php @@ -31,8 +31,9 @@ public function getOutputTypes(): array /** * Convert prepared value to int or null */ - public function coerce(mixed $value): ?int - { + public function coerce( + mixed $value + ): ?int { if ($value === null) { return $this->isRequired() ? 0 : null; } diff --git a/src/Processor/Interval.php b/src/Processor/Interval.php index aaa24eb..11ea06d 100644 --- a/src/Processor/Interval.php +++ b/src/Processor/Interval.php @@ -34,8 +34,9 @@ public function getOutputTypes(): array /** * Convert prepared value to DateTime or null */ - public function coerce(mixed $value): ?CarbonInterval - { + public function coerce( + mixed $value + ): ?CarbonInterval { if ($value === null) { return null; } diff --git a/src/Processor/Ip.php b/src/Processor/Ip.php index 746c07a..ef98a9d 100644 --- a/src/Processor/Ip.php +++ b/src/Processor/Ip.php @@ -33,8 +33,9 @@ public function getOutputTypes(): array /** * Convert prepared value to string or null */ - public function coerce(mixed $value): ?IpAddress - { + public function coerce( + mixed $value + ): ?IpAddress { if (!class_exists(IpAddress::class)) { throw Exceptional::ComponentUnavailable( 'IP validation requires decodelabs/compass package' diff --git a/src/Processor/IpRange.php b/src/Processor/IpRange.php index 4dda0ab..173317f 100644 --- a/src/Processor/IpRange.php +++ b/src/Processor/IpRange.php @@ -35,8 +35,9 @@ public function getOutputTypes(): array /** * Convert prepared value to string or null */ - public function coerce(mixed $value): ?Range - { + public function coerce( + mixed $value + ): ?Range { if (!class_exists(IpAddress::class)) { throw Exceptional::ComponentUnavailable( 'IP validation requires decodelabs-compass package' diff --git a/src/Processor/ListNative.php b/src/Processor/ListNative.php index 7ed53f9..3100f7b 100644 --- a/src/Processor/ListNative.php +++ b/src/Processor/ListNative.php @@ -42,8 +42,9 @@ public function isMultiValue(): bool /** * @param Processor $processor */ - public function setChildType(Processor $processor): void - { + public function setChildType( + Processor $processor + ): void { $this->childType = $processor; } @@ -64,8 +65,9 @@ public function getChildType(): ?Processor * * @return array|null */ - public function coerce(mixed $value): ?array - { + public function coerce( + mixed $value + ): ?array { if ($value === null) { return null; } diff --git a/src/Processor/Name.php b/src/Processor/Name.php index 7779da3..0a592f4 100644 --- a/src/Processor/Name.php +++ b/src/Processor/Name.php @@ -39,8 +39,9 @@ public function getDefaultConstraints(): array /** * Convert prepared value to string or null */ - public function coerce(mixed $value): ?string - { + public function coerce( + mixed $value + ): ?string { if ($value === null) { return null; } diff --git a/src/Processor/PathSlug.php b/src/Processor/PathSlug.php index aa84f55..9faf2ef 100644 --- a/src/Processor/PathSlug.php +++ b/src/Processor/PathSlug.php @@ -32,8 +32,9 @@ public function getOutputTypes(): array /** * Convert prepared value to string or null */ - public function coerce(mixed $value): ?string - { + public function coerce( + mixed $value + ): ?string { if ($value === null) { return null; } diff --git a/src/Processor/Slug.php b/src/Processor/Slug.php index ea52a2a..baff7cf 100644 --- a/src/Processor/Slug.php +++ b/src/Processor/Slug.php @@ -32,8 +32,9 @@ public function getOutputTypes(): array /** * Convert prepared value to string or null */ - public function coerce(mixed $value): ?string - { + public function coerce( + mixed $value + ): ?string { if ($value === null) { return null; } diff --git a/src/Processor/StringNative.php b/src/Processor/StringNative.php index 8984e80..d6d55bf 100644 --- a/src/Processor/StringNative.php +++ b/src/Processor/StringNative.php @@ -39,8 +39,9 @@ public function getDefaultConstraints(): array /** * Convert prepared value to string or null */ - public function coerce(mixed $value): ?string - { + public function coerce( + mixed $value + ): ?string { if ($value === null) { return null; } diff --git a/src/Processor/Url.php b/src/Processor/Url.php index 72e8620..1c42ad5 100644 --- a/src/Processor/Url.php +++ b/src/Processor/Url.php @@ -33,8 +33,9 @@ public function getOutputTypes(): array /** * Convert prepared value to string or null */ - public function coerce(mixed $value): ?string - { + public function coerce( + mixed $value + ): ?string { if ($value === null) { return null; } @@ -56,8 +57,9 @@ public function coerce(mixed $value): ?string /** * Check URL is valid */ - public function validateType(mixed $value): Generator - { + public function validateType( + mixed $value + ): Generator { if (!filter_var($value, \FILTER_VALIDATE_URL)) { yield new Error( $this, diff --git a/src/ProcessorTrait.php b/src/ProcessorTrait.php index 9a79a20..31cd5a7 100644 --- a/src/ProcessorTrait.php +++ b/src/ProcessorTrait.php @@ -27,8 +27,9 @@ trait ProcessorTrait protected Sanitizer $sanitizer; - public function __construct(Sanitizer $sanitizer) - { + public function __construct( + Sanitizer $sanitizer + ) { $this->sanitizer = $sanitizer; } @@ -57,8 +58,9 @@ public function isMultiValue(): bool } - final public function prepareValue(mixed $value): mixed - { + final public function prepareValue( + mixed $value + ): mixed { if ($value instanceof Closure) { $value = $value($this); } @@ -71,8 +73,9 @@ final public function prepareValue(mixed $value): mixed } - final public function alterValue(mixed $value): mixed - { + final public function alterValue( + mixed $value + ): mixed { foreach ($this->constraints as $constraint) { $value = $constraint->alterValue($value); @@ -184,8 +187,9 @@ public function prepareConstraints(): array - public function validate(mixed $value): Generator - { + public function validate( + mixed $value + ): Generator { // Type validation yield from $gen = $this->validateType($value); @@ -204,8 +208,9 @@ public function validate(mixed $value): Generator } - public function validateType(mixed $value): Generator - { + public function validateType( + mixed $value + ): Generator { yield null; } } diff --git a/src/Sanitizer/ValueContainer.php b/src/Sanitizer/ValueContainer.php index 185e8d6..99465d4 100644 --- a/src/Sanitizer/ValueContainer.php +++ b/src/Sanitizer/ValueContainer.php @@ -27,8 +27,9 @@ class ValueContainer implements Sanitizer /** * Init with raw value */ - public function __construct(mixed $value) - { + public function __construct( + mixed $value + ) { $this->value = $value; }