Hi all, today we will show you our support for PHP 7 which will be part of NetBeans 8.2.
(This is the second part; for the first part, please follow this link.)
First, please let me thank our NetBeans user Junichi Yamamoto who is helping a lot with developing of new features as well as fixing of existing issues. Thanks a lot, Junichi!
Please note that PHP 7 is a huge update of NetBeans PHP support so your help with testing and reporting issues is more than welcome (and really appreciated!), thank you. Instructions can be found at the end of this blog post.
As the first step, you should set PHP 7.0 as the PHP version of your PHP project:
One of the biggest features of PHP 7 is group use declarations. Now, all the use statements from some common namespace can be combined in one group use statement. How this can look like can be found on the next image:
Of course, all the features you would expect work - e.g. code completion:
Not only classes/interfaces/traits can be used in group uses but also constants as well as functions:
So if you prefer group uses, simply select the relevant property in IDE Options:
Another big feature of PHP 7 is ability to use anonymous classes. These classes are basically created on-the-fly and immediately used:
Great news is that code completion works as expected in this case as well:
Anonymous classes can be also a bit more complicated - they can extend some other class, implement some interfaces and even use some traits, just like any other classes. They can also take any constructor parameters:
Not only code completion works but also all other features like e.g. find usages:
That's all for today, as always, please test it and report all the issues or enhancements you find in NetBeans Bugzilla (component php, subcomponent Editor). You can also leave a comment here (please notice that the comments are moderated so they will not appear here immediately) but reporting issues is strongly preferred (no issues described here in comments will be fixed, sorry; only Bugzilla counts).