roslov / psr12ext

PSR-12 Extended Coding Standard
MIT License
3 stars 1 forks source link

Limit to a single blank line between methods and lines in code #51

Open roslov opened 5 months ago

roslov commented 5 months ago

Disable more than one new line between methods, functions, lines of code, etc.

Incorrect:

$a = 10;

return $a;

Correct:

$a = 10;

return $a;

or

$a = 10;
return $a;

Incorrect:

}

public function someMethod(): void
{

Correct:

}

public function someMethod(): void
{
roslov commented 4 months ago

Something like this:

<rule ref="SlevomatCodingStandard.Classes.MethodSpacing">
    <properties>
        <property name="minLinesCountBeforeFirstMethod" value="0"/>
        <property name="maxLinesCountBeforeFirstMethod" value="1"/>
        <property name="minLinesCountBeforeMethod" value="0"/>
        <property name="maxLinesCountBeforeMethod" value="1"/>
        <property name="minLinesCountAfterMethod" value="0"/>
        <property name="maxLinesCountAfterMethod" value="1"/>
    </properties>
</rule>