1: <?php declare(strict_types = 1);
2:
3: namespace ApiGen\Info;
4:
5: use ApiGen\Index\Index;
6: use ApiGen\Info\Traits\HasGenericParameters;
7: use ApiGen\Info\Traits\HasLineLocation;
8: use ApiGen\Info\Traits\HasTags;
9:
10:
11: abstract class ClassLikeInfo implements ElementInfo
12: {
13: use HasTags;
14: use HasLineLocation;
15: use HasGenericParameters;
16:
17:
18: /** @var string|null */
19: public ?string $file = null;
20:
21: /** @var ConstantInfo[] indexed by [constantName] */
22: public array $constants = [];
23:
24: /** @var PropertyInfo[] indexed by [propertyName] */
25: public array $properties = [];
26:
27: /** @var MethodInfo[] indexed by [methodName] */
28: public array $methods = [];
29:
30: /** @var ClassLikeReferenceInfo[] indexed by [classLikeName] */
31: public array $mixins = [];
32:
33: /** @var AliasInfo[] indexed by [aliasName] */
34: public array $aliases = [];
35:
36:
37: public function __construct(
38: public NameInfo $name,
39: public bool $primary,
40: ) {
41: }
42:
43:
44: public function isInstanceOf(Index $index, string $type): bool
45: {
46: return isset($index->instanceOf[$type][$this->name->fullLower]);
47: }
48:
49:
50: public function isThrowable(Index $index): bool
51: {
52: return $this->isInstanceOf($index, 'throwable');
53: }
54: }
55: