1 | <?php |
||
14 | class PdoDatabaseObject |
||
15 | { |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $db_table_name; |
||
20 | |||
21 | /** |
||
22 | * @var \PDO |
||
23 | */ |
||
24 | protected $pdo; |
||
25 | |||
26 | /** |
||
27 | * @var bool |
||
28 | */ |
||
29 | protected $is_initialised = FALSE; |
||
30 | |||
31 | /** |
||
32 | * @param \PDO $pdo |
||
33 | * @param string $db_table_name |
||
34 | */ |
||
35 | public function __construct(\PDO $pdo, $db_table_name) |
||
40 | |||
41 | protected function init() |
||
48 | |||
49 | /** |
||
50 | * @return string |
||
51 | */ |
||
52 | public function get_db_table_name() |
||
56 | |||
57 | /** |
||
58 | * @param string $sql |
||
59 | * @param mixed[] $params |
||
60 | * |
||
61 | * @return \PDOStatement |
||
62 | */ |
||
63 | public function execute($sql, $params) |
||
76 | |||
77 | /** |
||
78 | * @param string $sql |
||
79 | * @param mixed[] $params |
||
80 | * |
||
81 | * @return string[]|object|false |
||
|
|||
82 | */ |
||
83 | public function fetch_all($sql, $params) |
||
90 | |||
91 | } |
||
92 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.If the return type contains the type array, this check recommends the use of a more specific type like
String[]
orarray<String>
.