> public function \Customer getCustomer(){
>  return $this->customer;
> }
> 
> If the $customer instance variable is not declared with the type Customer
> then first of all IDE will not be able to spot an error, second compiler may
> have a slighly harder time of detecting a mismatch.

The compiler does not even try to detect a mismatch; type hinting is
taken into account at run-time only. So whenever this function executes,
if it tries to return a value that is not a \Customer, a run-time error
will be reported.

-- 
Oleg
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to