diff --git a/CHANGELOG.md b/CHANGELOG.md index ab00178a..69c82c66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `data-transfer-object` will be documented in this file +## 1.9.1 - 2019-10-03 + +- Improve type error message + ## 1.9.0 - 2019-08-30 - Add DataTransferObjectCollection::items() diff --git a/src/DataTransferObjectError.php b/src/DataTransferObjectError.php index a8a4ae1b..d426f299 100644 --- a/src/DataTransferObjectError.php +++ b/src/DataTransferObjectError.php @@ -31,7 +31,9 @@ public static function invalidType(Property $property, $value): DataTransferObje $expectedTypes = implode(', ', $property->getTypes()); - return new self("Invalid type: expected {$property->getFqn()} to be of type {$expectedTypes}, instead got value `{$value}`."); + $currentType = gettype($value); + + return new self("Invalid type: expected {$property->getFqn()} to be of type {$expectedTypes}, instead got value `{$value}` ({$currentType})."); } public static function uninitialized(Property $property): DataTransferObjectError