Skip to content

Commit f2c2b1d

Browse files
committed
String::of -> str
1 parent 0f52699 commit f2c2b1d

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

php-templates/blade-components.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function findFiles($path, $extension, $keyCallback = null)
5454
foreach ($files as $file) {
5555
$realPath = $file->getRealPath();
5656

57-
$key = \Illuminate\Support\Str::of($realPath)
57+
$key = str($realPath)
5858
->replace($pathRealPath, '')
5959
->ltrim('/\\')
6060
->replace('.' . $extension, '')
@@ -87,7 +87,7 @@ protected function getStandardClasses()
8787
->map(fn($p) => \Illuminate\Support\Str::kebab($p))
8888
->implode('.'),
8989
))->map(function ($item) use ($appNamespace) {
90-
$class = \Illuminate\Support\Str::of($item['path'])
90+
$class = str($item['path'])
9191
->after('View/Components/')
9292
->replace('.php', '')
9393
->replace('/', '\\')
@@ -209,7 +209,7 @@ protected function handleIndexComponents($str)
209209
if ($parts->slice(-2)->unique()->count() === 1) {
210210
$parts->pop();
211211

212-
return \Illuminate\Support\Str::of($parts->implode('.'));
212+
return str($parts->implode('.'));
213213
}
214214

215215
return $str;
@@ -248,7 +248,7 @@ protected function getNamespacePath($classNamespace)
248248
}
249249

250250
foreach ($paths as $p) {
251-
$dir = \Illuminate\Support\Str::of($classNamespace)
251+
$dir = str($classNamespace)
252252
->replace($ns, '')
253253
->replace('\\', '/')
254254
->prepend($p . DIRECTORY_SEPARATOR)

php-templates/configs.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
$local = collect(glob(config_path("/*.php")))
44
->merge(glob(config_path("**/*.php")))
55
->map(fn ($path) => [
6-
(string) \Illuminate\Support\Str::of($path)
6+
(string) str($path)
77
->replace([config_path('/'), ".php"], "")
88
->replace(DIRECTORY_SEPARATOR, "."),
99
$path
@@ -12,7 +12,7 @@
1212
$vendor = collect(glob(base_path("vendor/**/**/config/*.php")))->map(fn (
1313
$path
1414
) => [
15-
(string) \Illuminate\Support\Str::of($path)
15+
(string) str($path)
1616
->afterLast(DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR)
1717
->replace(".php", "")
1818
->replace(DIRECTORY_SEPARATOR, "."),
@@ -57,7 +57,7 @@ function vsCodeGetConfigValue($value, $key, $configPaths) {
5757
$cachedContents[$path] ??= file_get_contents($path);
5858
$cachedParsed[$path] ??= token_get_all($cachedContents[$path]);
5959

60-
$keysToFind = \Illuminate\Support\Str::of($key)
60+
$keysToFind = str($key)
6161
->replaceFirst($found, "")
6262
->ltrim(".")
6363
->explode(".");

php-templates/models.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ protected function getInfo($className)
131131

132132
$data['attributes'] = collect($data['attributes'])
133133
->map(fn($attrs) => array_merge($attrs, [
134-
'title_case' => \Illuminate\Support\Str::of($attrs['name'])->title()->replace('_', '')->toString(),
134+
'title_case' => str($attrs['name'])->title()->replace('_', '')->toString(),
135135
'documented' => $existingProperties->contains($attrs['name']),
136136
'cast' => $this->getCastReturnType($attrs['cast'])
137137
]))
138138
->toArray();
139139

140140
$data['scopes'] = collect($reflection->getMethods())
141141
->filter(fn($method) => $method->isPublic() && !$method->isStatic() && str_starts_with($method->name, 'scope'))
142-
->map(fn($method) => \Illuminate\Support\Str::of($method->name)->replace('scope', '')->lcfirst()->toString())
142+
->map(fn($method) => str($method->name)->replace('scope', '')->lcfirst()->toString())
143143
->values()
144144
->toArray();
145145

php-templates/views.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function getAllComponents()
3737
foreach ($autoloaded as $namespace => $paths) {
3838
if (str_starts_with($ns, $namespace)) {
3939
foreach ($paths as $p) {
40-
$test = \Illuminate\Support\Str::of($ns)->replace($namespace, '')->replace('\\', '/')->prepend($p . DIRECTORY_SEPARATOR)->toString();
40+
$test = str($ns)->replace($namespace, '')->replace('\\', '/')->prepend($p . DIRECTORY_SEPARATOR)->toString();
4141

4242
if (is_dir($test)) {
4343
$path = $test;
@@ -64,7 +64,7 @@ public function getAllComponents()
6464
$components[] = [
6565
"path" => str_replace(base_path(DIRECTORY_SEPARATOR), '', $realPath),
6666
"isVendor" => str_contains($realPath, base_path("vendor")),
67-
"key" => \Illuminate\Support\Str::of($realPath)
67+
"key" => str($realPath)
6868
->replace(realpath($path), "")
6969
->replace(".php", "")
7070
->ltrim(DIRECTORY_SEPARATOR)
@@ -95,7 +95,7 @@ protected function findViews($path)
9595
$paths[] = [
9696
"path" => str_replace(base_path(DIRECTORY_SEPARATOR), '', $file->getRealPath()),
9797
"isVendor" => str_contains($file->getRealPath(), base_path("vendor")),
98-
"key" => \Illuminate\Support\Str::of($file->getRealPath())
98+
"key" => str($file->getRealPath())
9999
->replace(realpath($path), "")
100100
->replace(".blade.php", "")
101101
->ltrim(DIRECTORY_SEPARATOR)

src/templates/blade-components.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ $components = new class {
5454
foreach ($files as $file) {
5555
$realPath = $file->getRealPath();
5656
57-
$key = \\Illuminate\\Support\\Str::of($realPath)
57+
$key = str($realPath)
5858
->replace($pathRealPath, '')
5959
->ltrim('/\\\\')
6060
->replace('.' . $extension, '')
@@ -87,7 +87,7 @@ $components = new class {
8787
->map(fn($p) => \\Illuminate\\Support\\Str::kebab($p))
8888
->implode('.'),
8989
))->map(function ($item) use ($appNamespace) {
90-
$class = \\Illuminate\\Support\\Str::of($item['path'])
90+
$class = str($item['path'])
9191
->after('View/Components/')
9292
->replace('.php', '')
9393
->replace('/', '\\\\')
@@ -209,7 +209,7 @@ $components = new class {
209209
if ($parts->slice(-2)->unique()->count() === 1) {
210210
$parts->pop();
211211
212-
return \\Illuminate\\Support\\Str::of($parts->implode('.'));
212+
return str($parts->implode('.'));
213213
}
214214
215215
return $str;
@@ -248,7 +248,7 @@ $components = new class {
248248
}
249249
250250
foreach ($paths as $p) {
251-
$dir = \\Illuminate\\Support\\Str::of($classNamespace)
251+
$dir = str($classNamespace)
252252
->replace($ns, '')
253253
->replace('\\\\', '/')
254254
->prepend($p . DIRECTORY_SEPARATOR)

src/templates/configs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export default `
33
$local = collect(glob(config_path("/*.php")))
44
->merge(glob(config_path("**/*.php")))
55
->map(fn ($path) => [
6-
(string) \\Illuminate\\Support\\Str::of($path)
6+
(string) str($path)
77
->replace([config_path('/'), ".php"], "")
88
->replace(DIRECTORY_SEPARATOR, "."),
99
$path
@@ -12,7 +12,7 @@ $local = collect(glob(config_path("/*.php")))
1212
$vendor = collect(glob(base_path("vendor/**/**/config/*.php")))->map(fn (
1313
$path
1414
) => [
15-
(string) \\Illuminate\\Support\\Str::of($path)
15+
(string) str($path)
1616
->afterLast(DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR)
1717
->replace(".php", "")
1818
->replace(DIRECTORY_SEPARATOR, "."),
@@ -57,7 +57,7 @@ function vsCodeGetConfigValue($value, $key, $configPaths) {
5757
$cachedContents[$path] ??= file_get_contents($path);
5858
$cachedParsed[$path] ??= token_get_all($cachedContents[$path]);
5959
60-
$keysToFind = \\Illuminate\\Support\\Str::of($key)
60+
$keysToFind = str($key)
6161
->replaceFirst($found, "")
6262
->ltrim(".")
6363
->explode(".");

src/templates/models.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ $models = new class($factory) {
131131
132132
$data['attributes'] = collect($data['attributes'])
133133
->map(fn($attrs) => array_merge($attrs, [
134-
'title_case' => \\Illuminate\\Support\\Str::of($attrs['name'])->title()->replace('_', '')->toString(),
134+
'title_case' => str($attrs['name'])->title()->replace('_', '')->toString(),
135135
'documented' => $existingProperties->contains($attrs['name']),
136136
'cast' => $this->getCastReturnType($attrs['cast'])
137137
]))
138138
->toArray();
139139
140140
$data['scopes'] = collect($reflection->getMethods())
141141
->filter(fn($method) => $method->isPublic() && !$method->isStatic() && str_starts_with($method->name, 'scope'))
142-
->map(fn($method) => \\Illuminate\\Support\\Str::of($method->name)->replace('scope', '')->lcfirst()->toString())
142+
->map(fn($method) => str($method->name)->replace('scope', '')->lcfirst()->toString())
143143
->values()
144144
->toArray();
145145

src/templates/views.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $blade = new class {
3737
foreach ($autoloaded as $namespace => $paths) {
3838
if (str_starts_with($ns, $namespace)) {
3939
foreach ($paths as $p) {
40-
$test = \\Illuminate\\Support\\Str::of($ns)->replace($namespace, '')->replace('\\\\', '/')->prepend($p . DIRECTORY_SEPARATOR)->toString();
40+
$test = str($ns)->replace($namespace, '')->replace('\\\\', '/')->prepend($p . DIRECTORY_SEPARATOR)->toString();
4141
4242
if (is_dir($test)) {
4343
$path = $test;
@@ -64,7 +64,7 @@ $blade = new class {
6464
$components[] = [
6565
"path" => str_replace(base_path(DIRECTORY_SEPARATOR), '', $realPath),
6666
"isVendor" => str_contains($realPath, base_path("vendor")),
67-
"key" => \\Illuminate\\Support\\Str::of($realPath)
67+
"key" => str($realPath)
6868
->replace(realpath($path), "")
6969
->replace(".php", "")
7070
->ltrim(DIRECTORY_SEPARATOR)
@@ -95,7 +95,7 @@ $blade = new class {
9595
$paths[] = [
9696
"path" => str_replace(base_path(DIRECTORY_SEPARATOR), '', $file->getRealPath()),
9797
"isVendor" => str_contains($file->getRealPath(), base_path("vendor")),
98-
"key" => \\Illuminate\\Support\\Str::of($file->getRealPath())
98+
"key" => str($file->getRealPath())
9999
->replace(realpath($path), "")
100100
->replace(".blade.php", "")
101101
->ltrim(DIRECTORY_SEPARATOR)

0 commit comments

Comments
 (0)