granam / strict-string
Lightweight string container with strict checks
Installs: 138
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
pkg:composer/granam/strict-string
Requires
- php: >=5.4
- granam/exception-hierarchy: ~2.1
- granam/scalar: ~1.0
- granam/strict-object: ~1.1
- granam/strict-scalar: ~2.0
- granam/string: ~1.0
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~4.4
README
Note: requires 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());
}