diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 05d2a47..8a10a79 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -22,6 +22,9 @@ on:
name: build
+permissions:
+ contents: read
+
jobs:
phpunit:
uses: yiisoft/actions/.github/workflows/phpunit.yml@master
diff --git a/CHANGELOG.md b/CHANGELOG.md
index afd2292..e8d15a1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,7 @@
## 1.1.1 under development
-- no changes in this release.
+- Enh #89: Add support for `yiisoft/html` version `^4.0` (@vjik)
## 1.1.0 December 23, 2025
diff --git a/composer.json b/composer.json
index 2263e2d..9841ebe 100644
--- a/composer.json
+++ b/composer.json
@@ -31,7 +31,7 @@
"ext-mbstring": "*",
"psr/http-message": "^1.0 || ^2.0",
"yiisoft/form": "^1.0",
- "yiisoft/html": "^3.3",
+ "yiisoft/html": "^3.3 || ^4.0",
"yiisoft/hydrator": "^1.3",
"yiisoft/strings": "^2.3",
"yiisoft/validator": "^2.5"
diff --git a/tests/FieldFactoryTest.php b/tests/FieldFactoryTest.php
index e51fe06..7674e90 100644
--- a/tests/FieldFactoryTest.php
+++ b/tests/FieldFactoryTest.php
@@ -108,7 +108,7 @@ public function testCheckbox(): void
$this->assertSame(
<<
-
+
HTML,
$result,
@@ -130,7 +130,7 @@ public function testCheckboxWithTheme(): void
$this->assertSame(
<<
-
+
HTML,
$result,
@@ -150,8 +150,8 @@ public function testCheckboxList(): void
HTML;
@@ -181,8 +181,8 @@ public function testCheckboxListWithTheme(): void
HTML;
@@ -197,7 +197,7 @@ public function testDate(): void
<<
-
+
HTML,
$result,
@@ -220,7 +220,7 @@ public function testDateWithTheme(): void
<<
-
+
HTML,
$result,
@@ -234,7 +234,7 @@ public function testDateTimeLocal(): void
<<
-
+
HTML,
$result,
@@ -257,7 +257,7 @@ public function testDateTimeLocalWithTheme(): void
<<
-
+
HTML,
$result,
@@ -271,7 +271,7 @@ public function testEmail(): void
<<
-
+
Email for notifications.
HTML,
@@ -295,7 +295,7 @@ public function testEmailWithTheme(): void
<<
-
+
Email for notifications.
HTML,
@@ -398,7 +398,7 @@ public function testFile(): void
<<
-
+
HTML,
$result,
@@ -421,7 +421,7 @@ public function testFileWithTheme(): void
<<
-
+
HTML,
$result,
@@ -432,7 +432,7 @@ public function testHidden(): void
{
$result = (new FieldFactory())->hidden(new TestForm(), 'key')->render();
$this->assertSame(
- '',
+ '',
$result,
);
}
@@ -450,7 +450,7 @@ public function testHiddenWithTheme(): void
$result = (new FieldFactory('A'))->hidden(new TestForm(), 'key', theme: 'B')->render();
$this->assertSame(
- '',
+ '',
$result,
);
}
@@ -516,7 +516,7 @@ public function testNumber(): void
<<
-
+
Full years.
HTML,
@@ -540,7 +540,7 @@ public function testNumberWithTheme(): void
<<
-
+
Full years.
HTML,
@@ -555,7 +555,7 @@ public function testPassword(): void
<<
-
+
Enter your old password.
HTML,
@@ -579,7 +579,7 @@ public function testPasswordWithTheme(): void
<<
-
+
Enter your old password.
HTML,
@@ -600,8 +600,8 @@ public function testRadioList(): void
@@ -632,8 +632,8 @@ public function testRadioListWithTheme(): void
@@ -652,7 +652,7 @@ public function testRange(): void
<<
-
+
HTML,
$result,
@@ -678,7 +678,7 @@ public function testRangeWithTheme(): void
<<
-
+
HTML,
$result,
@@ -815,7 +815,7 @@ public function testTelephone(): void
<<
-
+
Enter your phone.
HTML,
@@ -839,7 +839,7 @@ public function testTelephoneWithTheme(): void
<<
-
+
Enter your phone.
HTML,
@@ -854,7 +854,7 @@ public function testText(): void
<<
-
+
Input your full name.
HTML,
@@ -878,7 +878,7 @@ public function testTextWithTheme(): void
<<
-
+
Input your full name.
HTML,
@@ -893,7 +893,7 @@ public function testTextarea(): void
<<
-
+
HTML,
$result,
@@ -916,7 +916,7 @@ public function testTextareaWithTheme(): void
<<
-
+
HTML,
$result,
@@ -930,7 +930,7 @@ public function testTime(): void
$expected = <<
-
+
HTML;
@@ -953,7 +953,7 @@ public function testTimeWithTheme(): void
$expected = <<
-
+
HTML;
@@ -967,7 +967,7 @@ public function testUrl(): void
<<
-
+
Enter your site URL.
HTML,
@@ -991,7 +991,7 @@ public function testUrlWithTheme(): void
<<
-
+
Enter your site URL.
HTML,
diff --git a/tests/FieldTest.php b/tests/FieldTest.php
index 91cb9c1..ed946ef 100644
--- a/tests/FieldTest.php
+++ b/tests/FieldTest.php
@@ -109,7 +109,7 @@ public function testCheckbox(): void
$this->assertSame(
<<
-
+
HTML,
$result,
@@ -131,7 +131,7 @@ public function testCheckboxWithTheme(): void
$this->assertSame(
<<
-
+
HTML,
$result,
@@ -151,8 +151,8 @@ public function testCheckboxList(): void
HTML;
@@ -182,8 +182,8 @@ public function testCheckboxListWithTheme(): void
HTML;
@@ -198,7 +198,7 @@ public function testDate(): void
<<
-
+
HTML,
$result,
@@ -221,7 +221,7 @@ public function testDateWithTheme(): void
<<
-
+
HTML,
$result,
@@ -235,7 +235,7 @@ public function testDateTimeLocal(): void
<<
-
+
HTML,
$result,
@@ -258,7 +258,7 @@ public function testDateTimeLocalWithTheme(): void
<<
-
+
HTML,
$result,
@@ -272,7 +272,7 @@ public function testEmail(): void
<<
-
+
Email for notifications.
HTML,
@@ -296,7 +296,7 @@ public function testEmailWithTheme(): void
<<
-
+
Email for notifications.
HTML,
@@ -399,7 +399,7 @@ public function testFile(): void
<<
-
+
HTML,
$result,
@@ -422,7 +422,7 @@ public function testFileWithTheme(): void
<<
-
+
HTML,
$result,
@@ -433,7 +433,7 @@ public function testHidden(): void
{
$result = Field::hidden(new TestForm(), 'key')->render();
$this->assertSame(
- '',
+ '',
$result,
);
}
@@ -451,7 +451,7 @@ public function testHiddenWithTheme(): void
$result = FieldWithTheme::hidden(new TestForm(), 'key', theme: 'B')->render();
$this->assertSame(
- '',
+ '',
$result,
);
}
@@ -517,7 +517,7 @@ public function testNumber(): void
<<
-
+
Full years.
HTML,
@@ -541,7 +541,7 @@ public function testNumberWithTheme(): void
<<
-
+
Full years.
HTML,
@@ -556,7 +556,7 @@ public function testPassword(): void
<<
-
+
Enter your old password.
HTML,
@@ -580,7 +580,7 @@ public function testPasswordWithTheme(): void
<<
-
+
Enter your old password.
HTML,
@@ -601,8 +601,8 @@ public function testRadioList(): void
@@ -633,8 +633,8 @@ public function testRadioListWithTheme(): void
@@ -653,7 +653,7 @@ public function testRange(): void
<<
-
+
HTML,
$result,
@@ -679,7 +679,7 @@ public function testRangeWithTheme(): void
<<
-
+
HTML,
$result,
@@ -816,7 +816,7 @@ public function testTelephone(): void
<<
-
+
Enter your phone.
HTML,
@@ -840,7 +840,7 @@ public function testTelephoneWithTheme(): void
<<
-
+
Enter your phone.
HTML,
@@ -855,7 +855,7 @@ public function testText(): void
<<
-
+
Input your full name.
HTML,
@@ -879,7 +879,7 @@ public function testTextWithTheme(): void
<<
-
+
Input your full name.
HTML,
@@ -894,7 +894,7 @@ public function testTextarea(): void
<<
-
+
HTML,
$result,
@@ -917,7 +917,7 @@ public function testTextareaWithTheme(): void
<<
-
+
HTML,
$result,
@@ -931,7 +931,7 @@ public function testTime(): void
$expected = <<
-
+
HTML;
@@ -954,7 +954,7 @@ public function testTimeWithTheme(): void
$expected = <<
-
+
HTML;
@@ -968,7 +968,7 @@ public function testUrl(): void
<<
-
+
Enter your site URL.
HTML,
@@ -992,7 +992,7 @@ public function testUrlWithTheme(): void
<<
-
+
Enter your site URL.
HTML,
diff --git a/tests/FormModelTest.php b/tests/FormModelTest.php
index 4ebeb95..e8075cc 100644
--- a/tests/FormModelTest.php
+++ b/tests/FormModelTest.php
@@ -60,7 +60,7 @@ public function testArrayValue(): void
$expected = <<<'HTML'
-
+
HTML;
@@ -90,7 +90,7 @@ public function testNonExistArrayValue(): void
<<
-
+
HTML,
$result,
@@ -102,7 +102,7 @@ public function testArrayValueIntoObject(): void
$expected = <<<'HTML'
-
+
HTML;
diff --git a/tests/ValidationRulesEnricherTest.php b/tests/ValidationRulesEnricherTest.php
index d379ef4..35bbe8f 100644
--- a/tests/ValidationRulesEnricherTest.php
+++ b/tests/ValidationRulesEnricherTest.php
@@ -52,43 +52,43 @@ public static function dataUrl(): array
{
return [
'required' => [
- '',
+ '',
'company',
],
'required-with-when' => [
- '',
+ '',
'requiredWhen',
],
'has-length' => [
- '',
+ '',
'home',
],
'regex' => [
- '',
+ '',
'code',
],
'regex-not' => [
- '',
+ '',
'nocode',
],
'url' => [
- '',
+ '',
'shop',
],
'url-regex' => [
- '',
+ '',
'beach',
],
'regex-url' => [
- '',
+ '',
'beach2',
],
'url-with-idn' => [
- '',
+ '',
'urlWithIdn',
],
'regex-and-url-with-idn' => [
- '',
+ '',
'regexAndUrlWithIdn',
],
];
@@ -109,23 +109,23 @@ public static function dataText(): array
{
return [
'required' => [
- '',
+ '',
'company',
],
'has-length' => [
- '',
+ '',
'shortdesc',
],
'regex' => [
- '',
+ '',
'code',
],
'regex-not' => [
- '',
+ '',
'nocode',
],
'required-with-when' => [
- '',
+ '',
'requiredWhen',
],
];
@@ -148,15 +148,15 @@ public static function dataTextarea(): array
{
return [
'required' => [
- '',
+ '',
'bio',
],
'has-length' => [
- '',
+ '',
'shortdesc',
],
'required-with-when' => [
- '',
+ '',
'requiredWhen',
],
];
@@ -178,23 +178,23 @@ public static function dataTelephone(): array
{
return [
'required' => [
- '',
+ '',
'office1',
],
'has-length' => [
- '',
+ '',
'office2',
],
'regex' => [
- '',
+ '',
'code',
],
'regex-not' => [
- '',
+ '',
'nocode',
],
'required-with-when' => [
- '',
+ '',
'requiredWhen',
],
];
@@ -223,7 +223,7 @@ public function testSelect(): void
->render();
$expected = <<
+
HTML;
@@ -261,7 +261,7 @@ public function testSelectWithWhenNext(): void
->render();
$expected = <<
+
HTML;
@@ -273,23 +273,23 @@ public static function dataPassword(): array
{
return [
'required' => [
- '',
+ '',
'entry1',
],
'has-length' => [
- '',
+ '',
'entry2',
],
'regex' => [
- '',
+ '',
'code',
],
'regex-not' => [
- '',
+ '',
'nocode',
],
'required-with-when' => [
- '',
+ '',
'requiredWhen',
],
];
@@ -317,7 +317,7 @@ public function testFile(): void
$expected = <<
-
+
HTML;
@@ -334,7 +334,7 @@ public function testFileWithWhen(): void
$expected = <<
-
+
HTML;
@@ -351,7 +351,7 @@ public function testFileWithWhenNext(): void
$expected = <<
-
+
HTML;
@@ -368,7 +368,7 @@ public function testDateTimeInputField(): void
$expected = <<
-
+
HTML;
@@ -385,7 +385,7 @@ public function testDateTimeInputFieldWithWhen(): void
$expected = <<
-
+
HTML;
@@ -402,7 +402,7 @@ public function testDateTimeInputFieldWithWhenAndNext(): void
$expected = <<
-
+
HTML;
@@ -413,23 +413,23 @@ public static function dataEmail(): array
{
return [
'required' => [
- '',
+ '',
'cto',
],
'has-length' => [
- '',
+ '',
'teamlead',
],
'regex' => [
- '',
+ '',
'code',
],
'regex-not' => [
- '',
+ '',
'nocode',
],
'required-with-when' => [
- '',
+ '',
'requiredWhen',
],
];
@@ -451,15 +451,15 @@ public static function dataNumber(): array
{
return [
'required' => [
- '',
+ '',
'weight',
],
'number' => [
- '',
+ '',
'step',
],
'required-with-when' => [
- '',
+ '',
'requiredWhen',
],
];
@@ -481,15 +481,15 @@ public static function dataRange(): array
{
return [
'required' => [
- '',
+ '',
'volume',
],
'number' => [
- '',
+ '',
'count',
],
'required-with-when' => [
- '',
+ '',
'requiredWhen',
],
];