Skip to content

Commit 940cf8c

Browse files
committed
Normalize ignore settings in FunctionLengthSniff
1 parent ce13288 commit 940cf8c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Inpsyde/Sniffs/CodeQuality/FunctionLengthSniff.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public function process(File $file, $position)
6565

6666
$ignored = [];
6767
$suffix = '';
68+
$this->normalizeIgnoreFlags();
6869
$this->ignoreBlankLines and $ignored[] = 'blank lines';
6970
$this->ignoreComments and $ignored[] = 'single line comments';
7071
$this->ignoreDocBlocks and $ignored[] = 'doc blocks';
@@ -197,4 +198,19 @@ private function docBlocksData(
197198

198199
return $docBlocks;
199200
}
201+
202+
private function normalizeIgnoreFlags()
203+
{
204+
$flags = [
205+
'ignoreBlankLines',
206+
'ignoreComments',
207+
'ignoreDocBlocks',
208+
];
209+
210+
foreach ($flags as $flag) {
211+
if (is_string($this->{$flag})) {
212+
$this->{$flag} = (bool)filter_var($this->{$flag}, FILTER_VALIDATE_BOOLEAN);
213+
}
214+
}
215+
}
200216
}

0 commit comments

Comments
 (0)