Skip to content

Commit 45f3f51

Browse files
Merge pull request #12 from mrelevance/5.5
Make MonologFormatter normalize method compatible with parent.
2 parents a989764 + 6089dcd commit 45f3f51

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

.travis.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@ php:
55
- 7.1
66
- 7.2
77

8+
cache:
9+
directories:
10+
- $HOME/.composer/cache
11+
12+
services:
13+
- mysql
14+
815
install:
9-
- composer update
10-
- composer require php-coveralls/php-coveralls --dev
16+
- COMPOSER_MEMORY_LIMIT=-1 travis_retry composer update --no-interaction --prefer-dist
17+
- COMPOSER_MEMORY_LIMIT=-1 travis_retry composer require --no-interaction --prefer-dist --dev php-coveralls/php-coveralls
1118

1219
script:
1320
- vendor/bin/phpunit --coverage-clover ./tests/logs/clover.xml

src/Loggable/FileChannel/MonologFormatter.php

+6-8
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,14 @@ protected function convertToString($data)
3131
return parent::convertToString($data);
3232
}
3333

34-
protected function normalize($data)
34+
protected function normalize($data, $depth = 0)
3535
{
36-
if (is_array($data) || ($data instanceof Traversable)) {
37-
$normalized = [];
38-
foreach ($data as $key => $value) {
39-
$normalized[$key] = $this->normalize($value);
40-
}
41-
return $normalized;
36+
if (is_array($data) || $data instanceof Traversable) {
37+
return collect($data)->map(function ($item) {
38+
return $this->normalize($item);
39+
})->toArray();
4240
}
4341

44-
return parent::normalize($data);
42+
return parent::normalize($data, $depth);
4543
}
4644
}

0 commit comments

Comments
 (0)