It will inspect the exception stack trace and automatically set the exception message to include the function name that threw the exception.

Example:

 function myFunction($str) {
     if (empty($str)) {
         throw new \MD\Foundation\Exceptions\InvalidArgumentException('non-empty string', $str);
     }
 }

 try {
     myFunction('');
 } catch(\InvalidArgumentException $e) {
     echo $e->getMessage();
     // -> myFunction expected argument 1 to be non-empty string, string ("") given.
 }

Methods This class defines the following methods:

__construct (string $expected, mixed $actual, int $number = 1, bool $hideCaller = false)

Constructor.

Arguments:
string $expected

Expected type.

mixed $actual

Actual argument given.

int $number

[optional] Argument number.

bool $hideCaller

[optional] Should the function that has thrown this exception be hidden? Default: false.