The expression parent::one($db ?: $this->getDb()); of type yii\db\ActiveRecord|array|null adds the type yii\db\ActiveRecord to the return on line 23 which is incompatible with the return type declared by the interface yii\db\QueryInterface::one of type array|boolean.