- Breaking change: Switched away from custom normalizers to the normalizers from
digital-craftsman/self-aware-normalizers
. - Breaking change: Removed base doctrine type
IdListType
in favor ofArrayNormalizableType
ofdigital-craftsman/self-aware-normalizers
. - Breaking change: Dropped support for PHP 8.2.
- Added support for PHP 8.4.
- Added method
toString(): string
toId
.
- Added method
mapWithIdKeys(callable $mapFunction): array
toIdList
.
- Extend annotations for
Id
andIdList
.
- Renamed parameter
$exception
to$otherwiseThrow
in the guard methods ofId
andIdList
to make it more clear what the parameter does when using named parameters.
- Added option to supply a custom exception to the guard methods of
Id
andIdList
. This allows for more specific exceptions when the guard fails.
Example of using the new (optional) parameter:
$requestingUser->userId->mustNotBeEqualTo(
$command->targetUserId,
static fn () => new Exception\UserCanNotTargetItself(),
);
Reached stability after 2 years of usage in multiple scaled production systems.
- Added new guard method
mustNotBeEmpty(): void
toIdList
.
- Breaking change: Converted database column type from
JSON
toJSONB
forIdListType
to improve comparison performance and enable index creation.
- Added compatibility for Symfony 7.
- Dropped
final
keyword from methodgenerateRandom(): static
fromId
, so that it can be overridden in subclasses. For example to be able to create UUID version 7 ids instead of the default version 4.
- Breaking change: Changed abstract methods of types to be
public
andstatic
to enable automatic registration. - Breaking change: Removed
OrderedIdList
as there weren't enough use cases for it. - Fixed return type of
IdList::fromMap
to bestatic
instead ofself
.
- Breaking change: Dropped support for Symfony below 6.3.
- Added new method
mustNotBeEqualTo(self $idList): void
toIdList
. - Added new method
mustNotBeEqualTo(self $idList): void
toOrderedIdList
. - Added new method
fromMap(iterable $items, callable $mapFunction): static
toIdList
. - Added support for
getSupportedTypes
toIdNormalizer
andIdListNormalizer
for new Symfony 6.3 serializer performance improvements.
- Breaking change: Added
readonly
keyword toId
andIdList
. - Drop support for PHP 8.1.
- Add support for PHP 8.3.
- Breaking change: Updated method
removeId
fromIdList
to throw an exception when the id is not in the list. This is the same behaviour as theaddId
method has. - Breaking change: Performance improvements for larger lists. Internal ids of
IdList
now use the string representation of an id as key instead of the index. - Added new method
removeIdWhenInList(Id $id): static
toIdList
. - Added new method
addIds(self $idList): static
toIdList
. - Added new method
addIdsWhenNotInList(self $idList): static
toIdList
. - Added new method
removeIds(self $idList): static
toIdList
. - Added new method
removeIdsWhenInList(self $idList): static
toIdList
. - Added new method
notContainsEveryId(self $idList): bool
toIdList
. - Added new method
containsNoneIds(self $idList): bool
toIdList
. - Added new method
mustNotContainEveryId(self $idList): void
toIdList
. - Added new method
mustContainNoneIds(self $idList): void
toIdList
. - Added new named constructor
fromIdStrings
toIdList
.
- Breaking change: Changed the way
IdList
'sdiff
method behaves to matcharray_diff
's behavior.- Previously it returned an
IdList
containing all elements that were present in theIdList
itself but not in the givenIdList
(method parameter) as well as all elements that were in the givenIdList
(method parameter) but not in theIdList
itself. - Now it returns an
IdList
containing only the elements that are present in theIdList
itself but not in the givenIdList
(method parameter).
- Previously it returned an
- Added
containsEveryId(self $idList): bool
toIdList
. - Added
containsSomeIds(self $idList): bool
toIdList
. - Added
mustContainEveryId(self $idList): void
toIdList
. - Added
mustContainSomeIds(self $idList): void
toIdList
.
- Added PHPStan on level 9 and fixed PHPStan issues.
- Reduced visibility of internal methods
idAtPosition
,mustNotContainDuplicateIds
andmustOnlyContainIdsOfHandledClass
ofIdList
frompublic
toprivate
.
- Drop support for PHP 8.0.
- Add support for PHP 8.2.
- Improve template annotations
- Return same instance of list when
addIdWhenNotInList
doesn't mutate the list.
- The
IdList
now implements the\IteratorAggregate
instead the\Iterator
interface to fix comparing lists in tests with equal checks.
- Breaking change: The methods
isExistingInList
andisNotExistingInList
have been removed. ThecontainsId
method of the list class must be used instead.
- Breaking change: The methods
isExistingInList
andisNotExistingInList
now expect an id list as parameter instead of an array of ids. - Id list now supports ids of id subclass.
- Initial release