Skip to content

Commit f0c8c54

Browse files
committed
improved error message in parameter formatter
1 parent 6a8a9a2 commit f0c8c54

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/ParameterHelper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use DateInterval;
2222
use DateTimeInterface;
2323
use DateTimeZone;
24+
use function get_debug_type;
2425
use function gettype;
2526
use InvalidArgumentException;
2627
use function is_array;
@@ -110,7 +111,7 @@ private static function stringAbleToString($value): ?string
110111
private static function filterInvalidType($value)
111112
{
112113
if ($value !== null && !is_scalar($value)) {
113-
throw new InvalidArgumentException('Requests must be iterable, scalar, null or string able');
114+
throw new InvalidArgumentException(sprintf('Cannot format parameter of type: %s to work with Neo4J', get_debug_type($value)));
114115
}
115116

116117
return $value;

tests/Unit/ParameterHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function __toString(): string
148148
public function testInvalidType(): void
149149
{
150150
$this->expectException(InvalidArgumentException::class);
151-
$this->expectExceptionMessage('Requests must be iterable, scalar, null or string able');
151+
$this->expectExceptionMessage('Cannot format parameter of type: stdClass to work with Neo4J');
152152
ParameterHelper::asParameter(new stdClass());
153153
}
154154
}

0 commit comments

Comments
 (0)