This updates the grammer to recognize the '::class' constant as valid php. This was added in php 5.5 and results in the full qualified class name.
Details
- Reviewers
mwolff - Group Reviewers
KDevelop - Commits
- R52:917be0efc3e1: Fix parsing of the ::class constant
R52:ff5a7d86a3f1: Fix parsing of the ::class constant
Diff Detail
- Repository
- R52 KDevelop: PHP Support
- Lint
Lint Skipped - Unit
Unit Tests Skipped
I'd put it into the expression parser tests (duchain/tests/expressionparser.cpp). I imagine it would then build the test snippet from the PHP documentation:
<?php namespace NS { class ClassName { } }
And then verify that ClassName::class in the NS context, and NS\ClassName::class and \NS\Classname::class all evaluate to a string type.
Sounds good?
One performance related change, otherwise excellent work! Are you interested in doing more PHP related changes? I'd really welcome mentoring you more in that area - that plugin needs someone who looks after it! If you have any questions, don't hesitate to ask us on our mailing list.
Cheers, and thanks again!
duchain/expressionvisitor.cpp | ||
---|---|---|
419 | make it: if (!stringForNode(node->classConstant).compare(QLatin1String("class"), Qt::CaseInsensitive)) this is much faster as it removes two runtime memory allocations. |
Are you interested in doing more PHP related changes? I'd really welcome mentoring you more in that area - that plugin needs someone who looks after it!
I am, but i don't know if i have the time. This bugged me a lot, but i think it is time well spend.