Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Box produces error related to PHPStan #1006

Closed
kubk opened this issue Jul 16, 2023 · 3 comments
Closed

Box produces error related to PHPStan #1006

kubk opened this issue Jul 16, 2023 · 3 comments

Comments

@kubk
Copy link

kubk commented Jul 16, 2023

Bug report

Question Answer
Box version 4.3.8@5534406
PHP version 8.1.19
Platform with version MacOS
Github Repo https://github.com/riverwaysoft/php-converter/tree/box-issue
box.json.dist
{
   "chmod": "0700",
   "files": ["vendor/autoload.php"],
   "directories": ["src"],
   "finder": [
       {
           "name": "*.php",
           "exclude": ["tests"],
           "in": "vendor"
       }
   ]
}

But the same issue happens even if there is no box.json file.

Output
$ php box.phar compile
>   The command "'/opt/homebrew/bin/composer' 'dump-autoload' '--classmap-authoritative' '--no-dev' '--ansi'" failed.                                                    
                                                                                                                                                                      
 Exit Code: 1(General error)                                                                                                                                          
                                                                                                                                                                      
 Working directory: /private/var/folders/_d/g7ltcm3130b5_t60621hgs0w0000gn/T/box/Box32256                                                                             
                                                                                                                                                                      
 Output:                                                                                                                                                              
 ================                                                                                                                                                     
                                                                                                                                                                      
                                                                                                                                                                      
 Error Output:                                                                                                                                                        
 ================                                                                                                                                                     
                                                                                                                                                                      
 In AutoloadGenerator.php line 1337:                                                                                                                          
                                                                                                                                                               
                                                                                                                                                               
   require(/private/var/folders/_d/g7ltcm3130b5_t60621hgs0w0000gn/T/box/Box32256/vendor/phpstan/phpstan/bootstrap.php): Failed to open stream: No such file o  
 r director                                                                                                                                                    
   y                                                                                                                                                           
                                                                                                                                                               
                                                                                                                                                               
          

Just clone the repo on branch box-issue and run php box.phar compile: riverwaysoft/php-converter@a77455a

@lkrms
Copy link

lkrms commented Aug 8, 2023

Commenting because I found this issue while investigating the same error here:

This is related to a long-standing issue when a Composer plugin is provided by a dev dependency, because Box removes dev dependencies at the filesystem level but Composer tries to load them anyway. I've posted a workaround that may or may not work for you in #580, which seems to be where this is being tracked.

@kubk
Copy link
Author

kubk commented Aug 8, 2023

@lkrms Thank you for the workaround. I'll close the issue then if it's a duplicate #580

So far I am using phar-composer and it gets the job done.

@kubk kubk closed this as completed Aug 8, 2023
@lkrms
Copy link

lkrms commented Aug 8, 2023

@lkrms Thank you for the workaround. I'll close the issue then if it's a duplicate #580

So far I am using phar-composer and it gets the job done.

I've been using that too, but am wanting a bit more control over the output 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants