From 5c1f94b6b8b918dfc5aa7f3ca5da75868805f482 Mon Sep 17 00:00:00 2001 From: Allan Jensen Date: Wed, 8 May 2024 19:32:06 +0200 Subject: [PATCH] chore: improved PHP 8 compatibility --- src/FormHelper.php | 6 ++---- src/UserException.php | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/FormHelper.php b/src/FormHelper.php index a4c2971..0762c46 100644 --- a/src/FormHelper.php +++ b/src/FormHelper.php @@ -167,10 +167,8 @@ public static function addResultErrors($result, &$model, $options = []) { foreach ($modelErrors as $attr => $errors) { // Generate the form field ID so Yii ActiveForm client-side can apply the error message - if (!$modelName) { - $modelName = get_class($model); - $modelName = mb_strtolower(substr($modelName, strrpos($modelName, '\\')+1)); - } + $modelName = get_class($model); + $modelName = mb_strtolower(substr($modelName, strrpos($modelName, '\\')+1)); $attributeId = $modelName .'-'. mb_strtolower($attr); diff --git a/src/UserException.php b/src/UserException.php index c468173..9d0766c 100644 --- a/src/UserException.php +++ b/src/UserException.php @@ -147,6 +147,7 @@ function __construct($msg, $arrayInternalInfo = [], $options = []) { } } + $extraMessage = ''; if ($msg === null) { $messageString = $messageStringHtml = 'NULL'; } elseif (is_array($msg) || is_object($msg) || is_bool($msg)) {