@@ -49,6 +49,8 @@ class Database extends \SimpleSAML\Module\consent\Store
4949
5050 /**
5151 * Options for the database;
52+ *
53+ * @var array<mixed>
5254 */
5355 private array $ options = [];
5456
@@ -77,7 +79,7 @@ class Database extends \SimpleSAML\Module\consent\Store
7779 *
7880 * This constructor parses the configuration.
7981 *
80- * @param array $config Configuration for database consent store.
82+ * @param array<mixed> $config Configuration for database consent store.
8183 *
8284 * @throws \Exception in case of a configuration error.
8385 */
@@ -139,7 +141,7 @@ public function __construct(array $config)
139141 /**
140142 * Called before serialization.
141143 *
142- * @return array The variables which should be serialized.
144+ * @return string[] The variables which should be serialized.
143145 */
144146 public function __sleep (): array
145147 {
@@ -303,7 +305,7 @@ public function deleteAllConsents(string $userId): int
303305 *
304306 * @param string $userId The hash identifying the user at an IdP.
305307 *
306- * @return array Array of all destination ids the user has given consent for.
308+ * @return string[] Array of all destination ids the user has given consent for.
307309 */
308310 public function getConsents (string $ userId ): array
309311 {
@@ -334,16 +336,13 @@ public function getConsents(string $userId): array
334336 * returned.
335337 *
336338 * @param string $statement The statement which should be executed.
337- * @param array $parameters Parameters for the statement.
339+ * @param array<mixed> $parameters Parameters for the statement.
338340 *
339341 * @return \PDOStatement|false The statement, or false if execution failed.
340342 */
341343 private function execute (string $ statement , array $ parameters )
342344 {
343345 $ db = $ this ->getDB ();
344- if ($ db === false ) {
345- return false ;
346- }
347346
348347 $ st = $ db ->prepare ($ statement );
349348 if ($ st === false ) {
@@ -374,7 +373,7 @@ private function execute(string $statement, array $parameters)
374373 * - users: Total number of uses that have given consent
375374 * ' services: Total number of services that has been given consent to
376375 *
377- * @return array Array containing the statistics
376+ * @return array<mixed> Array containing the statistics
378377 */
379378 public function getStatistics (): array
380379 {
@@ -427,9 +426,9 @@ public function getStatistics(): array
427426 /**
428427 * Get database handle.
429428 *
430- * @return \PDO|false Database handle, or false if we fail to connect.
429+ * @return \PDO Database handle, or false if we fail to connect.
431430 */
432- private function getDB ()
431+ private function getDB (): PDO
433432 {
434433 if ($ this ->db !== null ) {
435434 return $ this ->db ;
@@ -439,6 +438,7 @@ private function getDB()
439438 if (isset ($ this ->timeout )) {
440439 $ driver_options [PDO ::ATTR_TIMEOUT ] = $ this ->timeout ;
441440 }
441+
442442 if (!empty ($ this ->options )) {
443443 $ this ->options = array_merge ($ driver_options , $ this ->options );
444444 } else {
@@ -456,7 +456,7 @@ private function getDB()
456456 *
457457 * This function formats a PDO error, as returned from errorInfo.
458458 *
459- * @param array $error The error information.
459+ * @param string[] $error The error information.
460460 *
461461 * @return string Error text.
462462 */
0 commit comments