mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-30 02:37:58 +08:00
Fixed docs for validatoin. (#5653)
Co-authored-by: lujunyi <lujunyi@shopex.cn>
This commit is contained in:
parent
ca4377c8f7
commit
efc8fd9942
@ -49,7 +49,7 @@ class FooCommand extends HyperfCommand
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'foo:hello';
|
||||
protected ?string $name = 'foo:hello';
|
||||
}
|
||||
```
|
||||
|
||||
@ -97,7 +97,7 @@ class FooCommand extends HyperfCommand
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'foo:hello';
|
||||
protected ?string $name = 'foo:hello';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
@ -134,7 +134,7 @@ class FooCommand extends HyperfCommand
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'foo:hello';
|
||||
protected ?string $name = 'foo:hello';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
|
@ -83,21 +83,21 @@ class User extends Model
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'user';
|
||||
protected ?string $table = 'user';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['id', 'name', 'gender', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['id', 'name', 'gender', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = ['id' => 'integer', 'gender' => 'integer'];
|
||||
protected array $casts = ['id' => 'integer', 'gender' => 'integer'];
|
||||
}
|
||||
```
|
||||
|
||||
@ -129,7 +129,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $table = 'user';
|
||||
protected ?string $table = 'user';
|
||||
}
|
||||
```
|
||||
|
||||
@ -154,7 +154,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
public bool $timestamps = false;
|
||||
}
|
||||
```
|
||||
|
||||
@ -171,7 +171,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $dateFormat = 'U';
|
||||
protected ?string $dateFormat = 'U';
|
||||
}
|
||||
```
|
||||
|
||||
@ -211,7 +211,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $connection = 'connection-name';
|
||||
protected ?string $connection = 'connection-name';
|
||||
}
|
||||
```
|
||||
|
||||
@ -230,7 +230,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $attributes = [
|
||||
protected array $attributes = [
|
||||
'delayed' => false,
|
||||
];
|
||||
}
|
||||
@ -403,7 +403,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $fillable = ['name'];
|
||||
protected array $fillable = ['name'];
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -1004,7 +1004,7 @@ class ValidatorFactoryResolvedListener implements ListenerInterface
|
||||
];
|
||||
}
|
||||
|
||||
public function process(object $event)
|
||||
public function process(object $event): void
|
||||
{
|
||||
/** @var ValidatorFactoryInterface $validatorFactory */
|
||||
$validatorFactory = $event->validatorFactory;
|
||||
|
@ -47,7 +47,7 @@ class FooCommand extends HyperfCommand
|
||||
/**
|
||||
* 执行的命令行
|
||||
*/
|
||||
protected string $name = 'foo:hello';
|
||||
protected ?string $name = 'foo:hello';
|
||||
}
|
||||
```
|
||||
|
||||
@ -93,7 +93,7 @@ class FooCommand extends HyperfCommand
|
||||
/**
|
||||
* 执行的命令行
|
||||
*/
|
||||
protected string $name = 'foo:hello';
|
||||
protected ?string $name = 'foo:hello';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
@ -128,7 +128,7 @@ class FooCommand extends HyperfCommand
|
||||
/**
|
||||
* 执行的命令行
|
||||
*/
|
||||
protected string $name = 'foo:hello';
|
||||
protected ?string $name = 'foo:hello';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
|
@ -83,21 +83,21 @@ class User extends Model
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'user';
|
||||
protected ?string $table = 'user';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['id', 'name', 'gender', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['id', 'name', 'gender', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = ['id' => 'integer', 'gender' => 'integer'];
|
||||
protected array $casts = ['id' => 'integer', 'gender' => 'integer'];
|
||||
}
|
||||
```
|
||||
|
||||
@ -129,7 +129,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $table = 'user';
|
||||
protected ?string $table = 'user';
|
||||
}
|
||||
```
|
||||
|
||||
@ -154,7 +154,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
public bool $timestamps = false;
|
||||
}
|
||||
```
|
||||
|
||||
@ -171,7 +171,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $dateFormat = 'U';
|
||||
protected ?string $dateFormat = 'U';
|
||||
}
|
||||
```
|
||||
|
||||
@ -211,7 +211,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $connection = 'connection-name';
|
||||
protected ?string $connection = 'connection-name';
|
||||
}
|
||||
```
|
||||
|
||||
@ -230,7 +230,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $attributes = [
|
||||
protected array $attributes = [
|
||||
'delayed' => false,
|
||||
];
|
||||
}
|
||||
@ -403,7 +403,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $fillable = ['name'];
|
||||
protected array $fillable = ['name'];
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -1014,7 +1014,7 @@ class ValidatorFactoryResolvedListener implements ListenerInterface
|
||||
];
|
||||
}
|
||||
|
||||
public function process(object $event)
|
||||
public function process(object $event): void
|
||||
{
|
||||
/** @var ValidatorFactoryInterface $validatorFactory */
|
||||
$validatorFactory = $event->validatorFactory;
|
||||
|
@ -47,7 +47,7 @@ class FooCommand extends HyperfCommand
|
||||
/**
|
||||
* 執行的命令行
|
||||
*/
|
||||
protected string $name = 'foo:hello';
|
||||
protected ?string $name = 'foo:hello';
|
||||
}
|
||||
```
|
||||
|
||||
@ -93,7 +93,7 @@ class FooCommand extends HyperfCommand
|
||||
/**
|
||||
* 執行的命令行
|
||||
*/
|
||||
protected string $name = 'foo:hello';
|
||||
protected ?string $name = 'foo:hello';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
@ -128,7 +128,7 @@ class FooCommand extends HyperfCommand
|
||||
/**
|
||||
* 執行的命令行
|
||||
*/
|
||||
protected string $name = 'foo:hello';
|
||||
protected ?string $name = 'foo:hello';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
|
@ -83,21 +83,21 @@ class User extends Model
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'user';
|
||||
protected ?string $table = 'user';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['id', 'name', 'gender', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['id', 'name', 'gender', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = ['id' => 'integer', 'gender' => 'integer'];
|
||||
protected array $casts = ['id' => 'integer', 'gender' => 'integer'];
|
||||
}
|
||||
```
|
||||
|
||||
@ -129,7 +129,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $table = 'user';
|
||||
protected ?string $table = 'user';
|
||||
}
|
||||
```
|
||||
|
||||
@ -154,7 +154,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
public bool $timestamps = false;
|
||||
}
|
||||
```
|
||||
|
||||
@ -171,7 +171,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $dateFormat = 'U';
|
||||
protected ?string $dateFormat = 'U';
|
||||
}
|
||||
```
|
||||
|
||||
@ -211,7 +211,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $connection = 'connection-name';
|
||||
protected ?string $connection = 'connection-name';
|
||||
}
|
||||
```
|
||||
|
||||
@ -230,7 +230,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $attributes = [
|
||||
protected array $attributes = [
|
||||
'delayed' => false,
|
||||
];
|
||||
}
|
||||
@ -403,7 +403,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $fillable = ['name'];
|
||||
protected array $fillable = ['name'];
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -1014,7 +1014,7 @@ class ValidatorFactoryResolvedListener implements ListenerInterface
|
||||
];
|
||||
}
|
||||
|
||||
public function process(object $event)
|
||||
public function process(object $event): void
|
||||
{
|
||||
/** @var ValidatorFactoryInterface $validatorFactory */
|
||||
$validatorFactory = $event->validatorFactory;
|
||||
|
@ -47,7 +47,7 @@ class FooCommand extends HyperfCommand
|
||||
/**
|
||||
* 執行的命令列
|
||||
*/
|
||||
protected string $name = 'foo:hello';
|
||||
protected ?string $name = 'foo:hello';
|
||||
}
|
||||
```
|
||||
|
||||
@ -93,7 +93,7 @@ class FooCommand extends HyperfCommand
|
||||
/**
|
||||
* 執行的命令列
|
||||
*/
|
||||
protected string $name = 'foo:hello';
|
||||
protected ?string $name = 'foo:hello';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
@ -128,7 +128,7 @@ class FooCommand extends HyperfCommand
|
||||
/**
|
||||
* 執行的命令列
|
||||
*/
|
||||
protected string $name = 'foo:hello';
|
||||
protected ?string $name = 'foo:hello';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
|
@ -83,21 +83,21 @@ class User extends Model
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'user';
|
||||
protected ?string $table = 'user';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['id', 'name', 'gender', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['id', 'name', 'gender', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = ['id' => 'integer', 'gender' => 'integer'];
|
||||
protected array $casts = ['id' => 'integer', 'gender' => 'integer'];
|
||||
}
|
||||
```
|
||||
|
||||
@ -129,7 +129,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $table = 'user';
|
||||
protected ?string $table = 'user';
|
||||
}
|
||||
```
|
||||
|
||||
@ -154,7 +154,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
public bool $timestamps = false;
|
||||
}
|
||||
```
|
||||
|
||||
@ -171,7 +171,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $dateFormat = 'U';
|
||||
protected ?string $dateFormat = 'U';
|
||||
}
|
||||
```
|
||||
|
||||
@ -211,7 +211,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $connection = 'connection-name';
|
||||
protected ?string $connection = 'connection-name';
|
||||
}
|
||||
```
|
||||
|
||||
@ -230,7 +230,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $attributes = [
|
||||
protected array $attributes = [
|
||||
'delayed' => false,
|
||||
];
|
||||
}
|
||||
@ -403,7 +403,7 @@ use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
protected $fillable = ['name'];
|
||||
protected array $fillable = ['name'];
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -1014,7 +1014,7 @@ class ValidatorFactoryResolvedListener implements ListenerInterface
|
||||
];
|
||||
}
|
||||
|
||||
public function process(object $event)
|
||||
public function process(object $event): void
|
||||
{
|
||||
/** @var ValidatorFactoryInterface $validatorFactory */
|
||||
$validatorFactory = $event->validatorFactory;
|
||||
|
Loading…
Reference in New Issue
Block a user