2 Commits

Author SHA1 Message Date
Dylan K. Taylor
8c19f6cac8 EnumTrait: throw InvalidArgumentException from fromString()
this is more in line with expected behaviour, since this might be used to process arbitrary user input. Only calling an undefined magic static method should throw an Error.
2019-03-31 16:07:42 +01:00
Dylan K. Taylor
01904adf49 Improve enum implementations, move some components to traits
The reason this uses a trait is because `self` refers to the including class in a trait, which offers a small amount of automatic type safety.
If we had templates or generics, this would be a generic class instead.
2019-03-13 15:10:31 +00:00