You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method printParameters in the Printer class checks if the length of the arguments is greater than (new Dumper)->wrapLength. But this only checks if the list of parameters exceeds the 120 character limit but ignores the string length of the rest of the method head like the visibility, method name, function keyword and the return type
<?php
namespace Foo;
class Bar
{
public function baz(string $lorem, string $ipsum, string $dolor, string $sit, string $amet, string $foo, string $bar): string
{
}
}
The function baz now has a line length of 130 characters which is too long for PSR2 and PSR12
Expected Behavior
I expect, that the rest of the method head is also taken into account when checking the line length so the following output would be generated which is PSR2 and PSR12 valid:
<?php
namespace Foo;
class Bar
{
public function baz(
string $lorem,
string $ipsum,
string $dolor,
string $sit,
string $amet,
string $foo,
string $bar
): string {
}
}
The text was updated successfully, but these errors were encountered:
First of all thanks for a quick fix. Unfortunately this is still not working correctly.
In line 288 of the Printer class you are taking into account the length of public function baz as well as the length of : string and the length of the parameters string $lorem, string $ipsum, string $dolor, string $sit, string $amet, string $foo, string $bar but you are forgetting two things here. First of all you need to add 2 characters for the parenthesis of the parameters as well as 4 spaces for the indention of the function. Later should probably be included in the parameter $column
dg
added a commit
that referenced
this issue
Feb 8, 2021
Version: 3.5.2
Bug Description
The method
printParameters
in thePrinter
class checks if the length of the arguments is greater than(new Dumper)->wrapLength
. But this only checks if the list of parameters exceeds the 120 character limit but ignores the string length of the rest of the method head like the visibility, method name,function
keyword and the return typeSteps To Reproduce
Example code:
Will print the following:
The function baz now has a line length of 130 characters which is too long for PSR2 and PSR12
Expected Behavior
I expect, that the rest of the method head is also taken into account when checking the line length so the following output would be generated which is PSR2 and PSR12 valid:
The text was updated successfully, but these errors were encountered: