Defensive Development is a programming practice that is frequently misunderstood, but is nevertheless a critical practice to follow when working in many environments. I have seen articles written that argue that defensive development simply causes nonsensical null checks to be written, and as a result of seeing people writing bad code defensively, argues that no one should practice defensive development. There are other articles that, like many things in software development, argue that you should always use defensive development for everything.
Once you determine that the parameter passed to your function is not of the correct type, you should immediately signal a failure condition for your site/application to handle the failure in a user-friendly manner. The idea is to figure out that a failue condition exists as quickly as possible and then ensure that you can properly respond to it.
In addition to checking that parameters to functions are valid, you should also check the response values from outside functions that are called to ensure that you get sane return values.