public static function set($key, $value): void
    {
        Assert::nullOrScalar($value, 'ini values must be scalar or null. Got: %s');

        $iniValue = $value === false ? '0' : (string) $value;

        $result = false;
        $ex = null;
        try {
            $result = Thrower::call('ini_set', $key, $iniValue);
        } catch (\Throwable $ex) {
        }

        if ($result === false || $ex !== null) {
            if (! static::has($key)) {
                throw new \RuntimeException(
                    "The ini option '${key}' does not exist. New ini options cannot be added.",
                    0,
                    $ex
                );
            }
            if (! static::$keys[$key]) {
                throw new \RuntimeException(
                    "Unable to change ini option '${key}', because it is not editable at runtime.",
                    0,
                    $ex
                );
            }

            $value = Assert::valueToString($value);
            throw new \RuntimeException(sprintf('Unable to change ini option "%s" to %s.', $key, $value), 0, $ex);
        }

        // HHVM sets values w/o error, but the change is not actually applied.
        if (ini_get($key) !== $iniValue) {
            $value = Assert::valueToString($value);
            throw new \RuntimeException(sprintf('Unable to change ini option "%s" to %s.', $key, $value), 0, $ex);
        }
    }
public static function set($key, $value): void
    {
        Assert::nullOrScalar($value, 'ini values must be scalar or null. Got: %s');

        $iniValue = $value === false ? '0' : (string) $value;

        $result = false;
        $ex = null;
        try {
            $result = Thrower::call('ini_set', $key, $iniValue);
        } catch (\Throwable $ex) {
        }

        if ($result === false || $ex !== null) {
            if (! static::has($key)) {
                throw new \RuntimeException(
                    "The ini option '${key}' does not exist. New ini options cannot be added.",
                    0,
                    $ex
                );
            }
            if (! static::$keys[$key]) {
                throw new \RuntimeException(
                    "Unable to change ini option '${key}', because it is not editable at runtime.",
                    0,
                    $ex
                );
            }

            $value = Assert::valueToString($value);
            throw new \RuntimeException(sprintf('Unable to change ini option "%s" to %s.', $key, $value), 0, $ex);
        }

        // HHVM sets values w/o error, but the change is not actually applied.
        if (ini_get($key) !== $iniValue) {
            $value = Assert::valueToString($value);
            throw new \RuntimeException(sprintf('Unable to change ini option "%s" to %s.', $key, $value), 0, $ex);
        }
    }
public static function set ( $ key , $ value ) : void { Assert :: nullOrScalar ( $ value , 'ini values must be scalar or null. Got: %s' ) ; $ iniValue = $ value === false ? '0' : ( string ) $ value ; $ result = false ; $ ex = null ; try { $ result = Thrower :: call ( 'ini_set' , $ key , $ iniValue ) ; } catch ( \ Throwable $ ex ) { } if ( $ result === false || $ ex !== null ) { if ( ! static :: has ( $ key ) ) { throw new \ RuntimeException ( "The ini option '${key}' does not exist. New ini options cannot be added." , 0 , $ ex ) ; } if ( ! static :: $ keys [ $ key ] ) { throw new \ RuntimeException ( "Unable to change ini option '${key}', because it is not editable at runtime." , 0 , $ ex ) ; } $ value = Assert :: valueToString ( $ value ) ; throw new \ RuntimeException ( sprintf ( 'Unable to change ini option "%s" to %s.' , $ key , $ value ) , 0 , $ ex ) ; } // HHVM sets values w/o error, but the change is not actually applied. if ( ini_get ( $ key ) !== $ iniValue ) { $ value = Assert :: valueToString ( $ value ) ; throw new \ RuntimeException ( sprintf ( 'Unable to change ini option "%s" to %s.' , $ key , $ value ) , 0 , $ ex ) ; } }
Set a new value for the given key.

@param string $key

@throws \InvalidArgumentException when the value is not scalar or null
@throws \RuntimeException         when the key does not exist, it is not editable, or some unknown reason
Set a new value for the given key .