Describe return type accurately

This return type is conditional to $params['wrapperClass']. Luckily,
recent versions of Psalm allow documenting it properly.
See https://github.com/vimeo/psalm/issues/3277

Note that phpstan is not able to understand this yet, but still attempts
to, hence the extra ignore rules.
parent 9d730848
......@@ -45,7 +45,7 @@
"phpunit/phpunit": "^8.5.5",
"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.4"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
......
......@@ -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": "9157c6d35dd39f5399592fd91126fa07",
"content-hash": "0372454a0ee2de4c2051cc13cbb23b72",
"packages": [
{
"name": "doctrine/cache",
......@@ -2995,16 +2995,16 @@
},
{
"name": "vimeo/psalm",
"version": "3.11.2",
"version": "3.11.4",
"source": {
"type": "git",
"url": "https://github.com/vimeo/psalm.git",
"reference": "d470903722cfcbc1cd04744c5491d3e6d13ec3d9"
"reference": "58e1d8e68e5098bf4fbfdfb420c38d563f882549"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/d470903722cfcbc1cd04744c5491d3e6d13ec3d9",
"reference": "d470903722cfcbc1cd04744c5491d3e6d13ec3d9",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/58e1d8e68e5098bf4fbfdfb420c38d563f882549",
"reference": "58e1d8e68e5098bf4fbfdfb420c38d563f882549",
"shasum": ""
},
"require": {
......@@ -3089,7 +3089,7 @@
"inspection",
"php"
],
"time": "2020-04-13T12:47:11+00:00"
"time": "2020-05-11T13:39:25+00:00"
},
{
"name": "webmozart/assert",
......
......@@ -115,11 +115,15 @@ final class DriverManager
* <b>driverClass</b>:
* The driver class to use.
*
* @param mixed[] $params The parameters.
* @param array{wrapperClass?: class-string<T>} $params
* @param Configuration|null $config The configuration to use.
* @param EventManager|null $eventManager The event manager to use.
*
* @throws DBALException
*
* @phpstan-param mixed[] $params
* @psalm-return ($params is array{wrapperClass:mixed} ? T : Connection)
* @template T of Connection
*/
public static function getConnection(
array $params,
......
......@@ -83,3 +83,10 @@ parameters:
# Needs Generics
- '~Method Doctrine\\DBAL\\Schema\\SchemaDiff::getNewTablesSortedByDependencies\(\) should return array<Doctrine\\DBAL\\Schema\\Table> but returns array<object>.~'
# 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment