laravel / valet

A more enjoyable local development experience for Mac.
https://laravel.com/docs/valet
MIT License
2.52k stars 698 forks source link

fix: Warning: Constant VALET_* already defined in X #1485

Closed NickSdot closed 6 months ago

NickSdot commented 6 months ago

Similar issue as in https://github.com/laravel/prompts/pull/146. To make packages like symfony/var-dumper available globally you prepend the global Composer autoload.php like so:

// php.ini

auto_prepend_file = ${HOME}/.composer/vendor/autoload.php

image From: https://symfony.com/doc/current/components/var_dumper.html

In Valet this can result in

( ! ) Warning: Constant VALET_HOME_PATH already defined in ~/.composer/vendor/laravel/valet/server.php on line 12
Call Stack
#   Time    Memory  Function    Location
1   0.0354  571296  {main}( )   .../server.php:0
2   0.0380  571488  define( $constant_name = 'VALET_HOME_PATH', $value = '~/.config/valet' )    .../server.php:12

( ! ) Warning: Constant VALET_STATIC_PREFIX already defined in ~/.composer/vendor/laravel/valet/server.php on line 13
Call Stack
#   Time    Memory  Function    Location
1   0.0354  571296  {main}( )   .../server.php:0