From 4c467ce4d5a72c3cf0832c813d4d84d222c3d4bb Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Sun, 12 Aug 2018 10:49:01 -0500 Subject: [PATCH] Mark toString() method as deprecated, scheduled for removal in 4.0.0 --- src/Uuid.php | 8 ++++++++ src/UuidInterface.php | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/Uuid.php b/src/Uuid.php index 45f9fa4..fd4a8d3 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -590,6 +590,14 @@ class Uuid implements UuidInterface return null; } + /** + * {@inheritdoc} + * + * @deprecated In ramsey/uuid 4.0.0, this method will be replaced with the + * __toString() magic method, which is already available on this class. + * The new recommendation is to cast Uuid objects to string, rather than + * calling `toString()`. + */ public function toString() { return $this->codec->encode($this); diff --git a/src/UuidInterface.php b/src/UuidInterface.php index e1cea67..ceef90f 100644 --- a/src/UuidInterface.php +++ b/src/UuidInterface.php @@ -268,6 +268,10 @@ interface UuidInterface extends JsonSerializable, Serializable /** * Converts this UUID into a string representation. * + * @deprecated In ramsey/uuid 4.0.0, this method will be replaced with the + * __toString() magic method, which is currently available in the + * Uuid concrete class. The new recommendation is to cast Uuid objects + * to string, rather than calling `toString()`. * @return string */ public function toString();