PHP namespaces 5/10: Importing namespaced elements with the use operator

preview_player
Показать описание

We'll continue this mini-course on PHP namespaces with learning how to import code that's in a namespace using the use operator.
Рекомендации по теме
Комментарии
Автор

Isn't it slightly inconsistent that when importing a constant or function we write 'use const', 'use function', and a name of a constant or function, but when we import a class we just write 'use' plus a name of a class, and not 'use class' and a name of a class?
It is also quite strange for me that we have to write 'use const', 'use function' and not just 'use'. I thought the PHP interpreter is pretty clever and could sneak into the required file and check that imported thing is a constant or function because in that file there is explicitly defined what is what.
BTW, you are a great teacher, everything is perfectly explained in a very understandable way and with quite easy English suitable for non native speakers :-)

SqueezePl
Автор

What plugins are using in vscode for php? I get so many red wavy underlines for the phpcode

Tony.Nguyen