[RFC]: Require a PlatformInterface in the DDL process* methods
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ó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
Bắt đầu ở src/Sql/Ddl với các phương thức process* của CreateTable, AlterTable và DropTable, và đọc AbstractSql::buildSqlString() cùng getSqlString() để xác nhận nền tảng luôn là non-null. Đổi từng chữ ký từ ?PlatformInterface $adapterPlatform = null thành PlatformInterface $adapterPlatform, giữ tham số trong processCombinedby() và processStatementEnd() để tương thích vị trí, rồi xác minh bằng mago analyze --ignore-baseline src/Sql rằng 21 phát hiện giảm như dự đoán và bộ test vẫn vượt qua.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của php-db/phpdb
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RFC
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RFC
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RFC
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Sql's foreign-table guard raises TypeError when its table is a TableIdentifier or aliased arrayCó thể đã có người làm @simon-mundy đã nhận 1 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 50/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
thephpleague/commonmark#1159 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
awslabs/aidlc-workflows#1879 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] The PHP file that lists DNS records truncates records to 12 characters?Có thể đã có người làm @sahsanu đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
hestiacp/hestiacp#5769 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug customer-reported
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
MagnaCapax/PMSS#1011 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Talk Review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
socallinuxexpo/scale-drupal#351 ·