Skip to content
Permalink
Browse files

Typehint should be against the ConnectionInterface and not a Connecti…

…on object
  • Loading branch information...
HavokInspiration committed Sep 25, 2015
1 parent 04e1875 commit 15e0ed017fd474eedb305c334d8e4396709da5e0
@@ -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
@@ -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);
@@ -14,8 +14,8 @@
*/
namespace Cake\Database\Schema;
use Cake\Database\Connection;
use Cake\Database\Exception;
use Cake\Datasource\ConnectionInterface;
use PDOException;
/**
@@ -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();
@@ -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.
@@ -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 = [];
@@ -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);
@@ -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);
@@ -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;
@@ -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;

0 comments on commit 15e0ed0

Please sign in to comment.
You can’t perform that action at this time.