diff --git a/framework/Yii.php b/framework/Yii.php index 4226770df37..124533958d3 100644 --- a/framework/Yii.php +++ b/framework/Yii.php @@ -5,8 +5,6 @@ * @license http://www.yiiframework.com/license/ */ -require __DIR__ . '/BaseYii.php'; - /** * Yii is a helper class serving common framework functionalities. * diff --git a/framework/console/widgets/Table.php b/framework/console/widgets/Table.php index 400a7313cb0..0a8f2b252f1 100644 --- a/framework/console/widgets/Table.php +++ b/framework/console/widgets/Table.php @@ -228,6 +228,7 @@ protected function renderRow(array $row, $spanLeft, $spanMiddle, $spanRight) $buffer = ''; $arrayPointer = []; + $finalChunk = []; for ($i = 0, ($max = $this->calculateRowHeight($row)) ?: $max = 1; $i < $max; $i++) { $buffer .= $spanLeft . ' '; foreach ($size as $index => $cellSize) { diff --git a/framework/helpers/BaseHtml.php b/framework/helpers/BaseHtml.php index d8560a77676..5d7703556a6 100644 --- a/framework/helpers/BaseHtml.php +++ b/framework/helpers/BaseHtml.php @@ -1249,7 +1249,7 @@ private static function collectErrors($models, $encode, $showAllErrors) } if ($encode) { - for ($i = 0; $i < count($lines); $i++) { + for ($i = 0, $linesCount = count($lines); $i < $linesCount; $i++) { $lines[$i] = Html::encode($lines[$i]); } } diff --git a/framework/i18n/Formatter.php b/framework/i18n/Formatter.php index f74b7a29f5f..f60c3807c31 100644 --- a/framework/i18n/Formatter.php +++ b/framework/i18n/Formatter.php @@ -1013,6 +1013,7 @@ public function asDuration($value, $implodeString = ', ', $negativeSign = '-') $isNegative = $interval->invert; } + $parts = []; if ($interval->y > 0) { $parts[] = Yii::t('yii', '{delta, plural, =1{1 year} other{# years}}', ['delta' => $interval->y], $this->locale); } diff --git a/framework/validators/ExistValidator.php b/framework/validators/ExistValidator.php index 0ba80228c45..b7e5c574abb 100644 --- a/framework/validators/ExistValidator.php +++ b/framework/validators/ExistValidator.php @@ -92,7 +92,7 @@ public function validateAttribute($model, $attribute) { $targetAttribute = $this->targetAttribute === null ? $attribute : $this->targetAttribute; $params = $this->prepareConditions($targetAttribute, $model, $attribute); - $conditions[] = $this->targetAttributeJunction == 'or' ? 'or' : 'and'; + $conditions = [$this->targetAttributeJunction == 'or' ? 'or' : 'and']; if (!$this->allowArray) { foreach ($params as $key => $value) { diff --git a/framework/validators/UniqueValidator.php b/framework/validators/UniqueValidator.php index 89da62fde21..d99095cc126 100644 --- a/framework/validators/UniqueValidator.php +++ b/framework/validators/UniqueValidator.php @@ -121,7 +121,7 @@ public function validateAttribute($model, $attribute) $targetClass = $this->getTargetClass($model); $targetAttribute = $this->targetAttribute === null ? $attribute : $this->targetAttribute; $rawConditions = $this->prepareConditions($targetAttribute, $model, $attribute); - $conditions[] = $this->targetAttributeJunction === 'or' ? 'or' : 'and'; + $conditions = [$this->targetAttributeJunction === 'or' ? 'or' : 'and']; foreach ($rawConditions as $key => $value) { if (is_array($value)) {