Sql\Platform: decorator contract is incomplete and Platform's per-platform registry is unused
Los mantenedores suelen responder en 1 día
@simon-mundy ya está trabajando en esto.
Desde el 24/8/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- PHP
- Estrellas
- 18
- Forks
- 8
- Merge medio
- 6 d 11 h
- PR fusionados (30 d)
- 14
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de php-db/phpdb
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
RFC
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
RFC
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
Los mantenedores suelen responder en 1 día
-
RFC
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
RFC
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
Todos los issues de php-db/phpdb
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
crazy-goat/rabbit-stream#753 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
opensourcepos/opensourcepos#4743 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
grokability/snipe-it#19786 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
PrestaShop/PrestaShop#43140 ·
Los mantenedores suelen responder en 1 día