Skip to content

Commit 2b95780

Browse files
modified codes
1 parent 0db353e commit 2b95780

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/Validation/BuildValidationRule.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,12 @@ class BuildValidationRule
312312
protected static ?string $notIn = null;
313313

314314
/**
315-
* @return array<int,LowerFL|IntegerByComma|StringByComma|StringByUnderscore|TimezoneRegion|Timezone|UpperFL|string>
315+
* @return array<string>
316316
*/
317317
protected function buildValidationRules(): array
318318
{
319-
return [
319+
/** @var array<string> $rules */
320+
$rules = [
320321
/**
321322
* --------------------------------------------------------------------------------
322323
* Default validations
@@ -420,5 +421,7 @@ protected function buildValidationRules(): array
420421
...($this->separateStringsByComma === true ? [new StringByComma()] : []),
421422
...($this->separateStringsByUnderscore === true ? [new StringByUnderscore()] : []),
422423
];
424+
425+
return $rules;
423426
}
424427
}

src/Validation/Rule.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -949,15 +949,18 @@ public static function notIn(Arrayable|array|string $values): Rule
949949
}
950950

951951
/**
952-
* @return array<int,LowerFL|IntegerByComma|StringByComma|StringByUnderscore|TimezoneRegion|Timezone|UpperFL|string>
952+
* @return array<string>
953953
*/
954954
private function getValidationRules(): array
955955
{
956+
/** @var array<string> $rules */
957+
$rules = $this->buildValidationRules();
958+
956959
if (empty($this->customRules)) {
957-
return $this->buildValidationRules();
960+
return $rules;
958961
}
959962

960-
return array_merge($this->customRules, $this->buildValidationRules());
963+
return array_merge($this->customRules, $rules);
961964
}
962965

963966
/**
@@ -989,7 +992,10 @@ public function passes(string $attribute, mixed $value): bool
989992
*/
990993
public function getRules(): array
991994
{
992-
return $this->getValidationRules();
995+
/** @var array<string> $rules */
996+
$rules = $this->getValidationRules();
997+
998+
return $rules;
993999
}
9941000

9951001
/**
@@ -998,6 +1004,7 @@ public function getRules(): array
9981004
*/
9991005
public function getRule(int $key = 0): string|null
10001006
{
1007+
/** @var array<string> $rules */
10011008
$rules = $this->getRules();
10021009

10031010
/**

0 commit comments

Comments
 (0)