[RFC]: Require a PlatformInterface in the DDL process* methods
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 src/Sql/Ddl 中 CreateTable、AlterTable 和 DropTable 的 process* 方法开始,并阅读 AbstractSql::buildSqlString() 与 getSqlString() 以确认平台始终为 non-null。将每个签名从 ?PlatformInterface $adapterPlatform = null 改为 PlatformInterface $adapterPlatform,同时为保持位置兼容性在 processCombinedby() 和 processStatementEnd() 上保留该参数,然后使用 mago analyze --ignore-baseline src/Sql 验证 21 项发现如预期下降,且测试套件仍然通过。
由索引模型根据 Issue 内容生成。
描述
Proposed Version
Next minor
Basic Information
The process* methods on CreateTable, AlterTable and DropTable take ?PlatformInterface $adapterPlatform = null, but use it unconditionally: they call quoteIdentifier(), quoteTrustedValue(), processExpression() and resolveTable(), none of which accept null. Their only caller, AbstractSql::buildSqlString(), always passes a non-null platform.
This accounts for 21 analyzer findings in src/Sql/Ddl:
possibly-null-argument(8) andpossible-method-access-on-null(6).less-specific-nested-return-statement(4) andinvalid-return-statement(1): calling a method on a possibly-null platform yieldsmixed, so the arrays these methods return lose their element types.unused-parameter(2):CreateTable::processCombinedby()andprocessStatementEnd()receive the platform but don't use it.
Background
AbstractSql::getSqlString() supplies a default platform before calling buildSqlString(), so no path reaches these methods with null.
Considerations
- These are
protectedmethods. Making the parameter required narrows it for callers, but subclasses that override with?PlatformInterface $adapterPlatform = nullremain compatible, since a child may widen a parameter. - A subclass that calls
parent::processX()without arguments, or withnull, would get anArgumentCountErrororTypeError. None of the driver packages do this.
Proposal(s)
Change the signature of each DDL process* method to PlatformInterface $adapterPlatform. Keep the parameter on processCombinedby() and processStatementEnd(), since buildSqlString() passes it positionally to every process* method.
Appendix/Additional Info
Finding counts are from mago analyze --ignore-baseline src/Sql once the docblock typing in #204 is applied.
- 主要语言
- PHP
- 星标
- 18
- 派生
- 8
- 平均合并
- 6 天 11 小时
- 30 天内合并 PR
- 14
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
php-db/phpdb 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
RFC
难度 3/5 1-2 天 新手友好度 66/100
维护者通常 1 天内回复
-
RFC
难度 5/5 一周以上 新手友好度 38/100
维护者通常 1 天内回复
-
RFC
难度 4/5 3-5 天 新手友好度 45/100
维护者通常 1 天内回复
-
Sql's foreign-table guard raises TypeError when its table is a TableIdentifier or aliased array可能已有人在做 @simon-mundy 于 1 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 50/100
维护者通常 1 天内回复
相似的 Issue
-
product / databases
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
VilnaCRM-Org/user-service#525 ·
维护者通常 21 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
shukiv/jabali-panel#2029 ·
维护者通常 1 天内回复
-
area:pool-types good first issue priority:low type:bug
难度 2/5 1-3 小时 新手友好度 76/100
crazy-goat/php-fpm-ng#822 ·
维护者通常 1 天内回复
-
agentic bug
难度 2/5 1-3 小时 新手友好度 78/100
MagnaCapax/PMSS#1023 · 1 条评论 ·
维护者通常 5 天内回复