Skip to content

Commit 6b45ac3

Browse files
committed
style: pint
1 parent d69f12b commit 6b45ac3

File tree

4 files changed

+86
-104
lines changed

4 files changed

+86
-104
lines changed

src/Console/InstallCommand.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Illuminate\Support\Arr;
99
use Illuminate\Support\Collection;
1010
use Illuminate\Support\Facades\Artisan;
11-
use Illuminate\Support\Facades\Process;
1211
use Illuminate\Support\Str;
1312
use Laravel\Boost\Install\ApplicationDetector;
1413
use Laravel\Boost\Install\Cli\DisplayHelper;
@@ -77,7 +76,7 @@ public function handle(Roster $roster, Herd $herd): void
7776
$this->idesToInstallTo = collect();
7877
$this->roster = $roster;
7978
$this->herd = $herd;
80-
$this->appDetector = new ApplicationDetector();
79+
$this->appDetector = new ApplicationDetector;
8180

8281
$this->colors = new class
8382
{
@@ -108,7 +107,7 @@ protected function query()
108107
$this->boostToInstall = $this->boostToInstall();
109108
// $this->boostToolsToDisable = $this->boostToolsToDisable(); // Not useful to start
110109

111-
// $this->projectPurpose = $this->projectPurpose();
110+
// $this->projectPurpose = $this->projectPurpose();
112111
$this->enforceTests = $this->shouldEnforceTests(ask: false);
113112

114113
$this->idesToInstallTo = $this->idesToInstallTo(); // To add boost:mcp to the correct file
@@ -278,7 +277,7 @@ protected function detectProjectAgents(): array
278277
{
279278
$agents = [];
280279
$projectAgents = $this->appDetector->detectInProject(base_path());
281-
280+
282281
// Map IDE detections to their corresponding agents
283282
$ideToAgentMap = [
284283
'phpstorm' => 'junie',
@@ -287,20 +286,20 @@ protected function detectProjectAgents(): array
287286
'windsurf' => 'windsurf',
288287
'copilot' => 'copilot',
289288
];
290-
289+
291290
foreach ($projectAgents as $app) {
292291
if (isset($ideToAgentMap[$app])) {
293292
$agents[] = $ideToAgentMap[$app];
294293
}
295294
}
296-
295+
297296
// Also check installed IDEs that might not have project files yet
298297
foreach ($this->installedIdes as $ide) {
299-
if (isset($ideToAgentMap[$ide]) && !in_array($ideToAgentMap[$ide], $agents)) {
298+
if (isset($ideToAgentMap[$ide]) && ! in_array($ideToAgentMap[$ide], $agents)) {
300299
$agents[] = $ideToAgentMap[$ide];
301300
}
302301
}
303-
302+
304303
return array_unique($agents);
305304
}
306305

@@ -391,7 +390,7 @@ protected function agentsToInstallTo(): Collection
391390

392391
// Filter agents to only show those that are installed (for Windsurf)
393392
$filteredAgents = $agents;
394-
if (!in_array('windsurf', $this->installedIdes) && !in_array('windsurf', $this->detectedProjectAgents)) {
393+
if (! in_array('windsurf', $this->installedIdes) && ! in_array('windsurf', $this->detectedProjectAgents)) {
395394
unset($filteredAgents['Laravel\\Boost\\Install\\Agents\\Windsurf']);
396395
}
397396

@@ -515,7 +514,7 @@ protected function publishAndUpdateConfig(): void
515514
$this->newLine();
516515
}
517516

518-
// $updated = $this->updateProjectPurposeInConfig($configPath, $this->projectPurpose);
517+
// $updated = $this->updateProjectPurposeInConfig($configPath, $this->projectPurpose);
519518
}
520519

521520
protected function updateProjectPurposeInConfig(string $configPath, ?string $purpose): bool

src/Install/Agents/Windsurf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ public function frontmatter(): bool
1515
{
1616
return false;
1717
}
18-
}
18+
}

src/Install/ApplicationDetector.php

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ApplicationDetector
1010
{
1111
/**
1212
* Application detection configurations for each platform.
13-
*
13+
*
1414
* @var array<string, array<string, array<string, string|array<string>>>>
1515
*/
1616
protected array $detectionConfig = [
@@ -114,7 +114,7 @@ class ApplicationDetector
114114

115115
/**
116116
* Project-specific detection patterns.
117-
*
117+
*
118118
* @var array<string, array<string, string|array<string>>>
119119
*/
120120
protected array $projectDetectionConfig = [
@@ -147,15 +147,15 @@ class ApplicationDetector
147147

148148
/**
149149
* Detect installed applications on the current platform.
150-
*
150+
*
151151
* @return array<string>
152152
*/
153153
public function detectInstalled(): array
154154
{
155155
$platform = $this->getPlatform();
156156
$detected = [];
157157

158-
if (!isset($this->detectionConfig[$platform])) {
158+
if (! isset($this->detectionConfig[$platform])) {
159159
return [];
160160
}
161161

@@ -170,8 +170,7 @@ public function detectInstalled(): array
170170

171171
/**
172172
* Detect applications used in the current project.
173-
*
174-
* @param string $basePath
173+
*
175174
* @return array<string>
176175
*/
177176
public function detectInProject(string $basePath): array
@@ -189,10 +188,8 @@ public function detectInProject(string $basePath): array
189188

190189
/**
191190
* Check if an application is installed based on its configuration.
192-
*
193-
* @param array<string, string|array<string>> $config
194-
* @param string $platform
195-
* @return bool
191+
*
192+
* @param array<string, string|array<string>> $config
196193
*/
197194
protected function isAppInstalled(array $config, string $platform): bool
198195
{
@@ -203,11 +200,11 @@ protected function isAppInstalled(array $config, string $platform): bool
203200
if ($config['type'] === 'directory' && isset($config['paths'])) {
204201
foreach ($config['paths'] as $path) {
205202
$expandedPath = $this->expandPath($path, $platform);
206-
203+
207204
// Handle wildcards
208205
if (strpos($expandedPath, '*') !== false) {
209206
$matches = glob($expandedPath, GLOB_ONLYDIR);
210-
if (!empty($matches)) {
207+
if (! empty($matches)) {
211208
return true;
212209
}
213210
} elseif (is_dir($expandedPath)) {
@@ -221,24 +218,22 @@ protected function isAppInstalled(array $config, string $platform): bool
221218

222219
/**
223220
* Check if an application is used in the current project.
224-
*
225-
* @param array<string, string|array<string>> $config
226-
* @param string $basePath
227-
* @return bool
221+
*
222+
* @param array<string, string|array<string>> $config
228223
*/
229224
protected function isAppUsedInProject(array $config, string $basePath): bool
230225
{
231226
if ($config['type'] === 'directory' && isset($config['paths'])) {
232227
foreach ($config['paths'] as $path) {
233-
if (is_dir($basePath . DIRECTORY_SEPARATOR . $path)) {
228+
if (is_dir($basePath.DIRECTORY_SEPARATOR.$path)) {
234229
return true;
235230
}
236231
}
237232
}
238233

239234
if ($config['type'] === 'file' && isset($config['files'])) {
240235
foreach ($config['files'] as $file) {
241-
if (file_exists($basePath . DIRECTORY_SEPARATOR . $file)) {
236+
if (file_exists($basePath.DIRECTORY_SEPARATOR.$file)) {
242237
return true;
243238
}
244239
}
@@ -247,14 +242,14 @@ protected function isAppUsedInProject(array $config, string $basePath): bool
247242
if ($config['type'] === 'mixed') {
248243
if (isset($config['paths'])) {
249244
foreach ($config['paths'] as $path) {
250-
if (is_dir($basePath . DIRECTORY_SEPARATOR . $path)) {
245+
if (is_dir($basePath.DIRECTORY_SEPARATOR.$path)) {
251246
return true;
252247
}
253248
}
254249
}
255250
if (isset($config['files'])) {
256251
foreach ($config['files'] as $file) {
257-
if (file_exists($basePath . DIRECTORY_SEPARATOR . $file)) {
252+
if (file_exists($basePath.DIRECTORY_SEPARATOR.$file)) {
258253
return true;
259254
}
260255
}
@@ -266,10 +261,6 @@ protected function isAppUsedInProject(array $config, string $basePath): bool
266261

267262
/**
268263
* Expand environment variables and user home directory in paths.
269-
*
270-
* @param string $path
271-
* @param string $platform
272-
* @return string
273264
*/
274265
protected function expandPath(string $path, string $platform): string
275266
{
@@ -293,8 +284,6 @@ protected function expandPath(string $path, string $platform): string
293284

294285
/**
295286
* Get the current platform identifier.
296-
*
297-
* @return string
298287
*/
299288
protected function getPlatform(): string
300289
{
@@ -307,11 +296,8 @@ protected function getPlatform(): string
307296

308297
/**
309298
* Add custom detection configuration for an application.
310-
*
311-
* @param string $app
312-
* @param array<string, array<string, string|array<string>>> $config
313-
* @param string|null $platform
314-
* @return void
299+
*
300+
* @param array<string, array<string, string|array<string>>> $config
315301
*/
316302
public function addDetectionConfig(string $app, array $config, ?string $platform = null): void
317303
{
@@ -327,13 +313,11 @@ public function addDetectionConfig(string $app, array $config, ?string $platform
327313

328314
/**
329315
* Add custom project detection configuration for an application.
330-
*
331-
* @param string $app
332-
* @param array<string, string|array<string>> $config
333-
* @return void
316+
*
317+
* @param array<string, string|array<string>> $config
334318
*/
335319
public function addProjectDetectionConfig(string $app, array $config): void
336320
{
337321
$this->projectDetectionConfig[$app] = $config;
338322
}
339-
}
323+
}

0 commit comments

Comments
 (0)