Skip to content

Commit eea1a34

Browse files
Add compatibility to monolog 2 (#11)
1 parent c2cf4b1 commit eea1a34

File tree

6 files changed

+54
-3
lines changed

6 files changed

+54
-3
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ before_script:
6060
script:
6161
- wget -q --waitretry=1 --retry-connrefused -T 10 -O - http://127.0.0.1:9200
6262
- vendor/bin/simple-phpunit --coverage-clover=coverage.clover
63-
- vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor/,Tests/app/,var/ ./
63+
- vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor/,Tests/app/,var/,Profiler/Handler/BackwardCompatibilityWriteTrait.php ./
6464

6565
after_script:
6666
- travis_retry php vendor/bin/coveralls
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace ONGR\ElasticsearchBundle\Profiler\Handler;
4+
5+
if (PHP_VERSION_ID >= 70200) {
6+
/**
7+
* @internal
8+
*/
9+
trait BackwardCompatibilityWriteTrait
10+
{
11+
use BackwardCompatibilityWriteTrait72;
12+
}
13+
} else {
14+
/**
15+
* @internal
16+
*/
17+
trait BackwardCompatibilityWriteTrait
18+
{
19+
use BackwardCompatibilityWriteTrait71;
20+
}
21+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace ONGR\ElasticsearchBundle\Profiler\Handler;
4+
5+
/**
6+
* @internal
7+
*/
8+
trait BackwardCompatibilityWriteTrait71
9+
{
10+
protected function write(array $record)
11+
{
12+
$this->doWrite($record);
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace ONGR\ElasticsearchBundle\Profiler\Handler;
4+
5+
/**
6+
* @internal
7+
*/
8+
trait BackwardCompatibilityWriteTrait72
9+
{
10+
protected function write(array $record): void
11+
{
12+
$this->doWrite($record);
13+
}
14+
}

Profiler/Handler/CollectionHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
class CollectionHandler extends AbstractProcessingHandler
2020
{
21+
use BackwardCompatibilityWriteTrait;
22+
2123
/**
2224
* @var array
2325
*/
@@ -26,7 +28,7 @@ class CollectionHandler extends AbstractProcessingHandler
2628
/**
2729
* {@inheritdoc}
2830
*/
29-
protected function write(array $record)
31+
protected function doWrite(array $record)
3032
{
3133
$this->records[] = $record;
3234
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"doctrine/inflector": "~1.0",
2626
"doctrine/cache": "~1.4",
2727
"doctrine/collections": "~1.4",
28-
"monolog/monolog": "~1.10",
28+
"monolog/monolog": "^1.10 || ^2.0",
2929
"handcraftedinthealps/elasticsearch-dsl": "^5.0.7.1|^6.2.0.1|^7.2.0.1"
3030
},
3131
"require-dev": {

0 commit comments

Comments
 (0)