diff --git a/CHANGELOG.md b/CHANGELOG.md index ad2c5d3a..e8d6bc19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# Version 18.0.0 + +### PHP 8.1 Compatibility + +* Update dependencies +* Add PHP ">=8.1" support +* Remove PHP 7.3 support +* Fix compatiility import logger with monolog/monolog + # Version 17.8.3 ## Bugfixes diff --git a/composer.json b/composer.json index ed06e2e2..9d835feb 100755 --- a/composer.json +++ b/composer.json @@ -3,36 +3,36 @@ "description": "A library supporting generic Magento 2 import functionality", "license": "MIT", "require": { - "php": ">=7.3.0", - "psr/log": "~1.0|~2.0|~3.0", - "psr/cache" : "~1.0|~2.0|~3.0", - "psr/container": "1.1.1", - "handcraftedinthealps/goodby-csv": "^1.4.0", - "monolog/monolog": "~1.0|~2.3", - "league/event": "~2.0", - "ramsey/uuid": "^3.7|^3.8|^4.1|^4.2", - "swiftmailer/swiftmailer": "^6.2.5", - "laminas/laminas-filter": "~2.0", - "techdivision/import-dbal": "^1.0.0", - "techdivision/import-dbal-collection": "^1.0.0", - "techdivision/import-cache": "^1.0.0", - "techdivision/import-cache-collection": "^1.0.0", - "techdivision/import-serializer": "^1.0.0", - "techdivision/import-serializer-csv": "^1.0.0", - "techdivision/import-configuration": "^5.0.0", + "php": "^8.1", + "psr/log": "^1.0.0|^2.0.0|^3.0.0", + "psr/cache" : "^2.0.0|^3.0.0", + "psr/container": "^1.1.2", + "handcraftedinthealps/goodby-csv": "^1.4.2", + "monolog/monolog": "^2.9|^3.7", + "league/event": "^2.2.0", + "ramsey/uuid": "^4.2|^4.7", + "swiftmailer/swiftmailer": "v6.3.0", + "laminas/laminas-filter": "^2.31.0", + "techdivision/import-dbal": "^2.0.0", + "techdivision/import-dbal-collection": "^2.0.0", + "techdivision/import-cache": "^2.0.0", + "techdivision/import-cache-collection": "^2.0.0", + "techdivision/import-serializer": "^2.0.0", + "techdivision/import-serializer-csv": "^2.0.0", + "techdivision/import-configuration": "^6.0.0.", "ext-json": "*", "ext-zip": "*" }, "require-dev": { - "doctrine/dbal": "2.5.*", - "pdepend/pdepend": "2.5.2", - "phpmd/phpmd": "@stable", - "phpunit/phpunit": "^6.5.0|^8.0.0|~9.5.0", - "sebastian/phpcpd": "~3.0|~4.0|~5.0|~6.0", - "squizlabs/php_codesniffer": "~3.4.0|~3.6.0", - "consolidation/robo": "~1.0", - "mikey179/vfsstream": "~1.0", - "symfony/http-kernel": "~2.0|~3.0|~4.0" + "doctrine/dbal": "^4.0.4", + "pdepend/pdepend": "^2.16.2", + "phpmd/phpmd": "^2.15.0", + "phpunit/phpunit": "^11.2.5", + "sebastian/phpcpd": "^2.0.1", + "squizlabs/php_codesniffer": "^3.10.1", + "consolidation/robo": "^4.0.2", + "mikey179/vfsstream": "~1.6.11", + "symfony/http-kernel": "~4.4.51" }, "authors": [ { diff --git a/src/Loggers/Handlers/HandlerWrapper.php b/src/Loggers/Handlers/HandlerWrapper.php index 54f1e4ad..119db0c1 100644 --- a/src/Loggers/Handlers/HandlerWrapper.php +++ b/src/Loggers/Handlers/HandlerWrapper.php @@ -16,6 +16,7 @@ use Monolog\Handler\HandlerInterface; use Monolog\Formatter\FormatterInterface; +use Monolog\LogRecord; use TechDivision\Import\Loggers\HandlerFactoryInterface; use TechDivision\Import\Configuration\Logger\HandlerConfigurationInterface; @@ -104,11 +105,11 @@ public function reset() * is no guarantee that handle() will not be called, and isHandling() might not be called * for a given record. * - * @param array $record Partial log record containing only a level key + * @param array|LogRecord $record Partial log record containing only a level key * * @return boolean TRUE if the handler has to handle the record, FALSE otherwise */ - public function isHandling(array $record): bool + public function isHandling(array|LogRecord $record): bool { return $this->handler->isHandling($record); } @@ -128,7 +129,7 @@ public function isHandling(array $record): bool * @return boolean TRUE means that this handler handled the record, and that bubbling is not permitted. * FALSE means the record was either not processed or that this handler allows bubbling. */ - public function handle(array $record): bool + public function handle(array|LogRecord $record): bool { return $this->handler->handle($record); } diff --git a/src/Loggers/SerialProcessor.php b/src/Loggers/SerialProcessor.php index b9f172b2..336b5cb8 100644 --- a/src/Loggers/SerialProcessor.php +++ b/src/Loggers/SerialProcessor.php @@ -14,6 +14,7 @@ namespace TechDivision\Import\Loggers; +use Monolog\LogRecord; use Monolog\Processor\ProcessorInterface; use TechDivision\Import\Configuration\ConfigurationInterface; @@ -49,12 +50,16 @@ public function __construct(ConfigurationInterface $configuration) /** * Will be invoked by the logger processor chain to append the serial. * - * @param array $record The record to append the serial to + * @param LogRecord $record The record to append the serial to * - * @return array The record with the appended serial + * @return array|LogRecord The record with the appended serial */ - public function __invoke(array $record) + public function __invoke(array|LogRecord $record) { + if ($record instanceof LogRecord) { + $record->extra = array_merge($record->extra, array('serial' => $this->serial)); + return $record; + } return array_merge($record, array('extra' => array('serial' => $this->serial))); } }