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