Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#213 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
38/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php
Ambito
databases

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
PHP
Stelle
18
Fork
8
Merge medio
2g 14h
PR unite (30g)
26

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di php-db/phpdb

Tutte le issue di php-db/phpdb

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.