How to use gen-stubs.php?

How do I use this gen-stubs.php file? It asks me to "Change the CPHALCON_DIR constant to point to the dev/ directory in the Phalcon source code" But there is no dev dir in the source code dir?

And is this to be run during compilation of the source code for creating the extension? There seems to be very little information given on how to use this, or just a lot of assumptions made.

Any step by step walkthroughs?



83.4k

You have to change the CPHALCON_DIR constant to a valid directory containing the cphalcon code:

https://github.com/phalcon/phalcon-devtools/blob/master/ide/gen-stubs.php#L15



10.6k

Thanks, I figured that part out myself. But I still don't know how to use the bugger. Other seems to just point their IDE of choice to the folder phalcon-devtools-master/ide/1.3.1/Phalcon and BAM they've got code completion. But I seem to end up having to trawl all sort of weird documentation that do not explain anything in detail, but assume I know what they know. If I did, I'd probably have the issue out of my way, so to iterate:

What do I do with the gen-stubs.php file after pointing the path to the phalcon code? Do I put it somewhere on my localhost and execute it? And will the stubs (I assume is generated) be found somewhere afterwards? And where do I put the stubs afterwards?

I guess that with my questions it is fairly clear that I have no clue whatsoever, and therefore need any help to be very specific. I really appreciate it (and I'm sure there must be others), thanks.



83.4k

You don't really need to execute that script unless you have made modifications to the C code adding new methods or classes or improving the existing docblocks.

If you still want/need to execute it, you have to clone devtools and change your directory in the console to:

cd /path/to/devtools/ide
php gen-stubs.php

It will create a new directory with the version in the current phalcon extension in memory, like these: https://github.com/phalcon/phalcon-devtools/tree/master/ide



10.6k

What I really just want is code completion for Sublime Text, but it seems nearly impossible to achieve. Is there any instructions other that what I've been able to google for the post four weeks, that doesn't seem to help? They all seem to just point to the devtools and expect one to know what to do.

I've installed SublimeCodeIntel, but that alone doesn't give me code completion for phalcon. I have to put these stubs somewhere. But I haven't been able to figure out where in more than a month. I actually installed Eclipse today and dumped the whole damn folder indo the project, just to prevent insanity.

You have to change the CPHALCON_DIR constant to a valid directory containing the cphalcon code:

https://github.com/phalcon/phalcon-devtools/blob/master/ide/gen-stubs.php#L15

Sorry to bring back to life an old post but, i kinda got in doubt where this valid directory with cphalcon code would be? its the place where i installed the dev-tools or something else? Thank you in advance!