Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry BLIND2019-11-10 15:28:37 -0500
committerThierry BLIND2019-11-10 15:54:05 -0500
commitb6c62d25e7be00adffba659dc54b558bc3c101e6 (patch)
tree1ac02aff801f948b90d73161396f46f240d76512
parent9f8b9aea5af6f3d91b24a65066617d5a1242ba81 (diff)
downloadorg.eclipse.pdt-b6c62d25e7be00adffba659dc54b558bc3c101e6.tar.gz
org.eclipse.pdt-b6c62d25e7be00adffba659dc54b558bc3c101e6.tar.xz
org.eclipse.pdt-b6c62d25e7be00adffba659dc54b558bc3c101e6.zip
Bug 552887 - add formatting option for referenced expressions
Change-Id: Idb218698c71ec83bc9de081db4e04363cab8300d Signed-off-by: Thierry BLIND <thierryblind@msn.com>
-rw-r--r--plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterConstants.java16
-rw-r--r--plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterVisitor.java4
-rw-r--r--plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/profiles/CodeFormatterPreferences.java11
-rw-r--r--plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/profiles/PHPDefaultFormatterPreferences.java4
-rw-r--r--plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/FormatterMessages.java8
-rw-r--r--plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/FormatterMessages.properties6
-rw-r--r--plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/preferences/WhiteSpaceOptions.java36
-rw-r--r--plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/preferences/WhiteSpaceTabPage.java9
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_20/commentFormatter1.pdtt47
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_20/comments_formatter_20.xml211
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_20/reference.pdtt30
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_9/commentFormatter4.pdtt2
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/default_formatter_configuration/reference.pdtt8
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/max_line_wrap_length_20/reference.pdtt4
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/new_default_formatter_configuration/reference.pdtt8
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/zend_framework_default_configuration/reference.pdtt8
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php54/comments_formatter_1/commentFormatter13.pdtt2
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php54/comments_formatter_1/commentFormatter17.pdtt2
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/default_formatter_configuration/commaList.pdtt2
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked3/commaList01.pdtt2
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked4/commaList01.pdtt2
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked5/commaList01.pdtt2
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked7/commaList01.pdtt2
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked8/commaList05.pdtt2
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php74/default_formatter_configuration/arrowFunctions.pdtt4
-rw-r--r--tests/org.eclipse.php.formatter.core.tests/workspace/formatter_indent_empty_lines/php5/comments_formatter_9/commentFormatter4.pdtt3
26 files changed, 395 insertions, 40 deletions
diff --git a/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterConstants.java b/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterConstants.java
index 3ce429774..a60ef2e11 100644
--- a/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterConstants.java
+++ b/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2018 Zend Techologies Ltd.
+ * Copyright (c) 2013-2019 Zend Techologies Ltd.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
@@ -915,6 +915,20 @@ public class CodeFormatterConstants {
+ ".formatter.insert_space_after_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
/**
* <pre>
+ * FORMATTER / Option to insert a space after the reference symbol in a referenced expression
+ * - option id: &quot;org.eclipse.php.formatter.core.insert_space_after_reference_symbol_in_referenced_expression&quot;
+ * - possible values: { INSERT, DO_NOT_INSERT }
+ * - default: DO_NOT_INSERT
+ * </pre>
+ *
+ * @see JavaCore#INSERT
+ * @see JavaCore#DO_NOT_INSERT
+ * @since 3.0
+ */
+ public static final String FORMATTER_INSERT_SPACE_AFTER_REFERENCE_SYMBOL_IN_REFERENCED_EXPRESSION = FormatterCorePlugin.PLUGIN_ID
+ + ".formatter.insert_space_after_reference_symbol_in_referenced_expression"; //$NON-NLS-1$
+ /**
+ * <pre>
* FORMATTER / Option to insert a space after the opening parenthesis in a switch statement
* - option id: &quot;org.eclipse.php.formatter.core.insert_space_after_opening_paren_in_switch&quot;
* - possible values: { INSERT, DO_NOT_INSERT }
diff --git a/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterVisitor.java b/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterVisitor.java
index 15badd63a..aeb51daa3 100644
--- a/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterVisitor.java
+++ b/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterVisitor.java
@@ -5011,6 +5011,10 @@ public class CodeFormatterVisitor extends AbstractVisitor implements ICodeFormat
@Override
public boolean visit(Reference reference) {
addNonBlanksToLineWidth(1);// &$a
+ if (this.preferences.insert_space_after_reference_symbol_in_referenced_expression) {
+ insertSpace();
+ }
+ handleChars(reference.getStart() + 1, reference.getExpression().getStart());
reference.getExpression().accept(this);
return false;
}
diff --git a/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/profiles/CodeFormatterPreferences.java b/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/profiles/CodeFormatterPreferences.java
index 129532776..28ee1f06c 100644
--- a/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/profiles/CodeFormatterPreferences.java
+++ b/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/profiles/CodeFormatterPreferences.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Zend Techologies Ltd.
+ * Copyright (c) 2013-2019 Zend Techologies Ltd.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
@@ -183,6 +183,8 @@ public class CodeFormatterPreferences {
public boolean insert_space_after_open_paren_in_parenthesis_expression;
public boolean insert_space_before_close_paren_in_parenthesis_expression;
+ public boolean insert_space_after_reference_symbol_in_referenced_expression;
+
public boolean insert_space_before_arrow_in_yield;
public boolean insert_space_after_arrow_in_yield;
@@ -673,6 +675,10 @@ public class CodeFormatterPreferences {
CodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION,
insert_space_before_close_paren_in_parenthesis_expression);
+ insert_space_after_reference_symbol_in_referenced_expression = getBooleanValue(preferences,
+ CodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_REFERENCE_SYMBOL_IN_REFERENCED_EXPRESSION,
+ insert_space_after_reference_symbol_in_referenced_expression);
+
blank_line_preserve_empty_lines = getIntValue(preferences,
CodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, blank_line_preserve_empty_lines);
blank_line_before_class_declaration = getIntValue(preferences,
@@ -1341,6 +1347,9 @@ public class CodeFormatterPreferences {
options.put(CodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION,
insert_space_before_close_paren_in_parenthesis_expression ? TRUE : FALSE);
+ options.put(CodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_REFERENCE_SYMBOL_IN_REFERENCED_EXPRESSION,
+ insert_space_after_reference_symbol_in_referenced_expression ? TRUE : FALSE);
+
options.put(CodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE,
String.valueOf(blank_line_preserve_empty_lines));
options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS,
diff --git a/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/profiles/PHPDefaultFormatterPreferences.java b/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/profiles/PHPDefaultFormatterPreferences.java
index 4a91afae1..89057e05b 100644
--- a/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/profiles/PHPDefaultFormatterPreferences.java
+++ b/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/profiles/PHPDefaultFormatterPreferences.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2018 Zend Techologies Ltd.
+ * Copyright (c) 2013-2019 Zend Techologies Ltd.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
@@ -174,6 +174,8 @@ public final class PHPDefaultFormatterPreferences implements ICodeFormatterPrefe
preferences.insert_space_after_open_paren_in_parenthesis_expression = false;
preferences.insert_space_before_close_paren_in_parenthesis_expression = false;
+ preferences.insert_space_after_reference_symbol_in_referenced_expression = false;
+
preferences.blank_line_preserve_empty_lines = 1;
preferences.blank_line_before_class_declaration = 0;
preferences.blank_line_before_constant_declaration = 0;
diff --git a/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/FormatterMessages.java b/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/FormatterMessages.java
index 000c59cf3..174bd761b 100644
--- a/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/FormatterMessages.java
+++ b/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/FormatterMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013-2018 Zend Techologies Ltd.
+ * Copyright (c) 2013-2019 Zend Techologies Ltd.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
@@ -93,7 +93,7 @@ final public class FormatterMessages extends NLS {
public static String WhiteSpaceTabPage_type_parameters;
public static String WhiteSpaceTabPage_conditionals;
public static String WhiteSpaceTabPage_typecasts;
- public static String WhiteSpaceTabPage_parenexpr;
+ public static String WhiteSpaceTabPage_paren_expr;
public static String WhiteSpaceTabPage_declarations;
public static String WhiteSpaceTabPage_expressions;
public static String WhiteSpaceTabPage_arrays;
@@ -135,6 +135,8 @@ final public class FormatterMessages extends NLS {
public static String WhiteSpaceTabPage_before_and_list;
public static String WhiteSpaceTabPage_after_and_list;
public static String WhiteSpaceTabPage_before_parenthesized_expressions;
+ public static String WhiteSpaceTabPage_ref_expr;
+ public static String WhiteSpaceTabPage_after_reference_symbol;
public static String WhiteSpaceTabPage_insert_space;
public static String WhiteSpaceOptions_return;
public static String WhiteSpaceOptions_before;
@@ -161,6 +163,7 @@ final public class FormatterMessages extends NLS {
public static String WhiteSpaceOptions_method;
public static String WhiteSpaceOptions_method_call;
public static String WhiteSpaceOptions_paren_expr;
+ public static String WhiteSpaceOptions_ref_expr;
public static String WhiteSpaceOptions_type_cast;
public static String WhiteSpaceOptions_parameterized_type;
public static String WhiteSpaceOptions_type_arguments;
@@ -449,6 +452,7 @@ final public class FormatterMessages extends NLS {
public static String WhiteSpaceOptions_after_arrow;
public static String WhiteSpaceOptions_before_coloncolon;
public static String WhiteSpaceOptions_after_coloncolon;
+ public static String WhiteSpaceOptions_after_reference_symbol;
public static String WhiteSpaceOptions_field_access;
public static String WhiteSpaceOptions_array;
diff --git a/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/FormatterMessages.properties b/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/FormatterMessages.properties
index 12ae6d4cd..290f451da 100644
--- a/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/FormatterMessages.properties
+++ b/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/FormatterMessages.properties
@@ -120,7 +120,7 @@ WhiteSpaceTabPage_conditionals=Conditionals
WhiteSpaceTabPage_typecasts=Type casts
-WhiteSpaceTabPage_parenexpr=Parenthesized expressions
+WhiteSpaceTabPage_paren_expr=Parenthesized expressions
WhiteSpaceTabPage_declarations=Declarations
WhiteSpaceTabPage_expressions=Expressions
WhiteSpaceTabPage_arrays=Arrays
@@ -132,6 +132,8 @@ WhiteSpaceTabPage_before_opening_brace=before opening brace
WhiteSpaceTabPage_before_closing_brace=before closing brace
WhiteSpaceTabPage_between_empty_braces=between empty braces
+WhiteSpaceTabPage_ref_expr=Referenced expressions
+WhiteSpaceTabPage_after_reference_symbol=after reference symbol
WhiteSpaceTabPage_after_opening_paren=after opening parenthesis
WhiteSpaceTabPage_after_closing_paren=after closing parenthesis
@@ -203,6 +205,7 @@ WhiteSpaceOptions_constructor=Constructor
WhiteSpaceOptions_method=Method
WhiteSpaceOptions_method_call=Method Invocation
WhiteSpaceOptions_paren_expr=Parenthesized expression
+WhiteSpaceOptions_ref_expr=Referenced expression
WhiteSpaceOptions_field_access=Field access
WhiteSpaceOptions_array=Array
@@ -296,6 +299,7 @@ WhiteSpaceOptions_before_arrow=Before arrow
WhiteSpaceOptions_after_arrow=After arrow
WhiteSpaceOptions_before_coloncolon=Before double colon
WhiteSpaceOptions_after_coloncolon=After double colon
+WhiteSpaceOptions_after_reference_symbol=After reference symbol
WhiteSpaceOptions_before_and=Before & list
WhiteSpaceOptions_after_and=After & list
diff --git a/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/preferences/WhiteSpaceOptions.java b/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/preferences/WhiteSpaceOptions.java
index 3f7c63c56..385fa8dac 100644
--- a/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/preferences/WhiteSpaceOptions.java
+++ b/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/preferences/WhiteSpaceOptions.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Zend Techologies Ltd.
+ * Copyright (c) 2013-2019 Zend Techologies Ltd.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
@@ -201,12 +201,15 @@ public final class WhiteSpaceOptions {
private final static String PARENTHESIS_EXPRESSION_PREVIEW = "(($a));"; //$NON-NLS-1$
+ private final static String REFERENCED_EXPRESSION_PREVIEW = "$b = &$a;"; //$NON-NLS-1$
+
private final static String MULT_FIELD_PREVIEW = "class MyClass {public $a=0,$b=1,$c=2,$d=3; const MY_TRUE=1,MY_FALSE=2;}"; //$NON-NLS-1$
private final static String BLOCK_PREVIEW = "if (true) { return 1; } else if(true) {return 3; }else { return 2; }"; //$NON-NLS-1$
/**
- * Create the tree, in this order: syntax element - position - abstract element
+ * Create the tree, in this order: syntax element - position - abstract
+ * element
*
* @param workingValues
* @return returns roots (type <code>Node</code>)
@@ -311,11 +314,16 @@ public final class WhiteSpaceOptions {
createAfterColoncolonTree(workingValues, element);
roots.add(element);
+ element = new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_after_reference_symbol);
+ createAfterReferenceSymbolTree(workingValues, element);
+ roots.add(element);
+
return roots;
}
/**
- * Create the tree, in this order: position - syntax element - abstract element
+ * Create the tree, in this order: position - syntax element - abstract
+ * element
*
* @param workingValues
* @return returns roots (type <code>Node</code>)
@@ -400,6 +408,10 @@ public final class WhiteSpaceOptions {
parent = createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_coloncolon);
createAfterColoncolonTree(workingValues, parent);
+
+ parent = createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_reference_symbol);
+ createAfterReferenceSymbolTree(workingValues, parent);
+
return roots;
}
@@ -441,6 +453,7 @@ public final class WhiteSpaceOptions {
createTypecastTree(workingValues, expressions);
createConditionalTree(workingValues, expressions);
createParenthesisExpressionTree(workingValues, expressions);
+ createReferencedExpressionTree(workingValues, expressions);
final InnerNode arrays = new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_arrays);
createArrayCreationTree(workingValues, arrays);
@@ -612,6 +625,12 @@ public final class WhiteSpaceOptions {
METHOD_CALL_PREVIEW);
}
+ private static void createAfterReferenceSymbolTree(Map<String, Object> workingValues, InnerNode parent) {
+ createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_ref_expr,
+ CodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_REFERENCE_SYMBOL_IN_REFERENCED_EXPRESSION,
+ REFERENCED_EXPRESSION_PREVIEW);
+ }
+
private static void createBeforeColoncolonTree(Map<String, Object> workingValues, InnerNode parent) {
createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_field_access,
CodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLONCOLON_IN_FIELD_ACCESS, FIELD_ACCESS_PREVIEW);
@@ -1116,7 +1135,7 @@ public final class WhiteSpaceOptions {
}
private static InnerNode createParenthesisExpressionTree(Map<String, Object> workingValues, InnerNode parent) {
- final InnerNode root = new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_parenexpr);
+ final InnerNode root = new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_paren_expr);
createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren,
CodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION,
@@ -1127,6 +1146,15 @@ public final class WhiteSpaceOptions {
return root;
}
+ private static InnerNode createReferencedExpressionTree(Map<String, Object> workingValues, InnerNode parent) {
+ final InnerNode root = new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_ref_expr);
+
+ createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_reference_symbol,
+ CodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_REFERENCE_SYMBOL_IN_REFERENCED_EXPRESSION,
+ REFERENCED_EXPRESSION_PREVIEW);
+ return root;
+ }
+
private static InnerNode createTypecastTree(Map<String, Object> workingValues, InnerNode parent) {
final InnerNode root = new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_typecasts);
diff --git a/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/preferences/WhiteSpaceTabPage.java b/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/preferences/WhiteSpaceTabPage.java
index 50020c264..b3be76b1f 100644
--- a/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/preferences/WhiteSpaceTabPage.java
+++ b/plugins/org.eclipse.php.formatter.ui/src/org/eclipse/php/formatter/ui/preferences/WhiteSpaceTabPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Zend Techologies Ltd.
+ * Copyright (c) 2013-2019 Zend Techologies Ltd.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
@@ -37,8 +37,8 @@ import org.eclipse.ui.part.PageBook;
public class WhiteSpaceTabPage extends ModifyDialogTabPage {
/**
- * Encapsulates a view of the options tree which is structured by syntactical
- * element.
+ * Encapsulates a view of the options tree which is structured by
+ * syntactical element.
*/
private final class SyntaxComponent
@@ -765,6 +765,9 @@ public class WhiteSpaceTabPage extends ModifyDialogTabPage {
preferences,
CodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION);
+ codeFormatterPreferences.insert_space_after_reference_symbol_in_referenced_expression = getBooleanValue(
+ preferences,
+ CodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_REFERENCE_SYMBOL_IN_REFERENCED_EXPRESSION);
}
private boolean getBooleanValue(Map<String, Object> preferences, String key) {
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_20/commentFormatter1.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_20/commentFormatter1.pdtt
new file mode 100644
index 000000000..04924e74d
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_20/commentFormatter1.pdtt
@@ -0,0 +1,47 @@
+--TEST--
+Check that indentation string is valid and recalculated for each group of comments.
+--FILE--
+<?php
+
+class MyClass extends MyBaseClass
+{
+
+ private function foo(&$row)
+ {
+ /*
+ * indentation string for this comment should not be stored...
+ */
+ }
+
+ function addColumns(Table $table)
+ {
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ $column->setNativeType($type);
+ // comment 1
+ // ...to be reused here!!!
+ $column->setSize($size);
+ }
+ }
+}
+?>
+--EXPECT--
+<?php
+class MyClass extends MyBaseClass
+{
+ private function foo(& $row)
+ {
+ /*
+ * indentation string for this comment should not be stored...
+ */
+ }
+ function addColumns(Table $table)
+ {
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ $column->setNativeType($type);
+ // comment 1
+ // ...to be reused here!!!
+ $column->setSize($size);
+ }
+ }
+}
+?> \ No newline at end of file
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_20/comments_formatter_20.xml b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_20/comments_formatter_20.xml
new file mode 100644
index 000000000..dfb685d8f
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_20/comments_formatter_20.xml
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<profiles>
+<profile name="comments_formatter_20">
+<setting id="indentationChar" value=" "/>
+<setting id="insert_space_after_opening_paren_in_declare" value="false"/>
+<setting id="insert_space_before_closing_paren_in_declare" value="false"/>
+<setting id="insert_space_before_opening_paren_in_declare" value="false"/>
+<setting id="org.eclipse.php.core.formatter.insert_new_line_in_function_invoke" value="3"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_force_split" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_indent_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_line_wrap_policy" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_force_split" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_indent_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_line_wrap_policy" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_force_split" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_indent_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_line_wrap_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_force_split" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_indent_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_line_wrap_policy" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_force_split" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_indent_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_line_wrap_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_force_split" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_indent_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_line_wrap_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_force_split" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_indent_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_line_wrap_policy" value="3"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_force_split" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_indent_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_line_wrap_policy" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_force_split" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_indent_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_line_wrap_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_force_split" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_indent_policy" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_line_wrap_policy" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_field" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_member_type" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_method" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_between_type_declarations" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_block" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_lambda_function_declaration" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_method_declaration" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_switch" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_type_declaration" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.format_block_comments" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.format_header" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.format_html" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.format_javadoc_comments" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.format_line_comments" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.format_source_code" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.indent_parameter_description" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.indent_root_tags" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.insert_new_line_before_root_tags" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.insert_new_line_for_parameter" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.line_length" value="9999"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.continuation_indentation" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.continuation_indentation_for_array_initializer" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.disabling_tag" value="@formatter:off"/>
+<setting id="org.eclipse.php.formatter.core.formatter.enabling_tag" value="@formatter:on"/>
+<setting id="org.eclipse.php.formatter.core.formatter.format_guardian_clause_on_one_line" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.indent_breaks_compare_to_cases" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.indent_empty_lines" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_block" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_body" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.indentation.size" value="4"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_catch_in_try_statement" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_else_in_if_statement" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_finally_in_try_statement" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_while_in_do_statement" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_block" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_method_body" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_type_declaration" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_array_creation" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_field_access" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_foreach" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_method_invocation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_yield" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_assignment_operator" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_binary_operator" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_closing_brace_in_block" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_closing_paren_in_cast" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_colon_in_conditional" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_field_access" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_method_invocation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_array_creation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_echo" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_for_inits" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_global" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_list" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_constant_declarations" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_static" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_superinterfaces" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_array_creation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_cast" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_catch" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_for" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_foreach" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_if" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_list" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_switch" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_while" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_postfix_operator" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_prefix_operator" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_question_in_conditional" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_reference_symbol_in_referenced_expression" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_semicolon_in_for" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_unary_operator" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_array_creation" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_field_access" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_foreach" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_method_invocation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_yield" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_assignment_operator" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_binary_operator" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_array_creation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_cast" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_catch" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_for" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_foreach" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_if" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_list" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_switch" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_while" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_case" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_conditional" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_default" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_field_access" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_method_invocation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_array_creation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_echo" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_for_inits" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_global" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_list" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_constant_declarations" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_static" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_superinterfaces" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_block" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_switch" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_array_creation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_catch" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_for" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_foreach" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_if" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_list" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_switch" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_while" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_postfix_operator" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_prefix_operator" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_question_in_conditional" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon_in_for" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_unary_operator" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_brackets_in_array_type_reference" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.join_lines_in_comments" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.keep_else_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.keep_elseif_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.keep_imple_if_on_one_line" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.keep_then_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.lineSplit" value="1024"/>
+<setting id="org.eclipse.php.formatter.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_namespace" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_use_statements" value="1"/>
+<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_class_body" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_namespace" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_use_statements" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_namespaces" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_use_statements" value="0"/>
+<setting id="org.eclipse.php.formatter.core.formatter.number_of_empty_lines_to_preserve" value="10"/>
+<setting id="org.eclipse.php.formatter.core.formatter.put_empty_statement_on_new_line" value="true"/>
+<setting id="org.eclipse.php.formatter.core.formatter.tabulation.size" value="4"/>
+<setting id="org.eclipse.php.formatter.core.formatter.use_on_off_tags" value="false"/>
+</profile>
+</profiles>
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_20/reference.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_20/reference.pdtt
new file mode 100644
index 000000000..7ba3d1576
--- /dev/null
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_20/reference.pdtt
@@ -0,0 +1,30 @@
+--TEST--
+Test formatting for Reference
+--FILE--
+<?php
+function foo() {
+ ;
+}
+class MyClass {
+}
+ $a = 0;
+ $b = &$a;
+$bb = &new MyClass ( );
+$bbb = &foo ();
+ $newref =&returns_reference ();
+?>
+--EXPECT--
+<?php
+function foo()
+{
+ ;
+}
+class MyClass
+{
+}
+$a = 0;
+$b = & $a;
+$bb = & new MyClass();
+$bbb = & foo();
+$newref = & returns_reference();
+?>
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_9/commentFormatter4.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_9/commentFormatter4.pdtt
index 174fac276..eb4c01ebf 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_9/commentFormatter4.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/comments_formatter_9/commentFormatter4.pdtt
@@ -30,7 +30,7 @@ class MyClass extends MyBaseClass
class MyClass extends MyBaseClass
{
- private function foo(& $row)
+ private function foo(&$row)
{
/*
* indentation string for this comment should not be stored...
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/default_formatter_configuration/reference.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/default_formatter_configuration/reference.pdtt
index ff898072e..5cbad696b 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/default_formatter_configuration/reference.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/default_formatter_configuration/reference.pdtt
@@ -21,8 +21,8 @@ function foo() {
class MyClass {
}
$a = 0;
-$b = & $a;
-$bb = & new MyClass ();
-$bbb = & foo ();
-$newref = & returns_reference ();
+$b = &$a;
+$bb = &new MyClass ();
+$bbb = &foo ();
+$newref = &returns_reference ();
?>
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/max_line_wrap_length_20/reference.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/max_line_wrap_length_20/reference.pdtt
index 8f20335ed..0f29f5071 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/max_line_wrap_length_20/reference.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/max_line_wrap_length_20/reference.pdtt
@@ -8,7 +8,7 @@ function foo() {
class MyClass {
}
$a = 0;
- $b = &$a;
+ $b = & $a;
$bb = &new MyClass ( );
$bbb = &foo ();
$newref =& returns_reference ();
@@ -24,5 +24,5 @@ $a = 0;
$b = &$a;
$bb = &new MyClass ();
$bbb = &foo ();
-$newref = & returns_reference ();
+$newref = &returns_reference ();
?>
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/new_default_formatter_configuration/reference.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/new_default_formatter_configuration/reference.pdtt
index ff898072e..5cbad696b 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/new_default_formatter_configuration/reference.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/new_default_formatter_configuration/reference.pdtt
@@ -21,8 +21,8 @@ function foo() {
class MyClass {
}
$a = 0;
-$b = & $a;
-$bb = & new MyClass ();
-$bbb = & foo ();
-$newref = & returns_reference ();
+$b = &$a;
+$bb = &new MyClass ();
+$bbb = &foo ();
+$newref = &returns_reference ();
?>
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/zend_framework_default_configuration/reference.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/zend_framework_default_configuration/reference.pdtt
index b4cb99f88..39620c688 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/zend_framework_default_configuration/reference.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php5/zend_framework_default_configuration/reference.pdtt
@@ -23,8 +23,8 @@ class MyClass
{
}
$a = 0;
-$b = & $a;
-$bb = & new MyClass();
-$bbb = & foo();
-$newref = & returns_reference();
+$b = &$a;
+$bb = &new MyClass();
+$bbb = &foo();
+$newref = &returns_reference();
?>
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php54/comments_formatter_1/commentFormatter13.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php54/comments_formatter_1/commentFormatter13.pdtt
index 86b5fdd80..52397c5e5 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php54/comments_formatter_1/commentFormatter13.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php54/comments_formatter_1/commentFormatter13.pdtt
@@ -932,7 +932,7 @@ class Application
}
ksort($namespacedCommands);
- foreach ($namespacedCommands as &$commands) {
+ foreach ($namespacedCommands as & $commands) {
ksort($commands);
}
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php54/comments_formatter_1/commentFormatter17.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php54/comments_formatter_1/commentFormatter17.pdtt
index 87a43459c..7860238a8 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php54/comments_formatter_1/commentFormatter17.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php54/comments_formatter_1/commentFormatter17.pdtt
@@ -225,7 +225,7 @@ class I18nBehaviorObjectBuilderModifier
));
}
- public function objectFilter(&$script, $builder)
+ public function objectFilter( & $script, $builder)
{
$i18nTable = $this->behavior->getI18nTable();
$i18nTablePhpName = $this->builder->getNewStubObjectBuilder($i18nTable)->getUnprefixedClassname();
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/default_formatter_configuration/commaList.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/default_formatter_configuration/commaList.pdtt
index 72244353d..ed463bf23 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/default_formatter_configuration/commaList.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/default_formatter_configuration/commaList.pdtt
@@ -6,7 +6,7 @@ if (true) {
foo($value, $key /* comment1 */ /* comment2 */); /* comment3 */
}
-function foo(&$value, $key)
+function foo( & $value, $key)
{
$value = str_replace(array(
'_',
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked3/commaList01.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked3/commaList01.pdtt
index 2fec0acbf..082291081 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked3/commaList01.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked3/commaList01.pdtt
@@ -6,7 +6,7 @@ if (true) {
foo($value, $key /* comment1 */ /* comment2 */); /* comment3 */
}
-function foo(&$value, $key)
+function foo( & $value, $key)
{
$value = str_replace(array(
'_',
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked4/commaList01.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked4/commaList01.pdtt
index bf5792755..f4b20b517 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked4/commaList01.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked4/commaList01.pdtt
@@ -6,7 +6,7 @@ if (true) {
foo($value, $key /* comment1 */ /* comment2 */); /* comment3 */
}
-function foo(&$value, $key)
+function foo( & $value, $key)
{
$value = str_replace(array(
'_',
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked5/commaList01.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked5/commaList01.pdtt
index 091f9a006..129dda299 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked5/commaList01.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked5/commaList01.pdtt
@@ -6,7 +6,7 @@ if (true) {
foo($value, $key /* comment1 */ /* comment2 */); /* comment3 */
}
-function foo(&$value, $key)
+function foo( & $value, $key)
{
$value = str_replace(array(
'_',
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked7/commaList01.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked7/commaList01.pdtt
index 1ec7a9e19..67603bc0d 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked7/commaList01.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked7/commaList01.pdtt
@@ -6,7 +6,7 @@ if (true) {
foo($value, $key /* comment1 */ /* comment2 */); /* comment3 */
}
-function foo(&$value, $key)
+function foo( & $value, $key)
{
$value = str_replace(array(
'_',
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked8/commaList05.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked8/commaList05.pdtt
index b8c79ba40..16e53eebf 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked8/commaList05.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php55/psr2_tweaked8/commaList05.pdtt
@@ -6,7 +6,7 @@ if (true) {
foo($value, $key /* comment1 */ /* comment2 */); /* comment3 */
}
-function foo(&$value, $key)
+function foo( & $value, $key)
{
$value = str_replace(array(
'_',
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php74/default_formatter_configuration/arrowFunctions.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php74/default_formatter_configuration/arrowFunctions.pdtt
index 72ba9cb68..aefb68309 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php74/default_formatter_configuration/arrowFunctions.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter/php74/default_formatter_configuration/arrowFunctions.pdtt
@@ -16,8 +16,8 @@ $fn=fn($x)=>fn($y)=>$x*$y+$z;
fn(array$x)=>$x;
fn():int=>$x;
fn($x=42)=>$x;
-fn(&$x)=>$x;
-fn&($x)=>$x;
+fn( & $x)=>$x;
+fn & ($x)=>$x;
fn($x,...$rest)=>$rest;
class Test
diff --git a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter_indent_empty_lines/php5/comments_formatter_9/commentFormatter4.pdtt b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter_indent_empty_lines/php5/comments_formatter_9/commentFormatter4.pdtt
index bb39b808b..7686d4976 100644
--- a/tests/org.eclipse.php.formatter.core.tests/workspace/formatter_indent_empty_lines/php5/comments_formatter_9/commentFormatter4.pdtt
+++ b/tests/org.eclipse.php.formatter.core.tests/workspace/formatter_indent_empty_lines/php5/comments_formatter_9/commentFormatter4.pdtt
@@ -26,11 +26,10 @@ class MyClass extends MyBaseClass
?>
--EXPECT--
<?php
-
class MyClass extends MyBaseClass
{
- private function foo(& $row)
+ private function foo(&$row)
{
/*
* indentation string for this comment should not be stored...

Back to the top