Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"PhpVersion.PHP_82=PHP 8.2",
"PhpVersion.PHP_83=PHP 8.3",
"PhpVersion.PHP_84=PHP 8.4",
"PhpVersion.PHP_85=PHP 8.5",
})
public enum PhpVersion {

Expand Down Expand Up @@ -115,6 +116,11 @@ public enum PhpVersion {
* @since 2.100
*/
PHP_84(Bundle.PhpVersion_PHP_84()),
/**
* PHP 8.4.
* @since 2.x
*/
PHP_85(Bundle.PhpVersion_PHP_85()),
;

private final String displayName;
Expand Down Expand Up @@ -373,6 +379,7 @@ private enum Period {
PHP_82(LocalDate.of(2022, 12, 8), LocalDate.of(2024, 12, 31), LocalDate.of(2026, 12, 31)),
PHP_83(LocalDate.of(2023, 11, 23), LocalDate.of(2025, 12, 31), LocalDate.of(2027, 12, 31)),
PHP_84(LocalDate.of(2024, 11, 21), LocalDate.of(2026, 12, 31), LocalDate.of(2028, 12, 31)),
PHP_85(LocalDate.of(2025, 11, 20), LocalDate.of(2027, 12, 31), LocalDate.of(2029, 12, 31)),
;

private final LocalDate initialRelease;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.netbeans.modules.php.editor.parser.astnodes.ClassDeclaration;
import org.netbeans.modules.php.editor.parser.astnodes.ClassInstanceCreation;
import org.netbeans.modules.php.editor.parser.astnodes.ClassInstanceCreationVariable;
import org.netbeans.modules.php.editor.parser.astnodes.CompositionExpression;
import org.netbeans.modules.php.editor.parser.astnodes.ConditionalExpression;
import org.netbeans.modules.php.editor.parser.astnodes.ConstantDeclaration;
import org.netbeans.modules.php.editor.parser.astnodes.DeclareStatement;
Expand Down Expand Up @@ -1085,6 +1086,21 @@ private void visitConditionalExpression(ConditionalExpression node, boolean putC
}
}

//PHP 8.5 pipe operator composition expression
@Override
public void visit(CompositionExpression node) {
scan(node.getLeft());
while (ts.moveNext()
&& !(ts.token().id() == PHPTokenId.PHP_OPERATOR && TokenUtilities.textEquals("|>", ts.token().text())) // NOI18N
&& lastIndex < ts.index()) {
addFormatToken(formatTokens);
}

formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_AROUND_KEY_VALUE_OP, ts.offset() + ts.token().length()));
formatTokens.add(new FormatToken(FormatToken.Kind.TEXT, ts.offset(), ts.token().text().toString()));
scan(node.getRight());
}

@Override
public void visit(ConstantDeclaration node) {
if (path.size() > 1 && path.get(1) instanceof Block) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,13 @@ && isFirstCommaAfterDoubleArrow(startExpression, caretOffset, ts)) {
newIndent = Utilities.getRowIndent(doc, startExpression) + continuationSize;
break;
}
} else if (ts.token().id() == PHPTokenId.PHP_OPERATOR && TokenUtilities.textEquals("|>", ts.token().text())) { // NOI18N
//PHP 8.5 align pipe operator chain expressions
int startExpression = LexUtilities.findStartTokenOfExpression(ts);
if (startExpression != -1) {
newIndent = Utilities.getRowIndent(doc, startExpression);
break;
}
}
}
previousTokenId = ts.token().id();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,10 @@ public static int findStartTokenOfExpression(TokenSequence ts) {
}
break;
}
} else if (token.id() == PHPTokenId.PHP_OPERATOR && TokenUtilities.textEquals(token.text(), "|>")) { // NOI18N
//pipe operator
start = ts.offset();
break;
} else if (balance == 1 && token.id() == PHPTokenId.PHP_STRING) {
// probably there is a function call insede the expression
start = ts.offset();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading