Skip to content

Commit 76b60b8

Browse files
committed
v2.0.4
1 parent 3d9ce91 commit 76b60b8

17 files changed

+87
-54
lines changed

.gitattributes

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/.gitignore export-ignore
22
/.gitattributes export-ignore
33
/phpunit.xml export-ignore
4+
/phpunit.legacy.xml export-ignore
45
/workenv export-ignore
56
/tests export-ignore
67
/.github export-ignore
7-
/phpcs.php export-ignore
8+
/.php-cs-fixer.php export-ignore

.github/workflows/build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
- 8.1
2323
- 8.2
2424
- 8.3
25+
- 8.4
2526
include:
2627
- phpunit: phpunit.xml
2728
- php: 5.6

phpcs.php renamed to .php-cs-fixer.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* Configuration of code style fixer and checker for this library.
5-
* This configuration compatible with friendsofphp/php-cs-fixer "^3.43.1".
5+
* This configuration compatible with friendsofphp/php-cs-fixer "^3.65.0".
66
*/
77

88
use PhpCsFixer\Finder;
@@ -14,10 +14,8 @@
1414

1515
$config = new Config();
1616
$config->setRules([
17-
'@PSR2' => true,
18-
'array_syntax' => [
19-
'syntax' => 'short',
20-
],
17+
'@PER-CS' => true,
18+
'single_line_empty_body' => false,
2119
]);
2220
$config->setFinder($finder);
2321

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ php-html-form
99
- *Dep*: Deprecated.
1010
- *Fix*: Fixed.
1111

12+
2.0.4 [2024-12-21]
13+
------------------
14+
15+
- Add: Supporting of PHP 8.4.
16+
- Enh: Code style fixes.
17+
1218
2.0.3 [2023-12-30]
1319
------------------
1420

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ The MIT License (MIT)
22

33
Copyright (c) 2016 Adam Wathan <adam.wathan@gmail.com>
44

5-
Copyright (c) 2023 Vasily Belosloodcev <vasily.belosloodcev@gmail.com>
5+
Copyright (c) 2024 Vasily Belosloodcev <vasily.belosloodcev@gmail.com>
66

77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ php-html-form
22
===
33

44
This is fork of [adamwathan/form](https://github.com/adamwathan/form). There is just HTML-elements builder
5-
without any framework support. Extension are supporting PHP from 5.6 to 8.x!
5+
without any framework support. Extension are supporting PHP from 5.6 up to newest!
66

77

88
[![Stable Version](https://poser.pugx.org/bupy7/php-html-form/v/stable)](https://packagist.org/packages/bupy7/php-html-form)
@@ -365,7 +365,7 @@ Code style
365365
To fix code style, run:
366366
367367
```
368-
~/.composer/vendor/bin/php-cs-fixer fix --config=./phpcs.php --verbose
368+
~/.composer/vendor/bin/php-cs-fixer fix --verbose
369369
```
370370
371371
You have to install [PHP CS Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) at first, if you

src/AdamWathan/Form/Elements/Element.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public function data($attribute, $value = null)
2929
{
3030
if (is_array($attribute)) {
3131
foreach ($attribute as $key => $val) {
32-
$this->setAttribute('data-'.$key, $val);
32+
$this->setAttribute('data-' . $key, $val);
3333
}
3434
} else {
35-
$this->setAttribute('data-'.$attribute, $value);
35+
$this->setAttribute('data-' . $attribute, $value);
3636
}
3737

3838
return $this;
@@ -137,7 +137,7 @@ protected function setBooleanAttribute($attribute, $value)
137137

138138
protected function escape($value)
139139
{
140-
return htmlentities((string)$value, ENT_QUOTES, 'UTF-8');
140+
return htmlentities((string) $value, ENT_QUOTES, 'UTF-8');
141141
}
142142

143143
public function __call($method, $params)

src/AdamWathan/Form/Elements/Select.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function getOptAttribute($optValue, $name)
148148
}
149149
return null;
150150
}
151-
151+
152152
public function prompt($label = '', $value = '')
153153
{
154154
$this->options = [$value => $label] + $this->options;

src/AdamWathan/Form/FormBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function setToken($token)
3737

3838
public function open()
3939
{
40-
$open = new FormOpen;
40+
$open = new FormOpen();
4141

4242
if ($this->hasToken()) {
4343
$open->token($this->csrfToken);

tests/BindingTest.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class BindingTest extends TestCase
1111

1212
protected function _setUp()
1313
{
14-
$this->form = new FormBuilder;
14+
$this->form = new FormBuilder();
1515
}
1616

1717
protected function _tearDown()
@@ -128,7 +128,7 @@ public function testBindUnsetProperty()
128128

129129
public function testBindMagicProperty()
130130
{
131-
$object = new MagicGetter;
131+
$object = new MagicGetter();
132132
$this->form->bind($object);
133133

134134
$expected = '<input type="text" name="not_magic" value="foo">';
@@ -167,8 +167,8 @@ public function testBindNestedArray()
167167
'city' => 'Roswell',
168168
'tree' => [
169169
'has' => [
170-
'nested' => 'Bird'
171-
]
170+
'nested' => 'Bird',
171+
],
172172
],
173173
],
174174
];
@@ -188,7 +188,7 @@ public function testBindNestedArrayWithMissingKey()
188188
$array = [
189189
'address' => [
190190
'tree' => [
191-
'nested' => 'Bird'
191+
'nested' => 'Bird',
192192
],
193193
],
194194
];
@@ -227,8 +227,8 @@ public function testBindNestedObject()
227227
'city' => 'Roswell',
228228
'tree' => [
229229
'has' => [
230-
'nested' => 'Bird'
231-
]
230+
'nested' => 'Bird',
231+
],
232232
],
233233
],
234234
]));
@@ -250,8 +250,8 @@ public function testBindNestedMixed()
250250
'city' => 'Roswell',
251251
'tree' => json_decode(json_encode([
252252
'has' => [
253-
'nested' => 'Bird'
254-
]
253+
'nested' => 'Bird',
254+
],
255255
])),
256256
],
257257
];
@@ -407,7 +407,7 @@ public function testExplicitCheckOnRadioTakesPrecedenceOverBinding()
407407

408408
private function getStubObject()
409409
{
410-
$obj = new stdClass;
410+
$obj = new stdClass();
411411

412412
$obj->email = 'johndoe@example.com';
413413
$obj->first_name = 'John';

tests/FormBuilderTest.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class FormBuilderTest extends TestCase
1111

1212
protected function _setUp()
1313
{
14-
$this->form = new FormBuilder;
14+
$this->form = new FormBuilder();
1515
}
1616

1717
protected function _tearDown()
@@ -21,7 +21,7 @@ protected function _tearDown()
2121

2222
public function testFormBuilderCanBeCreated()
2323
{
24-
$formBuilder = new FormBuilder;
24+
$formBuilder = new FormBuilder();
2525
$this->assertInstanceOf('AdamWathan\Form\FormBuilder', $formBuilder);
2626
}
2727

@@ -108,6 +108,7 @@ public function testReset()
108108
/**
109109
* @dataProvider buttonProvider
110110
*/
111+
#[\PHPUnit\Framework\Attributes\DataProvider('buttonProvider')]
111112
public function testButton($value, $name, $expected)
112113
{
113114
$result = (string) $this->form->button($value, $name);

tests/FormOpenTest.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ class FormOpenTest extends TestCase
66
{
77
public function testFormCanBeCreated()
88
{
9-
$form = new FormOpen;
9+
$form = new FormOpen();
1010
$this->assertInstanceOf('AdamWathan\Form\Elements\FormOpen', $form);
1111
}
1212

1313
public function testRenderBasicFormOpen()
1414
{
15-
$form = new FormOpen;
15+
$form = new FormOpen();
1616
$expected = '<form method="POST" action="">';
1717
$result = $form->render();
1818

@@ -21,7 +21,7 @@ public function testRenderBasicFormOpen()
2121

2222
public function testRenderPostFormOpen()
2323
{
24-
$form = new FormOpen;
24+
$form = new FormOpen();
2525
$expected = '<form method="POST" action="">';
2626
$result = $form->post()->render();
2727

@@ -30,7 +30,7 @@ public function testRenderPostFormOpen()
3030

3131
public function testRenderGetFormOpen()
3232
{
33-
$form = new FormOpen;
33+
$form = new FormOpen();
3434
$expected = '<form method="GET" action="">';
3535
$result = $form->get()->render();
3636

@@ -39,7 +39,7 @@ public function testRenderGetFormOpen()
3939

4040
public function testRenderPutFormOpen()
4141
{
42-
$form = new FormOpen;
42+
$form = new FormOpen();
4343
$expected = '<form method="POST" action=""><input type="hidden" name="_method" value="PUT">';
4444
$result = $form->put()->render();
4545

@@ -48,7 +48,7 @@ public function testRenderPutFormOpen()
4848

4949
public function testRenderPatchFormOpen()
5050
{
51-
$form = new FormOpen;
51+
$form = new FormOpen();
5252
$expected = '<form method="POST" action=""><input type="hidden" name="_method" value="PATCH">';
5353
$result = $form->patch()->render();
5454

@@ -57,7 +57,7 @@ public function testRenderPatchFormOpen()
5757

5858
public function testRenderDeleteFormOpen()
5959
{
60-
$form = new FormOpen;
60+
$form = new FormOpen();
6161
$expected = '<form method="POST" action=""><input type="hidden" name="_method" value="DELETE">';
6262
$result = $form->delete()->render();
6363

@@ -66,7 +66,7 @@ public function testRenderDeleteFormOpen()
6666

6767
public function testSetAction()
6868
{
69-
$form = new FormOpen;
69+
$form = new FormOpen();
7070
$expected = '<form method="POST" action="/test">';
7171
$result = $form->action('/test')->render();
7272

@@ -75,7 +75,7 @@ public function testSetAction()
7575

7676
public function testSetCustomAttribute()
7777
{
78-
$form = new FormOpen;
78+
$form = new FormOpen();
7979
$expected = '<form method="POST" action="" data-test="sample">';
8080
$result = $form->attribute('data-test', 'sample')->render();
8181

@@ -84,7 +84,7 @@ public function testSetCustomAttribute()
8484

8585
public function testClearCustomAttribute()
8686
{
87-
$form = new FormOpen;
87+
$form = new FormOpen();
8888
$expected = '<form method="POST" action="">';
8989
$result = $form->attribute('data-test', 'sample')->clear('data-test')->render();
9090

@@ -93,7 +93,7 @@ public function testClearCustomAttribute()
9393

9494
public function testMultipart()
9595
{
96-
$form = new FormOpen;
96+
$form = new FormOpen();
9797
$expected = '<form method="POST" action="" enctype="multipart/form-data">';
9898
$result = $form->multipart()->render();
9999

@@ -102,7 +102,7 @@ public function testMultipart()
102102

103103
public function testEncodingType()
104104
{
105-
$form = new FormOpen;
105+
$form = new FormOpen();
106106
$expected = '<form method="POST" action="" enctype="custom">';
107107
$result = $form->encodingType('custom')->render();
108108

@@ -111,7 +111,7 @@ public function testEncodingType()
111111

112112
public function testCanRenderCsrfToken()
113113
{
114-
$open = new FormOpen;
114+
$open = new FormOpen();
115115
$expected = '<form method="POST" action=""><input type="hidden" name="_token" value="abc123">';
116116
$result = (string) $open->token('abc123');
117117

@@ -120,7 +120,7 @@ public function testCanRenderCsrfToken()
120120

121121
public function testRenderCustomMethodWithToken()
122122
{
123-
$open = new FormOpen;
123+
$open = new FormOpen();
124124
$expected = '<form method="POST" action=""><input type="hidden" name="_token" value="abc123"><input type="hidden" name="_method" value="DELETE">';
125125
$result = $open->token('abc123')->delete()->render();
126126

tests/InputContractTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function testCanRenderWithValue()
195195
$text = $text->value('example@example.com');
196196

197197
$result = $text->render();
198-
$message ='value attribute should be set';
198+
$message = 'value attribute should be set';
199199
$this->assertRegExp($this->elementRegExp('value="example@example.com"'), $result, $message);
200200

201201
$text = $this->newTestSubjectInstance('first_name');

workenv/50_xdebug.ini

-2
This file was deleted.

0 commit comments

Comments
 (0)