Skip to content

Commit 68688b9

Browse files
laravel-ide-helpergithub-actions[bot]
authored andcommitted
composer fix-style
1 parent 1353c67 commit 68688b9

File tree

5 files changed

+59
-63
lines changed

5 files changed

+59
-63
lines changed

php-templates/configs.php

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,41 @@
11
<?php
22

3-
$local = collect(glob(config_path("/*.php")))
4-
->merge(glob(config_path("**/*.php")))
3+
$local = collect(glob(config_path('/*.php')))
4+
->merge(glob(config_path('**/*.php')))
55
->map(fn ($path) => [
6-
(string) \Illuminate\Support\Str::of($path)
7-
->replace([config_path("/"), ".php"], "")
8-
->replace("/", "."),
9-
$path
6+
(string) Illuminate\Support\Str::of($path)
7+
->replace([config_path('/'), '.php'], '')
8+
->replace('/', '.'),
9+
$path,
1010
]);
1111

12-
$vendor = collect(glob(base_path("vendor/**/**/config/*.php")))->map(fn (
12+
$vendor = collect(glob(base_path('vendor/**/**/config/*.php')))->map(fn (
1313
$path
1414
) => [
15-
(string) \Illuminate\Support\Str::of($path)
16-
->afterLast("/config/")
17-
->replace(".php", "")
18-
->replace("/", "."),
19-
$path
15+
(string) Illuminate\Support\Str::of($path)
16+
->afterLast('/config/')
17+
->replace('.php', '')
18+
->replace('/', '.'),
19+
$path,
2020
]);
2121

2222
$configPaths = $local
2323
->merge($vendor)
2424
->groupBy(0)
25-
->map(fn ($items)=>$items->pluck(1));
25+
->map(fn ($items) => $items->pluck(1));
2626

2727
$cachedContents = [];
2828
$cachedParsed = [];
2929

30-
function vsCodeGetConfigValue($value, $key, $configPaths) {
31-
$parts = explode(".", $key);
30+
function vsCodeGetConfigValue($value, $key, $configPaths)
31+
{
32+
$parts = explode('.', $key);
3233
$toFind = $key;
3334
$found = null;
3435

3536
while (count($parts) > 0) {
3637
array_pop($parts);
37-
$toFind = implode(".", $parts);
38+
$toFind = implode('.', $parts);
3839

3940
if ($configPaths->has($toFind)) {
4041
$found = $toFind;
@@ -56,22 +57,22 @@ function vsCodeGetConfigValue($value, $key, $configPaths) {
5657
$cachedContents[$path] ??= file_get_contents($path);
5758
$cachedParsed[$path] ??= token_get_all($cachedContents[$path]);
5859

59-
$keysToFind = \Illuminate\Support\Str::of($key)
60-
->replaceFirst($found, "")
61-
->ltrim(".")
62-
->explode(".");
60+
$keysToFind = Illuminate\Support\Str::of($key)
61+
->replaceFirst($found, '')
62+
->ltrim('.')
63+
->explode('.');
6364

6465
if (is_numeric($keysToFind->last())) {
6566
$index = $keysToFind->pop();
6667

67-
if ($index !== "0") {
68+
if ($index !== '0') {
6869
return null;
6970
}
7071

71-
$key = collect(explode(".", $key));
72+
$key = collect(explode('.', $key));
7273
$key->pop();
73-
$key = $key->implode(".");
74-
$value = "array(...)";
74+
$key = $key->implode('.');
75+
$value = 'array(...)';
7576
}
7677

7778
$nextKey = $keysToFind->shift();
@@ -80,11 +81,11 @@ function vsCodeGetConfigValue($value, $key, $configPaths) {
8081
$depth = 0;
8182

8283
foreach ($cachedParsed[$path] as $token) {
83-
if ($token === "[") {
84+
if ($token === '[') {
8485
$depth++;
8586
}
8687

87-
if ($token === "]") {
88+
if ($token === ']') {
8889
$depth--;
8990
}
9091

@@ -117,14 +118,14 @@ function vsCodeGetConfigValue($value, $key, $configPaths) {
117118
}
118119

119120
return [
120-
"name" => $key,
121-
"value" => $value,
122-
"file" => $file === null ? null : str_replace(base_path('/'), '', $file),
123-
"line" => $line
121+
'name' => $key,
122+
'value' => $value,
123+
'file' => $file === null ? null : str_replace(base_path('/'), '', $file),
124+
'line' => $line,
124125
];
125126
}
126127

127-
return collect(\Illuminate\Support\Arr::dot(config()->all()))
128+
return collect(Illuminate\Support\Arr::dot(config()->all()))
128129
->map(fn ($value, $key) => vsCodeGetConfigValue($value, $key, $configPaths))
129130
->filter()
130131
->values();

php-templates/routes.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
<?php
22

3-
function vsCodeGetRouterReflection(\Illuminate\Routing\Route $route)
3+
function vsCodeGetRouterReflection(Illuminate\Routing\Route $route)
44
{
55
if ($route->getActionName() === 'Closure') {
6-
return new \ReflectionFunction($route->getAction()['uses']);
6+
return new ReflectionFunction($route->getAction()['uses']);
77
}
88

99
if (!str_contains($route->getActionName(), '@')) {
10-
return new \ReflectionClass($route->getActionName());
10+
return new ReflectionClass($route->getActionName());
1111
}
1212

1313
try {
14-
return new \ReflectionMethod($route->getControllerClass(), $route->getActionMethod());
15-
} catch (\Throwable $e) {
16-
$namespace = app(\Illuminate\Routing\UrlGenerator::class)->getRootControllerNamespace()
14+
return new ReflectionMethod($route->getControllerClass(), $route->getActionMethod());
15+
} catch (Throwable $e) {
16+
$namespace = app(Illuminate\Routing\UrlGenerator::class)->getRootControllerNamespace()
1717
?? (app()->getNamespace() . 'Http\Controllers');
1818

19-
return new \ReflectionMethod(
19+
return new ReflectionMethod(
2020
$namespace . '\\' . ltrim($route->getControllerClass(), '\\'),
2121
$route->getActionMethod(),
2222
);
2323
}
2424
}
2525

2626
return collect(app('router')->getRoutes()->getRoutes())
27-
->map(function (\Illuminate\Routing\Route $route) {
27+
->map(function (Illuminate\Routing\Route $route) {
2828
try {
2929
$reflection = vsCodeGetRouterReflection($route);
30-
} catch (\Throwable $e) {
30+
} catch (Throwable $e) {
3131
$reflection = null;
3232
}
3333

@@ -43,4 +43,4 @@ function vsCodeGetRouterReflection(\Illuminate\Routing\Route $route)
4343
'line' => $reflection ? $reflection->getStartLine() : null,
4444
];
4545
})
46-
;
46+
;

php-templates/views.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,42 @@ function vsCodeFindBladeFiles($path)
99
}
1010

1111
foreach (
12-
\Symfony\Component\Finder\Finder::create()
12+
Symfony\Component\Finder\Finder::create()
1313
->files()
14-
->name("*.blade.php")
15-
->in($path)
16-
as $file
14+
->name('*.blade.php')
15+
->in($path) as $file
1716
) {
1817
$paths[] = [
19-
"path" => str_replace(base_path(DIRECTORY_SEPARATOR), '', $file->getRealPath()),
20-
"isVendor" => str_contains($file->getRealPath(), base_path("vendor")),
21-
"key" => \Illuminate\Support\Str::of($file->getRealPath())
22-
->replace(realpath($path), "")
23-
->replace(".blade.php", "")
18+
'path' => str_replace(base_path(DIRECTORY_SEPARATOR), '', $file->getRealPath()),
19+
'isVendor' => str_contains($file->getRealPath(), base_path('vendor')),
20+
'key' => Illuminate\Support\Str::of($file->getRealPath())
21+
->replace(realpath($path), '')
22+
->replace('.blade.php', '')
2423
->ltrim(DIRECTORY_SEPARATOR)
25-
->replace(DIRECTORY_SEPARATOR, ".")
24+
->replace(DIRECTORY_SEPARATOR, '.'),
2625
];
2726
}
2827

2928
return $paths;
3029
}
3130
$paths = collect(
32-
app("view")
31+
app('view')
3332
->getFinder()
3433
->getPaths()
3534
)->flatMap(function ($path) {
3635
return vsCodeFindBladeFiles($path);
3736
});
3837

3938
$hints = collect(
40-
app("view")
39+
app('view')
4140
->getFinder()
4241
->getHints()
4342
)->flatMap(function ($paths, $key) {
4443
return collect($paths)->flatMap(function ($path) use ($key) {
4544
return collect(vsCodeFindBladeFiles($path))->map(function ($value) use (
4645
$key
4746
) {
48-
return array_merge($value, ["key" => "{$key}::{$value["key"]}"]);
47+
return array_merge($value, ['key' => "{$key}::{$value['key']}"]);
4948
});
5049
});
5150
});
@@ -54,9 +53,9 @@ function vsCodeFindBladeFiles($path)
5453
->merge($hints)
5554
->values()
5655
->partition(function ($v) {
57-
return !$v["isVendor"];
56+
return !$v['isVendor'];
5857
});
5958

6059
return $local
61-
->sortBy("key", SORT_NATURAL)
62-
->merge($vendor->sortBy("key", SORT_NATURAL));
60+
->sortBy('key', SORT_NATURAL)
61+
->merge($vendor->sortBy('key', SORT_NATURAL));

src/Console/MetaCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ protected function getExpectedArgumentSets()
192192
'configs' => $this->loadTemplate('configs')->pluck('name')->filter(),
193193
'routes' => $this->loadTemplate('routes')->pluck('name')->filter(),
194194
'views' => $this->loadTemplate('views')->pluck('key')->filter(),
195-
195+
196196
];
197197
}
198198

@@ -229,7 +229,7 @@ protected function getExpectedArguments()
229229
protected function loadTemplate($name)
230230
{
231231
if (!isset($this->templates[$name])) {
232-
$file = __DIR__ . '/../../php-templates/' . basename($name) .'.php';
232+
$file = __DIR__ . '/../../php-templates/' . basename($name) . '.php';
233233
$this->templates[$name] = $this->files->requireOnce($file);
234234
}
235235

src/IdeHelperServiceProvider.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
use Illuminate\Contracts\Support\DeferrableProvider;
2121
use Illuminate\Database\Events\MigrationsEnded;
2222
use Illuminate\Support\ServiceProvider;
23-
use Illuminate\View\Engines\EngineResolver;
24-
use Illuminate\View\Engines\PhpEngine;
25-
use Illuminate\View\Factory;
26-
use Illuminate\View\FileViewFinder;
2723

2824
class IdeHelperServiceProvider extends ServiceProvider implements DeferrableProvider
2925
{

0 commit comments

Comments
 (0)