czproject/assert 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

czproject/assert

最新稳定版本:v2.0.1

Composer 安装命令:

composer require czproject/assert

包简介

Assert helper.

README 文档

README

Build Status Downloads this Month Latest Stable Version License

Assert helper, throws exceptions.

Donate

Installation

Download a latest package or use Composer:

composer require czproject/assert

CzProject\Assert requires PHP 8.0 or later.

Usage

use CzProject\Assert\Assert;

function add($a, $b)
{
	Assert::int($a);
	Assert::int($b);
	return $a + $b;
}
  • assert($value, $msg = NULL) - checks if value is TRUE
  • bool($value, $msg = NULL) - checks if value is bool
  • int($value, $msg = NULL) - checks if value is int
  • intOrNull($value, $msg = NULL) - checks if value is int|NULL
  • float($value, $msg = NULL) - checks if value is float
  • floatOrNull($value, $msg = NULL) - checks if value is float|NULL
  • number($value, $msg = NULL) - checks if value is float|int
  • numberOrNull($value, $msg = NULL) - checks if value is float|int|NULL
  • string($value, $msg = NULL) - checks if value is string
  • stringOrNull($value, $msg = NULL) - checks if value is string|NULL
  • type($value, $type, $msg = NULL) - checks if value is instance of given type
  • typeOrNull($value, $type, $msg = NULL) - checks if value is instance of given type or NULL
  • null($value, $msg = NULL) - checks if value is NULL
  • in($value, $arr, $msg = NULL) - checks if value is in array
  • inArray($value, $arr, $msg = NULL) - alias for Assert::in()

PhpStan extension

services:
	-
		class: CzProject\Assert\Bridges\PhpStan\StaticMethodTypeSpecifyingExtension
		tags:
			- phpstan.typeSpecifier.staticMethodTypeSpecifyingExtension

License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/

统计信息

  • 总下载量: 24.02k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 9
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2017-08-22