php_testability icon indicating copy to clipboard operation
php_testability copied to clipboard

Report Law of Demeter violation

Open edsonmedina opened this issue 11 years ago • 0 comments

These:

 $externalObj->subObject->method();
 $a = $externalObj->anotherObj->someproperty;

Violate the Law of Demeter.

But this:

$query->select('*')->from('table')->where('1=1');

Does not (methods instead of properties)

Also this:

$this->internalObj->getSomething();

Because it is an internal object.

edsonmedina avatar Jan 07 '15 12:01 edsonmedina