src/Update/Updater.php
public function writeComposerJson($contents) {
    // Ensure that require and require-dev are objects and not arrays.
    if (array_key_exists('require', $contents) && is_array($contents['require'])) {
      ksort($contents['require']);
      $contents['require'] = (object) $contents['require'];
    }
    if (array_key_exists('require-dev', $contents)&& is_array($contents['require-dev'])) {
      ksort($contents['require-dev']);
      $contents['require-dev'] = (object) $contents['require-dev'];
    }
    file_put_contents($this->composerJsonFilepath, json_encode($contents, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
  }
public function writeComposerJson($contents) {
    // Ensure that require and require-dev are objects and not arrays.
    if (array_key_exists('require', $contents) && is_array($contents['require'])) {
      ksort($contents['require']);
      $contents['require'] = (object) $contents['require'];
    }
    if (array_key_exists('require-dev', $contents)&& is_array($contents['require-dev'])) {
      ksort($contents['require-dev']);
      $contents['require-dev'] = (object) $contents['require-dev'];
    }
    file_put_contents($this->composerJsonFilepath, json_encode($contents, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
  }
public function writeComposerJson ( $ contents ) { // Ensure that require and require-dev are objects and not arrays. if ( array_key_exists ( 'require' , $ contents ) && is_array ( $ contents [ 'require' ] ) ) { ksort ( $ contents [ 'require' ] ) ; $ contents [ 'require' ] = ( object ) $ contents [ 'require' ] ; } if ( array_key_exists ( 'require-dev' , $ contents ) && is_array ( $ contents [ 'require-dev' ] ) ) { ksort ( $ contents [ 'require-dev' ] ) ; $ contents [ 'require-dev' ] = ( object ) $ contents [ 'require-dev' ] ; } file_put_contents ( $ this -> composerJsonFilepath , json_encode ( $ contents , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ) ; }
Writes an array to composer.json.

@param array $contents
The new contents of composer.json.
Writes an array to composer . json .