original_string: protected function tryDumpList(array $input, int $outerLineLength, int $level): ?string
      {
          if ($level > $this->listDepthLimit) {
              return null;
          }
  
          $dump = '[';
          $total_length = $outerLineLength + 1;
  
          $index = 0;
          foreach ($input as $key => $value) {
              if ($key !== $index) {
                  return null;
              }
  
              if ($index > 0) {
                  $dump .= ', ';
                  $total_length += 2;
              }
  
              if ($total_length >= $this->lineLength) {
                  return null;
              }
  
              ++$index;
  
              if (\is_array($value)) {
                  $value_dump = $this->tryDumpList($value, $total_length, $level + 1);
                  if (null === $value_dump) {
                      return null;
                  }
              } else {
                  $value_dump = $this->dumpValue($value);
              }
  
              $total_length += StringHelper::lengthUtf8($value_dump);
              if ($total_length >= $this->lineLength) {
                  return null;
              }
  
              $dump .= $value_dump;
          }
  
          $total_length += 1;
          if ($total_length > $this->lineLength) {
              return null;
          }
  
          $dump .= ']';
          return $dump;
      }
code: protected function tryDumpList(array $input, int $outerLineLength, int $level): ?string
      {
          if ($level > $this->listDepthLimit) {
              return null;
          }
  
          $dump = '[';
          $total_length = $outerLineLength + 1;
  
          $index = 0;
          foreach ($input as $key => $value) {
              if ($key !== $index) {
                  return null;
              }
  
              if ($index > 0) {
                  $dump .= ', ';
                  $total_length += 2;
              }
  
              if ($total_length >= $this->lineLength) {
                  return null;
              }
  
              ++$index;
  
              if (\is_array($value)) {
                  $value_dump = $this->tryDumpList($value, $total_length, $level + 1);
                  if (null === $value_dump) {
                      return null;
                  }
              } else {
                  $value_dump = $this->dumpValue($value);
              }
  
              $total_length += StringHelper::lengthUtf8($value_dump);
              if ($total_length >= $this->lineLength) {
                  return null;
              }
  
              $dump .= $value_dump;
          }
  
          $total_length += 1;
          if ($total_length > $this->lineLength) {
              return null;
          }
  
          $dump .= ']';
          return $dump;
      }
code_tokens: protected function tryDumpList ( array $ input , int $ outerLineLength , int $ level ) : ? string { if ( $ level > $ this -> listDepthLimit ) { return null ; } $ dump = '[' ; $ total_length = $ outerLineLength + 1 ; $ index = 0 ; foreach ( $ input as $ key => $ value ) { if ( $ key !== $ index ) { return null ; } if ( $ index > 0 ) { $ dump .= ', ' ; $ total_length += 2 ; } if ( $ total_length >= $ this -> lineLength ) { return null ; } ++ $ index ; if ( \ is_array ( $ value ) ) { $ value_dump = $ this -> tryDumpList ( $ value , $ total_length , $ level + 1 ) ; if ( null === $ value_dump ) { return null ; } } else { $ value_dump = $ this -> dumpValue ( $ value ) ; } $ total_length += StringHelper :: lengthUtf8 ( $ value_dump ) ; if ( $ total_length >= $ this -> lineLength ) { return null ; } $ dump .= $ value_dump ; } $ total_length += 1 ; if ( $ total_length > $ this -> lineLength ) { return null ; } $ dump .= ']' ; return $ dump ; }
docstring: Dump list if possible
  
  @param array $input Input array
  @param int $outerLineLength Known line length outside of expected dump
  @param int $level Nesting lists level starting from 1.
  @return string|null PHP code in case of success. A `null` when one-line dump is not possible
  @throws \InvalidArgumentException In case of unsupported data type
docstring_tokens: Dump list if possible