This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 159802 [details] Screenshot of syntax errors Many parts of the "Context sensitive lexer"[1] and the "Uniform variable syntax"[2] RFC seem not implemented yet, see screenshot. Examples: <?php class Example { const GOTO = 1; function __construct(Example $list = null) { if ($list) { $this->foreach($list); } } function apply(callable $function) { foreach ([self::GOTO] as $key => $val) { $function($key, $val); } } function foreach(Example $list) { $list->apply(function() { printf("So contrived!\n"); }); return $list; } function as() : Example { return (clone $this)->foreach($this); } } (clone (new Example(new Example)))->as(); ?> [1] https://wiki.php.net/rfc/context_sensitive_lexer [2] https://wiki.php.net/rfc/uniform_variable_syntax
Unfortunately, due to limitations of the NetBeans PHP support internals, this issue will very likely not be fixed in NB 8.2, sorry. Context sensitive lexer is definitely out of scope, some (the most basic) cases of Uniform variable syntax are supported and we are working hard to try to support more such cases but as I wrote, it is not easy at all. Thanks for understanding and your report.
*** Bug 268463 has been marked as a duplicate of this bug. ***
First, I'll try Context sensitive lexer. Thanks.
*** Bug 268708 has been marked as a duplicate of this bug. ***
Created attachment 162736 [details] screenshot for context sensitive lexer
Created attachment 162737 [details] proposed patch for context sensitive lexer
Created attachment 162738 [details] screenshot for uniform variable syntax Now, I'm fixing syntax errors for uniform variable syntax. The following case is not resolved yet: [$object1, $object2][0]->property; I think that basically, variables($variable, $this->foo, Foo::$bar, $arr['test'], getStr() e.t.c.) and clone expression(clone $object) are used within "()". e.g. ($variable->getFoo())::foo(); (clone new MyClass())->foo(); Are there other cases using "()"? Could you provide them if you know them? BTW, I want to fix other issues before I fix this issue. To fix this issue takes much time. So, I'll try this later. Thanks for understanding.
Great job, Junichi!
> Are there other cases using "()"? Could you provide them if you know them? (function($s){var_dump($s);})("hi!");
Once this issue is fixed, we should improve our signature files (they contain methods like _clone() etc. to avoid syntax errors). Thanks.
(In reply to Tomas Mysik from comment #10) > Once this issue is fixed, we should improve our signature files (they > contain methods like _clone() etc. to avoid syntax errors). I forgot to add - I will do that :) Thanks.
(In reply to m6w6 from comment #9) > > Are there other cases using "()"? Could you provide them if you know them? > > (function($s){var_dump($s);})("hi!"); Thanks for it! It' was fixed in the issue 259111[1]. [1] https://netbeans.org/bugzilla/show_bug.cgi?id=259111 (In reply to Tomas Mysik from comment #11) > (In reply to Tomas Mysik from comment #10) > > Once this issue is fixed, we should improve our signature files (they > > contain methods like _clone() etc. to avoid syntax errors). > > I forgot to add - I will do that :) Thanks!
*** Bug 270092 has been marked as a duplicate of this bug. ***
I'm sorry to be late. I'll work on this issue again. First of all, I'll commit changes for Context Sensitive Lexer part. We have to verify the patch once before that because the parser has some changes for PHP7.1 support. Thanks.
Created attachment 164229 [details] proposed patch for context sensitive lexer v2 The first patch has a problem in this case(const CONST = [1,2], GOTO = 2;). So I fixed it. I moved exsting testfiles for CC(from php.editor/test/unit/data/testfiles/completion/lib/php70/* to php.editor/test/unit/data/testfiles/completion/lib/php70/base/*) I run all unit tests once. Then I'll push my changes today or tomorrow. Thanks.
Fixed context sensitive lexer part. Please try to test it if possible. Probably, it will be available in a dev build tomorrow or later. http://hg.netbeans.org/web-main/rev/63e15ba37eaa Thanks.
Great job, Junichi, as always! BTW feel free to add it to NB 9 N&N wiki page [1] ;) Thanks a lot! [1] http://wiki.netbeans.org/NewAndNoteworthyNB9
Integrated into 'main-silver', will be available in build *201705050001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/63e15ba37eaa User: Junichi Yamamoto <junichi11@netbeans.org> Log: #262141 - [PHP7] Context sensitive lexer & Uniform variable syntax Context sensitive lexer part
*** Bug 269380 has been marked as a duplicate of this bug. ***
Created attachment 164293 [details] screenshot for Uniform Variable Syntax Current progress for Uniform Variable Syntax: I fixed the parser and existing unit tests. Although the parser may possibly have wrong fixes(it seems that there is no error at the moment), we can fix missing cases for Uniform Variable Syntax. Missing cases: // (...) expression ($a)['0']; ($a)(); (($a)['0'])(); (Example::bar()); (Example::$bar)['test']; (Example::$bar)['baz'](); (getString()){0}; (($example->arr())[0])[9]; ($example->create())->test(); ($example->create())::bar(); // nested :: $foo::$bar::$baz; $foo::$bar::$baz::$test; $foo::$bar::$baz->test(); $foo::$bar::$baz(); $foo::$bar::baz(); // clone expression ((...) expression) class CloneExpression { public function create() { $test = (clone $this->test1())->test2(); return (clone $this)->test1(); } public function test1() { } public function test2() { } } (clone (new CloneExpression()))->create(); // array access with {} getStr(){0}; Now, we have to fix some features(e.g. CC, GotoDeclaration). Probably, I'll just look at simple cases for them. Thanks.
(In reply to junichi11 from comment #20) > Missing cases: The following case also is fixed: [$obj1, $obj2][0]->prop;
Nice job, Junichi. Thanks!
Fixed Uniform variable syntax part. Could someone verify it when it is available in a development build? http://hg.netbeans.org/web-main/rev/48ca30d3fcc5 Unfortunately, some features(CC, GotoDeclaration, MarkOccurrences) don't work with (...) expression yet. This problem should be submitted as a new issue. To resolve it, VariousUtils.getSemiType() has to be improved. Thanks.
Junichi, thanks a lot!
You are welcome :)
Integrated into 'main-silver', will be available in build *201705241652* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/48ca30d3fcc5 User: Junichi Yamamoto <junichi11@netbeans.org> Log: #262141 - [PHP7] Context sensitive lexer & Uniform variable syntax Uniform variable syntax part. Some features(CC, GotoDeclaration, MarkOccurrences) don't work with (...) expression yet.
*** Bug 271124 has been marked as a duplicate of this bug. ***
*** Bug 271164 has been marked as a duplicate of this bug. ***
This is still (again) an issue. Netbeans 8.2. Using as method name keyword like foreach, print, list cause error.
(In reply to instead from comment #29) > This is still (again) an issue. Netbeans 8.2. Using as method name keyword > like foreach, print, list cause error. Please don't reopen it. This was already fixed. Please try to use a dev build[1]. [1] http://bits.netbeans.org/download/trunk/nightly/latest/