Skip to content

Commit 0e1fd0a

Browse files
committed
refactor: combine the code of the redundant COMPOSER_GLOBAL_PATH constant into the Diagnose command.
- Removed the redundant `COMPOSER_GLOBAL_PATH` constant because it's only used by one thing. So it doesn't need to exist. - Changed the `Diagnose` command to get the contents of the global composer.json to use the code that was originally used to set the `COMPOSER_GLOBAL_PATH` constant. Ie. The command now directly uses the `Valet::getComposerGlobalPath` method to get the global composer path. - Changed docblock of the `Valet::getComposerGlobalPath` method.
1 parent 0f773b6 commit 0e1fd0a

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

cli/Valet/Diagnose.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(CommandLine $cli, Filesystem $files) {
3838
'php --info',
3939
'php --ri curl',
4040
'cmd /C curl --version',
41-
'cat "' . pathFilter(COMPOSER_GLOBAL_PATH) . '/composer.json"',
41+
'cat "' . pathFilter(trim(\Valet::getComposerGlobalPath())) . '/composer.json"',
4242
'composer global diagnose --no-ansi 1>' . VALET_HOME_PATH . '/composer.txt',
4343
'composer global outdated --format json'
4444
];

cli/Valet/Valet.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,7 @@ public function composerGlobalUpdate() {
254254
* composer does allow the user to change where global packages are installed.
255255
* So we need to essentially ask composer where the home directory is.
256256
*
257-
* This is used to set the `COMPOSER_GLOBAL_PATH` constant, which in turn is used
258-
* by the `Diagnose` class.
257+
* This is used by the `Diagnose` class.
259258
*
260259
* @return string The path to the global composer directory.
261260
*/

cli/includes/helpers.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424
define('VALET_HOME_PATH', pathFilter($_SERVER['HOME'] . '/.config/valet'));
2525
define('VALET_SERVER_PATH', str_replace('\\', '/', realpath(__DIR__ . '/../../server.php')));
2626
define('VALET_STATIC_PREFIX', '41c270e4-5535-4daa-b23e-c269744c2f45');
27-
/**
28-
* Define the composer global path as a constant. For use with `Diagnose` class.
29-
*/
30-
define('COMPOSER_GLOBAL_PATH', trim(\Valet::getComposerGlobalPath()));
3127

3228
/**
3329
* Output the given text to the console.

0 commit comments

Comments
 (0)