matthiasblaesing commented on code in PR #9113:
URL: https://github.com/apache/netbeans/pull/9113#discussion_r2907057115


##########
php/php.editor/test/unit/data/testfiles/parser/php85/pipeOperator_02.php:
##########
@@ -0,0 +1,50 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//multiple callables
+$result = "Example"
+    |> 'strtoupper'
+    |> str_shuffle(...)
+    |> fn($x) => trim($x)

Review Comment:
   This is not correct and is not runnable. The PHP interpreter errors out with:
   
   ```
   Fatal error: Arrow functions on the right hand side of |> must be 
parenthesized in /mnt/pipeOperator_02.php on line 22
   Stack trace:
   #0 {main}
   ```
   
   I noticed this because the parser tree looked wrong to me (the composition 
function was nested inside the arrow function). I then checked the 
documentation: 
   
   https://www.php.net/manual/en/language.operators.functional.php
   
   > Be aware that, to avoid syntax ambiguity, [arrow 
functions](https://www.php.net/manual/en/functions.arrow.php) MUST be wrapped 
in parentheses when used with a pipe operator, as in the examples above. 
Failing to do so will result in a fatal error.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to