Support for PHP 8.5 pipe operator#9113
Conversation
Issue apache#9034 - include Php 8.5 version option - syntax support for pipe opperator - hint for basic non-callable pipe operator right handle : integer, float, bool, infix expression
|
I wonder if there is still time to include this in NB 29. |
@haidubogdan NB 29 is pretty much done unfortunately. There are no more RCs planned unless someone finds something release critical and we have to do another one. RC3 would become the release after vote. |
There was a problem hiding this comment.
Overall, the PR looks good to me, thanks a lot for it! 👍
If we can, please let's wait a bit for @junichi11 as he is the main guy working on the PHP support in NetBeans, thank you.
php/php.api.phpmodule/src/org/netbeans/modules/php/api/PhpVersion.java
Outdated
Show resolved
Hide resolved
php/php.editor/src/org/netbeans/modules/php/editor/indent/IndentationCounter.java
Outdated
Show resolved
Hide resolved
php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/visitors/DefaultVisitor.java
Outdated
Show resolved
Hide resolved
php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/CompositionExpression.java
Outdated
Show resolved
Hide resolved
php/php.editor/src/org/netbeans/modules/php/editor/parser/PHP5ErrorHandlerImpl.java
Show resolved
Hide resolved
php/php.editor/src/org/netbeans/modules/php/editor/verification/PHP84UnhandledError.java
Show resolved
Hide resolved
php/php.editor/src/org/netbeans/modules/php/editor/verification/PHP85UnhandledError.java
Outdated
Show resolved
Hide resolved
- bump PhpVersion - add message for composition expression invalid arg exception - correct php version number typos - pipe operator text as String const
tmysik
left a comment
There was a problem hiding this comment.
Just one minor comment from me, otherwise it looks good, thank you.
| @@ -115,6 +116,11 @@ public enum PhpVersion { | |||
| * @since 2.100 | |||
| */ | |||
| PHP_84(Bundle.PhpVersion_PHP_84()), | |||
| /** | |||
| * PHP 8.5 | |||
| * @since 2.x | |||
There was a problem hiding this comment.
| * @since 2.x | |
| * @since 2.106 |
Part of issue #9034
Pipe Operator
The IDE doesn't support this operator today.
So it requires updates on the lexer and parser level.
For the pipe operator I've used a similar approach to the infix expression and based on this rfc : https://wiki.php.net/rfc/function-composition I've created a new AstNode CompositionExpression (Maybe it should be FunctionCompostionExpression ?).
Trying to identify what is a variable or what is not a callable seemed to be very hard as you can assign a callable to a variable. Also, as it's a chain type expression there are no clear syntax delimiters to be included, so it can't be implemented as a stand alone AST rule.
For the error syntax I've used a hint verification approach of identifying what type of expression is the right handle of a Composition Expression. The basic types of numeric tokens or boolean values can be marked directly as errors.
In some future implementation we can add checks on callable types, as they require to take only one parameter (first-class-callables) .
https://wiki.php.net/rfc/pipe-operator-v3#callable_styles
Todo | work in progress (while review is in progress :) )
^Add meaningful description above
Click to collapse/expand PR instructions
By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -
Please make sure (eg.
git log) that all commits have a valid name and email address for you in the Author field.If you're a first time contributor, see the Contributing guidelines for more information.
If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.
PR approval and merge checklist:
If this PR targets the delivery branch: don't merge. (full wiki article)