mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Applied code style fixes
This commit is contained in:
@ -127,7 +127,7 @@ class ExitCode
|
||||
*/
|
||||
public static $reasons = [
|
||||
self::OK => 'Success',
|
||||
self::UNSPECIFIED_ERROR => "Unspecified error",
|
||||
self::UNSPECIFIED_ERROR => 'Unspecified error',
|
||||
self::USAGE => 'Incorrect usage, argument or option error',
|
||||
self::DATAERR => 'Error in input data',
|
||||
self::NOINPUT => 'Input file not found or unreadable',
|
||||
@ -154,6 +154,6 @@ class ExitCode
|
||||
*/
|
||||
public static function getReason($exitCode)
|
||||
{
|
||||
return isset($exReasons[$exitCode]) ? $exReasons[$exitCode] : "Unknown exit code";
|
||||
return isset($exReasons[$exitCode]) ? $exReasons[$exitCode] : 'Unknown exit code';
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@
|
||||
namespace yii\data;
|
||||
|
||||
use Yii;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\base\BaseObject;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Inflector;
|
||||
use yii\web\Request;
|
||||
|
@ -195,7 +195,7 @@ class ActiveRecord extends BaseActiveRecord
|
||||
{
|
||||
$pk = [];
|
||||
// disambiguate column names in case ActiveQuery adds a JOIN
|
||||
foreach($this->getPrimaryKey(true) as $key => $value) {
|
||||
foreach ($this->getPrimaryKey(true) as $key => $value) {
|
||||
$pk[static::tableName() . '.' . $key] = $value;
|
||||
}
|
||||
/* @var $record BaseActiveRecord */
|
||||
|
@ -8,10 +8,10 @@
|
||||
namespace yii\db;
|
||||
|
||||
use Yii;
|
||||
use yii\base\BaseObject;
|
||||
use yii\base\InvalidCallException;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\base\NotSupportedException;
|
||||
use yii\base\BaseObject;
|
||||
use yii\caching\Cache;
|
||||
use yii\caching\CacheInterface;
|
||||
use yii\caching\TagDependency;
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
namespace yii\db;
|
||||
|
||||
use yii\base\InvalidParamException;
|
||||
use yii\base\BaseObject;
|
||||
use yii\base\InvalidParamException;
|
||||
|
||||
/**
|
||||
* TableSchema represents the metadata of a database table.
|
||||
|
@ -8,8 +8,8 @@
|
||||
namespace yii\mail;
|
||||
|
||||
use Yii;
|
||||
use yii\base\ErrorHandler;
|
||||
use yii\base\BaseObject;
|
||||
use yii\base\ErrorHandler;
|
||||
|
||||
/**
|
||||
* BaseMessage serves as a base class that implements the [[send()]] method required by [[MessageInterface]].
|
||||
|
@ -56,7 +56,7 @@ class MysqlMutex extends DbMutex
|
||||
*/
|
||||
protected function acquireLock($name, $timeout = 0)
|
||||
{
|
||||
return $this->db->useMaster(function($db) use ($name, $timeout) {
|
||||
return $this->db->useMaster(function ($db) use ($name, $timeout) {
|
||||
/** @var \yii\db\Connection $db */
|
||||
return (bool) $db->createCommand(
|
||||
'SELECT GET_LOCK(:name, :timeout)',
|
||||
@ -75,7 +75,7 @@ class MysqlMutex extends DbMutex
|
||||
{
|
||||
return $this->db->useMaster(function ($db) use ($name) {
|
||||
/** @var \yii\db\Connection $db */
|
||||
return (bool)$db->createCommand(
|
||||
return (bool) $db->createCommand(
|
||||
'SELECT RELEASE_LOCK(:name)',
|
||||
[':name' => $name]
|
||||
)->queryScalar();
|
||||
|
@ -88,7 +88,7 @@ class OracleMutex extends DbMutex
|
||||
$timeout = abs((int) $timeout);
|
||||
|
||||
// inside pl/sql scopes pdo binding not working correctly :(
|
||||
$this->db->useMaster(function($db) use ($name, $timeout, $releaseOnCommit, &$lockStatus) {
|
||||
$this->db->useMaster(function ($db) use ($name, $timeout, $releaseOnCommit, &$lockStatus) {
|
||||
/** @var \yii\db\Connection $db */
|
||||
$db->createCommand(
|
||||
'DECLARE
|
||||
@ -115,7 +115,7 @@ END;',
|
||||
protected function releaseLock($name)
|
||||
{
|
||||
$releaseStatus = null;
|
||||
$this->db->useMaster(function($db) use ($name, &$releaseStatus) {
|
||||
$this->db->useMaster(function ($db) use ($name, &$releaseStatus) {
|
||||
/** @var \yii\db\Connection $db */
|
||||
$db->createCommand(
|
||||
'DECLARE
|
||||
|
@ -71,9 +71,9 @@ class PgsqlMutex extends DbMutex
|
||||
throw new InvalidParamException('PgsqlMutex does not support timeout.');
|
||||
}
|
||||
list($key1, $key2) = $this->getKeysFromName($name);
|
||||
return $this->db->useMaster(function($db) use ($key1, $key2) {
|
||||
return $this->db->useMaster(function ($db) use ($key1, $key2) {
|
||||
/** @var \yii\db\Connection $db */
|
||||
return (bool)$db->createCommand(
|
||||
return (bool) $db->createCommand(
|
||||
'SELECT pg_try_advisory_lock(:key1, :key2)',
|
||||
[':key1' => $key1, ':key2' => $key2]
|
||||
)->queryScalar();
|
||||
@ -89,9 +89,9 @@ class PgsqlMutex extends DbMutex
|
||||
protected function releaseLock($name)
|
||||
{
|
||||
list($key1, $key2) = $this->getKeysFromName($name);
|
||||
return $this->db->useMaster(function($db) use ($key1, $key2) {
|
||||
return $this->db->useMaster(function ($db) use ($key1, $key2) {
|
||||
/** @var \yii\db\Connection $db */
|
||||
return (bool)$db->createCommand(
|
||||
return (bool) $db->createCommand(
|
||||
'SELECT pg_advisory_unlock(:key1, :key2)',
|
||||
[':key1' => $key1, ':key2' => $key2]
|
||||
)->queryScalar();
|
||||
|
@ -569,7 +569,7 @@ class IpValidator extends Validator
|
||||
$unpack = unpack('A16', inet_pton($ip));
|
||||
$binStr = array_shift($unpack);
|
||||
$bytes = static::IPV6_ADDRESS_LENGTH / 8; // 128 bit / 8 = 16 bytes
|
||||
$result = '';
|
||||
$result = '';
|
||||
while ($bytes-- > 0) {
|
||||
$result = sprintf('%08b', isset($binStr[$bytes]) ? ord($binStr[$bytes]) : '0') . $result;
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ namespace yii\web;
|
||||
|
||||
use ArrayIterator;
|
||||
use Yii;
|
||||
use yii\base\InvalidCallException;
|
||||
use yii\base\BaseObject;
|
||||
use yii\base\InvalidCallException;
|
||||
|
||||
/**
|
||||
* CookieCollection maintains the cookies available in the current request.
|
||||
|
@ -8,8 +8,8 @@
|
||||
namespace yii\web;
|
||||
|
||||
use Yii;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\base\BaseObject;
|
||||
use yii\base\InvalidConfigException;
|
||||
|
||||
/**
|
||||
* UrlNormalizer normalizes URLs for [[UrlManager]] and [[UrlRule]].
|
||||
|
@ -8,8 +8,8 @@
|
||||
namespace yii\web;
|
||||
|
||||
use Yii;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\base\BaseObject;
|
||||
use yii\base\InvalidConfigException;
|
||||
|
||||
/**
|
||||
* UrlRule represents a rule used by [[UrlManager]] for parsing and generating URLs.
|
||||
|
Reference in New Issue
Block a user