Skip to content

Commit

Permalink
fix: 🐛 Fix some more wrong/missing imports
Browse files Browse the repository at this point in the history
  • Loading branch information
shaedrich committed Sep 30, 2024
1 parent 0f9c71c commit 2c15ea6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Bus/Batchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Illuminate\Bus;

use Carbon\CarbonImmutable;
use Generator;
use Illuminate\Container\Container;
use Illuminate\Support\Generator;
use Illuminate\Support\Testing\Fakes\BatchFake;

trait Batchable
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Support/Casing.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static function headline($value)
? array_map([static::class, 'title'], $parts)
: array_map([static::class, 'title'], Str::ucsplit(implode('_', $parts)));

$collapsed = Str::replace(['-', '_', ' '], '_', implode('_', $parts));
$collapsed = Replacer::replace(['-', '_', ' '], '_', implode('_', $parts));

return implode(' ', array_filter(explode('_', $collapsed)));
}
Expand Down Expand Up @@ -180,7 +180,7 @@ public static function studly($value)
return static::$studlyCache[$key];
}

$words = explode(' ', Str::replace(['-', '_'], ' ', $value));
$words = explode(' ', Replacer::replace(['-', '_'], ' ', $value));

$studlyWords = array_map(fn ($word) => static::ucfirst($word), $words);

Expand Down
17 changes: 17 additions & 0 deletions src/Illuminate/Support/Replacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Closure;
use Illuminate\Support\Traits\Macroable;
use Throwable;
use Traversable;

class Replacer
Expand Down Expand Up @@ -205,4 +206,20 @@ public static function substrReplace($string, $replace, $offset = 0, $length = n

return substr_replace($string, $replace, $offset, $length);
}

/**
* Convert the given value to a string or return the given fallback on failure.
*
* @param mixed $value
* @param string $fallback
* @return string
*/
private static function toStringOr($value, $fallback)
{
try {
return (string) $value;
} catch (Throwable $e) {
return $fallback;
}
}
}
17 changes: 0 additions & 17 deletions src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use League\CommonMark\GithubFlavoredMarkdownConverter;
use League\CommonMark\MarkdownConverter;
use Symfony\Component\Uid\Ulid;
use Throwable;
use voku\helper\ASCII;

class Str
Expand Down Expand Up @@ -670,22 +669,6 @@ public static function repeat(string $string, int $times)
return str_repeat($string, $times);
}

/**
* Convert the given value to a string or return the given fallback on failure.
*
* @param mixed $value
* @param string $fallback
* @return string
*/
private static function toStringOr($value, $fallback)
{
try {
return (string) $value;
} catch (Throwable $e) {
return $fallback;
}
}

/**
* Reverse the given string.
*
Expand Down
1 change: 1 addition & 0 deletions src/Illuminate/Testing/ParallelTesting.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Testing;

use Illuminate\Contracts\Container\Container;
use Illuminate\Support\Casing;

class ParallelTesting
{
Expand Down

0 comments on commit 2c15ea6

Please sign in to comment.