Fatal error: Cannot declare class `Composer\InstalledVersions`, because the name is already in use
Bug report
| Question | Answer |
|---|---|
| Box version | 4.3.8@5534406 |
| PHP version | 8.1.18 |
| Platform with version | Ubuntu 22.04 LTS |
| Github Repo | - |
When reusing BOX in a Composer Plugin context, PHP raise this fatal error when getting box version with \KevinGH\Box\get_box_version.
To avoid this error, I suggest to fix current get_box_version by this
if (!class_exists(InstalledVersions::class, false) && file_exists($file)) {
instead of https://github.com/box-project/box/blob/4.3.8/src/functions.php#L59
WDYM as a composer plugin context? Installed as a regular dependency instead of a PHAR?
WDYM as a composer plugin context?
My first attempt was to update declaration of box-manifest as a composer-plugin rather than a project.
As box-manifest as a direct dependency to box, it lead to this error.
BTW, I've let down this approach, and I'll create a composer plugin without link to the box-project. The goal will be to create only manifest files.
Other features actually present into box-manifest willl be let down !
Installed as a regular dependency instead of a PHAR?
Yes