Skip to content

Commit b5d1075

Browse files
authored
[TypeDeclarationDocblocks] Allow override dummy mixed identifier on UsefulArrayTagNodeAnalyzer (#7395)
1 parent 7a73e88 commit b5d1075

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\AddReturnDocblockDataProviderRector\Fixture;
4+
5+
use PHPUnit\Framework\Attributes\DataProvider;
6+
use PHPUnit\Framework\TestCase;
7+
8+
final class OverrideDummyMixed extends TestCase
9+
{
10+
#[DataProvider('provideData')]
11+
public function testSomething()
12+
{
13+
}
14+
15+
/**
16+
* @return mixed
17+
*/
18+
public static function provideData()
19+
{
20+
return [
21+
[125, 35],
22+
[1252]
23+
];
24+
}
25+
}
26+
27+
?>
28+
-----
29+
<?php
30+
31+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\AddReturnDocblockDataProviderRector\Fixture;
32+
33+
use PHPUnit\Framework\Attributes\DataProvider;
34+
use PHPUnit\Framework\TestCase;
35+
36+
final class OverrideDummyMixed extends TestCase
37+
{
38+
#[DataProvider('provideData')]
39+
public function testSomething()
40+
{
41+
}
42+
43+
/**
44+
* @return int[][]
45+
*/
46+
public static function provideData()
47+
{
48+
return [
49+
[125, 35],
50+
[1252]
51+
];
52+
}
53+
}
54+
55+
?>

rules/TypeDeclarationDocblocks/TagNodeAnalyzer/UsefulArrayTagNodeAnalyzer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ public function isUsefulArrayTag(null|ReturnTagValueNode|ParamTagValueNode|VarTa
2222
return true;
2323
}
2424

25-
return $type->name !== 'array';
25+
return ! in_array($type->name, ['array', 'mixed'], true);
2626
}
2727
}

0 commit comments

Comments
 (0)