<?php
use ProxyManager\Factory\NullObjectFactory;
class Foo
{
public function __construct()
{
throw new Exception('oops, something went wrong');
}
public function bar()
{
return 'bar';
}
}
try {
$foo = new Foo();
}
catch (Exception $e) {
$factory = new NullObjectFactory();
$foo = $factory->createProxy(Foo::CLASS);
}
dump($foo->bar());
^ null