http://php.net/manual/en/migration54.new-features.php Array dereferencing New array syntax Traits Almost all of the features mentioned on that page currently result in syntax errors. <?php $str = 'A:B'; explode(':', $arr)[1]; trait A { // <-- syntax error } ?> etc Reproducible: Always Steps to Reproduce: n/a Actual Results: n/a Expected Results: n/a
Git commit bab6bf2516af11d0383a5f1d34c4b6db0475dda7 by Milian Wolff. Committed on 16/07/2013 at 14:20. Pushed by mwolff into branch 'master'. Add support for php 5.4's short array syntax. A first step towards support for the new syntax features introduced in PHP 5.4. This implements parsing support for the short (json-style) array syntax where one can rewrite $var = array( "key" => "value" ); as $var = [ "key" => "value" ]; REVIEW: 110374 M +23 -0 duchain/tests/expressionparser.cpp M +1 -0 duchain/tests/expressionparser.h M +10 -0 parser/php.g http://commits.kde.org/kdev-php/bab6bf2516af11d0383a5f1d34c4b6db0475dda7
not all features implemented yet, reopening
Git commit 693e877d45afecd0e41b678e0ef441fda7744075 by Milian Wolff, on behalf of Heinz Wiesinger. Committed on 16/07/2013 at 15:20. Pushed by mwolff into branch 'master'. Add support for PHP 5.4's function array dereferencing. M +5 -6 duchain/expressionvisitor.cpp M +1 -1 duchain/expressionvisitor.h M +42 -0 duchain/tests/expressionparser.cpp M +2 -0 duchain/tests/expressionparser.h M +7 -7 parser/php.g http://commits.kde.org/kdev-php/693e877d45afecd0e41b678e0ef441fda7744075
Git commit d87cd7d64acca990a0092955a0f4681d3b97af06 by Heinz Wiesinger. Committed on 24/09/2013 at 08:37. Pushed by wiesinger into branch 'master'. Add support for Trait declarations, as introduced in PHP 5.4. REVIEW: 112917 M +1 -0 completion/context.cpp M +8 -0 duchain/builders/contextbuilder.cpp M +1 -0 duchain/builders/contextbuilder.h M +30 -4 duchain/builders/declarationbuilder.cpp M +1 -0 duchain/builders/declarationbuilder.h M +27 -0 duchain/builders/predeclarationbuilder.cpp M +1 -0 duchain/builders/predeclarationbuilder.h M +9 -0 duchain/builders/typebuilder.cpp M +1 -0 duchain/builders/typebuilder.h M +3 -0 duchain/declarations/classdeclaration.cpp M +2 -0 duchain/navigation/declarationnavigationcontext.cpp M +37 -0 duchain/tests/expressionparser.cpp M +3 -0 duchain/tests/expressionparser.h M +6 -1 parser/php.g M +2 -0 parser/phplexer.cpp http://commits.kde.org/kdev-php/d87cd7d64acca990a0092955a0f4681d3b97af06
Git commit 9141e9d737cc2635e7573a8b71423de9d52c3389 by Heinz Wiesinger. Committed on 21/01/2014 at 17:43. Pushed by wiesinger into branch 'master'. Support the syntax for class member access on instantiation. This adds support for syntax like (new Foo())->bar() as introduced in PHP 5.4. The bug, that ($a)-> still offers completion even though it is invalid syntax (stupid PHP) remains though. Related: bug 297908 REVIEW: 115304 M +15 -13 duchain/builders/declarationbuilder.cpp M +2 -1 duchain/expressionvisitor.cpp M +19 -0 duchain/tests/expressionparser.cpp M +1 -0 duchain/tests/expressionparser.h M +14 -3 parser/php.g http://commits.kde.org/kdev-php/9141e9d737cc2635e7573a8b71423de9d52c3389
Git commit 5dd4bdb1e2994de007a3ebbd772dd2181bf3f6f6 by Heinz Wiesinger. Committed on 29/10/2013 at 20:59. Pushed by wiesinger into branch 'master'. Add support for trait uses, as introduced in PHP 5.4 The error messages I used are as close as possible to the actual errors given by PHP. We check for - invalid function modifiers (static, final) - property name conflicts between traits and main class - method name conflicts between multiple traits REVIEW: 115299 M +1 -0 completion/context.cpp M +206 -1 duchain/builders/declarationbuilder.cpp M +3 -0 duchain/builders/declarationbuilder.h M +62 -0 duchain/builders/usebuilder.cpp M +3 -0 duchain/builders/usebuilder.h M +38 -0 duchain/navigation/declarationnavigationcontext.cpp M +1 -0 duchain/navigation/declarationnavigationcontext.h M +24 -0 duchain/tests/expressionparser.cpp M +2 -0 duchain/tests/expressionparser.h M +106 -0 duchain/tests/uses.cpp M +1 -0 duchain/tests/uses.h M +12 -1 parser/php.g M +2 -0 parser/phplexer.cpp http://commits.kde.org/kdev-php/5dd4bdb1e2994de007a3ebbd772dd2181bf3f6f6
what exactly is still missing from PHP 5.4 support?
Looking at http://php.net/manual/en/migration54.new-features.php the one feature I see still missing is "Class::{expr}() syntax is now supported." Example code: http://www.lifemichael.com/en/2012/06/php-5-4-classexpr-syntax-pro/
I presume this bug is now fixed by: https://phabricator.kde.org/D4902
Backported to 5.1