Skip to content

Commit 68687fe

Browse files
committed
chore: fix phpstan complaints
1 parent 6f8a75a commit 68687fe

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

phpstan.neon.dist

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ parameters:
55
paths:
66
- src
77
- tests
8+
ignoreErrors:
9+
- '#Call to static method getClass\(\) on an unknown class Doctrine\\Common\\Util\\ClassUtils#'

tests/Dbal/Type/DummyObjectIdType.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?DummyObj
2828
}
2929

3030
if (!\is_string($value) && !is_int($value)) {
31-
throw ConversionException::conversionFailedInvalidType($value, $this->getName(), ['null', 'string', 'int', DummyObjectId::class]);
31+
$actualType = \get_debug_type($value);
32+
$possibleTypes = ['null', 'string', 'int', self::class];
33+
throw new ConversionException(\sprintf("Could not convert PHP value '%s' of type '%s' to type '%s'. Expected one of the following types: %s", $value, $actualType, $this->getName(), \implode(', ', $possibleTypes)));
3234
}
3335

3436
return new DummyObjectId((int) $value);
@@ -48,7 +50,9 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): ?int
4850
}
4951

5052
if (!\is_string($value) && !is_int($value)) {
51-
throw ConversionException::conversionFailedInvalidType($value, $this->getName(), ['null', 'string', 'int', DummyObjectId::class]);
53+
$actualType = \get_debug_type($value);
54+
$possibleTypes = ['null', 'string', 'int', self::class];
55+
throw new ConversionException(\sprintf("Could not convert PHP value '%s' of type '%s' to type '%s'. Expected one of the following types: %s", $value, $actualType, $this->getName(), \implode(', ', $possibleTypes)));
5256
}
5357

5458
return (int) $value;

0 commit comments

Comments
 (0)