granam/strict-string

此包已被放弃,不再维护。作者建议使用 granam/string 包。

轻量级字符串容器,具有严格的检查

1.2.2 2015-09-16 14:57 UTC

This package is not auto-updated.

Last update: 2016-03-16 21:04:26 UTC


README

注意:需要 PHP 5.4+

<?php
use Granam\Strict\String\StrictString;
use Granam\Strict\String\Exceptions\WrongParameterType;

$string = new StrictString('12345');

// foo
echo $string;

try {
  new StrictString(12345);
} catch (WrongParameterType $stringException) {
  // Strict string has to get a string value. Integer is not a string.
  die('Something get wrong: ' . $stringException->getMessage());
}