Sorry I'm new to the group so I'm not 100% aware of the process, but the 
site says PSR-12 is under draft, so I guess things can still be 
discussed... 

I was going to open a new topic about this but found this one, and just 
wanted to say I agree with the previous message - I don't like this part of 
the recommendation:

A single argument being split across multiple lines (as might be the case 
> with an anonymous function or array) does not constitute splitting the 
> argument list itself.
>

somefunction($foo, $bar, [
    // ... 
], $baz);

$app->get('/hello/{name}', function ($name) use ($app) { 
    return 'Hello ' . $app->escape($name); 
});


I know many developers are used this in some scenarios, but particularly 
when there are many arguments it gets lets readable.
Also I assume that implementation of auto-formatting allowing this would be 
quite trickier (in fact for example PhpStorm doesn't support this atm).

So, is this something that has been decided already or is it open to 
changes?

El sábado, 20 de enero de 2018, 17:34:26 (UTC), Joe T. escribió:

> The short-style syntax does make arrays much more readable, as it no 
> longer makes them look like function calls.
>
> However, the rule you're referencing is for when you are keeping arguments 
> on the *same* line. It permits for splitting an array in that signature to 
> multiple lines, and continuing the signature after the end of the 
> multi-line array.
>
> i see now your first example was following the guideline of the format 
> from your second message. Your right, technically that does comply with the 
> standard. When you start the signature on the same line as the opening "(", 
> all successive arguments after should continue on the line where the 
> previous argument ends. But hopefully you can see how muddled that pattern 
> is for readability. It's hard to tell where the arrays begin or end, 
> particularly in context of being function arguments. So many commas and 
> brackets...
>
> Honestly, i dislike the standard's allowance of the style in your second 
> message. It seems very awkward and visually clunky to me. But i don't have 
> a vote in accepting the standard, and came to the group a bit late to make 
> a case for changing it. For me (and the guide my team uses), any time any 
> argument is split to multiple lines, the whole signature should follow the 
> multi-line signature rule.
>
> Ultimately, i think the goal is readable & maintainable code, so when two 
> versions are technically legal, let that objective be the deciding factor.
>
> Hope that helps.
> -jlt
>
>

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/001e0ddc-6c62-4777-936e-29cd997d9e32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to