From f92921f058af340987757ff4998d536fa7f1b496 Mon Sep 17 00:00:00 2001 From: Cbrad24 Date: Wed, 12 Jul 2023 11:23:00 +1000 Subject: [PATCH] Adds Stringable interface to all classes containing __toString() method. --- src/Models/Attributes/AccountControl.php | 3 ++- src/Models/Attributes/DistinguishedName.php | 3 ++- src/Models/Attributes/DistinguishedNameBuilder.php | 3 ++- src/Models/Attributes/EscapedValue.php | 4 +++- src/Models/Attributes/Guid.php | 3 ++- src/Models/Attributes/Sid.php | 3 ++- src/Models/Model.php | 3 ++- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Models/Attributes/AccountControl.php b/src/Models/Attributes/AccountControl.php index 45698bb4..8f0fee87 100644 --- a/src/Models/Attributes/AccountControl.php +++ b/src/Models/Attributes/AccountControl.php @@ -3,8 +3,9 @@ namespace LdapRecord\Models\Attributes; use ReflectionClass; +use Stringable; -class AccountControl +class AccountControl implements Stringable { public const SCRIPT = 1; diff --git a/src/Models/Attributes/DistinguishedName.php b/src/Models/Attributes/DistinguishedName.php index 98a684bc..960b9318 100644 --- a/src/Models/Attributes/DistinguishedName.php +++ b/src/Models/Attributes/DistinguishedName.php @@ -4,8 +4,9 @@ use LdapRecord\EscapesValues; use LdapRecord\Support\Arr; +use Stringable; -class DistinguishedName +class DistinguishedName implements Stringable { use EscapesValues; diff --git a/src/Models/Attributes/DistinguishedNameBuilder.php b/src/Models/Attributes/DistinguishedNameBuilder.php index a507ab40..fb53298d 100644 --- a/src/Models/Attributes/DistinguishedNameBuilder.php +++ b/src/Models/Attributes/DistinguishedNameBuilder.php @@ -4,8 +4,9 @@ use LdapRecord\EscapesValues; use LdapRecord\Support\Arr; +use Stringable; -class DistinguishedNameBuilder +class DistinguishedNameBuilder implements Stringable { use EscapesValues; diff --git a/src/Models/Attributes/EscapedValue.php b/src/Models/Attributes/EscapedValue.php index 9af54a86..c28d95c2 100644 --- a/src/Models/Attributes/EscapedValue.php +++ b/src/Models/Attributes/EscapedValue.php @@ -2,7 +2,9 @@ namespace LdapRecord\Models\Attributes; -class EscapedValue +use Stringable; + +class EscapedValue implements Stringable { /** * The value to be escaped. diff --git a/src/Models/Attributes/Guid.php b/src/Models/Attributes/Guid.php index 63eaf8e7..9be0bd93 100644 --- a/src/Models/Attributes/Guid.php +++ b/src/Models/Attributes/Guid.php @@ -3,8 +3,9 @@ namespace LdapRecord\Models\Attributes; use InvalidArgumentException; +use Stringable; -class Guid +class Guid implements Stringable { /** * The string GUID value. diff --git a/src/Models/Attributes/Sid.php b/src/Models/Attributes/Sid.php index c5701dcf..ac7569db 100644 --- a/src/Models/Attributes/Sid.php +++ b/src/Models/Attributes/Sid.php @@ -3,8 +3,9 @@ namespace LdapRecord\Models\Attributes; use InvalidArgumentException; +use Stringable; -class Sid +class Sid implements Stringable { /** * The string SID value. diff --git a/src/Models/Model.php b/src/Models/Model.php index 6279640c..062f30f8 100644 --- a/src/Models/Model.php +++ b/src/Models/Model.php @@ -13,10 +13,11 @@ use LdapRecord\Models\Attributes\Guid; use LdapRecord\Query\Model\Builder; use LdapRecord\Support\Arr; +use Stringable; use UnexpectedValueException; /** @mixin Builder */ -abstract class Model implements ArrayAccess, Arrayable, JsonSerializable +abstract class Model implements ArrayAccess, Arrayable, JsonSerializable, Stringable { use EscapesValues; use Concerns\HasEvents;