Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Commit ff85904

Browse files
committed
fix tests
1 parent 88b37e0 commit ff85904

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/Config.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private function getPsr2Rules()
123123
*/
124124
private function getSymfonyRules()
125125
{
126-
return [
126+
$rules = [
127127
'blank_line_after_opening_tag' => true,
128128
'blank_line_before_return' => true,
129129
'cast_spaces' => true,
@@ -177,7 +177,6 @@ private function getSymfonyRules()
177177
'self_accessor' => false,
178178
'short_scalar_cast' => true,
179179
'simplified_null_return' => true,
180-
'single_blank_line_before_namespace' => true,
181180
'single_quote' => true,
182181
'space_after_semicolon' => true,
183182
'standardize_not_equals' => true,
@@ -189,5 +188,13 @@ private function getSymfonyRules()
189188
'unary_operator_spaces' => true,
190189
'whitespace_after_comma_in_array' => true,
191190
];
191+
192+
if ($this->header !== null) {
193+
$rules['single_blank_line_before_namespace'] = true;
194+
} else {
195+
$rules['single_blank_line_before_namespace'] = false;
196+
}
197+
198+
return $rules;
192199
}
193200
}

tests/ConfigTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function testDoesNotHaveHeaderCommentFixerByDefault()
5555
$this->assertArrayHasKey('header_comment', $rules);
5656
$this->assertFalse($rules['header_comment']);
5757
$this->assertTrue($rules['no_blank_lines_before_namespace']);
58+
$this->assertFalse($rules['single_blank_line_before_namespace']);
5859
}
5960

6061
public function testHasHeaderCommentFixerIfProvided()
@@ -71,6 +72,7 @@ public function testHasHeaderCommentFixerIfProvided()
7172
];
7273
$this->assertSame($expected, $rules['header_comment']);
7374
$this->assertFalse($rules['no_blank_lines_before_namespace']);
75+
$this->assertTrue($rules['single_blank_line_before_namespace']);
7476
}
7577

7678
/**
@@ -211,7 +213,7 @@ private function getSymfonyRules()
211213
'self_accessor' => false,
212214
'short_scalar_cast' => true,
213215
'simplified_null_return' => true,
214-
'single_blank_line_before_namespace' => true,
216+
'single_blank_line_before_namespace' => false,
215217
'single_quote' => true,
216218
'space_after_semicolon' => true,
217219
'standardize_not_equals' => true,

0 commit comments

Comments
 (0)