Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ protected function tearDownTheTestEnvironment(): void
Queue::createPayloadUsing(null);
RegisterProviders::flushState();
Sleep::fake(false);
Str::resetFactoryState();
TrimStrings::flushState();
TrustProxies::flushState();
TrustHosts::flushState();
Expand Down
22 changes: 17 additions & 5 deletions src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ public static function random($length = 16)
/**
* Set the callable that will be used to generate random strings.
*
* @param callable|null $factory
* @param (callable(int): string)|null $factory
* @return void
*/
public static function createRandomStringsUsing(?callable $factory = null)
Expand Down Expand Up @@ -1913,7 +1913,7 @@ public static function orderedUuid()
/**
* Set the callable that will be used to generate UUIDs.
*
* @param callable|null $factory
* @param (callable(): \Ramsey\Uuid\UuidInterface)|null $factory
* @return void
*/
public static function createUuidsUsing(?callable $factory = null)
Expand All @@ -1925,7 +1925,7 @@ public static function createUuidsUsing(?callable $factory = null)
* Set the sequence that will be used to generate UUIDs.
*
* @param array $sequence
* @param callable|null $whenMissing
* @param (callable(): \Ramsey\Uuid\UuidInterface)|null $whenMissing
* @return void
*/
public static function createUuidsUsingSequence(array $sequence, $whenMissing = null)
Expand Down Expand Up @@ -2020,7 +2020,7 @@ public static function createUlidsNormally()
/**
* Set the callable that will be used to generate ULIDs.
*
* @param callable|null $factory
* @param (callable(): \Symfony\Component\Uid\Ulid)|null $factory
* @return void
*/
public static function createUlidsUsing(?callable $factory = null)
Expand All @@ -2032,7 +2032,7 @@ public static function createUlidsUsing(?callable $factory = null)
* Set the sequence that will be used to generate ULIDs.
*
* @param array $sequence
* @param callable|null $whenMissing
* @param (callable(): \Symfony\Component\Uid\Ulid)|null $whenMissing
* @return void
*/
public static function createUlidsUsingSequence(array $sequence, $whenMissing = null)
Expand Down Expand Up @@ -2096,4 +2096,16 @@ public static function flushCache()
static::$camelCache = [];
static::$studlyCache = [];
}

/**
* Return all factory functions to their default state.
*
* @return void
*/
public static function resetFactoryState()
{
static::createRandomStringsNormally();
static::createUlidsNormally();
static::createUuidsNormally();
}
}
Loading