From 159e4893e82abfa23c84a06587ce5bfd4b7d8d13 Mon Sep 17 00:00:00 2001 From: Leander Huysse Date: Mon, 5 Aug 2024 20:26:49 +0200 Subject: [PATCH] Fixes #892 - Push Psr\Log to custom namespace to prevent dependency conflicts --- composer.json | 9 +- composer.lock | 104 ++++++------- lib/packages/Psr/Log/AbstractLogger.php | 128 +++++++++++++++ .../Psr/Log/InvalidArgumentException.php | 7 + lib/packages/Psr/Log/LogLevel.php | 18 +++ lib/packages/Psr/Log/LoggerAwareInterface.php | 18 +++ lib/packages/Psr/Log/LoggerAwareTrait.php | 26 ++++ lib/packages/Psr/Log/LoggerInterface.php | 125 +++++++++++++++ lib/packages/Psr/Log/LoggerTrait.php | 142 +++++++++++++++++ lib/packages/Psr/Log/NullLogger.php | 30 ++++ lib/packages/Psr/Log/Test/DummyTest.php | 18 +++ .../Psr/Log/Test/LoggerInterfaceTest.php | 138 ++++++++++++++++ lib/packages/Psr/Log/Test/TestLogger.php | 147 ++++++++++++++++++ .../ApplePayButton/AppleAjaxRequests.php | 2 +- .../ApplePayButton/ApplePayDataObjectHttp.php | 4 +- .../ApplePayButton/ResponsesToApple.php | 2 +- .../PayPalButton/PayPalAjaxRequests.php | 4 +- .../PayPalButton/PayPalDataObjectHttp.php | 4 +- src/Gateway/GatewayModule.php | 2 +- src/Gateway/MolliePaymentGateway.php | 2 +- src/Log/LogModule.php | 6 +- src/Log/WcPsrLoggerAdapter.php | 6 +- .../Action/AbstractPaymentCaptureAction.php | 2 +- src/MerchantCapture/MerchantCaptureModule.php | 2 +- src/Payment/MollieObject.php | 2 +- src/Payment/MollieOrder.php | 2 +- src/Payment/MollieOrderService.php | 4 +- src/Payment/MolliePayment.php | 2 +- src/Payment/PaymentFieldsService.php | 2 +- src/Payment/PaymentModule.php | 4 +- src/Payment/PaymentService.php | 4 +- src/Settings/SettingsModule.php | 2 +- src/Shared/Data.php | 4 +- src/Shared/SharedModule.php | 2 +- .../MollieSepaRecurringGateway.php | 4 +- .../MollieSubscriptionGateway.php | 4 +- src/Subscription/SubscriptionModule.php | 4 +- 37 files changed, 892 insertions(+), 94 deletions(-) create mode 100644 lib/packages/Psr/Log/AbstractLogger.php create mode 100644 lib/packages/Psr/Log/InvalidArgumentException.php create mode 100644 lib/packages/Psr/Log/LogLevel.php create mode 100644 lib/packages/Psr/Log/LoggerAwareInterface.php create mode 100644 lib/packages/Psr/Log/LoggerAwareTrait.php create mode 100644 lib/packages/Psr/Log/LoggerInterface.php create mode 100644 lib/packages/Psr/Log/LoggerTrait.php create mode 100644 lib/packages/Psr/Log/NullLogger.php create mode 100644 lib/packages/Psr/Log/Test/DummyTest.php create mode 100644 lib/packages/Psr/Log/Test/LoggerInterfaceTest.php create mode 100644 lib/packages/Psr/Log/Test/TestLogger.php diff --git a/composer.json b/composer.json index 0fbd7da98..fba4ea9b5 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,7 @@ "php": ">=7.2", "ext-intl": "*", "ext-json": "*", - "mollie/mollie-api-php": "^v2.40", - "psr/log":"^1.1.4" + "mollie/mollie-api-php": "^v2.40" }, "require-dev": { "inpsyde/modularity": "^1.3.0", @@ -34,7 +33,8 @@ "inpsyde/composer-assets-compiler": "^2.5", "php-stubs/wordpress-stubs": "^5.0@stable", "php-stubs/woocommerce-stubs": "7.9.0", - "vimeo/psalm": "^4.8 || ^5.13.0" + "vimeo/psalm": "^4.8 || ^5.13.0", + "psr/log": "^1.1.4" }, "autoload": { "psr-4": { @@ -85,7 +85,8 @@ "classmap_directory": "/lib/classes/", "classmap_prefix": "MOL_", "packages": [ - "psr/container", + "psr/container", + "psr/log", "inpsyde/modularity" ], "delete_vendor_directories": true diff --git a/composer.lock b/composer.lock index f905d204a..0eb15e307 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "99dd93462bdd098a3d12154b8e71b543", + "content-hash": "ae901b3dd1c50deb389754ccb2ee83db", "packages": [ { "name": "composer/ca-bundle", @@ -173,56 +173,6 @@ "source": "https://github.com/mollie/mollie-api-php/tree/v2.61.0" }, "time": "2023-07-31T15:37:46+00:00" - }, - { - "name": "psr/log", - "version": "1.1.4", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" - }, - "time": "2021-05-03T11:20:27+00:00" } ], "packages-dev": [ @@ -2699,6 +2649,56 @@ }, "time": "2017-02-14T16:28:37+00:00" }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + }, { "name": "ptrofimov/xpmock", "version": "1.1.5", @@ -4735,5 +4735,5 @@ "ext-json": "*" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/lib/packages/Psr/Log/AbstractLogger.php b/lib/packages/Psr/Log/AbstractLogger.php new file mode 100644 index 000000000..91f433afb --- /dev/null +++ b/lib/packages/Psr/Log/AbstractLogger.php @@ -0,0 +1,128 @@ +log(LogLevel::EMERGENCY, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function alert($message, array $context = array()) + { + $this->log(LogLevel::ALERT, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function critical($message, array $context = array()) + { + $this->log(LogLevel::CRITICAL, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function error($message, array $context = array()) + { + $this->log(LogLevel::ERROR, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function warning($message, array $context = array()) + { + $this->log(LogLevel::WARNING, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function notice($message, array $context = array()) + { + $this->log(LogLevel::NOTICE, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function info($message, array $context = array()) + { + $this->log(LogLevel::INFO, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param mixed[] $context + * + * @return void + */ + public function debug($message, array $context = array()) + { + $this->log(LogLevel::DEBUG, $message, $context); + } +} diff --git a/lib/packages/Psr/Log/InvalidArgumentException.php b/lib/packages/Psr/Log/InvalidArgumentException.php new file mode 100644 index 000000000..e9737d234 --- /dev/null +++ b/lib/packages/Psr/Log/InvalidArgumentException.php @@ -0,0 +1,7 @@ +logger = $logger; + } +} diff --git a/lib/packages/Psr/Log/LoggerInterface.php b/lib/packages/Psr/Log/LoggerInterface.php new file mode 100644 index 000000000..19233090f --- /dev/null +++ b/lib/packages/Psr/Log/LoggerInterface.php @@ -0,0 +1,125 @@ +log(LogLevel::EMERGENCY, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function alert($message, array $context = array()) + { + $this->log(LogLevel::ALERT, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function critical($message, array $context = array()) + { + $this->log(LogLevel::CRITICAL, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function error($message, array $context = array()) + { + $this->log(LogLevel::ERROR, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function warning($message, array $context = array()) + { + $this->log(LogLevel::WARNING, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function notice($message, array $context = array()) + { + $this->log(LogLevel::NOTICE, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function info($message, array $context = array()) + { + $this->log(LogLevel::INFO, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param array $context + * + * @return void + */ + public function debug($message, array $context = array()) + { + $this->log(LogLevel::DEBUG, $message, $context); + } + + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string $message + * @param array $context + * + * @return void + * + * @throws \Mollie\WooCommerce\Vendor\Psr\Log\InvalidArgumentException + */ + abstract public function log($level, $message, array $context = array()); +} diff --git a/lib/packages/Psr/Log/NullLogger.php b/lib/packages/Psr/Log/NullLogger.php new file mode 100644 index 000000000..2fad9e527 --- /dev/null +++ b/lib/packages/Psr/Log/NullLogger.php @@ -0,0 +1,30 @@ +logger) { }` + * blocks. + */ +class NullLogger extends AbstractLogger +{ + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string $message + * @param array $context + * + * @return void + * + * @throws \Mollie\WooCommerce\Vendor\Psr\Log\InvalidArgumentException + */ + public function log($level, $message, array $context = array()) + { + // noop + } +} diff --git a/lib/packages/Psr/Log/Test/DummyTest.php b/lib/packages/Psr/Log/Test/DummyTest.php new file mode 100644 index 000000000..c388615e8 --- /dev/null +++ b/lib/packages/Psr/Log/Test/DummyTest.php @@ -0,0 +1,18 @@ + ". + * + * Example ->error('Foo') would yield "error Foo". + * + * @return string[] + */ + abstract public function getLogs(); + + public function testImplements() + { + $this->assertInstanceOf('Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface', $this->getLogger()); + } + + /** + * @dataProvider provideLevelsAndMessages + */ + public function testLogsAtAllLevels($level, $message) + { + $logger = $this->getLogger(); + $logger->{$level}($message, array('user' => 'Bob')); + $logger->log($level, $message, array('user' => 'Bob')); + + $expected = array( + $level.' message of level '.$level.' with context: Bob', + $level.' message of level '.$level.' with context: Bob', + ); + $this->assertEquals($expected, $this->getLogs()); + } + + public function provideLevelsAndMessages() + { + return array( + LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), + LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), + LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), + LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), + LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), + LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), + LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), + LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), + ); + } + + /** + * @expectedException \Mollie\WooCommerce\Vendor\Psr\Log\InvalidArgumentException + */ + public function testThrowsOnInvalidLevel() + { + $logger = $this->getLogger(); + $logger->log('invalid level', 'Foo'); + } + + public function testContextReplacement() + { + $logger = $this->getLogger(); + $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); + + $expected = array('info {Message {nothing} Bob Bar a}'); + $this->assertEquals($expected, $this->getLogs()); + } + + public function testObjectCastToString() + { + if (method_exists($this, 'createPartialMock')) { + $dummy = $this->createPartialMock('Mollie\WooCommerce\Vendor\Psr\Log\Test\DummyTest', array('__toString')); + } else { + $dummy = $this->getMock('Mollie\WooCommerce\Vendor\Psr\Log\Test\DummyTest', array('__toString')); + } + $dummy->expects($this->once()) + ->method('__toString') + ->will($this->returnValue('DUMMY')); + + $this->getLogger()->warning($dummy); + + $expected = array('warning DUMMY'); + $this->assertEquals($expected, $this->getLogs()); + } + + public function testContextCanContainAnything() + { + $closed = fopen('php://memory', 'r'); + fclose($closed); + + $context = array( + 'bool' => true, + 'null' => null, + 'string' => 'Foo', + 'int' => 0, + 'float' => 0.5, + 'nested' => array('with object' => new DummyTest), + 'object' => new \DateTime, + 'resource' => fopen('php://memory', 'r'), + 'closed' => $closed, + ); + + $this->getLogger()->warning('Crazy context data', $context); + + $expected = array('warning Crazy context data'); + $this->assertEquals($expected, $this->getLogs()); + } + + public function testContextExceptionKeyCanBeExceptionOrOtherValues() + { + $logger = $this->getLogger(); + $logger->warning('Random message', array('exception' => 'oops')); + $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); + + $expected = array( + 'warning Random message', + 'critical Uncaught Exception!' + ); + $this->assertEquals($expected, $this->getLogs()); + } +} diff --git a/lib/packages/Psr/Log/Test/TestLogger.php b/lib/packages/Psr/Log/Test/TestLogger.php new file mode 100644 index 000000000..ea7117a49 --- /dev/null +++ b/lib/packages/Psr/Log/Test/TestLogger.php @@ -0,0 +1,147 @@ + $level, + 'message' => $message, + 'context' => $context, + ]; + + $this->recordsByLevel[$record['level']][] = $record; + $this->records[] = $record; + } + + public function hasRecords($level) + { + return isset($this->recordsByLevel[$level]); + } + + public function hasRecord($record, $level) + { + if (is_string($record)) { + $record = ['message' => $record]; + } + return $this->hasRecordThatPasses(function ($rec) use ($record) { + if ($rec['message'] !== $record['message']) { + return false; + } + if (isset($record['context']) && $rec['context'] !== $record['context']) { + return false; + } + return true; + }, $level); + } + + public function hasRecordThatContains($message, $level) + { + return $this->hasRecordThatPasses(function ($rec) use ($message) { + return strpos($rec['message'], $message) !== false; + }, $level); + } + + public function hasRecordThatMatches($regex, $level) + { + return $this->hasRecordThatPasses(function ($rec) use ($regex) { + return preg_match($regex, $rec['message']) > 0; + }, $level); + } + + public function hasRecordThatPasses(callable $predicate, $level) + { + if (!isset($this->recordsByLevel[$level])) { + return false; + } + foreach ($this->recordsByLevel[$level] as $i => $rec) { + if (call_user_func($predicate, $rec, $i)) { + return true; + } + } + return false; + } + + public function __call($method, $args) + { + if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { + $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; + $level = strtolower($matches[2]); + if (method_exists($this, $genericMethod)) { + $args[] = $level; + return call_user_func_array([$this, $genericMethod], $args); + } + } + throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); + } + + public function reset() + { + $this->records = []; + $this->recordsByLevel = []; + } +} diff --git a/src/Buttons/ApplePayButton/AppleAjaxRequests.php b/src/Buttons/ApplePayButton/AppleAjaxRequests.php index 6643cffe1..ebf297bf1 100644 --- a/src/Buttons/ApplePayButton/AppleAjaxRequests.php +++ b/src/Buttons/ApplePayButton/AppleAjaxRequests.php @@ -10,7 +10,7 @@ use Mollie\WooCommerce\SDK\Api; use Mollie\WooCommerce\Settings\Settings; use Mollie\WooCommerce\Shared\GatewaySurchargeHandler; -use Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; use WC_Cart; use WC_Data_Exception; diff --git a/src/Buttons/ApplePayButton/ApplePayDataObjectHttp.php b/src/Buttons/ApplePayButton/ApplePayDataObjectHttp.php index db7f6919b..8399a79ec 100644 --- a/src/Buttons/ApplePayButton/ApplePayDataObjectHttp.php +++ b/src/Buttons/ApplePayButton/ApplePayDataObjectHttp.php @@ -4,8 +4,8 @@ namespace Mollie\WooCommerce\Buttons\ApplePayButton; -use Psr\Log\LoggerInterface as Logger; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; class ApplePayDataObjectHttp { diff --git a/src/Buttons/ApplePayButton/ResponsesToApple.php b/src/Buttons/ApplePayButton/ResponsesToApple.php index b4b580c2b..bd098f60c 100644 --- a/src/Buttons/ApplePayButton/ResponsesToApple.php +++ b/src/Buttons/ApplePayButton/ResponsesToApple.php @@ -5,7 +5,7 @@ namespace Mollie\WooCommerce\Buttons\ApplePayButton; use Mollie\WooCommerce\Gateway\MolliePaymentGatewayI; -use Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; class ResponsesToApple { diff --git a/src/Buttons/PayPalButton/PayPalAjaxRequests.php b/src/Buttons/PayPalButton/PayPalAjaxRequests.php index 17f231bc9..2b89bb5a9 100644 --- a/src/Buttons/PayPalButton/PayPalAjaxRequests.php +++ b/src/Buttons/PayPalButton/PayPalAjaxRequests.php @@ -7,8 +7,8 @@ use Mollie\WooCommerce\Gateway\Surcharge; use Mollie\WooCommerce\Notice\NoticeInterface; use Mollie\WooCommerce\Shared\GatewaySurchargeHandler; -use Psr\Log\LoggerInterface as Logger; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; use WC_Data_Exception; class PayPalAjaxRequests diff --git a/src/Buttons/PayPalButton/PayPalDataObjectHttp.php b/src/Buttons/PayPalButton/PayPalDataObjectHttp.php index 03320c26c..7337adf57 100644 --- a/src/Buttons/PayPalButton/PayPalDataObjectHttp.php +++ b/src/Buttons/PayPalButton/PayPalDataObjectHttp.php @@ -4,8 +4,8 @@ namespace Mollie\WooCommerce\Buttons\PayPalButton; -use Psr\Log\LoggerInterface as Logger; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; class PayPalDataObjectHttp { diff --git a/src/Gateway/GatewayModule.php b/src/Gateway/GatewayModule.php index b97e58677..d93ecb2fe 100644 --- a/src/Gateway/GatewayModule.php +++ b/src/Gateway/GatewayModule.php @@ -42,7 +42,7 @@ use Mollie\WooCommerce\Subscription\MollieSubscriptionGateway; use Mollie\WooCommerce\PaymentMethods\Constants; use Mollie\WooCommerce\Vendor\Psr\Container\ContainerInterface; -use Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; use WP_Post; class GatewayModule implements ServiceModule, ExecutableModule diff --git a/src/Gateway/MolliePaymentGateway.php b/src/Gateway/MolliePaymentGateway.php index c9a729205..1d2a6c497 100644 --- a/src/Gateway/MolliePaymentGateway.php +++ b/src/Gateway/MolliePaymentGateway.php @@ -19,7 +19,7 @@ use Mollie\WooCommerce\SDK\HttpResponse; use Mollie\WooCommerce\Shared\Data; use Mollie\WooCommerce\Shared\SharedDataDictionary; -use Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; use UnexpectedValueException; use WC_Order; use WC_Payment_Gateway; diff --git a/src/Log/LogModule.php b/src/Log/LogModule.php index 4483f692f..74bc6886e 100644 --- a/src/Log/LogModule.php +++ b/src/Log/LogModule.php @@ -9,9 +9,9 @@ use Mollie\WooCommerce\Vendor\Inpsyde\Modularity\Module\ModuleClassNameIdTrait; use Mollie\WooCommerce\Vendor\Inpsyde\Modularity\Module\ServiceModule; use Mollie\WooCommerce\Vendor\Psr\Container\ContainerInterface; -use Psr\Log\AbstractLogger; -use Psr\Log\LoggerInterface as Logger; -use Psr\Log\NullLogger; +use Mollie\WooCommerce\Vendor\Psr\Log\AbstractLogger; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\NullLogger; class LogModule implements ServiceModule { diff --git a/src/Log/WcPsrLoggerAdapter.php b/src/Log/WcPsrLoggerAdapter.php index 781a872fc..85db050f1 100644 --- a/src/Log/WcPsrLoggerAdapter.php +++ b/src/Log/WcPsrLoggerAdapter.php @@ -5,9 +5,9 @@ namespace Mollie\WooCommerce\Log; use InvalidArgumentException; -use Psr\Log\AbstractLogger; -use Psr\Log\LoggerTrait; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\AbstractLogger; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerTrait; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; class WcPsrLoggerAdapter extends AbstractLogger { diff --git a/src/MerchantCapture/Capture/Action/AbstractPaymentCaptureAction.php b/src/MerchantCapture/Capture/Action/AbstractPaymentCaptureAction.php index 70d3ef8b8..3b33497c7 100644 --- a/src/MerchantCapture/Capture/Action/AbstractPaymentCaptureAction.php +++ b/src/MerchantCapture/Capture/Action/AbstractPaymentCaptureAction.php @@ -6,7 +6,7 @@ use Mollie\WooCommerce\SDK\Api; use Mollie\WooCommerce\Settings\Settings; -use Psr\Log\LoggerInterface; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface; class AbstractPaymentCaptureAction { diff --git a/src/MerchantCapture/MerchantCaptureModule.php b/src/MerchantCapture/MerchantCaptureModule.php index 0bdca1dfa..09f1ba70d 100644 --- a/src/MerchantCapture/MerchantCaptureModule.php +++ b/src/MerchantCapture/MerchantCaptureModule.php @@ -18,7 +18,7 @@ use Mollie\WooCommerce\Vendor\Inpsyde\Modularity\Module\ModuleClassNameIdTrait; use Mollie\WooCommerce\Vendor\Inpsyde\Modularity\Module\ServiceModule; use Mollie\WooCommerce\Vendor\Psr\Container\ContainerInterface; -use Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; use WC_Order; class MerchantCaptureModule implements ExecutableModule, ServiceModule diff --git a/src/Payment/MollieObject.php b/src/Payment/MollieObject.php index 7eac75ed1..2b7e12362 100644 --- a/src/Payment/MollieObject.php +++ b/src/Payment/MollieObject.php @@ -13,7 +13,7 @@ use Mollie\WooCommerce\Settings\Settings; use WC_Order; use WC_Payment_Gateway; -use Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; use stdClass; class MollieObject diff --git a/src/Payment/MollieOrder.php b/src/Payment/MollieOrder.php index 804e91b6a..5f7b5b3f6 100644 --- a/src/Payment/MollieOrder.php +++ b/src/Payment/MollieOrder.php @@ -13,7 +13,7 @@ use Mollie\WooCommerce\PaymentMethods\Voucher; use Mollie\WooCommerce\SDK\Api; use Mollie\WooCommerce\Shared\SharedDataDictionary; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; use WC_Order; use WP_Error; diff --git a/src/Payment/MollieOrderService.php b/src/Payment/MollieOrderService.php index ede0c6d05..2ee61b8ef 100644 --- a/src/Payment/MollieOrderService.php +++ b/src/Payment/MollieOrderService.php @@ -12,8 +12,8 @@ use Mollie\WooCommerce\SDK\HttpResponse; use Mollie\WooCommerce\Shared\Data; use Mollie\WooCommerce\Shared\SharedDataDictionary; -use Psr\Log\LoggerInterface as Logger; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; use WC_Order; class MollieOrderService diff --git a/src/Payment/MolliePayment.php b/src/Payment/MolliePayment.php index 0d319e54f..091b3290a 100644 --- a/src/Payment/MolliePayment.php +++ b/src/Payment/MolliePayment.php @@ -13,7 +13,7 @@ use Mollie\WooCommerce\PaymentMethods\Voucher; use Mollie\WooCommerce\SDK\Api; use Mollie\WooCommerce\Shared\SharedDataDictionary; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; use WC_Order; use WC_Payment_Gateway; use WC_Subscriptions_Manager; diff --git a/src/Payment/PaymentFieldsService.php b/src/Payment/PaymentFieldsService.php index c5eaebc3b..4f862b6cb 100644 --- a/src/Payment/PaymentFieldsService.php +++ b/src/Payment/PaymentFieldsService.php @@ -8,7 +8,7 @@ use Mollie\WooCommerce\PaymentMethods\PaymentFieldsStrategies\DefaultFieldsStrategy; use Mollie\WooCommerce\PaymentMethods\PaymentFieldsStrategies\PaymentFieldsStrategyI; use Mollie\WooCommerce\Shared\Data; -use Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; class PaymentFieldsService { diff --git a/src/Payment/PaymentModule.php b/src/Payment/PaymentModule.php index d7c92734c..92d7babfc 100644 --- a/src/Payment/PaymentModule.php +++ b/src/Payment/PaymentModule.php @@ -19,8 +19,8 @@ use Mollie\WooCommerce\Shared\Data; use Mollie\WooCommerce\Shared\SharedDataDictionary; use Mollie\WooCommerce\Vendor\Psr\Container\ContainerInterface; -use Psr\Log\LoggerInterface as Logger; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; use RuntimeException; use WC_Order; diff --git a/src/Payment/PaymentService.php b/src/Payment/PaymentService.php index f866de5fa..f16cba86b 100644 --- a/src/Payment/PaymentService.php +++ b/src/Payment/PaymentService.php @@ -16,8 +16,8 @@ use Mollie\WooCommerce\Shared\Data; use Mollie\WooCommerce\Shared\SharedDataDictionary; use Mollie\WooCommerce\PaymentMethods\Constants; -use Psr\Log\LoggerInterface as Logger; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; use WC_Order; class PaymentService diff --git a/src/Settings/SettingsModule.php b/src/Settings/SettingsModule.php index 9dffc59c2..fee2104a5 100644 --- a/src/Settings/SettingsModule.php +++ b/src/Settings/SettingsModule.php @@ -16,7 +16,7 @@ use Mollie\WooCommerce\Shared\Status; use Mollie\WooCommerce\Uninstall\CleanDb; use Mollie\WooCommerce\Vendor\Psr\Container\ContainerInterface; -use Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; class SettingsModule implements ServiceModule, ExecutableModule { diff --git a/src/Shared/Data.php b/src/Shared/Data.php index cea0c38d0..24bc1e19a 100644 --- a/src/Shared/Data.php +++ b/src/Shared/Data.php @@ -9,8 +9,8 @@ use Mollie\Api\Resources\Method; use Mollie\WooCommerce\SDK\Api; use Mollie\WooCommerce\Settings\Settings; -use Psr\Log\LoggerInterface as Logger; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; use WC_Customer; use WC_Order; diff --git a/src/Shared/SharedModule.php b/src/Shared/SharedModule.php index 8298c565c..5a2ab8aa5 100644 --- a/src/Shared/SharedModule.php +++ b/src/Shared/SharedModule.php @@ -12,7 +12,7 @@ use Mollie\Api\CompatibilityChecker; use Mollie\WooCommerce\SDK\Api; use Mollie\WooCommerce\Vendor\Psr\Container\ContainerInterface; -use Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; class SharedModule implements ServiceModule { diff --git a/src/Subscription/MollieSepaRecurringGateway.php b/src/Subscription/MollieSepaRecurringGateway.php index 86f856446..72efb2646 100644 --- a/src/Subscription/MollieSepaRecurringGateway.php +++ b/src/Subscription/MollieSepaRecurringGateway.php @@ -21,8 +21,8 @@ use Mollie\WooCommerce\SDK\HttpResponse; use Mollie\WooCommerce\Settings\Settings; use Mollie\WooCommerce\Shared\Data; -use Psr\Log\LoggerInterface as Logger; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; class MollieSepaRecurringGateway extends MollieSubscriptionGateway { diff --git a/src/Subscription/MollieSubscriptionGateway.php b/src/Subscription/MollieSubscriptionGateway.php index f62a6e839..97c6764c6 100644 --- a/src/Subscription/MollieSubscriptionGateway.php +++ b/src/Subscription/MollieSubscriptionGateway.php @@ -21,8 +21,8 @@ use Mollie\WooCommerce\SDK\InvalidApiKey; use Mollie\WooCommerce\Settings\Settings; use Mollie\WooCommerce\Shared\Data; -use Psr\Log\LoggerInterface as Logger; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; use Mollie\WooCommerce\PaymentMethods\Constants; use WC_Order; diff --git a/src/Subscription/SubscriptionModule.php b/src/Subscription/SubscriptionModule.php index 71511e286..81f16a64f 100644 --- a/src/Subscription/SubscriptionModule.php +++ b/src/Subscription/SubscriptionModule.php @@ -14,8 +14,8 @@ use Mollie\WooCommerce\Shared\Data; use Mollie\WooCommerce\Shared\SharedDataDictionary; use Mollie\WooCommerce\Vendor\Psr\Container\ContainerInterface; -use Psr\Log\LoggerInterface as Logger; -use Psr\Log\LogLevel; +use Mollie\WooCommerce\Vendor\Psr\Log\LoggerInterface as Logger; +use Mollie\WooCommerce\Vendor\Psr\Log\LogLevel; class SubscriptionModule implements ExecutableModule {