All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning and this changelog format.
- Minimum PHP version is now 8.2.
- Added generics to the value interface, abstract class and trait. This will be breaking if you are running PHPStan.
- BREAKING: The abstract value and value trait are now both readonly. This is because value objects should always be immutable.
- BREAKING: The abstract value constructor is now final. If you need to parse the provided value before it is
accepted, overload the
parse()method in your class. Alternatively, don't extend theAbstractValueand use theValueTraitinstead.
- New static
AbstractValue::nullable()method. This casts the provided value to the value object, unless it isnull.
- Package tests are now run using Github actions instead of Travis.
- Removed deprecation message on
jsonSerialize()return type for PHP 8.1. - Fixed the argument type in the docblock for
ValueTrait::is()andValueInterface::is().
- Package now supports PHP 8.
This package now requires PHP 7.1 or above.
- Added PHP 7 return types to interface, trait and abstract class methods.
- No longer support PHP 5.6 and 7.0.
- Deprecated mutable value objects have been removed.
- Removed the
isAnymethod in favour ofis.
- The following methods have been added to value objects:
toStringfor fluently casting the object to a string.isAnyto check if the value is one of any number of provided values.isEmptyto check if the value is empty.isNotEmptyto check if the value is not empty.
- Mutable value objects are deprecated and will be removed in 2.0
- The following static methods have been added to both abstract classes:
createwhich is a fluent constructor.castwhich ensures the provided value is an instance ofstatic.
- Minimum PHP version is now
5.6.0. ValueExceptionnow extendsInvalidArgumentException.