From 532ad5971e52692fb423758096088f74ae1ab74c Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 7 Mar 2022 18:48:24 +0700 Subject: [PATCH] final touch: clean up --- .../TypeMapper/ArrayShapeTypeMapper.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/PHPStanStaticTypeMapper/TypeMapper/ArrayShapeTypeMapper.php b/packages/PHPStanStaticTypeMapper/TypeMapper/ArrayShapeTypeMapper.php index 08b092bb0d0..59ed6f2fc27 100644 --- a/packages/PHPStanStaticTypeMapper/TypeMapper/ArrayShapeTypeMapper.php +++ b/packages/PHPStanStaticTypeMapper/TypeMapper/ArrayShapeTypeMapper.php @@ -40,6 +40,11 @@ public function mapConstantArrayType(ConstantArrayType $constantArrayType): Arra } $keyValue = $keyType->getValue(); + + if ($this->reflectionProvider->hasClass($keyValue)) { + return null; + } + $keyDocTypeNode = new IdentifierTypeNode($keyValue); $valueType = $constantArrayType->getValueTypes()[$index]; @@ -48,10 +53,6 @@ public function mapConstantArrayType(ConstantArrayType $constantArrayType): Arra TypeKind::RETURN() ); - if ($this->reflectionProvider->hasClass($keyValue)) { - return null; - } - $arrayShapeItemNodes[] = new ArrayShapeItemNode( $keyDocTypeNode, $constantArrayType->isOptionalKey($index),