// Traditional PHAR invocation: `php path/to/dw.phar`.
// Reject when the phar lives under a composer vendor/ tree —
// composer owns that file.
if ($pharResolved !== '' && self::looksLikePhar($pharResolved)) {
if (self::isInsideVendor($pharResolved)) {
returnnewself(
kind: self::KIND_COMPOSER_VENDOR,
path: $pharResolved,
upgradeable: false,
assetName: $asset,
reason: 'dw is installed as a Composer dependency. Update it with the package manager that owns this vendor tree, or reinstall a pinned public release with install.sh.',
);
}
returnnewself(
kind: self::KIND_PHAR,
path: $pharResolved,
upgradeable: false,
assetName: $asset,
reason: 'dw is running as a PHAR archive. Download the matching PHAR manually from the release page; `dw upgrade` only replaces standalone binaries.',
);
}
if ($resolved === '') {
returnnewself(
kind: self::KIND_UNKNOWN,
path: '',
upgradeable: false,
assetName: $asset,
reason: 'could not resolve the dw executable path',
);
}
if (self::isInsideVendor($resolved)) {
returnnewself(
kind: self::KIND_COMPOSER_VENDOR,
path: $resolved,
upgradeable: false,
assetName: $asset,
reason: 'dw is installed as a Composer dependency. Update it with the package manager that owns this vendor tree, or reinstall a pinned public release with install.sh.',
);
}
if (self::isInsideHomebrew($resolved)) {
returnnewself(
kind: self::KIND_HOMEBREW,
path: $resolved,
upgradeable: false,
assetName: $asset,
reason: 'dw is installed via Homebrew. Use `brew upgrade durable-workflow/tap/dw` instead.',
);
}
if ($asset === null) {
returnnewself(
kind: self::KIND_BINARY,
path: $resolved,
upgradeable: false,
assetName: null,
reason: sprintf('no published release asset matches this platform (%s/%s)', $osFamily, $arch),
);
}
returnnewself(
kind: self::KIND_BINARY,
path: $resolved,
upgradeable: true,
assetName: $asset,
);
}
/**
* Map the current platform to a published release asset name.
* Returns null when the platform has no matching binary.