Here is a bug:
function test(
string $string = "string",
int |
(
JsonSerializable
&
Stringable
)|
null $int = 0
) {}
}
This is a weird but the correct way to write a type. Right now the AlignMultilineParametersFixer will calculate the length of the type with all those tabulation spaces and put the names of the parameters really far away to the left.
The PHP-CS-Fixer's TypesSpacesFixer doesn't fix such multiline type declarations and I didn't find any other fixer suited for this task, so it seems that this code was left on the user's side.
It seems that I can calculate the length of each line and take the longest line as the type length:
function test(
string $string = "string",
int |
(
JsonSerializable
&
Stringable
)|
null $int = 0
) {}
}
But I'm not sure about this solution at this moment. So I'll leave this issue open until somebody also occurs this in a real code and gives me some feedback about expected behavior.
Here is a bug:
This is a weird but the correct way to write a type. Right now the
AlignMultilineParametersFixerwill calculate the length of the type with all those tabulation spaces and put the names of the parameters really far away to the left.The PHP-CS-Fixer's
TypesSpacesFixerdoesn't fix such multiline type declarations and I didn't find any other fixer suited for this task, so it seems that this code was left on the user's side.It seems that I can calculate the length of each line and take the longest line as the type length:
But I'm not sure about this solution at this moment. So I'll leave this issue open until somebody also occurs this in a real code and gives me some feedback about expected behavior.