Skip to content

Commit f011fe8

Browse files
author
moxi
committed
fix: 更新写法
1 parent be79c98 commit f011fe8

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/Adapter/HyperfValidator.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,17 @@ public function validated(): array
243243
$missingValue = Str::random(10);
244244

245245
foreach ($this->getRules() as $key => $rules) {
246-
$keyString = (string) $key;
247246

248247
// 跳过包含通配符的规则键,避免创建虚拟的["*"]键
249248
// 这些规则只用于验证,不应该影响最终的数据结构
250-
if (str_contains($keyString, '*')) {
249+
if (is_string($key) && str_contains($key, '*')) {
251250
continue;
252251
}
253252

254-
$value = data_get($this->getData(), $keyString, $missingValue);
253+
$value = data_get($this->getData(), $key, $missingValue);
255254

256255
if ($value !== $missingValue) {
257-
Arr::set($results, $keyString, $value);
256+
Arr::set($results, $key, $value);
258257
}
259258
}
260259

0 commit comments

Comments
 (0)