doctrineum/strict-string

This package is abandoned and no longer maintained. The author suggests using the doctrineum/scalar package instead.

Enumeration type for Doctrine - strings only

2.1.1 2015-08-04 15:18 UTC

This package is auto-updated.

Last update: 2019-02-20 19:57:02 UTC


README

Build Status

About

Doctrine enum allowing strings only.

Example


$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 integration

For details about new Doctrine type registration, see the parent project Doctrineum.