How to load php DS namespace in PhpStorm

喜欢而已 提交于 2020-04-11 09:27:44

问题


I have installed php-ds extension as shown here. But I am unable to Load the DS namespace in PhpStorm.

How can I do this?


回答1:


You need stub files in order for PhpStorm to understand what DS (a PHP extension written in C) offers (classes/functions/etc).

Stub file is basically a PHP version of that -- just "declaration/documentation" part -- e.g. function declarations but with empty bodies. You can either make your own ... or find some existing ones (if somebody else did it already, of course).

A bit more on stub files in general:

  • https://stackoverflow.com/a/15775431/783119
  • https://stackoverflow.com/a/30329412/783119

So .. basically what you need is php-ds/polyfill -- "You should also include the polyfill in your project for compatibility and IDE integration" .

IDE will read such files and will understand what real DS extension has to offer/what it does (type of parameters/returns/etc).



来源:https://stackoverflow.com/questions/43736492/how-to-load-php-ds-namespace-in-phpstorm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!