src/Codec/DecodingList.php
public function when(bool $test, $decodings): self
    {
        if (!$test) {
            return $this;
        }

        if ($decodings instanceof \Closure) {
            return $decodings($this);
        }

        $decodings = $decodings instanceof Decoding ? [$decodings] : $decodings;

        return $this->push(...$decodings);
    }
public function when(bool $test, $decodings): self
    {
        if (!$test) {
            return $this;
        }

        if ($decodings instanceof \Closure) {
            return $decodings($this);
        }

        $decodings = $decodings instanceof Decoding ? [$decodings] : $decodings;

        return $this->push(...$decodings);
    }
Push decodings if the truth test evaluates to true.

@param bool $test
@param Decoding|iterable|\Closure $decodings
@return DecodingList