private function updateServiceBuilder($version)
{
$path = $this->cliBasePath . '/../' . self::PATH_SERVICE_BUILDER;
if (!file_exists($path)) {
throw new RuntimeException('ServiceBuilder not found at ' . $path);
}
$sb = file_get_contents($path);
$replacement = sprintf("const VERSION = '%s';", $version);
$sb = preg_replace("/const VERSION = '[0-9.]{0,}'\\;/", $replacement, $sb);
$result = file_put_contents($path, $sb);
if (!$result) {
throw new RuntimeException('File write failed');
}
}