dev/src/ComponentVersionTrait.php
private function updateComposerReplacesVersion($version, array $component)
    {
        $composer = $this->rootPath() .'/composer.json';
        if (!file_exists($composer)) {
            throw new \Exception('Invalid composer.json path');
        }

        $data = json_decode(file_get_contents($composer), true);

        $data['replace'][$component['name']] = $version;

        file_put_contents($composer, json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));
    }
private function updateComposerReplacesVersion($version, array $component)
    {
        $composer = $this->rootPath() .'/composer.json';
        if (!file_exists($composer)) {
            throw new \Exception('Invalid composer.json path');
        }

        $data = json_decode(file_get_contents($composer), true);

        $data['replace'][$component['name']] = $version;

        file_put_contents($composer, json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));
    }
private function updateComposerReplacesVersion ( $ version , array $ component ) { $ composer = $ this -> rootPath ( ) . '/composer.json' ; if ( ! file_exists ( $ composer ) ) { throw new \ Exception ( 'Invalid composer.json path' ) ; } $ data = json_decode ( file_get_contents ( $ composer ) , true ) ; $ data [ 'replace' ] [ $ component [ 'name' ] ] = $ version ; file_put_contents ( $ composer , json_encode ( $ data , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ) ; }
Update the `replaces` version in the main composer.json file.

@param string $version The new version. (do not prefix with `v`).
@param array $component The component data as an array.
@return void
Update the replaces version in the main composer . json file .