Skip to content

Commit

Permalink
Fix code issues (yiisoft#15435)
Browse files Browse the repository at this point in the history
* Fix some scrunitizer warnings

* Remove obsolete require

* Fix codestyle
  • Loading branch information
vkhramtsov authored and samdark committed Jan 1, 2018
1 parent b8f4397 commit b44bbd6
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions framework/Yii.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* @license http://www.yiiframework.com/license/
*/

require __DIR__ . '/BaseYii.php';

/**
* Yii is a helper class serving common framework functionalities.
*
Expand Down
1 change: 1 addition & 0 deletions framework/console/widgets/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion framework/helpers/BaseHtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
Expand Down
1 change: 1 addition & 0 deletions framework/i18n/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion framework/validators/ExistValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion framework/validators/UniqueValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit b44bbd6

Please sign in to comment.