Skip to content

Commit 2fcd316

Browse files
committed
- Added vendor/autoload.php to PHPStan bootstrap configuration to ensure
all driver classes (Doctrine DBAL, MongoDB, Predis) are autoloadable during static analysis. - Prevents false "invalid return type" warnings in AdapterInterface::getDriver() even when drivers are installed via require-dev. - No functional code changes; development tooling update only.
1 parent 0f84c65 commit 2fcd316

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,14 @@
2727
}
2828
},
2929
"require-dev": {
30-
"phpunit/phpunit": "^10.0"
30+
"phpunit/phpunit": "^10.0",
31+
"phpstan/phpstan": "^1.11",
32+
"mongodb/mongodb": "^2.0",
33+
"predis/predis": "^2.3",
34+
"doctrine/dbal": "^4.3"
3135
},
3236
"scripts": {
33-
"test": "vendor/bin/phpunit --testdox"
37+
"test": "vendor/bin/phpunit --testdox",
38+
"analyse": "phpstan analyse src --level=max"
3439
}
3540
}

src/Contracts/Adapter/AdapterInterface.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,16 @@ public function disconnect(): void;
132132
* - Debugging
133133
* - Direct driver feature access
134134
*
135-
* @return \PDO|\Doctrine\DBAL\Connection|\MongoDB\Database|\Redis|\Predis\Client
136-
*
137135
* 🧪 **Example**
138136
* ```php
139137
* $driver = $adapter->getDriver();
140138
* var_dump(get_class($driver)); // e.g., Redis, PDO, MongoDB\Database
141139
* ```
140+
*
141+
* @return \PDO|\Doctrine\DBAL\Connection|\MongoDB\Database|\Redis|\Predis\Client
142+
*
143+
* @phpstan-return \PDO|\Doctrine\DBAL\Connection|\MongoDB\Database|\Redis|\Predis\Client
144+
* public function getDriver(): mixed;
142145
*/
143-
public function getDriver();
146+
public function getDriver(): mixed;
144147
}

0 commit comments

Comments
 (0)