public function setMaxDepth(int $maxDepth) : void
    {
        if ($maxDepth < 0 || $maxDepth >= 0x7fffffff) { // max depth + 1 must not be greater than this limit
            throw new \InvalidArgumentException('Invalid max depth.');
        }

        $this->maxDepth = $maxDepth;
    }
public function setMaxDepth(int $maxDepth) : void
    {
        if ($maxDepth < 0 || $maxDepth >= 0x7fffffff) { // max depth + 1 must not be greater than this limit
            throw new \InvalidArgumentException('Invalid max depth.');
        }

        $this->maxDepth = $maxDepth;
    }
public function setMaxDepth ( int $ maxDepth ) : void { if ( $ maxDepth < 0 || $ maxDepth >= 0x7fffffff ) { // max depth + 1 must not be greater than this limit
 throw new \ InvalidArgumentException ( 'Invalid max depth.' ) ; } $ this -> maxDepth = $ maxDepth ; }
Sets the max recursion depth. Defaults to `512`.

Every nested array or object adds one level of recursion.
If the max depth is zero, only scalars can be encoded/decoded.

@param int $maxDepth

@return void

@throws \InvalidArgumentException If the max depth is out of range.
Sets the max recursion depth . Defaults to 512 .