Sql\Platform: decorator contract is incomplete and Platform's per-platform registry is unused
Les mainteneurs répondent en général sous 1 jour
@simon-mundy y travaille déjà.
Depuis le 24/8/2026.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
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.
- Langage dominant
- PHP
- Étoiles
- 18
- Forks
- 8
- Merge moyen
- 6 j 11 h
- PR mergées (30 j)
- 14
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de php-db/phpdb
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
RFC
Difficulté 3/5 1-2 jours Accessibilité débutants 66/100
Les mainteneurs répondent en général sous 1 jour
-
RFC
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 38/100
Les mainteneurs répondent en général sous 1 jour
-
RFC
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
RFC
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de php-db/phpdb
Issues similaires
-
Bug Enhancement Performance
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Feature Status: Needs Triage
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
Les mainteneurs répondent en général sous 1 jour
-
frontend low-priority
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
mplodowski/dynamicpdf-plugin#336 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
AdvancedCustomFields/acf#1044 ·
-
Add ZammadPeut-être pris @Arslan-TR l’a pris aujourd’hui. Ouverterequest
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
endoflife-date/endoflife.date#11298 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour