Skip to content

Commit c82b43b

Browse files
Kyrchtaylorotwell
andauthored
[12.x] Add toStringable to Uri (#56359)
* [12.x] Add toStr to Uri * improve docs * refactor: changed toStr to toStringable * Update Uri.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 816ffa5 commit c82b43b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Illuminate/Support/Uri.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,17 @@ public function redirect(int $status = 302, array $headers = []): RedirectRespon
333333
}
334334

335335
/**
336-
* Create an HTTP response that represents the object.
336+
* Get the URI as a Stringable instance.
337+
*
338+
* @return \Illuminate\Support\Stringable
339+
*/
340+
public function toStringable()
341+
{
342+
return Str::of($this->value());
343+
}
344+
345+
/**
346+
* Create an HTTP response that represents the URI object.
337347
*
338348
* @param \Illuminate\Http\Request $request
339349
* @return \Symfony\Component\HttpFoundation\Response
@@ -344,7 +354,7 @@ public function toResponse($request)
344354
}
345355

346356
/**
347-
* Get content as a string of HTML.
357+
* Get the URI as a string of HTML.
348358
*
349359
* @return string
350360
*/

0 commit comments

Comments
 (0)