Skip to content

Commit d8c277c

Browse files
committed
fixup! [NodeTypeResolver] Handle ArrayType with intersection string on AccessoryNonEmptyArrayTypeCorrector (#7332)
1 parent 6d40f8a commit d8c277c

2 files changed

Lines changed: 84 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
3+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\ClassMethodArrayDocblockParamFromLocalCallsRector\Fixture;
4+
5+
use Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\ClassMethodArrayDocblockParamFromLocalCallsRector\Source\SomeReturnedObject;
6+
7+
final class ObjectsOverruleEmptyArray
8+
{
9+
public function go()
10+
{
11+
$this->run($this->getItemsWithArray());
12+
$this->run($this->getItems());
13+
}
14+
15+
public function run(array $result)
16+
{
17+
}
18+
19+
/**
20+
* @return SomeReturnedObject[]|array
21+
*/
22+
private function getItems()
23+
{
24+
return [];
25+
}
26+
27+
/**
28+
* @return SomeReturnedObject[]
29+
*/
30+
private function getItemsWithArray()
31+
{
32+
return [];
33+
}
34+
}
35+
36+
?>
37+
-----
38+
<?php
39+
40+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\ClassMethodArrayDocblockParamFromLocalCallsRector\Fixture;
41+
42+
use Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\ClassMethodArrayDocblockParamFromLocalCallsRector\Source\SomeReturnedObject;
43+
44+
final class ObjectsOverruleEmptyArray
45+
{
46+
public function go()
47+
{
48+
$this->run($this->getItemsWithArray());
49+
$this->run($this->getItems());
50+
$this->run([]);
51+
}
52+
53+
/**
54+
* @param SomeReturnedObject[] $result
55+
*/
56+
public function run(array $result)
57+
{
58+
}
59+
60+
/**
61+
* @return SomeReturnedObject[]|array
62+
*/
63+
private function getItems()
64+
{
65+
return [];
66+
}
67+
68+
/**
69+
* @return SomeReturnedObject[]
70+
*/
71+
private function getItemsWithArray()
72+
{
73+
return [];
74+
}
75+
}
76+
77+
?>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\ClassMethodArrayDocblockParamFromLocalCallsRector\Source;
4+
5+
final class SomeReturnedObject
6+
{
7+
}

0 commit comments

Comments
 (0)