Page 1 of 1

use classname as classalias not recognized by intellisense

PostPosted: September 15th, 2018, 6:36 am
by urosg
Hi,

a simple example where use namespace as alias is declared the alias is then not recognized.

Code: Select all
namespace some\name\space;

use some\other\name\space\Class as ClassAlias;

class Class extends ClassAlias
{
}


with this the used ClassAlias at extends is underlined green and declared as "Use of unknown class".

Re: use classname as classalias not recognized by intellisen

PostPosted: September 21st, 2018, 9:25 am
by Miloslav Beno
Hi,

Thanks for the post.

The warning seems to be fine. It doesn't say `ClassAlias` is unknown, it says `some\other\name\space\Class` is unknown.

If I didn't get the issue please let me know.

Thanks

Re: use classname as classalias not recognized by intellisen

PostPosted: September 23rd, 2018, 12:48 pm
by urosg
Thank you for the answer, it seems there must have been some other error present in parsing the project as I now rechecked and the issue is not apparent anymore.

Thanks again!

Re: use classname as classalias not recognized by intellisen

PostPosted: September 24th, 2018, 8:51 am
by Miloslav Beno
Great. I'm glad it's fine now.

Have a good one,

Re: use classname as classalias not recognized by intellisen

PostPosted: October 4th, 2018, 4:22 am
by urosg
This issue has risen up again, unfortunately I don't yet have a way to 100% reproduce it.

Will try to find more details and let you know.

Re: use classname as classalias not recognized by intellisen

PostPosted: October 4th, 2018, 5:14 am
by urosg
Now this is interesting.

Currently I have the solution open with two vertical windows, in the left one the classes are recognized correctly but in the right one (let's say) partially.

See here "right" side:
phptools-unknownclass.PNG


and "left" side:
photools-unknownclass-left.PNG


You can see that the classes are underlined as unknown, where the "yii\helpers\Url" actually shows "unknown class error" but the "ActiveForm" (which has the "use kartik\widget\ActiveForm at start) shows the correct description along with the unknown class error. But in the "left" you can see the yii\helpers namespace be recognized correctly.

After reloading Visual Studio it was recognized ok. It seems that sometimes the project is not loaded correctly, but there were no errors while loading in both cases.