diff --git a/src/Chronos.php b/src/Chronos.php index f03d8d71..30a271ac 100644 --- a/src/Chronos.php +++ b/src/Chronos.php @@ -190,6 +190,8 @@ public static function hasTestNow() */ public function __debugInfo() { + // Conditionally add properties if state exists to avoid + // errors when using a debugger. $vars = get_object_vars($this); $properties = [ diff --git a/src/Date.php b/src/Date.php index 7cfea762..387d0a94 100644 --- a/src/Date.php +++ b/src/Date.php @@ -133,6 +133,8 @@ public function toMutable() */ public function __debugInfo() { + // Conditionally add properties if state exists to avoid + // errors when using a debugger. $vars = get_object_vars($this); $properties = [ diff --git a/src/MutableDate.php b/src/MutableDate.php index 2cacf11c..00ea85bf 100644 --- a/src/MutableDate.php +++ b/src/MutableDate.php @@ -132,6 +132,8 @@ public function toImmutable() */ public function __debugInfo() { + // Conditionally add properties if state exists to avoid + // errors when using a debugger. $vars = get_object_vars($this); $properties = [ diff --git a/src/MutableDateTime.php b/src/MutableDateTime.php index 5b07a386..c97ffe18 100644 --- a/src/MutableDateTime.php +++ b/src/MutableDateTime.php @@ -175,6 +175,8 @@ public function __set($name, $value) */ public function __debugInfo() { + // Conditionally add properties if state exists to avoid + // errors when using a debugger. $vars = get_object_vars($this); $properties = [