Skip to content

Commit e6a0c70

Browse files
committed
Generate error messages as associative array
1 parent 1503b12 commit e6a0c70

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ It's a standalone single file PHP class to use on your projects. It requires no
66
## What's New
77
- **Date validation** - Validate date format and date range
88
- **Field alias** - Set alias on field names for error messages
9+
- **Error messages** - Generate error messages as associative array
910

1011
## How To Use
1112
You only need only one file:

Validator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private function add_error_message($type, $others = []){
7373
foreach($others as $key => $val){
7474
$msg = str_replace('{'.$key.'}', $val, $msg);
7575
}
76-
array_push($this->error_messages, $msg);
76+
$this->error_messages[$this->current_field] = $msg;
7777
}
7878

7979
/**

0 commit comments

Comments
 (0)