2016-05-16 05:06:03 +02:00
|
|
|
<?php
|
2016-08-13 20:20:46 +02:00
|
|
|
namespace Psalm\Checker;
|
2016-05-16 05:06:03 +02:00
|
|
|
|
|
|
|
use PhpParser;
|
2018-01-21 18:44:46 +01:00
|
|
|
use Psalm\Aliases;
|
|
|
|
use Psalm\StatementsSource;
|
2016-08-13 20:20:46 +02:00
|
|
|
|
|
|
|
class TraitChecker extends ClassLikeChecker
|
2016-05-16 05:06:03 +02:00
|
|
|
{
|
2016-11-02 07:29:00 +01:00
|
|
|
/**
|
2018-01-21 18:44:46 +01:00
|
|
|
* @var Aliases
|
2016-11-02 07:29:00 +01:00
|
|
|
*/
|
2018-01-21 18:44:46 +01:00
|
|
|
private $aliases;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $fq_class_name
|
|
|
|
*/
|
|
|
|
public function __construct(
|
|
|
|
PhpParser\Node\Stmt\Trait_ $class,
|
|
|
|
StatementsSource $source,
|
|
|
|
$fq_class_name,
|
|
|
|
Aliases $aliases
|
|
|
|
) {
|
|
|
|
$this->source = $source;
|
|
|
|
$this->file_checker = $source->getFileChecker();
|
2016-08-14 00:54:49 +02:00
|
|
|
$this->class = $class;
|
2016-11-07 23:29:51 +01:00
|
|
|
$this->fq_class_name = $fq_class_name;
|
2017-09-18 22:10:08 +02:00
|
|
|
$this->storage = $this->file_checker->project_checker->classlike_storage_provider->get($fq_class_name);
|
2018-01-21 18:44:46 +01:00
|
|
|
$this->aliases = $aliases;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-01-28 23:07:09 +01:00
|
|
|
* @return null|string
|
2018-01-21 18:44:46 +01:00
|
|
|
*/
|
|
|
|
public function getNamespace()
|
|
|
|
{
|
|
|
|
return $this->aliases->namespace;
|
|
|
|
}
|
2016-05-16 05:06:03 +02:00
|
|
|
|
2018-01-21 18:44:46 +01:00
|
|
|
/**
|
|
|
|
* @return Aliases
|
|
|
|
*/
|
|
|
|
public function getAliases()
|
|
|
|
{
|
|
|
|
return $this->aliases;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array<string, string>
|
|
|
|
*/
|
|
|
|
public function getAliasedClassesFlipped()
|
|
|
|
{
|
|
|
|
return [];
|
2016-05-16 05:06:03 +02:00
|
|
|
}
|
|
|
|
}
|