Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace Rector\Tests\TypeDeclarationDocblocks\Rector\ClassMethod\DocblockReturnArrayFromDirectArrayInstanceRector\Fixture\Nesting;

final class SimpleNesting
{
public static function returnArray(): array
{
return [
'key1' => 'string-1',
'key2' => [
'key2a' => null,
'key2b' => [
'key2b1' => 'ABC',
],
],
'key3' => 'string-2',
'key4' => null,
'key5' => 'string-3',
];
}
}
-----
<?php

namespace Rector\Tests\TypeDeclarationDocblocks\Rector\ClassMethod\DocblockReturnArrayFromDirectArrayInstanceRector\Fixture\Nesting;

final class SimpleNesting
{
/**
* @return array<string, array<string, array<string, string>|null>|string|null>
*/
public static function returnArray(): array
{
return [
'key1' => 'string-1',
'key2' => [
'key2a' => null,
'key2b' => [
'key2b1' => 'ABC',
],
],
'key3' => 'string-2',
'key4' => null,
'key5' => 'string-3',
];
}
}
3 changes: 2 additions & 1 deletion rules/Privatization/TypeManipulator/TypeNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* @var int
*/
private const MAX_PRINTED_UNION_DOC_LENGHT = 50;
private const MAX_PRINTED_UNION_DOC_LENGHT = 60;

public function __construct(
private TypeFactory $typeFactory,
Expand Down Expand Up @@ -78,6 +78,7 @@ public function generalizeConstantTypes(Type $type): Type

// should be string[]
$itemType = $traverseCallback($type->getItemType(), $traverseCallback);

if ($itemType instanceof ConstantStringType) {
$itemType = new StringType();
}
Expand Down
Loading