Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#213 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
38/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
databases

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
PHP
Star
18
Fork
8
Merge trung bình
6 ngày 11 giờ
Pull request đã merge (30 ngày)
14

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của php-db/phpdb

Tất cả issue của php-db/phpdb

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.