Skip to content

Instantly share code, notes, and snippets.

@nahidulhasan
Last active June 29, 2018 19:47
Show Gist options
  • Save nahidulhasan/d12bcb4118ad52fbc40d3b195969ffc7 to your computer and use it in GitHub Desktop.
Save nahidulhasan/d12bcb4118ad52fbc40d3b195969ffc7 to your computer and use it in GitHub Desktop.
<?php
interface ConnectionInterface
{
public function connect();
}
class DbConnection implements ConnectionInterface
{
/**
* db connection
*/
public function connect()
{
var_dump('MYSQL Connection');
}
}
class PasswordReminder
{
/**
* @var MySQLConnection
*/
private $dbConnection;
public function __construct(ConnectionInterface $dbConnection)
{
$this->dbConnection = $dbConnection;
}
}
@larsbo
Copy link

larsbo commented Jun 29, 2018

In line 22 MySQLConnection should be replaced with ConnectionInterface, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment