X

An Oracle blog about NetBeans for PHP

PHP 7 Support (Part 2)

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:

PHP 7 support in NetBeans

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:

PHP 7 support in NetBeans

Of course, all the features you would expect work - e.g. code completion:

PHP 7 support in NetBeans

Or hints: 

PHP 7 support in NetBeans

Not only classes/interfaces/traits can be used in group uses but also constants as well as functions: 

PHP 7 support in NetBeans

So if you prefer group uses, simply select the relevant property in IDE Options:

PHP 7 support in NetBeans

Another big feature of PHP 7 is ability to use anonymous classes. These classes are basically created on-the-fly and immediately used:

PHP 7 support in NetBeans

Great news is that code completion works as expected in this case as well:

PHP 7 support in NetBeans

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: 

PHP 7 support in NetBeans

Not only code completion works but also all other features like e.g. find usages:

PHP 7 support in NetBeans

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).

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services