Skip to content
Commit 7a6c8299 authored by Matthijs Tijink's avatar Matthijs Tijink Committed by Alexander Zhigalin
Browse files

Add more typehints to arguments in PHP

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!

Reviewers: #kdevelop, pprkut, mwolff

Reviewed By: #kdevelop, pprkut, mwolff

Subscribers: mwolff, apol, kdevelop-devel

Tags: #kdevelop

Differential Revision: https://phabricator.kde.org/D6342
parent f4ec18d4
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment