Skip to content

Commit c643ac3

Browse files
committed
Remove unneeded and risky stub parsing
PHPStan already reads these stubs, but in a controlled and safe why. It does not seem to read global constants yet, which is why we define OCI_NO_AUTO_COMMIT if undefined. Might be unneeded in the future too.
1 parent 30430ef commit c643ac3

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

tests/phpstan-polyfill.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22

33
declare(strict_types=1);
44

5-
(static function () : void {
6-
foreach (['ibm_db2', 'mysqli', 'oci8', 'sqlsrv', 'pgsql'] as $extension) {
7-
if (extension_loaded($extension)) {
8-
continue;
9-
}
5+
// PHPStan does not read global constants from the stubs yet, remove this when it does
6+
if (defined('OCI_NO_AUTO_COMMIT')) {
7+
return;
8+
}
109

11-
require sprintf(__DIR__ . '/../vendor/jetbrains/phpstorm-stubs/%1$s/%1$s.php', $extension);
12-
}
13-
})();
10+
define('OCI_NO_AUTO_COMMIT', 0);

0 commit comments

Comments
 (0)