Skip to content

Commit 0108edd

Browse files
committed
Add class type to wrong type exception message
1 parent 5778940 commit 0108edd

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/Type/ArrayType.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public static function fromDefinition(array $definition, ?string $name = null):
5050
$type = $definition['type'] ?? '$ref';
5151

5252
if ($type !== static::type()) {
53-
throw new \RuntimeException(\sprintf('The type "%s" does not match type class "%s"', $type, static::class));
53+
throw new \RuntimeException(
54+
\sprintf('The type "%s" does not match type "%s" class "%s"', $type, self::type(), static::class)
55+
);
5456
}
5557

5658
$self = new static();

src/Type/ObjectType.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ public static function fromDefinition(array $definition, ?string $name = null):
5656
$type = $definition['type'];
5757

5858
if ($type !== static::type()) {
59-
throw new \RuntimeException(\sprintf('The type "%s" does not match type class "%s"', $type, static::class));
59+
throw new \RuntimeException(
60+
\sprintf('The type "%s" does not match type "%s" class "%s"', $type, self::type(), static::class)
61+
);
6062
}
6163

6264
$self = new static();

src/Type/ScalarType.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ public static function fromDefinition(array $definition, ?string $name = null):
4545
$type = $definition['type'];
4646

4747
if ($type !== static::type()) {
48-
throw new \RuntimeException(\sprintf('The type "%s" does not match type class "%s"', $type, static::class));
48+
throw new \RuntimeException(
49+
\sprintf('The type "%s" does not match type "%s" class "%s"', $type, static::type(), static::class)
50+
);
4951
}
5052

5153
$self = new static();

0 commit comments

Comments
 (0)