Using concrete classes results undefined type warning in VS Code

Permalink
Hey there. When I am using Concrete5 core classes, I often get warnings by VS code that this type is undefined. Although this causes no errors, it is just so annoying seeing that messages all the time. For many classes I tried to rewrite the use statements like:
instead of -> PageTheme;
changed -> use Concrete\Theme\Concrete\PageTheme;
and that removes these warnings. But for the BlockTypeSet class for example, this warning persists.

So when I am writing
use BlockTypeSet;
this gives 'Undefined type 'BlockTypeSet'' warning,

and if I change this line to
use Concrete\Core\Package\ItemCategory\BlockTypeSet;
then I got problem with function declaration line of my code, which is:
$blockTypeSet = BlockTypeSet::getByHandle('my_pkg_handle', $this->pkg);
and this causes 'Undefined method 'getByHandle'' error.

Does anybody have also same problem? Is there any solution to this or should I just let it go

2 Attachments

 
enlil replied on at Permalink Best Answer Reply
enlil
I get it like this in my package controller:

use Concrete\Core\Block\BlockType\Set as BlockTypeSet;

as opposed to:

use BlockTypeSet;
muratyil replied on at Permalink Reply
I was choosing the wrong class all the time. Thanks for the answer.