From a6542b0972a1a92c1249689d3e1b46b3bc4e59fa Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 14 May 2018 07:56:56 -0500 Subject: [PATCH] formatting --- src/Illuminate/Foundation/Console/Presets/Preset.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Foundation/Console/Presets/Preset.php b/src/Illuminate/Foundation/Console/Presets/Preset.php index ebdb79f9340e..e837cffe0cbb 100644 --- a/src/Illuminate/Foundation/Console/Presets/Preset.php +++ b/src/Illuminate/Foundation/Console/Presets/Preset.php @@ -23,22 +23,24 @@ protected static function ensureComponentDirectoryExists() /** * Update the "package.json" file. * + * @param bool $dev * @return void */ - protected static function updatePackages($devDependency = true) + protected static function updatePackages($dev = true) { if (! file_exists(base_path('package.json'))) { return; } - $dependenciesBlock = $devDependency ? 'devDependencies' : 'dependencies'; + $configurationKey = $dev ? 'devDependencies' : 'dependencies'; + $packages = json_decode(file_get_contents(base_path('package.json')), true); - $packages[$dependenciesBlock] = static::updatePackageArray( - array_key_exists($dependenciesBlock, $packages) ? $packages[$dependenciesBlock] : [] + $packages[$configurationKey] = static::updatePackageArray( + array_key_exists($configurationKey, $packages) ? $packages[$configurationKey] : [] ); - ksort($packages[$dependenciesBlock]); + ksort($packages[$configurationKey]); file_put_contents( base_path('package.json'),