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.

Bug 247996

Summary: Formatting PHP - Ability to delete braces for IF and loop statements
Product: php Reporter: Zicguy
Component: Formatting & IndentationAssignee: Ondrej Brejla <obrejla>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:

Description Zicguy 2014-10-17 08:46:11 UTC
It would be nice, in the PHP formatting tool, to have the ability to delete braces for IF and loop statements, if there statements have juste one line.

Example 1:

Change:
if ($test)
{
return false;
}

To:
if ($test)
return false;

Example 2:

Change:
foreach ($array as $key => $value)
{
$value = 'test';
}

To:
foreach ($array as $key => $value)
$value = 'test';

Thanks by advance.
Florian
Comment 1 IT_Architect 2017-09-06 11:45:29 UTC
When it indicates there is a problem with the code and there is not, and you cannot trust the syntax checking, it is not a convenience issue, it is a bug.  The PROPER way to do a single statement IF in PHP is WITHOUT the braces.