Skip to content

Commit 12b2775

Browse files
ludicruzbobthecow
authored andcommitted
only force hte use of hte Value object if there is no __toString method
1 parent 3df8b6b commit 12b2775

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Ruler/Set.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ public function __construct($set)
4242
foreach ($this->value as &$value) {
4343
if (is_array($value)) {
4444
$value = new Set($value);
45-
} elseif (is_object($value) && !$value instanceof Value) {
46-
$value = new Value($value);
45+
} elseif (is_object($value)) {
46+
$reflect = new \ReflectionObject($value);
47+
if (!$reflect->hasMethod('__toString')) {
48+
$value = new Value($value);
49+
}
4750
}
4851
}
4952

0 commit comments

Comments
 (0)