Skip to content

Commit a157df6

Browse files
committed
Update Statement::prepare() signature.
Signed-off-by: Joey Smith <jsmith@webinertia.net> Signed-off-by: Joey Smith <jsmith@webinertia.net>
1 parent 8b7011e commit a157df6

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

src/DatabasePlatformNameTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Laminas\Db\Mysql\Driver;
5+
namespace Laminas\Db\Adapter\Mysql;
66

77
trait DatabasePlatformNameTrait
88
{

src/Driver/Mysqli/Mysqli.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ public function createStatement($sqlOrResource = null)
173173
{
174174
/**
175175
* @todo Resource tracking
176-
if (is_resource($sqlOrResource) && !in_array($sqlOrResource, $this->resources, true)) {
177-
$this->resources[] = $sqlOrResource;
178-
}
179-
*/
176+
* if (is_resource($sqlOrResource) && !in_array($sqlOrResource, $this->resources, true)) {
177+
* $this->resources[] = $sqlOrResource;
178+
*}
179+
*/
180180

181181
$statement = clone $this->statementPrototype;
182182
if ($sqlOrResource instanceof mysqli_stmt) {

src/Driver/Mysqli/Statement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function isPrepared()
176176
* @throws Exception\InvalidQueryException
177177
* @throws Exception\RuntimeException
178178
*/
179-
public function prepare($sql = null)
179+
public function prepare(?string $sql = null): self
180180
{
181181
if ($this->isPrepared) {
182182
throw new Exception\RuntimeException('This statement has already been prepared');

src/Driver/Pdo/Statement.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function getParameterContainer()
146146
* @param string $sql
147147
* @throws Exception\RuntimeException
148148
*/
149-
public function prepare($sql = null)
149+
public function prepare(?string $sql = null): ?self
150150
{
151151
if ($this->isPrepared) {
152152
throw new Exception\RuntimeException('This statement has been prepared already');
@@ -164,6 +164,8 @@ public function prepare($sql = null)
164164
}
165165

166166
$this->isPrepared = true;
167+
// todo: why does this not return $this like mysqli?
168+
return $this;
167169
}
168170

169171
/**

0 commit comments

Comments
 (0)