src/File/ImageOptions.php
public function setFormat(string $format = \null)
    {
        $validValues = ['png', 'jpg', 'webp'];

        if (\null !== $format && !\in_array($format, $validValues, \true)) {
            throw new \InvalidArgumentException(\sprintf(
                'Unknown format "%s" given. Expected "%s" or null.',
                $format,
                \implode(', ', $validValues)
            ));
        }

        $this->format = $format;

        return $this;
    }
public function setFormat(string $format = \null)
    {
        $validValues = ['png', 'jpg', 'webp'];

        if (\null !== $format && !\in_array($format, $validValues, \true)) {
            throw new \InvalidArgumentException(\sprintf(
                'Unknown format "%s" given. Expected "%s" or null.',
                $format,
                \implode(', ', $validValues)
            ));
        }

        $this->format = $format;

        return $this;
    }
public function setFormat ( string $ format = \ null ) { $ validValues = [ 'png' , 'jpg' , 'webp' ] ; if ( \ null !== $ format && ! \ in_array ( $ format , $ validValues , \ true ) ) { throw new \ InvalidArgumentException ( \ sprintf ( 'Unknown format "%s" given. Expected "%s" or null.' , $ format , \ implode ( ', ' , $ validValues ) ) ) ; } $ this -> format = $ format ; return $ this ; }
Set the format of the image. Valid values are "png" and "jpg".
Can be set to null to not enforce a format.

@param string|null $format

@throws \InvalidArgumentException If $format is not a valid value

@return $this
Set the format of the image . Valid values are png and jpg . Can be set to null to not enforce a format .