Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 268071 - Anonymous functions with return type are marked as errors when use keyword is used
Anonymous functions with return type are marked as errors when use keyword is...
Product: php
Classification: Unclassified
Component: Editor
All All
: P3 with 1 vote (vote)
: 8.2
Assigned To: junichi11
Depends on:
  Show dependency treegraph
Reported: 2016-09-16 19:49 UTC by rabalthazar
Modified: 2016-12-15 12:16 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT

screenshot (3.38 KB, image/png)
2016-10-08 04:01 UTC, junichi11

Note You need to log in before you can comment on or make changes to this bug.
Description rabalthazar 2016-09-16 19:49:45 UTC
Product Version = NetBeans IDE 8.2 RC (Build 201609140952)
Operating System = Linux version 4.4.0-36-generic running on amd64
Java; VM; Vendor = 1.8.0_60
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.60-b23

Capacidade de Reprodução: Acontece toda vez que

  * In any PHP file create an anonymous function as this one

$a = 1;
$func = function (bool $v) use ($a) : bool {
    return $v || $a > 1;

  Editor displays the second line as an error

  Do no display an error
Comment 1 Tomas Mysik 2016-09-19 05:45:05 UTC
Thanks for catching that, possible patch cancidate.
Comment 2 Tomas Mysik 2016-09-27 13:36:39 UTC
Adding Junichi to CC, maybe he could be interested. Thanks.
Comment 3 dasprid 2016-10-05 11:44:25 UTC
I assume the problem lies in ASTPHP5Parser.cup, where the varsList for LambdaFunctionDeclaration is defined *after* the optional return type (wrong way around). I tried to fix it myself, but I kinda fail at re-generating the parser.
Comment 4 dasprid 2016-10-05 11:45:24 UTC
Same problem by the way in the file, where it's also switched in the toString() method.
Comment 5 junichi11 2016-10-07 15:10:02 UTC
I'll try to look at it.

Comment 6 junichi11 2016-10-08 04:00:59 UTC
I'll fix it.

Comment 7 junichi11 2016-10-08 04:01:55 UTC
Created attachment 162400 [details]
Comment 8 junichi11 2016-10-14 03:47:40 UTC

Comment 9 Tomas Mysik 2016-10-14 06:30:02 UTC
Guys, in order to be part of the patch for NB 8.2, could you please verify that
this issue is fixed now? Just wait for a message that will appear here saying
in which daily build this change will be available.

Junichi, great job as always!

Comment 10 Quality Engineering 2016-10-15 02:13:48 UTC
Integrated into 'main-silver', will be available in build *201610150002* on (upload may still be in progress)

User: Junichi Yamamoto <>
Log: #268071 - Anonymous functions with return type are marked as errors when use keyword is used
Comment 11 dasprid 2016-10-19 11:15:04 UTC
Looks fixed for me.
Comment 12 junichi11 2016-10-19 22:54:24 UTC
(In reply to dasprid from comment #11)
> Looks fixed for me.

Thanks for your verification!
Comment 13 Tomas Mysik 2016-10-20 06:03:45 UTC
Thanks a lot!
Comment 14 Tomas Mysik 2016-12-03 14:09:40 UTC
Transplanted to the releases repo branch release82:

Comment 15 amobilia 2016-12-15 12:16:17 UTC

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo