Skip to content

Commit

Permalink
[TypeDeclaration] Add mixed[] array back on complex class-string stru…
Browse files Browse the repository at this point in the history
…cture on CompleteVarDocTypePropertyRector (#1116)
  • Loading branch information
samsonasik committed Oct 30, 2021
1 parent e525dad commit 4ddd986
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class FactoryC {}
final class RecursiveMultipleClassStringArray
{
/**
* @var array<string, array<class-string<\Rector\Tests\TypeDeclaration\Rector\Property\CompleteVarDocTypePropertyRector\Fixture\FactoryA>|class-string<\Rector\Tests\TypeDeclaration\Rector\Property\CompleteVarDocTypePropertyRector\Fixture\FactoryB>|class-string<\Rector\Tests\TypeDeclaration\Rector\Property\CompleteVarDocTypePropertyRector\Fixture\FactoryC>|class-string<\Rector\Tests\TypeDeclaration\Rector\Property\CompleteVarDocTypePropertyRector\Fixture\InvokableA>|class-string<\Rector\Tests\TypeDeclaration\Rector\Property\CompleteVarDocTypePropertyRector\Fixture\InvokableB>|class-string<\Rector\Tests\TypeDeclaration\Rector\Property\CompleteVarDocTypePropertyRector\Fixture\InvokableC>>>
* @var array<string, mixed[]>
*/
public $services = [
'invokables' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Type\ArrayType;
use PHPStan\Type\ClassStringType;
use PHPStan\Type\Constant\ConstantArrayType;
use PHPStan\Type\Constant\ConstantIntegerType;
use PHPStan\Type\Constant\ConstantStringType;
use PHPStan\Type\Generic\GenericClassStringType;
Expand Down Expand Up @@ -108,7 +107,7 @@ private function resolveClassStringInUnionType(UnionType $type): UnionType | Arr
$keyType = $unionType->getKeyType();
$itemType = $unionType->getItemType();

if ($itemType instanceof ConstantArrayType) {
if ($itemType instanceof ArrayType) {
$arrayType = new ArrayType(new MixedType(), new MixedType());
return new ArrayType($keyType, $arrayType);
}
Expand Down

0 comments on commit 4ddd986

Please sign in to comment.