Sql\Platform: decorator contract is incomplete and Platform's per-platform registry is unused
Maintainer thường phản hồi trong vòng 1 ngày
@simon-mundy đang làm issue này rồi.
Từ ngày 24/8/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Summary
PlatformDecoratorInterface declares only setSubject(), but every caller of
AbstractPlatform::getTypeDecorator() immediately calls getSqlString() or
prepareStatement() on the result. Those methods are not on the contract, so the
calls are unprovable and the analyzer reports them as calls to non-existent methods.
Separately, Platform stores its decorators in a per-platform map
([platformName][class => decorator]) while AbstractPlatform — which every driver
package extends — stores a flat [class => decorator] map. The two shapes share one
property name, so the property cannot be typed.
Together these account for 26 of the 28 analyzer findings in src/Sql/Platform.
Proposed change
PlatformDecoratorInterface extends SqlInterface, PreparableSqlInterface. Every
decorator in the ecosystem already satisfies this — they all extendSelect,
Insert,Update,Delete,CreateTableorAlterTable.setSubject()no longer acceptsnull, matching the non-nullable$subject
property it assigns to. Passingnullis currently aTypeError.- Remove the per-platform decorator registry from
Platform. It has no callers: the
three-argumentsetTypeDecorator()and two-argumentgetTypeDecorator()are never
invoked anywhere in this repository or in any driver package, and no test registers
decorators for more than one platform.Platformthen inherits the flat map, like
every driver. - Mark
Platformfinal. - Remove the two now-unreachable guards in
Sql::buildSqlString()and
Sql::prepareStatementForSqlObject(), and the two tests covering them.
Compatibility
AbstractPlatform is unchanged in shape and signature, so phpdb-mysql and
phpdb-sqlite, which extend it and call the two-argument setTypeDecorator(), are
unaffected. phpdb-sqlite's reflection test on decorators still passes.
phpdb-pgsql instantiates Sql\Platform\Platform directly in
AdapterPlatform::getSqlPlatformDecorator(). It registers no decorators and calls none
of the removed methods. Verified by installing phpdb-pgsql against this branch and
against 0.6.x: both produce SELECT "users".* FROM "users" from the same probe.
phpdb-{ibmdb2,oci8,sql92,sqlsrv} will carry their own copy of
PhpDb\Sql\Platform\* and will have no runtime dependency on php-db/phpdb.
Breaking changes
Removed from Platform: the three-argument setTypeDecorator(), the two-argument
getTypeDecorator(), the getDecorators() override and the protected
resolvePlatformName(). Platform becomes final. No known caller uses any of them.
Notes
This addresses the @todo sat-migration block in Platform::__construct(). That approach has been
superseded by each driver shipping its own platform class.
- 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ó 3/5 1-2 ngày Mức phù hợp với người mới 68/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
Issue tương tự
-
Bug Enhancement Performance
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Feature Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 1 ngày
-
frontend low-priority
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
mplodowski/dynamicpdf-plugin#336 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add ZammadCó thể đã có người làm @Arslan-TR đã nhận hôm nay. Đang mởrequest
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
endoflife-date/endoflife.date#11298 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
FriendsOfFlarum/best-answer#137 ·