Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Cache pretty printed expression
  • Loading branch information
lookyman committed Jan 5, 2020
commit de805d6ade2034cb7c78122fb8218a8a94014711
8 changes: 7 additions & 1 deletion src/Analyser/MutatingScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,13 @@ public function getAnonymousFunctionReturnType(): ?\PHPStan\Type\Type

public function getType(Expr $node): Type
{
$key = $this->printer->prettyPrintExpr($node);
/** @var string|null $key */
$key = $node->getAttribute('phpstan_cache_printer');
if ($key === null) {
$key = $this->printer->prettyPrintExpr($node);
$node->setAttribute('phpstan_cache_printer', $key);
}

if (!array_key_exists($key, $this->resolvedTypes)) {
$this->resolvedTypes[$key] = $this->resolveType($node);
}
Expand Down