PhpTypeProvider2 vs PhpTypeProvider3 vs PhpTypeProvider4


Is there some documentation about the difference in these interfaces?   

I have only found this:

But is not only a bit old (it does not include any reference to PhpTypeProvider4) but also is not correct, the implementation of PhpTypeProvider3 is overriding 

  public String getType(PsiElement e) {

And that is from PhpTypeProvider2, it should be
  public PhpType getType(PsiElement e) {

Official comment

Most important difference is com.jetbrains.php.lang.psi.resolve.types.PhpTypeProvider4#complete existence - by using it you can encode local information during indexing using com.jetbrains.php.lang.psi.resolve.types.PhpTypeProvider4#getType and then this information can be accessed in #complete on stage when indexes are available to do resolving. If your type provider works correctly only by using local information, then implementing com.jetbrains.php.lang.psi.resolve.types.PhpTypeProvider4#getType should be enough


Thank you for pointing this out. Right now we're in process of stabilizing external type inference API, there is no complete documentation yet, but we're working on it and it will be provided when we will compose stable API.

Right now PhpTypeProvider2 and PhpTypeProvider3 are considered as obsolete, client extension point should implement only PhpTypeProvider4.


OK, can you point the most important difference between PhpTypeProvider3 and PhpTypeProvider4? 


Please sign in to leave a comment.