Repository navigation
Conversation
Formatting moves with the 1.61 formatter. The analyzer findings it raises are answered in code: the Traversable guard in resolveIterator stays because an internal class may implement Traversable without Iterator or IteratorAggregate, the metadata hierarchy walk keeps its mixed-array access under an expect, and AdapterInterfaceFactory narrows the config service before indexing it. The @Property for lastInsertValue now matches the property it documents, and two redundant null coalesces are gone. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The dialect is known when the platform is selected, so it is known when a statement is created. StatementFactoryInterface puts the statement construction on the platform: the standard SQL implementation returns the PhpDb\\Sql\\Ddl and DML classes, and a driver returns its own subclasses where its dialect renders a statement differently. Sql delegates its four DML factories to it and gains createTable(), alterTable() and dropTable(). With the statement carrying the dialect, the decoration machinery has nothing left to do, so PlatformDecoratorInterface, setSubject(), AbstractSql::\, localizeVariables(), getTypeDecorator(), setTypeDecorator(), the name-keyed decorator map and the two decorator exceptions are removed. AbstractSql gains prepareSpecifications() in place of the state copy, and processSubSelect() renders the subselect directly rather than cloning a decorator over it. A statement constructed directly still renders with standard SQL rules. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
tyrsson
force-pushed
the
rfc/256-statement-factory
branch
2 times, most recently
from
November 27, 2026 05:31
144398b to
954de7a
Compare
Driverless value quoting is no longer supported: a platform asks its driver to quote a value, and one without a driver throws rather than guess. AbstractSql::getSqlString() still defaulted to a driverless Sql92, so whether a statement rendered depended on whether it carried values. The platform is now a required parameter on SqlInterface and AbstractSql. Sql92 itself is unchanged, and with no default left it is reachable only from the test suite: nothing in src selects it. The adapter and SQL chapters state the quoting requirement, and the bare getSqlString() calls in the DDL and statement tests now pass a trusting standard SQL platform. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
tyrsson
force-pushed
the
rfc/256-statement-factory
branch
from
November 27, 2026 05:41
954de7a to
0210163
Compare
This was referenced Nov 30, 2026
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.
Replaces the decorator mechanism with a statement factory, so a statement carries its dialect from the moment it is created, and removes the runtime default platform.
StatementFactoryInterfaceputs statement construction on the platform.AbstractPlatformreturns the standard DML and DDL classes; a driver returns its own subclasses where its dialect renders a statement differently.Sqldelegatesselect(),insert(),update()anddelete()to the factory and gainscreateTable(),alterTable()anddropTable().getSqlPlatform()becomesgetStatementFactory().PlatformInterface::getSqlPlatformDecorator()becomesgetStatementFactory().buildSqlString()andprepareStatementForSqlObject()render the object they are given.getSqlString()requires a platform. Driverless value quoting is not supported: a platform asks its driver to quote a value, and one without a driver throws.Sql92becomes@internal, and with no default left it is reachable only from the test suite; nothing insrcselects it.PlatformDecoratorInterface,setSubject(),AbstractSql::$subject,localizeVariables(),getTypeDecorator(),setTypeDecorator(), the name-keyed decorator map, and the decorator and subject exceptions.AbstractSql::prepareSpecifications()replaces the state copy, andprocessSubSelect()renders the subselect directly instead of cloning a decorator over it.Why: the dialect is known when the platform is selected, so it is known when a statement is created. The decorator layer only existed to apply dialect rendering to a statement after construction, which also meant copying state into a shared instance, nulling the subject part-way through the render, and narrowing the decorator again at each call site. The
Sql92fallback meant whether a statement rendered at all depended on whether it carried values.A statement built with
new Select()no longer receives platform rendering. Inside phpdb every statement comes fromSqlor from the factory, including the four TableGateway and RowGateway construction sites, so the event features keep mutating the object that renders.Companion implementation: php-db/phpdb-mysql#88. phpdb-sqlite and phpdb-pgsql need the same one-line accessor change and their own factory overrides.
The first commit brings the tree in line with Mago 1.61.
Mago 1.61 code changes
src/Adapter/ParameterContainer.php:314
unfulfilled-expectsrc/Adapter/Profiler/Profiler.php:44
redundant-null-coalescesrc/Container/AdapterInterfaceFactory.php:36
docblock-type-mismatch,redundant-null-coalescesrc/Metadata/Source/AbstractSource.php:699
mixed-array-assignment* @mago-expect analysis:mixed-assignment + * @mago-expect analysis:mixed-array-assignment * @mago-expect lint:no-issetsrc/ResultSet/AbstractResultSet.php:124
redundant-conditionsrc/Sql/AbstractSql.php:367
redundant-null-coalescesrc/TableGateway/AbstractTableGateway.php:32
overly-wide-return-type