X classı argüman olarak kabul ederek çalışabilen her method, X classın alt classlarınıda kabul edip çalışabilmelidirler. Kısacası bir alt class, çalışma prensibini bozmadan üst classın methodlarını çiğneyebilmelidir. Bir diğer açıklama biçimi ise, belirli bir interface ile bağlantılı olan bir class, uygulamanın çalışma prensibini bozmadan aynı interface ile bağlantılı olan diğer bir classın yerini alabilmelidir.


# VIOLATION
interface SportsInterface
{
public function pass(string $ball);
public function tackle(string $opponent);
}

class Footballer implements SportsInterface
{
public function pass(string $ball)
{
// Passing the $ball
}

public function tackle(string $opponent)
{
// Tackling the $opponent
}
}

class English extends Footballer implements SportsInterface
{
public function pass(string $ball)
{
// I am able to pass the $ball
}

public function tackle(string $opponent)
{
// I am able to tackle the $opponent
}
}

class Spanish extends Footballer implements SportsInterface
{
public function pass(string $ball)
{
// I am able to pass the $ball
}

public function tackle(string $opponent)
{
throw new Exception('Sorry, I am too nice to tackle my opponents.');
}
}

Yukarıda gördüğümüz gibi, Footballer class dikte ettiği için English ve Spanish futbolcuların hem pass, hem de tackle işlevini görebilmeleri mecburidir. Ama baktığımız zaman, Spanish futbolcuların tackle işlevini göremedikleri ortada. Bu da prensibe aykırı çünkü Footballer class tackle işlevini dikte ediyor.


# VIOLATION
class Outputer
{
private $computer;

public function __construct(ComputerInterface $computer)
{
$this->computer = $computer;
}

public function output()
{
return implode(',', $this->computer->getData());
}
}

interface ComputerInterface
{
public function getData();
}

class Terminal implements ComputerInterface
{
protected $data;

public function __construct($data)
{
$this->data = $data;
}

public function getData()
{
return $this->data;
}
}

class Browser extends Terminal
{
public function __construct($data)
{
parent::__construct($data);
}

public function getData()
{
return json_encode($this->data);
}
}

# This would work
$terminal = new Terminal(['Hello', 'World']);
$outputer = new Outputer($terminal);
echo $outputer->output();

# This would fail
$browser = new Browser(['Hello', 'World']);
$outputer = new Outputer($browser);
echo $outputer->output();

Bu da başka bir prensip aykırılığı örneği. Her ne kadar üst Terminal class veriyi array olarak geri vermeyi dikte etse de, alt Browser classın getData methodu veriyi JSON string olarak veriyor, ki bu da prensibe aykırıdır. Eğer: