Browse Source

::class syntax in the Guide

only partially. covered ::className() replacement and the
concept-configuration.md
tags/3.0.0-alpha1
Carsten Brandt 9 years ago
parent
commit
636591d284
  1. 20
      docs/guide/concept-behaviors.md
  2. 2
      docs/guide/concept-components.md
  3. 28
      docs/guide/concept-configurations.md
  4. 16
      docs/guide/concept-events.md
  5. 33
      docs/guide/db-active-record.md
  6. 2
      docs/guide/input-validation.md
  7. 4
      docs/guide/output-client-scripts.md
  8. 10
      docs/guide/rest-authentication.md
  9. 2
      docs/guide/rest-controllers.md
  10. 6
      docs/guide/security-authorization.md
  11. 22
      docs/guide/structure-filters.md
  12. 2
      docs/guide/test-fixtures.md

20
docs/guide/concept-behaviors.md

@ -120,21 +120,21 @@ class User extends ActiveRecord
{ {
return [ return [
// anonymous behavior, behavior class name only // anonymous behavior, behavior class name only
MyBehavior::className(), MyBehavior::class,
// named behavior, behavior class name only // named behavior, behavior class name only
'myBehavior2' => MyBehavior::className(), 'myBehavior2' => MyBehavior::class,
// anonymous behavior, configuration array // anonymous behavior, configuration array
[ [
'class' => MyBehavior::className(), 'class' => MyBehavior::class,
'prop1' => 'value1', 'prop1' => 'value1',
'prop2' => 'value2', 'prop2' => 'value2',
], ],
// named behavior, configuration array // named behavior, configuration array
'myBehavior4' => [ 'myBehavior4' => [
'class' => MyBehavior::className(), 'class' => MyBehavior::class,
'prop1' => 'value1', 'prop1' => 'value1',
'prop2' => 'value2', 'prop2' => 'value2',
] ]
@ -156,11 +156,11 @@ use app\components\MyBehavior;
$component->attachBehavior('myBehavior1', new MyBehavior); $component->attachBehavior('myBehavior1', new MyBehavior);
// attach a behavior class // attach a behavior class
$component->attachBehavior('myBehavior2', MyBehavior::className()); $component->attachBehavior('myBehavior2', MyBehavior::class);
// attach a configuration array // attach a configuration array
$component->attachBehavior('myBehavior3', [ $component->attachBehavior('myBehavior3', [
'class' => MyBehavior::className(), 'class' => MyBehavior::class,
'prop1' => 'value1', 'prop1' => 'value1',
'prop2' => 'value2', 'prop2' => 'value2',
]); ]);
@ -171,7 +171,7 @@ You may attach multiple behaviors at once using the [[yii\base\Component::attach
```php ```php
$component->attachBehaviors([ $component->attachBehaviors([
'myBehavior1' => new MyBehavior, // a named behavior 'myBehavior1' => new MyBehavior, // a named behavior
MyBehavior::className(), // an anonymous behavior MyBehavior::class, // an anonymous behavior
]); ]);
``` ```
@ -179,10 +179,10 @@ You may also attach behaviors through [configurations](concept-configurations.md
```php ```php
[ [
'as myBehavior2' => MyBehavior::className(), 'as myBehavior2' => MyBehavior::class,
'as myBehavior3' => [ 'as myBehavior3' => [
'class' => MyBehavior::className(), 'class' => MyBehavior::class,
'prop1' => 'value1', 'prop1' => 'value1',
'prop2' => 'value2', 'prop2' => 'value2',
], ],
@ -272,7 +272,7 @@ class User extends ActiveRecord
{ {
return [ return [
[ [
'class' => TimestampBehavior::className(), 'class' => TimestampBehavior::class,
'attributes' => [ 'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'],
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],

2
docs/guide/concept-components.md

@ -76,7 +76,7 @@ Following these guidelines will make your components [configurable](concept-conf
$component = new MyClass(1, 2, ['prop1' => 3, 'prop2' => 4]); $component = new MyClass(1, 2, ['prop1' => 3, 'prop2' => 4]);
// alternatively // alternatively
$component = \Yii::createObject([ $component = \Yii::createObject([
'class' => MyClass::className(), 'class' => MyClass::class,
'prop1' => 3, 'prop1' => 3,
'prop2' => 4, 'prop2' => 4,
], [1, 2]); ], [1, 2]);

28
docs/guide/concept-configurations.md

@ -51,6 +51,8 @@ The format of a configuration can be formally described as:
where where
* The `class` element specifies a fully qualified class name for the object being created. * The `class` element specifies a fully qualified class name for the object being created.
Instead of string, you may use the [`::class` PHP syntax](http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class)
to specify the class name. This enables better IDE navigation.
* The `propertyName` elements specify the initial values for the named property. The keys are the property names, and the * The `propertyName` elements specify the initial values for the named property. The keys are the property names, and the
values are the corresponding initial values. Only public member variables and [properties](concept-properties.md) values are the corresponding initial values. Only public member variables and [properties](concept-properties.md)
defined by getters/setters can be configured. defined by getters/setters can be configured.
@ -65,7 +67,7 @@ Below is an example showing a configuration with initial property values, event
```php ```php
[ [
'class' => 'app\components\SearchEngine', 'class' => \app\components\SearchEngine::class,
'apiKey' => 'xxxxxxxx', 'apiKey' => 'xxxxxxxx',
'on search' => function ($event) { 'on search' => function ($event) {
Yii::info("Keyword searched: " . $event->keyword); Yii::info("Keyword searched: " . $event->keyword);
@ -100,22 +102,22 @@ $config = [
'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'), 'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
'components' => [ 'components' => [
'cache' => [ 'cache' => [
'class' => 'yii\caching\FileCache', 'class' => \yii\caching\FileCache::class,
], ],
'mailer' => [ 'mailer' => [
'class' => 'yii\swiftmailer\Mailer', 'class' => \yii\swiftmailer\Mailer::class,
], ],
'log' => [ 'log' => [
'class' => 'yii\log\Dispatcher', 'class' => \yii\log\Dispatcher::class,
'traceLevel' => YII_DEBUG ? 3 : 0, 'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [ 'targets' => [
[ [
'class' => 'yii\log\FileTarget', 'class' => \yii\log\FileTarget::class,
], ],
], ],
], ],
'db' => [ 'db' => [
'class' => 'yii\db\Connection', 'class' => \yii\db\Connection::class,
'dsn' => 'mysql:host=localhost;dbname=stay2', 'dsn' => 'mysql:host=localhost;dbname=stay2',
'username' => 'root', 'username' => 'root',
'password' => '', 'password' => '',
@ -182,22 +184,22 @@ and "require" this file in `web.php` as shown above. The content of `components.
```php ```php
return [ return [
'cache' => [ 'cache' => [
'class' => 'yii\caching\FileCache', 'class' => \yii\caching\FileCache::class,
], ],
'mailer' => [ 'mailer' => [
'class' => 'yii\swiftmailer\Mailer', 'class' => yii\swiftmailer\Mailer::class,
], ],
'log' => [ 'log' => [
'class' => 'yii\log\Dispatcher', 'class' => \yii\log\Dispatcher::class,
'traceLevel' => YII_DEBUG ? 3 : 0, 'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [ 'targets' => [
[ [
'class' => 'yii\log\FileTarget', 'class' => \yii\log\FileTarget::class,
], ],
], ],
], ],
'db' => [ 'db' => [
'class' => 'yii\db\Connection', 'class' => \yii\db\Connection::class,
'dsn' => 'mysql:host=localhost;dbname=stay2', 'dsn' => 'mysql:host=localhost;dbname=stay2',
'username' => 'root', 'username' => 'root',
'password' => '', 'password' => '',
@ -225,7 +227,7 @@ For example, if you want to customize [[yii\widgets\LinkPager]] so that ALL link
(the default value is 10), you may use the following code to achieve this goal, (the default value is 10), you may use the following code to achieve this goal,
```php ```php
\Yii::$container->set('yii\widgets\LinkPager', [ \Yii::$container->set(\yii\widgets\LinkPager::class, [
'maxButtonCount' => 5, 'maxButtonCount' => 5,
]); ]);
``` ```
@ -263,7 +265,7 @@ $config = [...];
if (YII_ENV_DEV) { if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment // configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug'; $config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module'; $config['modules']['debug'] = \yii\debug\Module::class;
} }
return $config; return $config;

16
docs/guide/concept-events.md

@ -211,7 +211,7 @@ use Yii;
use yii\base\Event; use yii\base\Event;
use yii\db\ActiveRecord; use yii\db\ActiveRecord;
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'); Yii::trace(get_class($event->sender) . ' is inserted');
}); });
``` ```
@ -229,11 +229,11 @@ handlers only. For example:
```php ```php
use yii\base\Event; use yii\base\Event;
Event::on(Foo::className(), Foo::EVENT_HELLO, function ($event) { Event::on(Foo::class, Foo::EVENT_HELLO, function ($event) {
echo $event->sender; // displays "app\models\Foo" echo $event->sender; // displays "app\models\Foo"
}); });
Event::trigger(Foo::className(), Foo::EVENT_HELLO); Event::trigger(Foo::class, Foo::EVENT_HELLO);
``` ```
Note that, in this case, `$event->sender` refers to the name of the class triggering the event instead of an object instance. Note that, in this case, `$event->sender` refers to the name of the class triggering the event instead of an object instance.
@ -245,10 +245,10 @@ To detach a class-level event handler, call [[yii\base\Event::off()]]. For examp
```php ```php
// detach $handler // detach $handler
Event::off(Foo::className(), Foo::EVENT_HELLO, $handler); Event::off(Foo::class, Foo::EVENT_HELLO, $handler);
// detach all handlers of Foo::EVENT_HELLO // detach all handlers of Foo::EVENT_HELLO
Event::off(Foo::className(), Foo::EVENT_HELLO); Event::off(Foo::class, Foo::EVENT_HELLO);
``` ```
@ -301,7 +301,7 @@ Event::on('DanceEventInterface', DanceEventInterface::EVENT_DANCE, function ($ev
You can trigger the event of those classes: You can trigger the event of those classes:
```php ```php
Event::trigger(DanceEventInterface::className(), DanceEventInterface::EVENT_DANCE); Event::trigger(DanceEventInterface::class, DanceEventInterface::EVENT_DANCE);
``` ```
But please notice, that you can not trigger all the classes, that implement the interface: But please notice, that you can not trigger all the classes, that implement the interface:
@ -315,10 +315,10 @@ To detach event handler, call [[yii\base\Event::off()|Event::off()]]. For exampl
```php ```php
// detaches $handler // detaches $handler
Event::off('DanceEventInterface', DanceEventInterface::EVENT_DANCE, $handler); Event::off(DanceEventInterface::class, DanceEventInterface::EVENT_DANCE, $handler);
// detaches all handlers of DanceEventInterface::EVENT_DANCE // detaches all handlers of DanceEventInterface::EVENT_DANCE
Event::off('DanceEventInterface', DanceEventInterface::EVENT_DANCE); Event::off(DanceEventInterface::class, DanceEventInterface::EVENT_DANCE);
``` ```

33
docs/guide/db-active-record.md

@ -717,7 +717,7 @@ class Customer extends ActiveRecord
public function getOrders() public function getOrders()
{ {
return $this->hasMany(Order::className(), ['customer_id' => 'id']); return $this->hasMany(Order::class, ['customer_id' => 'id']);
} }
} }
@ -727,7 +727,7 @@ class Order extends ActiveRecord
public function getCustomer() public function getCustomer()
{ {
return $this->hasOne(Customer::className(), ['id' => 'customer_id']); return $this->hasOne(Customer::class, ['id' => 'customer_id']);
} }
} }
``` ```
@ -745,8 +745,9 @@ While declaring a relation, you should specify the following information:
declarations that a customer has many orders while an order only has one customer. declarations that a customer has many orders while an order only has one customer.
- the name of the related Active Record class: specified as the first parameter to - the name of the related Active Record class: specified as the first parameter to
either [[yii\db\ActiveRecord::hasMany()|hasMany()]] or [[yii\db\ActiveRecord::hasOne()|hasOne()]]. either [[yii\db\ActiveRecord::hasMany()|hasMany()]] or [[yii\db\ActiveRecord::hasOne()|hasOne()]].
A recommended practice is to call `Xyz::className()` to get the class name string so that you can receive A recommended practice is to use the `Xyz::class` syntax provided by PHP to get the class name string so that you can receive
IDE auto-completion support as well as error detection at compiling stage. IDE auto-completion support as well as error detection using static analysis tools.
Using the `::class` syntax does not trigger auto loading, so this does not violate the lazy loading approach.
- the link between the two types of data: specifies the column(s) through which the two types of data are related. - the link between the two types of data: specifies the column(s) through which the two types of data are related.
The array values are the columns of the primary data (represented by the Active Record class that you are declaring The array values are the columns of the primary data (represented by the Active Record class that you are declaring
relations), while the array keys are the columns of the related data. relations), while the array keys are the columns of the related data.
@ -823,7 +824,7 @@ class Customer extends ActiveRecord
{ {
public function getBigOrders($threshold = 100) public function getBigOrders($threshold = 100)
{ {
return $this->hasMany(Order::className(), ['customer_id' => 'id']) return $this->hasMany(Order::class, ['customer_id' => 'id'])
->where('subtotal > :threshold', [':threshold' => $threshold]) ->where('subtotal > :threshold', [':threshold' => $threshold])
->orderBy('id'); ->orderBy('id');
} }
@ -858,7 +859,7 @@ class Order extends ActiveRecord
{ {
public function getItems() 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']); ->viaTable('order_item', ['order_id' => 'id']);
} }
} }
@ -871,12 +872,12 @@ class Order extends ActiveRecord
{ {
public function getOrderItems() public function getOrderItems()
{ {
return $this->hasMany(OrderItem::className(), ['order_id' => 'id']); return $this->hasMany(OrderItem::class, ['order_id' => 'id']);
} }
public function getItems() public function getItems()
{ {
return $this->hasMany(Item::className(), ['id' => 'item_id']) return $this->hasMany(Item::class, ['id' => 'item_id'])
->via('orderItems'); ->via('orderItems');
} }
} }
@ -1127,7 +1128,7 @@ class Customer extends ActiveRecord
{ {
public function getOrders() public function getOrders()
{ {
return $this->hasMany(Order::className(), ['customer_id' => 'id']); return $this->hasMany(Order::class, ['customer_id' => 'id']);
} }
} }
@ -1135,7 +1136,7 @@ class Order extends ActiveRecord
{ {
public function getCustomer() public function getCustomer()
{ {
return $this->hasOne(Customer::className(), ['id' => 'customer_id']); return $this->hasOne(Customer::class, ['id' => 'customer_id']);
} }
} }
``` ```
@ -1169,7 +1170,7 @@ class Customer extends ActiveRecord
{ {
public function getOrders() public function getOrders()
{ {
return $this->hasMany(Order::className(), ['customer_id' => 'id'])->inverseOf('customer'); return $this->hasMany(Order::class, ['customer_id' => 'id'])->inverseOf('customer');
} }
} }
``` ```
@ -1280,7 +1281,7 @@ class Customer extends \yii\db\ActiveRecord
public function getComments() public function getComments()
{ {
// a customer has many comments // a customer has many comments
return $this->hasMany(Comment::className(), ['customer_id' => 'id']); return $this->hasMany(Comment::class, ['customer_id' => 'id']);
} }
} }
@ -1295,7 +1296,7 @@ class Comment extends \yii\mongodb\ActiveRecord
public function getCustomer() public function getCustomer()
{ {
// a comment has one customer // a comment has one customer
return $this->hasOne(Customer::className(), ['id' => 'customer_id']); return $this->hasOne(Customer::class, ['id' => 'customer_id']);
} }
} }
@ -1371,7 +1372,7 @@ class Customer extends \yii\db\ActiveRecord
{ {
public function getActiveComments() public function getActiveComments()
{ {
return $this->hasMany(Comment::className(), ['customer_id' => 'id'])->active(); return $this->hasMany(Comment::class, ['customer_id' => 'id'])->active();
} }
} }
@ -1441,7 +1442,7 @@ class Customer extends \yii\db\ActiveRecord
public function getOrders() public function getOrders()
{ {
return $this->hasMany(Order::className(), ['customer_id' => 'id']); return $this->hasMany(Order::class, ['customer_id' => 'id']);
} }
} }
``` ```
@ -1535,7 +1536,7 @@ class Customer extends \yii\db\ActiveRecord
public function getOrders() public function getOrders()
{ {
return $this->hasMany(Order::className(), ['customer_id' => 'id']); return $this->hasMany(Order::class, ['customer_id' => 'id']);
} }
} }
``` ```

2
docs/guide/input-validation.md

@ -412,7 +412,7 @@ class EntryForm extends Model
{ {
return [ return [
[['name', 'email'], 'required'], [['name', 'email'], 'required'],
['country', CountryValidator::className()], ['country', CountryValidator::class],
['email', 'email'], ['email', 'email'],
]; ];
} }

4
docs/guide/output-client-scripts.md

@ -30,7 +30,7 @@ instead of adding a new one. If you don't provide it, the JS code itself will be
An external script can be added like the following: An external script can be added like the following:
```php ```php
$this->registerJsFile('http://example.com/js/main.js', ['depends' => [\yii\web\JqueryAsset::className()]]); $this->registerJsFile('http://example.com/js/main.js', ['depends' => [\yii\web\JqueryAsset::class]]);
``` ```
The arguments for [[yii\web\View::registerJsFile()|registerJsFile()]] are similar to those for The arguments for [[yii\web\View::registerJsFile()|registerJsFile()]] are similar to those for
@ -77,7 +77,7 @@ If you need to make sure there's only a single style tag use fourth argument as
```php ```php
$this->registerCssFile("http://example.com/css/themes/black-and-white.css", [ $this->registerCssFile("http://example.com/css/themes/black-and-white.css", [
'depends' => [BootstrapAsset::className()], 'depends' => [BootstrapAsset::class],
'media' => 'print', 'media' => 'print',
], 'css-print-theme'); ], 'css-print-theme');
``` ```

10
docs/guide/rest-authentication.md

@ -57,7 +57,7 @@ public function behaviors()
{ {
$behaviors = parent::behaviors(); $behaviors = parent::behaviors();
$behaviors['authenticator'] = [ $behaviors['authenticator'] = [
'class' => HttpBasicAuth::className(), 'class' => HttpBasicAuth::class,
]; ];
return $behaviors; return $behaviors;
} }
@ -75,11 +75,11 @@ public function behaviors()
{ {
$behaviors = parent::behaviors(); $behaviors = parent::behaviors();
$behaviors['authenticator'] = [ $behaviors['authenticator'] = [
'class' => CompositeAuth::className(), 'class' => CompositeAuth::class,
'authMethods' => [ 'authMethods' => [
HttpBasicAuth::className(), HttpBasicAuth::class,
HttpBearerAuth::className(), HttpBearerAuth::class,
QueryParamAuth::className(), QueryParamAuth::class,
], ],
]; ];
return $behaviors; return $behaviors;

2
docs/guide/rest-controllers.md

@ -69,7 +69,7 @@ public function behaviors()
{ {
$behaviors = parent::behaviors(); $behaviors = parent::behaviors();
$behaviors['authenticator'] = [ $behaviors['authenticator'] = [
'class' => HttpBasicAuth::className(), 'class' => HttpBasicAuth::class,
]; ];
return $behaviors; return $behaviors;
} }

6
docs/guide/security-authorization.md

@ -25,7 +25,7 @@ class SiteController extends Controller
{ {
return [ return [
'access' => [ 'access' => [
'class' => AccessControl::className(), 'class' => AccessControl::class,
'only' => ['login', 'logout', 'signup'], 'only' => ['login', 'logout', 'signup'],
'rules' => [ 'rules' => [
[ [
@ -70,7 +70,7 @@ You may customize this behavior by configuring the [[yii\filters\AccessControl::
```php ```php
[ [
'class' => AccessControl::className(), 'class' => AccessControl::class,
... ...
'denyCallback' => function ($rule, $action) { 'denyCallback' => function ($rule, $action) {
throw new \Exception('You are not allowed to access this page'); throw new \Exception('You are not allowed to access this page');
@ -126,7 +126,7 @@ class SiteController extends Controller
{ {
return [ return [
'access' => [ 'access' => [
'class' => AccessControl::className(), 'class' => AccessControl::class,
'only' => ['special-callback'], 'only' => ['special-callback'],
'rules' => [ 'rules' => [
[ [

22
docs/guide/structure-filters.md

@ -121,7 +121,7 @@ public function behaviors()
{ {
return [ return [
'access' => [ 'access' => [
'class' => AccessControl::className(), 'class' => AccessControl::class,
'only' => ['create', 'update'], 'only' => ['create', 'update'],
'rules' => [ 'rules' => [
// allow authenticated users // allow authenticated users
@ -157,7 +157,7 @@ public function behaviors()
{ {
return [ return [
'basicAuth' => [ 'basicAuth' => [
'class' => HttpBasicAuth::className(), 'class' => HttpBasicAuth::class,
], ],
]; ];
} }
@ -183,7 +183,7 @@ public function behaviors()
{ {
return [ return [
[ [
'class' => ContentNegotiator::className(), 'class' => ContentNegotiator::class,
'formats' => [ 'formats' => [
'application/json' => Response::FORMAT_JSON, 'application/json' => Response::FORMAT_JSON,
'application/xml' => Response::FORMAT_XML, 'application/xml' => Response::FORMAT_XML,
@ -210,7 +210,7 @@ use yii\web\Response;
[ [
'bootstrap' => [ 'bootstrap' => [
[ [
'class' => ContentNegotiator::className(), 'class' => ContentNegotiator::class,
'formats' => [ 'formats' => [
'application/json' => Response::FORMAT_JSON, 'application/json' => Response::FORMAT_JSON,
'application/xml' => Response::FORMAT_XML, 'application/xml' => Response::FORMAT_XML,
@ -241,7 +241,7 @@ public function behaviors()
{ {
return [ return [
[ [
'class' => HttpCache::className(), 'class' => HttpCache::class,
'only' => ['index'], 'only' => ['index'],
'lastModified' => function ($action, $params) { 'lastModified' => function ($action, $params) {
$q = new \yii\db\Query(); $q = new \yii\db\Query();
@ -269,11 +269,11 @@ public function behaviors()
{ {
return [ return [
'pageCache' => [ 'pageCache' => [
'class' => PageCache::className(), 'class' => PageCache::class,
'only' => ['index'], 'only' => ['index'],
'duration' => 60, 'duration' => 60,
'dependency' => [ 'dependency' => [
'class' => DbDependency::className(), 'class' => DbDependency::class,
'sql' => 'SELECT COUNT(*) FROM post', 'sql' => 'SELECT COUNT(*) FROM post',
], ],
'variations' => [ 'variations' => [
@ -307,7 +307,7 @@ public function behaviors()
{ {
return [ return [
'verbs' => [ 'verbs' => [
'class' => VerbFilter::className(), 'class' => VerbFilter::class,
'actions' => [ 'actions' => [
'index' => ['get'], 'index' => ['get'],
'view' => ['get'], 'view' => ['get'],
@ -339,7 +339,7 @@ public function behaviors()
{ {
return ArrayHelper::merge([ return ArrayHelper::merge([
[ [
'class' => Cors::className(), 'class' => Cors::class,
], ],
], parent::behaviors()); ], parent::behaviors());
} }
@ -363,7 +363,7 @@ public function behaviors()
{ {
return ArrayHelper::merge([ return ArrayHelper::merge([
[ [
'class' => Cors::className(), 'class' => Cors::class,
'cors' => [ 'cors' => [
'Origin' => ['http://www.myserver.net'], 'Origin' => ['http://www.myserver.net'],
'Access-Control-Request-Method' => ['GET', 'HEAD', 'OPTIONS'], 'Access-Control-Request-Method' => ['GET', 'HEAD', 'OPTIONS'],
@ -384,7 +384,7 @@ public function behaviors()
{ {
return ArrayHelper::merge([ return ArrayHelper::merge([
[ [
'class' => Cors::className(), 'class' => Cors::class,
'cors' => [ 'cors' => [
'Origin' => ['http://www.myserver.net'], 'Origin' => ['http://www.myserver.net'],
'Access-Control-Request-Method' => ['GET', 'HEAD', 'OPTIONS'], 'Access-Control-Request-Method' => ['GET', 'HEAD', 'OPTIONS'],

2
docs/guide/test-fixtures.md

@ -129,7 +129,7 @@ class UserProfileTest extends DbTestCase
public function fixtures() public function fixtures()
{ {
return [ return [
'profiles' => UserProfileFixture::className(), 'profiles' => UserProfileFixture::class,
]; ];
} }

Loading…
Cancel
Save