Skip to content

Commit ab0430a

Browse files
committed
Enable multiline_string_to_heredoc
1 parent f53a105 commit ab0430a

File tree

5 files changed

+69
-48
lines changed

5 files changed

+69
-48
lines changed

src/Ruleset/Nexus80.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ public function __construct()
237237
'modernize_strpos' => true,
238238
'modernize_types_casting' => true,
239239
'multiline_comment_opening_closing' => true,
240+
'multiline_string_to_heredoc' => true,
240241
'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'],
241242
'native_constant_invocation' => [
242243
'fix_built_in' => false,

src/Ruleset/Nexus81.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ public function __construct()
237237
'modernize_strpos' => true,
238238
'modernize_types_casting' => true,
239239
'multiline_comment_opening_closing' => true,
240+
'multiline_string_to_heredoc' => true,
240241
'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'],
241242
'native_constant_invocation' => [
242243
'fix_built_in' => false,

src/Ruleset/Nexus82.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ public function __construct()
237237
'modernize_strpos' => true,
238238
'modernize_types_casting' => true,
239239
'multiline_comment_opening_closing' => true,
240+
'multiline_string_to_heredoc' => true,
240241
'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'],
241242
'native_constant_invocation' => [
242243
'fix_built_in' => false,

tests/Fixer/Comment/NoCodeSeparatorCommentFixerTest.php

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,48 +36,58 @@ public function testFix(string $expected, ?string $input = null): void
3636
public static function provideFixCases(): iterable
3737
{
3838
yield [
39-
'<?php
39+
<<<'EOD'
40+
<?php
4041
41-
$a = [];
42-
',
43-
'<?php
42+
$a = [];
4443

45-
//---------------------
46-
$a = [];
47-
',
44+
EOD,
45+
<<<'EOD'
46+
<?php
47+
48+
//---------------------
49+
$a = [];
50+
51+
EOD,
4852
];
4953

5054
yield [
51-
'<?php
55+
<<<'EOD'
56+
<?php
57+
58+
// - a comment
59+
$arr = [];
5260

53-
// - a comment
54-
$arr = [];
55-
',
61+
EOD,
5662
];
5763

5864
yield [
59-
'<?php
65+
<<<'EOD'
66+
<?php
67+
68+
//=======================
69+
// A Section
70+
//=======================
71+
72+
$a = 1;
6073
61-
//=======================
62-
// A Section
63-
//=======================
74+
$b = 2;
6475

65-
$a = 1;
76+
EOD,
77+
<<<'EOD'
78+
<?php
6679
67-
$b = 2;
68-
',
69-
'<?php
80+
//=======================
81+
// A Section
82+
//=======================
7083
71-
//=======================
72-
// A Section
73-
//=======================
84+
$a = 1;
7485
75-
$a = 1;
86+
//-----------------------
7687
77-
//-----------------------
88+
$b = 2;
7889

79-
$b = 2;
80-
',
90+
EOD,
8191
];
8292
}
8393
}

tests/Fixer/Comment/SpaceAfterCommentStartFixerTest.php

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@ public static function provideFixCases(): iterable
4040
];
4141

4242
yield 'code-separator' => [
43-
'<?php
43+
<<<'EOD'
44+
<?php
4445
45-
//-------------------------------
46+
//-------------------------------
4647
47-
//===============================
48-
',
48+
//===============================
49+
50+
EOD,
4951
];
5052

5153
yield 'no-space' => [
@@ -68,28 +70,34 @@ public static function provideFixCases(): iterable
6870
];
6971

7072
yield 'multi-lined' => [
71-
'<?php
72-
73-
// a comment
74-
//
75-
// another comment
76-
',
77-
'<?php
78-
79-
//a comment
80-
//
81-
// another comment
82-
',
73+
<<<'EOD'
74+
<?php
75+
76+
// a comment
77+
//
78+
// another comment
79+
80+
EOD,
81+
<<<'EOD'
82+
<?php
83+
84+
//a comment
85+
//
86+
// another comment
87+
88+
EOD,
8389
];
8490

8591
yield 'multi-empty' => [
86-
'<?php
92+
<<<'EOD'
93+
<?php
94+
95+
//
96+
//
97+
//
98+
// a comment
8799

88-
//
89-
//
90-
//
91-
// a comment
92-
',
100+
EOD,
93101
];
94102
}
95103
}

0 commit comments

Comments
 (0)