You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2 cases; one that has a call to parent constructor, one that doesn't override constructor at all. Psalm doesn't recognize set property, attempts with final public also failed.
Explanation:
ID trait is used by all entities and must be initialized so I can't suppress it.
I fixed the above inheritance problem by copying the code but surely would prefer to use trait.
The text was updated successfully, but these errors were encountered:
<?phptrait IdTrait
{
privateint$id;
privatefunctioninitializeId(): void
{
$this->id = 5;
}
}
class BaseUser
{
use IdTrait;
publicfunction__construct()
{
$this->initializeId();
}
}
class Admin extends BaseUser
{
}
class Client extends BaseUser
{
publicfunction__construct()
{
parent::__construct();
}
}
Psalm output (using commit 9e05254):
ERROR: PropertyNotSetInConstructor - 23:7 - Property Admin::$id is not defined in constructor of Admin and in any private or final methods called in the constructor
ERROR: PropertyNotSetInConstructor - 27:7 - Property Client::$id is not defined in constructor of Client and in any private or final methods called in the constructor
https://psalm.dev/r/c4eeed072f
2 cases; one that has a call to parent constructor, one that doesn't override constructor at all. Psalm doesn't recognize set property, attempts with
final public
also failed.Explanation:
ID trait is used by all entities and must be initialized so I can't suppress it.
I fixed the above inheritance problem by copying the code but surely would prefer to use trait.
The text was updated successfully, but these errors were encountered: