xref: /web-bugs/src/Database/Statement.php (revision 4792d120)
1<?php
2
3namespace App\Database;
4
5/**
6 * PDOStatement wrapper class.
7 */
8class Statement extends \PDOStatement
9{
10    /**
11     * This allows chaining execute() method:
12     *   $db->query('SELECT a FROM b WHERE c = ?')->execute('foo')->fetch();
13     * \PDOStatement::execute(), on the other hand, returns boolean. Change it
14     * to return $this and thus allow further method chaining.
15     */
16    #[\ReturnTypeWillChange]
17    public function execute($parameters = null): self
18    {
19        parent::execute($parameters);
20
21        return $this;
22    }
23}
24