Skip to content

Commit f334025

Browse files
authored
Merge pull request #3974 from greg0ire/remove-unneeded-and-risky-stubs-parsing
Remove unneeded and risky stubs parsing
2 parents 155d028 + c643ac3 commit f334025

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

lib/Doctrine/DBAL/Driver/OCI8/Driver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Doctrine\DBAL\DBALException;
66
use Doctrine\DBAL\Driver\AbstractOracleDriver;
7-
use const OCI_DEFAULT;
7+
use const OCI_NO_AUTO_COMMIT;
88

99
/**
1010
* A Doctrine DBAL driver for the Oracle OCI8 PHP extensions.
@@ -22,7 +22,7 @@ public function connect(array $params, $username = null, $password = null, array
2222
(string) $password,
2323
$this->_constructDsn($params),
2424
$params['charset'] ?? '',
25-
$params['sessionMode'] ?? OCI_DEFAULT,
25+
$params['sessionMode'] ?? OCI_NO_AUTO_COMMIT,
2626
$params['persistent'] ?? false
2727
);
2828
} catch (OCI8Exception $e) {

lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Doctrine\DBAL\ParameterType;
88
use UnexpectedValueException;
99
use const OCI_COMMIT_ON_SUCCESS;
10-
use const OCI_DEFAULT;
1110
use const OCI_NO_AUTO_COMMIT;
1211
use function addcslashes;
1312
use function func_get_args;
@@ -51,7 +50,7 @@ public function __construct(
5150
$password,
5251
$db,
5352
$charset = '',
54-
$sessionMode = OCI_DEFAULT,
53+
$sessionMode = OCI_NO_AUTO_COMMIT,
5554
$persistent = false
5655
) {
5756
$dbh = $persistent

phpstan.neon.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,8 @@ parameters:
7272
-
7373
message: '~^Cannot cast array<string>\|bool\|string\|null to int\.$~'
7474
path: %currentWorkingDirectory%/lib/Doctrine/DBAL/Tools/Console/Command/RunSqlCommand.php
75+
76+
# Requires a release of https://github.com/JetBrains/phpstorm-stubs/pull/732
77+
-
78+
message: '~^Access to undefined constant PDO::PGSQL_ATTR_DISABLE_PREPARES\.$~'
79+
path: %currentWorkingDirectory%/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php

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)