tioncico/logic-assert

逻辑断言

1.0.1 2019-09-12 07:49 UTC

This package is auto-updated.

Last update: 2024-05-16 11:50:27 UTC


README

逻辑断言组件,用于项目中,直接断言,抛出异常,简化代码

示例

$userId = null;
//常规判断写法
if ($userId===null){
    echo "会员id不存在!";
}


try{
    //断言写法
    \LogicAssert\Assert::assertEquals($userId, null,'会员id不存在!');
}catch (\Throwable $throwable){
    echo $throwable->getMessage();
}