Skip to content

Commit 8035d4e

Browse files
committed
Merged hotfix/add-php-5-6-support into master
2 parents 323a6c0 + adc9ff8 commit 8035d4e

27 files changed

+81
-133
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^7.0",
18+
"php": "^5.6|^7.0",
1919
"zendframework/zend-inputfilter": "^2.6",
2020
"zendframework/zend-validator": "^2.6",
2121
"zendframework/zend-filter": "^2.6",

src/FormElement/BaseFormElement.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @license https://github.com/xtreamwayz/html-form-validator/blob/master/LICENSE.md MIT
88
*/
99

10-
declare(strict_types = 1);
11-
1210
namespace Xtreamwayz\HTMLFormValidator\FormElement;
1311

1412
use DOMDocument;
@@ -29,7 +27,7 @@ class BaseFormElement implements InputProviderInterface
2927

3028
public function __construct(DOMElement $node, DOMDocument $document)
3129
{
32-
$this->node = $node;
30+
$this->node = $node;
3331
$this->document = $document;
3432
}
3533

@@ -39,7 +37,7 @@ public function __construct(DOMElement $node, DOMDocument $document)
3937
*
4038
* @return array
4139
*/
42-
public function getInputSpecification() : array
40+
public function getInputSpecification()
4341
{
4442
$spec = [
4543
'name' => $this->getName(),
@@ -79,7 +77,7 @@ public function getInputSpecification() : array
7977
return $spec;
8078
}
8179

82-
protected function getName() : string
80+
protected function getName()
8381
{
8482
$name = $this->node->getAttribute('name');
8583
if (!$name) {
@@ -89,17 +87,17 @@ protected function getName() : string
8987
return $name;
9088
}
9189

92-
protected function isRequired() : bool
90+
protected function isRequired()
9391
{
9492
return $this->node->hasAttribute('required') || $this->node->getAttribute('aria-required') === 'true';
9593
}
9694

97-
protected function getFilters() : array
95+
protected function getFilters()
9896
{
9997
return [];
10098
}
10199

102-
protected function getValidators() : array
100+
protected function getValidators()
103101
{
104102
return [];
105103
}
@@ -120,7 +118,7 @@ protected function parseDataAttribute($dataAttribute)
120118
}
121119

122120
foreach ($matches as $match) {
123-
$name = $match[1];
121+
$name = $match[1];
124122
$options = [];
125123

126124
if (isset($match[2])) {

src/FormElement/Checkbox.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
* @license https://github.com/xtreamwayz/html-form-validator/blob/master/LICENSE.md MIT
88
*/
99

10-
declare(strict_types = 1);
11-
1210
namespace Xtreamwayz\HTMLFormValidator\FormElement;
1311

1412
use Zend\Validator\Identical as IdenticalValidator;
1513

1614
class Checkbox extends BaseFormElement
1715
{
18-
protected function getValidators() : array
16+
protected function getValidators()
1917
{
2018
return [
2119
[

src/FormElement/Color.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,21 @@
77
* @license https://github.com/xtreamwayz/html-form-validator/blob/master/LICENSE.md MIT
88
*/
99

10-
declare(strict_types = 1);
11-
1210
namespace Xtreamwayz\HTMLFormValidator\FormElement;
1311

1412
use Zend\Filter\StringToLower as StringToLowerFilter;
1513
use Zend\Validator\Regex as RegexValidator;
1614

1715
class Color extends BaseFormElement
1816
{
19-
protected function getFilters() : array
17+
protected function getFilters()
2018
{
2119
return [
2220
['name' => StringToLowerFilter::class],
2321
];
2422
}
2523

26-
protected function getValidators() : array
24+
protected function getValidators()
2725
{
2826
return [
2927
[

src/FormElement/Date.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @license https://github.com/xtreamwayz/html-form-validator/blob/master/LICENSE.md MIT
88
*/
99

10-
declare(strict_types = 1);
11-
1210
namespace Xtreamwayz\HTMLFormValidator\FormElement;
1311

1412
use DateInterval;
@@ -20,7 +18,7 @@ class Date extends DateTimeElement
2018
{
2119
protected $format = 'Y-m-d';
2220

23-
protected function getStepValidator() : array
21+
protected function getStepValidator()
2422
{
2523
$stepValue = $this->node->getAttribute('step') ?: 1; // Days
2624
$baseValue = $this->node->getAttribute('min') ?: date($this->format, 0);

src/FormElement/DateTime.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @license https://github.com/xtreamwayz/html-form-validator/blob/master/LICENSE.md MIT
88
*/
99

10-
declare(strict_types = 1);
11-
1210
namespace Xtreamwayz\HTMLFormValidator\FormElement;
1311

1412
use DateInterval;
@@ -21,9 +19,9 @@ class DateTime extends BaseFormElement
2119
{
2220
protected $format = 'Y-m-d\TH:i';
2321

24-
protected function getValidators() : array
22+
protected function getValidators()
2523
{
26-
$validators = [];
24+
$validators = [];
2725
$validators[] = $this->getDateValidator();
2826

2927
if ($this->node->hasAttribute('min')) {
@@ -55,7 +53,7 @@ protected function getValidators() : array
5553
return $validators;
5654
}
5755

58-
protected function getDateValidator() : array
56+
protected function getDateValidator()
5957
{
6058
return [
6159
'name' => DateValidator::class,
@@ -65,7 +63,7 @@ protected function getDateValidator() : array
6563
];
6664
}
6765

68-
protected function getStepValidator() : array
66+
protected function getStepValidator()
6967
{
7068
$stepValue = $this->node->getAttribute('step') ?: 1; // Minutes
7169
$baseValue = $this->node->getAttribute('min') ?: date($this->format, 0);

src/FormElement/Email.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @license https://github.com/xtreamwayz/html-form-validator/blob/master/LICENSE.md MIT
88
*/
99

10-
declare(strict_types = 1);
11-
1210
namespace Xtreamwayz\HTMLFormValidator\FormElement;
1311

1412
use Zend\Filter\StringTrim as StringTrimFilter;
@@ -20,15 +18,15 @@
2018

2119
class Email extends BaseFormElement
2220
{
23-
protected function getFilters() : array
21+
protected function getFilters()
2422
{
2523
return [
2624
['name' => StripNewlinesFilter::class],
2725
['name' => StringTrimFilter::class],
2826
];
2927
}
3028

31-
protected function getValidators() : array
29+
protected function getValidators()
3230
{
3331
$validators = [];
3432

@@ -65,7 +63,7 @@ protected function getValidators() : array
6563
return $validators;
6664
}
6765

68-
protected function getEmailValidator() : array
66+
protected function getEmailValidator()
6967
{
7068
return [
7169
'name' => EmailAddressValidator::class,

src/FormElement/File.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@
77
* @license https://github.com/xtreamwayz/html-form-validator/blob/master/LICENSE.md MIT
88
*/
99

10-
declare(strict_types = 1);
11-
1210
namespace Xtreamwayz\HTMLFormValidator\FormElement;
1311

1412
use Zend\InputFilter\FileInput;
1513
use Zend\Validator\File\MimeType as MimeTypeValidator;
1614

1715
class File extends BaseFormElement
1816
{
19-
public function getInputSpecification() : array
17+
public function getInputSpecification()
2018
{
2119
$spec = [
2220
'type' => FileInput::class,

src/FormElement/Hidden.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @license https://github.com/xtreamwayz/html-form-validator/blob/master/LICENSE.md MIT
88
*/
99

10-
declare(strict_types = 1);
11-
1210
namespace Xtreamwayz\HTMLFormValidator\FormElement;
1311

1412
class Hidden extends BaseFormElement

src/FormElement/Month.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @license https://github.com/xtreamwayz/html-form-validator/blob/master/LICENSE.md MIT
88
*/
99

10-
declare(strict_types = 1);
11-
1210
namespace Xtreamwayz\HTMLFormValidator\FormElement;
1311

1412
use DateInterval;
@@ -19,7 +17,7 @@ class Month extends DateTimeElement
1917
{
2018
protected $format = 'Y-m';
2119

22-
protected function getStepValidator() : array
20+
protected function getStepValidator()
2321
{
2422
$stepValue = $this->node->getAttribute('step') ?: 1; // Months
2523
$baseValue = $this->node->getAttribute('min') ?: '1970-01';

0 commit comments

Comments
 (0)