Skip to content

Commit 12dafde

Browse files
committed
update readme
1 parent b46276a commit 12dafde

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Build Status](https://travis-ci.org/inhere/php-validate.svg?branch=master)](https://travis-ci.org/inhere/php-validate)
77
[![Coverage Status](https://coveralls.io/repos/github/inhere/php-validate/badge.svg?branch=master)](https://coveralls.io/github/inhere/php-validate?branch=master)
88

9-
一个简洁小巧且功能完善的php验证、过滤库。仅有几个文件,无其它依赖。
9+
一个简洁小巧且功能完善的php验证、过滤库。
1010

1111
- 简单方便,支持添加自定义验证器
1212
- 支持前置验证检查, 自定义如何判断非空
@@ -56,7 +56,7 @@ validate 同时支持两种规则配置方式,对应了两种规则的收集
5656
- **github** https://github.com/inhere/php-validate.git
5757
- **gitee** https://gitee.com/inhere/php-validate.git
5858

59-
> **注意:** master 分支是要求 `php7+` 的(推荐使用)。`1.x` 分支是支持php5的代码分支,但是基本上不再维护。
59+
> **注意:** master 分支是要求 `php7.1+` 的(推荐使用)。`1.x` 分支是支持php5的代码分支,但是基本上不再维护。
6060
6161
## 安装
6262

@@ -110,7 +110,7 @@ use Inhere\Validate\Validation;
110110

111111
class PageRequest extends Validation
112112
{
113-
public function rules()
113+
public function rules(): array
114114
{
115115
return [
116116
// 字段必须存在且不能为空
@@ -164,15 +164,15 @@ class PageRequest extends Validation
164164
}
165165

166166
// 定义字段翻译
167-
public function translates()
167+
public function translates(): array
168168
{
169169
return [
170170
'userId' => '用户Id',
171171
];
172172
}
173173

174174
// 自定义验证器的提示消息, 默认消息请看 {@see ErrorMessageTrait::$messages}
175-
public function messages()
175+
public function messages(): array
176176
{
177177
return [
178178
'required' => '{attr} 是必填项。',
@@ -182,7 +182,7 @@ class PageRequest extends Validation
182182
}
183183

184184
// 添加一个验证器。必须返回一个布尔值标明验证失败或成功
185-
protected function customValidator($title)
185+
protected function customValidator($title): bool
186186
{
187187
// some logic ...
188188
// $this->getRaw('field'); 访问 data 数据
@@ -257,7 +257,7 @@ class DataModel
257257
// on model class
258258
class UserModel extends DataModel
259259
{
260-
public function rules()
260+
public function rules(): array
261261
{
262262
return [
263263
['username, passwd', 'required'],
@@ -388,7 +388,7 @@ $v = Validation::make($_POST,[
388388
389389
```php
390390
// 在继承了 Validation 的子类 ValidationClass 中 ...
391-
public function rules()
391+
public function rules(): array
392392
{
393393
return [
394394
['title', 'required' ],
@@ -418,7 +418,7 @@ $v = Validation::make($_POST,[
418418

419419
```php
420420
// 在继承了 Validation 的子类中 ...
421-
public function rules()
421+
public function rules(): array
422422
{
423423
return [
424424
['title', 'required' ],

0 commit comments

Comments
 (0)