Skip to content

Commit f07241b

Browse files
committed
[TypeDeclarationDocblocks] Avoid array<mixed, mixed> on complex array structure with all string key on DocblockReturnArrayFromDirectArrayInstanceRector
1 parent 1514b5e commit f07241b

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

  • rules-tests/TypeDeclarationDocblocks/Rector/ClassMethod/DocblockReturnArrayFromDirectArrayInstanceRector/Fixture
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\ClassMethod\DocblockReturnArrayFromDirectArrayInstanceRector\Fixture;
4+
5+
class ComplexArray
6+
{
7+
public function getServiceOrderWithIncident(): array
8+
{
9+
return [
10+
'id' => new \stdClass(),
11+
'context' => [
12+
'id' => 1,
13+
'data' => [
14+
'foo' => 'bar',
15+
'baz' => 'qux',
16+
],
17+
],
18+
'values' => [
19+
'name' => '111',
20+
],
21+
];
22+
}
23+
}
24+
25+
?>
26+
-----
27+
<?php
28+
29+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\ClassMethod\DocblockReturnArrayFromDirectArrayInstanceRector\Fixture;
30+
31+
class ComplexArray
32+
{
33+
/**
34+
* @return array<string, mixed>
35+
*/
36+
public function getServiceOrderWithIncident(): array
37+
{
38+
return [
39+
'id' => new \stdClass(),
40+
'context' => [
41+
'id' => 1,
42+
'data' => [
43+
'foo' => 'bar',
44+
'baz' => 'qux',
45+
],
46+
],
47+
'values' => [
48+
'name' => '111',
49+
],
50+
];
51+
}
52+
}
53+
54+
?>

0 commit comments

Comments
 (0)