Is there any difference between:
public function init(a_class_name $classObj)
and
public function init($classObj)
The difference being that example 1 specifies what kind of object I am getting. My question is more: does php still pass the object by reference (Default behavior) or is example 1 some weird shortcut to clone the object. I only ask because in more strict languages (C, Java) example 1 is quite straightforward (and the only example that would work). In PHP it is not as clear, and both methods are used in different places in the PHP docs.
Thanks.
That’s called a a type hint.
— http://php.net/manual/en/language.oop5.typehinting.php
In both cases (with and without a type hint) the object is passed by reference. That doesn’t change.