Skip to content

Commit

Permalink
Shorten two identical statements in compare validator (#18922)
Browse files Browse the repository at this point in the history
  • Loading branch information
toir427 committed Oct 1, 2021
1 parent f7c81fb commit 3578621
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions framework/validators/CompareValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The value being compared with can be another attribute value
* (specified via [[compareAttribute]]) or a constant (specified via
* [[compareValue]]. When both are specified, the latter takes
* [[compareValue]]). When both are specified, the latter takes
* precedence. If neither is specified, the attribute will be compared
* with another attribute whose name is by appending "_repeat" to the source
* attribute name.
Expand Down Expand Up @@ -105,14 +105,10 @@ public function init()
if ($this->message === null) {
switch ($this->operator) {
case '==':
$this->message = Yii::t('yii', '{attribute} must be equal to "{compareValueOrAttribute}".');
break;
case '===':
$this->message = Yii::t('yii', '{attribute} must be equal to "{compareValueOrAttribute}".');
break;
case '!=':
$this->message = Yii::t('yii', '{attribute} must not be equal to "{compareValueOrAttribute}".');
break;
case '!==':
$this->message = Yii::t('yii', '{attribute} must not be equal to "{compareValueOrAttribute}".');
break;
Expand Down

0 comments on commit 3578621

Please sign in to comment.