Skip to content

Commit

Permalink
Fix mysql tests, phpcs and phpstan/psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Mar 13, 2024
1 parent 5e48c0e commit 005ca4e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
10 changes: 8 additions & 2 deletions src/Db/Adapter/AdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Migrations\Db\Adapter;

use Cake\Console\ConsoleIo;
use Cake\Database\Connection;
use Cake\Database\Query;
use Cake\Database\Query\DeleteQuery;
use Cake\Database\Query\InsertQuery;
Expand All @@ -21,8 +22,6 @@

/**
* Adapter Interface.
*
* @method \PDO getConnection()
*/
interface AdapterInterface
{
Expand Down Expand Up @@ -520,4 +519,11 @@ public function setIo(ConsoleIo $io);
* @return \Cake\Console\ConsoleIo $io The io instance to use
*/
public function getIo(): ?ConsoleIo;

/**
* Get the Connection for this adapter.
*
* @return \Cake\Database\Connection The connection
*/
public function getConnection(): Connection;
}
6 changes: 3 additions & 3 deletions src/Db/Adapter/AdapterWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Migrations\Db\Adapter;

use Cake\Console\ConsoleIo;
use Cake\Database\Connection;
use Cake\Database\Query;
use Cake\Database\Query\DeleteQuery;
use Cake\Database\Query\InsertQuery;
Expand All @@ -17,7 +18,6 @@
use Migrations\Db\Literal;
use Migrations\Db\Table\Column;
use Migrations\Db\Table\Table;
use PDO;
use Phinx\Migration\MigrationInterface;

/**
Expand Down Expand Up @@ -430,9 +430,9 @@ public function castToBool($value): mixed
}

/**
* @return \PDO
* @return \Cake\Database\Connection
*/
public function getConnection(): PDO
public function getConnection(): Connection
{
return $this->getAdapter()->getConnection();
}
Expand Down
14 changes: 11 additions & 3 deletions src/Db/Adapter/PhinxAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Migrations\Db\Adapter;

use Cake\Database\Connection;
use Cake\Database\Query;
use Cake\Database\Query\DeleteQuery;
use Cake\Database\Query\InsertQuery;
Expand All @@ -32,7 +33,6 @@
use Migrations\Db\Table\ForeignKey;
use Migrations\Db\Table\Index;
use Migrations\Db\Table\Table;
use PDO;
use Phinx\Db\Action\Action as PhinxAction;
use Phinx\Db\Action\AddColumn as PhinxAddColumn;
use Phinx\Db\Action\AddForeignKey as PhinxAddForeignKey;
Expand Down Expand Up @@ -747,9 +747,9 @@ public function castToBool($value): mixed
}

/**
* @return \PDO
* @return \Cake\Database\Connection
*/
public function getConnection(): PDO
public function getConnection(): Connection

Check warning on line 752 in src/Db/Adapter/PhinxAdapter.php

View check run for this annotation

Codecov / codecov/patch

src/Db/Adapter/PhinxAdapter.php#L752

Added line #L752 was not covered by tests
{
return $this->adapter->getConnection();
}
Expand Down Expand Up @@ -812,4 +812,12 @@ public function getDeleteBuilder(): DeleteQuery
{
return $this->adapter->getDeleteBuilder();
}

/**
* @inheritDoc
*/
public function getCakeConnection(): Connection
{
return $this->adapter->getConnection();
}
}

0 comments on commit 005ca4e

Please sign in to comment.