Reputation: 423
In Yii2 codebase, I saw 2 different types of config declaration:
One way with CLASS_NAME::class
'options' => ['class' => OptionsAction::class],
Another way with full string representation
'options' => ['class' => 'yii\rest\OptionsAction'],
Which way is preferable and why?
Upvotes: 3
Views: 59
Reputation: 6456
Both ways might be used, but the better way is the declaration with help ::class
because:
Upvotes: 2