Skip to content

Instantly share code, notes, and snippets.

<?php
// http://php.net/manual/en/language.oop5.typehinting.php says that type-hinted PHP parameter
// that has no default value set to null can't be null. But are you sure?
// First, register error handler which do nothing and return nothing (this is important!)
set_error_handler(function () {});
class SomeClass {}
function test(SomeClass $instance) {var_dump($instance);}