From 5384a14dbdb934f2bb7c445bf6e8396abe580e53 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Tue, 26 Sep 2023 11:23:13 -0400 Subject: [PATCH] PHPLIB-1143: Renamed add_logger() and remove_logger() functions This renames the camelCase names introduced in 1acfab001810504214da8617e1500168086f7074 to snake_case, which is consistent with other functions. --- src/functions.php | 4 ++-- tests/LogNonGenuineHostTest.php | 8 ++++---- tests/PsrLogAdapterTest.php | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/functions.php b/src/functions.php index fbe712270..90420c81d 100644 --- a/src/functions.php +++ b/src/functions.php @@ -53,7 +53,7 @@ * Calling this method again with a logger that has already been added will have * no effect. */ -function addLogger(LoggerInterface $logger): void +function add_logger(LoggerInterface $logger): void { PsrLogAdapter::addLogger($logger); } @@ -64,7 +64,7 @@ function addLogger(LoggerInterface $logger): void * Calling this method with a logger that has not been added will have no * effect. */ -function removeLogger(LoggerInterface $logger): void +function remove_logger(LoggerInterface $logger): void { PsrLogAdapter::removeLogger($logger); } diff --git a/tests/LogNonGenuineHostTest.php b/tests/LogNonGenuineHostTest.php index bef29f27b..4991b2339 100644 --- a/tests/LogNonGenuineHostTest.php +++ b/tests/LogNonGenuineHostTest.php @@ -8,8 +8,8 @@ use Psr\Log\LoggerInterface; use function func_get_args; -use function MongoDB\addLogger; -use function MongoDB\removeLogger; +use function MongoDB\add_logger; +use function MongoDB\remove_logger; /** @see https://jira.mongodb.org/browse/DRIVERS-2583 */ class LogNonGenuineHostTest extends TestCase @@ -20,12 +20,12 @@ public function setUp(): void { $this->logger = $this->createTestPsrLogger(); - addLogger($this->logger); + add_logger($this->logger); } public function tearDown(): void { - removeLogger($this->logger); + remove_logger($this->logger); } /** @dataProvider provideCosmosUris */ diff --git a/tests/PsrLogAdapterTest.php b/tests/PsrLogAdapterTest.php index cd3aa2c03..5e945dd62 100644 --- a/tests/PsrLogAdapterTest.php +++ b/tests/PsrLogAdapterTest.php @@ -11,9 +11,9 @@ use Psr\Log\LogLevel; use function func_get_args; -use function MongoDB\addLogger; +use function MongoDB\add_logger; use function MongoDB\Driver\Monitoring\mongoc_log; -use function MongoDB\removeLogger; +use function MongoDB\remove_logger; use function sprintf; class PsrLogAdapterTest extends BaseTestCase @@ -39,12 +39,12 @@ public function testAddAndRemoveLoggerFunctions(): void mongoc_log(LogSubscriber::LEVEL_INFO, 'domain1', 'info1'); PsrLogAdapter::writeLog(PsrLogAdapter::INFO, 'domain2', 'info2'); - addLogger($logger); + add_logger($logger); mongoc_log(LogSubscriber::LEVEL_INFO, 'domain3', 'info3'); PsrLogAdapter::writeLog(PsrLogAdapter::INFO, 'domain4', 'info4'); - removeLogger($logger); + remove_logger($logger); mongoc_log(LogSubscriber::LEVEL_INFO, 'domain5', 'info5'); PsrLogAdapter::writeLog(PsrLogAdapter::INFO, 'domain6', 'info6');