Community
Participate
Working Groups
Hi, I have used Toshihiro Izumi's code formatter plugin PDT Tools: Formatter 1.5.1.v20131008 Its having seperate options for binary & string concatination operator for add whitespace PHP Development Tools (PDT) 3.3.0.201406110111 default code formatter has problem like, White Space >> Expressions >> Operators >> before & after binary operators. Problem : Its also put spaces on string concat Correct : $a = 4 + 9; Incorrect : echo $elm . "\n"; instead of echo $elm."\n";
This is not critical Space for concat operator is hardcoded, I'm marking this bug as enhancement.
I would like to remind about the problem. Relevant Code: https://github.com/eclipse/pdt/blob/80f4bdc9b25197cb75dd5dda7310146802babcad/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterVisitor.java#L4419 I think you can add a check for operator == InfixExpression.OP_CONCAT And if the condition is true, then do not add a space. The ideal option is to add another setting, which will determine the addition of a space only in this case. But this requires more code changes.
New Gerrit change created: https://git.eclipse.org/r/155031
Gerrit change https://git.eclipse.org/r/155031 was merged to [master]. Commit: http://git.eclipse.org/c/pdt/org.eclipse.pdt.git/commit/?id=bcb33da73731e8366471d8edcff53debc775acef
Fixed. There are 2 new options: White Space >> Expressions >> Operators >> before & after concatenation operators Note that this patch also fixes a bug found when unchecking the "before & after binary operators" options, code like: $a instanceof MyClass; would have been formatted as: $ainstanceofMyClass; Thierry.