Browse Source

Use ::class instead of ::className()

- shorter syntax
- native PHP feature, so it does not depend on yii\base\Object
- Does not trigger autoloading anymore
tags/3.0.0-alpha1
Carsten Brandt 9 years ago
parent
commit
88a4f4ae9f
  1. 2
      framework/base/Event.php
  2. 2
      framework/base/Object.php
  3. 2
      framework/behaviors/AttributeBehavior.php
  4. 4
      framework/behaviors/BlameableBehavior.php
  5. 6
      framework/behaviors/SluggableBehavior.php
  6. 4
      framework/behaviors/TimestampBehavior.php
  7. 2
      framework/caching/DbCache.php
  8. 2
      framework/caching/DbDependency.php
  9. 2
      framework/captcha/Captcha.php
  10. 2
      framework/console/controllers/CacheController.php
  11. 2
      framework/console/controllers/MigrateController.php
  12. 2
      framework/data/ActiveDataProvider.php
  13. 4
      framework/data/BaseDataProvider.php
  14. 2
      framework/data/SqlDataProvider.php
  15. 4
      framework/db/ActiveQuery.php
  16. 2
      framework/db/ActiveRecord.php
  17. 6
      framework/db/ActiveRelationTrait.php
  18. 4
      framework/db/BaseActiveRecord.php
  19. 2
      framework/db/Migration.php
  20. 4
      framework/db/Query.php
  21. 4
      framework/di/Instance.php
  22. 4
      framework/filters/AccessControl.php
  23. 4
      framework/filters/Cors.php
  24. 2
      framework/filters/PageCache.php
  25. 2
      framework/filters/RateLimiter.php
  26. 2
      framework/filters/VerbFilter.php
  27. 6
      framework/filters/auth/CompositeAuth.php
  28. 2
      framework/filters/auth/HttpBasicAuth.php
  29. 2
      framework/filters/auth/HttpBearerAuth.php
  30. 2
      framework/grid/ActionColumn.php
  31. 10
      framework/grid/GridView.php
  32. 4
      framework/i18n/DbMessageSource.php
  33. 2
      framework/log/DbTarget.php
  34. 2
      framework/mail/BaseMailer.php
  35. 2
      framework/mutex/DbMutex.php
  36. 6
      framework/rbac/DbManager.php
  37. 2
      framework/rbac/PhpManager.php
  38. 8
      framework/rest/Controller.php
  39. 2
      framework/test/DbFixture.php
  40. 6
      framework/test/FixtureTrait.php
  41. 2
      framework/validators/UniqueValidator.php
  42. 4
      framework/web/AssetManager.php
  43. 2
      framework/web/CacheSession.php
  44. 2
      framework/web/DbSession.php
  45. 2
      framework/widgets/ActiveField.php
  46. 4
      framework/widgets/BaseListView.php
  47. 2
      framework/widgets/FragmentCache.php
  48. 2
      framework/widgets/MaskedInput.php

2
framework/base/Event.php

@ -64,7 +64,7 @@ class Event extends Object
* `afterInsert` event:
*
* ```php
* Event::on(ActiveRecord::className(), ActiveRecord::EVENT_AFTER_INSERT, function ($event) {
* Event::on(ActiveRecord::class, ActiveRecord::EVENT_AFTER_INSERT, function ($event) {
* Yii::trace(get_class($event->sender) . ' is inserted.');
* });
* ```

2
framework/base/Object.php

@ -79,6 +79,8 @@ class Object implements Configurable
/**
* Returns the fully qualified name of this class.
* @return string the fully qualified name of this class.
* @deprecated since version 2.1. PHPs `::class` syntax should be used instead.
* For object instances, use `get_class()`.
*/
public static function className()
{

2
framework/behaviors/AttributeBehavior.php

@ -29,7 +29,7 @@ use yii\db\ActiveRecord;
* {
* return [
* [
* 'class' => AttributeBehavior::className(),
* 'class' => AttributeBehavior::class,
* 'attributes' => [
* ActiveRecord::EVENT_BEFORE_INSERT => 'attribute1',
* ActiveRecord::EVENT_BEFORE_UPDATE => 'attribute2',

4
framework/behaviors/BlameableBehavior.php

@ -21,7 +21,7 @@ use yii\db\BaseActiveRecord;
* public function behaviors()
* {
* return [
* BlameableBehavior::className(),
* BlameableBehavior::class,
* ];
* }
* ```
@ -36,7 +36,7 @@ use yii\db\BaseActiveRecord;
* {
* return [
* [
* 'class' => BlameableBehavior::className(),
* 'class' => BlameableBehavior::class,
* 'createdByAttribute' => 'author_id',
* 'updatedByAttribute' => 'updater_id',
* ],

6
framework/behaviors/SluggableBehavior.php

@ -25,7 +25,7 @@ use Yii;
* {
* return [
* [
* 'class' => SluggableBehavior::className(),
* 'class' => SluggableBehavior::class,
* 'attribute' => 'title',
* // 'slugAttribute' => 'slug',
* ],
@ -42,7 +42,7 @@ use Yii;
* {
* return [
* [
* 'class' => SluggableBehavior::className(),
* 'class' => SluggableBehavior::class,
* 'slugAttribute' => 'alias',
* ],
* ];
@ -219,7 +219,7 @@ class SluggableBehavior extends AttributeBehavior
/* @var $model BaseActiveRecord */
$validator = Yii::createObject(array_merge(
[
'class' => UniqueValidator::className()
'class' => UniqueValidator::class
],
$this->uniqueValidator
));

4
framework/behaviors/TimestampBehavior.php

@ -21,7 +21,7 @@ use yii\db\BaseActiveRecord;
* public function behaviors()
* {
* return [
* TimestampBehavior::className(),
* TimestampBehavior::class,
* ];
* }
* ```
@ -42,7 +42,7 @@ use yii\db\BaseActiveRecord;
* {
* return [
* [
* 'class' => TimestampBehavior::className(),
* 'class' => TimestampBehavior::class,
* 'createdAtAttribute' => 'create_time',
* 'updatedAtAttribute' => 'update_time',
* 'value' => new Expression('NOW()'),

2
framework/caching/DbCache.php

@ -82,7 +82,7 @@ class DbCache extends Cache
public function init()
{
parent::init();
$this->db = Instance::ensure($this->db, Connection::className());
$this->db = Instance::ensure($this->db, Connection::class);
}
/**

2
framework/caching/DbDependency.php

@ -47,7 +47,7 @@ class DbDependency extends Dependency
*/
protected function generateDependencyData($cache)
{
$db = Instance::ensure($this->db, Connection::className());
$db = Instance::ensure($this->db, Connection::class);
if ($this->sql === null) {
throw new InvalidConfigException('DbDependency::sql must be set.');
}

2
framework/captcha/Captcha.php

@ -50,7 +50,7 @@ use yii\widgets\InputWidget;
* method, for example like this:
*
* ```php
* <?= $form->field($model, 'captcha')->widget(\yii\captcha\Captcha::classname(), [
* <?= $form->field($model, 'captcha')->widget(\yii\captcha\Captcha::class, [
* // configure additional widget properties here
* ]) ?>
* ```

2
framework/console/controllers/CacheController.php

@ -273,6 +273,6 @@ class CacheController extends Controller
*/
private function isCacheClass($className)
{
return is_subclass_of($className, Cache::className());
return is_subclass_of($className, Cache::class);
}
}

2
framework/console/controllers/MigrateController.php

@ -149,7 +149,7 @@ class MigrateController extends BaseMigrateController
{
if (parent::beforeAction($action)) {
if ($action->id !== 'create') {
$this->db = Instance::ensure($this->db, Connection::className());
$this->db = Instance::ensure($this->db, Connection::class);
}
return true;
} else {

2
framework/data/ActiveDataProvider.php

@ -88,7 +88,7 @@ class ActiveDataProvider extends BaseDataProvider
{
parent::init();
if (is_string($this->db)) {
$this->db = Instance::ensure($this->db, Connection::className());
$this->db = Instance::ensure($this->db, Connection::class);
}
}

4
framework/data/BaseDataProvider.php

@ -189,7 +189,7 @@ abstract class BaseDataProvider extends Component implements DataProviderInterfa
public function setPagination($value)
{
if (is_array($value)) {
$config = ['class' => Pagination::className()];
$config = ['class' => Pagination::class];
if ($this->id !== null) {
$config['pageParam'] = $this->id . '-page';
$config['pageSizeParam'] = $this->id . '-per-page';
@ -229,7 +229,7 @@ abstract class BaseDataProvider extends Component implements DataProviderInterfa
public function setSort($value)
{
if (is_array($value)) {
$config = ['class' => Sort::className()];
$config = ['class' => Sort::class];
if ($this->id !== null) {
$config['sortParam'] = $this->id . '-sort';
}

2
framework/data/SqlDataProvider.php

@ -93,7 +93,7 @@ class SqlDataProvider extends BaseDataProvider
public function init()
{
parent::init();
$this->db = Instance::ensure($this->db, Connection::className());
$this->db = Instance::ensure($this->db, Connection::class);
if ($this->sql === null) {
throw new InvalidConfigException('The "sql" property must be set.');
}

4
framework/db/ActiveQuery.php

@ -660,7 +660,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
* ```php
* public function getActiveUsers()
* {
* return $this->hasMany(User::className(), ['id' => 'user_id'])
* return $this->hasMany(User::class, ['id' => 'user_id'])
* ->onCondition(['active' => true]);
* }
* ```
@ -730,7 +730,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
* ```php
* public function getItems()
* {
* return $this->hasMany(Item::className(), ['id' => 'item_id'])
* return $this->hasMany(Item::class, ['id' => 'item_id'])
* ->viaTable('order_item', ['order_id' => 'id']);
* }
* ```

2
framework/db/ActiveRecord.php

@ -268,7 +268,7 @@ class ActiveRecord extends BaseActiveRecord
*/
public static function find()
{
return Yii::createObject(ActiveQuery::className(), [get_called_class()]);
return Yii::createObject(ActiveQuery::class, [get_called_class()]);
}
/**

6
framework/db/ActiveRelationTrait.php

@ -85,12 +85,12 @@ trait ActiveRelationTrait
* ```php
* public function getOrders()
* {
* return $this->hasOne(Order::className(), ['id' => 'order_id']);
* return $this->hasOne(Order::class, ['id' => 'order_id']);
* }
*
* public function getOrderItems()
* {
* return $this->hasMany(Item::className(), ['id' => 'item_id'])
* return $this->hasMany(Item::class, ['id' => 'item_id'])
* ->via('orders');
* }
* ```
@ -123,7 +123,7 @@ trait ActiveRelationTrait
* ```php
* public function getOrders()
* {
* return $this->hasMany(Order::className(), ['customer_id' => 'id'])->inverseOf('customer');
* return $this->hasMany(Order::class, ['customer_id' => 'id'])->inverseOf('customer');
* }
* ```
*

4
framework/db/BaseActiveRecord.php

@ -319,7 +319,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
* ```php
* public function getCountry()
* {
* return $this->hasOne(Country::className(), ['id' => 'country_id']);
* return $this->hasOne(Country::class, ['id' => 'country_id']);
* }
* ```
*
@ -360,7 +360,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
* ```php
* public function getOrders()
* {
* return $this->hasMany(Order::className(), ['customer_id' => 'id']);
* return $this->hasMany(Order::class, ['customer_id' => 'id']);
* }
* ```
*

2
framework/db/Migration.php

@ -67,7 +67,7 @@ class Migration extends Component implements MigrationInterface
public function init()
{
parent::init();
$this->db = Instance::ensure($this->db, Connection::className());
$this->db = Instance::ensure($this->db, Connection::class);
$this->db->getSchema()->refresh();
}

4
framework/db/Query.php

@ -164,7 +164,7 @@ class Query extends Component implements QueryInterface
public function batch($batchSize = 100, $db = null)
{
return Yii::createObject([
'class' => BatchQueryResult::className(),
'class' => BatchQueryResult::class,
'query' => $this,
'batchSize' => $batchSize,
'db' => $db,
@ -191,7 +191,7 @@ class Query extends Component implements QueryInterface
public function each($batchSize = 100, $db = null)
{
return Yii::createObject([
'class' => BatchQueryResult::className(),
'class' => BatchQueryResult::class,
'query' => $this,
'batchSize' => $batchSize,
'db' => $db,

4
framework/di/Instance.php

@ -91,9 +91,9 @@ class Instance
* use yii\db\Connection;
*
* // returns Yii::$app->db
* $db = Instance::ensure('db', Connection::className());
* $db = Instance::ensure('db', Connection::class);
* // returns an instance of Connection using the given configuration
* $db = Instance::ensure(['dsn' => 'sqlite:path/to/my.db'], Connection::className());
* $db = Instance::ensure(['dsn' => 'sqlite:path/to/my.db'], Connection::class);
* ```
*
* @param object|string|array|static $reference an object or a reference to the desired object.

4
framework/filters/AccessControl.php

@ -31,7 +31,7 @@ use yii\web\ForbiddenHttpException;
* {
* return [
* 'access' => [
* 'class' => \yii\filters\AccessControl::className(),
* 'class' => \yii\filters\AccessControl::class,
* 'only' => ['create', 'update'],
* 'rules' => [
* // deny all POST requests
@ -95,7 +95,7 @@ class AccessControl extends ActionFilter
public function init()
{
parent::init();
$this->user = Instance::ensure($this->user, User::className());
$this->user = Instance::ensure($this->user, User::class);
foreach ($this->rules as $i => $rule) {
if (is_array($rule)) {
$this->rules[$i] = Yii::createObject(array_merge($this->ruleConfig, $rule));

4
framework/filters/Cors.php

@ -24,7 +24,7 @@ use yii\web\Response;
* {
* return [
* 'corsFilter' => [
* 'class' => \yii\filters\Cors::className(),
* 'class' => \yii\filters\Cors::class,
* ],
* ];
* }
@ -38,7 +38,7 @@ use yii\web\Response;
* {
* return [
* 'corsFilter' => [
* 'class' => \yii\filters\Cors::className(),
* 'class' => \yii\filters\Cors::class,
* 'cors' => [
* // restrict access to
* 'Origin' => ['http://www.myserver.com', 'https://www.myserver.com'],

2
framework/filters/PageCache.php

@ -148,7 +148,7 @@ class PageCache extends ActionFilter
return true;
}
$this->cache = Instance::ensure($this->cache, Cache::className());
$this->cache = Instance::ensure($this->cache, Cache::class);
if (is_array($this->dependency)) {
$this->dependency = Yii::createObject($this->dependency);

2
framework/filters/RateLimiter.php

@ -23,7 +23,7 @@ use yii\web\TooManyRequestsHttpException;
* {
* return [
* 'rateLimiter' => [
* 'class' => \yii\filters\RateLimiter::className(),
* 'class' => \yii\filters\RateLimiter::class,
* ],
* ];
* }

2
framework/filters/VerbFilter.php

@ -28,7 +28,7 @@ use yii\web\MethodNotAllowedHttpException;
* {
* return [
* 'verbs' => [
* 'class' => \yii\filters\VerbFilter::className(),
* 'class' => \yii\filters\VerbFilter::class,
* 'actions' => [
* 'index' => ['get'],
* 'view' => ['get'],

6
framework/filters/auth/CompositeAuth.php

@ -23,10 +23,10 @@ use yii\base\InvalidConfigException;
* {
* return [
* 'compositeAuth' => [
* 'class' => \yii\filters\auth\CompositeAuth::className(),
* 'class' => \yii\filters\auth\CompositeAuth::class,
* 'authMethods' => [
* \yii\filters\auth\HttpBasicAuth::className(),
* \yii\filters\auth\QueryParamAuth::className(),
* \yii\filters\auth\HttpBasicAuth::class,
* \yii\filters\auth\QueryParamAuth::class,
* ],
* ],
* ];

2
framework/filters/auth/HttpBasicAuth.php

@ -17,7 +17,7 @@ namespace yii\filters\auth;
* {
* return [
* 'basicAuth' => [
* 'class' => \yii\filters\auth\HttpBasicAuth::className(),
* 'class' => \yii\filters\auth\HttpBasicAuth::class,
* ],
* ];
* }

2
framework/filters/auth/HttpBearerAuth.php

@ -17,7 +17,7 @@ namespace yii\filters\auth;
* {
* return [
* 'bearerAuth' => [
* 'class' => \yii\filters\auth\HttpBearerAuth::className(),
* 'class' => \yii\filters\auth\HttpBearerAuth::class,
* ],
* ];
* }

2
framework/grid/ActionColumn.php

@ -21,7 +21,7 @@ use yii\helpers\Url;
* 'columns' => [
* // ...
* [
* 'class' => ActionColumn::className(),
* 'class' => ActionColumn::class,
* // you may configure additional properties here
* ],
* ]

10
framework/grid/GridView.php

@ -141,14 +141,14 @@ class GridView extends BaseListView
*
* ```php
* [
* ['class' => SerialColumn::className()],
* ['class' => SerialColumn::class],
* [
* 'class' => DataColumn::className(), // this line is optional
* 'class' => DataColumn::class, // this line is optional
* 'attribute' => 'name',
* 'format' => 'text',
* 'label' => 'Name',
* ],
* ['class' => CheckboxColumn::className()],
* ['class' => CheckboxColumn::class],
* ]
* ```
*
@ -526,7 +526,7 @@ class GridView extends BaseListView
$column = $this->createDataColumn($column);
} else {
$column = Yii::createObject(array_merge([
'class' => $this->dataColumnClass ? : DataColumn::className(),
'class' => $this->dataColumnClass ? : DataColumn::class,
'grid' => $this,
], $column));
}
@ -551,7 +551,7 @@ class GridView extends BaseListView
}
return Yii::createObject([
'class' => $this->dataColumnClass ? : DataColumn::className(),
'class' => $this->dataColumnClass ? : DataColumn::class,
'grid' => $this,
'attribute' => $matches[1],
'format' => isset($matches[3]) ? $matches[3] : 'text',

4
framework/i18n/DbMessageSource.php

@ -90,9 +90,9 @@ class DbMessageSource extends MessageSource
public function init()
{
parent::init();
$this->db = Instance::ensure($this->db, Connection::className());
$this->db = Instance::ensure($this->db, Connection::class);
if ($this->enableCaching) {
$this->cache = Instance::ensure($this->cache, Cache::className());
$this->cache = Instance::ensure($this->cache, Cache::class);
}
}

2
framework/log/DbTarget.php

@ -52,7 +52,7 @@ class DbTarget extends Target
public function init()
{
parent::init();
$this->db = Instance::ensure($this->db, Connection::className());
$this->db = Instance::ensure($this->db, Connection::class);
}
/**

2
framework/mail/BaseMailer.php

@ -140,7 +140,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
protected function createView(array $config)
{
if (!array_key_exists('class', $config)) {
$config['class'] = View::className();
$config['class'] = View::class;
}
return Yii::createObject($config);

2
framework/mutex/DbMutex.php

@ -38,6 +38,6 @@ abstract class DbMutex extends Mutex
public function init()
{
parent::init();
$this->db = Instance::ensure($this->db, Connection::className());
$this->db = Instance::ensure($this->db, Connection::class);
}
}

6
framework/rbac/DbManager.php

@ -107,9 +107,9 @@ class DbManager extends BaseManager
public function init()
{
parent::init();
$this->db = Instance::ensure($this->db, Connection::className());
$this->db = Instance::ensure($this->db, Connection::class);
if ($this->cache !== null) {
$this->cache = Instance::ensure($this->cache, Cache::className());
$this->cache = Instance::ensure($this->cache, Cache::class);
}
}
@ -431,7 +431,7 @@ class DbManager extends BaseManager
*/
protected function populateItem($row)
{
$class = $row['type'] == Item::TYPE_PERMISSION ? Permission::className() : Role::className();
$class = $row['type'] == Item::TYPE_PERMISSION ? Permission::class : Role::class;
if (!isset($row['data']) || ($data = @unserialize($row['data'])) === false) {
$data = null;

2
framework/rbac/PhpManager.php

@ -691,7 +691,7 @@ class PhpManager extends BaseManager
$rules = $this->loadFromFile($this->ruleFile);
foreach ($items as $name => $item) {
$class = $item['type'] == Item::TYPE_PERMISSION ? Permission::className() : Role::className();
$class = $item['type'] == Item::TYPE_PERMISSION ? Permission::class : Role::class;
$this->items[$name] = new $class([
'name' => $name,

8
framework/rest/Controller.php

@ -47,21 +47,21 @@ class Controller extends \yii\web\Controller
{
return [
'contentNegotiator' => [
'class' => ContentNegotiator::className(),
'class' => ContentNegotiator::class,
'formats' => [
'application/json' => Response::FORMAT_JSON,
'application/xml' => Response::FORMAT_XML,
],
],
'verbFilter' => [
'class' => VerbFilter::className(),
'class' => VerbFilter::class,
'actions' => $this->verbs(),
],
'authenticator' => [
'class' => CompositeAuth::className(),
'class' => CompositeAuth::class,
],
'rateLimiter' => [
'class' => RateLimiter::className(),
'class' => RateLimiter::class,
],
];
}

2
framework/test/DbFixture.php

@ -37,6 +37,6 @@ abstract class DbFixture extends Fixture
public function init()
{
parent::init();
$this->db = Instance::ensure($this->db, Object::className());
$this->db = Instance::ensure($this->db, Object::class);
}
}

6
framework/test/FixtureTrait.php

@ -40,12 +40,12 @@ trait FixtureTrait
* ```php
* [
* // anonymous fixture
* PostFixture::className(),
* PostFixture::class,
* // "users" fixture
* 'users' => UserFixture::className(),
* 'users' => UserFixture::class,
* // "cache" fixture with configuration
* 'cache' => [
* 'class' => CacheFixture::className(),
* 'class' => CacheFixture::class,
* 'host' => 'xxx',
* ],
* ]

2
framework/validators/UniqueValidator.php

@ -106,7 +106,7 @@ class UniqueValidator extends Validator
$query->andWhere($this->filter);
}
if (!$model instanceof ActiveRecordInterface || $model->getIsNewRecord() || $model->className() !== $targetClass::className()) {
if (!$model instanceof ActiveRecordInterface || $model->getIsNewRecord() || get_class($model) !== $targetClass::class) {
// if current $model isn't in the database yet then it's OK just to call exists()
// also there's no need to run check based on primary keys, when $targetClass is not the same as $model's class
$exists = $query->exists();

4
framework/web/AssetManager.php

@ -371,10 +371,10 @@ class AssetManager extends Component
public function getConverter()
{
if ($this->_converter === null) {
$this->_converter = Yii::createObject(AssetConverter::className());
$this->_converter = Yii::createObject(AssetConverter::class);
} elseif (is_array($this->_converter) || is_string($this->_converter)) {
if (is_array($this->_converter) && !isset($this->_converter['class'])) {
$this->_converter['class'] = AssetConverter::className();
$this->_converter['class'] = AssetConverter::class;
}
$this->_converter = Yii::createObject($this->_converter);
}

2
framework/web/CacheSession.php

@ -56,7 +56,7 @@ class CacheSession extends Session
public function init()
{
parent::init();
$this->cache = Instance::ensure($this->cache, Cache::className());
$this->cache = Instance::ensure($this->cache, Cache::class);
}
/**

2
framework/web/DbSession.php

@ -83,7 +83,7 @@ class DbSession extends MultiFieldSession
public function init()
{
parent::init();
$this->db = Instance::ensure($this->db, Connection::className());
$this->db = Instance::ensure($this->db, Connection::class);
}
/**

2
framework/widgets/ActiveField.php

@ -653,7 +653,7 @@ class ActiveField extends Component
* the following code, assuming that `$form` is your [[ActiveForm]] instance:
*
* ```php
* $form->field($model, 'date')->widget(\yii\widgets\MaskedInput::className(), [
* $form->field($model, 'date')->widget(\yii\widgets\MaskedInput::class, [
* 'mask' => '99/99/9999',
* ]);
* ```

4
framework/widgets/BaseListView.php

@ -237,7 +237,7 @@ abstract class BaseListView extends Widget
}
/* @var $class LinkPager */
$pager = $this->pager;
$class = ArrayHelper::remove($pager, 'class', LinkPager::className());
$class = ArrayHelper::remove($pager, 'class', LinkPager::class);
$pager['pagination'] = $pagination;
$pager['view'] = $this->getView();
@ -256,7 +256,7 @@ abstract class BaseListView extends Widget
}
/* @var $class LinkSorter */
$sorter = $this->sorter;
$class = ArrayHelper::remove($sorter, 'class', LinkSorter::className());
$class = ArrayHelper::remove($sorter, 'class', LinkSorter::class);
$sorter['sort'] = $sort;
$sorter['view'] = $this->getView();

2
framework/widgets/FragmentCache.php

@ -84,7 +84,7 @@ class FragmentCache extends Widget
{
parent::init();
$this->cache = $this->enabled ? Instance::ensure($this->cache, Cache::className()) : null;
$this->cache = $this->enabled ? Instance::ensure($this->cache, Cache::class) : null;
if ($this->cache instanceof Cache && $this->getCachedContent() === false) {
$this->getView()->cacheStack[] = $this;

2
framework/widgets/MaskedInput.php

@ -33,7 +33,7 @@ use yii\web\View;
* method, for example like this:
*
* ```php
* <?= $form->field($model, 'from_date')->widget(\yii\widgets\MaskedInput::className(), [
* <?= $form->field($model, 'from_date')->widget(\yii\widgets\MaskedInput::class, [
* 'mask' => '999-999-9999',
* ]) ?>
* ```

Loading…
Cancel
Save