You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However the issue here, even if you added support for parsing the DSN string to get the correct subclass, I suspect most of them will be coming from configs/env, so it may not be available at analysis time.
Unsure what a good solution for this would be, for now I can manually narrow the type with a comment:
@@ @@-PHP 8.4 (2 errors)+PHP 8.4 (1 error)
==========
9: Property HelloWorld::$db (Pdo\Mysql) does not accept PDO.
-10: Method HelloWorld::db() should return Pdo\Mysql but returns PDO.-PHP 7.2 – 8.3 (5 errors)+PHP 7.2 – 8.3 (4 errors)
==========
5: Property HelloWorld::$db has unknown class Pdo\Mysql as its type.
7: Method HelloWorld::db() has invalid return type Pdo\Mysql.
9: Call to an undefined static method PDO::connect().
- 9: Property HelloWorld::$db (Pdo\Mysql) does not accept mixed.-10: Method HelloWorld::db() should return Pdo\Mysql but returns mixed.+ 9: Property HelloWorld::$db (Pdo\Mysql) does not accept mixed.
Full report
PHP 8.4 (1 error)
Line
Error
9
Property HelloWorld::$db (Pdo\Mysql) does not accept PDO.
PHP 7.2 – 8.3 (4 errors)
Line
Error
5
Property HelloWorld::$db has unknown class Pdo\Mysql as its type.
7
Method HelloWorld::db() has invalid return type Pdo\Mysql.
9
Call to an undefined static method PDO::connect().
9
Property HelloWorld::$db (Pdo\Mysql) does not accept mixed.
Feature request
Repro: https://phpstan.org/r/a737df77-1a70-4ef6-af8d-c3a605bf84cc
PHP 8.4 added PDO::connect static function which returns a PDO subclass for a specific driver
https://www.php.net/manual/en/pdo.connect.php
However the issue here, even if you added support for parsing the DSN string to get the correct subclass, I suspect most of them will be coming from configs/env, so it may not be available at analysis time.
Unsure what a good solution for this would be, for now I can manually narrow the type with a comment:
Did PHPStan help you today? Did it make you happy in any way?
No response
The text was updated successfully, but these errors were encountered: