- assert: documentation ( source)
<?php
class ToStringTest {
function toString() {
echo 'toString';
throw new Exception('error');
}
function __toString() {
try {
$this->toString();
}
catch (\Exception $e) {
assert(false);
}
}
}
$test = new ToStringTest;
$test = (string) $test;