D6342: Add more typehints to arguments in PHP
Matthijs Tijink
noreply at phabricator.kde.org
Thu Jun 22 12:57:31 UTC 2017
mtijink created this revision.
mtijink added a project: KDevelop.
Restricted Application added a subscriber: kdevelop-devel.
REVISION SUMMARY
In php 7.0 and php 7.1, new type hints were added. I would like to see those supported in KDevelop.
This patch adds support for most of the new type hints (only "self" is missing), but some types do not get a better resulting DUChain type, since I do not know how to add the types "iterable" and "callable" in the DUChain.
Since this is my first patch, I also have some questions, which I hope you can answer:
- How should I add support for "self"? Adding it as a token gave all kinds of problems.
- 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.
Feedback very welcome!
REPOSITORY
R52 KDevelop: PHP Support
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
parser/php.g
parser/phplexer.cpp
To: mtijink, #kdevelop
Cc: kdevelop-devel, geetamc, Pilzschaf, akshaydeo, surgenight, arrowdodger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170622/aea4a333/attachment.html>
More information about the KDevelop-devel
mailing list