-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0e5c8b
commit e6f13d7
Showing
6 changed files
with
83 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,14 @@ | ||
<?php | ||
|
||
namespace yii1tech\psr\log; | ||
/** | ||
* Splits actual class declaration into 2 separated branches, allowing support both PHP 8.x and PHP 7.x. | ||
* This is necessary since {@see \Psr\Log\LoggerInterface} changes signature over different PHP versions. | ||
* | ||
* @author Paul Klimov <[email protected]> | ||
* @since 1.0 | ||
*/ | ||
|
||
if (version_compare(phpversion(), '8.0', '>=')) { | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
class PsrLogger extends AbstractPsrLogger | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function log($level, string|\Stringable $message, array $context = []): void | ||
{ | ||
$this->writeLog($level, $message, $context); | ||
} | ||
} | ||
require __DIR__ . '/compatibility/PsrLogger.v8.php'; | ||
} else { | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
class PsrLogger extends AbstractPsrLogger | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function log($level, $message, array $context = []): void | ||
{ | ||
$this->writeLog($level, $message, $context); | ||
} | ||
} | ||
require __DIR__ . '/compatibility/PsrLogger.v7.php'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace yii1tech\psr\log; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
class PsrLogger extends AbstractPsrLogger | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function log($level, $message, array $context = []): void | ||
{ | ||
$this->writeLog($level, $message, $context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace yii1tech\psr\log; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
class PsrLogger extends AbstractPsrLogger | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function log($level, string|\Stringable $message, array $context = []): void | ||
{ | ||
$this->writeLog($level, $message, $context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,7 @@ | ||
<?php | ||
|
||
namespace yii1tech\psr\log\test\support; | ||
|
||
if (version_compare(phpversion(), '8.0', '>=')) { | ||
class ArrayLogger extends AbstractArrayLogger | ||
{ | ||
public function log($level, string|\Stringable $message, array $context = []): void | ||
{ | ||
$this->writeLog($level, $message, $context); | ||
} | ||
} | ||
require __DIR__ . '/compatibility/ArrayLogger.v8.php'; | ||
} else { | ||
class ArrayLogger extends AbstractArrayLogger | ||
{ | ||
public function log($level, $message, array $context = []): void | ||
{ | ||
$this->writeLog($level, $message, $context); | ||
} | ||
} | ||
require __DIR__ . '/compatibility/ArrayLogger.v7.php'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace yii1tech\psr\log\test\support; | ||
|
||
use yii1tech\psr\log\test\support\AbstractArrayLogger; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
class ArrayLogger extends AbstractArrayLogger | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function log($level, $message, array $context = []): void | ||
{ | ||
$this->writeLog($level, $message, $context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace yii1tech\psr\log\test\support; | ||
|
||
use yii1tech\psr\log\test\support\AbstractArrayLogger; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
class ArrayLogger extends AbstractArrayLogger | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function log($level, string|\Stringable $message, array $context = []): void | ||
{ | ||
$this->writeLog($level, $message, $context); | ||
} | ||
} |