public function updateJSON() { if ($this->package->getPrettyVersion() == $this->version) { /* Don't touch, it's the same. */ return; } $dumper = new Util\Dumper(); $composer_json = $this->package->getRootDir() . DIRECTORY_SEPARATOR . 'composer.json'; $this->package->replaceVersion((new VersionParser())->normalize($this->version), $this->version); $len = file_put_contents($composer_json, json_encode($dumper->dump($this->package), JSON_PRETTY_PRINT)); if (!$len) { throw new \Exception("Failed to update '{$package_json}'"); } }