You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: LazyString.php
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@
16
16
*
17
17
* @author Nicolas Grekas <p@tchwork.com>
18
18
*/
19
-
class LazyString implements \JsonSerializable
19
+
class LazyString implements \Stringable, \JsonSerializable
20
20
{
21
21
private$value;
22
22
@@ -50,14 +50,14 @@ public static function fromCallable($callback, ...$arguments): self
50
50
}
51
51
52
52
/**
53
-
* @param object|string|int|float|bool $value A scalar or an object that implements the __toString() magic method
53
+
* @param string|int|float|bool|\Stringable $value
54
54
*
55
55
* @return static
56
56
*/
57
57
publicstaticfunctionfromStringable($value): self
58
58
{
59
59
if (!self::isStringable($value)) {
60
-
thrownew \TypeError(sprintf('Argument 1 passed to %s() must be a scalar or an object that implements the __toString() magic method, %s given.', __METHOD__, \is_object($value) ? \get_class($value) : \gettype($value)));
60
+
thrownew \TypeError(sprintf('Argument 1 passed to %s() must be a scalar or a stringable object, %s given.', __METHOD__, \is_object($value) ? \get_class($value) : \gettype($value)));
61
61
}
62
62
63
63
if (\is_object($value)) {
@@ -75,7 +75,7 @@ public static function fromStringable($value): self
0 commit comments