diff --git a/lib/public/AppFramework/Db/Entity.php b/lib/public/AppFramework/Db/Entity.php index f29eef92b2854..886326ca0fcc4 100644 --- a/lib/public/AppFramework/Db/Entity.php +++ b/lib/public/AppFramework/Db/Entity.php @@ -19,7 +19,8 @@ * @psalm-consistent-constructor */ abstract class Entity { - public int|string|null $id = null; + /** @var int $id */ + public $id; private array $_updatedFields = []; /** @psalm-param $_fieldTypes array */ protected array $_fieldTypes = ['id' => 'integer']; diff --git a/lib/public/AppFramework/Db/SnowflakeAwareEntity.php b/lib/public/AppFramework/Db/SnowflakeAwareEntity.php index bdcbf12135b4a..87c91e995b811 100644 --- a/lib/public/AppFramework/Db/SnowflakeAwareEntity.php +++ b/lib/public/AppFramework/Db/SnowflakeAwareEntity.php @@ -35,6 +35,7 @@ public function setId($id): void { */ public function generateId(): void { if ($this->id === null) { + /** @psalm-suppress InvalidPropertyAssignmentValue */ $this->id = Server::get(ISnowflakeGenerator::class)->nextId(); $this->markFieldUpdated('id'); } @@ -50,7 +51,7 @@ public function getSnowflake(): ?Snowflake { } if ($this->snowflake === null) { - $this->snowflake = Server::get(ISnowflakeDecoder::class)->decode($this->id); + $this->snowflake = Server::get(ISnowflakeDecoder::class)->decode($this->getId()); } return $this->snowflake;