diff --git a/rules-tests/CodeQuality/Rector/ClassMethod/ExplicitReturnNullRector/Fixture/array_constant.php.inc b/rules-tests/CodeQuality/Rector/ClassMethod/ExplicitReturnNullRector/Fixture/array_constant.php.inc new file mode 100644 index 00000000000..403e66450a4 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/ClassMethod/ExplicitReturnNullRector/Fixture/array_constant.php.inc @@ -0,0 +1,14 @@ + ['foo' => 'fooValue']]], + [null, []], + ]; + } +} diff --git a/rules/TypeDeclaration/TypeNormalizer.php b/rules/TypeDeclaration/TypeNormalizer.php index 8ae2b22f2ec..4b5acdece85 100644 --- a/rules/TypeDeclaration/TypeNormalizer.php +++ b/rules/TypeDeclaration/TypeNormalizer.php @@ -84,9 +84,9 @@ public function normalizeArrayTypeAndArrayNever(Type $type): Type assert($traversedType instanceof ConstantArrayType); // not sure why, but with direct new node everything gets nulled to MixedType - $this->privatesAccessor->setPrivateProperty($traversedType, 'keyType', new MixedType()); + $this->privatesAccessor->setPrivateProperty($traversedType, 'keyTypes', [new MixedType()]); - $this->privatesAccessor->setPrivateProperty($traversedType, 'itemType', new MixedType()); + $this->privatesAccessor->setPrivateProperty($traversedType, 'valueTypes', [new MixedType()]); return $traversedType; }