@@ -52,7 +52,7 @@ public function testConfigurationIsRequired(): void
5252 * @param TFormatterConfig $config
5353 * @dataProvider provideFixCases
5454 */
55- final public function testApplyFix (array $ config , string $ input , string $ expected ): void
55+ public function testApplyFix (array $ config , string $ input , string $ expected ): void
5656 {
5757 $ fixer = new BlockStringFixer ();
5858 $ tokens = Tokens::fromCode ($ input );
@@ -91,7 +91,7 @@ public static function provideFixCases(): iterable
9191 'HTML ' => new class extends AbstractCodecFormatter {
9292 public function __construct ()
9393 {
94- parent ::__construct ('1.0 ' , null );
94+ parent ::__construct ('1 ' );
9595 }
9696
9797 protected function formatContent (string $ original ): string
@@ -133,7 +133,7 @@ protected function formatContent(string $original): string
133133 new class extends AbstractCodecFormatter {
134134 public function __construct ()
135135 {
136- parent ::__construct ('1.0 ' , null );
136+ parent ::__construct ('2 ' );
137137 }
138138
139139 protected function formatContent (string $ original ): string
@@ -144,7 +144,7 @@ protected function formatContent(string $original): string
144144 'HTML ' => new class extends AbstractCodecFormatter {
145145 public function __construct ()
146146 {
147- parent ::__construct ('1.0 ' , null );
147+ parent ::__construct ('3 ' );
148148 }
149149
150150 protected function formatContent (string $ original ): string
@@ -180,7 +180,7 @@ protected function formatContent(string $original): string
180180 'HTML ' => new class extends AbstractCodecFormatter {
181181 public function __construct ()
182182 {
183- parent ::__construct ('1.0 ' , new GeneratedTokenCodec ());
183+ parent ::__construct ('4 ' , new GeneratedTokenCodec ());
184184 }
185185
186186 protected function formatContent (string $ original ): string
@@ -203,5 +203,25 @@ protected function formatContent(string $original): string
203203 HTML;
204204 PHP,
205205 ];
206+
207+ yield 'Windows-style newlines ' => [
208+ 'config ' => [
209+ 'formatters ' => [
210+ 'HTML ' => new class extends AbstractCodecFormatter {
211+ public function __construct ()
212+ {
213+ parent ::__construct ('5 ' );
214+ }
215+
216+ protected function formatContent (string $ original ): string
217+ {
218+ return strip_tags ($ original );
219+ }
220+ },
221+ ],
222+ ],
223+ 'input ' => "<?php \r\n\r\necho <<<'HTML' \r\n <h1>Hello world!</h1> \r\n HTML; \r\n" ,
224+ 'expected ' => "<?php \r\n\r\necho <<<'HTML' \r\n Hello world! \r\n HTML; \r\n" ,
225+ ];
206226 }
207227}
0 commit comments