mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 13:58:55 +08:00
Replace aliases of functions
This commit is contained in:
@ -141,7 +141,7 @@ trait ArrayableTrait
|
||||
$result = [];
|
||||
|
||||
foreach ($this->fields() as $field => $definition) {
|
||||
if (is_integer($field)) {
|
||||
if (is_int($field)) {
|
||||
$field = $definition;
|
||||
}
|
||||
if (empty($fields) || in_array($field, $fields, true)) {
|
||||
@ -154,7 +154,7 @@ trait ArrayableTrait
|
||||
}
|
||||
|
||||
foreach ($this->extraFields() as $field => $definition) {
|
||||
if (is_integer($field)) {
|
||||
if (is_int($field)) {
|
||||
$field = $definition;
|
||||
}
|
||||
if (in_array($field, $expand, true)) {
|
||||
|
||||
@ -66,7 +66,7 @@ class DynamicModel extends Model
|
||||
public function __construct(array $attributes = [], $config = [])
|
||||
{
|
||||
foreach ($attributes as $name => $value) {
|
||||
if (is_integer($name)) {
|
||||
if (is_int($name)) {
|
||||
$this->_attributes[$value] = null;
|
||||
} else {
|
||||
$this->_attributes[$name] = $value;
|
||||
|
||||
@ -270,7 +270,7 @@ class Security extends Component
|
||||
if (is_string($length) && preg_match('{^\d{1,16}$}', $length)) {
|
||||
$length = (int) $length;
|
||||
}
|
||||
if (!is_integer($length) || $length < 0 || $length > 255 * $hashLength) {
|
||||
if (!is_int($length) || $length < 0 || $length > 255 * $hashLength) {
|
||||
throw new InvalidParamException('Invalid length');
|
||||
}
|
||||
$blocks = $length !== 0 ? ceil($length / $hashLength) : 1;
|
||||
@ -325,13 +325,13 @@ class Security extends Component
|
||||
if (is_string($iterations) && preg_match('{^\d{1,16}$}', $iterations)) {
|
||||
$iterations = (int) $iterations;
|
||||
}
|
||||
if (!is_integer($iterations) || $iterations < 1) {
|
||||
if (!is_int($iterations) || $iterations < 1) {
|
||||
throw new InvalidParamException('Invalid iterations');
|
||||
}
|
||||
if (is_string($length) && preg_match('{^\d{1,16}$}', $length)) {
|
||||
$length = (int) $length;
|
||||
}
|
||||
if (!is_integer($length) || $length < 0) {
|
||||
if (!is_int($length) || $length < 0) {
|
||||
throw new InvalidParamException('Invalid length');
|
||||
}
|
||||
$hashLength = StringHelper::byteLength($test);
|
||||
|
||||
@ -97,7 +97,7 @@ class Application extends \yii\base\Application
|
||||
if (!empty($path) && is_file($file = Yii::getAlias($path))) {
|
||||
return require($file);
|
||||
} else {
|
||||
die("The configuration file does not exist: $path\n");
|
||||
exit("The configuration file does not exist: $path\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -408,7 +408,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
|
||||
|
||||
if (is_array($eagerLoading)) {
|
||||
foreach ($with as $name => $callback) {
|
||||
if (is_integer($name)) {
|
||||
if (is_int($name)) {
|
||||
if (!in_array($callback, $eagerLoading, true)) {
|
||||
unset($with[$name]);
|
||||
}
|
||||
@ -463,7 +463,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
|
||||
$relations = [];
|
||||
|
||||
foreach ($with as $name => $callback) {
|
||||
if (is_integer($name)) {
|
||||
if (is_int($name)) {
|
||||
$name = $callback;
|
||||
$callback = null;
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ trait ActiveQueryTrait
|
||||
$this->with = $with;
|
||||
} elseif (!empty($with)) {
|
||||
foreach ($with as $name => $value) {
|
||||
if (is_integer($name)) {
|
||||
if (is_int($name)) {
|
||||
// repeating relation is fine as normalizeRelations() handle it well
|
||||
$this->with[] = $value;
|
||||
} else {
|
||||
@ -180,7 +180,7 @@ trait ActiveQueryTrait
|
||||
{
|
||||
$relations = [];
|
||||
foreach ($with as $name => $callback) {
|
||||
if (is_integer($name)) {
|
||||
if (is_int($name)) {
|
||||
$name = $callback;
|
||||
$callback = null;
|
||||
}
|
||||
|
||||
@ -675,7 +675,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
|
||||
{
|
||||
$attrs = [];
|
||||
foreach ($attributes as $name => $value) {
|
||||
if (is_integer($name)) {
|
||||
if (is_int($name)) {
|
||||
$attrs[] = $value;
|
||||
} else {
|
||||
$this->$name = $value;
|
||||
|
||||
@ -790,7 +790,7 @@ class Query extends Component implements QueryInterface
|
||||
$this->params = $params;
|
||||
} else {
|
||||
foreach ($params as $name => $value) {
|
||||
if (is_integer($name)) {
|
||||
if (is_int($name)) {
|
||||
$this->params[] = $value;
|
||||
} else {
|
||||
$this->params[$name] = $value;
|
||||
|
||||
@ -220,7 +220,7 @@ class ContentNegotiator extends ActionFilter implements BootstrapInterface
|
||||
return $this->languages[$language];
|
||||
}
|
||||
foreach ($this->languages as $key => $supported) {
|
||||
if (is_integer($key) && $this->isLanguageSupported($language, $supported)) {
|
||||
if (is_int($key) && $this->isLanguageSupported($language, $supported)) {
|
||||
return $supported;
|
||||
}
|
||||
}
|
||||
@ -232,7 +232,7 @@ class ContentNegotiator extends ActionFilter implements BootstrapInterface
|
||||
return $this->languages[$language];
|
||||
}
|
||||
foreach ($this->languages as $key => $supported) {
|
||||
if (is_integer($key) && $this->isLanguageSupported($language, $supported)) {
|
||||
if (is_int($key) && $this->isLanguageSupported($language, $supported)) {
|
||||
return $supported;
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ class BaseArrayHelper
|
||||
while (!empty($args)) {
|
||||
$next = array_shift($args);
|
||||
foreach ($next as $k => $v) {
|
||||
if (is_integer($k)) {
|
||||
if (is_int($k)) {
|
||||
if (isset($res[$k])) {
|
||||
$res[] = $v;
|
||||
} else {
|
||||
@ -577,7 +577,7 @@ class BaseArrayHelper
|
||||
return array_keys($array) === range(0, count($array) - 1);
|
||||
} else {
|
||||
foreach ($array as $key => $value) {
|
||||
if (!is_integer($key)) {
|
||||
if (!is_int($key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ class BaseVarDumper
|
||||
self::$_output .= '[]';
|
||||
} else {
|
||||
$keys = array_keys($var);
|
||||
$outputKeys = ($keys !== range(0, sizeof($var) - 1));
|
||||
$outputKeys = ($keys !== range(0, count($var) - 1));
|
||||
$spaces = str_repeat(' ', $level * 4);
|
||||
self::$_output .= '[';
|
||||
foreach ($keys as $key) {
|
||||
|
||||
@ -147,7 +147,7 @@ class UrlRule extends CompositeUrlRule
|
||||
|
||||
$controllers = [];
|
||||
foreach ((array) $this->controller as $urlName => $controller) {
|
||||
if (is_integer($urlName)) {
|
||||
if (is_int($urlName)) {
|
||||
$urlName = $this->pluralize ? Inflector::pluralize($controller) : $controller;
|
||||
}
|
||||
$controllers[$urlName] = $controller;
|
||||
|
||||
@ -168,7 +168,7 @@ trait FixtureTrait
|
||||
if (!is_array($fixture)) {
|
||||
$class = ltrim($fixture, '\\');
|
||||
$fixtures[$name] = ['class' => $class];
|
||||
$aliases[$class] = is_integer($name) ? $class : $name;
|
||||
$aliases[$class] = is_int($name) ? $class : $name;
|
||||
} elseif (isset($fixture['class'])) {
|
||||
$class = ltrim($fixture['class'], '\\');
|
||||
$config[$class] = $fixture;
|
||||
|
||||
@ -91,7 +91,7 @@ class ExistValidator extends Validator
|
||||
}
|
||||
$params = [];
|
||||
foreach ($targetAttribute as $k => $v) {
|
||||
$params[$v] = is_integer($k) ? $model->$v : $model->$k;
|
||||
$params[$v] = is_int($k) ? $model->$v : $model->$k;
|
||||
}
|
||||
} else {
|
||||
$params = [$targetAttribute => $model->$attribute];
|
||||
|
||||
@ -370,7 +370,7 @@ class FileValidator extends Validator
|
||||
$options['mimeTypes'] = $this->mimeTypes;
|
||||
$options['wrongMimeType'] = Yii::$app->getI18n()->format($this->wrongMimeType, [
|
||||
'attribute' => $label,
|
||||
'mimeTypes' => join(', ', $this->mimeTypes),
|
||||
'mimeTypes' => implode(', ', $this->mimeTypes),
|
||||
], Yii::$app->language);
|
||||
}
|
||||
|
||||
@ -378,7 +378,7 @@ class FileValidator extends Validator
|
||||
$options['extensions'] = $this->extensions;
|
||||
$options['wrongExtension'] = Yii::$app->getI18n()->format($this->wrongExtension, [
|
||||
'attribute' => $label,
|
||||
'extensions' => join(', ', $this->extensions),
|
||||
'extensions' => implode(', ', $this->extensions),
|
||||
], Yii::$app->language);
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ class UniqueValidator extends Validator
|
||||
if (is_array($targetAttribute)) {
|
||||
$params = [];
|
||||
foreach ($targetAttribute as $k => $v) {
|
||||
$params[$v] = is_integer($k) ? $model->$v : $model->$k;
|
||||
$params[$v] = is_int($k) ? $model->$v : $model->$k;
|
||||
}
|
||||
} else {
|
||||
$params = [$targetAttribute => $model->$attribute];
|
||||
|
||||
Reference in New Issue
Block a user