Repository navigation
Bring Sql\Ddl to Mago compliance - #231
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
simon-mundy
marked this pull request as draft
October 11, 2026 23:10
AlterTable::getRawState() and CreateTable::getRawState() declared array|string, so asking either for the table of a statement built with a TableIdentifier threw a TypeError. Both now declare TableIdentifier too, with the raw state described by a RawState shape. The DDL processors take PlatformInterface rather than a nullable platform defaulting to null. buildSqlString() always passes one, and the platform packages' decorators already cast it to non-null. Their ?PlatformInterface overrides stay compatible. processCombinedby() returns an empty parameter list instead of reading its separator back out of the specifications, and processStatementEnd() drops the platform it never used. AlterTable maps its column, constraint and index lists instead of looping over each by hand. The column constructors type $default as the values setDefault() accepts, and Column::$default starts as null. ForeignKey's reference specification is typed as the two-part shape getExpressionData() reads.
Every DDL statement, column, constraint and index class is public API that the platform packages extend, so each is marked @api rather than final, as in Sql\Predicate. AlterTable and CreateTable join the too-many-methods exclusions as fluent builders. ForeignKey and AbstractPrecisionColumn are excluded from excessive-parameter-list: their constructors take one argument per part of the definition they model and are public API. Three findings stay baselined, one per processTable(). They come from AbstractSql::resolveTable() declaring an array return that only Select's override produces, and belong with the DML pass.
simon-mundy
force-pushed
the
qa/mago-sql-ddl
branch
from
October 11, 2026 23:43
8891914 to
09426ce
Compare
simon-mundy
marked this pull request as ready for review
October 11, 2026 23:46
tyrsson
previously approved these changes
Oct 12, 2026
simon-mundy
dismissed
tyrsson’s stale review
October 12, 2026 02:23
The merge-base changed after approval.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Takes
Sql\Ddlout of the lint baseline entirely and leaves 3 of its 62 analyzer findings, and fixes aTypeErroringetRawState()along the way.Bug fixed
AlterTable::getRawState()andCreateTable::getRawState()declaredarray|string. Asking for the table of a statement built with aTableIdentifiertherefore threw:Both now declare
TableIdentifieras well, and describe the raw state with aRawStateshape.Cleanup
process*()methods take aPlatformInterface, not?PlatformInterface = null.buildSqlString()always passes one, and thephpdb-mysqldecorators already cast it to non-null. Their?PlatformInterfaceoverrides stay compatible, because a wider parameter type in a child is allowed.CreateTable::processCombinedby()returns an empty parameter list rather than reading the separator back out of$specifications.processStatementEnd()drops the platform parameter it never used.AlterTablebuilds its column, constraint and index lists witharray_mapinstead of five hand-written loops. This clears itskan-defect.$defaultas the valuessetDefault()accepts, where they used to takemixed, andColumn::$defaultnow starts asnull. Constructors are exempt from signature compatibility, so subclasses are unaffected.ForeignKey::$referenceSpecificationis typed as the two-part shapegetExpressionData()reads.AbstractPrecisionColumn::getLengthExpression()is a singlematch, which clears itshalsteadfinding.@api, not madefinal, as in Bring Sql\Predicate to full Mago compliance #230.mago.toml,AlterTableandCreateTablejoin thetoo-many-methodsexclusions as fluent builders.ForeignKeyandAbstractPrecisionColumnare excluded fromexcessive-parameter-list: their public constructors take one argument per part of the definition they model.Left for the DML pass
Three findings remain, one per
processTable(). They trace back toAbstractSql::resolveTable()declaringstring|array|null. OnlySelect's override returns an array; it reuses the name for a different[table, fromTable]shape. Fixing that is aSelectchange, so it belongs with the DML PR.Result
src/Sql/Ddlin either baselineLine and method coverage of
src/Sql/Ddlis 100%. Infection reports 100% covered-code MSI: 287 killed and 5 caught by static analysis.