Skip to content

Enable PHPStan in tests #3260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 85 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
2f4809a
Decouple unique index from unique constraint
guilhermeblanco Sep 22, 2016
75ca0b9
Added flag support to unique constraint
guilhermeblanco Sep 22, 2016
64a1f95
Fixed tests
guilhermeblanco Sep 24, 2016
dc9696e
Removed identifier generator type from schema table definition
guilhermeblanco Sep 24, 2016
b4da554
Fixing rebase with master
guilhermeblanco Jun 21, 2017
ca0e17d
Fixed undefined result of rebase
guilhermeblanco Jun 22, 2017
2513424
Moved getSequencePrefix() from ClassMetadata (ORM) to AbstractPlatfor…
guilhermeblanco Jul 11, 2017
e656cd5
Bump version to 3.0.x-dev
Majkl578 Jan 5, 2018
d2f585a
[BC] Removed support for PDO::PARAM_INPUT_OUTPUT in Statement::bindPa…
morozov Dec 27, 2017
b542a51
[BC] Replaced extension of \PDOStatement with a composition to avoid …
morozov Jan 2, 2018
c4f5d50
[BC] Replaced PDO constants with values
morozov Jan 1, 2018
97f4fdb
Updated UPGRADE.md for 3.x
morozov Dec 25, 2017
ecd2959
Drop Doctrine\DBAL\Version in favor of Ocramius\PackageVersions
Majkl578 Jan 5, 2018
ff9a93a
Drop Drizzle support
BenMorel Mar 7, 2018
b03995f
Add note to UPGRADE.md
BenMorel Mar 7, 2018
1ede74f
Introduce a null SQL logger
BenMorel Mar 8, 2018
a604c93
Make NullLogger final
BenMorel Mar 8, 2018
0cd43bb
One-liner for Configuration::getSQLLogger()
BenMorel Mar 8, 2018
f851b66
Change the SQLLogger interface signature
BenMorel Mar 8, 2018
c8cc485
Add UPGRADE note
BenMorel Mar 8, 2018
afc806b
Ignore NullLogger in code coverage
BenMorel Mar 8, 2018
b15132c
Make SQLLogger implementations final
BenMorel Mar 8, 2018
a947bf8
Update UPGRADE.md
BenMorel Mar 8, 2018
52f4680
Do not accept null in Configuration::setSQLLogger()
BenMorel Mar 8, 2018
238ec65
Add note about setSQLLogger()
BenMorel Mar 8, 2018
b938e31
Don't catch Exception anymore
BenMorel Mar 9, 2018
aa17f5a
When rendering SQL, only render the alias if it's different from the …
morozov Mar 13, 2018
ad400b9
Drop support for PostgreSQL <9.3
Majkl578 Mar 16, 2018
d116e74
Drop support for SQL Server <2008
Majkl578 Mar 16, 2018
e785a54
Drop support for SQL Anywhere <16
Majkl578 Mar 16, 2018
4191666
Drop PDO DB2 driver
Majkl578 Mar 17, 2018
0d01d3e
Remove MsSQLKeywords
Majkl578 Mar 17, 2018
d6c2e46
Reorder keywords and type mappings alphabetically
Majkl578 Mar 17, 2018
f934f89
Fixed build failure on SQL Server (sqlsrv)
morozov Mar 20, 2018
03917d3
Fixed build failure on SQL Server (pdo_sqlsrv)
morozov Mar 20, 2018
21cf640
[DBAL-3079] Reworked the usage of PDO in PDOConnection from inheritan…
morozov Apr 2, 2018
c28d7da
[DBAL-3079] Added type hints to query-related method parameters and r…
morozov Apr 11, 2018
e1248fa
Added string mapping in SqlitePlatform - used by make bundle
Apr 28, 2018
1eb9aaf
[DBAL-3079] Updated upgrade documentation
morozov Apr 12, 2018
2afcbc3
Merge pull request #3119 from DeyV/develop
Ocramius Apr 28, 2018
6cec550
Revert complex type specification in Connection
Majkl578 Apr 20, 2018
d267148
Merge pull request #3113 from Majkl578/revert-complex-type-spec
Majkl578 May 2, 2018
f3fc96f
Removed the logic of using BLOB columns for BINARY type of fields
morozov Jun 6, 2018
5f704b6
Removed support for DB-generated UUIDs
morozov Jul 11, 2018
defd944
Fixed and suppressed issues found by PHPStan on develop
morozov Aug 3, 2018
3a9e527
Merge pull request #3211 from morozov/issues/3167
morozov Aug 2, 2018
db1f156
Removed dbal:import CLI command
morozov Aug 7, 2018
d1214a2
Merge pull request #3238 from morozov/phpstan-develop
Ocramius Aug 3, 2018
f7ad1fe
Made the OFFSET in LIMIT queries non-nullable
morozov Aug 11, 2018
adc6ecd
Merge pull request #3241 from morozov/issues/3237
morozov Aug 8, 2018
809fe31
Merge pull request #3248 from morozov/non-nullable-offset
morozov Aug 12, 2018
0756867
Remove Doctrine\DBAL\Types\Type::__toString()
Majkl578 Aug 17, 2018
aa30617
Remove Doctrine\DBAL\Types\Type::getDefaultLength()
Majkl578 Aug 17, 2018
8d24216
Got rid of func_num_args in AbstractPlatform::getDummySelectSQL()
morozov Oct 6, 2018
8dc0b8d
Handle binding errors in OCI8Statement::execute() and MySQLiStatement…
morozov Dec 1, 2018
90011df
Statement::fetchColumn() will throw an exception in the case of inval…
morozov Dec 1, 2018
9fe284d
Transaction-related Statement methods return void
morozov Mar 13, 2019
38bebb7
Merge pull request #3417 from morozov/issues/3358
morozov Feb 9, 2019
b7d18b5
Connection::setAutoCommit() will return void
morozov Mar 13, 2019
bc9a8d2
Moved rowCount() from Statement to ResultStatement
morozov Jan 24, 2019
5ee770e
Merge pull request #3480 from morozov/transaction-void
Ocramius Mar 13, 2019
a801466
Converted Connection and Statement methods which returned false in ca…
morozov Mar 15, 2019
49048e5
Merge pull request #3483 from morozov/row-count
morozov Mar 15, 2019
1e84ced
Merge pull request #3486 from morozov/conn-stmt-void
morozov Mar 16, 2019
2cabfeb
Connection::quote() can only quote strings
morozov Mar 16, 2019
c5ec536
Assert that the username is specified on the connection when listing …
morozov Mar 16, 2019
83e3b7a
Make the $tableName argument of _getPortableTableIndexesList() required
morozov Mar 16, 2019
319b51e
Changed the type of `$char` in `AbstractPlatform::getTrimExpression()…
morozov Mar 17, 2019
c3e6f33
Merge pull request #3488 from morozov/quote-only-string
Ocramius Mar 16, 2019
195a2ad
Merge pull request #3491 from morozov/get-trim-expr
Ocramius Mar 18, 2019
fab415a
Modified AbstractPlatform::getLocateExpression() and ::getSubstringEx…
morozov Mar 18, 2019
f771d67
Reworked AbstractPlatform::get*Expression() methods
morozov Mar 22, 2019
6c5f79b
Merge pull request #3494 from morozov/get-locate-expr
Ocramius Mar 21, 2019
1b86ed3
Merge pull request #3498 from morozov/get-other-expr
Ocramius Mar 27, 2019
82f5fe3
Enable strict types
Majkl578 Feb 8, 2019
c59ee29
Removed DB2SchemaManager::_getPortableForeignKeyRuleDef()
morozov Mar 30, 2019
07b9819
Merge pull request #2854 from Majkl578/strict-types
morozov Apr 2, 2019
b0a8ab0
Reworking driver exceptions
morozov Apr 5, 2019
90286b5
Merge pull request #3502 from morozov/db2-get-portable-foreign-key-ru…
Majkl578 Apr 3, 2019
9f3c882
Merge pull request #3505 from morozov/driver-exceptions
Ocramius Apr 5, 2019
0f662c5
Removed errorCode() and errorInfo() methods from Connection and State…
morozov Apr 5, 2019
6b5d226
Reworked `AbstractSchemaManager::extractDoctrineTypeFromComment()` re…
morozov Mar 29, 2019
ba45fbd
Merge pull request #3507 from morozov/error-code-info
Ocramius Apr 6, 2019
6daf933
Merge pull request #3501 from morozov/extract-type-from-comment
morozov Apr 13, 2019
9742200
Enable PHPStan in tests
Majkl578 Aug 18, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ before_commands:
tools:
external_code_coverage:
timeout: 3600
runs: 30 # 25x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP
runs: 29 # 24x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP

filter:
excluded_paths:
Expand Down
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,6 @@ jobs:
env: DB=mariadb.mysqli MARIADB_VERSION=10.3 COVERAGE=yes
addons:
mariadb: 10.3
- stage: Test
php: 7.3
env: DB=pgsql POSTGRESQL_VERSION=9.2 COVERAGE=yes
services:
- postgresql
addons:
postgresql: "9.2"
- stage: Test
php: 7.3
env: DB=pgsql POSTGRESQL_VERSION=9.3 COVERAGE=yes
Expand Down
221 changes: 220 additions & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,222 @@
# Upgrade to 3.0

## BC BREAK `AbstractSchemaManager::extractDoctrineTypeFromComment()` changed, `::removeDoctrineTypeFromComment()` removed

`AbstractSchemaManager::extractDoctrineTypeFromComment()` made `protected`. It takes the comment by reference, removes the type annotation from it and returns the extracted Doctrine type.

## BC BREAK `::errorCode()` and `::errorInfo()` removed from `Connection` and `Statement` APIs

The error information is available in `DriverException` trown in case of an error.

## BC BREAK Changes in driver exceptions

1. The `Doctrine\DBAL\Driver\DriverException::getErrorCode()` method is removed. In order to obtain the driver error code, please use `::getCode()`.
2. `Doctrine\DBAL\Driver\PDOException` no longer extends `PDOException`.
3. The value returned by `Doctrine\DBAL\Driver\PDOException::getSQLState()` no longer falls back to the driver error code.

The method was used internally and is no longer needed.

## BC BREAK `DB2SchemaManager::_getPortableForeignKeyRuleDef()` removed

The method was used internally and is no longer needed.

## BC BREAK `AbstractPlatform::get*Expression()` methods no loner accept integer values as arguments

The following methods' arguments do not longer accept integer value:

- the `$expression` argument in `::getCountExpression()`,
- the `$decimals` argument in `::getRoundExpression()`,
- the `$seconds` argument in `::getDateAddSecondsExpression()`,
- the `$seconds` argument in `::getDateSubSecondsExpression()`,
- the `$minutes` argument in `::getDateAddMinutesExpression()`,
- the `$minutes` argument in `::getDateSubMinutesExpression()`,
- the `$hours` argument in `::getDateAddHourExpression()`,
- the `$hours` argument in `::getDateAddHourExpression()`,
- the `$days` argument in `::getDateAddDaysExpression()`,
- the `$days` argument in `::getDateSubDaysExpression()`,
- the `$weeks` argument in `::getDateAddWeeksExpression()`,
- the `$weeks` argument in `::getDateSubWeeksExpression()`,
- the `$months` argument in `::getDateAddMonthExpression()`,
- the `$months` argument in `::getDateSubMonthExpression()`,
- the `$quarters` argument in `::getDateAddQuartersExpression()`,
- the `$quarters` argument in `::getDateSubQuartersExpression()`,
- the `$years` argument in `::getDateAddYearsExpression()`,
- the `$years` argument in `::getDateSubYearsExpression()`.

Please use the strings representing numeric SQL literals instead (e.g. `'1'` instead of `1`).

The signature of `AbstractPlatform::getConcatExpression()` changed to `::getConcatExpression(string ...$string)`.

## BC BREAK The type of `$start` in `AbstractPlatform::getLocateExpression()` changed from `string|false` to `?string`

The default value of `$start` is now `null`, not `false`.

## BC BREAK The types of `$start` and `$length` in `AbstractPlatform::getSubstringExpression()` changed from `int` and `?int` to `string` and `?string` respectively

The platform abstraction allows building arbitrary SQL expressions, so even if the arguments represent numeric literals, they should be passed as a string.

## BC BREAK The type of `$char` in `AbstractPlatform::getTrimExpression()` changed from `string|false` to `?string`

The default value of `$char` is now `null`, not `false`. Additionally, the method will throw an `InvalidArgumentException` in an invalid value of `$mode` is passed.

## BC BREAK `Statement::quote()` only accepts strings.

`Statement::quote()` and `ExpressionBuilder::literal()` no longer accept arguments of an arbitrary type and and don't implement type-specific handling. Only strings can be quoted.

## BC BREAK `Statement` and `Connection` methods return `void`.

`Connection::connect()`, `Statement::bindParam()`, `::bindValue()`, `::execute()`, `ResultStatement::setFetchMode()` and `::closeCursor()` no longer return a boolean value. They will throw an exception in case of failure.

## BC BREAK `Statement::rowCount()` is moved.

`Statement::rowCount()` has been moved to the `ResultStatement` interface where it belongs by definition.

## BC BREAK Transaction-related `Statement` methods return `void`.

`Statement::beginTransaction()`, `::commit()` and `::rollBack()` no longer return a boolean value. They will throw a `DriverException` in case of failure.

## MINOR BC BREAK `Statement::fetchColumn()` with an invalid index.

Similarly to `PDOStatement::fetchColumn()`, DBAL statements throw an exception in case of an invalid column index.

## BC BREAK `Statement::execute()` with redundant parameters.

Similarly to the drivers based on `pdo_pgsql` and `pdo_sqlsrv`, `OCI8Statement::execute()` and `MySQLiStatement::execute()` do not longer ignore redundant parameters.

## BC BREAK: `Doctrine\DBAL\Types\Type::getDefaultLength()` removed

The `Doctrine\DBAL\Types\Type::getDefaultLength()` method has been removed as it served no purpose.

## BC BREAK: `Doctrine\DBAL\Types\Type::__toString()` removed

Relying on string representation was discouraged and has been removed.

## BC BREAK: The `NULL` value of `$offset` in LIMIT queries is not allowed

The `NULL` value of the `$offset` argument in `AbstractPlatform::(do)?ModifyLimitQuery()` methods is no longer allowed. The absence of the offset should be indicated with a `0` which is now the default value.

## BC BREAK: Removed dbal:import CLI command

The `dbal:import` CLI command has been removed since it only worked with PDO-based drivers by relying on a non-documented behavior of the extension, and it was impossible to make it work with other drivers.
Please use other database client applications for import, e.g.:

* For MySQL and MariaDB: `mysql [dbname] < data.sql`.
* For PostgreSQL: `psql [dbname] < data.sql`.
* For SQLite: `sqlite3 /path/to/file.db < data.sql`.

## BC BREAK: Removed support for DB-generated UUIDs

The support for DB-generated UUIDs was removed as non-portable.
Please generate UUIDs on the application side (e.g. using [ramsey/uuid](https://packagist.org/packages/ramsey/uuid)).

## BC BREAK: Removed MsSQLKeywords class

The `Doctrine\DBAL\Platforms\MsSQLKeywords` has been removed.
Please use `Doctrine\DBAL\Platforms\SQLServerPlatform `instead.

## BC BREAK: Removed PDO DB2 driver

This PDO-based IBM DB2 driver (built on top of pdo_ibm extension) has already been unsupported as of 2.5, it has now been now removed.

The following class has been removed:

* `Doctrine\DBAL\Driver\PDOIbm\Driver`

## BC BREAK: Removed support for SQL Anywhere 12 and older

DBAL now requires SQL Anywhere 16 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to newer SQL Anywhere version (16+).
`Doctrine\DBAL\Platforms\SQLAnywherePlatform` and `Doctrine\DBAL\Platforms\Keywords\SQLAnywhereKeywords` now represent the SQL Anywhere 16.

The following classes have been removed:

* `Doctrine\DBAL\Platforms\SQLAnywhere11Platform`
* `Doctrine\DBAL\Platforms\SQLAnywhere12Platform`
* `Doctrine\DBAL\Platforms\SQLAnywhere16Platform`
* `Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords`

## BC BREAK: Removed support for SQL Server 2005 and older

DBAL now requires SQL Server 2008 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to newer SQL Server version (2012+ is recommended).
`Doctrine\DBAL\Platforms\SQLServerPlatform` and `Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords` now represent the SQL Server 2008.

The following classes have been removed:

* `Doctrine\DBAL\Platforms\SQLServer2005Platform`
* `Doctrine\DBAL\Platforms\SQLServer2008Platform`
* `Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords`

## BC BREAK: Removed support for PostgreSQL 9.2 and older

DBAL now requires PostgeSQL 9.3 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to newer PostgreSQL version (9.6+ is recommended).
`Doctrine\DBAL\Platforms\PostgreSqlPlatform` and `Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords` now represent the PostgreSQL 9.3.

The following classes have been removed:

* `Doctrine\DBAL\Platforms\PostgreSQL91Platform`
* `Doctrine\DBAL\Platforms\PostgreSQL92Platform`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords`

## BC BREAK: Removed Doctrine\DBAL\Version

The Doctrine\DBAL\Version class is no longer available: please refrain from checking the DBAL version at runtime.

## BC BREAK: the PDO symbols are no longer part of the DBAL API

1. The support of `PDO::PARAM_*`, `PDO::FETCH_*`, `PDO::CASE_*` and `PDO::PARAM_INPUT_OUTPUT` constants in the DBAL API is removed.
2. `\Doctrine\DBAL\Driver\PDOConnection` does not extend `\PDO` anymore. Please use `\Doctrine\DBAL\Driver\PDOConnection::getWrappedConnection()` to access the underlying `PDO` object.
3. `\Doctrine\DBAL\Driver\PDOStatement` does not extend `\PDOStatement` anymore.

Before:

use Doctrine\DBAL\Portability\Connection;

$params = array(
'wrapperClass' => Connection::class,
'fetch_case' => PDO::CASE_LOWER,
);

$stmt->bindValue(1, 1, PDO::PARAM_INT);
$stmt->fetchAll(PDO::FETCH_COLUMN);

After:

use Doctrine\DBAL\ColumnCase;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Portability\Connection;

$params = array(
'wrapperClass' => Connection::class,
'fetch_case' => ColumnCase::LOWER,
);

$stmt->bindValue(1, 1, ParameterType::INTEGER);
$stmt->fetchAll(FetchMode::COLUMN);

## BC BREAK: Removed Drizzle support

The Drizzle project is abandoned and is therefore not supported by Doctrine DBAL anymore.

## BC BREAK: SQLLogger changes

- The `SQLLogger` interface has changed; the methods are the same but use scalar type hints, return types, and non-nullable arrays.
- `SQLLogger` implementations: `DebugStack`, `EchoSQLLogger`, `LoggerChain` are now final.
- `Configuration::getSQLLogger()` does not return `null` anymore, but a `NullLogger` implementation.
- `Configuration::setSQLLogger()` does not allow `null` anymore.

## BC BREAK: Changes to handling binary fields

- Binary fields whose length exceeds the maximum field size on a given platform are no longer represented as `BLOB`s.
Use binary fields of a size which fits all target platforms, or use blob explicitly instead.
- Binary fields are no longer represented as streams in PHP. They are represented as strings.

# Upgrade to 2.10

## Deprecated `Type::*` constants
Expand Down Expand Up @@ -80,7 +299,7 @@ This method now throws SPL ``UnexpectedValueException`` instead of accidentally

## Doctrine\DBAL\Connection::TRANSACTION_* constants deprecated

``Doctrine\DBAL\Connection::TRANSACTION_*`` were moved into ``Doctrine\DBAL\TransactionIsolationLevel`` class without the ``TRANSACTION_`` prefix.
``Doctrine\DBAL\Connection::TRANSACTION_*`` were moved into ``Doctrine\DBAL\TransactionIsolationLevel`` class without the ``TRANSACTION_`` prefix.

## DEPRECATION: direct usage of the PDO APIs in the DBAL API

Expand Down
2 changes: 2 additions & 0 deletions bin/doctrine-dbal.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Doctrine\DBAL\Tools\Console\ConsoleRunner;
use Symfony\Component\Console\Helper\HelperSet;

Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@
],
"require": {
"php": "^7.2",
"ext-pdo": "*",
"doctrine/cache": "^1.0",
"doctrine/event-manager": "^1.0"
"doctrine/event-manager": "^1.0",
"ocramius/package-versions": "^1.2"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"jetbrains/phpstorm-stubs": "^2018.1.2",
"phpstan/phpstan": "^0.11.3",
"phpstan/phpstan-phpunit": "^0.11.0",
"phpunit/phpunit": "^8.0",
"symfony/console": "^2.0.5|^3.0|^4.0",
"symfony/phpunit-bridge": "^3.4.5|^4.0.5"
Expand Down
Loading