Regression: missing @return annotation on Psr7\Stream::getMetadata() causes symfony/error-handler deprecation again (was fixed in #703 for #701)

オープン 初心者向け
#763 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php
領域
api, backend

調査の方向性

lib/Http/Psr7/Stream.php から始めて getMetadata() を調べ、続いて #703 の以前の修正と、それに対応する src/Http/Psr7/Stream.php の変更を比較します。annotation が codegen の spec または template から生成されているか確認します。Symfony DebugClassLoader でクラスを読み込んだときに deprecation が発生しなくなり、再生成後も annotation が保持されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Description

Algolia\AlgoliaSearch\Http\Psr7\Stream::getMetadata() no longer has an explicit @return PHPDoc annotation, which causes symfony/error-handler's DebugClassLoader to emit a deprecation notice when the class is loaded:

User Deprecated: Method "Psr\Http\Message\StreamInterface::getMetadata()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Algolia\AlgoliaSearch\Http\Psr7\Stream" now to avoid errors or add an explicit @return annotation to suppress this message.

This is a regression: the same issue was already reported in #701 and fixed in #703 (merged 2022), which added @return array|mixed|null above getMetadata() in src/Http/Psr7/Stream.php (along with annotations on Request.php, Uri.php, and a few Response classes).

On the current release, the annotation is missing again on lib/Http/Psr7/Stream.php:

    public function getMetadata($key = null)
    {
        if (!isset($this->stream)) {

My guess is this got dropped by a regeneration of the SDK from its codegen spec, since the fix was a manual addition to a generated file rather than something enforced by the generator/templates.

Steps To Reproduce

Load Algolia\AlgoliaSearch\Http\Psr7\Stream in an app using symfony/error-handler's DebugClassLoader (e.g. any Symfony app in dev/test env), and call getMetadata() (it's called internally from the constructor via $this->uri = $this->getMetadata('uri');).

Expected behavior

No deprecation notice, consistent with the fix in #703.

Versions
  • Algolia Client Version: 4.47.0
  • PHP: 8.4

cc @jeromevieilledent-qobuz

主要言語
PHP
スター
696
フォーク
111
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

algolia/algoliasearch-client-php のほかの issue

algolia/algoliasearch-client-php の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。