Skip to content

Commit

Permalink
Merge pull request #244 from techdivision/compatibility-php-81
Browse files Browse the repository at this point in the history
PHP 8.1 Compatibility
  • Loading branch information
kenza-ya authored Jul 24, 2024
2 parents a0e103f + b622204 commit 0842f0a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 32 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
52 changes: 26 additions & 26 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
7 changes: 4 additions & 3 deletions src/Loggers/Handlers/HandlerWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
11 changes: 8 additions & 3 deletions src/Loggers/SerialProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

namespace TechDivision\Import\Loggers;

use Monolog\LogRecord;
use Monolog\Processor\ProcessorInterface;
use TechDivision\Import\Configuration\ConfigurationInterface;

Expand Down Expand Up @@ -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)));
}
}

0 comments on commit 0842f0a

Please sign in to comment.