xcwen / ac-php

emacs auto-complete & company-mode for php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Looking for guidance: PHP built-in stubs

hugot opened this issue · comments

commented

Hi, I have been working on an Emacs package for PHP code intelligence during the past few years. My package is slowly getting to a point where it can reliably parse and complete local/vendored class methods and attributes. Now that I've gotten to this point, I'm looking to add completion for PHP's built in classes and functions. Initially, I thought that I could use phpstorm's stubs to generate an index of serialized s-expressions and distribute that index with my package. But it seems that this could result in licensing problems (the stubs are licensed under apache2). I want my package to be GPL compliant so that it can eventually be distributed through ELPA. As you have been working on a similar package for a long time already, I figured that you have probably given some thought to this issue so I'm hoping that you'll let me bother you for some pointers on the subject :)

Would you be willing to share your thoughts and ideas on ways to build an index of built-in PHP functions and types? I am not entirely familiar with the featureset of ac-php, but it seems that it does come with support for at least a good subset of PHP's built-in functions. How is this currently achieved, and what are the biggest challenges in this process?

In the commom_php folder of your repository, I see some files with PHP stub functions. Are these generated in some way? If so, how? Or are these all manual contributions?

Thanks in advance and kind regards,

  • Hugo
commented

sorry When I created this project, I only copied the definitions of related functions from PHP. net, without considering copyright issues. :<

commented

I see. You're probably fine in terms of licensing regardles, I don't think copying documentation would cause any trouble ;). That does seem like a lot of menial work though. I did a little more research and it looks like PHP itself might come with some tools fit for the job. I'm currently looking at a combination of PHP's get_defined_functions() and \ReflectionFunction and get_declared_classes() with respective \ReflectionClass to either generate stubs or directly generate s-expressions. Looks promising :D

commented

nice