@@ -31,9 +31,9 @@ class Database
31
31
/**
32
32
* Instance.
33
33
*
34
- * @var Driver
34
+ * @var Driver|null
35
35
*/
36
- private static $ instance = null ;
36
+ private static ? Driver $ instance = null ;
37
37
38
38
/**
39
39
* Database type.
@@ -44,13 +44,13 @@ class Database
44
44
/**
45
45
* @var Configuration
46
46
*/
47
- protected $ config ;
47
+ protected Configuration $ config ;
48
48
/**
49
49
* DROP TABLE statements.
50
50
*
51
51
* @var array
52
52
*/
53
- private $ dropTableStmts = [
53
+ private array $ dropTableStmts = [
54
54
'DROP TABLE %sfaqadminlog ' ,
55
55
'DROP TABLE %sfaqattachment ' ,
56
56
'DROP TABLE %sfaqattachment_file ' ,
@@ -102,12 +102,11 @@ private function __construct(Configuration $config)
102
102
* Database factory.
103
103
*
104
104
* @param Configuration $config phpMyFAQ configuration container
105
- * @param string $type Database management system type
106
- *
107
- * @return Driver
105
+ * @param string $type Database management system type
106
+ * @return Driver|null
108
107
* @throws Exception
109
108
*/
110
- public static function factory (Configuration $ config , $ type )
109
+ public static function factory (Configuration $ config , string $ type ): ? Driver
111
110
{
112
111
self ::$ dbType = $ type ;
113
112
@@ -125,9 +124,9 @@ public static function factory(Configuration $config, $type)
125
124
/**
126
125
* Returns the single instance.
127
126
*
128
- * @return Driver
127
+ * @return Driver|null
129
128
*/
130
- public static function getInstance ()
129
+ public static function getInstance (): ? Driver
131
130
{
132
131
if (null === self ::$ instance ) {
133
132
$ className = __CLASS__ ;
@@ -141,10 +140,9 @@ public static function getInstance()
141
140
* Executes all DROP TABLE statements.
142
141
*
143
142
* @param string $prefix
144
- *
145
143
* @return bool
146
144
*/
147
- public function dropTables ($ prefix = '' )
145
+ public function dropTables (string $ prefix = '' ): bool
148
146
{
149
147
foreach ($ this ->dropTableStmts as $ stmt ) {
150
148
$ result = $ this ->config ->getDb ()->query (sprintf ($ stmt , $ prefix ));
0 commit comments