Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

0.3

Compare
Choose a tag to compare
@robertrossmann robertrossmann released this 25 Nov 18:10
· 38 commits to master since this release

Version 0.3 ( 2013-11-25 )

This version brings an important new feature: type hinting for your Enumerations!

Example:

class Animal extends \Dreamscapes\Enumeration
{
  const Horse = 1;
  const Dog = 2;
}

// Type-hint an Enumeration in your list of parameters!
function myFunction(Animal $animal)
{
// Such members can also be represented as strings easily
  echo $animal;
}

// To pass the type hint:
myFunction(Animal::Horse()); // prints (string)"Horse"

Of course, you can still use a simple Animal::Horse if you do not need this functionality.

Fixes

  • Trigger PHP error when accessing undefined Enumeration members instead of silently ignoring such actions