diff --git a/.travis.yml b/.travis.yml
index 13e1961..3077c26 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,16 +1,17 @@
# .travis.yml
language: php
+dist: bionic
php:
- - 5.3
- - 5.4
- - 5.5
- - 5.6
+ - 7.2
+ - 7.3
+ - 7.4
+ - 8.0
# Install dependencies before testing
before_script:
- composer selfupdate
- - composer install --dev
+ - composer install
# Use our custom version of phpunit
script:
@@ -19,4 +20,4 @@ script:
# Run coveralls.io code coverage report
after_script:
- - vendor/bin/coveralls -v
\ No newline at end of file
+ - vendor/bin/php-coveralls -v
diff --git a/composer.json b/composer.json
index 1c30ca7..b728310 100644
--- a/composer.json
+++ b/composer.json
@@ -10,12 +10,15 @@
}
],
"require": {
- "php": ">=5.3.0"
+ "php": ">=7.2"
+ },
+ "conflict": {
+ "monolog/monolog": "<2.0"
},
"require-dev": {
- "monolog/monolog": "~1.0",
- "phpunit/phpunit": "~4.0",
- "satooshi/php-coveralls": "dev-master"
+ "monolog/monolog": "^2.0",
+ "phpunit/phpunit": "^8.5",
+ "php-coveralls/php-coveralls": "^2.4"
},
"autoload": {
"psr-4": {
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index d4b5eaa..6788e45 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -8,7 +8,7 @@
- test/unit
+ test
@@ -19,8 +19,8 @@
-
+
-
\ No newline at end of file
+
diff --git a/src/SplunkLineFormatter.php b/src/SplunkLineFormatter.php
index 45c68ce..f1983d2 100644
--- a/src/SplunkLineFormatter.php
+++ b/src/SplunkLineFormatter.php
@@ -1,4 +1,5 @@
-quoteReplacement = $quoteReplacement;
}
- protected function jsonEncode($data)
+ protected function jsonEncode($data): string
{
- if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
- return $this->toJson($data, true);
- }
-
- return str_replace('\\/', '/', @json_encode($data));
+ return $this->toJson($data, true);
}
/**
* Public so we can run unit tests against it
*/
- public function publicConvertToString($data)
+ public function publicConvertToString($data): string
{
return $this->convertToString($data);
}
- protected function convertToString($data)
+ protected function convertToString($data): string
{
if (null === $data || is_bool($data)) {
return var_export($data, true);
@@ -74,7 +71,7 @@ protected function convertToString($data)
if (is_array($data)) {
- $vals = array();
+ $vals = [];
foreach ($data as $n => $v) {
if (null === $v || is_bool($v)) {
@@ -103,9 +100,9 @@ protected function convertToString($data)
return $this->jsonEncode($data);
}
- protected function toQuoteSafeString($string)
+ protected function toQuoteSafeString($string): string
{
return str_replace('"', $this->quoteReplacement, (string) $string);
}
-}
\ No newline at end of file
+}
diff --git a/test/unit/SplunkLinkFormatterTest.php b/test/SplunkLineFormatterTest.php
similarity index 94%
rename from test/unit/SplunkLinkFormatterTest.php
rename to test/SplunkLineFormatterTest.php
index 9b86c26..b3d0bf6 100644
--- a/test/unit/SplunkLinkFormatterTest.php
+++ b/test/SplunkLineFormatterTest.php
@@ -1,17 +1,17 @@
slf = new SplunkLineFormatter();
@@ -153,7 +153,7 @@ public function testLogFormat()
$context = array(
'a' => 'A A',
);
- $this->log->addNotice('message here', $context);
+ $this->log->notice('message here', $context);
$records = $this->handler->getRecords();
$this->assertSame(1, count($records));
$message = $records[0]['formatted'];
@@ -166,7 +166,7 @@ public function testLogFormatWithQuotesInMessage()
$context = array(
'a' => 'A A',
);
- $this->log->addWarning('message "with quotes"', $context);
+ $this->log->warning('message "with quotes"', $context);
$records = $this->handler->getRecords();
$this->assertSame(1, count($records));
$message = $records[0]['formatted'];
@@ -181,7 +181,7 @@ public function testLogWithAssocArrayInContext()
'ca' => 'CA',
),
);
- $this->log->addWarning('message', $context);
+ $this->log->warning('message', $context);
$records = $this->handler->getRecords();
$this->assertSame(1, count($records));
$message = $records[0]['formatted'];