Gii generated ModelSearch with error

I generated model and CRUD with gii. Right after it I go to index page and then this error comes out:

PHP Compile Error – yii\base\ErrorException

Namespace declaration statement has to be the very first statement in the script

  1. in C:\OpenServer\domains\mysite\models\MymodelSearch.php

the declaration of the namespace is actually the very first statement. From what I read from other sites this kind of problem comes out because of editor. But in my case no editor was used, just Gii.

That’s weird. I don’t think anyone is able to help having no file itself.