Docs folder standardization and other fixes #382
Annotations
10 warnings
mutation / PHP 8.1-ubuntu-latest:
src/Logger.php#L102
Escaped Mutant for Mutator "FunctionCallRemoval":
--- Original
+++ New
@@ @@
public function __construct(array $targets = [])
{
$this->setTargets($targets);
- register_shutdown_function(function () {
- // make regular flush before other shutdown functions, which allows session data collection and so on
- $this->flush();
- // make sure log entries written by shutdown functions are also flushed
- // ensure "flush()" is called last when there are multiple shutdown functions
- register_shutdown_function([$this, 'flush'], true);
- });
+
}
/**
* Returns the text display of the specified level.
|
mutation / PHP 8.1-ubuntu-latest:
src/Logger.php#L155
Escaped Mutant for Mutator "AssignCoalesce":
--- Original
+++ New
@@ @@
*/
public function log(mixed $level, string|Stringable $message, array $context = []) : void
{
- $context['time'] ??= microtime(true);
+ $context['time'] = microtime(true);
$context['trace'] ??= $this->collectTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
$context['memory'] ??= memory_get_usage();
$context['category'] ??= CategoryFilter::DEFAULT;
|
mutation / PHP 8.1-ubuntu-latest:
src/Logger.php#L156
Escaped Mutant for Mutator "AssignCoalesce":
--- Original
+++ New
@@ @@
public function log(mixed $level, string|Stringable $message, array $context = []) : void
{
$context['time'] ??= microtime(true);
- $context['trace'] ??= $this->collectTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
+ $context['trace'] = $this->collectTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
$context['memory'] ??= memory_get_usage();
$context['category'] ??= CategoryFilter::DEFAULT;
$this->messages[] = new Message($level, $message, $context);
|
mutation / PHP 8.1-ubuntu-latest:
src/Logger.php#L157
Escaped Mutant for Mutator "AssignCoalesce":
--- Original
+++ New
@@ @@
{
$context['time'] ??= microtime(true);
$context['trace'] ??= $this->collectTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
- $context['memory'] ??= memory_get_usage();
+ $context['memory'] = memory_get_usage();
$context['category'] ??= CategoryFilter::DEFAULT;
$this->messages[] = new Message($level, $message, $context);
if ($this->flushInterval > 0 && count($this->messages) >= $this->flushInterval) {
|
mutation / PHP 8.1-ubuntu-latest:
src/Logger.php#L162
Escaped Mutant for Mutator "GreaterThan":
--- Original
+++ New
@@ @@
$context['memory'] ??= memory_get_usage();
$context['category'] ??= CategoryFilter::DEFAULT;
$this->messages[] = new Message($level, $message, $context);
- if ($this->flushInterval > 0 && count($this->messages) >= $this->flushInterval) {
+ if ($this->flushInterval >= 0 && count($this->messages) >= $this->flushInterval) {
$this->flush();
}
}
|
mutation / PHP 8.1-ubuntu-latest:
src/Logger.php#L300
Escaped Mutant for Mutator "UnwrapArrayFilter":
--- Original
+++ New
@@ @@
$count = 0;
foreach ($backtrace as $trace) {
if (isset($trace['file'], $trace['line'])) {
- $excludedMatch = array_filter($this->excludedTracePaths, static fn($path) => str_contains($trace['file'], $path));
+ $excludedMatch = $this->excludedTracePaths;
if (empty($excludedMatch)) {
unset($trace['object'], $trace['args']);
$traces[] = $trace;
|
mutation / PHP 8.1-ubuntu-latest:
src/StreamTarget.php#L40
Escaped Mutant for Mutator "FunctionCallRemoval":
--- Original
+++ New
@@ @@
protected function export() : void
{
$stream = $this->createStream();
- flock($stream, LOCK_EX);
+
if (fwrite($stream, $this->formatMessages("\n")) === false) {
flock($stream, LOCK_UN);
fclose($stream);
|
mutation / PHP 8.1-ubuntu-latest:
src/StreamTarget.php#L43
Escaped Mutant for Mutator "FunctionCallRemoval":
--- Original
+++ New
@@ @@
$stream = $this->createStream();
flock($stream, LOCK_EX);
if (fwrite($stream, $this->formatMessages("\n")) === false) {
- flock($stream, LOCK_UN);
+
fclose($stream);
throw new RuntimeException(sprintf('Unable to export the log because of an error writing to the stream: %s', error_get_last()['message'] ?? ''));
}
|
mutation / PHP 8.1-ubuntu-latest:
src/StreamTarget.php#L52
Escaped Mutant for Mutator "FunctionCallRemoval":
--- Original
+++ New
@@ @@
throw new RuntimeException(sprintf('Unable to export the log because of an error writing to the stream: %s', error_get_last()['message'] ?? ''));
}
$this->stream = stream_get_meta_data($stream)['uri'];
- flock($stream, LOCK_UN);
+
fclose($stream);
}
/**
|
mutation / PHP 8.1-ubuntu-latest:
src/Target.php#L105
Escaped Mutant for Mutator "GreaterThan":
--- Original
+++ New
@@ @@
{
$this->filterMessages($messages);
$count = count($this->messages);
- if ($count > 0 && ($final || $this->exportInterval > 0 && $count >= $this->exportInterval)) {
+ if ($count >= 0 && ($final || $this->exportInterval > 0 && $count >= $this->exportInterval)) {
// set exportInterval to 0 to avoid triggering export again while exporting
$oldExportInterval = $this->exportInterval;
$this->exportInterval = 0;
|