Skip to content

Cannot declare class because the name is already in use #859

@icanhazstring

Description

@icanhazstring

Bug report

Question Answer
Box version 3.16.0
PHP version 7.4, 8.0, 8.1
Platform with version whatever php:7.4-alpine is using :)
Github Repo - https://github.com/composer-unused/composer-unused
box.json.dist
{
   "base-path": null,
   "output": "build/composer-unused.phar",
   "files": [
       "config/container.php",
       "config/polyfill_symfony_di.php",
       "config/services.php"
   ],
   "compactors": [
       "KevinGH\\Box\\Compactor\\PhpScoper"
   ]
}
Output
$ make box
> docker compose run php7.4 php .phive/box compile --no-parallel

   ____
  / __ )____  _  __
 / __  / __ \| |/_/
/ /_/ / /_/ />  <
/_____/\____/_/|_|


Box version 3.16.0@adb282a 2022-02-13 23:54:13 UTC

// Loading the configuration file "/docker/composer-unused/box.json".                                                  

🔨  Building the PHAR "/docker/composer-unused/build/composer-unused.phar"

? Registering compactors
 + KevinGH\Box\Compactor\PhpScoper
? Adding main file: /docker/composer-unused/bin/composer-unused
? Adding requirements checker
? Adding binary files
   > No file found
? Auto-discover files? Yes
? Exclude dev files? Yes
? Adding files
   > 1067 file(s)
? Generating new stub
 - Using shebang line: #!/usr/bin/env php
 - Using banner:
   > Generated by Humbug Box 3.16.0@adb282a.
   > 
   > @link https://github.com/humbug/box
? Dumping the Composer autoloader

In ComposerOrchestrator.php line 172:
                                 
 Could not dump the autoloader.  
                                 

In ComposerOrchestrator.php line 175:
                                                                                                                                                                                            
 The command "'/usr/bin/composer' 'dump-autoload' '--classmap-authoritative' '--no-dev' '--ansi'" failed.                                                                                   
                                                                                                                                                                                            
 Exit Code: 255(Unknown error)                                                                                                                                                              
                                                                                                                                                                                            
 Working directory: /tmp/box/Box34800                                                                                                                                                       
                                                                                                                                                                                            
 Output:                                                                                                                                                                                    
 ================                                                                                                                                                                           
                                                                                                                                                                                            
 Fatal error: Cannot declare class __ComposerUnused__\Composer\InstalledVersions, because the name is already in use in /tmp/box/Box34800/vendor/composer/InstalledVersions.php on line 25  
                                                                                                                                                                                            
                                                                                                                                                                                            
 Error Output:                                                                                                                                                                              
 ================                                                                                                                                                                           
                                                                                                                                                                                            

compile [-c|--config CONFIG] [--debug] [--no-parallel] [--no-restart] [--dev] [--no-config] [--with-docker] [-d|--working-dir WORKING-DIR]

make: *** [box] Error 1

To reproduce:

  • checkout repository
  • make up
  • make update
  • make box

This might not even be related to this repository.
But I can't figure out what is happening here. The dump also didn't help a lot.

Seems like "something" in dependency chain changed.
Sadly I don't have a lock file to check what happened.

So this is more like a request for help 🙈
Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions