Apache NetBeans (Incubating)

Monday October 01, 2018

PHP 7.3 Support

Hi all. Today, we will briefly show you about PHP7.3 support which will be available in the next NetBeans version i.e. NetBeans 10.

First of all, I strongly hope that new features are tested by PHP users before NetBeans 10 is released because there should be bugs. Definitely, need your help! If you are interested in them, just test them. You can download a dev version here.

PHP 7.3 Support

To enable it, you have to set PHP 7.3 as the PHP version of your PHP project.

Nb10-php7.3-support-project-properties.png

NetBeans provides support for the new three syntaxes.

Allow a trailing comma in function calls

Nb10-php73-trailing-comma-in-function-calls.png

list() Referenct Assignment

Nb10-php73-list-reference-assignment.png

Flexible Heredoc and Nowdoc Syntaxes

Nb10-php73-flexible-heredoc-and-nowdoc-syntaxes.png

Note: We won't provide support for the old syntax any longer. i.e. NetBeans treats the following code as an error.

$heredoc = <<< END
END{$variable}
END;

PHP 7.1, 7.2 and more PHP features

The other PHP features for NetBeans 10 are here. We have also implemented PHP7.1, 7.2, new hints, new code foldings and more.

That's all for today. As always, please test it. You can download a development version from Jenkins Build. If you find some issues or enhancements, please report them to JIRA with your exact steps to reproduce them. (Components: php - Editor). Thanks.

Wednesday September 26, 2018

PHPStan Support

Hi all. Today, we will show you about PHPStan integration which will be available in the next NetBeans version i.e. NetBeans 10 as a new code analysis feature. If you have already used other code analysis features(e.g. Code Sniffer), you should be able to use this with similar way soon.

Options

First of all, let's set the Options (Tools > Options > PHP > Code Analysis > PHPStan). You can set a script path, a configuration file path and a level. At least you have to set the PHPStan script path to "PHPStan". If you don't set "Configuration" path, the configuration file of project root directory would be used.

Nb10-php-phpstan-support-options.png

Inspect project/directory/file

Then, let's inspect a project/direcoty/file using PHPStan. Please click "Source > Inspect...". The inspect dialog is shown.

Nb10-php-phpstan-support-inspect-dialog.png

Please choose "Scope" which you would like to inspect and PHPStan as "Configuration". The files are inspected when you click the "inspect" button. Finally, The results are shown in the inspector window after the inspection is done.

Nb10-php-phpstan-support-results.png

That's all for today. As always, please test it. You can download a development version from Jenkins Build. If you find some issues or enhancements, please report them to JIRA (Components: php - Code). Thanks.

Thursday August 30, 2018

[PHP] Conditional breakpoints and new Twig features

Hi all. Today, we will show you some new features which will be available in the next NetBeans version, maybe (NetBeans 10? NOTE: we cannot promise anything about release contents at the moment).

First of all, if you would like to try new features, please build NetBeans yourself.

git clone git@github.com:apache/incubator-netbeans.git
cd incubator-netbeans
ant -Dcluster.config=full
(or ant -Dcluster.config=php)

You can find the start-up files in the nbbuild/netbeans/bin directory if the build succeeds. So please run it.

Debugger: Conditional breakpoints

You can stop the debugger if the context matches your condition. i.e. If the condition is true, the debugger stops on the breakpoint, otherwise, it does not stop there.

I assume that you have already done the settings for debugging. (please see: HowToConfigureXDebug) If xdebug doesn't work, please ask someone via Apache NetBeans mailing lists. (Please don't ask here.)

Just in my case(Ubuntu 18.04):

sudo apt install php-xdebug
sudo vim /etc/php/7.2/mods-available/xdebug.ini

# Change to the following
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.idekey="netbeans-xdebug"

Let's try running with a sample code(index.php):

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
    $array = ["foo", "bar", "baz", "qux"];
    foreach ($array as $value) {
        echo $value;
    }
?>
</body>
</html>

Step 1: Enable a breakpoint

You can enable it when you click a line number.

Nb-php-debugger-conditial-breakpoint-1.png

Step 2: Show the Breakpoint Properties dialog

To show it, please right-click the breakpoint, then please click Breakpoint > Properties.

Nb-php-debugger-conditial-breakpoint-2.png

Nb-php-debugger-conditial-breakpoint-3.png

Step 3: Input a condition

Please check "Condition" and input your condition to the combo box, then click the OK button.

Nb-php-debugger-conditial-breakpoint-4.png

Step 4: Run Debug Project

Please click Debug > Debug Project or the icon on the toolbar.

In this case, the debugger stops on the breakpont if $value is "baz".

Nb-php-debugger-conditional-breakpoints.gif

Twig: Code completion for delimiters, brackets, and quotes

Twig editor supports code completion for delimeters({{ and {%), brackets([, (, and {), and quotes(" and '). This feature is enabled by default. If you would like to disable, please uncheck the options (Tools > Options > Editor > Code Completion > Language: Twig File).

Nb-php-twig-autocomplete-options.png

Nb-php-twig-autocomplete.gif

Twig: Palette support

You can show the palette window. Please click Window > IDE Tools > Palette.

Nb-php-twig-palette.png

That's all for today. As always, please test it. If you find some issues or enhancements, please report them to JIRA (Components: php - Debugger, php - Twig). Thanks.

Calendar

Search

Hot Blogs (today's hits)

Tag Cloud

Categories

Feeds

Links

Navigation