Bug 305779 - PHP 5.4 features
Summary: PHP 5.4 features
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: PHP (show other bugs)
Version: 4.3.1
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-25 20:06 UTC by Andrew Udvare
Modified: 2017-03-07 08:51 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.1.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Udvare 2012-08-25 20:06:50 UTC
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
Comment 1 Milian Wolff 2013-07-16 14:25:48 UTC
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
Comment 2 Milian Wolff 2013-07-16 15:23:06 UTC
not all features implemented yet, reopening
Comment 3 Milian Wolff 2013-07-16 15:24:47 UTC
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
Comment 4 Heinz Wiesinger 2013-10-12 13:55:27 UTC
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
Comment 5 Heinz Wiesinger 2014-02-07 17:17:25 UTC
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
Comment 6 Heinz Wiesinger 2014-02-07 17:40:59 UTC
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
Comment 7 Milian Wolff 2015-11-01 17:16:36 UTC
what exactly is still missing from PHP 5.4 support?
Comment 8 Heinz Wiesinger 2015-11-01 17:36:52 UTC
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/
Comment 9 Kevin Funk 2017-03-07 08:26:01 UTC
I presume this bug is now fixed by:
  https://phabricator.kde.org/D4902
Comment 10 Kevin Funk 2017-03-07 08:51:49 UTC
Backported to 5.1