Skip to content
Permalink
Browse files

Fix #2436 - fix templating of property types inside templated functions

  • Loading branch information
muglug committed Dec 9, 2019
1 parent 7144bb7 commit 69e6624b167d00b578ad785388b04f405dc4ab3e
@@ -811,7 +811,11 @@ public static function analyzeInstance(
}
}

$class_property_type = Type::parseTokens($new_type_tokens);
$class_property_type = Type::parseTokens(
$new_type_tokens,
null,
$statements_analyzer->getTemplateTypeMap() ?: []
);
}
}
}
@@ -2106,7 +2106,33 @@ function acceptsThrowableRef(WeakReference $_ref): void {}
acceptsThrowableRef(WeakReference::create(new Exception));
'
]
],
'mapTypeParams' => [
'<?php
/**
* @template TKey as array-key
* @template TValue
*/
class Map {
/** @var array<TKey, TValue> */
public $arr;
/** @param array<TKey, TValue> $arr */
function __construct(array $arr) {
$this->arr = $arr;
}
}
/**
* @template TInputKey as array-key
* @template TInputValue
* @param Map<TInputKey, TInputValue> $map
* @return Map<TInputKey, TInputValue>
*/
function copyMapUsingProperty(Map $map): Map {
return new Map($map->arr);
}'
],
];
}

0 comments on commit 69e6624

Please sign in to comment.
You can’t perform that action at this time.