1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 09:19:40 +01:00
psalm/src/Psalm/Internal/Analyzer/ClosureAnalyzer.php

34 lines
902 B
PHP
Raw Normal View History

2018-11-06 03:57:36 +01:00
<?php
namespace Psalm\Internal\Analyzer;
use PhpParser;
/**
* @internal
*/
2018-11-06 03:57:36 +01:00
class ClosureAnalyzer extends FunctionLikeAnalyzer
{
/**
* @param PhpParser\Node\Expr\Closure|PhpParser\Node\Expr\ArrowFunction $function
* @param SourceAnalyzer $source [description]
*/
public function __construct(PhpParser\Node\FunctionLike $function, SourceAnalyzer $source)
{
$codebase = $source->getCodebase();
2019-11-04 21:14:07 +01:00
$function_id = \strtolower($source->getFilePath())
. ':' . $function->getLine()
. ':' . (int)$function->getAttribute('startFilePos')
. ':-:closure';
$storage = $codebase->getClosureStorage($source->getFilePath(), $function_id);
parent::__construct($function, $source, $storage);
}
public function getTemplateTypeMap()
{
return $this->source->getTemplateTypeMap();
}
2018-11-06 03:57:36 +01:00
}