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.
The initial work was done on top of
master
and then backported to3.0.x
to get the tests improved as well. This is an important addition on top of the existing code quality checks since it helps to find potential bugs and prevents the new code of questionable quality from being introduced.Additionally, in
master
the test suite will be cleaned up since a lot of assertions are no longer needed thanks to the improved type system (#3348).Fixed issues:
The analysis identified a couple of potential issues and deviations from the best practices:
$name
variable declared in theforeach
loop overrides the table$name
method argument that is used down the line. Most likely, a table with such constraints will have an invalid name:dbal/src/Platforms/SqlitePlatform.php
Lines 329 to 331 in 8be6d16
strpos()
return value looks suspicious:dbal/src/Schema/OracleSchemaManager.php
Line 127 in 8be6d16
dbal/src/Cache/ResultCacheStatement.php
Lines 84 to 85 in 936e7e3
"0"
set on a table in Oracle may be ignored:dbal/src/Platforms/OraclePlatform.php
Lines 788 to 790 in 8be6d16
TRUE
is when the counts are not equal which should have been coded explicitly:dbal/src/Platforms/SQLServer2012Platform.php
Line 1353 in 8be6d16
Technically, BC-breaks:
$fetchMode
argument in theStatement
methods is no longer ignored. Not that anyone should have used it but in order to use the default mode, it should be omitted or expressed asNULL
.oci8
andpdo_oci
drivers are no longer ignored if passed explicitly.pdo_sqlsrv
driver is no longer ignored if passed explicitly.QueryBuilder
methods still accept null as an optional parameter but will no longer ignore another explicitly passed empty value:::select()
,::addSelect()
,::insert()
,::update()
,::delete()
.Statement::execute()
,QueryBuilder::groupBy()
and::addGroupBy()
will no longer an explicitly passed non-array empty value.AbstractPlatform::getTrimExpression()
will no longer ignore an empty value of$mode
(useTrimMode::UNSPECIFIED
or omit); and an empty value of$char
(usefalse
or omit).Other empty values in various configurations are not ignored if passed explicitly
Future improvements identified
The errors suppressed in the PHPStan configuration identify the by-design issues that need to be fixed in the future:
AbstractSchemaManager::tryMethod()
implements dynamic method calls and needs to be redesigned and internalized to DBAL.Additional, not strictly relevant issues fixed:
dbal/src/Schema/MySqlSchemaManager.php
Line 146 in 936e7e3
TODO:
master
, revisit the list of whitelisted errors. Some of them will be no longer relevant.