Skip to content

Commit 780ca32

Browse files
authored
[TypeDeclarationDocblocks] Handle nested false and true on DocblockReturnArrayFromDirectArrayInstanceRector (#7354)
* [TypeDeclarationDocblocks] Handle false and true should change to bool on DocblockReturnArrayFromDirectArrayInstanceRector * fix
1 parent ce46023 commit 780ca32

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\ClassMethod\DocblockReturnArrayFromDirectArrayInstanceRector\Fixture;
4+
5+
function FalseAndTrue()
6+
{
7+
return [
8+
'first' => [true],
9+
'second' => [false],
10+
'third' => [true],
11+
'fourth' => [false],
12+
];
13+
}
14+
15+
?>
16+
-----
17+
<?php
18+
19+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\ClassMethod\DocblockReturnArrayFromDirectArrayInstanceRector\Fixture;
20+
21+
/**
22+
* @return array<string, true[]|false[]>
23+
*/
24+
function FalseAndTrue()
25+
{
26+
return [
27+
'first' => [true],
28+
'second' => [false],
29+
'third' => [true],
30+
'fourth' => [false],
31+
];
32+
}
33+
34+
?>

src/NodeTypeResolver/PHPStan/TypeHasher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function createTypeHash(Type $type): string
3232
if ($type instanceof ArrayType) {
3333
return $this->createTypeHash($type->getIterableValueType()) . $this->createTypeHash(
3434
$type->getIterableKeyType()
35-
) . '[]';
35+
) . $type->getItemType()->describe(VerbosityLevel::precise()) . '[]';
3636
}
3737

3838
if ($type instanceof GenericObjectType) {

0 commit comments

Comments
 (0)