Skip to content

Commit bf4d1aa

Browse files
committed
Fixed deprecations from DtoTestCase class
1 parent f8ed110 commit bf4d1aa

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tests/Integration/TestCase/DtoTestCase.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@
2424
use function array_filter;
2525
use function array_map;
2626
use function count;
27+
use function explode;
2728
use function gettype;
2829
use function is_object;
30+
use function preg_replace;
2931
use function sprintf;
32+
use function str_contains;
3033
use function ucfirst;
3134

3235
/**
@@ -261,18 +264,16 @@ private static function getDtoProperties(): array
261264
private static function getType(string $class, string $property): string
262265
{
263266
$propertyInfo = self::initializePropertyExtractor();
264-
$types = $propertyInfo->getTypes($class, $property);
265267

266-
self::assertNotNull($types);
268+
$type = $propertyInfo->getType($class, $property);
269+
$type = preg_replace('/^array<.*>$/', 'array', (string)$type);
267270

268-
$type = $types[0]->getBuiltinType();
271+
self::assertNotNull($type);
269272

270-
if ($type === 'object') {
271-
$type = $types[0]->getClassName();
273+
if (str_contains($type, '|')) {
274+
$type = explode('|', $type)[1];
272275
}
273276

274-
self::assertNotNull($type);
275-
276277
return $type;
277278
}
278279
}

0 commit comments

Comments
 (0)