original_string: public static function countMinDepth($potentialArray, $depth = 0)
      {
          // validation, must be positive int or 0
          if (!self::isLogicallyCastableToInt($depth)) {
              throw new InvalidArgumentException('Depth parameter must be non-negative integer');
          }
          if ($depth < 0) {
              throw new InvalidArgumentException('Depth parameter must be non-negative integer');
          }
  
          $return = $depth;
          if (is_array($potentialArray)) {
              $return++;
              $childrenDepths = array();
              foreach ($potentialArray as $element) {
                  $childrenDepths[] = self::countMinDepth($element, $return);
              }
              $return = empty($childrenDepths) ? $return : min($childrenDepths);
          }
  
          return $return;
      }
code: public static function countMinDepth($potentialArray, $depth = 0)
      {
          // validation, must be positive int or 0
          if (!self::isLogicallyCastableToInt($depth)) {
              throw new InvalidArgumentException('Depth parameter must be non-negative integer');
          }
          if ($depth < 0) {
              throw new InvalidArgumentException('Depth parameter must be non-negative integer');
          }
  
          $return = $depth;
          if (is_array($potentialArray)) {
              $return++;
              $childrenDepths = array();
              foreach ($potentialArray as $element) {
                  $childrenDepths[] = self::countMinDepth($element, $return);
              }
              $return = empty($childrenDepths) ? $return : min($childrenDepths);
          }
  
          return $return;
      }
code_tokens: public static function countMinDepth ( $ potentialArray , $ depth = 0 ) { // validation, must be positive int or 0 if ( ! self :: isLogicallyCastableToInt ( $ depth ) ) { throw new InvalidArgumentException ( 'Depth parameter must be non-negative integer' ) ; } if ( $ depth < 0 ) { throw new InvalidArgumentException ( 'Depth parameter must be non-negative integer' ) ; } $ return = $ depth ; if ( is_array ( $ potentialArray ) ) { $ return ++ ; $ childrenDepths = array ( ) ; foreach ( $ potentialArray as $ element ) { $ childrenDepths [ ] = self :: countMinDepth ( $ element , $ return ) ; } $ return = empty ( $ childrenDepths ) ? $ return : min ( $ childrenDepths ) ; } return $ return ; }
docstring: Counts maximum array depth
  
  @param mixed $potentialArray
  @param int   $depth
  
  @return int
  @throws InvalidArgumentException
docstring_tokens: Counts maximum array depth