How to use pecl_http version 2 with phpStorm ?

I recently 'homebrewed' pecl_http version 2.1.4 into my php 5.5.22 php interpreter (osx 10.10.2, phpstorm 8.0.3), and phpstorm seems confused about the http declarations as shown below.

Screen Shot 2015-03-25 at 7.22.58 AM.png
all the 2.x syntax is highlighted as 'missing' declarations, yet this works at runtime (ie homebrew did its thing properly). Running phpinfo() shows me version 2.1.4 of http is running.

I also included a line of code in 1.x syntax, which bombs at runtime, expectedly. Yet, the highlighting is according to 1.6.6, and code completion too. If I command-click on the HttpRequest symbol, phpStorm opens a http.php file (1.6.6).

When i hover over the 2.x Request class, i get the following tool-tip :

Screen Shot 2015-03-25 at 7.34.38 AM.png

Strange thing, it tells me that the class is undefined on the first line, and on the second line it tells me there are multiple declarations for it. What gives ? Which is it ???

How can I convince phpStorm to highlight properly ?  a real pain to do this from memory. Any help greatly appreciated.  


-- Yves

1 comment
Comment actions Permalink

Hi there,

ATM PhpStorm does not know anything about pecl_http version 2 -- it has stubs for v1 only (your "phpStorm opens a http.php file" part) -- watch this ticket (star/vote/comment) to get notified on progress.

How can I convince phpStorm to highlight properly ?  a real pain to do this from memory.

You can create such stub file yourself (and place it anywhere in your project or reference in any other supported way) -- as you can clearly see from v1 stub it's just a PHP version of all classes/function declarations (just with empty body).

Alternatively -- try searching online -- maybe somebody have created such stub files already.


Please sign in to leave a comment.