Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry BLIND2019-05-02 09:50:51 -0400
committerThierry BLIND2019-05-02 09:50:51 -0400
commit94f789fa0cabdac43c0ffc925e2cfd8f2f50e6ec (patch)
tree1988b2e52c198e49a028acdcfc1a51dc87dfa4ca
parentb6bb0e936695d124d7b2795387c5a84f35465031 (diff)
downloadorg.eclipse.pdt-94f789fa0cabdac43c0ffc925e2cfd8f2f50e6ec.tar.gz
org.eclipse.pdt-94f789fa0cabdac43c0ffc925e2cfd8f2f50e6ec.tar.xz
org.eclipse.pdt-94f789fa0cabdac43c0ffc925e2cfd8f2f50e6ec.zip
Bug 501654 - Invalid syntax error for use statement
Change-Id: I7dc0e665f3e643def050d90a8e03020869dfb7d4 Signed-off-by: Thierry BLIND <thierryblind@msn.com>
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php53/php_ast_parser.cup4
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php53/php_compiler_ast_parser.cup4
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php54/php_ast_parser.cup4
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php54/php_compiler_ast_parser.cup4
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php55/php_ast_parser.cup4
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php55/php_compiler_ast_parser.cup4
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php56/php_ast_parser.cup4
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php56/php_compiler_ast_parser.cup4
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php7/php_ast_parser.cup10
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php7/php_compiler_ast_parser.cup42
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php71/php_ast_parser.cup10
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php71/php_compiler_ast_parser.cup42
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php72/php_ast_parser.cup10
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php72/php_compiler_ast_parser.cup42
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php73/php_ast_parser.cup10
-rw-r--r--plugins/org.eclipse.php.core/Resources/parserTools/parser/php73/php_compiler_ast_parser.cup42
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/core/compiler/ast/nodes/NamespaceReference.java9
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPCompletionEngine.java12
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/UseStatementContext.java32
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/ConstantsStrategy.java6
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/FunctionsStrategy.java6
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/TypesStrategy.java6
-rw-r--r--tests/org.eclipse.php.core.tests/src/org/eclipse/php/core/tests/dom_ast/rewrite/ASTRewriteTestsPHP71.java121
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement01B.pdtt22
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement02B.pdtt19
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement04B.pdtt23
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement05B.pdtt25
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass01B.pdtt55
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass02B.pdtt52
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass03B.pdtt50
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass04B.pdtt53
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass05B.pdtt50
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass06B.pdtt50
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass07B.pdtt53
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass08B.pdtt53
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass09B.pdtt55
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass10B.pdtt53
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass11B.pdtt47
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass12B.pdtt47
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass13B.pdtt47
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass14B.pdtt50
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass15B.pdtt50
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst01B.pdtt53
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst02B.pdtt50
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst03B.pdtt50
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst04B.pdtt53
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst05B.pdtt52
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst06B.pdtt50
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst07B.pdtt53
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion01B.pdtt53
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion02B.pdtt50
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion03B.pdtt50
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion04B.pdtt53
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion05B.pdtt52
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion06B.pdtt50
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion07B.pdtt53
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement01B.pdtt31
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement02B.pdtt41
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement03B.pdtt31
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement04B.pdtt95
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/compiler_parser/php72/trailingComma01B.pdtt143
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/document_lexer/php7/groupUseStatement01B.pdtt38
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/document_lexer/php7/groupUseStatement02B.pdtt52
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/document_lexer/php7/groupUseStatement03B.pdtt36
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/dom_parser/php7/groupUseStatement01B.pdtt38
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/dom_parser/php7/groupUseStatement02B.pdtt43
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/dom_parser/php7/groupUseStatement03B.pdtt41
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/dom_parser/php72/trailingComma01B.pdtt214
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/errors/php7/testTypeReferenceErrorB.pdtt13
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/errors/php7/testUseStatementUsage01B.pdtt25
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement01B.pdtt22
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement02B.pdtt18
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement03B.pdtt17
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement04B.pdtt32
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement05B.pdtt32
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement06B.pdtt32
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php7/default_formatter_configuration/groupUseStatement01B.pdtt33
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php7/psr2/groupUseStatement01B.pdtt33
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_1/commentFormatter1B.pdtt75
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_2/arrayAccessB.pdtt49
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_3/arrayAccessB.pdtt62
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_4/arrayAccessB.pdtt57
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_5/commentFormatter1B.pdtt75
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_6/arrayAccessB.pdtt49
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_7/arrayAccessB.pdtt62
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_8/arrayAccessB.pdtt57
-rw-r--r--tests/org.eclipse.php.ui.tests/workspace/codeassist/php7/groupUseStatement01B.pdtt18
-rw-r--r--tests/org.eclipse.php.ui.tests/workspace/codeassist/php7/groupUseStatement02B.pdtt22
-rw-r--r--tests/org.eclipse.php.ui.tests/workspace/codeassist/php7/groupUseStatement03_overwriteB.pdtt16
89 files changed, 3524 insertions, 86 deletions
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php53/php_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php53/php_ast_parser.cup
index 1fa773a47..34f85a80c 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php53/php_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php53/php_ast_parser.cup
@@ -488,14 +488,14 @@ namespace_name:list
| T_NS_SEPARATOR:s namespace_name:list
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, listright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false), null);
:}
| T_NS_SEPARATOR:s namespace_name:list T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, aliasNameright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false),
new Identifier(aliasNameleft, aliasNameright, parser.ast, aliasName));
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php53/php_compiler_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php53/php_compiler_ast_parser.cup
index d3633cfe0..dc0b3b172 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php53/php_compiler_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php53/php_compiler_ast_parser.cup
@@ -588,7 +588,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name, null);
RESULT = usePart;
@@ -596,7 +596,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name,
new SimpleReference(aliasNameleft, aliasNameright, aliasName));
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php54/php_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php54/php_ast_parser.cup
index 784d86c1d..487e231f3 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php54/php_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php54/php_ast_parser.cup
@@ -513,14 +513,14 @@ namespace_name:list
| T_NS_SEPARATOR:s namespace_name:list
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, listright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false), null);
:}
| T_NS_SEPARATOR:s namespace_name:list T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, aliasNameright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false),
new Identifier(aliasNameleft, aliasNameright, parser.ast, aliasName));
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php54/php_compiler_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php54/php_compiler_ast_parser.cup
index 4e3573140..2ae1f161d 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php54/php_compiler_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php54/php_compiler_ast_parser.cup
@@ -617,7 +617,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name, null);
RESULT = usePart;
@@ -625,7 +625,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name,
new SimpleReference(aliasNameleft, aliasNameright, aliasName));
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php55/php_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php55/php_ast_parser.cup
index 4aef52c4b..ae660e074 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php55/php_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php55/php_ast_parser.cup
@@ -534,14 +534,14 @@ namespace_name:list
| T_NS_SEPARATOR:s namespace_name:list
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, listright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false), null);
:}
| T_NS_SEPARATOR:s namespace_name:list T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, aliasNameright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false),
new Identifier(aliasNameleft, aliasNameright, parser.ast, aliasName));
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php55/php_compiler_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php55/php_compiler_ast_parser.cup
index 6f2ad15b3..7a97b5a5d 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php55/php_compiler_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php55/php_compiler_ast_parser.cup
@@ -639,7 +639,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name, null);
RESULT = usePart;
@@ -647,7 +647,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name,
new SimpleReference(aliasNameleft, aliasNameright, aliasName));
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php56/php_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php56/php_ast_parser.cup
index ea5d44b08..78c369787 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php56/php_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php56/php_ast_parser.cup
@@ -567,14 +567,14 @@ namespace_name:list
| T_NS_SEPARATOR:s namespace_name:list
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, listright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false), null);
:}
| T_NS_SEPARATOR:s namespace_name:list T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, aliasNameright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false),
new Identifier(aliasNameleft, aliasNameright, parser.ast, aliasName));
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php56/php_compiler_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php56/php_compiler_ast_parser.cup
index 8fed08b5e..32ec9a364 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php56/php_compiler_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php56/php_compiler_ast_parser.cup
@@ -675,7 +675,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name, null);
RESULT = usePart;
@@ -683,7 +683,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name,
new SimpleReference(aliasNameleft, aliasNameright, aliasName));
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php7/php_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php7/php_ast_parser.cup
index 486180c5d..44ef7da2f 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php7/php_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php7/php_ast_parser.cup
@@ -888,14 +888,14 @@ namespace_name:list
| T_NS_SEPARATOR:s namespace_name:list
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, listright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false), null);
:}
| T_NS_SEPARATOR:s namespace_name:list T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, aliasNameright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false),
new Identifier(aliasNameleft, aliasNameright, parser.ast, aliasName));
@@ -907,6 +907,12 @@ namespace_name:nnList T_NS_SEPARATOR:end
{:
RESULT = new NamespaceName(nnListleft, endright, parser.ast, nnList, false, false);
:}
+
+| T_NS_SEPARATOR:s namespace_name:nnList T_NS_SEPARATOR:end
+{:
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
+ RESULT = new NamespaceName(sright, endright, parser.ast, nnList, false, false);
+:}
;
inner_statement_list ::=
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php7/php_compiler_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php7/php_compiler_ast_parser.cup
index 02078de30..446ec2dd0 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php7/php_compiler_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php7/php_compiler_ast_parser.cup
@@ -704,16 +704,16 @@ namespace_name_list:list
FullyQualifiedReference fullyQualifiedName = null;
Iterator i = list.iterator();
while (i.hasNext()) {
- String s = (String) i.next();
+ String str = (String) i.next();
if (i.hasNext()) {
if (namespaceNameBuf.length() != 0) {
namespaceNameBuf.append('\\');
}
- namespaceNameBuf.append(s);
+ namespaceNameBuf.append(str);
} else {
NamespaceReference namespaceRef = (namespaceNameBuf.length() != 0) ?
- new NamespaceReference(listleft, listright - s.length() - 1, namespaceNameBuf.toString()) : null;
- fullyQualifiedName = new FullyQualifiedReference(listleft, listright, s, namespaceRef);
+ new NamespaceReference(listleft, listright - str.length() - 1, namespaceNameBuf.toString()) : null;
+ fullyQualifiedName = new FullyQualifiedReference(listleft, listright, str, namespaceRef);
}
}
RESULT = fullyQualifiedName;
@@ -1034,7 +1034,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name, null);
RESULT = usePart;
@@ -1042,7 +1042,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name,
new SimpleReference(aliasNameleft, aliasNameright, aliasName));
@@ -1057,16 +1057,38 @@ namespace_name_list:list T_NS_SEPARATOR:end
FullyQualifiedReference fullyQualifiedName = null;
Iterator i = list.iterator();
while (i.hasNext()) {
- String s = (String) i.next();
+ String str = (String) i.next();
if (i.hasNext()) {
if (namespaceNameBuf.length() != 0) {
namespaceNameBuf.append('\\');
}
- namespaceNameBuf.append(s);
+ namespaceNameBuf.append(str);
} else {
NamespaceReference namespaceRef = (namespaceNameBuf.length() != 0) ?
- new NamespaceReference(listleft, listright - s.length() - 1, namespaceNameBuf.toString()) : null;
- fullyQualifiedName = new FullyQualifiedReference(listleft, endright, s, namespaceRef);
+ new NamespaceReference(listleft, listright - str.length() - 1, namespaceNameBuf.toString()) : null;
+ fullyQualifiedName = new FullyQualifiedReference(listleft, endright, str, namespaceRef);
+ }
+ }
+ RESULT = fullyQualifiedName;
+:}
+
+| T_NS_SEPARATOR:s namespace_name_list:list T_NS_SEPARATOR:end
+{:
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
+ StringBuilder namespaceNameBuf = new StringBuilder();
+ FullyQualifiedReference fullyQualifiedName = null;
+ Iterator i = list.iterator();
+ while (i.hasNext()) {
+ String str = (String) i.next();
+ if (i.hasNext()) {
+ if (namespaceNameBuf.length() != 0) {
+ namespaceNameBuf.append('\\');
+ }
+ namespaceNameBuf.append(str);
+ } else {
+ NamespaceReference namespaceRef = (namespaceNameBuf.length() != 0) ?
+ new NamespaceReference(sright, listright - str.length() - 1, namespaceNameBuf.toString()) : null;
+ fullyQualifiedName = new FullyQualifiedReference(sright, endright, str, namespaceRef);
}
}
RESULT = fullyQualifiedName;
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php71/php_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php71/php_ast_parser.cup
index 5a0de3970..6826caa98 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php71/php_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php71/php_ast_parser.cup
@@ -888,14 +888,14 @@ namespace_name:list
| T_NS_SEPARATOR:s namespace_name:list
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, listright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false), null);
:}
| T_NS_SEPARATOR:s namespace_name:list T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, aliasNameright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false),
new Identifier(aliasNameleft, aliasNameright, parser.ast, aliasName));
@@ -907,6 +907,12 @@ namespace_name:nnList T_NS_SEPARATOR:end
{:
RESULT = new NamespaceName(nnListleft, endright, parser.ast, nnList, false, false);
:}
+
+| T_NS_SEPARATOR:s namespace_name:nnList T_NS_SEPARATOR:end
+{:
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
+ RESULT = new NamespaceName(sright, endright, parser.ast, nnList, false, false);
+:}
;
inner_statement_list ::=
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php71/php_compiler_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php71/php_compiler_ast_parser.cup
index 919f3e7dd..1af56c493 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php71/php_compiler_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php71/php_compiler_ast_parser.cup
@@ -702,16 +702,16 @@ namespace_name_list:list
FullyQualifiedReference fullyQualifiedName = null;
Iterator i = list.iterator();
while (i.hasNext()) {
- String s = (String) i.next();
+ String str = (String) i.next();
if (i.hasNext()) {
if (namespaceNameBuf.length() != 0) {
namespaceNameBuf.append('\\');
}
- namespaceNameBuf.append(s);
+ namespaceNameBuf.append(str);
} else {
NamespaceReference namespaceRef = (namespaceNameBuf.length() != 0) ?
- new NamespaceReference(listleft, listright - s.length() - 1, namespaceNameBuf.toString()) : null;
- fullyQualifiedName = new FullyQualifiedReference(listleft, listright, s, namespaceRef);
+ new NamespaceReference(listleft, listright - str.length() - 1, namespaceNameBuf.toString()) : null;
+ fullyQualifiedName = new FullyQualifiedReference(listleft, listright, str, namespaceRef);
}
}
RESULT = fullyQualifiedName;
@@ -1032,7 +1032,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name, null);
RESULT = usePart;
@@ -1040,7 +1040,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name,
new SimpleReference(aliasNameleft, aliasNameright, aliasName));
@@ -1055,16 +1055,38 @@ namespace_name_list:list T_NS_SEPARATOR:end
FullyQualifiedReference fullyQualifiedName = null;
Iterator i = list.iterator();
while (i.hasNext()) {
- String s = (String) i.next();
+ String str = (String) i.next();
if (i.hasNext()) {
if (namespaceNameBuf.length() != 0) {
namespaceNameBuf.append('\\');
}
- namespaceNameBuf.append(s);
+ namespaceNameBuf.append(str);
} else {
NamespaceReference namespaceRef = (namespaceNameBuf.length() != 0) ?
- new NamespaceReference(listleft, listright - s.length() - 1, namespaceNameBuf.toString()) : null;
- fullyQualifiedName = new FullyQualifiedReference(listleft, endright, s, namespaceRef);
+ new NamespaceReference(listleft, listright - str.length() - 1, namespaceNameBuf.toString()) : null;
+ fullyQualifiedName = new FullyQualifiedReference(listleft, endright, str, namespaceRef);
+ }
+ }
+ RESULT = fullyQualifiedName;
+:}
+
+| T_NS_SEPARATOR:s namespace_name_list:list T_NS_SEPARATOR:end
+{:
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
+ StringBuilder namespaceNameBuf = new StringBuilder();
+ FullyQualifiedReference fullyQualifiedName = null;
+ Iterator i = list.iterator();
+ while (i.hasNext()) {
+ String str = (String) i.next();
+ if (i.hasNext()) {
+ if (namespaceNameBuf.length() != 0) {
+ namespaceNameBuf.append('\\');
+ }
+ namespaceNameBuf.append(str);
+ } else {
+ NamespaceReference namespaceRef = (namespaceNameBuf.length() != 0) ?
+ new NamespaceReference(sright, listright - str.length() - 1, namespaceNameBuf.toString()) : null;
+ fullyQualifiedName = new FullyQualifiedReference(sright, endright, str, namespaceRef);
}
}
RESULT = fullyQualifiedName;
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php72/php_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php72/php_ast_parser.cup
index f2095ab80..9bf513920 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php72/php_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php72/php_ast_parser.cup
@@ -896,14 +896,14 @@ namespace_name:list
| T_NS_SEPARATOR:s namespace_name:list
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, listright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false), null);
:}
| T_NS_SEPARATOR:s namespace_name:list T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, aliasNameright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false),
new Identifier(aliasNameleft, aliasNameright, parser.ast, aliasName));
@@ -915,6 +915,12 @@ namespace_name:nnList T_NS_SEPARATOR:end
{:
RESULT = new NamespaceName(nnListleft, endright, parser.ast, nnList, false, false);
:}
+
+| T_NS_SEPARATOR:s namespace_name:nnList T_NS_SEPARATOR:end
+{:
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
+ RESULT = new NamespaceName(sright, endright, parser.ast, nnList, false, false);
+:}
;
inner_statement_list ::=
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php72/php_compiler_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php72/php_compiler_ast_parser.cup
index 4eb18684d..04f6d2cab 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php72/php_compiler_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php72/php_compiler_ast_parser.cup
@@ -702,16 +702,16 @@ namespace_name_list:list
FullyQualifiedReference fullyQualifiedName = null;
Iterator i = list.iterator();
while (i.hasNext()) {
- String s = (String) i.next();
+ String str = (String) i.next();
if (i.hasNext()) {
if (namespaceNameBuf.length() != 0) {
namespaceNameBuf.append('\\');
}
- namespaceNameBuf.append(s);
+ namespaceNameBuf.append(str);
} else {
NamespaceReference namespaceRef = (namespaceNameBuf.length() != 0) ?
- new NamespaceReference(listleft, listright - s.length() - 1, namespaceNameBuf.toString()) : null;
- fullyQualifiedName = new FullyQualifiedReference(listleft, listright, s, namespaceRef);
+ new NamespaceReference(listleft, listright - str.length() - 1, namespaceNameBuf.toString()) : null;
+ fullyQualifiedName = new FullyQualifiedReference(listleft, listright, str, namespaceRef);
}
}
RESULT = fullyQualifiedName;
@@ -1032,7 +1032,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name, null);
RESULT = usePart;
@@ -1040,7 +1040,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name,
new SimpleReference(aliasNameleft, aliasNameright, aliasName));
@@ -1055,16 +1055,38 @@ namespace_name_list:list T_NS_SEPARATOR:end
FullyQualifiedReference fullyQualifiedName = null;
Iterator i = list.iterator();
while (i.hasNext()) {
- String s = (String) i.next();
+ String str = (String) i.next();
if (i.hasNext()) {
if (namespaceNameBuf.length() != 0) {
namespaceNameBuf.append('\\');
}
- namespaceNameBuf.append(s);
+ namespaceNameBuf.append(str);
} else {
NamespaceReference namespaceRef = (namespaceNameBuf.length() != 0) ?
- new NamespaceReference(listleft, listright - s.length() - 1, namespaceNameBuf.toString()) : null;
- fullyQualifiedName = new FullyQualifiedReference(listleft, endright, s, namespaceRef);
+ new NamespaceReference(listleft, listright - str.length() - 1, namespaceNameBuf.toString()) : null;
+ fullyQualifiedName = new FullyQualifiedReference(listleft, endright, str, namespaceRef);
+ }
+ }
+ RESULT = fullyQualifiedName;
+:}
+
+| T_NS_SEPARATOR:s namespace_name_list:list T_NS_SEPARATOR:end
+{:
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
+ StringBuilder namespaceNameBuf = new StringBuilder();
+ FullyQualifiedReference fullyQualifiedName = null;
+ Iterator i = list.iterator();
+ while (i.hasNext()) {
+ String str = (String) i.next();
+ if (i.hasNext()) {
+ if (namespaceNameBuf.length() != 0) {
+ namespaceNameBuf.append('\\');
+ }
+ namespaceNameBuf.append(str);
+ } else {
+ NamespaceReference namespaceRef = (namespaceNameBuf.length() != 0) ?
+ new NamespaceReference(sright, listright - str.length() - 1, namespaceNameBuf.toString()) : null;
+ fullyQualifiedName = new FullyQualifiedReference(sright, endright, str, namespaceRef);
}
}
RESULT = fullyQualifiedName;
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php73/php_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php73/php_ast_parser.cup
index 731c9545e..01a32c499 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php73/php_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php73/php_ast_parser.cup
@@ -896,14 +896,14 @@ namespace_name:list
| T_NS_SEPARATOR:s namespace_name:list
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, listright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false), null);
:}
| T_NS_SEPARATOR:s namespace_name:list T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
RESULT = new UseStatementPart(sright, aliasNameright, parser.ast,
new NamespaceName(sright, listright, parser.ast, list, false, false),
new Identifier(aliasNameleft, aliasNameright, parser.ast, aliasName));
@@ -915,6 +915,12 @@ namespace_name:nnList T_NS_SEPARATOR:end
{:
RESULT = new NamespaceName(nnListleft, endright, parser.ast, nnList, false, false);
:}
+
+| T_NS_SEPARATOR:s namespace_name:nnList T_NS_SEPARATOR:end
+{:
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
+ RESULT = new NamespaceName(sright, endright, parser.ast, nnList, false, false);
+:}
;
inner_statement_list ::=
diff --git a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php73/php_compiler_ast_parser.cup b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php73/php_compiler_ast_parser.cup
index 90505f6f9..dfdc767d5 100644
--- a/plugins/org.eclipse.php.core/Resources/parserTools/parser/php73/php_compiler_ast_parser.cup
+++ b/plugins/org.eclipse.php.core/Resources/parserTools/parser/php73/php_compiler_ast_parser.cup
@@ -702,16 +702,16 @@ namespace_name_list:list
FullyQualifiedReference fullyQualifiedName = null;
Iterator i = list.iterator();
while (i.hasNext()) {
- String s = (String) i.next();
+ String str = (String) i.next();
if (i.hasNext()) {
if (namespaceNameBuf.length() != 0) {
namespaceNameBuf.append('\\');
}
- namespaceNameBuf.append(s);
+ namespaceNameBuf.append(str);
} else {
NamespaceReference namespaceRef = (namespaceNameBuf.length() != 0) ?
- new NamespaceReference(listleft, listright - s.length() - 1, namespaceNameBuf.toString()) : null;
- fullyQualifiedName = new FullyQualifiedReference(listleft, listright, s, namespaceRef);
+ new NamespaceReference(listleft, listright - str.length() - 1, namespaceNameBuf.toString()) : null;
+ fullyQualifiedName = new FullyQualifiedReference(listleft, listright, str, namespaceRef);
}
}
RESULT = fullyQualifiedName;
@@ -1032,7 +1032,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name, null);
RESULT = usePart;
@@ -1040,7 +1040,7 @@ namespace_name:name
| T_NS_SEPARATOR:s namespace_name:name T_AS T_STRING:aliasName
{:
- // NB: leading backslash is optional and has no special meaning here
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
name.setElementType(FullyQualifiedReference.T_TYPE);
UsePart usePart = new UsePart(name,
new SimpleReference(aliasNameleft, aliasNameright, aliasName));
@@ -1055,16 +1055,38 @@ namespace_name_list:list T_NS_SEPARATOR:end
FullyQualifiedReference fullyQualifiedName = null;
Iterator i = list.iterator();
while (i.hasNext()) {
- String s = (String) i.next();
+ String str = (String) i.next();
if (i.hasNext()) {
if (namespaceNameBuf.length() != 0) {
namespaceNameBuf.append('\\');
}
- namespaceNameBuf.append(s);
+ namespaceNameBuf.append(str);
} else {
NamespaceReference namespaceRef = (namespaceNameBuf.length() != 0) ?
- new NamespaceReference(listleft, listright - s.length() - 1, namespaceNameBuf.toString()) : null;
- fullyQualifiedName = new FullyQualifiedReference(listleft, endright, s, namespaceRef);
+ new NamespaceReference(listleft, listright - str.length() - 1, namespaceNameBuf.toString()) : null;
+ fullyQualifiedName = new FullyQualifiedReference(listleft, endright, str, namespaceRef);
+ }
+ }
+ RESULT = fullyQualifiedName;
+:}
+
+| T_NS_SEPARATOR:s namespace_name_list:list T_NS_SEPARATOR:end
+{:
+ // NB: leading backslash is optional and has no special meaning here, so totally ignore it
+ StringBuilder namespaceNameBuf = new StringBuilder();
+ FullyQualifiedReference fullyQualifiedName = null;
+ Iterator i = list.iterator();
+ while (i.hasNext()) {
+ String str = (String) i.next();
+ if (i.hasNext()) {
+ if (namespaceNameBuf.length() != 0) {
+ namespaceNameBuf.append('\\');
+ }
+ namespaceNameBuf.append(str);
+ } else {
+ NamespaceReference namespaceRef = (namespaceNameBuf.length() != 0) ?
+ new NamespaceReference(sright, listright - str.length() - 1, namespaceNameBuf.toString()) : null;
+ fullyQualifiedName = new FullyQualifiedReference(sright, endright, str, namespaceRef);
}
}
RESULT = fullyQualifiedName;
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/core/compiler/ast/nodes/NamespaceReference.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/core/compiler/ast/nodes/NamespaceReference.java
index 6fb8f245f..a4c59968f 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/core/compiler/ast/nodes/NamespaceReference.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/core/compiler/ast/nodes/NamespaceReference.java
@@ -36,7 +36,9 @@ public class NamespaceReference extends TypeReference {
}
/**
- * Returns whether the namespace name is prefixed with a '\' character
+ * Returns whether the namespace name is prefixed with a '\' character. <br>
+ * <b>WARNING:</b> isGlobal() will always return false for
+ * NamespaceReferences used inside any kind of use statement declaration.
*
* @return
*/
@@ -54,7 +56,10 @@ public class NamespaceReference extends TypeReference {
}
/**
- * Returns whether the namespace name is prefixed with a 'namespace' keyword
+ * Returns whether the namespace name is prefixed with a 'namespace'
+ * keyword. <br>
+ * <b>WARNING:</b> despite its name, method isLocal() is <b>not</b> related
+ * to method isGlobal().
*
* @return
*/
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPCompletionEngine.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPCompletionEngine.java
index 6343264e6..1a1c761cc 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPCompletionEngine.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPCompletionEngine.java
@@ -25,6 +25,7 @@ import org.eclipse.dltk.core.*;
import org.eclipse.dltk.internal.core.ModelManager;
import org.eclipse.php.core.codeassist.*;
import org.eclipse.php.core.compiler.PHPFlags;
+import org.eclipse.php.core.compiler.ast.nodes.NamespaceReference;
import org.eclipse.php.internal.core.PHPCorePlugin;
import org.eclipse.php.internal.core.codeassist.contexts.CompletionContextResolver;
import org.eclipse.php.internal.core.codeassist.strategies.CompletionStrategyFactory;
@@ -162,7 +163,9 @@ public class PHPCompletionEngine extends ScriptCompletionEngine implements IComp
return;
}
processedFields.add(field);
+ noProposal = false;
+ assert StringUtils.isEmpty(prefix) || !prefix.startsWith(NamespaceReference.NAMESPACE_DELIMITER);
assert !(removeDollar && StringUtils.isNotEmpty(prefix));
int flags = 0;
@@ -174,8 +177,6 @@ public class PHPCompletionEngine extends ScriptCompletionEngine implements IComp
int relevance = PHPFlags.isConstant(flags) ? relevanceConst : relevanceVar;
relevance += subRelevance;
- noProposal = false;
-
if (!requestor.isIgnored(CompletionProposal.FIELD_REF)) {
CompletionProposal proposal = createProposal(CompletionProposal.FIELD_REF, actualCompletionPosition);
@@ -191,7 +192,6 @@ public class PHPCompletionEngine extends ScriptCompletionEngine implements IComp
&& StringUtils.startsWithIgnoreCase(elementFullName, prefix)) {
completionName = elementFullName.substring(prefix.length());
}
-
} else if (removeDollar && completionName.startsWith("$")) { //$NON-NLS-1$
completionName = completionName.substring(1);
}
@@ -291,9 +291,10 @@ public class PHPCompletionEngine extends ScriptCompletionEngine implements IComp
return;
}
processedElements.put(method, method);
-
noProposal = false;
+ assert StringUtils.isEmpty(prefix) || !prefix.startsWith(NamespaceReference.NAMESPACE_DELIMITER);
+
if (!requestor.isIgnored(CompletionProposal.METHOD_REF)) {
CompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF, actualCompletionPosition);
proposal.setExtraInfo(extraInfo);
@@ -380,9 +381,10 @@ public class PHPCompletionEngine extends ScriptCompletionEngine implements IComp
return;
}
processedElements.put(type, type);
-
noProposal = false;
+ assert StringUtils.isEmpty(prefix) || !prefix.startsWith(NamespaceReference.NAMESPACE_DELIMITER);
+
if (!requestor.isIgnored(CompletionProposal.TYPE_REF)) {
CompletionProposal proposal = createProposal(CompletionProposal.TYPE_REF, actualCompletionPosition);
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/UseStatementContext.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/UseStatementContext.java
index bbc64a651..018f1e552 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/UseStatementContext.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/UseStatementContext.java
@@ -38,6 +38,7 @@ import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentReg
* 3. use A as |
* 4. use A as B|
* 5. use A\{ B, \C| }
+ * 6. use \A\{ B, \C| }
* etc...
* </pre>
*
@@ -69,16 +70,16 @@ public abstract class UseStatementContext extends StatementContext {
}
/**
- * Returns true when the use statement (TYPES.USE) or the group use statement
- * (TYPES.USE_GROUP) contains the keyword "function".
+ * Returns true when the use statement (TYPES.USE) or the group use
+ * statement (TYPES.USE_GROUP) contains the keyword "function".
*/
public boolean isUseFunctionStatement() {
return isUseFunctionStatement;
}
/**
- * Returns true when the use statement (TYPES.USE) or the group use statement
- * (TYPES.USE_GROUP) contains the keyword "const".
+ * Returns true when the use statement (TYPES.USE) or the group use
+ * statement (TYPES.USE_GROUP) contains the keyword "const".
*/
public boolean isUseConstStatement() {
return isUseConstStatement;
@@ -151,6 +152,9 @@ public abstract class UseStatementContext extends StatementContext {
// "use X\Y\ { A, B, \C\D| };" with '|' the cursor position.
// When found, at this point statementText will contain "A, B, \C\D"
// and statementTextBeforeCurly will contain "use X\Y\ ".
+ // Note that "use \X\Y\ { A, B, \C\D| };" is also a valid "grouped
+ // use statement" syntax, even if it's not a well-documented php
+ // feature.
TextSequence statementTextBeforeOpeningCurly = PHPTextSequenceUtilities
.getStatement(foundDelimiter[0].getStart(), sdRegion, true);
if (hasUsePrefix(statementTextBeforeOpeningCurly)) {
@@ -193,8 +197,8 @@ public abstract class UseStatementContext extends StatementContext {
// statementTextBeforeOpeningCurly.length() +
// statementText.length()
fullStatementText.length() - (statementText.length() - idxS2));
- // 4. store "X\Y\" in biggestCommonStatementText and "C\D" in
- // longestStatementTextBeforeCursor
+ // 4. store "use X\Y\" in biggestCommonStatementText and "C\D"
+ // in longestStatementTextBeforeCursor
biggestCommonStatementText = statementTextBeforeOpeningCurly.cutTextSequence(endS1,
statementTextBeforeOpeningCurly.length());
longestPrefixTextBeforeCursor = statementText.cutTextSequence(0, idx3);
@@ -221,9 +225,11 @@ public abstract class UseStatementContext extends StatementContext {
}
/**
- * Prefix part of a "grouped use statement", in the statement part before '{'.
- * Returned value is null for other statement types. For example, with "use X\Y\
- * { A, B, \C\D| };" this method would return "X\Y\".
+ * Non-null prefix part of a "grouped use statement", in the statement part
+ * before '{'. <b>Returned value is null if it's not a "grouped use
+ * statement".</b> For example, this method would return "X\Y\" with
+ * <code>"use X\Y\ { A, B, \C\D| };"</code> and would return "\X\Y\" with
+ * <code>"use \X\Y\ { A, B, \C\D| };"</code>.
*
* @return
*/
@@ -241,9 +247,11 @@ public abstract class UseStatementContext extends StatementContext {
}
/**
- * When isCursorInsideGroupStatement() is true, only the prefix part after '{'
- * is returned, otherwise same content as getPrefix() is returned. For example,
- * with "use X\Y\ { A, B, \C\D| };" this method would return "\C\D".
+ * When isCursorInsideGroupStatement() is true, only the non-null prefix
+ * part after '{' is returned, otherwise same content as getPrefix() is
+ * returned. For example, this method would return <code>"\C\D"</code> with
+ * <code>"use X\Y\ { A, B, \C\D| };"</code> or with
+ * <code>"use \X\Y\ { A, B, \C\D| };"</code>.
*
* @return
*/
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/ConstantsStrategy.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/ConstantsStrategy.java
index 336079278..8d96f9920 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/ConstantsStrategy.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/ConstantsStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2017 IBM Corporation and others.
+ * Copyright (c) 2009, 2017, 2019 IBM Corporation and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
@@ -69,6 +69,10 @@ public class ConstantsStrategy extends ElementsStrategy {
boolean isUseConstStatement = false;
if (context instanceof UseStatementContext) {
nsUseGroupPrefix = ((UseStatementContext) context).getGroupPrefixBeforeOpeningCurly();
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=501654
+ if (nsUseGroupPrefix != null && nsUseGroupPrefix.startsWith(NamespaceReference.NAMESPACE_DELIMITER)) {
+ nsUseGroupPrefix = nsUseGroupPrefix.substring(1);
+ }
isUseConstStatement = ((UseStatementContext) context).isUseConstStatement();
}
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/FunctionsStrategy.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/FunctionsStrategy.java
index 64e01b25f..998ffdb88 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/FunctionsStrategy.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/FunctionsStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2017 IBM Corporation and others.
+ * Copyright (c) 2009, 2017, 2019 IBM Corporation and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
@@ -63,6 +63,10 @@ public class FunctionsStrategy extends ElementsStrategy {
String nsUseGroupPrefix = null;
if (context instanceof UseStatementContext) {
nsUseGroupPrefix = ((UseStatementContext) context).getGroupPrefixBeforeOpeningCurly();
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=501654
+ if (nsUseGroupPrefix != null && nsUseGroupPrefix.startsWith(NamespaceReference.NAMESPACE_DELIMITER)) {
+ nsUseGroupPrefix = nsUseGroupPrefix.substring(1);
+ }
}
int extraInfo = getExtraInfo();
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/TypesStrategy.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/TypesStrategy.java
index 5f72f841a..561aa07fd 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/TypesStrategy.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/TypesStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2017 IBM Corporation and others.
+ * Copyright (c) 2009, 2017, 2019 IBM Corporation and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
@@ -84,6 +84,10 @@ public class TypesStrategy extends ElementsStrategy {
String nsUseGroupPrefix = null;
if (context instanceof UseStatementContext) {
nsUseGroupPrefix = ((UseStatementContext) context).getGroupPrefixBeforeOpeningCurly();
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=501654
+ if (nsUseGroupPrefix != null && nsUseGroupPrefix.startsWith(NamespaceReference.NAMESPACE_DELIMITER)) {
+ nsUseGroupPrefix = nsUseGroupPrefix.substring(1);
+ }
}
IType[] types = getTypes(abstractContext);
diff --git a/tests/org.eclipse.php.core.tests/src/org/eclipse/php/core/tests/dom_ast/rewrite/ASTRewriteTestsPHP71.java b/tests/org.eclipse.php.core.tests/src/org/eclipse/php/core/tests/dom_ast/rewrite/ASTRewriteTestsPHP71.java
index 3a68be585..2c1ec205a 100644
--- a/tests/org.eclipse.php.core.tests/src/org/eclipse/php/core/tests/dom_ast/rewrite/ASTRewriteTestsPHP71.java
+++ b/tests/org.eclipse.php.core.tests/src/org/eclipse/php/core/tests/dom_ast/rewrite/ASTRewriteTestsPHP71.java
@@ -55,6 +55,20 @@ public class ASTRewriteTestsPHP71 extends ASTRewriteTestsPHP7 {
}
@Test
+ public void useStatementFunctionSet2b() throws Exception {
+ String str = "<?php use \\Foo\\{Bar}; \n ?>";
+ initialize(str);
+
+ List<UseStatement> statements = getAllOfType(program, UseStatement.class);
+ assertTrue("Unexpected list size.", statements.size() == 1);
+ assertTrue("Unexpected parts list size.", statements.get(0).parts().size() == 1);
+ statements.get(0).parts().get(0).setStatementType(UseStatement.T_FUNCTION);
+
+ rewrite();
+ checkResult("<?php use \\Foo\\{function Bar}; \n ?>");
+ }
+
+ @Test
public void useStatementConstSet2() throws Exception {
String str = "<?php use Foo\\{Bar}; \n ?>";
initialize(str);
@@ -69,6 +83,20 @@ public class ASTRewriteTestsPHP71 extends ASTRewriteTestsPHP7 {
}
@Test
+ public void useStatementConstSet2b() throws Exception {
+ String str = "<?php use \\Foo\\{Bar}; \n ?>";
+ initialize(str);
+
+ List<UseStatement> statements = getAllOfType(program, UseStatement.class);
+ assertTrue("Unexpected list size.", statements.size() == 1);
+ assertTrue("Unexpected parts list size.", statements.get(0).parts().size() == 1);
+ statements.get(0).parts().get(0).setStatementType(UseStatement.T_CONST);
+
+ rewrite();
+ checkResult("<?php use \\Foo\\{const Bar}; \n ?>");
+ }
+
+ @Test
public void useStatementFunctionSet3() throws Exception {
String str = "<?php use function Foo\\{Bar, Bar2}; \n ?>";
initialize(str);
@@ -84,6 +112,21 @@ public class ASTRewriteTestsPHP71 extends ASTRewriteTestsPHP7 {
}
@Test
+ public void useStatementFunctionSet3b() throws Exception {
+ String str = "<?php use function \\Foo\\{Bar, Bar2}; \n ?>";
+ initialize(str);
+
+ List<UseStatement> statements = getAllOfType(program, UseStatement.class);
+ assertTrue("Unexpected list size.", statements.size() == 1);
+ statements.get(0).setStatementType(UseStatement.T_NONE);
+ assertTrue("Unexpected parts list size.", statements.get(0).parts().size() == 2);
+ statements.get(0).parts().get(1).setStatementType(UseStatement.T_FUNCTION);
+
+ rewrite();
+ checkResult("<?php use Foo\\{Bar, function Bar2}; \n ?>");
+ }
+
+ @Test
public void useStatementConstSet3() throws Exception {
String str = "<?php use function Foo\\{Bar, Bar2}; \n ?>";
initialize(str);
@@ -97,6 +140,19 @@ public class ASTRewriteTestsPHP71 extends ASTRewriteTestsPHP7 {
}
@Test
+ public void useStatementConstSet3b() throws Exception {
+ String str = "<?php use function \\Foo\\{Bar, Bar2}; \n ?>";
+ initialize(str);
+
+ List<UseStatement> statements = getAllOfType(program, UseStatement.class);
+ assertTrue("Unexpected list size.", statements.size() == 1);
+ statements.get(0).setStatementType(UseStatement.T_CONST);
+
+ rewrite();
+ checkResult("<?php use const Foo\\{Bar, Bar2}; \n ?>");
+ }
+
+ @Test
public void useStatementConstSet4() throws Exception {
String str = "<?php use Foo\\{const Bar, function Bar2}; \n ?>";
initialize(str);
@@ -113,6 +169,22 @@ public class ASTRewriteTestsPHP71 extends ASTRewriteTestsPHP7 {
}
@Test
+ public void useStatementConstSet4b() throws Exception {
+ String str = "<?php use \\Foo\\{const Bar, function Bar2}; \n ?>";
+ initialize(str);
+
+ List<UseStatement> statements = getAllOfType(program, UseStatement.class);
+ assertTrue("Unexpected list size.", statements.size() == 1);
+ statements.get(0).setStatementType(UseStatement.T_CONST);
+ assertTrue("Unexpected parts list size.", statements.get(0).parts().size() == 2);
+ statements.get(0).parts().get(0).setStatementType(UseStatement.T_NONE);
+ statements.get(0).parts().get(1).setStatementType(UseStatement.T_NONE);
+
+ rewrite();
+ checkResult("<?php use const Foo\\{Bar, Bar2}; \n ?>");
+ }
+
+ @Test
public void useStatementNoneSet2() throws Exception {
String str = "<?php use Foo\\{const Bar, function Bar2}; \n ?>";
initialize(str);
@@ -129,6 +201,22 @@ public class ASTRewriteTestsPHP71 extends ASTRewriteTestsPHP7 {
}
@Test
+ public void useStatementNoneSet2b() throws Exception {
+ String str = "<?php use \\Foo\\{const Bar, function Bar2}; \n ?>";
+ initialize(str);
+
+ List<UseStatement> statements = getAllOfType(program, UseStatement.class);
+ assertTrue("Unexpected list size.", statements.size() == 1);
+ statements.get(0).setStatementType(UseStatement.T_NONE);
+ assertTrue("Unexpected parts list size.", statements.get(0).parts().size() == 2);
+ statements.get(0).parts().get(0).setStatementType(UseStatement.T_NONE);
+ statements.get(0).parts().get(1).setStatementType(UseStatement.T_NONE);
+
+ rewrite();
+ checkResult("<?php use \\Foo\\{Bar, Bar2}; \n ?>");
+ }
+
+ @Test
public void useStatementNoneSet3() throws Exception {
String str = "<?php use function Foo\\{Bar, Bar2}; \n ?>";
initialize(str);
@@ -145,6 +233,22 @@ public class ASTRewriteTestsPHP71 extends ASTRewriteTestsPHP7 {
}
@Test
+ public void useStatementNoneSet3b() throws Exception {
+ String str = "<?php use function \\Foo\\{Bar, Bar2}; \n ?>";
+ initialize(str);
+
+ List<UseStatement> statements = getAllOfType(program, UseStatement.class);
+ assertTrue("Unexpected list size.", statements.size() == 1);
+ statements.get(0).setStatementType(UseStatement.T_NONE);
+ assertTrue("Unexpected parts list size.", statements.get(0).parts().size() == 2);
+ statements.get(0).parts().get(0).setStatementType(UseStatement.T_NONE);
+ statements.get(0).parts().get(1).setStatementType(UseStatement.T_NONE);
+
+ rewrite();
+ checkResult("<?php use Foo\\{Bar, Bar2}; \n ?>");
+ }
+
+ @Test
public void useStatementNoneSet4() throws Exception {
String str = "<?php use Foo\\{function Bar, Bar, const Bar}; \n ?>";
initialize(str);
@@ -161,4 +265,21 @@ public class ASTRewriteTestsPHP71 extends ASTRewriteTestsPHP7 {
checkResult("<?php use Foo\\{Bar, Bar, Bar}; \n ?>");
}
+ @Test
+ public void useStatementNoneSet4b() throws Exception {
+ String str = "<?php use \\Foo\\{function Bar, Bar, const Bar}; \n ?>";
+ initialize(str);
+
+ List<UseStatement> statements = getAllOfType(program, UseStatement.class);
+ assertTrue("Unexpected list size.", statements.size() == 1);
+ statements.get(0).setStatementType(UseStatement.T_NONE);
+ assertTrue("Unexpected parts list size.", statements.get(0).parts().size() == 3);
+ statements.get(0).parts().get(0).setStatementType(UseStatement.T_NONE);
+ statements.get(0).parts().get(1).setStatementType(UseStatement.T_NONE);
+ statements.get(0).parts().get(2).setStatementType(UseStatement.T_NONE);
+
+ rewrite();
+ checkResult("<?php use \\Foo\\{Bar, Bar, Bar}; \n ?>");
+ }
+
}
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement01B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement01B.pdtt
new file mode 100644
index 000000000..634670703
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement01B.pdtt
@@ -0,0 +1,22 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+namespace Boo {
+ class MyClass {
+ public function test($param) {
+ echo $param;
+ }
+ }
+}
+
+namespace Foo {
+ use \Boo\ {
+ MyClass
+ };
+
+ $var = new MyClass();
+ $var->tes|
+}
+--EXPECT--
+method(test)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement02B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement02B.pdtt
new file mode 100644
index 000000000..77a2ee7bd
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement02B.pdtt
@@ -0,0 +1,19 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+namespace Boo {
+ function test(){
+ return new \DateTime();
+ }
+}
+
+namespace Foo {
+ use function \Boo\ {
+ test
+ };
+
+ test()->createFromF|
+}
+--EXPECT--
+method(createFromFormat)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement04B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement04B.pdtt
new file mode 100644
index 000000000..5e36c5075
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement04B.pdtt
@@ -0,0 +1,23 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+namespace Foo;
+
+use \Boo\Boo2\ {
+ Boo3\MyClass as MyAlias
+};
+
+$var = new MyAlias ();
+$var->tes|
+--FILE0--
+<?php
+namespace Boo\Boo2\Boo3;
+
+class MyClass {
+ public function test($param) {
+ echo $param;
+ }
+}
+--EXPECT--
+method(test)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement05B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement05B.pdtt
new file mode 100644
index 000000000..26bc5e73e
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/groupUseStatement05B.pdtt
@@ -0,0 +1,25 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+namespace ns2\ns3\ns4;
+
+class MyFooClass3 {
+}
+
+class MyFooClass4 {
+}
+
+namespace ns5;
+
+/* comment */ use \/* comment */ ns2\ns3\ /* comment */ {
+
+ /* comment */ ns4\MyFooClass3
+
+ /* comment */ , /* comment */ \ns4\| /* comment */
+
+
+};
+--EXPECT--
+type(MyFooClass3)
+type(MyFooClass4)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass01B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass01B.pdtt
new file mode 100644
index 000000000..ced13c9d4
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass01B.pdtt
@@ -0,0 +1,55 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseClass01\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass01\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseClass01\ { | as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseClass01\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseClass01\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+keyword(const)
+keyword(function)
+type(MyUseClass01\Space)
+type(MyUseClass01\Space\A)
+type(MyUseClass01\Space2\A)
+type(MyUseClass01\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass02B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass02B.pdtt
new file mode 100644
index 000000000..7ee1a7405
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass02B.pdtt
@@ -0,0 +1,52 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseClass02\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass02\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass02\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass02\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass02\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseClass02\ { Space\| as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseClass02\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseClass02\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseClass02\Space\A)
+type(MyUseClass02\Space\AB)
+type(MyClass)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass03B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass03B.pdtt
new file mode 100644
index 000000000..f85dbcdf8
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass03B.pdtt
@@ -0,0 +1,50 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseClass03\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass03\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass03\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass03\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass03\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseClass03\ { Space\A\| as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseClass03\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseClass03\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyClass2)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass04B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass04B.pdtt
new file mode 100644
index 000000000..1b3dc4ad6
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass04B.pdtt
@@ -0,0 +1,53 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseClass04\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass04\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass04\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass04\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass04\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseClass04\ { Space\A\MyClass2 as C, \| as D, \Space\AB\MyClass3 as E };
+use const \MyUseClass04\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseClass04\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseClass04\Space)
+type(MyUseClass04\Space\A)
+type(MyUseClass04\Space2\A)
+type(MyUseClass04\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass05B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass05B.pdtt
new file mode 100644
index 000000000..8e365f363
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass05B.pdtt
@@ -0,0 +1,50 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseClass05\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass05\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass05\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass05\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass05\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseClass05\ { Space\A\MyClass2 as C, \Space2\| as D, \Space\AB\MyClass3 as E };
+use const \MyUseClass05\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseClass05\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseClass05\Space2\A)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass06B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass06B.pdtt
new file mode 100644
index 000000000..6d97758ae
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass06B.pdtt
@@ -0,0 +1,50 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseClass06\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass06\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass06\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass06\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass06\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseClass06\ { Space\A\MyClass2 as C, \Space2\A\| as D, \Space\AB\MyClass3 as E };
+use const \MyUseClass06\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseClass06\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyClass2)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass07B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass07B.pdtt
new file mode 100644
index 000000000..9d08ce486
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass07B.pdtt
@@ -0,0 +1,53 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseClass07\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass07\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass07\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass07\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass07\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseClass07\ { \| as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseClass07\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseClass07\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseClass07\Space)
+type(MyUseClass07\Space\A)
+type(MyUseClass07\Space2\A)
+type(MyUseClass07\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass08B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass08B.pdtt
new file mode 100644
index 000000000..e28773ab5
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass08B.pdtt
@@ -0,0 +1,53 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseClass08\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass08\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass08\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass08\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass08\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseClass08\ { Space\A\MyClass2 as C, \Space| as D, \Space\AB\MyClass3 as E };
+use const \MyUseClass08\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseClass08\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseClass08\Space)
+type(MyUseClass08\Space\A)
+type(MyUseClass08\Space2\A)
+type(MyUseClass08\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass09B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass09B.pdtt
new file mode 100644
index 000000000..520af8502
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass09B.pdtt
@@ -0,0 +1,55 @@
+--TEST--
+No bug - better CA for mixed use group statements
+--FILE--
+<?php
+namespace MyUseClass01\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass01\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseClass01\ { \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E, | as C };
+use const \MyUseClass01\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseClass01\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+keyword(const)
+keyword(function)
+type(MyUseClass01\Space)
+type(MyUseClass01\Space\A)
+type(MyUseClass01\Space2\A)
+type(MyUseClass01\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass10B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass10B.pdtt
new file mode 100644
index 000000000..e8373a8f3
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass10B.pdtt
@@ -0,0 +1,53 @@
+--TEST--
+No bug - better CA for mixed use group statements
+--FILE--
+<?php
+namespace MyUseClass01\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass01\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseClass01\ { \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E, \| as C };
+use const \MyUseClass01\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseClass01\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseClass01\Space)
+type(MyUseClass01\Space\A)
+type(MyUseClass01\Space2\A)
+type(MyUseClass01\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass11B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass11B.pdtt
new file mode 100644
index 000000000..11a907831
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass11B.pdtt
@@ -0,0 +1,47 @@
+--TEST--
+No bug - better CA for mixed use group statements
+--FILE--
+<?php
+namespace MyUseClass01\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass01\ { \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E, function \Space\A\| as C };
+--EXPECT--
+method(foo1)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass12B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass12B.pdtt
new file mode 100644
index 000000000..698eb1f49
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass12B.pdtt
@@ -0,0 +1,47 @@
+--TEST--
+No bug - better CA for mixed use group statements
+--FILE--
+<?php
+namespace MyUseClass01\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass01\ { \Space2\A\MyClass2 as D, function \Space\AB\foo1 as E, const \Space\A\| as C };
+--EXPECT--
+field(CONST1)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass13B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass13B.pdtt
new file mode 100644
index 000000000..eb25e93f3
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass13B.pdtt
@@ -0,0 +1,47 @@
+--TEST--
+No bug - better CA for mixed use group statements
+--FILE--
+<?php
+namespace MyUseClass01\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass01\ { \Space2\A\MyClass2 as D, const Space\A\CONST1 as E, function \Space\A\| as C };
+--EXPECT--
+method(foo1)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass14B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass14B.pdtt
new file mode 100644
index 000000000..4a9690577
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass14B.pdtt
@@ -0,0 +1,50 @@
+--TEST--
+No bug - better CA for mixed use group statements
+--FILE--
+<?php
+namespace MyUseClass01\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass01\ { \Space2\A\MyClass2 as D, const Space\A\CONST1 as E, function | as C };
+--EXPECT--
+type(MyUseClass01\Space)
+type(MyUseClass01\Space\A)
+type(MyUseClass01\Space2\A)
+type(MyUseClass01\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass15B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass15B.pdtt
new file mode 100644
index 000000000..37ad52cb3
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseClass15B.pdtt
@@ -0,0 +1,50 @@
+--TEST--
+No bug - better CA for mixed use group statements
+--FILE--
+<?php
+namespace MyUseClass01\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseClass01\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseClass01\ { \Space2\A\MyClass2 as D, const Space\A\CONST1 as E, const | as C };
+--EXPECT--
+type(MyUseClass01\Space)
+type(MyUseClass01\Space\A)
+type(MyUseClass01\Space2\A)
+type(MyUseClass01\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst01B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst01B.pdtt
new file mode 100644
index 000000000..29091057d
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst01B.pdtt
@@ -0,0 +1,53 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseConst01\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst01\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst01\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst01\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseConst01\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseConst01\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseConst01\ { | as F, \Space\AB\CONST1 as G };
+use function \MyUseConst01\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseConst01\Space)
+type(MyUseConst01\Space\A)
+type(MyUseConst01\Space2\A)
+type(MyUseConst01\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst02B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst02B.pdtt
new file mode 100644
index 000000000..2d399ca0c
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst02B.pdtt
@@ -0,0 +1,50 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseConst02\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst02\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst02\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst02\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseConst02\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseConst02\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseConst02\ { Space2\| as F, \Space\AB\CONST1 as G };
+use function \MyUseConst02\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseConst02\Space2\A)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst03B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst03B.pdtt
new file mode 100644
index 000000000..48d7342d7
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst03B.pdtt
@@ -0,0 +1,50 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseConst03\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst03\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst03\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst03\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseConst03\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseConst03\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseConst03\ { Space2\A\| as F, \Space\AB\CONST1 as G };
+use function \MyUseConst03\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+field(CONST1)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst04B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst04B.pdtt
new file mode 100644
index 000000000..d238cf068
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst04B.pdtt
@@ -0,0 +1,53 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseConst04\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst04\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst04\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst04\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseConst04\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseConst04\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseConst04\ { Space2\A\CONST1 as F, \| as G };
+use function \MyUseConst04\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseConst04\Space)
+type(MyUseConst04\Space\A)
+type(MyUseConst04\Space2\A)
+type(MyUseConst04\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst05B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst05B.pdtt
new file mode 100644
index 000000000..18d63e697
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst05B.pdtt
@@ -0,0 +1,52 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseConst05\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst05\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst05\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst05\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseConst05\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseConst05\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseConst05\ { Space2\A\CONST1 as F, \Space\| as G };
+use function \MyUseConst05\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseConst05\Space\A)
+type(MyUseConst05\Space\AB)
+field(CONST1)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst06B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst06B.pdtt
new file mode 100644
index 000000000..a18d8ee75
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst06B.pdtt
@@ -0,0 +1,50 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseConst06\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst06\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst06\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst06\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseConst06\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseConst06\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseConst06\ { Space2\A\CONST1 as F, \Space\AB\| as G };
+use function \MyUseConst06\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+field(CONST1)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst07B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst07B.pdtt
new file mode 100644
index 000000000..c29e9ef18
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseConst07B.pdtt
@@ -0,0 +1,53 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseConst07\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst07\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst07\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseConst07\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseConst07\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseConst07\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseConst07\ { \| as F, \Space\AB\CONST1 as G };
+use function \MyUseConst07\ { Space2\A\foo1 as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseConst07\Space)
+type(MyUseConst07\Space\A)
+type(MyUseConst07\Space2\A)
+type(MyUseConst07\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion01B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion01B.pdtt
new file mode 100644
index 000000000..6f1f6fd5a
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion01B.pdtt
@@ -0,0 +1,53 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseFunction01\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction01\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction01\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction01\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseFunction01\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseFunction01\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseFunction01\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseFunction01\ { | as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseFunction01\Space)
+type(MyUseFunction01\Space\A)
+type(MyUseFunction01\Space2\A)
+type(MyUseFunction01\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion02B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion02B.pdtt
new file mode 100644
index 000000000..d9a2567f9
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion02B.pdtt
@@ -0,0 +1,50 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseFunction02\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction02\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction02\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction02\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseFunction02\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseFunction02\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseFunction02\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseFunction02\ { Space2\| as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseFunction02\Space2\A)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion03B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion03B.pdtt
new file mode 100644
index 000000000..ccfc1a0f5
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion03B.pdtt
@@ -0,0 +1,50 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseFunction03\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction03\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction03\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction03\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseFunction03\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseFunction03\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseFunction03\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseFunction03\ { Space2\A\| as H, \Space\A\foo1 as I };
+--EXPECT--
+method(foo1)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion04B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion04B.pdtt
new file mode 100644
index 000000000..18a84993c
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion04B.pdtt
@@ -0,0 +1,53 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseFunction04\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction04\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction04\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction04\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseFunction04\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseFunction04\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseFunction04\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseFunction04\ { Space2\A\foo1 as H, \| as I };
+--EXPECT--
+type(MyUseFunction04\Space)
+type(MyUseFunction04\Space\A)
+type(MyUseFunction04\Space2\A)
+type(MyUseFunction04\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion05B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion05B.pdtt
new file mode 100644
index 000000000..c69af0bcb
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion05B.pdtt
@@ -0,0 +1,52 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseFunction05\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction05\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction05\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction05\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseFunction05\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseFunction05\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseFunction05\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseFunction05\ { Space2\A\foo1 as H, \Space\| as I };
+--EXPECT--
+type(MyUseFunction05\Space\A)
+type(MyUseFunction05\Space\AB)
+method(foo1)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion06B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion06B.pdtt
new file mode 100644
index 000000000..66896c188
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion06B.pdtt
@@ -0,0 +1,50 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseFunction06\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction06\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction06\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction06\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseFunction06\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseFunction06\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseFunction06\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseFunction06\ { Space2\A\foo1 as H, \Space\A\| as I };
+--EXPECT--
+method(foo1)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion07B.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion07B.pdtt
new file mode 100644
index 000000000..b29d32627
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php7/testUseFuntion07B.pdtt
@@ -0,0 +1,53 @@
+--TEST--
+Bug 521134 - content assist doesn't work with grouped use statements
+--FILE--
+<?php
+namespace MyUseFunction07\Space;
+class MyClass
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction07\Space\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction07\Space2\A;
+class MyClass2
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+namespace MyUseFunction07\Space\AB;
+class MyClass3
+{
+}
+
+const CONST1 = 0;
+
+function foo1() {
+}
+
+use \MyUseFunction07\Space\ { MyClass as A, AB\MyClass3 as B };
+use \MyUseFunction07\ { Space\A\MyClass2 as C, \Space2\A\MyClass2 as D, \Space\AB\MyClass3 as E };
+use const \MyUseFunction07\ { Space2\A\CONST1 as F, \Space\AB\CONST1 as G };
+use function \MyUseFunction07\ { \| as H, \Space\A\foo1 as I };
+--EXPECT--
+type(MyUseFunction07\Space)
+type(MyUseFunction07\Space\A)
+type(MyUseFunction07\Space2\A)
+type(MyUseFunction07\Space\AB)
diff --git a/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement01B.pdtt b/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement01B.pdtt
new file mode 100644
index 000000000..091705c63
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement01B.pdtt
@@ -0,0 +1,31 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+use \Test\Boo\ {
+ Foo,
+ FooX as MyAlias
+};
+--EXPECT--
+<ModuleDeclaration start="0" end="50">
+ <UseStatement start="6" end="49">
+ <Namespace>
+ <FullyQualifiedReference start="11" end="20" name="Test\Boo">
+ <NamespaceReference start="11" end="15" name="Test" global="false" local="false">
+ </NamespaceReference>
+ </FullyQualifiedReference>
+ </Namespace>
+ <Parts>
+ <UsePart start="0" end="0">
+ <FullyQualifiedReference start="24" end="27" name="Foo">
+ </FullyQualifiedReference>
+ </UsePart>
+ <UsePart start="0" end="0">
+ <FullyQualifiedReference start="31" end="35" name="FooX">
+ </FullyQualifiedReference>
+ <SimpleReference start="39" end="46" name="MyAlias">
+ </SimpleReference>
+ </UsePart>
+ </Parts>
+ </UseStatement>
+</ModuleDeclaration> \ No newline at end of file
diff --git a/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement02B.pdtt b/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement02B.pdtt
new file mode 100644
index 000000000..1adb2c6ee
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement02B.pdtt
@@ -0,0 +1,41 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+use function \Test\Boo\ {
+ FooX
+};
+use const \Test\Boo\ {
+ FooX
+};
+--EXPECT--
+<ModuleDeclaration start="0" end="75">
+ <UseStatement start="6" end="41" statementType="1">
+ <Namespace>
+ <FullyQualifiedReference start="20" end="29" name="Test\Boo">
+ <NamespaceReference start="20" end="24" name="Test" global="false" local="false">
+ </NamespaceReference>
+ </FullyQualifiedReference>
+ </Namespace>
+ <Parts>
+ <UsePart start="0" end="0" statementType="1">
+ <FullyQualifiedReference start="34" end="38" name="FooX">
+ </FullyQualifiedReference>
+ </UsePart>
+ </Parts>
+ </UseStatement>
+ <UseStatement start="42" end="74" statementType="2">
+ <Namespace>
+ <FullyQualifiedReference start="53" end="62" name="Test\Boo">
+ <NamespaceReference start="53" end="57" name="Test" global="false" local="false">
+ </NamespaceReference>
+ </FullyQualifiedReference>
+ </Namespace>
+ <Parts>
+ <UsePart start="0" end="0" statementType="2">
+ <FullyQualifiedReference start="67" end="71" name="FooX">
+ </FullyQualifiedReference>
+ </UsePart>
+ </Parts>
+ </UseStatement>
+</ModuleDeclaration> \ No newline at end of file
diff --git a/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement03B.pdtt b/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement03B.pdtt
new file mode 100644
index 000000000..9230b0506
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement03B.pdtt
@@ -0,0 +1,31 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php use \foo\math\ { Math, const PI, function sin as TestSin };
+--EXPECT--
+<ModuleDeclaration start="0" end="66">
+ <UseStatement start="6" end="65">
+ <Namespace>
+ <FullyQualifiedReference start="11" end="20" name="foo\math">
+ <NamespaceReference start="11" end="14" name="foo" global="false" local="false">
+ </NamespaceReference>
+ </FullyQualifiedReference>
+ </Namespace>
+ <Parts>
+ <UsePart start="0" end="0">
+ <FullyQualifiedReference start="23" end="27" name="Math">
+ </FullyQualifiedReference>
+ </UsePart>
+ <UsePart start="0" end="0" statementType="2">
+ <FullyQualifiedReference start="35" end="37" name="PI">
+ </FullyQualifiedReference>
+ </UsePart>
+ <UsePart start="0" end="0" statementType="1">
+ <FullyQualifiedReference start="48" end="51" name="sin">
+ </FullyQualifiedReference>
+ <SimpleReference start="55" end="62" name="TestSin">
+ </SimpleReference>
+ </UsePart>
+ </Parts>
+ </UseStatement>
+</ModuleDeclaration> \ No newline at end of file
diff --git a/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement04B.pdtt b/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement04B.pdtt
new file mode 100644
index 000000000..9a74d4e1f
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php7/groupUseStatement04B.pdtt
@@ -0,0 +1,95 @@
+--TEST--
+Bug 519914 - Group Use declarations not recognized
+--FILE--
+<?php
+namespace Foo\Bar\X1
+{
+
+ class MyClass
+ {
+ }
+
+ function myFunction()
+ {
+ }
+
+ const MyConst = 10;
+}
+namespace Foo\Bar\X2
+{
+
+ use function \Foo\Bar\X1\ {
+ myFunction as myAlias1
+ };
+ use const \Foo\Bar\X1\ {
+ MyConst as myAlias2
+ };
+ use \Foo\Bar\X1\ {
+ MyClass as myAlias3
+ };
+}
+--EXPECT--
+<ModuleDeclaration start="0" end="344">
+ <NamespaceDeclaration start="6" end="125" modifiers="" name="Foo\Bar\X1">
+ <ClassDeclaration start="34" end="59" modifiers="" name="MyClass">
+ </ClassDeclaration>
+ <PHPMethodDeclaration start="65" end="98" modifiers="" name="myFunction">
+ </PHPMethodDeclaration>
+ <ConstantDeclaration start="104" end="122" modifiers="">
+ <ConstantReference start="110" end="117" name="MyConst">
+ </ConstantReference>
+ <Scalar start="120" end="122" type="int" value="10">
+ </Scalar>
+ </ConstantDeclaration>
+ </NamespaceDeclaration>
+ <NamespaceDeclaration start="126" end="343" modifiers="" name="Foo\Bar\X2">
+ <UseStatement start="154" end="219" statementType="1">
+ <Namespace>
+ <FullyQualifiedReference start="168" end="179" name="Foo\Bar\X1">
+ <NamespaceReference start="168" end="175" name="Foo\Bar" global="false" local="false">
+ </NamespaceReference>
+ </FullyQualifiedReference>
+ </Namespace>
+ <Parts>
+ <UsePart start="0" end="0" statementType="1">
+ <FullyQualifiedReference start="190" end="200" name="myFunction">
+ </FullyQualifiedReference>
+ <SimpleReference start="204" end="212" name="myAlias1">
+ </SimpleReference>
+ </UsePart>
+ </Parts>
+ </UseStatement>
+ <UseStatement start="224" end="283" statementType="2">
+ <Namespace>
+ <FullyQualifiedReference start="235" end="246" name="Foo\Bar\X1">
+ <NamespaceReference start="235" end="242" name="Foo\Bar" global="false" local="false">
+ </NamespaceReference>
+ </FullyQualifiedReference>
+ </Namespace>
+ <Parts>
+ <UsePart start="0" end="0" statementType="2">
+ <FullyQualifiedReference start="257" end="264" name="MyConst">
+ </FullyQualifiedReference>
+ <SimpleReference start="268" end="276" name="myAlias2">
+ </SimpleReference>
+ </UsePart>
+ </Parts>
+ </UseStatement>
+ <UseStatement start="288" end="341">
+ <Namespace>
+ <FullyQualifiedReference start="293" end="304" name="Foo\Bar\X1">
+ <NamespaceReference start="293" end="300" name="Foo\Bar" global="false" local="false">
+ </NamespaceReference>
+ </FullyQualifiedReference>
+ </Namespace>
+ <Parts>
+ <UsePart start="0" end="0">
+ <FullyQualifiedReference start="315" end="322" name="MyClass">
+ </FullyQualifiedReference>
+ <SimpleReference start="326" end="334" name="myAlias3">
+ </SimpleReference>
+ </UsePart>
+ </Parts>
+ </UseStatement>
+ </NamespaceDeclaration>
+</ModuleDeclaration>
diff --git a/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php72/trailingComma01B.pdtt b/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php72/trailingComma01B.pdtt
new file mode 100644
index 000000000..75486983d
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/compiler_parser/php72/trailingComma01B.pdtt
@@ -0,0 +1,143 @@
+--TEST--
+Test trailing commas
+--FILE--
+<?php
+// Grouped statements
+use \Foo\Bar\{ Foo, Bar, Baz, };
+// Mixed grouped statements
+use \Foo\Bar\{ function Foo, const Bar, Baz, };
+
+// Arrays (already possible)
+$array = [1, 2, 3,];
+
+// Function/method arguments (call)
+fooCall($arg1, $arg2, $arg3,);
+$obj->methodCall($arg1, $arg2, $arg3,);
+
+unset($a, $b, $c, );
+isset($a, $b, $c, );
+--EXPECT--
+<ModuleDeclaration start="0" end="339">
+ <UseStatement start="28" end="60">
+ <Namespace>
+ <FullyQualifiedReference start="33" end="41" name="Foo\Bar">
+ <NamespaceReference start="33" end="36" name="Foo" global="false" local="false">
+ </NamespaceReference>
+ </FullyQualifiedReference>
+ </Namespace>
+ <Parts>
+ <UsePart start="0" end="0">
+ <FullyQualifiedReference start="43" end="46" name="Foo">
+ </FullyQualifiedReference>
+ </UsePart>
+ <UsePart start="0" end="0">
+ <FullyQualifiedReference start="48" end="51" name="Bar">
+ </FullyQualifiedReference>
+ </UsePart>
+ <UsePart start="0" end="0">
+ <FullyQualifiedReference start="53" end="56" name="Baz">
+ </FullyQualifiedReference>
+ </UsePart>
+ </Parts>
+ </UseStatement>
+ <UseStatement start="89" end="136">
+ <Namespace>
+ <FullyQualifiedReference start="94" end="102" name="Foo\Bar">
+ <NamespaceReference start="94" end="97" name="Foo" global="false" local="false">
+ </NamespaceReference>
+ </FullyQualifiedReference>
+ </Namespace>
+ <Parts>
+ <UsePart start="0" end="0" statementType="1">
+ <FullyQualifiedReference start="113" end="116" name="Foo">
+ </FullyQualifiedReference>
+ </UsePart>
+ <UsePart start="0" end="0" statementType="2">
+ <FullyQualifiedReference start="124" end="127" name="Bar">
+ </FullyQualifiedReference>
+ </UsePart>
+ <UsePart start="0" end="0">
+ <FullyQualifiedReference start="129" end="132" name="Baz">
+ </FullyQualifiedReference>
+ </UsePart>
+ </Parts>
+ </UseStatement>
+ <ExpressionStatement start="167" end="187">
+ <Assignment start="167" end="186" operator="=">
+ <VariableReference start="167" end="173" name="$array">
+ </VariableReference>
+ <ArrayCreation start="176" end="186">
+ <ArrayElement start="177" end="178">
+ <Scalar start="177" end="178" type="int" value="1">
+ </Scalar>
+ </ArrayElement>
+ <ArrayElement start="180" end="181">
+ <Scalar start="180" end="181" type="int" value="2">
+ </Scalar>
+ </ArrayElement>
+ <ArrayElement start="183" end="184">
+ <Scalar start="183" end="184" type="int" value="3">
+ </Scalar>
+ </ArrayElement>
+ </ArrayCreation>
+ </Assignment>
+ </ExpressionStatement>
+ <ExpressionStatement start="225" end="255">
+ <PHPCallExpression start="225" end="254">
+ <FullyQualifiedReference start="225" end="232" name="fooCall">
+ </FullyQualifiedReference>
+ <PHPCallArgumentsList start="233" end="253">
+ <VariableReference start="233" end="238" name="$arg1">
+ </VariableReference>
+ <VariableReference start="240" end="245" name="$arg2">
+ </VariableReference>
+ <VariableReference start="247" end="252" name="$arg3">
+ </VariableReference>
+ </PHPCallArgumentsList>
+ </PHPCallExpression>
+ </ExpressionStatement>
+ <ExpressionStatement start="256" end="295">
+ <PHPCallExpression start="256" end="294">
+ <VariableReference start="256" end="260" name="$obj">
+ </VariableReference>
+ <SimpleReference start="262" end="272" name="methodCall">
+ </SimpleReference>
+ <PHPCallArgumentsList start="273" end="293">
+ <VariableReference start="273" end="278" name="$arg1">
+ </VariableReference>
+ <VariableReference start="280" end="285" name="$arg2">
+ </VariableReference>
+ <VariableReference start="287" end="292" name="$arg3">
+ </VariableReference>
+ </PHPCallArgumentsList>
+ </PHPCallExpression>
+ </ExpressionStatement>
+ <ExpressionStatement start="297" end="317">
+ <PHPCallExpression start="297" end="316">
+ <SimpleReference start="297" end="302" name="unset">
+ </SimpleReference>
+ <PHPCallArgumentsList start="303" end="315">
+ <VariableReference start="303" end="305" name="$a">
+ </VariableReference>
+ <VariableReference start="307" end="309" name="$b">
+ </VariableReference>
+ <VariableReference start="311" end="313" name="$c">
+ </VariableReference>
+ </PHPCallArgumentsList>
+ </PHPCallExpression>
+ </ExpressionStatement>
+ <ExpressionStatement start="318" end="338">
+ <PHPCallExpression start="318" end="337">
+ <SimpleReference start="318" end="323" name="isset">
+ </SimpleReference>
+ <PHPCallArgumentsList start="324" end="336">
+ <VariableReference start="324" end="326" name="$a">
+ </VariableReference>
+ <VariableReference start="328" end="330" name="$b">
+ </VariableReference>
+ <VariableReference start="332" end="334" name="$c">
+ </VariableReference>
+ </PHPCallArgumentsList>
+ </PHPCallExpression>
+ </ExpressionStatement>
+</ModuleDeclaration>
diff --git a/tests/org.eclipse.php.core.tests/workspace/document_lexer/php7/groupUseStatement01B.pdtt b/tests/org.eclipse.php.core.tests/workspace/document_lexer/php7/groupUseStatement01B.pdtt
new file mode 100644
index 000000000..050c17a2b
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/document_lexer/php7/groupUseStatement01B.pdtt
@@ -0,0 +1,38 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+use \Test\Boo\ {
+ Foo,
+ FooX as MyAlias
+};
+
+--EXPECT--
+PHP_TOKEN|<|2
+PHP_TOKEN|?|2
+PHP_LABEL|php|2
+WHITESPACE|
+|2
+PHP_USE|use|2
+WHITESPACE| |2
+PHP_NS_SEPARATOR|\|2
+PHP_LABEL|Test|2
+PHP_NS_SEPARATOR|\|2
+PHP_LABEL|Boo|2
+PHP_NS_SEPARATOR|\|2
+WHITESPACE| |2
+PHP_CURLY_OPEN|{
+ |2
+PHP_LABEL|Foo|2
+PHP_TOKEN|,|2
+WHITESPACE|
+ |2
+PHP_LABEL|FooX|2
+WHITESPACE| |2
+PHP_AS|as|2
+WHITESPACE| |2
+PHP_LABEL|MyAlias|2
+WHITESPACE|
+|2
+PHP_CURLY_CLOSE|}|2
+PHP_SEMICOLON|;|2 \ No newline at end of file
diff --git a/tests/org.eclipse.php.core.tests/workspace/document_lexer/php7/groupUseStatement02B.pdtt b/tests/org.eclipse.php.core.tests/workspace/document_lexer/php7/groupUseStatement02B.pdtt
new file mode 100644
index 000000000..539895e25
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/document_lexer/php7/groupUseStatement02B.pdtt
@@ -0,0 +1,52 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+use function \Test\Boo\ {
+ FooX
+};
+use const \Test\Boo\ {
+ FooX
+};
+--EXPECT--
+PHP_TOKEN|<|2
+PHP_TOKEN|?|2
+PHP_LABEL|php|2
+WHITESPACE|
+|2
+PHP_USE|use|2
+WHITESPACE| |2
+PHP_FUNCTION|function|36
+WHITESPACE| |36
+PHP_NS_SEPARATOR|\|2
+PHP_LABEL|Test|2
+PHP_NS_SEPARATOR|\|2
+PHP_LABEL|Boo|2
+PHP_NS_SEPARATOR|\|2
+WHITESPACE| |2
+PHP_CURLY_OPEN|{
+ |2
+PHP_LABEL|FooX|2
+WHITESPACE|
+|2
+PHP_CURLY_CLOSE|}|2
+PHP_SEMICOLON|;|2
+WHITESPACE|
+|2
+PHP_USE|use|2
+WHITESPACE| |2
+PHP_CONST|const|36
+WHITESPACE| |36
+PHP_NS_SEPARATOR|\|2
+PHP_LABEL|Test|2
+PHP_NS_SEPARATOR|\|2
+PHP_LABEL|Boo|2
+PHP_NS_SEPARATOR|\|2
+WHITESPACE| |2
+PHP_CURLY_OPEN|{
+ |2
+PHP_LABEL|FooX|2
+WHITESPACE|
+|2
+PHP_CURLY_CLOSE|}|2
+PHP_SEMICOLON|;|2
diff --git a/tests/org.eclipse.php.core.tests/workspace/document_lexer/php7/groupUseStatement03B.pdtt b/tests/org.eclipse.php.core.tests/workspace/document_lexer/php7/groupUseStatement03B.pdtt
new file mode 100644
index 000000000..8731d575d
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/document_lexer/php7/groupUseStatement03B.pdtt
@@ -0,0 +1,36 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php use \foo\math\ { Math, const PI, function sin as TestSin };
+--EXPECT--
+PHP_TOKEN|<|2
+PHP_TOKEN|?|2
+PHP_LABEL|php|2
+WHITESPACE| |2
+PHP_USE|use|2
+WHITESPACE| |2
+PHP_NS_SEPARATOR|\|2
+PHP_LABEL|foo|2
+PHP_NS_SEPARATOR|\|2
+PHP_LABEL|math|2
+PHP_NS_SEPARATOR|\|2
+WHITESPACE| |2
+PHP_CURLY_OPEN|{ |2
+PHP_LABEL|Math|2
+PHP_TOKEN|,|2
+WHITESPACE| |2
+PHP_CONST|const|36
+WHITESPACE| |36
+PHP_LABEL|PI|2
+PHP_TOKEN|,|2
+WHITESPACE| |2
+PHP_FUNCTION|function|36
+WHITESPACE| |36
+PHP_LABEL|sin|2
+WHITESPACE| |2
+PHP_AS|as|2
+WHITESPACE| |2
+PHP_LABEL|TestSin|2
+WHITESPACE| |2
+PHP_CURLY_CLOSE|}|2
+PHP_SEMICOLON|;|2
diff --git a/tests/org.eclipse.php.core.tests/workspace/dom_parser/php7/groupUseStatement01B.pdtt b/tests/org.eclipse.php.core.tests/workspace/dom_parser/php7/groupUseStatement01B.pdtt
new file mode 100644
index 000000000..5f92becc4
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/dom_parser/php7/groupUseStatement01B.pdtt
@@ -0,0 +1,38 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+use \Test\Boo\ {
+ Foo,
+ FooX as MyAlias
+};
+--EXPECT--
+<Program start='0' length='49'>
+ <Statements>
+ <UseStatement start='6' length='43'>
+ <NamespaceName start='11' length='9' global='false' current='false'>
+ <Identifier start='11' length='4' name='Test'/>
+ <Identifier start='16' length='3' name='Boo'/>
+ </NamespaceName>
+ <UseStatementPart start='24' length='3'>
+ <Name>
+ <NamespaceName start='24' length='3' global='false' current='false'>
+ <Identifier start='24' length='3' name='Foo'/>
+ </NamespaceName>
+ </Name>
+ </UseStatementPart>
+ <UseStatementPart start='31' length='15'>
+ <Name>
+ <NamespaceName start='31' length='4' global='false' current='false'>
+ <Identifier start='31' length='4' name='FooX'/>
+ </NamespaceName>
+ </Name>
+ <Alias>
+ <Identifier start='39' length='7' name='MyAlias'/>
+ </Alias>
+ </UseStatementPart>
+ </UseStatement>
+ </Statements>
+ <Comments>
+ </Comments>
+</Program> \ No newline at end of file
diff --git a/tests/org.eclipse.php.core.tests/workspace/dom_parser/php7/groupUseStatement02B.pdtt b/tests/org.eclipse.php.core.tests/workspace/dom_parser/php7/groupUseStatement02B.pdtt
new file mode 100644
index 000000000..22a45a1f6
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/dom_parser/php7/groupUseStatement02B.pdtt
@@ -0,0 +1,43 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+use function \Test\Boo\ {
+ FooX
+};
+use const \Test\Boo\ {
+ FooX
+};
+--EXPECT--
+<Program start='0' length='74'>
+ <Statements>
+ <UseStatement start='6' length='35' statementType='1'>
+ <NamespaceName start='20' length='9' global='false' current='false'>
+ <Identifier start='20' length='4' name='Test'/>
+ <Identifier start='25' length='3' name='Boo'/>
+ </NamespaceName>
+ <UseStatementPart start='34' length='4'>
+ <Name>
+ <NamespaceName start='34' length='4' global='false' current='false'>
+ <Identifier start='34' length='4' name='FooX'/>
+ </NamespaceName>
+ </Name>
+ </UseStatementPart>
+ </UseStatement>
+ <UseStatement start='42' length='32' statementType='2'>
+ <NamespaceName start='53' length='9' global='false' current='false'>
+ <Identifier start='53' length='4' name='Test'/>
+ <Identifier start='58' length='3' name='Boo'/>
+ </NamespaceName>
+ <UseStatementPart start='67' length='4'>
+ <Name>
+ <NamespaceName start='67' length='4' global='false' current='false'>
+ <Identifier start='67' length='4' name='FooX'/>
+ </NamespaceName>
+ </Name>
+ </UseStatementPart>
+ </UseStatement>
+ </Statements>
+ <Comments>
+ </Comments>
+</Program> \ No newline at end of file
diff --git a/tests/org.eclipse.php.core.tests/workspace/dom_parser/php7/groupUseStatement03B.pdtt b/tests/org.eclipse.php.core.tests/workspace/dom_parser/php7/groupUseStatement03B.pdtt
new file mode 100644
index 000000000..2527d42af
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/dom_parser/php7/groupUseStatement03B.pdtt
@@ -0,0 +1,41 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php use \foo\math\ { Math, const PI, function sin as TestSin };
+--EXPECT--
+<Program start='0' length='65'>
+ <Statements>
+ <UseStatement start='6' length='59'>
+ <NamespaceName start='11' length='9' global='false' current='false'>
+ <Identifier start='11' length='3' name='foo'/>
+ <Identifier start='15' length='4' name='math'/>
+ </NamespaceName>
+ <UseStatementPart start='23' length='4'>
+ <Name>
+ <NamespaceName start='23' length='4' global='false' current='false'>
+ <Identifier start='23' length='4' name='Math'/>
+ </NamespaceName>
+ </Name>
+ </UseStatementPart>
+ <UseStatementPart start='35' length='2' statementType='2'>
+ <Name>
+ <NamespaceName start='35' length='2' global='false' current='false'>
+ <Identifier start='35' length='2' name='PI'/>
+ </NamespaceName>
+ </Name>
+ </UseStatementPart>
+ <UseStatementPart start='48' length='14' statementType='1'>
+ <Name>
+ <NamespaceName start='48' length='3' global='false' current='false'>
+ <Identifier start='48' length='3' name='sin'/>
+ </NamespaceName>
+ </Name>
+ <Alias>
+ <Identifier start='55' length='7' name='TestSin'/>
+ </Alias>
+ </UseStatementPart>
+ </UseStatement>
+ </Statements>
+ <Comments>
+ </Comments>
+</Program> \ No newline at end of file
diff --git a/tests/org.eclipse.php.core.tests/workspace/dom_parser/php72/trailingComma01B.pdtt b/tests/org.eclipse.php.core.tests/workspace/dom_parser/php72/trailingComma01B.pdtt
new file mode 100644
index 000000000..717f29021
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/dom_parser/php72/trailingComma01B.pdtt
@@ -0,0 +1,214 @@
+--TEST--
+Test trailing commas
+--FILE--
+<?php
+// Grouped statements
+use \Foo\Bar\{ Foo, Bar, Baz, };
+// Mixed grouped statements
+use \Foo\Bar\{ function Foo, const Bar, Baz, };
+
+// Arrays (already possible)
+$array = [1, 2, 3,];
+
+// Function/method arguments (call)
+fooCall($arg1, $arg2, $arg3,);
+$obj->methodCall($arg1, $arg2, $arg3,);
+
+unset($a, $b, $c, );
+isset($a, $b, $c, );
+--EXPECT--
+<Program start='0' length='338'>
+ <Statements>
+ <UseStatement start='28' length='32'>
+ <NamespaceName start='33' length='8' global='false' current='false'>
+ <Identifier start='33' length='3' name='Foo'/>
+ <Identifier start='37' length='3' name='Bar'/>
+ </NamespaceName>
+ <UseStatementPart start='43' length='3'>
+ <Name>
+ <NamespaceName start='43' length='3' global='false' current='false'>
+ <Identifier start='43' length='3' name='Foo'/>
+ </NamespaceName>
+ </Name>
+ </UseStatementPart>
+ <UseStatementPart start='48' length='3'>
+ <Name>
+ <NamespaceName start='48' length='3' global='false' current='false'>
+ <Identifier start='48' length='3' name='Bar'/>
+ </NamespaceName>
+ </Name>
+ </UseStatementPart>
+ <UseStatementPart start='53' length='3'>
+ <Name>
+ <NamespaceName start='53' length='3' global='false' current='false'>
+ <Identifier start='53' length='3' name='Baz'/>
+ </NamespaceName>
+ </Name>
+ </UseStatementPart>
+ <EmptyExpression start='57' length='0'/>
+ </UseStatement>
+ <UseStatement start='89' length='47'>
+ <NamespaceName start='94' length='8' global='false' current='false'>
+ <Identifier start='94' length='3' name='Foo'/>
+ <Identifier start='98' length='3' name='Bar'/>
+ </NamespaceName>
+ <UseStatementPart start='113' length='3' statementType='1'>
+ <Name>
+ <NamespaceName start='113' length='3' global='false' current='false'>
+ <Identifier start='113' length='3' name='Foo'/>
+ </NamespaceName>
+ </Name>
+ </UseStatementPart>
+ <UseStatementPart start='124' length='3' statementType='2'>
+ <Name>
+ <NamespaceName start='124' length='3' global='false' current='false'>
+ <Identifier start='124' length='3' name='Bar'/>
+ </NamespaceName>
+ </Name>
+ </UseStatementPart>
+ <UseStatementPart start='129' length='3'>
+ <Name>
+ <NamespaceName start='129' length='3' global='false' current='false'>
+ <Identifier start='129' length='3' name='Baz'/>
+ </NamespaceName>
+ </Name>
+ </UseStatementPart>
+ <EmptyExpression start='133' length='0'/>
+ </UseStatement>
+ <ExpressionStatement start='167' length='20'>
+ <Assignment start='167' length='19' operator='='>
+ <Variable start='167' length='6' isDollared='true'>
+ <Identifier start='168' length='5' name='array'/>
+ </Variable>
+ <Value>
+ <ArrayCreation start='176' length='10'>
+ <ArrayElement start='177' length='1'>
+ <Key>
+ </Key>
+ <Value>
+ <Scalar start='177' length='1' type='int' value='1'/>
+ </Value>
+ </ArrayElement>
+ <ArrayElement start='180' length='1'>
+ <Key>
+ </Key>
+ <Value>
+ <Scalar start='180' length='1' type='int' value='2'/>
+ </Value>
+ </ArrayElement>
+ <ArrayElement start='183' length='1'>
+ <Key>
+ </Key>
+ <Value>
+ <Scalar start='183' length='1' type='int' value='3'/>
+ </Value>
+ </ArrayElement>
+ <ArrayElement start='185' length='0'>
+ <Key>
+ </Key>
+ <Value>
+ <EmptyExpression start='185' length='0'/>
+ </Value>
+ </ArrayElement>
+ </ArrayCreation>
+ </Value>
+ </Assignment>
+ </ExpressionStatement>
+ <ExpressionStatement start='225' length='30'>
+ <FunctionInvocation start='225' length='29'>
+ <FunctionName start='225' length='7'>
+ <NamespaceName start='225' length='7' global='false' current='false'>
+ <Identifier start='225' length='7' name='fooCall'/>
+ </NamespaceName>
+ </FunctionName>
+ <Parameters>
+ <Variable start='233' length='5' isDollared='true'>
+ <Identifier start='234' length='4' name='arg1'/>
+ </Variable>
+ <Variable start='240' length='5' isDollared='true'>
+ <Identifier start='241' length='4' name='arg2'/>
+ </Variable>
+ <Variable start='247' length='5' isDollared='true'>
+ <Identifier start='248' length='4' name='arg3'/>
+ </Variable>
+ <EmptyExpression start='253' length='0'/>
+ </Parameters>
+ </FunctionInvocation>
+ </ExpressionStatement>
+ <ExpressionStatement start='256' length='39'>
+ <MethodInvocation start='256' length='38'>
+ <Dispatcher>
+ <Variable start='256' length='4' isDollared='true'>
+ <Identifier start='257' length='3' name='obj'/>
+ </Variable>
+ </Dispatcher>
+ <Property>
+ <FunctionInvocation start='262' length='32'>
+ <FunctionName start='262' length='10'>
+ <Variable start='262' length='10' isDollared='false'>
+ <Identifier start='262' length='10' name='methodCall'/>
+ </Variable>
+ </FunctionName>
+ <Parameters>
+ <Variable start='273' length='5' isDollared='true'>
+ <Identifier start='274' length='4' name='arg1'/>
+ </Variable>
+ <Variable start='280' length='5' isDollared='true'>
+ <Identifier start='281' length='4' name='arg2'/>
+ </Variable>
+ <Variable start='287' length='5' isDollared='true'>
+ <Identifier start='288' length='4' name='arg3'/>
+ </Variable>
+ <EmptyExpression start='293' length='0'/>
+ </Parameters>
+ </FunctionInvocation>
+ </Property>
+ </MethodInvocation>
+ </ExpressionStatement>
+ <ExpressionStatement start='297' length='20'>
+ <FunctionInvocation start='297' length='19'>
+ <FunctionName start='297' length='5'>
+ <Identifier start='297' length='5' name='unset'/>
+ </FunctionName>
+ <Parameters>
+ <Variable start='303' length='2' isDollared='true'>
+ <Identifier start='304' length='1' name='a'/>
+ </Variable>
+ <Variable start='307' length='2' isDollared='true'>
+ <Identifier start='308' length='1' name='b'/>
+ </Variable>
+ <Variable start='311' length='2' isDollared='true'>
+ <Identifier start='312' length='1' name='c'/>
+ </Variable>
+ <EmptyExpression start='314' length='0'/>
+ </Parameters>
+ </FunctionInvocation>
+ </ExpressionStatement>
+ <ExpressionStatement start='318' length='20'>
+ <FunctionInvocation start='318' length='19'>
+ <FunctionName start='318' length='5'>
+ <Identifier start='318' length='5' name='isset'/>
+ </FunctionName>
+ <Parameters>
+ <Variable start='324' length='2' isDollared='true'>
+ <Identifier start='325' length='1' name='a'/>
+ </Variable>
+ <Variable start='328' length='2' isDollared='true'>
+ <Identifier start='329' length='1' name='b'/>
+ </Variable>
+ <Variable start='332' length='2' isDollared='true'>
+ <Identifier start='333' length='1' name='c'/>
+ </Variable>
+ <EmptyExpression start='335' length='0'/>
+ </Parameters>
+ </FunctionInvocation>
+ </ExpressionStatement>
+ </Statements>
+ <Comments>
+ <Comment start='6' length='22' commentType='singleLine'/>
+ <Comment start='61' length='28' commentType='singleLine'/>
+ <Comment start='138' length='29' commentType='singleLine'/>
+ <Comment start='189' length='36' commentType='singleLine'/>
+ </Comments>
+</Program>
+
diff --git a/tests/org.eclipse.php.core.tests/workspace/errors/php7/testTypeReferenceErrorB.pdtt b/tests/org.eclipse.php.core.tests/workspace/errors/php7/testTypeReferenceErrorB.pdtt
new file mode 100644
index 000000000..5f3a800b2
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/errors/php7/testTypeReferenceErrorB.pdtt
@@ -0,0 +1,13 @@
+--TEST--
+Bug 516485 - Constants are validated as types
+--FILE--
+<?php
+namespace name;
+
+use \Test\Boo\ {
+ Exception,
+ const Foo,
+ function FooX as MyAlias
+};
+--EXPECT--
+[line=5, start=41, end=50] The import Test\Boo\Exception cannot be resolved
diff --git a/tests/org.eclipse.php.core.tests/workspace/errors/php7/testUseStatementUsage01B.pdtt b/tests/org.eclipse.php.core.tests/workspace/errors/php7/testUseStatementUsage01B.pdtt
new file mode 100644
index 000000000..293b5b0fb
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/errors/php7/testUseStatementUsage01B.pdtt
@@ -0,0 +1,25 @@
+--TEST--
+Bug 519914 - Group Use declarations not recognized
+--FILE--
+<?php
+namespace grup3\model3\model4;
+
+class Foo3 {
+}
+
+class Foo4 {
+}
+
+namespace popo3;
+
+use \grup3\model3\ { \model4, \mode, \model2, \model4\Foo4 };
+use \grup3\model3\ { model4, mode, model2, model4\Foo4 };
+
+new model4\Foo3();
+--EXPECT--
+[line=12, start=119, end=123] The import grup3\model3\mode cannot be resolved
+[line=12, start=126, end=132] The import grup3\model3\model2 cannot be resolved
+[line=13, start=171, end=177] Cannot use grup3\model3\model4 as model4 because the name is already in use
+[line=13, start=179, end=183] The import grup3\model3\mode cannot be resolved
+[line=13, start=185, end=191] The import grup3\model3\model2 cannot be resolved
+[line=13, start=193, end=204] Cannot use grup3\model3\model4\Foo4 as Foo4 because the name is already in use
diff --git a/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement01B.pdtt b/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement01B.pdtt
new file mode 100644
index 000000000..4159fd545
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement01B.pdtt
@@ -0,0 +1,22 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+namespace Boo {
+ class MyClass {
+ public function test($param) {
+ echo $param;
+ }
+ }
+}
+
+namespace Foo {
+ use \Boo\ {
+ MyClass
+ };
+
+ $var = new MyClass();
+ $var->|test|(1);
+}
+--EXPECT--
+method(test)
diff --git a/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement02B.pdtt b/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement02B.pdtt
new file mode 100644
index 000000000..e543cd4c9
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement02B.pdtt
@@ -0,0 +1,18 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+namespace Boo {
+ function test(){
+ }
+}
+
+namespace Foo {
+ use function \Boo\ {
+ test
+ };
+
+ |test|();
+}
+--EXPECT--
+method(test)
diff --git a/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement03B.pdtt b/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement03B.pdtt
new file mode 100644
index 000000000..075acfa08
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement03B.pdtt
@@ -0,0 +1,17 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+namespace Boo {
+ const TEST = 1;
+}
+
+namespace Foo {
+ use \Boo\ {
+ const TEST
+ };
+
+ echo |TEST|;
+}
+--EXPECT--
+field(TEST)
diff --git a/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement04B.pdtt b/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement04B.pdtt
new file mode 100644
index 000000000..d3c6c8e1a
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement04B.pdtt
@@ -0,0 +1,32 @@
+--TEST--
+Bug 519914 - Group Use declarations not recognized
+--FILE--
+<?php
+namespace Foo\Bar\X1
+{
+
+ class MyClass
+ {
+ }
+
+ function myFunction()
+ {
+ }
+
+ const MyConst = 10;
+}
+namespace Foo\Bar\X2
+{
+
+ use function \Foo\Bar\X1\ {
+ |myFunction| as myAlias1
+ };
+ use const \Foo\Bar\X1\ {
+ MyConst as myAlias2
+ };
+ use \Foo\Bar\X1\ {
+ MyClass as myAlias3
+ };
+}
+--EXPECT--
+method(myFunction)
diff --git a/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement05B.pdtt b/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement05B.pdtt
new file mode 100644
index 000000000..7e17319c4
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement05B.pdtt
@@ -0,0 +1,32 @@
+--TEST--
+Bug 519914 - Group Use declarations not recognized
+--FILE--
+<?php
+namespace Foo\Bar\X1
+{
+
+ class MyClass
+ {
+ }
+
+ function myFunction()
+ {
+ }
+
+ const MyConst = 10;
+}
+namespace Foo\Bar\X2
+{
+
+ use function \Foo\Bar\X1\ {
+ myFunction as myAlias1
+ };
+ use const \Foo\Bar\X1\ {
+ |MyConst| as myAlias2
+ };
+ use \Foo\Bar\X1\ {
+ MyClass as myAlias3
+ };
+}
+--EXPECT--
+field(MyConst)
diff --git a/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement06B.pdtt b/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement06B.pdtt
new file mode 100644
index 000000000..9c51ef111
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/selection/php7/groupUseStatement06B.pdtt
@@ -0,0 +1,32 @@
+--TEST--
+Bug 519914 - Group Use declarations not recognized
+--FILE--
+<?php
+namespace Foo\Bar\X1
+{
+
+ class MyClass
+ {
+ }
+
+ function myFunction()
+ {
+ }
+
+ const MyConst = 10;
+}
+namespace Foo\Bar\X2
+{
+
+ use function \Foo\Bar\X1\ {
+ myFunction as myAlias1
+ };
+ use const \Foo\Bar\X1\ {
+ MyConst as myAlias2
+ };
+ use \Foo\Bar\X1\ {
+ |MyClass| as myAlias3
+ };
+}
+--EXPECT--
+type(MyClass)
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php7/default_formatter_configuration/groupUseStatement01B.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php7/default_formatter_configuration/groupUseStatement01B.pdtt
new file mode 100644
index 000000000..2bc7e989f
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php7/default_formatter_configuration/groupUseStatement01B.pdtt
@@ -0,0 +1,33 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+
+use \foo\math\ { \Math, const PI, function sin as TestSin };
+
+use \Test\Boo\ {
+ Foo,FooX as MyAlias
+ };
+
+use function \Test\Boo\ {
+ FooX};
+use const \Test\Boo\ {FooX};
+--EXPECT--
+<?php
+use foo\math\ {
+ Math,
+ const PI,
+ function sin as TestSin
+};
+
+use Test\Boo\ {
+ Foo,
+ FooX as MyAlias
+};
+
+use function Test\Boo\ {
+ FooX
+};
+use const Test\Boo\ {
+ FooX
+}; \ No newline at end of file
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php7/psr2/groupUseStatement01B.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php7/psr2/groupUseStatement01B.pdtt
new file mode 100644
index 000000000..c876524da
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php7/psr2/groupUseStatement01B.pdtt
@@ -0,0 +1,33 @@
+--TEST--
+Test group use statement
+--FILE--
+<?php
+
+use \foo\math\ { \Math, const PI, function sin as TestSin };
+
+use \Test\Boo\ {
+ Foo,FooX as MyAlias
+ };
+
+use function \Test\Boo\ {
+ FooX};
+use const \Test\Boo\ {FooX};
+--EXPECT--
+<?php
+use foo\math\ {
+ Math,
+ const PI,
+ function sin as TestSin
+};
+
+use Test\Boo\ {
+ Foo,
+ FooX as MyAlias
+};
+
+use function Test\Boo\ {
+ FooX
+};
+use const Test\Boo\ {
+ FooX
+}; \ No newline at end of file
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_1/commentFormatter1B.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_1/commentFormatter1B.pdtt
new file mode 100644
index 000000000..70be0fc10
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_1/commentFormatter1B.pdtt
@@ -0,0 +1,75 @@
+--TEST--
+Test formatting for comments
+Bug 367584 - Possible NPE in PHPDocTag
+Bug 521884 - Code Formatter: comma after final array element for multi-line array definition
+--FILE--
+<?php
+use \MyProject\Sub\Level\ { function MyAlias, const MyNamespace as OtherAlias, MyOtherNamespace, };
+use function \MyProject\Sub\Level\ { MyAlias, MyNamespace as OtherAlias, MyOtherNamespace, };
+$e = array (
+ array('level'=>'INFO'),
+ // TODO comment
+ array('level'=>'INFO'),
+);
+$e = foo (
+ array('level'=>'INFO'),
+ // TODO comment
+ array('level'=>'INFO'),
+);
+$e = $obj->foo (
+ array('level'=>'INFO'),
+ // TODO comment
+ array('level'=>'INFO'),
+);
+/**
+ * @param
+ */
+function foo (int $a, int $b){
+}
+/**
+ * Object allocation arguments
+ */
+class Example {
+ function foo() {
+ return new Example ( 100, 200, 300, 400, 500, 600, 700, 800, 900, );
+ }
+}
+?>
+--EXPECT--
+<?php
+use MyProject\Sub\Level\ {
+ function MyAlias,
+ const MyNamespace as OtherAlias,
+ MyOtherNamespace,
+};
+use function MyProject\Sub\Level\ {
+ MyAlias,
+ MyNamespace as OtherAlias,
+ MyOtherNamespace,
+};
+$e = array(array('level' => 'INFO'),
+// TODO comment
+array('level' => 'INFO'),);
+$e = foo(array('level' => 'INFO'),
+// TODO comment
+array('level' => 'INFO'),);
+$e = $obj->foo(array('level' => 'INFO'),
+// TODO comment
+array('level' => 'INFO'),);
+/**
+ *
+ * @param
+ */
+function foo (int $a, int $b)
+{}
+/**
+ * Object allocation arguments
+ */
+class Example
+{
+ function foo ()
+ {
+ return new Example(100, 200, 300, 400, 500, 600, 700, 800, 900,);
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_2/arrayAccessB.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_2/arrayAccessB.pdtt
new file mode 100644
index 000000000..419fcd3d5
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_2/arrayAccessB.pdtt
@@ -0,0 +1,49 @@
+--TEST--
+Test formatting for ArrayAccess
+Bug 521884 - Code Formatter: comma after final array element for multi-line array definition
+--FILE--
+<?php
+use \MyProject\Sub\Level\ { function MyAlias, const MyNamespace as OtherAlias, MyOtherNamespace, };
+use function \MyProject\Sub\Level\ { MyAlias, MyNamespace as OtherAlias, MyOtherNamespace, };
+$a = array (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+$a = foo (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+$a = $obj->foo (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+ echo $a[1] ;
+echo $a [ $a [ 1]];
+echo $a [ 'aaa'];
+/**
+ * Object allocation arguments
+ */
+class Example {
+ function foo() {
+ return new Example ( 100, 200, 300, 400, 500, 600, 700, 800, 900, );
+ }
+}
+?>
+--EXPECT--
+<?php
+use MyProject\Sub\Level\ {
+ function MyAlias,
+ const MyNamespace as OtherAlias,
+ MyOtherNamespace,
+};
+use function MyProject\Sub\Level\ {
+ MyAlias,
+ MyNamespace as OtherAlias,
+ MyOtherNamespace,
+};
+$a = array (1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, );
+$a = foo ( 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, );
+$a = $obj->foo ( 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, );
+echo $a [1];
+echo $a [$a [1]];
+echo $a ['aaa'];
+/**
+ * Object allocation arguments
+ */
+class Example {
+ function foo() {
+ return new Example ( 100, 200, 300, 400, 500, 600, 700, 800, 900, );
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_3/arrayAccessB.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_3/arrayAccessB.pdtt
new file mode 100644
index 000000000..8103371af
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_3/arrayAccessB.pdtt
@@ -0,0 +1,62 @@
+--TEST--
+Test formatting for ArrayAccess
+Bug 521884 - Code Formatter: comma after final array element for multi-line array definition
+--FILE--
+<?php
+use \MyProject\Sub\Level\ { function MyAlias, const MyNamespace as OtherAlias, MyOtherNamespace, };
+use function \MyProject\Sub\Level\ { MyAlias, MyNamespace as OtherAlias, MyOtherNamespace, };
+$a = array (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+$a = foo (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+$a = $obj->foo (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+ echo $a[1] ;
+echo $a [ $a [ 1]];
+echo $a [ 'aaa'];
+/**
+ * Object allocation arguments
+ */
+class Example {
+ function foo() {
+ return new Example ( 100, 200, 300, 400, 500, 600, 700, 800, 900, );
+ }
+}
+?>
+--EXPECT--
+<?php
+use MyProject\Sub\Level\ {
+ function MyAlias,
+ const MyNamespace as OtherAlias,
+ MyOtherNamespace,
+};
+use function MyProject\Sub\Level\ {
+ MyAlias,
+ MyNamespace as OtherAlias,
+ MyOtherNamespace,
+};
+$a = array (1, 2, 3,
+ 5, 6, 7, 8,
+ 9, 10, 1, 2,
+ 3, 5, 6, 7,
+ 8, 9, 10, 1,
+ 2, 3, 5, 6,
+ 7, 8, 9, 10,
+ 1, 2, 3, 5,
+ 6, 7, 8, 9,
+ 10, 1, 2, 3,
+ 5, 6, 7, 8,
+ 9, 10, 1, 2,
+ 3, 5, 6, 7,
+ 8, 9, 10, );
+$a = foo ( 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, );
+$a = $obj->foo ( 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, );
+echo $a [1];
+echo $a [$a [1]];
+echo $a ['aaa'];
+/**
+ * Object allocation arguments
+ */
+class Example {
+ function foo() {
+ return new Example ( 100, 200, 300, 400, 500, 600, 700, 800, 900, );
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_4/arrayAccessB.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_4/arrayAccessB.pdtt
new file mode 100644
index 000000000..122ffae72
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_4/arrayAccessB.pdtt
@@ -0,0 +1,57 @@
+--TEST--
+Test formatting for ArrayAccess
+Bug 521884 - Code Formatter: comma after final array element for multi-line array definition
+--FILE--
+<?php
+use \MyProject\Sub\Level\ { function MyAlias, const MyNamespace as OtherAlias, MyOtherNamespace, };
+use function \MyProject\Sub\Level\ { MyAlias, MyNamespace as OtherAlias, MyOtherNamespace, };
+$a = array (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+$a = foo (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+$a = $obj->foo (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+ echo $a[1] ;
+echo $a [ $a [ 1]];
+echo $a [ 'aaa'];
+/**
+ * Object allocation arguments
+ */
+class Example {
+ function foo() {
+ return new Example ( 100, 200, 300, 400, 500, 600, 700, 800, 900, );
+ }
+}
+?>
+--EXPECT--
+<?php
+use MyProject\Sub\Level\ {
+ function MyAlias,
+ const MyNamespace as OtherAlias,
+ MyOtherNamespace,
+};
+use function MyProject\Sub\Level\ {
+ MyAlias,
+ MyNamespace as OtherAlias,
+ MyOtherNamespace,
+};
+$a = array(1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6,
+7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5,
+6, 7, 8, 9, 10,);
+$a = foo(1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6,
+7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5,
+6, 7, 8, 9, 10,);
+$a = $obj->foo(1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3,
+5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2,
+3, 5, 6, 7, 8, 9, 10,);
+echo $a[1];
+echo $a[$a[1]];
+echo $a['aaa'];
+/**
+ * Object allocation arguments
+ */
+class Example
+{
+ function foo ()
+ {
+ return new Example(100, 200, 300, 400, 500, 600, 700, 800, 900,);
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_5/commentFormatter1B.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_5/commentFormatter1B.pdtt
new file mode 100644
index 000000000..454acec4c
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_5/commentFormatter1B.pdtt
@@ -0,0 +1,75 @@
+--TEST--
+Test formatting for comments
+Bug 367584 - Possible NPE in PHPDocTag
+Bug 521884 - Code Formatter: comma after final array element for multi-line array definition
+--FILE--
+<?php
+use \MyProject\Sub\Level\ { function MyAlias, const MyNamespace as OtherAlias, MyOtherNamespace, };
+use function \MyProject\Sub\Level\ { MyAlias, MyNamespace as OtherAlias, MyOtherNamespace, };
+$e = array (
+ array('level'=>'INFO'),
+ // TODO comment
+ array('level'=>'INFO'),
+);
+$e = foo (
+ array('level'=>'INFO'),
+ // TODO comment
+ array('level'=>'INFO'),
+);
+$e = $obj->foo (
+ array('level'=>'INFO'),
+ // TODO comment
+ array('level'=>'INFO'),
+);
+/**
+ * @param
+ */
+function foo (int $a, int $b){
+}
+/**
+ * Object allocation arguments
+ */
+class Example {
+ function foo() {
+ return new Example ( 100, 200, 300, 400, 500, 600, 700, 800, 900, );
+ }
+}
+?>
+--EXPECT--
+<?php
+use MyProject\Sub\Level\ {
+ function MyAlias,
+ const MyNamespace as OtherAlias,
+ MyOtherNamespace
+};
+use function MyProject\Sub\Level\ {
+ MyAlias,
+ MyNamespace as OtherAlias,
+ MyOtherNamespace
+};
+$e = array(array('level' => 'INFO'),
+// TODO comment
+array('level' => 'INFO'));
+$e = foo(array('level' => 'INFO'),
+// TODO comment
+array('level' => 'INFO'));
+$e = $obj->foo(array('level' => 'INFO'),
+// TODO comment
+array('level' => 'INFO'));
+/**
+ *
+ * @param
+ */
+function foo (int $a, int $b)
+{}
+/**
+ * Object allocation arguments
+ */
+class Example
+{
+ function foo ()
+ {
+ return new Example(100, 200, 300, 400, 500, 600, 700, 800, 900);
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_6/arrayAccessB.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_6/arrayAccessB.pdtt
new file mode 100644
index 000000000..a64e2334c
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_6/arrayAccessB.pdtt
@@ -0,0 +1,49 @@
+--TEST--
+Test formatting for ArrayAccess
+Bug 521884 - Code Formatter: comma after final array element for multi-line array definition
+--FILE--
+<?php
+use \MyProject\Sub\Level\ { function MyAlias, const MyNamespace as OtherAlias, MyOtherNamespace, };
+use function \MyProject\Sub\Level\ { MyAlias, MyNamespace as OtherAlias, MyOtherNamespace, };
+$a = array (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+$a = foo (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+$a = $obj->foo (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+ echo $a[1] ;
+echo $a [ $a [ 1]];
+echo $a [ 'aaa'];
+/**
+ * Object allocation arguments
+ */
+class Example {
+ function foo() {
+ return new Example ( 100, 200, 300, 400, 500, 600, 700, 800, 900, );
+ }
+}
+?>
+--EXPECT--
+<?php
+use MyProject\Sub\Level\ {
+ function MyAlias,
+ const MyNamespace as OtherAlias,
+ MyOtherNamespace
+};
+use function MyProject\Sub\Level\ {
+ MyAlias,
+ MyNamespace as OtherAlias,
+ MyOtherNamespace
+};
+$a = array (1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10 );
+$a = foo ( 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10 );
+$a = $obj->foo ( 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10 );
+echo $a [1];
+echo $a [$a [1]];
+echo $a ['aaa'];
+/**
+ * Object allocation arguments
+ */
+class Example {
+ function foo() {
+ return new Example ( 100, 200, 300, 400, 500, 600, 700, 800, 900 );
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_7/arrayAccessB.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_7/arrayAccessB.pdtt
new file mode 100644
index 000000000..e58251824
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_7/arrayAccessB.pdtt
@@ -0,0 +1,62 @@
+--TEST--
+Test formatting for ArrayAccess
+Bug 521884 - Code Formatter: comma after final array element for multi-line array definition
+--FILE--
+<?php
+use \MyProject\Sub\Level\ { function MyAlias, const MyNamespace as OtherAlias, MyOtherNamespace, };
+use function \MyProject\Sub\Level\ { MyAlias, MyNamespace as OtherAlias, MyOtherNamespace, };
+$a = array (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+$a = foo (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+$a = $obj->foo (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+ echo $a[1] ;
+echo $a [ $a [ 1]];
+echo $a [ 'aaa'];
+/**
+ * Object allocation arguments
+ */
+class Example {
+ function foo() {
+ return new Example ( 100, 200, 300, 400, 500, 600, 700, 800, 900, );
+ }
+}
+?>
+--EXPECT--
+<?php
+use MyProject\Sub\Level\ {
+ function MyAlias,
+ const MyNamespace as OtherAlias,
+ MyOtherNamespace
+};
+use function MyProject\Sub\Level\ {
+ MyAlias,
+ MyNamespace as OtherAlias,
+ MyOtherNamespace
+};
+$a = array (1, 2, 3,
+ 5, 6, 7, 8,
+ 9, 10, 1, 2,
+ 3, 5, 6, 7,
+ 8, 9, 10, 1,
+ 2, 3, 5, 6,
+ 7, 8, 9, 10,
+ 1, 2, 3, 5,
+ 6, 7, 8, 9,
+ 10, 1, 2, 3,
+ 5, 6, 7, 8,
+ 9, 10, 1, 2,
+ 3, 5, 6, 7,
+ 8, 9, 10 );
+$a = foo ( 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10 );
+$a = $obj->foo ( 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10 );
+echo $a [1];
+echo $a [$a [1]];
+echo $a ['aaa'];
+/**
+ * Object allocation arguments
+ */
+class Example {
+ function foo() {
+ return new Example ( 100, 200, 300, 400, 500, 600, 700, 800, 900 );
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_8/arrayAccessB.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_8/arrayAccessB.pdtt
new file mode 100644
index 000000000..c90e2264b
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php72/comments_formatter_8/arrayAccessB.pdtt
@@ -0,0 +1,57 @@
+--TEST--
+Test formatting for ArrayAccess
+Bug 521884 - Code Formatter: comma after final array element for multi-line array definition
+--FILE--
+<?php
+use \MyProject\Sub\Level\ { function MyAlias, const MyNamespace as OtherAlias, MyOtherNamespace, };
+use function \MyProject\Sub\Level\ { MyAlias, MyNamespace as OtherAlias, MyOtherNamespace, };
+$a = array (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+$a = foo (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+$a = $obj->foo (1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,1,2,3,5,6,7,8,9,10,);
+ echo $a[1] ;
+echo $a [ $a [ 1]];
+echo $a [ 'aaa'];
+/**
+ * Object allocation arguments
+ */
+class Example {
+ function foo() {
+ return new Example ( 100, 200, 300, 400, 500, 600, 700, 800, 900, );
+ }
+}
+?>
+--EXPECT--
+<?php
+use MyProject\Sub\Level\ {
+ function MyAlias,
+ const MyNamespace as OtherAlias,
+ MyOtherNamespace
+};
+use function MyProject\Sub\Level\ {
+ MyAlias,
+ MyNamespace as OtherAlias,
+ MyOtherNamespace
+};
+$a = array(1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6,
+7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5,
+6, 7, 8, 9, 10);
+$a = foo(1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6,
+7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5,
+6, 7, 8, 9, 10);
+$a = $obj->foo(1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3,
+5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2, 3, 5, 6, 7, 8, 9, 10, 1, 2,
+3, 5, 6, 7, 8, 9, 10);
+echo $a[1];
+echo $a[$a[1]];
+echo $a['aaa'];
+/**
+ * Object allocation arguments
+ */
+class Example
+{
+ function foo ()
+ {
+ return new Example(100, 200, 300, 400, 500, 600, 700, 800, 900);
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/org.eclipse.php.ui.tests/workspace/codeassist/php7/groupUseStatement01B.pdtt b/tests/org.eclipse.php.ui.tests/workspace/codeassist/php7/groupUseStatement01B.pdtt
new file mode 100644
index 000000000..e31c3ec5e
--- /dev/null
+++ b/tests/org.eclipse.php.ui.tests/workspace/codeassist/php7/groupUseStatement01B.pdtt
@@ -0,0 +1,18 @@
+--TEST--
+Test group use statements
+--PREFERENCES--
+org.eclipse.php.core/contentAssistInsertCompletion=true
+--FILE--
+<?php
+
+use \Foo\ { B| };
+
+--FILE0--
+<?php
+
+namespace Foo\Boo;
+
+--EXPECT--
+<?php
+
+use \Foo\ { Boo\ }; \ No newline at end of file
diff --git a/tests/org.eclipse.php.ui.tests/workspace/codeassist/php7/groupUseStatement02B.pdtt b/tests/org.eclipse.php.ui.tests/workspace/codeassist/php7/groupUseStatement02B.pdtt
new file mode 100644
index 000000000..5173c1360
--- /dev/null
+++ b/tests/org.eclipse.php.ui.tests/workspace/codeassist/php7/groupUseStatement02B.pdtt
@@ -0,0 +1,22 @@
+--TEST--
+Test group use statements
+--PREFERENCES--
+org.eclipse.php.core/contentAssistInsertCompletion=true
+--FILE--
+<?php
+
+use \Foo\ { Boo\T| };
+
+--FILE0--
+<?php
+
+namespace Foo\Boo;
+
+class Test {
+
+}
+
+--EXPECT--
+<?php
+
+use \Foo\ { Boo\Test }; \ No newline at end of file
diff --git a/tests/org.eclipse.php.ui.tests/workspace/codeassist/php7/groupUseStatement03_overwriteB.pdtt b/tests/org.eclipse.php.ui.tests/workspace/codeassist/php7/groupUseStatement03_overwriteB.pdtt
new file mode 100644
index 000000000..b04b1e5cc
--- /dev/null
+++ b/tests/org.eclipse.php.ui.tests/workspace/codeassist/php7/groupUseStatement03_overwriteB.pdtt
@@ -0,0 +1,16 @@
+--TEST--
+Test group use statements
+--PREFERENCES--
+org.eclipse.php.core/contentAssistInsertCompletion=false
+--FILE--
+<?php
+namespace T\U;
+class ABC{}
+
+use \T\U\{ A| };
+--EXPECT--
+<?php
+namespace T\U;
+class ABC{}
+
+use \T\U\{ ABC }; \ No newline at end of file

Back to the top