doctrineum / strict-string
2.1.1
2015-08-04 15:18 UTC
Requires
- php: >=5.5
- doctrineum/scalar: ~2.0
- granam/string: ~1.0
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~4.4
README
关于
示例
$stringEnum = StrictStringEnum::getEnum('foo bar'); $stringEnum = StrictStringEnum::getEnum('12345'); // throws an exception - only string is allowed $stringEnum = StrictStringEnum::getEnum(''); // throws an exception - only string is allowed StrictStringEnum::getEnum(12); // throws an exception - only string is allowed StrictStringEnum::getEnum(false); // throws an exception - only string is allowed StrictStringEnum::getEnum(null); // throws an exception - only string is allowed StrictStringEnum::getEnum(new ObjectWithToStringMethod('foo'));
Doctrine 集成
有关新 Doctrine 类型注册的详细信息,请参阅父项目 Doctrineum。