Skip to content

Commit

Permalink
Renamed Null log writer to Noop
Browse files Browse the repository at this point in the history
`null` will be a reserved keyword in PHP 7; this patch renames the `Null` log
writer to `Noop` (as it performs a no-op). A later patch will re-define the
`Null` writer to extend `Noop` and emit a deprecation notice.
  • Loading branch information
weierophinney committed Mar 25, 2015
1 parent 6972652 commit 7410c83
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Zend\Log\Writer;

class Null extends AbstractWriter
class Noop extends AbstractWriter
{
/**
* Write a message to the log.
Expand Down
7 changes: 6 additions & 1 deletion library/Zend/Log/WriterPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@

class WriterPluginManager extends AbstractPluginManager
{
protected $aliases = array(
'null' => 'noop',
'Zend\Log\Writer\Null' => 'noop',
);

/**
* Default set of writers
*
Expand All @@ -25,7 +30,7 @@ class WriterPluginManager extends AbstractPluginManager
'firephp' => 'Zend\Log\Writer\FirePhp',
'mail' => 'Zend\Log\Writer\Mail',
'mock' => 'Zend\Log\Writer\Mock',
'null' => 'Zend\Log\Writer\Null',
'noop' => 'Zend\Log\Writer\Noop',
'stream' => 'Zend\Log\Writer\Stream',
'syslog' => 'Zend\Log\Writer\Syslog',
'zendmonitor' => 'Zend\Log\Writer\ZendMonitor',
Expand Down
6 changes: 3 additions & 3 deletions tests/ZendTest/Log/LoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function testSetWriters()
$writers = $this->logger->getWriters();
$this->assertInstanceOf('Zend\Stdlib\SplPriorityQueue', $writers);
$writer = $writers->extract();
$this->assertTrue($writer instanceof \Zend\Log\Writer\Null);
$this->assertTrue($writer instanceof \Zend\Log\Writer\Noop);
$writer = $writers->extract();
$this->assertTrue($writer instanceof \Zend\Log\Writer\Mock);
}
Expand All @@ -120,7 +120,7 @@ public function testAddWriterWithPriority()

$this->assertInstanceOf('Zend\Stdlib\SplPriorityQueue', $writers);
$writer = $writers->extract();
$this->assertTrue($writer instanceof \Zend\Log\Writer\Null);
$this->assertTrue($writer instanceof \Zend\Log\Writer\Noop);
$writer = $writers->extract();
$this->assertTrue($writer instanceof \Zend\Log\Writer\Mock);
}
Expand All @@ -137,7 +137,7 @@ public function testAddWithSamePriority()
$writer = $writers->extract();
$this->assertTrue($writer instanceof \Zend\Log\Writer\Mock);
$writer = $writers->extract();
$this->assertTrue($writer instanceof \Zend\Log\Writer\Null);
$this->assertTrue($writer instanceof \Zend\Log\Writer\Noop);
}

public function testLogging()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

namespace ZendTest\Log\Writer;

use Zend\Log\Writer\Null as NullWriter;
use Zend\Log\Writer\Noop as NoopWriter;

/**
* @group Zend_Log
*/
class NullTest extends \PHPUnit_Framework_TestCase
class NoopTest extends \PHPUnit_Framework_TestCase
{
public function testWrite()
{
$writer = new NullWriter();
$writer = new NoopWriter();
$writer->write(array('message' => 'foo', 'priority' => 42));
}
}

0 comments on commit 7410c83

Please sign in to comment.