mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
parent
f9b48163e0
commit
8ca604a533
@ -414,6 +414,21 @@ class TypeExpander
|
||||
);
|
||||
}
|
||||
|
||||
if ($return_type instanceof Type\Atomic\TObjectWithProperties) {
|
||||
foreach ($return_type->properties as &$property_type) {
|
||||
$property_type = self::expandUnion(
|
||||
$codebase,
|
||||
$property_type,
|
||||
$self_class,
|
||||
$static_class_type,
|
||||
$parent_class,
|
||||
$evaluate_class_constants,
|
||||
$evaluate_conditional_types,
|
||||
$final
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($return_type instanceof Type\Atomic\TCallable
|
||||
|| $return_type instanceof Type\Atomic\TFn
|
||||
) {
|
||||
|
@ -315,7 +315,27 @@ class TypeAnnotationTest extends TestCase
|
||||
echo $elt["p1"];
|
||||
}
|
||||
}'
|
||||
]
|
||||
],
|
||||
'objectWithPropertiesAlias' => [
|
||||
'<?php
|
||||
/**
|
||||
* @psalm-type FooStruct=string
|
||||
*/
|
||||
class A {}
|
||||
|
||||
/**
|
||||
* @psalm-import-type FooStruct from A as F2
|
||||
*/
|
||||
class B {
|
||||
/**
|
||||
* @param object{foo: F2} $a
|
||||
* @return object{foo: string}
|
||||
*/
|
||||
public function bar($a) {
|
||||
return $a;
|
||||
}
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user