allebb / netbeans-psr-formatting

NetBeans configuration settings for PSR 1&2
MIT License
150 stars 16 forks source link

Add new line before namespace keyword #11

Closed joseluisq closed 7 years ago

joseluisq commented 7 years ago

Actually it looks like :

captura de pantalla 2016-11-03 a las 12 13 07

This solves the issue :

captura de pantalla 2016-11-03 a las 12 10 52

allebb commented 7 years ago

Hey @joseluisq - As long as you're using the latest release (https://github.com/bobsta63/netbeans-psr-formatting/releases/tag/v1.0.2) this is already resolved buddy :)

Cheers for logging though, I'll close the issue. - Do you me know if you have further issues.

joseluisq commented 7 years ago

It appears that doesn't work I have the v1.0.2

allebb commented 7 years ago

Sorry - Re-reading your original issue, appears you want a blank line before the namespace

Maybe I'm wrong but this isn't PSR1/PSR2 recommendations? See this page: http://www.php-fig.org/psr/psr-2/

If you feel I'm incorrect please let me know but as far as I'm concerned it's working fine for me?

joseluisq commented 7 years ago

It appears that new lines before namespaces is not mandatory in PSR-2 specs.. http://www.php-fig.org/psr/psr-2/#3-namespace-and-use-declarations

Anyway, I still think that'll be an idea to consider 👍 Thanks

allebb commented 7 years ago

Yeah, given that my package currently does make the auto-formatting of code look as per their valid example, I'd prefer to keep it as it now (namespace on a new line but not a blank line between the opening PHP tag and the namespace).

screenshot 2016-11-03 19 40 56

Obviously, you can override as per your own requirements but I think it's probably better to keep consistent with their example screenshots.

If others want to comment/request me to change this I will otherwise, personally I feel this is the currently correct and don't intend to change.

allebb commented 7 years ago

Alternatively you could use my previous version that supported a blank line given the previous bug with NetBeans. https://github.com/bobsta63/netbeans-psr-formatting/releases/tag/v1.0.1

:)

joseluisq commented 7 years ago

Sure, consistence is the rule. I don't pretend to change your plugin in favor to 😄
instead I think is would be a good option to consider only..

For example (this is only a particular preference):

<?php
namespace App\Http\Controllers;

use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    function hello()
    {
        dd('Hello!')
    }
}

Instead:

<?php

namespace App\Http\Controllers;

use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    function hello()
    {
        dd('Hello!')
    }
}