From 1cad53658d796f43b657fe01f9ce9a819b7c8e27 Mon Sep 17 00:00:00 2001 From: Todd Wade Date: Mon, 30 May 2022 09:07:53 -0400 Subject: [PATCH] fix deprecation warning for at least php 8.1.6 running `vendor/bin/phpunit` on at least php version 8.1.6 results in multiple warnings that state: Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in .../Coders/Model/Model.php on line 505 add a conditional to check the argument for null before using it to build parentClass --- src/Coders/Model/Model.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Coders/Model/Model.php b/src/Coders/Model/Model.php index 4ced5798..c6d62a83 100644 --- a/src/Coders/Model/Model.php +++ b/src/Coders/Model/Model.php @@ -502,7 +502,12 @@ public function getBaseNamespace() */ public function withParentClass($parent) { - $this->parentClass = '\\' . ltrim($parent, '\\'); + $thisParentClass = '\\'; + if (! is_null($parent)) { + $thisParentClass = $thisParentClass . ltrim($parent, '\\'); + } + + $this->parentClass = $thisParentClass; return $this; }