Skip to content

Commit ebb1d00

Browse files
authored
feature: remove construct from interfaces (#132)
For better SOLID patterns compliance (Liskov)
1 parent a7893cb commit ebb1d00

5 files changed

Lines changed: 6 additions & 23 deletions

File tree

‎CHANGELOG‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
4.0.0-rc.2 (unreleased):
2+
* Remove constructors from Interfaces (Liskov Substitution Principle violation)
3+
14
4.0.0-rc.1 (2025-12-15):
25
* BC PHP 8.0 dropped, minimum version is now PHP 8.1
36
* BC All classes now fully typehinted with strict types and return types

‎src/Ting/ConnectionPoolInterface.php‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030

3131
interface ConnectionPoolInterface
3232
{
33-
/**
34-
* @param DriverLoggerInterface $logger
35-
*/
36-
public function __construct(DriverLoggerInterface $logger);
37-
3833
public function setConfig(array $config): void;
3934

4035
/**

‎src/Ting/Driver/StatementInterface.php‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,6 @@
3131

3232
interface StatementInterface
3333
{
34-
/**
35-
* @param mysqli_stmt|Object $driverStatement
36-
* @param array $paramsOrder
37-
* @param string $connectionName
38-
* @param string $database
39-
*/
40-
public function __construct($driverStatement, array $paramsOrder, string $connectionName, string $database);
41-
4234
/**
4335
* @param array $params
4436
* @throws QueryException

‎src/Ting/Query/QueryInterface.php‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@
3434
*/
3535
interface QueryInterface
3636
{
37-
/**
38-
* @param string $sql
39-
* @param Connection $connection
40-
* @param CollectionFactoryInterface $collectionFactory
41-
*/
42-
public function __construct($sql, Connection $connection, ?CollectionFactoryInterface $collectionFactory = null);
43-
4437
/**
4538
* Execute a reading query (SELECT, SHOW, etc.)
4639
* @param CollectionInterface<T>|null $collection

‎tests/units/Ting/Repository/Metadata.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ public function testGenerateQueryForInsertShouldReturnAPreparedQuery()
693693
$mockConnection = new \mock\CCMBenchmark\Ting\Connection($mockConnectionPool, 'main', 'db');
694694

695695
$mockDriver = new \mock\tests\fixtures\FakeDriver\Driver();
696-
$mockStatement = new \mock\CCMBenchmark\Ting\Driver\StatementInterface(new \stdClass(), [], '', '');
696+
$mockStatement = new \mock\CCMBenchmark\Ting\Driver\StatementInterface();
697697
$this->calling($mockDriver)->prepare = $mockStatement;
698698
$this->calling($mockDriver)->execute = true;
699699
$this->calling($mockStatement)->execute = true;
@@ -960,7 +960,7 @@ public function testGenerateQueryForUpdateShouldReturnAPreparedQuery()
960960
{
961961
$mockConnectionPool = new \mock\CCMBenchmark\Ting\ConnectionPool();
962962
$mockDriver = new \mock\tests\fixtures\FakeDriver\Driver();
963-
$mockStatement = new \mock\CCMBenchmark\Ting\Driver\StatementInterface(new \stdClass(), [], '', '');
963+
$mockStatement = new \mock\CCMBenchmark\Ting\Driver\StatementInterface();
964964
$this->calling($mockDriver)->prepare = $mockStatement;
965965
$this->calling($mockDriver)->execute = true;
966966
$this->calling($mockStatement)->execute = true;
@@ -1018,7 +1018,7 @@ public function testGenerateQueryForDeleteShouldReturnAPreparedQuery()
10181018
{
10191019
$mockConnectionPool = new \mock\CCMBenchmark\Ting\ConnectionPool();
10201020
$mockDriver = new \mock\tests\fixtures\FakeDriver\Driver();
1021-
$mockStatement = new \mock\CCMBenchmark\Ting\Driver\StatementInterface(new \stdClass(), [], '', '');
1021+
$mockStatement = new \mock\CCMBenchmark\Ting\Driver\StatementInterface();
10221022
$this->calling($mockDriver)->prepare = $mockStatement;
10231023
$this->calling($mockDriver)->execute = true;
10241024
$this->calling($mockStatement)->execute = true;

0 commit comments

Comments
 (0)