Browse Source

Fix code issues (#15450)

tags/3.0.0-alpha1
Vladimir Khramtsov 7 years ago committed by Alexander Makarov
parent
commit
646cd73548
  1. 5
      composer.json
  2. 3
      framework/BaseYii.php
  3. 2
      framework/Yii.php
  4. 2
      framework/captcha/GdDriver.php
  5. 1
      framework/console/widgets/Table.php
  6. 2
      framework/db/sqlite/QueryBuilder.php
  7. 1
      framework/i18n/Formatter.php
  8. 2
      framework/validators/ExistValidator.php
  9. 3
      framework/validators/IpValidator.php
  10. 2
      framework/validators/UniqueValidator.php
  11. 1
      framework/web/Response.php
  12. 3
      framework/yii

5
composer.json

@ -101,7 +101,10 @@
"psr-4": {
"yii\\": "framework/",
"yii\\cs\\": "cs/src/"
}
},
"classmap": [
"framework/Yii.php"
]
},
"autoload-dev": {
"psr-4": {"yiiunit\\": "tests/"}

3
framework/BaseYii.php

@ -9,9 +9,8 @@ namespace yii;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use yii\base\InvalidConfigException;
use yii\base\InvalidArgumentException;
use yii\base\UnknownClassException;
use yii\base\InvalidConfigException;
use yii\di\Container;
use yii\di\Instance;
use yii\helpers\VarDumper;

2
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.
*

2
framework/captcha/GdDriver.php

@ -24,7 +24,7 @@ class GdDriver extends Driver
{
parent::init();
if (!extension_loaded('gd') || ($gdInfo = gd_info() && empty($gdInfo['FreeType Support']))) {
if (!extension_loaded('gd') || (($gdInfo = gd_info()) && empty($gdInfo['FreeType Support']))) {
throw new InvalidConfigException('GD PHP extension with FreeType support is required.');
}
}

1
framework/console/widgets/Table.php

@ -228,6 +228,7 @@ class Table extends Widget
$buffer = '';
$arrayPointer = [];
$finalChunk = [];
for ($i = 0, ($max = $this->calculateRowHeight($row)) ?: $max = 1; $i < $max; $i++) {
$buffer .= $spanLeft . ' ';
foreach ($size as $index => $cellSize) {

2
framework/db/sqlite/QueryBuilder.php

@ -10,8 +10,6 @@ namespace yii\db\sqlite;
use yii\base\InvalidArgumentException;
use yii\base\NotSupportedException;
use yii\db\Connection;
use yii\db\Exception;
use yii\db\Expression;
use yii\db\Query;
use yii\helpers\StringHelper;

1
framework/i18n/Formatter.php

@ -1006,6 +1006,7 @@ class Formatter extends Component
$isNegative = $interval->invert;
}
$parts = [];
if ($interval->y > 0) {
$parts[] = Yii::t('yii', '{delta, plural, =1{1 year} other{# years}}', ['delta' => $interval->y], $this->locale);
}

2
framework/validators/ExistValidator.php

@ -92,7 +92,7 @@ class ExistValidator extends Validator
{
$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) {

3
framework/validators/IpValidator.php

@ -9,10 +9,7 @@ namespace yii\validators;
use Yii;
use yii\base\InvalidConfigException;
use yii\helpers\Html;
use yii\helpers\IpHelper;
use yii\helpers\Json;
use yii\web\JsExpression;
/**
* The validator checks if the attribute value is a valid IPv4/IPv6 address or subnet.

2
framework/validators/UniqueValidator.php

@ -125,7 +125,7 @@ class UniqueValidator extends Validator
$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)) {

1
framework/web/Response.php

@ -16,7 +16,6 @@ use yii\helpers\Inflector;
use yii\helpers\StringHelper;
use yii\helpers\Url;
use yii\http\CookieCollection;
use yii\http\HeaderCollection;
use yii\http\MemoryStream;
use yii\http\MessageTrait;
use yii\http\ResourceStream;

3
framework/yii

@ -23,9 +23,6 @@ foreach ($composerAutoload as $autoload) {
}
}
require __DIR__ . '/Yii.php';
$application = new yii\console\Application([
'id' => 'yii-console',
'basePath' => __DIR__ . '/console',

Loading…
Cancel
Save