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;
|
|
|
|
|
2016-08-13 20:20:46 +02:00
|
|
|
use Psalm\StatementsSource;
|
|
|
|
use Psalm\Context;
|
|
|
|
|
|
|
|
class TraitChecker extends ClassLikeChecker
|
2016-05-16 05:06:03 +02:00
|
|
|
{
|
|
|
|
public function __construct(PhpParser\Node\Stmt\Trait_ $class, StatementsSource $source, $absolute_class)
|
|
|
|
{
|
2016-08-14 00:54:49 +02:00
|
|
|
$this->class = $class;
|
|
|
|
$this->namespace = $source->getNamespace();
|
|
|
|
$this->aliased_classes = $source->getAliasedClasses();
|
|
|
|
$this->file_name = $source->getFileName();
|
|
|
|
$this->absolute_class = $absolute_class;
|
2016-05-16 05:06:03 +02:00
|
|
|
|
2016-08-14 00:54:49 +02:00
|
|
|
$this->parent_class = null;
|
2016-05-16 05:06:03 +02:00
|
|
|
|
2016-08-14 00:54:49 +02:00
|
|
|
$this->suppressed_issues = $source->getSuppressedIssues();
|
2016-08-08 20:36:18 +02:00
|
|
|
|
2016-08-14 00:54:49 +02:00
|
|
|
self::$class_checkers[$absolute_class] = $this;
|
2016-08-08 20:36:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function check($check_methods = true, Context $class_context = null)
|
|
|
|
{
|
|
|
|
if (!$class_context) {
|
|
|
|
throw new \InvalidArgumentException('TraitChecker::check must be called with a $class_context');
|
2016-05-16 05:06:03 +02:00
|
|
|
}
|
2016-08-08 20:36:18 +02:00
|
|
|
|
|
|
|
parent::check($check_methods, $class_context);
|
2016-05-16 05:06:03 +02:00
|
|
|
}
|
|
|
|
}
|