From 3bc100c9a0540593ecd32313e8a0d98e2aff4b9c Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 27 Dec 2022 14:08:46 +0100 Subject: [PATCH] [ticket/16955] Add stubs for oci8, pgsql, and sqlite3 PHPBB3-16955 --- build/psalm/stubs/oci8/oci8.php | 19 ++++++++++++++++ build/psalm/stubs/pgsql/pgsql.php | 15 +++++++++++++ build/psalm/stubs/sqlite3/sqlite3.php | 32 +++++++++++++++++++++++++++ build/psalm_bootstrap.php | 4 ++++ psalm.xml | 6 +++++ 5 files changed, 76 insertions(+) create mode 100644 build/psalm/stubs/oci8/oci8.php create mode 100644 build/psalm/stubs/pgsql/pgsql.php create mode 100644 build/psalm/stubs/sqlite3/sqlite3.php diff --git a/build/psalm/stubs/oci8/oci8.php b/build/psalm/stubs/oci8/oci8.php new file mode 100644 index 0000000000..5d05a36fce --- /dev/null +++ b/build/psalm/stubs/oci8/oci8.php @@ -0,0 +1,19 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** @link https://php.net/manual/en/oci8.constants.php */ +define('OCI_DEFAULT', 0); + +define('OCI_ASSOC', 1); + +define('OCI_RETURN_NULLS', 4); diff --git a/build/psalm/stubs/pgsql/pgsql.php b/build/psalm/stubs/pgsql/pgsql.php new file mode 100644 index 0000000000..a00b21e46e --- /dev/null +++ b/build/psalm/stubs/pgsql/pgsql.php @@ -0,0 +1,15 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** @link https://www.php.net/manual/en/pgsql.constants.php */ +define('PGSQL_CONNECT_FORCE_NEW', 2); diff --git a/build/psalm/stubs/sqlite3/sqlite3.php b/build/psalm/stubs/sqlite3/sqlite3.php new file mode 100644 index 0000000000..a102b39fca --- /dev/null +++ b/build/psalm/stubs/sqlite3/sqlite3.php @@ -0,0 +1,32 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ +class SQLite3 +{ + public function query(string $query) {} +} + +class SQLite3Result +{ + public function fetchArray(int $mode = SQLITE3_BOTH) {} +} + +/** + * @link https://www.php.net/manual/en/sqlite3.constants.php + */ +define('SQLITE3_ASSOC', 1); +define('SQLITE3_NUM', 2); +define('SQLITE3_BOTH', 3); + +define('SQLITE3_OPEN_READONLY', 1); +define('SQLITE3_OPEN_READWRITE', 2); +define('SQLITE3_OPEN_CREATE', 4); diff --git a/build/psalm_bootstrap.php b/build/psalm_bootstrap.php index 4fc5628459..cea4bc64be 100644 --- a/build/psalm_bootstrap.php +++ b/build/psalm_bootstrap.php @@ -23,6 +23,7 @@ require_once $phpbb_root_path . 'includes/startup.php'; $table_prefix = 'phpbb_'; require_once $phpbb_root_path . 'includes/constants.php'; require_once $phpbb_root_path . 'phpbb/class_loader.' . $phpEx; +require_once $phpbb_root_path . 'includes/acp/acp_database.' . $phpEx; require_once $phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx; require_once $phpbb_root_path . 'includes/functions.' . $phpEx; require_once $phpbb_root_path . 'includes/functions_acp.' . $phpEx; @@ -46,6 +47,9 @@ require_once $phpbb_root_path . 'includes/compatibility_globals.' . $phpEx; $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', $phpbb_root_path . 'phpbb/', "php"); $phpbb_class_loader->register(); +// Include files that require class loader to be initialized +require_once $phpbb_root_path . 'includes/acp/auth.' . $phpEx; + class phpbb_cache_container extends \Symfony\Component\DependencyInjection\Container { } diff --git a/psalm.xml b/psalm.xml index 02160bcadf..0fbf33cdef 100644 --- a/psalm.xml +++ b/psalm.xml @@ -20,4 +20,10 @@ + + + + + +