如何在PhpStorm中加载php DS名称空间 [英] How to load php DS namespace in PhpStorm

查看:75
本文介绍了如何在PhpStorm中加载php DS名称空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 php-ds 扩展名,如此处.但是我无法在PhpStorm中加载DS名称空间.

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

我该怎么做?

推荐答案

您需要 stub文件,以使PhpStorm理解DS(用C语言编写的PHP扩展)提供的内容(类/函数/等).

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

Stub文件基本上是该文件的PHP版本-只是声明/文档"部分-例如函数声明,但具有空主体.您可以自己制作...,也可以找到一些现有的(当然,如果其他人已经做到了).

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

....基本上,您需要的是 php-ds/polyfill - 您还应该在项目中包括polyfill以实现兼容性和IDE集成"..

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

IDE将读取此类文件,并将了解真正的DS扩展必须提供的功能/它的功能(参数类型/返回值/等).

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

这篇关于如何在PhpStorm中加载php DS名称空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆