S
S
Svetlana Galenko2018-10-28 22:57:42
Yii
Svetlana Galenko, 2018-10-28 22:57:42

Why does phpStorm strike out "className" syntax in yii2?

Greetings, I understand that some functions have changed due to the update of yii2, and ::className()
here is an example of what I mean:
5bd613bce0bbf607289789.png
The documentation advises to change to ::class()
But I do it

<?= $form->field($model, 'text')->widget(Widget::class(), [
        'settings' => [
            'lang' => 'ru',
            'uploadOnlyImage' => true,
            'validatorOptions' => ['maxSize' => 40000],
            'minHeight' => 200,
            'plugins' => [
                'imagemanager',
            ],
            'imageUpload' => Url::to(['/admin/news/image-upload']),
            'imageManagerJson' => Url::to(['/admin/news/images-get']),
        ]
    ]); ?>

And it gives me an error:
syntax error, unexpected '('
1. in C:\Users\acer\OSPanel\domains\medicalyii2\modules\admin\views\news\_form.php at line
/* @var $form yii\widgets\ActiveForm */
?>
 
<div class="user-form">
 
    <?php $form = ActiveForm::begin(); ?>
 
    <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
 
    <?= $form->field($model, 'text')->widget(Widget::class(), [
        'settings' => [
            'lang' => 'ru',
            'uploadOnlyImage' => true,
            'validatorOptions' => ['maxSize' => 40000],
            'minHeight' => 200,
            'plugins' => [
                'imagemanager',
            ],
            'imageUpload' => Url::to(['/admin/news/image-upload']),
                
2. yii\base\ErrorHandler::handleFatalError()

Please help me figure out how to call this function.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2018-10-28
@swallow_97

Because the developers considered it depricate and made the right decision to use the native expression that appeared in the 5.5.0 version of PHP
Widget::class

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question