Skip to content

Commit

Permalink
Fix #19354: Reuse Validator::getAttributeNames() in `AttributeTypec…
Browse files Browse the repository at this point in the history
…astBehavior::detectAttributeTypes()`
  • Loading branch information
WinterSilence committed Nov 15, 2022
1 parent 70df221 commit feb637b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Yii Framework 2 Change Log
- Enh #19401: Delay `exit(1)` in `yii\base\ErrorHandler::handleFatalError` (arrilot)
- Enh #19416: Update and improve configurations for `yii\console\controllers\MessageController` (WinterSilence)
- Enh #19420: Update list of JS callbacks in `yii\widgets\MaskedInput` (WinterSilence)
- Chg #19354: Reuse `Validator::getAttributeNames()` in `AttributeTypecastBehavior::detectAttributeTypes()` (WinterSilence)
- Enh #19437: Add support to specify request port by trusted proxies in `\yii\web\Request::getServerPort()` (rhertogh)


Expand Down
4 changes: 1 addition & 3 deletions behaviors/AttributeTypecastBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,7 @@ protected function detectAttributeTypes()
}

if ($type !== null) {
foreach ((array) $validator->attributes as $attribute) {
$attributeTypes[ltrim($attribute, '!')] = $type;
}
$attributeTypes += array_fill_keys($validator->getAttributeNames(), $type);
}
}

Expand Down

0 comments on commit feb637b

Please sign in to comment.