Investigate the use of PhpStorm's stubs

Created by: ghost

Apparently, PhpStorm open-sourced their stubs [1]. Advantages to using these:

  • Built-in structural elements don't differ when using different PHP binaries, so if you upgrade to a new version, you don't need to reindex.
  • Corrections were applied and it's much more accurate for our purposes than Reflection or even the PHP documentation.

Disadvantages:

  • Does not cope with custom extensions that the user may have loaded. Reflection is capable of fetching these as well. This may be solved with a hybrid approach or we could simply drop this support for now as it is a very rare corner case.
  • Need to take the @since x.y.z and @deprecated x.y.z tags into account since older PHP versions will also index structural elements only available in newer PHP versions.

Important: we should also look at its licensing and see if it is legal for us to include them.

[1] https://github.com/JetBrains/phpstorm-stubs