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 238894

Summary: Fromatting > PHP > Blank Lines - configuration to add blank lines between functions
Product: php Reporter: s4muel
Component: Formatting & IndentationAssignee: Ondrej Brejla <obrejla>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 7.4   
Hardware: All   
OS: All   
See Also: https://netbeans.org/bugzilla/show_bug.cgi?id=255313
Issue Type: ENHANCEMENT Exception Reporter:

Description s4muel 2013-11-27 15:39:06 UTC
i try to set up code formatting according to fig-psr2 standards (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
but despite netbeans is doing pretty good job with formatting with lot of options, i wasnt able to set up blank lines between functions/methods. there is an example on github which i tried:

<?php
namespace Vendor\Package;

use FooInterface;
use BarClass as Bar;
use OtherVendor\OtherPackage\BazClass;

class Foo extends Bar implements FooInterface
{
    public function sampleFunction($a, $b = null)
    {
        if ($a === $b) {
            bar();
        } elseif ($a > $b) {
            $foo->bar($arg1);
        } else {
            BazClass::bar($arg2, $arg3);
        }
    }

    final public static function bar()
    {
        // method body
    }
}

there are only configuration settings that allow me to insert blank lines:
* before function
* after function
but i need kind of "between functions" so i dont end up with blank line on either first or last line of class.
eg:
class Foo extends Bar implements FooInterface
{

    public function sampleFunction($a, $b = null)
    {
...

or

class Foo extends Bar implements FooInterface
{
    final public static function bar()
    {
        // method body
    }

}

i tried many combinations that work in several cases (if attributes/fields are present and so on) but none covers the psr2 with this basic situation.
Comment 1 dilip-vishwa 2014-01-05 17:38:53 UTC
Please solve this issue as Coding standard needs to use blank line between function, but not before or after the function.
Comment 2 Ondrej Brejla 2014-01-05 18:03:35 UTC
Sorry, not a P1 defect at all. Common enhancement.