Skip to content

Commit 57c222e

Browse files
committed
IgnoreList: add private constructor
1 parent 29e2f49 commit 57c222e

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/Util/IgnoreList.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ final class IgnoreList
3333
private $data = [ '.default' => false ];
3434

3535

36+
/**
37+
* Prohibit direct instantiation of this class. Use the static `get[New]Instance*()` entry point methods instead.
38+
*/
39+
private function __construct()
40+
{
41+
42+
}//end __construct()
43+
44+
3645
/**
3746
* Get an instance set to ignore nothing.
3847
*

tests/Core/Util/IgnoreList/CheckAndSetTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CheckAndSetTest extends TestCase
3333
*/
3434
public function testCheckAndSet($toSet, $toCheck)
3535
{
36-
$ignoreList = new IgnoreList();
36+
$ignoreList = IgnoreList::getNewInstanceFrom(null);
3737
foreach ($toSet as $code => $ignore) {
3838
$this->assertSame($ignoreList, $ignoreList->set($code, $ignore), 'Set method returned $this');
3939
}

tests/Core/Util/IgnoreList/IgnoresNothingAndEverythingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function dataIgnoresNothingAndEverything()
5151
{
5252
return [
5353
'fresh list' => [
54-
new IgnoreList(),
54+
IgnoreList::getNewInstanceFrom(null),
5555
true,
5656
false,
5757
],

0 commit comments

Comments
 (0)