Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Typehint should be against the ConnectionInterface and not a Connecti…
…on object
  • Loading branch information
HavokInspiration committed Sep 25, 2015
1 parent 04e1875 commit 15e0ed0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/Database/Schema/CachedCollection.php
Expand Up @@ -15,7 +15,7 @@
namespace Cake\Database\Schema;

use Cake\Cache\Cache;
use Cake\Database\Connection;
use Cake\Datasource\ConnectionInterface;

/**
* Extends the schema collection class to provide caching
Expand All @@ -35,10 +35,10 @@ class CachedCollection extends Collection
/**
* Constructor.
*
* @param \Cake\Database\Connection $connection The connection instance.
* @param \Cake\Datasource\ConnectionInterface $connection The connection instance.
* @param string|bool $cacheKey The cache key or boolean false to disable caching.
*/
public function __construct(Connection $connection, $cacheKey = true)
public function __construct(ConnectionInterface $connection, $cacheKey = true)
{
parent::__construct($connection);
$this->cacheMetadata($cacheKey);
Expand Down
6 changes: 3 additions & 3 deletions src/Database/Schema/Collection.php
Expand Up @@ -14,8 +14,8 @@
*/
namespace Cake\Database\Schema;

use Cake\Database\Connection;
use Cake\Database\Exception;
use Cake\Datasource\ConnectionInterface;
use PDOException;

/**
Expand Down Expand Up @@ -44,9 +44,9 @@ class Collection
/**
* Constructor.
*
* @param \Cake\Database\Connection $connection The connection instance.
* @param \Cake\Datasource\ConnectionInterface $connection The connection instance.
*/
public function __construct(Connection $connection)
public function __construct(ConnectionInterface $connection)
{
$this->_connection = $connection;
$this->_dialect = $connection->driver()->schemaDialect();
Expand Down
14 changes: 7 additions & 7 deletions src/Database/Schema/Table.php
Expand Up @@ -14,9 +14,9 @@
*/
namespace Cake\Database\Schema;

use Cake\Database\Connection;
use Cake\Database\Exception;
use Cake\Database\Type;
use Cake\Datasource\ConnectionInterface;

/**
* Represents a single table in a database schema.
Expand Down Expand Up @@ -664,11 +664,11 @@ public function temporary($set = null)
* Uses the connection to access the schema dialect
* to generate platform specific SQL.
*
* @param Connection $connection The connection to generate SQL for
* @param \Cake\Datasource\ConnectionInterface $connection The connection to generate SQL for
* @return array List of SQL statements to create the table and the
* required indexes.
*/
public function createSql(Connection $connection)
public function createSql(ConnectionInterface $connection)
{
$dialect = $connection->driver()->schemaDialect();
$columns = $constraints = $indexes = [];
Expand All @@ -690,10 +690,10 @@ public function createSql(Connection $connection)
* Uses the connection to access the schema dialect to generate platform
* specific SQL.
*
* @param Connection $connection The connection to generate SQL for.
* @param \Cake\Datasource\ConnectionInterface $connection The connection to generate SQL for.
* @return array SQL to drop a table.
*/
public function dropSql(Connection $connection)
public function dropSql(ConnectionInterface $connection)
{
$dialect = $connection->driver()->schemaDialect();
return $dialect->dropTableSql($this);
Expand All @@ -702,10 +702,10 @@ public function dropSql(Connection $connection)
/**
* Generate the SQL statements to truncate a table
*
* @param Connection $connection The connection to generate SQL for.
* @param \Cake\Datasource\ConnectionInterface $connection The connection to generate SQL for.
* @return array SQL to drop a table.
*/
public function truncateSql(Connection $connection)
public function truncateSql(ConnectionInterface $connection)
{
$dialect = $connection->driver()->schemaDialect();
return $dialect->truncateTableSql($this);
Expand Down
8 changes: 4 additions & 4 deletions src/ORM/Table.php
Expand Up @@ -17,9 +17,9 @@
use ArrayObject;
use BadMethodCallException;
use Cake\Core\App;
use Cake\Database\Connection;
use Cake\Database\Schema\Table as Schema;
use Cake\Database\Type;
use Cake\Datasource\ConnectionInterface;
use Cake\Datasource\EntityInterface;
use Cake\Datasource\Exception\InvalidPrimaryKeyException;
use Cake\Datasource\RepositoryInterface;
Expand Down Expand Up @@ -389,10 +389,10 @@ public function registryAlias($registryAlias = null)
/**
* Returns the connection instance or sets a new one
*
* @param \Cake\Database\Connection|null $conn The new connection instance
* @return \Cake\Database\Connection
* @param \Cake\Datasource\ConnectionInterface|null $conn The new connection instance
* @return \Cake\Datasource\ConnectionInterface
*/
public function connection(Connection $conn = null)
public function connection(ConnectionInterface $conn = null)
{
if ($conn === null) {
return $this->_connection;
Expand Down

0 comments on commit 15e0ed0

Please sign in to comment.