Open 1234ru opened 2 years ago
Hm, can't you achieve what you want with Psalm's @template
type parameters? A moment...
/**
* @template T
*/
abstract class A {
/**
* @var T
*/
public $client;
/**
* @var array{
* client: T
* }
*/
public $order;
}
/**
* @extends A<array{
* name: '',
* phone: '',
* email: ''
* }>
*/
class B extends A {
}
Hm, it seems to be possible in Psalm's notation, but deep-assoc-completion does not support the @extends
tag sadly.
PR welcome
The code responsible for psalm types resolution is located at PsalmRes.java
Let's say, we have an abstract class with two propertes.
First one's structure is undefined. It completely depends on particular future child class.
Second one's structure is defined and relies on the first one.
In that class we can declare a relation between these two properties. But unfortunately it doesn't recognize first property's structure if it is declared in a child class:
Is it possible to fix that?