Open avdeev-ms opened 1 year ago
Could you share exact code of where current behavior fails?
Setting LineLengthFixer in ecs config (no inline_short_lines, default line length: 120):
$services->set(LineLengthFixer::class)->call(
'configure',
[
[
'inline_short_lines' => false,
],
]
);
Run ecs on code example
class Example
{
public function decline()
{
//a line break will be inserted here
$this->getDefaultHttpException('Извините, произошла ошибка. Попробуйте позже.');
//no line break will be inserted here
$this->getDefaultHttpException('Sorry, an unexpected error occurred. Please try later.');
}
}
The result will be
//a line break will be inserted here
- $this->getDefaultHttpException('Извините, произошла ошибка. Попробуйте позже.');
+ $this->getDefaultHttpException(
+ 'Извините, произошла ошибка. Попробуйте позже.',
+ );
//no line break will be inserted here
$this->getDefaultHttpException('Sorry, an unexpected error occurred. Please try later.');
I see, it seems valid. Feel free to add this feature with the test fixture you've provided :+1:
No utf8 support for LineLengthFixer. The length of the strings is not correctly calculated, because of this, an extra line break is set, where it is not necessary.
The solution would be \Symplify\CodingStandard\TokenRunner\Transformer\FixerTransformer\FirstLineLengthResolver class to use the mb_strlen function instead of strlen, or be able to configure this behavior