[RFC]: Require a PlatformInterface in the DDL process* methods
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
調査の方向性
まず src/Sql/Ddl にある CreateTable、AlterTable、DropTable の process* メソッドから着手し、AbstractSql::buildSqlString() と getSqlString() を読んで、プラットフォームが常に non-null であることを確認してください。各シグネチャを ?PlatformInterface $adapterPlatform = null から PlatformInterface $adapterPlatform に変更し、位置互換性のため processCombinedby() と processStatementEnd() のパラメータは維持したままにします。その後、mago analyze --ignore-baseline src/Sql で 21 件の検出が予測どおり減少し、テストスイートが引き続き通過することを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Proposed Version
Next minor
Basic Information
The process* methods on CreateTable, AlterTable and DropTable take ?PlatformInterface $adapterPlatform = null, but use it unconditionally: they call quoteIdentifier(), quoteTrustedValue(), processExpression() and resolveTable(), none of which accept null. Their only caller, AbstractSql::buildSqlString(), always passes a non-null platform.
This accounts for 21 analyzer findings in src/Sql/Ddl:
possibly-null-argument(8) andpossible-method-access-on-null(6).less-specific-nested-return-statement(4) andinvalid-return-statement(1): calling a method on a possibly-null platform yieldsmixed, so the arrays these methods return lose their element types.unused-parameter(2):CreateTable::processCombinedby()andprocessStatementEnd()receive the platform but don't use it.
Background
AbstractSql::getSqlString() supplies a default platform before calling buildSqlString(), so no path reaches these methods with null.
Considerations
- These are
protectedmethods. Making the parameter required narrows it for callers, but subclasses that override with?PlatformInterface $adapterPlatform = nullremain compatible, since a child may widen a parameter. - A subclass that calls
parent::processX()without arguments, or withnull, would get anArgumentCountErrororTypeError. None of the driver packages do this.
Proposal(s)
Change the signature of each DDL process* method to PlatformInterface $adapterPlatform. Keep the parameter on processCombinedby() and processStatementEnd(), since buildSqlString() passes it positionally to every process* method.
Appendix/Additional Info
Finding counts are from mago analyze --ignore-baseline src/Sql once the docblock typing in #204 is applied.
- 主要言語
- PHP
- スター
- 18
- フォーク
- 8
- 平均マージ
- 6日 11時間
- マージ済み PR(30日)
- 14
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
php-db/phpdb のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
RFC
難易度 3/5 1〜2日 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
RFC
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
メンテナーはふだん 1 日以内に返信
-
RFC
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
-
Sql's foreign-table guard raises TypeError when its table is a TableIdentifier or aliased array対応中かも @simon-mundy が 2 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 50/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
Awaiting Triage bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
product / databases
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
VilnaCRM-Org/user-service#525 ·
メンテナーはふだん 21 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
shukiv/jabali-panel#2029 ·
メンテナーはふだん 1 日以内に返信