BadReturn.php

<?php

namespace Lia\Exception;

class BadReturn extends Base {

    public function __construct($expectedType, $actualValue, $errorWith){
        $type = gettype($actualValue);
        $trace = $this->getTrace();
        $class = $trace[0]['class'];
        $func = $trace[0]['function'];

        $message = "A '{$type}' was returned from '{$errorWith}' instead of a '{$expectedType}'.\n";

        parent::__construct($message);
    }
}