aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ramsey/collection/src/Tool/ValueToStringTrait.php')
-rw-r--r--vendor/ramsey/collection/src/Tool/ValueToStringTrait.php13
1 files changed, 5 insertions, 8 deletions
diff --git a/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php b/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php
index 721ade002..64fc5fa42 100644
--- a/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php
+++ b/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php
@@ -16,11 +16,12 @@ namespace Ramsey\Collection\Tool;
use DateTimeInterface;
-use function get_class;
+use function assert;
use function get_resource_type;
use function is_array;
use function is_bool;
use function is_callable;
+use function is_object;
use function is_resource;
use function is_scalar;
@@ -44,7 +45,7 @@ trait ValueToStringTrait
*
* @param mixed $value the value to return as a string.
*/
- protected function toolValueToString($value): string
+ protected function toolValueToString(mixed $value): string
{
// null
if ($value === null) {
@@ -71,12 +72,8 @@ trait ValueToStringTrait
return '(' . get_resource_type($value) . ' resource #' . (int) $value . ')';
}
- // If we don't know what it is, use var_export().
- if (!is_object($value)) {
- return '(' . var_export($value, true) . ')';
- }
-
// From here, $value should be an object.
+ assert(is_object($value));
// __toString() is implemented
if (is_callable([$value, '__toString'])) {
@@ -89,6 +86,6 @@ trait ValueToStringTrait
}
// unknown type
- return '(' . get_class($value) . ' Object)';
+ return '(' . $value::class . ' Object)';
}
}