From ccee3b588cc2352161fb5f13a7d3558184e9dfb0 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Wed, 13 May 2026 15:26:28 -0400 Subject: [PATCH] fix: Allow Horde\Util\Variables class in isValid() method --- src/V3/AddressVariable.php | 1 + src/V3/AddresslinkVariable.php | 3 ++- src/V3/AssignVariable.php | 3 ++- src/V3/BaseVariable.php | 3 ++- src/V3/BooleanVariable.php | 3 ++- src/V3/CaptchaVariable.php | 1 + src/V3/CategoryVariable.php | 3 ++- src/V3/CellphoneVariable.php | 1 + src/V3/ColorpickerVariable.php | 3 ++- src/V3/CountedtextVariable.php | 3 ++- src/V3/CountryVariable.php | 1 + src/V3/CreditcardVariable.php | 3 ++- src/V3/DateVariable.php | 1 + src/V3/DatetimeVariable.php | 3 ++- src/V3/DblookupVariable.php | 1 + src/V3/DescriptionVariable.php | 3 ++- src/V3/EmailVariable.php | 3 ++- src/V3/EmailconfirmVariable.php | 3 ++- src/V3/EnumVariable.php | 3 ++- src/V3/FigletVariable.php | 3 ++- src/V3/FileVariable.php | 3 ++- src/V3/HeaderVariable.php | 3 ++- src/V3/HourminutesecondVariable.php | 3 ++- src/V3/HtmlVariable.php | 3 ++- src/V3/ImageVariable.php | 3 ++- src/V3/IntVariable.php | 3 ++- src/V3/IntlistVariable.php | 3 ++- src/V3/InvalidVariable.php | 3 ++- src/V3/Ip6addressVariable.php | 3 ++- src/V3/IpaddressVariable.php | 3 ++- src/V3/KeyvalMultienumVariable.php | 1 + src/V3/LinkVariable.php | 3 ++- src/V3/LongtextVariable.php | 1 + src/V3/MatrixVariable.php | 3 ++- src/V3/MlenumVariable.php | 3 ++- src/V3/MonthdayyearVariable.php | 3 ++- src/V3/MonthyearVariable.php | 3 ++- src/V3/MultienumVariable.php | 3 ++- src/V3/NumberVariable.php | 3 ++- src/V3/ObrowserVariable.php | 3 ++- src/V3/OctalVariable.php | 3 ++- src/V3/PasswordVariable.php | 3 ++- src/V3/PasswordconfirmVariable.php | 3 ++- src/V3/PgpVariable.php | 1 + src/V3/PhoneVariable.php | 3 ++- src/V3/RadioVariable.php | 1 + src/V3/SelectfilesVariable.php | 3 ++- src/V3/SetVariable.php | 3 ++- src/V3/SmimeVariable.php | 1 + src/V3/SorterVariable.php | 3 ++- src/V3/SoundVariable.php | 3 ++- src/V3/SpacerVariable.php | 3 ++- src/V3/StringarrayVariable.php | 1 + src/V3/StringlistVariable.php | 1 + src/V3/TablesetVariable.php | 3 ++- src/V3/TextVariable.php | 3 ++- src/V3/TimeVariable.php | 3 ++- 57 files changed, 101 insertions(+), 44 deletions(-) diff --git a/src/V3/AddressVariable.php b/src/V3/AddressVariable.php index 125146e..be935a6 100644 --- a/src/V3/AddressVariable.php +++ b/src/V3/AddressVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_String; use Horde_Form_Translation; diff --git a/src/V3/AddresslinkVariable.php b/src/V3/AddresslinkVariable.php index 012a888..5406824 100644 --- a/src/V3/AddresslinkVariable.php +++ b/src/V3/AddresslinkVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -22,7 +23,7 @@ */ class AddresslinkVariable extends AddressVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return true; } diff --git a/src/V3/AssignVariable.php b/src/V3/AssignVariable.php index 2416fbd..4c6fabb 100644 --- a/src/V3/AssignVariable.php +++ b/src/V3/AssignVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -52,7 +53,7 @@ public function init(...$params) $this->_width = $params[5] ?? '200px'; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return true; } diff --git a/src/V3/BaseVariable.php b/src/V3/BaseVariable.php index b87fbb5..fdb9b06 100644 --- a/src/V3/BaseVariable.php +++ b/src/V3/BaseVariable.php @@ -14,6 +14,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde; use Horde_Form_Translation; @@ -862,7 +863,7 @@ public function onSubmit($vars) {} * * @internal */ - protected function isValid(Horde_Variables $vars, $value): bool + protected function isValid(Horde_Variables|Variables $vars, $value): bool { $this->message = 'Error: Variable::isValid() called - should be overridden
'; return false; diff --git a/src/V3/BooleanVariable.php b/src/V3/BooleanVariable.php index 9de4270..0141739 100644 --- a/src/V3/BooleanVariable.php +++ b/src/V3/BooleanVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_String; use Horde_Form_Translation; @@ -29,7 +30,7 @@ class BooleanVariable extends BaseVariable * * @api */ - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return true; } diff --git a/src/V3/CaptchaVariable.php b/src/V3/CaptchaVariable.php index a9dfb57..2b034ca 100644 --- a/src/V3/CaptchaVariable.php +++ b/src/V3/CaptchaVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; diff --git a/src/V3/CategoryVariable.php b/src/V3/CategoryVariable.php index 0fe6859..8b3babe 100644 --- a/src/V3/CategoryVariable.php +++ b/src/V3/CategoryVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -34,7 +35,7 @@ protected function getInfoV3($vars) return $info; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (empty($value) && $this->isRequired()) { return $this->invalid('This field is required.'); diff --git a/src/V3/CellphoneVariable.php b/src/V3/CellphoneVariable.php index 7011032..f73f08e 100644 --- a/src/V3/CellphoneVariable.php +++ b/src/V3/CellphoneVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; diff --git a/src/V3/ColorpickerVariable.php b/src/V3/ColorpickerVariable.php index f3866a3..3f3ceb4 100644 --- a/src/V3/ColorpickerVariable.php +++ b/src/V3/ColorpickerVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class ColorpickerVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($this->isRequired() && empty($value)) { return $this->invalid('This field is required.'); diff --git a/src/V3/CountedtextVariable.php b/src/V3/CountedtextVariable.php index 8ff5397..af61dbf 100644 --- a/src/V3/CountedtextVariable.php +++ b/src/V3/CountedtextVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_String; use Horde_Form_Translation; @@ -46,7 +47,7 @@ public function init(...$params) $this->_chars = $chars; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { $length = Horde_String::length(trim($value)); if ($this->isRequired() && $length <= 0) { diff --git a/src/V3/CountryVariable.php b/src/V3/CountryVariable.php index bc2735c..9714e3f 100644 --- a/src/V3/CountryVariable.php +++ b/src/V3/CountryVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; use Horde_Nls; diff --git a/src/V3/CreditcardVariable.php b/src/V3/CreditcardVariable.php index adbd75b..38bee81 100644 --- a/src/V3/CreditcardVariable.php +++ b/src/V3/CreditcardVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class CreditcardVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (empty($value) && $this->isRequired()) { return $this->invalid('This field is required.'); diff --git a/src/V3/DateVariable.php b/src/V3/DateVariable.php index 66c0490..928ce67 100644 --- a/src/V3/DateVariable.php +++ b/src/V3/DateVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Date; use Horde_Form_Translation; diff --git a/src/V3/DatetimeVariable.php b/src/V3/DatetimeVariable.php index fe10c5a..1b18cc2 100644 --- a/src/V3/DatetimeVariable.php +++ b/src/V3/DatetimeVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -53,7 +54,7 @@ public function init(...$params) $this->_hms->init($show_seconds); } - public function isValid(Horde_Variables|array $vars, $date): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { /* Require all fields if one field is not empty */ if ($this->isRequired() || $this->emptyDateArray($date) != 1 || !$this->emptyTimeArray($date)) { diff --git a/src/V3/DblookupVariable.php b/src/V3/DblookupVariable.php index b70239e..f1d5dad 100644 --- a/src/V3/DblookupVariable.php +++ b/src/V3/DblookupVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; use Horde_Db_Exception; diff --git a/src/V3/DescriptionVariable.php b/src/V3/DescriptionVariable.php index 25ed056..0db7c8d 100644 --- a/src/V3/DescriptionVariable.php +++ b/src/V3/DescriptionVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class DescriptionVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return true; } diff --git a/src/V3/EmailVariable.php b/src/V3/EmailVariable.php index 0821320..ff6d9ae 100644 --- a/src/V3/EmailVariable.php +++ b/src/V3/EmailVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -99,7 +100,7 @@ public function init(...$params) * * @api */ - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { // Split into individual addresses. $emails = $this->splitEmailAddresses($value); diff --git a/src/V3/EmailconfirmVariable.php b/src/V3/EmailconfirmVariable.php index 979021b..bf9f1c2 100644 --- a/src/V3/EmailconfirmVariable.php +++ b/src/V3/EmailconfirmVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class EmailconfirmVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($this->isRequired() && empty($value['original'])) { return $this->invalid('This field is required.'); diff --git a/src/V3/EnumVariable.php b/src/V3/EnumVariable.php index 34839de..f7a7c23 100644 --- a/src/V3/EnumVariable.php +++ b/src/V3/EnumVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -43,7 +44,7 @@ public function init(...$params) } } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($this->isRequired() && $value == '' && !isset($this->_values[$value])) { return $this->invalid('This field is required.'); diff --git a/src/V3/FigletVariable.php b/src/V3/FigletVariable.php index 57bdd1b..f520a82 100644 --- a/src/V3/FigletVariable.php +++ b/src/V3/FigletVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_String; use Horde_Form_Translation; @@ -37,7 +38,7 @@ public function init(...$params) $this->_font = $params[1]; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (empty($value) && $this->isRequired()) { return $this->invalid('This field is required.'); diff --git a/src/V3/FileVariable.php b/src/V3/FileVariable.php index ed326ba..1c1358a 100644 --- a/src/V3/FileVariable.php +++ b/src/V3/FileVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Util; use Horde_Form_Translation; @@ -31,7 +32,7 @@ class FileVariable extends BaseVariable * * @api */ - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($this->isRequired()) { try { diff --git a/src/V3/HeaderVariable.php b/src/V3/HeaderVariable.php index 6358d8b..e317264 100644 --- a/src/V3/HeaderVariable.php +++ b/src/V3/HeaderVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class HeaderVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return true; } diff --git a/src/V3/HourminutesecondVariable.php b/src/V3/HourminutesecondVariable.php index 8bdc043..cc86ef8 100644 --- a/src/V3/HourminutesecondVariable.php +++ b/src/V3/HourminutesecondVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Date; use Horde_Form_Translation; @@ -33,7 +34,7 @@ public function init(...$params) $this->_show_seconds = $params[0] ?? false; } - public function isValid(Horde_Variables|array $vars, $time): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (!is_array($time)) { if ($this->isRequired()) { diff --git a/src/V3/HtmlVariable.php b/src/V3/HtmlVariable.php index a24270e..7b92929 100644 --- a/src/V3/HtmlVariable.php +++ b/src/V3/HtmlVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class HtmlVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return true; } diff --git a/src/V3/ImageVariable.php b/src/V3/ImageVariable.php index 2baa6bb..1d801f2 100644 --- a/src/V3/ImageVariable.php +++ b/src/V3/ImageVariable.php @@ -4,6 +4,7 @@ use Horde\Util\ArrayUtils; use Horde; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; use Horde_Browser_Exception; @@ -119,7 +120,7 @@ public function onSubmit($vars) * * @api */ - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($vars->get('remove_' . $this->getVarName())) { return true; diff --git a/src/V3/IntVariable.php b/src/V3/IntVariable.php index 3f0b23a..277ca4a 100644 --- a/src/V3/IntVariable.php +++ b/src/V3/IntVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -28,7 +29,7 @@ class IntVariable extends BaseVariable * * @api */ - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($this->isRequired() && empty($value) && ((string) (int) $value !== $value)) { return $this->invalid('This field is required.'); diff --git a/src/V3/IntlistVariable.php b/src/V3/IntlistVariable.php index a8da7bb..55b1b9e 100644 --- a/src/V3/IntlistVariable.php +++ b/src/V3/IntlistVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class IntlistVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (empty($value) && $this->isRequired()) { return $this->invalid('This field is required.'); diff --git a/src/V3/InvalidVariable.php b/src/V3/InvalidVariable.php index a04229b..4ac4d8b 100644 --- a/src/V3/InvalidVariable.php +++ b/src/V3/InvalidVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -30,7 +31,7 @@ public function init(...$params) $this->message = $params[0] ?? ''; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return false; } diff --git a/src/V3/Ip6addressVariable.php b/src/V3/Ip6addressVariable.php index 3708436..7b1c5d6 100644 --- a/src/V3/Ip6addressVariable.php +++ b/src/V3/Ip6addressVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -19,7 +20,7 @@ */ class Ip6addressVariable extends TextVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (strlen(trim((string) $value)) > 0) { $valid = @inet_pton($value); diff --git a/src/V3/IpaddressVariable.php b/src/V3/IpaddressVariable.php index b6be181..502a1e6 100644 --- a/src/V3/IpaddressVariable.php +++ b/src/V3/IpaddressVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -19,7 +20,7 @@ */ class IpaddressVariable extends TextVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (strlen(trim((string) $value)) > 0) { $ip = explode('.', $value); diff --git a/src/V3/KeyvalMultienumVariable.php b/src/V3/KeyvalMultienumVariable.php index 6e7d85d..e3379c9 100644 --- a/src/V3/KeyvalMultienumVariable.php +++ b/src/V3/KeyvalMultienumVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; diff --git a/src/V3/LinkVariable.php b/src/V3/LinkVariable.php index 466c083..42fc73c 100644 --- a/src/V3/LinkVariable.php +++ b/src/V3/LinkVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -38,7 +39,7 @@ public function init(...$params) $this->values = $params[0] ?? null; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return true; } diff --git a/src/V3/LongtextVariable.php b/src/V3/LongtextVariable.php index 7e940d9..601de04 100644 --- a/src/V3/LongtextVariable.php +++ b/src/V3/LongtextVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; diff --git a/src/V3/MatrixVariable.php b/src/V3/MatrixVariable.php index 0eb64cc..ab38ad7 100644 --- a/src/V3/MatrixVariable.php +++ b/src/V3/MatrixVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -54,7 +55,7 @@ public function init(...$params) $this->_new_input = $params[3] ?? false; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return true; } diff --git a/src/V3/MlenumVariable.php b/src/V3/MlenumVariable.php index d68c397..9b3d2e6 100644 --- a/src/V3/MlenumVariable.php +++ b/src/V3/MlenumVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -53,7 +54,7 @@ public function onSubmit($vars) } } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($this->isRequired() && (empty($value['1']) || empty($value['2']))) { return $this->invalid('This field is required.'); diff --git a/src/V3/MonthdayyearVariable.php b/src/V3/MonthdayyearVariable.php index 402649e..0828576 100644 --- a/src/V3/MonthdayyearVariable.php +++ b/src/V3/MonthdayyearVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Date; use Horde_Form_Translation; @@ -62,7 +63,7 @@ public function init(...$params) $this->_format_out = $format_out; } - public function isValid(Horde_Variables|array $vars, $date): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (!is_array($date)) { if ($this->isRequired() && empty($date)) { diff --git a/src/V3/MonthyearVariable.php b/src/V3/MonthyearVariable.php index f4141d4..3ba8dbe 100644 --- a/src/V3/MonthyearVariable.php +++ b/src/V3/MonthyearVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -46,7 +47,7 @@ public function init(...$params) $this->_end_year = $end_year; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (!$this->isRequired()) { return true; diff --git a/src/V3/MultienumVariable.php b/src/V3/MultienumVariable.php index d42a533..9437cf7 100644 --- a/src/V3/MultienumVariable.php +++ b/src/V3/MultienumVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -56,7 +57,7 @@ public function init(...$params) * * @api */ - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (is_array($value)) { foreach ($value as $val) { diff --git a/src/V3/NumberVariable.php b/src/V3/NumberVariable.php index 80b938b..8e2ff28 100644 --- a/src/V3/NumberVariable.php +++ b/src/V3/NumberVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; use Horde_Nls; @@ -33,7 +34,7 @@ public function init(...$params) $this->_fraction = $params[0] ?? null; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($this->isRequired() && empty($value) && ((string) (float) $value !== $value)) { return $this->invalid('This field is required.'); diff --git a/src/V3/ObrowserVariable.php b/src/V3/ObrowserVariable.php index 8663479..dd08cdb 100644 --- a/src/V3/ObrowserVariable.php +++ b/src/V3/ObrowserVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class ObrowserVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return true; } diff --git a/src/V3/OctalVariable.php b/src/V3/OctalVariable.php index b5bcff0..556691f 100644 --- a/src/V3/OctalVariable.php +++ b/src/V3/OctalVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class OctalVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($this->isRequired() && empty($value) && ((string) (int) $value !== $value)) { return $this->invalid('This field is required.'); diff --git a/src/V3/PasswordVariable.php b/src/V3/PasswordVariable.php index e8152f1..6e3b090 100644 --- a/src/V3/PasswordVariable.php +++ b/src/V3/PasswordVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class PasswordVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($this->isRequired() && strlen(trim((string) $value)) == 0) { return $this->invalid('This field is required.'); diff --git a/src/V3/PasswordconfirmVariable.php b/src/V3/PasswordconfirmVariable.php index 618c3d6..084eef0 100644 --- a/src/V3/PasswordconfirmVariable.php +++ b/src/V3/PasswordconfirmVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class PasswordconfirmVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($this->isRequired() && empty($value['original'])) { return $this->invalid('This field is required.'); diff --git a/src/V3/PgpVariable.php b/src/V3/PgpVariable.php index ed98669..70b5cd6 100644 --- a/src/V3/PgpVariable.php +++ b/src/V3/PgpVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; diff --git a/src/V3/PhoneVariable.php b/src/V3/PhoneVariable.php index 56262ac..a654050 100644 --- a/src/V3/PhoneVariable.php +++ b/src/V3/PhoneVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -37,7 +38,7 @@ public function init(...$params) $this->_size = $params[0] ?? 15; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (!strlen(trim((string) $value))) { if ($this->isRequired()) { diff --git a/src/V3/RadioVariable.php b/src/V3/RadioVariable.php index b631482..bb4055a 100644 --- a/src/V3/RadioVariable.php +++ b/src/V3/RadioVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; diff --git a/src/V3/SelectfilesVariable.php b/src/V3/SelectfilesVariable.php index cff3cc5..f10a8a6 100644 --- a/src/V3/SelectfilesVariable.php +++ b/src/V3/SelectfilesVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -75,7 +76,7 @@ public function init(...$params) $this->_icon = $icon; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return true; } diff --git a/src/V3/SetVariable.php b/src/V3/SetVariable.php index 9cb986a..c35e0ab 100644 --- a/src/V3/SetVariable.php +++ b/src/V3/SetVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -36,7 +37,7 @@ public function init(...$params) $this->_checkAll = $params[1] ?? false; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ((!is_null($this->_values) && count($this->_values) == 0) || is_null($value) || count($value) == 0) { return true; diff --git a/src/V3/SmimeVariable.php b/src/V3/SmimeVariable.php index 3c9b395..6008d6e 100644 --- a/src/V3/SmimeVariable.php +++ b/src/V3/SmimeVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; diff --git a/src/V3/SorterVariable.php b/src/V3/SorterVariable.php index 002c7b0..3a190ba 100644 --- a/src/V3/SorterVariable.php +++ b/src/V3/SorterVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -53,7 +54,7 @@ public function init(...$params) $this->_header = $header; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return true; } diff --git a/src/V3/SoundVariable.php b/src/V3/SoundVariable.php index 88b156c..8c99638 100644 --- a/src/V3/SoundVariable.php +++ b/src/V3/SoundVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; use Horde_Themes; @@ -37,7 +38,7 @@ public function getSounds() return $this->_sounds; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($this->isRequired() && empty($value)) { return $this->invalid('This field is required.'); diff --git a/src/V3/SpacerVariable.php b/src/V3/SpacerVariable.php index d512538..6a08967 100644 --- a/src/V3/SpacerVariable.php +++ b/src/V3/SpacerVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class SpacerVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { return true; } diff --git a/src/V3/StringarrayVariable.php b/src/V3/StringarrayVariable.php index 8190385..62223b3 100644 --- a/src/V3/StringarrayVariable.php +++ b/src/V3/StringarrayVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; diff --git a/src/V3/StringlistVariable.php b/src/V3/StringlistVariable.php index 67969dc..8475e9b 100644 --- a/src/V3/StringlistVariable.php +++ b/src/V3/StringlistVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; diff --git a/src/V3/TablesetVariable.php b/src/V3/TablesetVariable.php index d77a74b..08bf315 100644 --- a/src/V3/TablesetVariable.php +++ b/src/V3/TablesetVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -31,7 +32,7 @@ public function init(...$params) $this->_header = $params[1]; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (count($this->_values) == 0 || count($value) == 0) { return true; diff --git a/src/V3/TextVariable.php b/src/V3/TextVariable.php index 3de240a..10fcdb1 100644 --- a/src/V3/TextVariable.php +++ b/src/V3/TextVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_String; use Horde_Form_Translation; @@ -41,7 +42,7 @@ public function init(...$params) $this->_maxlength = $params[2] ?? null; } - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if (!empty($this->_maxlength) && Horde_String::length($value) > $this->_maxlength) { $this->message = sprintf(Horde_Form_Translation::t("Value is over the maximum length of %d."), $this->_maxlength); diff --git a/src/V3/TimeVariable.php b/src/V3/TimeVariable.php index 5101ceb..1b405c8 100644 --- a/src/V3/TimeVariable.php +++ b/src/V3/TimeVariable.php @@ -2,6 +2,7 @@ namespace Horde\Form\V3; +use Horde\Util\Variables; use Horde_Variables; use Horde_Form_Translation; @@ -15,7 +16,7 @@ */ class TimeVariable extends BaseVariable { - public function isValid(Horde_Variables $vars, $value): bool + public function isValid(Horde_Variables|Variables $vars, $value): bool { if ($this->isRequired() && empty($value) && ((string) (float) $value !== $value)) { return $this->invalid('This field is required.');