/**
  * creates a new exception about unreachable code that has, in fact,
  * been executed
  *
  * @return UnreachableCodeExecuted
  */
 public static function newAlert()
 {
     // build the basics
     list($message, $exceptionData) = BuildThrownBy::from("unreachable code executed", debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), [self::class, static::class, UnreachableCode::class]);
     return new static($message, $exceptionData);
 }
 /**
  * @covers ::from
  */
 public function test_will_return_thrower_in_data_block()
 {
     // ----------------------------------------------------------------
     // setup your test
     $message = "'%fieldOrVarName\$s' cannot be NULL";
     $expectedData = ['thrownBy' => new CodeCaller(__CLASS__, __FUNCTION__, '->', __FILE__, __LINE__ + 12), 'thrownByName' => __CLASS__ . '->' . __FUNCTION__ . '()@' . (__LINE__ + 11)];
     // ----------------------------------------------------------------
     // perform the change
     //
     // to correctly simulate getting a backtrace inside an exception's
     // factory method, we need to call something that will get the
     // backtrace for us
     $backtraceFn = function () {
         return debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
     };
     $backtrace = $backtraceFn();
     list($actualMessage, $actualData) = BuildThrownBy::from($message, $backtrace);
     // ----------------------------------------------------------------
     // test the results
     $this->assertEquals($expectedData, $actualData);
 }