Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[RFC]: Decide which PhpDb\Sql classes become final

オープン
#213 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
38/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
php
領域
databases

調査の方向性

Start by reviewing the listed classes under src/Sql and checking the driver packages for subclasses, especially the decorators described in #175 and phpdb-mysql's src/Sql/Ddl classes. Compare those findings with the proposed exclusions in mago.toml. Done means deciding which classes can become final, documenting exclusions for those that cannot, and resolving Platform\Platform alongside #175.

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

説明

RFC
Proposed Version

Next major

Basic Information

Mago reports 44 class-must-be-final findings in src/Sql, all baselined. Resolving them means deciding which classes are extension points, which a mechanical fix can't do.

Classes reported:

  • Statements: Select, Delete, Update, InsertIgnore, Combine, Sql, Join, Where, Having, Platform\Platform
  • DDL: Ddl\CreateTable, Ddl\AlterTable, Ddl\DropTable, Ddl\Index\Index, the 17 concrete Ddl\Column\* classes, and Ddl\Constraint\{Check, ForeignKey, PrimaryKey, UniqueKey}
  • Predicates: Predicate\{Operator, Expression, Literal, IsNotNull, NotBetween, NotIn, NotLike}
  • Exceptions: Predicate\Exception\{InvalidArgumentException, RuntimeException}
Background

The driver packages extend several of these classes:

  • Every platform decorator extends Select, Insert, Update, Delete, CreateTable or AlterTable (see #175).
  • phpdb-mysql ships its own DDL decorators under src/Sql/Ddl.
  • The test suite subclasses Delete, Update and Insert (DeleteIgnore, UpdateIgnore, Replace).

Metadata went through the same decision: its object classes were made final.

Considerations
  • Making a class final breaks every subclass of it. The statement and DDL classes that decorators extend cannot become final without replacing inheritance with composition.
  • Leaf predicates, concrete column types and the exception classes have no known subclasses.
Proposal(s)
  1. Make final the classes with no known subclasses: the leaf predicates, the Predicate\Exception classes, Join, Where and Having. Check the driver packages first.
  2. Keep the statement and DDL classes non-final, and add a per-path class-must-be-final exclusion in mago.toml documenting why, as already done for prefer-self-return-type.
  3. Settle Platform\Platform as part of #175, which already proposes making it final.
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 ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

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

php-db/phpdb のほかの issue

php-db/phpdb の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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