10quality / wpmvc-commands

Ayuco commands for Wordpress MVC,
MIT License
2 stars 4 forks source link

Multi line on lengthy con-cat strings #78

Closed amostajo closed 4 years ago

amostajo commented 4 years ago

Pretty printer, this:

$name = 'very large string ' . $variable_large . ' another large string ' . $very_large_valiable_name . 'ver long end';

To:

$name = 'very large string '
    . $variable_large
    . ' another large string '
    . $very_large_valiable_name
    . 'ver long end';
garretthyder commented 4 years ago

Is it not more appropriate to print that as follows;

$name = 'very large string ' .
        $variable_large .
        ' another large string ' .
        $very_large_valiable_name .
        'ver long end';

So all string parts are aligned, even the first one.

amostajo commented 4 years ago

@garretthyder yes, let's make it as you suggest, as it follows PSR-2 standards: https://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartV/CodingGuideLines/PHP.html

garretthyder commented 4 years ago

Awesome thanks @amostajo reading PSR-2 again my example had indented the following lines with spaces until it aligned with the first string. But from PSR-2 it indicates just to do a single tab indent for following lines so I guess it won't always line up with the first part of the string but that makes sense especially when we have long variable names.