Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- New #113: Add `Message::trace()` method (@vjik)
- New #114: Add `Message::time()` method (@vjik)
- Chg #116: Deprecate methods `setCommonContext()` and `getCommonContext()` in `Target` class (@vjik)
- Chg #118: Replace `gettype()` to `get_debug_type()` in exception messages generation (@vjik)

## 2.0.0 May 22, 2022

Expand Down
2 changes: 1 addition & 1 deletion src/ContextProvider/SystemContextProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function setExcludedTracePaths(array $excludedTracePaths): self
throw new InvalidArgumentException(
sprintf(
'The trace path must be a string, %s received.',
gettype($excludedTracePath)
get_debug_type($excludedTracePath)
)
);
}
Expand Down
5 changes: 2 additions & 3 deletions src/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Yiisoft\Log\ContextProvider\ContextProviderInterface;

use function count;
use function gettype;
use function implode;
use function in_array;
use function is_string;
Expand Down Expand Up @@ -113,7 +112,7 @@ public static function validateLevel(mixed $level): string
if (!is_string($level)) {
throw new \Psr\Log\InvalidArgumentException(sprintf(
'The log message level must be a string, %s provided.',
gettype($level)
get_debug_type($level)
));
}

Expand Down Expand Up @@ -250,7 +249,7 @@ public static function assertLevelIsString(mixed $level): void
}

throw new \Psr\Log\InvalidArgumentException(
sprintf('The log message level must be a string, %s provided.', gettype($level))
sprintf('The log message level must be a string, %s provided.', get_debug_type($level))
);
}

Expand Down
3 changes: 1 addition & 2 deletions src/Message/CategoryFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

use Yiisoft\Log\Message;

use function gettype;
use function is_string;
use function rtrim;
use function sprintf;
Expand Down Expand Up @@ -123,7 +122,7 @@ private function checkStructure(array $categories): void
if (!is_string($category)) {
throw new InvalidArgumentException(sprintf(
'The log message category must be a string, %s received.',
gettype($category)
get_debug_type($category)
));
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/Message/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Yiisoft\Log\Message;
use Yiisoft\VarDumper\VarDumper;

use function gettype;
use function implode;
use function is_string;
use function is_object;
Expand Down Expand Up @@ -103,7 +102,7 @@ public function format(Message $message, array $commonContext): string
if (!is_string($formatted)) {
throw new RuntimeException(sprintf(
'The PHP callable "format" must return a string, %s received.',
gettype($formatted)
get_debug_type($formatted)
));
}

Expand Down Expand Up @@ -151,7 +150,7 @@ private function getPrefix(Message $message, array $commonContext): string
if (!is_string($prefix)) {
throw new RuntimeException(sprintf(
'The PHP callable "prefix" must return a string, %s received.',
gettype($prefix)
get_debug_type($prefix)
));
}

Expand Down
3 changes: 1 addition & 2 deletions src/StreamTarget.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use function flock;
use function fopen;
use function fwrite;
use function gettype;
use function get_resource_type;
use function is_resource;
use function sprintf;
Expand Down Expand Up @@ -79,7 +78,7 @@ private function createStream()
if (!is_resource($stream) || get_resource_type($stream) !== 'stream') {
throw new InvalidArgumentException(sprintf(
'Invalid stream provided. It must be a string stream identifier or a stream resource, "%s" received.',
gettype($stream),
get_debug_type($stream),
));
}

Expand Down
3 changes: 1 addition & 2 deletions src/Target.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Yiisoft\Log\Message\Formatter;

use function count;
use function gettype;
use function in_array;
use function is_bool;
use function sprintf;
Expand Down Expand Up @@ -307,7 +306,7 @@ public function isEnabled(): bool
if (!is_bool($enabled = ($this->enabled)())) {
throw new RuntimeException(sprintf(
'The PHP callable "enabled" must returns a boolean, %s received.',
gettype($enabled)
get_debug_type($enabled)
));
}

Expand Down