Hello! I’ve been working on request introduced here https://bugs.php.net/bug.php?id=74957 <https://bugs.php.net/bug.php?id=74957> related to implementing new PDOInterface and PDOStatementInterfaces. At this point of time classes PDO and PDOStatement do not implement any interfaces that’s why code that uses PDO and PDOStatement are coupled and referred to concrete implementation , not interface.
It will help to add some custom classes and behavior to these classes and to decouple caller from details of PDO layer implementations. At this point of time, the only way to add some custom classes and behavior is to approach this is by subclassing PDO and PDOStatement. You can use the PDO:: ATTR_STATEMENT_CLASS driver option to tell a PDO object which PDOStatement subclass to return from PDO::prepare(). But this is is not very straightforward and elegant (in terms of coding) way to do this. But if PDO and PDOStatement implemented interfaces, it would be possible for the custom behaviour classes to implement those interfaces as well, making them interchangeable. No changes needed in callers of PDO/PDOStatement. Here is my PR introducing this interface https://github.com/php/php-src/pull/2657 <https://github.com/php/php-src/pull/2657> I would like to hear any feedback on it! Thanks!