-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
refactor(entity): Don't type id #57442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Some apps overwrite this and this breaks them. Signed-off-by: Carl Schwan <carlschwan@kde.org>
kyteinsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no error now 🚀
| */ | ||
| abstract class Entity { | ||
| public int|string|null $id = null; | ||
| /** @var int $id */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
|
||
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have an explicit getId() in this entity which has the full return type?
ChristophWurst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)