mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Improve result of "static" type-to-string
This commit is contained in:
parent
885a6a605e
commit
e75d8d00bb
@ -36,7 +36,7 @@ class TGenericObject extends TNamedObject
|
||||
* @param int $php_major_version
|
||||
* @param int $php_minor_version
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function toPhpString(
|
||||
$namespace,
|
||||
|
@ -64,6 +64,10 @@ class TNamedObject extends Atomic
|
||||
$use_phpdoc_format
|
||||
);
|
||||
|
||||
if ($this->value === 'static') {
|
||||
return 'static';
|
||||
}
|
||||
|
||||
if ($this->value === $this_class) {
|
||||
return 'self' . $intersection_types;
|
||||
}
|
||||
@ -94,7 +98,7 @@ class TNamedObject extends Atomic
|
||||
* @param int $php_major_version
|
||||
* @param int $php_minor_version
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function toPhpString(
|
||||
$namespace,
|
||||
@ -103,12 +107,16 @@ class TNamedObject extends Atomic
|
||||
$php_major_version,
|
||||
$php_minor_version
|
||||
) {
|
||||
if ($this->value === 'static') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->toNamespacedString($namespace, $aliased_classes, $this_class, false);
|
||||
}
|
||||
|
||||
public function canBeFullyExpressedInPhp()
|
||||
{
|
||||
return true;
|
||||
return $this->value !== 'static';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user