Skip to content

Commit dac1070

Browse files
2.9
1 parent 624368b commit dac1070

File tree

5 files changed

+93
-74
lines changed

5 files changed

+93
-74
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ in practically any PHP project, including WordPress, Laravel, core PHP project,
88

99
[![Packagist](https://img.shields.io/packagist/v/eftec/validationone.svg)](https://packagist.org/packages/eftec/ValidationOne)
1010
[![Total Downloads](https://poser.pugx.org/eftec/validationone/downloads)](https://packagist.org/packages/eftec/ValidationOne)
11-
[![Maintenance](https://img.shields.io/maintenance/yes/2023.svg)]()
11+
[![Maintenance](https://img.shields.io/maintenance/yes/2024.svg)]()
1212
[![composer](https://img.shields.io/badge/composer-%3E1.8-blue.svg)]()
1313
[![php](https://img.shields.io/badge/php-7.x-green.svg)]()
1414
[![php](https://img.shields.io/badge/php-8.x-green.svg)]()
@@ -708,6 +708,9 @@ $validation->convert('htmldecode')->set(....);
708708

709709

710710
## Version list
711+
* 2024-03-02 2.9
712+
* Updating dependency to PHP 7.4. The extended support of PHP 7.2 ended 3 years ago.
713+
* Added more type hinting in the code.
711714
* 2023-11-13 2.8
712715
* some maintenance code.
713716
* 2023-02-26 2.7

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
],
1414
"require": {
15-
"php": "^7.2.5 || ^8.0",
15+
"php": "^7.4 || ^8.0",
1616
"ext-ctype": "*",
1717
"eftec/messagecontainer": "^2.8",
1818
"ext-json": "*",
@@ -27,6 +27,6 @@
2727
"eftec/formone": "Allows to create form and integrates with the validation"
2828
},
2929
"require-dev": {
30-
"phpunit/phpunit": "^9.5.13"
30+
"phpunit/phpunit": "^8.5.13"
3131
}
3232
}

lib/ValidationInputOne.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@
1818
*/
1919
class ValidationInputOne
2020
{
21-
/** @var MessageContainer */
22-
public $messageList;
23-
public $prefix = '';
21+
/** @var MessageContainer|null */
22+
public ?MessageContainer $messageList = null;
23+
public string $prefix = '';
2424

2525
/** @var bool If true then the field exists (it could be null or empty) otherwise it generates an error */
26-
public $exist = false;
26+
public bool $exist = false;
2727
/** @var mixed default value */
2828
public $default;
2929
/** @var mixed default value */
3030
public $initial;
31-
public $ifFailThenOrigin = false;
31+
public bool $ifFailThenOrigin = false;
3232

3333
/** @var mixed It keeps a copy of the original value (after get/post/fetch or set) */
3434
public $originalValue;
35-
/** @var string It's a friendly id used to replace the "id" used in message. For example: "id customer" instead of "idcustomer" */
36-
public $friendId;
35+
/** @var null|string It's a friendly id used to replace the "id" used in message. For example: "id customer" instead of "idcustomer" */
36+
public ?string $friendId = null;
3737

3838
/**
3939
* @param string $prefix
@@ -158,11 +158,11 @@ public function getField(string $field, int $inputType = 99, ?string $msg = null
158158
* @param string|null $msg
159159
* @param bool $isMissing
160160
*
161-
* @return null|array=[current filename,temporal name]
161+
* @return null|array|string=[current filename,temporal name]
162162
* @internal param $folder
163163
* @internal param string $type
164164
*/
165-
public function getFile(string $field, bool $isArray = false, ?string &$msg = null, bool &$isMissing = false): ?array
165+
public function getFile(string $field, bool $isArray = false, ?string &$msg = null, bool &$isMissing = false)
166166
{
167167
$fieldId = $this->prefix . $field;
168168
if (!$isArray) {

lib/ValidationItem.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
*/
1313
class ValidationItem
1414
{
15-
/** @var string=['alpha','alphanum','alphanumunder','between','betweenlen','contain','doc','domain','email','eq','ext','false','gt','gte','image','lt','lte','maxlen','maxsize','minlen','minsize','ne','notcontain','notnull','null','regexp','req','text','true','url','fn.*'][$i] */
16-
public $type;
15+
/** @var null|string=['alpha','alphanum','alphanumunder','between','betweenlen','contain','doc','domain','email','eq','ext','false','gt','gte','image','lt','lte','maxlen','maxsize','minlen','minsize','ne','notcontain','notnull','null','regexp','req','text','true','url','fn.*'][$i] */
16+
public ?string $type = null;
1717
/** @var mixed value used for validation. It could be an array (between for example uses an array) */
1818
public $value;
1919
/** @var string|null Error message (if the condition is not meet) */
20-
public $msg;
21-
/** @var string=['error','warning','info','success'][$i] */
22-
public $level;
20+
public ?string $msg = null;
21+
/** @var null|string=['error','warning','info','success'][$i] */
22+
public ?string $level = null;
2323

2424
/**
2525
* Tris constructor.

0 commit comments

Comments
 (0)