How should stdlib stubs be updated?

Answered

I'm using latest EAP and I've just noticed the bundled stub file_put_contents() is rather outdated—it even mentions PHP 6.

I opened the stub and got a link to Github, where I could see that current version there is up-to-date. But I'm not sure if I'm expected to follow the instructions shown (install git, clone github repo and change defaults stub path) given that I don't want to edit the stubs.

What's the standard mechanism to keep stubs updated?

0
4 comments

Hi there,

>What's the standard mechanism to keep stubs updated?

Update IDE to the latest version ... so it will bring latest stubs.

 

Obviously, the drawback of this approach is that in periods like now, when last IDE update (2016.3.2) was released around 2 months ago and 2016.3.3 may not even be released .. and you have to wait till 2017.1 will become final (in case if you are using only stable versions) -- it's not great solution.

That's why (one of the reasons, actually) you now have an option to specify your own version of stubs as you can manually download latest version from the repo even for an older IDE version (I mean -- 2017.1 vs 2016.3). There is no need to edit them if you do not plan it. Another benefit -- you can simply remove stubs for unused modules -- a bit quicker indexing, a bit cleaner code completion (no never used functions/classes), no possible conflicts with some similar named modules (e.g. pecl http v1 module, classes like HttpException or alike).

1

Do you mean that regular releases include updated stubs but those from Early Access Program do not?

0

I would expect every public build to contain latest at that moment stubs. How EAP builds actually do this I'm not 100% sure (tickets in Issue Tracker in this regard are not getting updated fast -- I mean, they may stay open for quite some time and then bunch of them gets resolved in one go etc), but I guess they not get so frequent updates (maybe they require separate validation/approval).

Based on your example for file_put_contents() -- the 171.3691.14 EAP seem to have old stubs even though the PHP 6 mentions were removed on Feb 1st, which is over 1 month now (https://github.com/JetBrains/phpstorm-stubs/commit/f5fb87e3f7ab050a08bca283d91ddadc5f97dddd).

 

If you definitely need only latest stubs from the stubs repo -- setting up your own local copy and keep it up to date is the way to go. Vast majority of users will just stick to the bundled copy that comes with IDE (no extra movement is required; no need to keep it up to date; not everyone uses git or any other VCS).

I just hope that devs can introduce some automatic mechanism to keep such local stubs up to date without the need from user end to get latest repo manually (assuming that user does not edit any stubs himself, of course).

1

I've had a second look with all your information in mind. I currently run build #PS-171.3691.14 but the program (and so its stubs) is installed at: "C:\Program Files (x86)\JetBrains\PhpStorm 171.2822.14". If Google cache is right that build was released on 1st Feb. Since then, I've been installing the binary patches as offered by the auto-update tool. I suspect those patches do not include the complete asset collection, just executable code and such.

In short: new stubs come with the software and nothing needs to be done. But binary partial updates (at least EAP ones) may not include them.

Thank you for your time, you've been very helpful.

0

Please sign in to leave a comment.