original_string: public static function fromString(string $time, string $tz = null): self
      {
          try {
              if (!isset($tz)) {
                  $tz = date_default_timezone_get();
              }
              return new static(
                  new \DateTimeImmutable($time, self::_createTimeZone($tz)));
          } catch (\Exception $e) {
              throw new \RuntimeException(
                  "Failed to create DateTime: " .
                  self::_getLastDateTimeImmutableErrorsStr(), 0, $e);
          }
      }
code: public static function fromString(string $time, string $tz = null): self
      {
          try {
              if (!isset($tz)) {
                  $tz = date_default_timezone_get();
              }
              return new static(
                  new \DateTimeImmutable($time, self::_createTimeZone($tz)));
          } catch (\Exception $e) {
              throw new \RuntimeException(
                  "Failed to create DateTime: " .
                  self::_getLastDateTimeImmutableErrorsStr(), 0, $e);
          }
      }
code_tokens: public static function fromString ( string $ time , string $ tz = null ) : self { try { if ( ! isset ( $ tz ) ) { $ tz = date_default_timezone_get ( ) ; } return new static ( new \ DateTimeImmutable ( $ time , self :: _createTimeZone ( $ tz ) ) ) ; } catch ( \ Exception $ e ) { throw new \ RuntimeException ( "Failed to create DateTime: " . self :: _getLastDateTimeImmutableErrorsStr ( ) , 0 , $ e ) ; } }
docstring: Initialize from datetime string.
  
  @link http://php.net/manual/en/datetime.formats.php
  @param string $time Time string
  @param string|null $tz Timezone, if null use default.
  @throws \RuntimeException
  @return self
docstring_tokens: Initialize from datetime string .