code: private static function splitParams($paramStr)
      {
          $depth = 0;
          $startPos = 0;
          $chars = \str_split($paramStr);
          $params = array();
          foreach ($chars as $pos => $char) {
              switch ($char) {
                  case ',':
                      if ($depth === 0) {
                          $params[] = \trim(\substr($paramStr, $startPos, $pos-$startPos));
                          $startPos = $pos + 1;
                      }
                      break;
                  case '[':
                  case '(':
                      $depth ++;
                      break;
                  case ']':
                  case ')':
                      $depth --;
                      break;
              }
          }
          $params[] = \trim(\substr($paramStr, $startPos, $pos+1-$startPos));
          return $params;
      }
docs: Split parameter string into individual params
  
  @param string $paramStr parameter string
  
  @return string[]