Re: Passing null for a class-typed argument renders catchable error ?!?



..oO(Peter Pei)

buggy. inconsistent lang design

Wrong. It's not inconsistent, it's just not properly documented.
The behaviour is perfectly logical and quite useful if you know it:

public function foo(TBar $obj) {}

=> You must pass a TBar object.

public function foo(TBar $obj = NULL) {}

=> The parameter is optional, but if you pass something, it must be an
object of class TBar.

That's how I want it.

Micha

PS: Please learn to quote properly. Your posting alone taken out of
context is meaningless.
.



Relevant Pages