mirror of
https://github.com/itflow-org/itflow
synced 2026-08-18 21:45:13 +00:00
Allow PHP-8.2 and up Compatibility instead of just PHP-8.4
This commit is contained in:
@@ -4,6 +4,8 @@ namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
use function Illuminate\Support\enum_value;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Contracts\Filesystem\Filesystem drive(string|null $name = null)
|
||||
* @method static \Illuminate\Contracts\Filesystem\Filesystem disk(\UnitEnum|string|null $name = null)
|
||||
@@ -61,6 +63,7 @@ use Illuminate\Filesystem\Filesystem;
|
||||
* @method static string|false mimeType(string $path)
|
||||
* @method static string url(string $path)
|
||||
* @method static bool providesTemporaryUrls()
|
||||
* @method static bool providesTemporaryUploadUrls()
|
||||
* @method static string temporaryUrl(string $path, \DateTimeInterface $expiration, array $options = [])
|
||||
* @method static array temporaryUploadUrl(string $path, \DateTimeInterface $expiration, array $options = [])
|
||||
* @method static \League\Flysystem\FilesystemOperator getDriver()
|
||||
@@ -68,6 +71,7 @@ use Illuminate\Filesystem\Filesystem;
|
||||
* @method static array getConfig()
|
||||
* @method static void serveUsing(\Closure $callback)
|
||||
* @method static void buildTemporaryUrlsUsing(\Closure $callback)
|
||||
* @method static void buildTemporaryUploadUrlsUsing(\Closure $callback)
|
||||
* @method static \Illuminate\Filesystem\FilesystemAdapter|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
|
||||
* @method static \Illuminate\Filesystem\FilesystemAdapter|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
|
||||
* @method static void macro(string $name, object|callable $macro)
|
||||
@@ -90,13 +94,13 @@ class Storage extends Facade
|
||||
/**
|
||||
* Replace the given disk with a local testing disk.
|
||||
*
|
||||
* @param string|null $disk
|
||||
* @param \UnitEnum|string|null $disk
|
||||
* @param array $config
|
||||
* @return \Illuminate\Contracts\Filesystem\Filesystem
|
||||
* @return \Illuminate\Filesystem\LocalFilesystemAdapter
|
||||
*/
|
||||
public static function fake($disk = null, array $config = [])
|
||||
{
|
||||
$root = self::getRootPath($disk = $disk ?: static::$app['config']->get('filesystems.default'));
|
||||
$root = self::getRootPath($disk = enum_value($disk) ?: static::$app['config']->get('filesystems.default'));
|
||||
|
||||
if ($token = ParallelTesting::token()) {
|
||||
$root = "{$root}_test_{$token}";
|
||||
@@ -108,21 +112,27 @@ class Storage extends Facade
|
||||
self::buildDiskConfiguration($disk, $config, root: $root)
|
||||
));
|
||||
|
||||
return tap($fake)->buildTemporaryUrlsUsing(function ($path, $expiration) {
|
||||
return URL::to($path.'?expiration='.$expiration->getTimestamp());
|
||||
return tap($fake, function ($fake) {
|
||||
$fake->buildTemporaryUrlsUsing(function ($path, $expiration) {
|
||||
return URL::to($path.'?expiration='.$expiration->getTimestamp());
|
||||
});
|
||||
|
||||
$fake->buildTemporaryUploadUrlsUsing(function ($path, $expiration) {
|
||||
return ['url' => URL::to($path.'?expiration='.$expiration->getTimestamp()), 'headers' => []];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the given disk with a persistent local testing disk.
|
||||
*
|
||||
* @param string|null $disk
|
||||
* @param \UnitEnum|string|null $disk
|
||||
* @param array $config
|
||||
* @return \Illuminate\Contracts\Filesystem\Filesystem
|
||||
* @return \Illuminate\Filesystem\LocalFilesystemAdapter
|
||||
*/
|
||||
public static function persistentFake($disk = null, array $config = [])
|
||||
{
|
||||
$disk = $disk ?: static::$app['config']->get('filesystems.default');
|
||||
$disk = enum_value($disk) ?: static::$app['config']->get('filesystems.default');
|
||||
|
||||
static::set($disk, $fake = static::createLocalDriver(
|
||||
self::buildDiskConfiguration($disk, $config, root: self::getRootPath($disk))
|
||||
|
||||
Reference in New Issue
Block a user