Skip to content

Commit 0f91d88

Browse files
committed
Clean up NullWriter references
1 parent 6fbe589 commit 0f91d88

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

cli/includes/helpers.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
/**
3333
* Set or get a global console writer.
3434
*
35-
* @param null|Symfony\Component\Console\Output\ConsoleOutputInterface $writer
36-
* @return Symfony\Component\Console\Output\ConsoleOutputInterface
35+
* @param null|OutputInterface $writer
36+
* @return OutputInterface|\NullWriter|null
3737
*/
3838
function writer($writer = null)
3939
{
@@ -47,9 +47,11 @@ function writer($writer = null)
4747
return $container->make('writer');
4848
}
4949

50-
return Container::getInstance()->instance('writer', $writer);
50+
$container->instance('writer', $writer);
51+
return null;
5152
}
5253

54+
5355
/**
5456
* Output the given text to the console.
5557
*

tests/UsesNullWriter.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ trait UsesNullWriter
66
{
77
public function setNullWriter()
88
{
9-
Container::getInstance()->instance('writer', new class
10-
{
11-
public function writeLn($msg)
12-
{
13-
// do nothing
14-
}
15-
});
9+
Container::getInstance()->instance('writer', new NullWriter);
10+
}
11+
}
12+
13+
class NullWriter
14+
{
15+
public function writeLn($msg)
16+
{
17+
// do nothing
1618
}
1719
}

0 commit comments

Comments
 (0)