diff --git a/composer.json b/composer.json index 9b880061811..7dfb3faade6 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ "phpunit/phpunit": "^8.5@dev", "psalm/plugin-phpunit": "^0.10.0", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", - "vimeo/psalm": "^3.11" + "vimeo/psalm": "^3.11@dev" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." diff --git a/composer.lock b/composer.lock index bdda45853bc..2984acb8284 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cec3b783931e72ead199fc4c36e213bd", + "content-hash": "58106376e071903ef75ebd948d4dd5cd", "packages": [ { "name": "doctrine/cache", @@ -2976,16 +2976,16 @@ }, { "name": "vimeo/psalm", - "version": "3.11.2", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "d470903722cfcbc1cd04744c5491d3e6d13ec3d9" + "reference": "117a4d4d4001938bb2f11df51f2ada1b99933cc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/d470903722cfcbc1cd04744c5491d3e6d13ec3d9", - "reference": "d470903722cfcbc1cd04744c5491d3e6d13ec3d9", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/117a4d4d4001938bb2f11df51f2ada1b99933cc6", + "reference": "117a4d4d4001938bb2f11df51f2ada1b99933cc6", "shasum": "" }, "require": { @@ -3070,7 +3070,7 @@ "inspection", "php" ], - "time": "2020-04-13T12:47:11+00:00" + "time": "2020-05-01T03:35:13+00:00" }, { "name": "webmozart/assert", @@ -3219,7 +3219,8 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "phpunit/phpunit": 20 + "phpunit/phpunit": 20, + "vimeo/psalm": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/lib/Doctrine/DBAL/DriverManager.php b/lib/Doctrine/DBAL/DriverManager.php index 31fc8ea12f9..746b52d488f 100644 --- a/lib/Doctrine/DBAL/DriverManager.php +++ b/lib/Doctrine/DBAL/DriverManager.php @@ -115,11 +115,17 @@ private function __construct() * driverClass: * The driver class to use. * - * @param mixed[] $params The parameters. + * @param mixed[] $params * @param Configuration|null $config The configuration to use. * @param EventManager|null $eventManager The event manager to use. * * @throws DBALException + * + * @phpstan-param mixed[] $params + * @phpstan-return Connection + * @psalm-param array{wrapperClass?: class-string} $params + * @psalm-return ($params is array{wrapperClass:mixed} ? T : Connection) + * @template T of Connection */ public static function getConnection( array $params, diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 70544cbf7ec..40bc84910a1 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -83,3 +83,10 @@ parameters: # Needs Generics - '~Method Doctrine\\DBAL\\Schema\\SchemaDiff::getNewTablesSortedByDependencies\(\) should return array but returns array.~' + + # Caused by phpdoc annotations intended for Psalm + - + message: '~Unable to resolve the template type T in call to method static method Doctrine\\DBAL\\DriverManager::getConnection\(\)~' + paths: + - %currentWorkingDirectory%/lib/Doctrine/DBAL/Id/TableGenerator.php + - %currentWorkingDirectory%/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php