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 - Fromatting > PHP > Blank Lines - configuration to add blank lines between functions
Summary: Fromatting > PHP > Blank Lines - configuration to add blank lines between fun...
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 7.4
Hardware: All All
: P2 normal with 4 votes (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-27 15:39 UTC by s4muel
Modified: 2015-09-16 07:04 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 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.