Please, help me with this basic OOP question. Here is a code example:
class A
{
public function foo(SomeClass $someClass) {
return $someClass->bar();
}
}
Passing $someclass
as as a function parameter is a Dependency Injection or not? And why it is so.
Consider it as an interview question. As for me, SomeClass
is a dependency of class A
, and it is being injected into method, so, it should be Dependency Injection
. But I have not found any proofs to support my opinion.
I have checked What is dependency injection? and there are just examples of constructor and setter injection, my example is different.