Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/4.0.x' into remove/doctrine-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Apr 29, 2021
2 parents fd1e643 + 6d82230 commit d01363e
Show file tree
Hide file tree
Showing 443 changed files with 8,587 additions and 10,208 deletions.
17 changes: 10 additions & 7 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ environment:
- db: mssql
driver: sqlsrv
db_version: sql2012sp1
php: 7.3
php: 7.4
- db: mssql
driver: sqlsrv
db_version: sql2017
php: 7.3
php: 7.4
- db: mssql
driver: pdo_sqlsrv
db_version: sql2017
php: 7.3
php: 7.4

init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;C:\tools\composer;%PATH%
Expand All @@ -37,10 +37,13 @@ init:

## Install PHP and composer, and run the appropriate composer command
install:
# Upgrade to 0.10.16-beta to benefit from a bugfix for
# https://github.com/chocolatey/choco/issues/1843
- ps: choco upgrade chocolatey --pre
- ps: |
# Check if installation is cached
if (!(Test-Path c:\tools\php)) {
appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version 7.3.12
appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
# install sqlite
appveyor-retry cinst -y sqlite
Get-ChildItem -Path c:\tools\php
Expand All @@ -59,8 +62,8 @@ install:
Add-Content php.ini "`n extension=php_curl.dll"
Add-Content php.ini "`n curl.cainfo=C:\tools\cacert\bundle.pem"
# Get and install the latest stable sqlsrv DLL's
$DLLVersion = (Invoke-WebRequest "https://pecl.php.net/rest/r/sqlsrv/stable.txt").Content
# Use a preview version of the extension that supports PHP 7.4
$DLLVersion = "5.7.1preview"
cd c:\tools\php\ext
$source = "https://windows.php.net/downloads/pecl/releases/sqlsrv/$($DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip"
$destination = "c:\tools\php\ext\php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip"
Expand All @@ -71,7 +74,7 @@ install:
Invoke-WebRequest $source -OutFile $destination
7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip > $null
$DLLVersion = (Invoke-WebRequest "https://pecl.php.net/rest/r/pcov/stable.txt").Content
Invoke-WebRequest https://windows.php.net/downloads/pecl/releases/pcov/$($DLLVersion)/php_pcov-$($DLLVersion)-7.3-nts-vc15-$($env:platform).zip -OutFile pcov.zip
Invoke-WebRequest https://windows.php.net/downloads/pecl/releases/pcov/$($DLLVersion)/php_pcov-$($DLLVersion)-7.4-nts-vc15-$($env:platform).zip -OutFile pcov.zip
7z x -y pcov.zip > $null
Remove-Item c:\tools\php\* -include .zip
cd c:\tools\php
Expand Down
289 changes: 289 additions & 0 deletions UPGRADE.md

Large diffs are not rendered by default.

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;

$files = [__DIR__ . '/../vendor/autoload.php', __DIR__ . '/../../../autoload.php'];
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"doctrine/coding-standard": "8.2.0",
"jetbrains/phpstorm-stubs": "2020.2",
"phpstan/phpstan": "0.12.81",
"phpstan/phpstan-strict-rules": "^0.12.2",
"phpstan/phpstan-phpunit": "0.12.18",
"phpstan/phpstan-strict-rules": "0.12.2",
"phpunit/phpunit": "9.5.0",
"psalm/plugin-phpunit": "0.13.0",
"squizlabs/php_codesniffer": "3.6.0",
Expand Down
8 changes: 4 additions & 4 deletions docs/en/reference/schema-manager.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ A Schema Manager instance helps you with the abstraction of the
generation of SQL assets such as Tables, Sequences, Foreign Keys
and Indexes.

To retrieve the ``SchemaManager`` for your connection you can use
the ``getSchemaManager()`` method:
To instantiate a ``SchemaManager`` for your connection you can use
the ``createSchemaManager()`` method:

.. code-block:: php
<?php
$sm = $conn->getSchemaManager();
$schemaManager = $conn->createSchemaManager();
Now with the ``SchemaManager`` instance in ``$sm`` you can use the
Now with the ``SchemaManager`` instance in ``$schemaManager`` you can use the
available methods to learn about your database schema:

.. note::
Expand Down
14 changes: 11 additions & 3 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<file>tests</file>

<rule ref="Doctrine">
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
<exclude name="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants.DisallowedLateStaticBindingForConstant"/>
Expand Down Expand Up @@ -68,6 +67,10 @@
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>

<rule ref="SlevomatCodingStandard.PHP.RequireExplicitAssertion.RequiredExplicitAssertion">
<exclude-pattern>tests/*</exclude-pattern>
</rule>

<rule ref="Squiz.Classes.ClassFileName.NoMatch">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
Expand All @@ -93,8 +96,7 @@
</rule>

<rule ref="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps">
<!-- This test contains a fixture class that should use snake case -->
<exclude-pattern>tests/Functional/DataAccessTest.php</exclude-pattern>
<exclude-pattern>tests/Functional/DataAccess/FetchClass.php</exclude-pattern>
</rule>

<rule ref="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps">
Expand Down Expand Up @@ -143,4 +145,10 @@
<rule ref="Squiz.PHP.LowercasePHPFunctions">
<exclude-pattern>src/Driver/SQLSrv/Statement.php</exclude-pattern>
</rule>

<!-- This could be considered a bug in the sniff or the shortcoming of the Platform API design
see https://github.com/squizlabs/PHP_CodeSniffer/issues/3035 -->
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod.Found">
<exclude-pattern>src/Platforms/SqlitePlatform.php</exclude-pattern>
</rule>
</ruleset>
53 changes: 36 additions & 17 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,19 @@ parameters:
level: 7
paths:
- %currentWorkingDirectory%/src
- %currentWorkingDirectory%/tests
treatPhpDocTypesAsCertain: false
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
# removing it would be BC break
- '~^Constructor of class Doctrine\\DBAL\\Schema\\Table has an unused parameter \$idGeneratorType\.\z~'

# changing these would be a BC break, to be done in next major
- "~^Casting to bool something that's already bool.~"
- '~^Property Doctrine\\DBAL\\Schema\\Schema::\$_schemaConfig \(Doctrine\\DBAL\\Schema\\SchemaConfig\) does not accept default value of type false\.\z~'
- '~^Return type \(int\|false\) of method Doctrine\\DBAL\\Driver\\OCI8\\Connection\:\:lastInsertId\(\) should be compatible with return type \(string\) of method Doctrine\\DBAL\\Driver\\Connection::lastInsertId\(\)~'
- '~^Method Doctrine\\DBAL\\Driver\\Mysqli\\Connection::lastInsertId\(\) should return string but returns int\|string\.$~'

# https://github.com/doctrine/dbal/pull/3836
# TODO: remove in 4.0.0
- '~^Parameter #2 \$registeredAliases of static method Doctrine\\DBAL\\Query\\QueryException::nonUniqueAlias\(\) expects array<string>, array<int, int\|string> given\.\z~'

# some drivers actually do accept 2nd parameter...
- '~^Method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getListTableForeignKeysSQL\(\) invoked with \d+ parameters, 1 required\.\z~'

# legacy remnants from doctrine/common
- '~^Class Doctrine\\Common\\(Collections\\Collection|Persistence\\Proxy) not found\.\z~'
- '~^.+ on an unknown class Doctrine\\Common\\(Collections\\Collection|Persistence\\Proxy)\.\z~'

# may not exist when pdo_sqlsrv is not loaded but PDO is
- '~^Access to undefined constant PDO::SQLSRV_ENCODING_BINARY\.\z~'

# weird class name, represented in stubs as OCI_(Lob|Collection)
- '~unknown class OCI-(Lob|Collection)~'

Expand All @@ -52,6 +40,7 @@ parameters:
-
message: '~^Construct empty\(\) is not allowed. Use more strict comparison\.~'
paths:
- %currentWorkingDirectory%/src/Connections/PrimaryReadReplicaConnection.php
- %currentWorkingDirectory%/src/Driver/*/Driver.php
- %currentWorkingDirectory%/src/Driver/AbstractOracleDriver/EasyConnectString.php
- %currentWorkingDirectory%/src/Platforms/*Platform.php
Expand All @@ -69,13 +58,13 @@ parameters:
paths:
- %currentWorkingDirectory%/src/Driver/*/Driver.php
- %currentWorkingDirectory%/src/Platforms/*Platform.php
- %currentWorkingDirectory%/src/Query/QueryBuilder.php
- %currentWorkingDirectory%/src/Schema/*SchemaManager.php

# Some APIs use variable method calls internally
-
message: '~^Variable method call on .*~'
paths:
- %currentWorkingDirectory%/src/Schema/AbstractSchemaManager.php
- %currentWorkingDirectory%/src/Schema/Column.php

# https://github.com/phpstan/phpstan/issues/3146
Expand All @@ -84,6 +73,16 @@ parameters:
paths:
- %currentWorkingDirectory%/src/Platforms/SQLServer2012Platform.php

# Temporaily suppressed during up-merging an upgrade PHPStan 0.12
-
message: '~^Call to an undefined method Doctrine\\DBAL\\Driver::createDatabasePlatformForVersion\(\)\.$~'
path: %currentWorkingDirectory%/tests/Driver/AbstractDriverTest.php

# Temporaily suppressed during up-merging an upgrade to PHPStan 0.12.33
-
message: '~^Parameter #1 \$expected of static method PHPUnit\\Framework\\Assert::assertInstanceOf\(\) expects class-string<Doctrine\\DBAL\\Connection&PHPUnit\\Framework\\MockObject\\MockObject>, class-string<Doctrine\\DBAL\\Connection>&class-string<PHPUnit\\Framework\\MockObject\\MockObject> given\.$~'
path: %currentWorkingDirectory%/tests/DriverManagerTest.php

# Unlike Psalm, PHPStan doesn't understand the shape of the parse_str() return value
-
message: '~^Parameter #1 \$scheme of static method Doctrine\\DBAL\\DriverManager::parseDatabaseUrlScheme\(\) expects string\|null, int\|string\|null given\.$~'
Expand All @@ -102,6 +101,24 @@ parameters:
paths:
- %currentWorkingDirectory%/tests/Functional/Platform/DefaultExpressionTest.php

# https://github.com/phpstan/phpstan/issues/4126
-
message: '~^Call to function iterator_to_array\(\) on a separate line has no effect\.$~'
paths:
- %currentWorkingDirectory%/tests/Functional/Connection/FetchTest.php

# https://github.com/phpstan/phpstan/issues/4557
-
message: '~^Parameter #1 \$originalClassName of method PHPUnit\\Framework\\TestCase::createMock\(\) expects class-string<T of Doctrine\\DBAL\\Platforms\\AbstractPlatform>, string given\.$~'
paths:
- %currentWorkingDirectory%/tests/Platforms/AbstractPlatformTestCase.php

# https://github.com/phpstan/phpstan/issues/4557
-
message: '~^Unable to resolve the template type T in call to method PHPUnit\\Framework\\TestCase::createMock\(\)$~'
paths:
- %currentWorkingDirectory%/tests/Platforms/AbstractPlatformTestCase.php

-
message: '~^Instanceof between Doctrine\\DBAL\\Platforms\\Keywords\\KeywordList and Doctrine\\DBAL\\Platforms\\Keywords\\KeywordList will always evaluate to true\.~'
paths:
Expand All @@ -113,4 +130,6 @@ parameters:
count: 1
path: src/Cache/QueryCacheProfile.php
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
Loading

0 comments on commit d01363e

Please sign in to comment.