Do not create and pass a service if it's nullable in the method argument
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 55/100
調査の方向性
The issue is in the Entropy dependency injection container's service creation logic. Look at the ServiceMapProvider constructor in Rector\Symfony\DataProvider\ServiceMapProvider. The bug is that a service is being instantiated and passed when the argument is nullable and defaulted to null. Find where services are instantiated in the container code, likely in a service factory or resolver. Check how constructor arguments are resolved, particularly for nullable parameters. The fix is to pass null when the argument is nullable and no concrete service is bound, matching the illuminate/container behavior. Run existing tests related to dependency injection to verify the change.
索引モデルが issue の本文から書いたものです。
説明
Entropy should not create a service and pass it if the constructor definition is nullable like here:
\Rector\Symfony\DataProvider\ServiceMapProvider:
public function __construct(ServiceMapFactory $serviceMapFactory, ?ServiceMap $serviceMap = null)
{
$this->serviceMapFactory = $serviceMapFactory;
$this->serviceMap = null;
}
I expect a ServiceMapFactory and null as serviceMap.
This is the behavior with illuminate/container and Rector 2.6.3:
Before using Entropy in Rector the DI container from illuminate/container was used and since this commit https://github.com/rectorphp/rector-src/commit/cd3ec48e1209436d03d9c67d47c51ac4972a20cc the behavior is different because illuminate/container passed null as seen in the screenshot.
- 主要言語
- PHP
- スター
- 10.4k
- フォーク
- 742
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rectorphp/rector のほかの issue
-
feature
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
-
withImportNames() reports a change on a short name already imported next to a same-short-name aliasオープン
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
rectorphp/rector の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Yoast/wordpress-seo#23658 ·
メンテナーはふだん 3 日以内に返信
-
fixed
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
firefly-iii/firefly-iii#12934 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信