D6342: Add more typehints to arguments in PHP

Matthijs Tijink noreply at phabricator.kde.org
Tue Jun 27 13:06:22 UTC 2017


mtijink updated this revision to Diff 15918.
mtijink added a comment.


  I also added type support for `iterable` (previous, it only parsed correctly), which either is an array or an object which implements `Traversable`. Could someone look at this, give some comments and (if okay) merge it?
  
  Also, I still do not know how the issues I mentioned earlier should be handled:
  
  - How should I add support for `self`? Adding it as a token gave all kinds of problems. //Update:// adding it by detecting `self` as a class before assigning the typehint works, but might not be the ideal solution.
  - How should the `callable` type be represented? It should accept any kind of function, but I only saw support for types with known function signatures
  - This patch added some tokens, so they cannot be used as class names and constants anymore. This is a problem, I think, since PHP < 7 still allows e.g. `int` as class name. Another problem is that the newer keywords (e.g. `iterable`, `int`) can still be used as names for constants (but not for classes etc.), which is not allowed with this code either.

REPOSITORY
  R52 KDevelop: PHP Support

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D6342?vs=15757&id=15918

REVISION DETAIL
  https://phabricator.kde.org/D6342

AFFECTED FILES
  completion/context.cpp
  duchain/builders/typebuilder.cpp
  duchain/builders/usebuilder.cpp
  duchain/expressionvisitor.cpp
  duchain/tests/duchain.cpp
  duchain/tests/duchain.h
  parser/php.g
  parser/phplexer.cpp

To: mtijink, #kdevelop, pprkut
Cc: apol, kdevelop-devel, geetamc, Pilzschaf, akshaydeo, surgenight, arrowdodger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170627/64fde6d9/attachment.html>


More information about the KDevelop-devel mailing list