public function replaceIf($key, $oldValue, $newValue): bool
    {
        if ($this->get($key) === $oldValue) {
            $this[$key] = $newValue;

            return true;
        }

        return false;
    }
public function replaceIf($key, $oldValue, $newValue): bool
    {
        if ($this->get($key) === $oldValue) {
            $this[$key] = $newValue;

            return true;
        }

        return false;
    }
public function replaceIf ( $ key , $ oldValue , $ newValue ) : bool { if ( $ this -> get ( $ key ) === $ oldValue ) { $ this [ $ key ] = $ newValue ; return true ; } return false ; }
Replaces the entry for the specified key only if currently mapped to the
specified value.

This performs a strict type check on the value.

@param mixed $key The key to remove from the map.
@param mixed $oldValue The value to match.
@param mixed $newValue The value to use as a replacement.

@return bool true if the value was replaced.
Replaces the entry for the specified key only if currently mapped to the specified value .