mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
qa: mark TTypeAlias#extra_types
and TTypeAlias#setIntersectionTypes
as deprecated
Due to the way how this patch modifies the type alias handling, intersection types of aliases are directly expanded and thus, the referencing types are being used rather than intersecting aliases. Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
This commit is contained in:
parent
c3f91992f1
commit
07fcf5399c
@ -324,6 +324,7 @@ class TypeExpander
|
||||
];
|
||||
}
|
||||
|
||||
/** @psalm-suppress DeprecatedProperty For backwards compatibility, we have to keep this here. */
|
||||
foreach ($return_type->extra_types ?? [] as $alias) {
|
||||
$more_recursively_fleshed_out_types = self::expandAtomic(
|
||||
$codebase,
|
||||
|
@ -14,6 +14,9 @@ final class TTypeAlias extends Atomic
|
||||
{
|
||||
/**
|
||||
* @var array<string, TTypeAlias>|null
|
||||
* @deprecated type aliases are resolved within {@see TypeParser::resolveTypeAliases()} and therefore the
|
||||
* referencing type(s) are part of other intersection types. The intersection types are not set anymore
|
||||
* and with v6 this property along with its related methods will get removed.
|
||||
*/
|
||||
public $extra_types;
|
||||
|
||||
@ -30,14 +33,19 @@ final class TTypeAlias extends Atomic
|
||||
{
|
||||
$this->declaring_fq_classlike_name = $declaring_fq_classlike_name;
|
||||
$this->alias_name = $alias_name;
|
||||
/** @psalm-suppress DeprecatedProperty For backwards compatibility, we have to keep this here. */
|
||||
$this->extra_types = $extra_types;
|
||||
parent::__construct(true);
|
||||
}
|
||||
/**
|
||||
* @param array<string, TTypeAlias>|null $extra_types
|
||||
* @deprecated type aliases are resolved within {@see TypeParser::resolveTypeAliases()} and therefore the
|
||||
* referencing type(s) are part of other intersection types. This method will get removed with v6.
|
||||
* @psalm-suppress PossiblyUnusedMethod For backwards compatibility, we have to keep this here.
|
||||
*/
|
||||
public function setIntersectionTypes(?array $extra_types): self
|
||||
{
|
||||
/** @psalm-suppress DeprecatedProperty For backwards compatibility, we have to keep this here. */
|
||||
if ($extra_types === $this->extra_types) {
|
||||
return $this;
|
||||
}
|
||||
@ -55,6 +63,7 @@ final class TTypeAlias extends Atomic
|
||||
|
||||
public function getId(bool $exact = true, bool $nested = false): string
|
||||
{
|
||||
/** @psalm-suppress DeprecatedProperty For backwards compatibility, we have to keep this here. */
|
||||
if ($this->extra_types) {
|
||||
return $this->getKey() . '&' . implode(
|
||||
'&',
|
||||
|
Loading…
Reference in New Issue
Block a user