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 - Formatting PHP - Ability to delete braces for IF and loop statements
Summary: Formatting PHP - Ability to delete braces for IF and loop statements
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-17 08:46 UTC by Zicguy
Modified: 2017-09-06 11:45 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.