mirror of
https://github.com/danog/psalm.git
synced 2024-12-13 09:47:29 +01:00
31 lines
668 B
PHP
31 lines
668 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Psalm\Plugin;
|
|
|
|
use Psalm\Type;
|
|
use Psalm\Type\Atomic\TTemplateParam;
|
|
use Psalm\Type\Union;
|
|
|
|
final class DynamicTemplateProvider
|
|
{
|
|
private string $defining_class;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
public function __construct(string $defining_class)
|
|
{
|
|
$this->defining_class = $defining_class;
|
|
}
|
|
|
|
/**
|
|
* If {@see DynamicFunctionStorage} requires template params this method can create it.
|
|
*/
|
|
public function createTemplate(string $param_name, Union $as = null): TTemplateParam
|
|
{
|
|
return new TTemplateParam($param_name, $as ?? Type::getMixed(), $this->defining_class);
|
|
}
|
|
}
|