-
Notifications
You must be signed in to change notification settings - Fork 650
/
TAnonymousClassInstance.php
46 lines (40 loc) · 1.06 KB
/
TAnonymousClassInstance.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace Psalm\Type\Atomic;
/**
* Denotes an anonymous class (i.e. `new class{}`) with potential methods
*/
final class TAnonymousClassInstance extends TNamedObject
{
/**
* @var string|null
*/
public $extends;
/**
* @param string $value the name of the object
*/
public function __construct(string $value, bool $is_static = false, ?string $extends = null)
{
parent::__construct($value, $is_static);
$this->extends = $extends;
}
public function toPhpString(
?string $namespace,
array $aliased_classes,
?string $this_class,
int $analysis_php_version_id
): ?string {
return $analysis_php_version_id >= 7_02_00 ? ($this->extends ?? 'object') : null;
}
/**
* @param array<lowercase-string, string> $aliased_classes
*
*/
public function toNamespacedString(
?string $namespace,
array $aliased_classes,
?string $this_class,
bool $use_phpdoc_format
): string {
return $this->extends ?? 'object';
}
}