Conversation
Some apps overwrite this and this breaks them. Signed-off-by: Carl Schwan <carlschwan@kde.org>
| */ | ||
| abstract class Entity { | ||
| public int|string|null $id = null; | ||
| /** @var int $id */ |
There was a problem hiding this comment.
not sure but maybe it makes sense to adjust the the variable doc to /** @var int|string|null $id */ for psalm's indication at other places in the server repo since the other adjustments were made according to that
There was a problem hiding this comment.
Unfortunately that breaks psalm for existing apps
|
|
||
| if ($this->snowflake === null) { | ||
| $this->snowflake = Server::get(ISnowflakeDecoder::class)->decode($this->id); | ||
| $this->snowflake = Server::get(ISnowflakeDecoder::class)->decode($this->getId()); |
There was a problem hiding this comment.
Should we have an explicit getId() in this entity which has the full return type?
There was a problem hiding this comment.
This won't work unless we add a https://www.php.net/manual/en/class.returntypewillchange.php, but not sure this is worth it
ChristophWurst
left a comment
There was a problem hiding this comment.
It is not just that apps may overwrite it but that they use $ob->id on entities for tables that don't use snowflakes. That creates a "viral" change that all APIs consuming the id need to be adapted or that we have to add checks to make Psalm happy.
Summary
Some apps overwrite this and this breaks them.
TODO
Checklist
3. to review, feature component)stable32)