1 | <?php |
||
17 | abstract class StatementAbstract implements StatementInterface{ |
||
18 | |||
19 | /** |
||
20 | * @var \chillerlan\Database\Drivers\DBDriverInterface |
||
21 | */ |
||
22 | protected $DBDriver; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $dialect; |
||
28 | |||
29 | /** |
||
30 | * @var \string[] |
||
31 | */ |
||
32 | protected $quotes; |
||
33 | |||
34 | /** |
||
35 | * @var int |
||
36 | */ |
||
37 | protected $limit; |
||
38 | |||
39 | /** |
||
40 | * @var int |
||
41 | */ |
||
42 | protected $offset; |
||
43 | |||
44 | /** |
||
45 | * @var array |
||
46 | */ |
||
47 | protected $bindValues = []; |
||
48 | |||
49 | /** |
||
50 | * @var bool |
||
51 | */ |
||
52 | protected $offsetlimit_bound = false; |
||
53 | |||
54 | /** |
||
55 | * @var bool |
||
56 | */ |
||
57 | protected $multi = false; |
||
58 | |||
59 | /** |
||
60 | * StatementAbstract constructor. |
||
61 | * |
||
62 | * @param \chillerlan\Database\Drivers\DBDriverInterface $DBDriver |
||
63 | * @param string $dialect |
||
64 | */ |
||
65 | public function __construct(DBDriverInterface $DBDriver, string $dialect){ |
||
70 | |||
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | public function sql():string { |
||
77 | |||
78 | /** |
||
79 | * @return array |
||
80 | */ |
||
81 | public function bindValues():array{ |
||
97 | |||
98 | /** |
||
99 | * @param string|null $index |
||
100 | * @param array|null $values |
||
101 | * @param callable|null $callback |
||
102 | * |
||
103 | * @return bool|\chillerlan\Database\DBResult |
||
104 | */ |
||
105 | public function execute(string $index = null, array $values = null, $callback = null){ |
||
106 | |||
107 | return $this->multi || !is_null($values) |
||
108 | ? is_callable($callback) |
||
109 | ? $this->DBDriver->multi_callback($this->sql(), $values, $callback) |
||
110 | : $this->DBDriver->multi($this->sql(), !empty($values) ? $values : $this->bindValues()) |
||
111 | : $this->DBDriver->prepared($this->sql(), $this->bindValues(), $index); |
||
112 | |||
113 | } |
||
114 | |||
115 | /** |
||
116 | * @param string $str |
||
117 | * @todo ... |
||
118 | * @return string |
||
119 | */ |
||
120 | protected function quote(string $str):string{ |
||
126 | |||
127 | /** |
||
128 | * @param string $name |
||
129 | * |
||
130 | * @return mixed |
||
131 | */ |
||
132 | protected function getStatementClass(string $name){ |
||
137 | |||
138 | } |
||
139 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: