Closed
Description
Symfony version(s) affected
5.4.7
Description
\Symfony\Component\Cache\Adapter\PdoAdapter::__construct() 1st param is $connOrDsn
.
The DocBlock Comment currently section says:
@param \PDO|string $connOrDsn
, however it can also be of type \Doctrine\DBAL\Connection
.
Because of the DocBlock Comment is currently missing the Connection
type, some static analyzers (phpstan) fails when we provide a Connection
object.
How to reproduce
use Doctrine\DBAL\DriverManager;
use Symfony\Component\Cache\Adapter\PdoAdapter;
$connUrl = 'mysql://user:[email protected]/db_name';
$conn = DriverManager::getConnection( [ 'url' => $connUrl ]);
new PdoAdapter( $conn, 'mycache', 3600 );
Then run phpstan on it
Possible Solution
in vendor/symfony/cache/Adapter/PdoAdapter.php
Link to GitHub line change line 59 to this:
* @param \PDO|Connection|string $connOrDsn
Additional Context
static analyzer