Add return typehint support for PHP language

Authored by mtijink on Jul 12 2017, 10:48 AM.



This diff adds support for php return typehints (e.g. function foo(): string) to the parser. Nothing is done yet to use this in the TypeBuilder, that will come later.

Test Plan

The newly added test checks if the return typehint is correctly tokenized. Parsing itself is not tested, but the old tests work (so no regressions) and opening files with return typehints now works without parse errors. Tests will be added after using the return typehints in the TypeBuilder.

Diff Detail

R52 KDevelop: PHP Support
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
mtijink created this revision.Jul 12 2017, 10:48 AM
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptJul 12 2017, 10:48 AM
zhigalin requested changes to this revision.Jul 12 2017, 4:04 PM
zhigalin added a reviewer: pprkut.
zhigalin added a subscriber: zhigalin.

This one conflicts with D6645 on parser/test/lexertest.h and parser/test/lexertest.cpp.
Change either this one or D6645 so they can apply cleanly.
Thanks for your effort!

This revision now requires changes to proceed.Jul 12 2017, 4:04 PM
mtijink updated this revision to Diff 16601.Jul 12 2017, 6:40 PM
mtijink edited edge metadata.

Done, I put the new test next to the existing testTypeHintsOnFunction. Now it shouldn't conflict with D6645.

zhigalin accepted this revision as: zhigalin.Jul 12 2017, 9:55 PM

This seems also OK

This revision was automatically updated to reflect the committed changes.