Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta
#213 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
38/100
Tipo de issue
Refatoração
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
php
Domínio
databases

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
PHP
Estrelas
18
Forks
8
Merge médio
6d 11h
PRs com merge (30d)
14

Preparar o ambiente

  • Inclui um Dockerfile ou arquivo Docker Compose
  • Sem modelo de pull request
  • Sem guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de php-db/phpdb

Todas as issues de php-db/phpdb

Issues semelhantes

Mais issues de PHP

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.