Skip to content

Commit 5b9078f

Browse files
authored
Merge pull request #180 from rodrigoprimo/improve-code-coverage-no-silenced-errors
Generic/NoSilencedErrors: improve test coverage
2 parents 638c0d7 + 3b2f88f commit 5b9078f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Standards/Generic/Tests/PHP/NoSilencedErrorsUnitTest.inc

+6
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ if (@in_array($array, $needle))
88
}
99

1010
$hasValue = @in_array(haystack: $array, needle: $needle);
11+
12+
// phpcs:set Generic.PHP.NoSilencedErrors error true
13+
$fileContent = @file_get_contents('non_existent_file.txt');
14+
// phpcs:set Generic.PHP.NoSilencedErrors error false
15+
16+
echo @$undefinedVariable;

src/Standards/Generic/Tests/PHP/NoSilencedErrorsUnitTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class NoSilencedErrorsUnitTest extends AbstractSniffUnitTest
3030
*/
3131
public function getErrorList()
3232
{
33-
return [];
33+
return [13 => 1];
3434

3535
}//end getErrorList()
3636

@@ -48,6 +48,7 @@ public function getWarningList()
4848
return [
4949
5 => 1,
5050
10 => 1,
51+
16 => 1,
5152
];
5253

5354
}//end getWarningList()

0 commit comments

Comments
 (0)