Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab authored and github-actions[bot] committed Jul 27, 2024
1 parent 009e008 commit 6a35c25
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/Casts/GeneratedConversion.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
public ?float $aspect_ratio = null,
public ?string $average_color = null,
public array $metadata = [],
public Collection $generated_conversions = new Collection(),
public Collection $generated_conversions = new Collection,
?Carbon $created_at = null,
?Carbon $state_set_at = null,
) {
Expand Down
2 changes: 1 addition & 1 deletion src/FileDownloaders/FileDownloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static function getTemporaryFile(string $url, ?TemporaryDirectory $tempor
throw new Exception("Can't reach the url: {$url}");
}

$temporaryDirectory ??= (new TemporaryDirectory())
$temporaryDirectory ??= (new TemporaryDirectory)
->location(storage_path('media-tmp'))
->deleteWhenDestroyed()
->create();
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/MediaConversionJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function handle(): void

public function init(): void
{
$this->temporaryDirectory = (new TemporaryDirectory())
$this->temporaryDirectory = (new TemporaryDirectory)
->location(storage_path('media-tmp'))
->deleteWhenDestroyed()
->create();
Expand Down
3 changes: 1 addition & 2 deletions src/MediaCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ public function __construct(
public bool $public = false,
public ?string $disk = null,
public null|string|Closure $fallback = null,
) {
}
) {}
}
2 changes: 1 addition & 1 deletion src/MediaZipper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MediaZipper implements Responsable
* @param Collection<int, TMedia> $media
*/
public function __construct(
public Collection $media = new Collection(),
public Collection $media = new Collection,
public string $fileName = 'media.zip',
public array $zipStreamOptions = [],
) {
Expand Down
6 changes: 3 additions & 3 deletions src/Models/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ public function storeFileFromUrl(
?string $disk = null,
): static {

$temporaryDirectory = (new TemporaryDirectory())
$temporaryDirectory = (new TemporaryDirectory)
->location(storage_path('media-tmp'))
->create();

Expand All @@ -458,7 +458,7 @@ public function storeFileFromRessource(
?string $disk = null
): static {

$temporaryDirectory = (new TemporaryDirectory())
$temporaryDirectory = (new TemporaryDirectory)
->location(storage_path('media-tmp'))
->create();

Expand Down Expand Up @@ -543,7 +543,7 @@ public function storeConversionFromUrl(
?string $basePath = null,
string $state = 'success',
): GeneratedConversion {
$temporaryDirectory = (new TemporaryDirectory())
$temporaryDirectory = (new TemporaryDirectory)
->location(storage_path('media-tmp'))
->create();

Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public function addMedia(

$model = config('media.model');
/** @var TMedia $media */
$media = new $model();
$media = new $model;

$media->model()->associate($this);

Expand Down
2 changes: 1 addition & 1 deletion src/Traits/InteractsWithMediaFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function copyFileLocallyTo(string $path): ?string

public function makeTemporaryFileCopy(?TemporaryDirectory $temporaryDirectory = null): string|false
{
$temporaryDirectory ??= (new TemporaryDirectory())
$temporaryDirectory ??= (new TemporaryDirectory)
->location(storage_path('media-tmp'))
->deleteWhenDestroyed()
->create();
Expand Down
30 changes: 15 additions & 15 deletions tests/Feature/HasMediaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
use Illuminate\Support\Facades\Storage;

it('gets the correct media collection', function () {
$model = new Test();
$model = new Test;

expect($model->getMediaCollections()->toArray())->toHaveKeys(['files', 'avatar', 'fallback']);
});

it('keys media conversion by conversionName', function () {
$model = new TestWithNestedConversions();
$model = new TestWithNestedConversions;

/** @var Media $media */
$media = MediaFactory::new()->make([
Expand All @@ -28,7 +28,7 @@
});

it('gets the correct media conversion', function () {
$model = new TestWithNestedConversions();
$model = new TestWithNestedConversions;

/** @var Media $media */
$media = MediaFactory::new()->make([
Expand All @@ -40,7 +40,7 @@
});

it('gets the correct nested media conversion', function () {
$model = new TestWithNestedConversions();
$model = new TestWithNestedConversions;

/** @var Media $media */
$media = MediaFactory::new()->make([
Expand All @@ -64,7 +64,7 @@
it('creates a media, store files and generate conversions', function () {
Storage::fake('media');

$model = new Test();
$model = new Test;
$model->save();

$file = UploadedFile::fake()->image('foo.jpg');
Expand Down Expand Up @@ -95,7 +95,7 @@
it('generates nested conversions', function () {
Storage::fake('media');

$model = new TestWithNestedConversions();
$model = new TestWithNestedConversions;
$model->save();

$file = UploadedFile::fake()->image('foo.jpg');
Expand Down Expand Up @@ -136,15 +136,15 @@
});

it('gets the fallback value when no media extist', function () {
$model = new Test();
$model = new Test;

expect($model->getFirstMediaUrl('fallback'))->toBe('fallback-value');
});

it('gets the media url when a media exists in a collection', function () {
Storage::fake('media');

$model = new Test();
$model = new Test;
$model->save();

$file = UploadedFile::fake()->image('foo.jpg');
Expand All @@ -162,7 +162,7 @@
it('adds the new added media to the model relation', function () {
Storage::fake('media');

$model = new Test();
$model = new Test;
$model->save();

$model->load('media');
Expand All @@ -189,7 +189,7 @@
it('removes media from the model when clearing media collection', function () {
Storage::fake('media');

$model = new Test();
$model = new Test;
$model->save();

$model->addMedia(
Expand Down Expand Up @@ -218,7 +218,7 @@

Storage::fake('media');

$model = new Test();
$model = new Test;
$model->save();

$file = UploadedFile::fake()->image('foo.jpg');
Expand All @@ -243,7 +243,7 @@

Storage::fake('media');

$model = new Test();
$model = new Test;
$model->save();

$file = UploadedFile::fake()->image('foo.jpg');
Expand All @@ -269,7 +269,7 @@

Storage::fake('media');

$model = new TestSoftDelete();
$model = new TestSoftDelete;
$model->save();

$file = UploadedFile::fake()->image('foo.jpg');
Expand All @@ -295,7 +295,7 @@

Storage::fake('media');

$model = new TestSoftDelete();
$model = new TestSoftDelete;
$model->save();

$file = UploadedFile::fake()->image('foo.jpg');
Expand All @@ -321,7 +321,7 @@

Storage::fake('media');

$model = new TestSoftDelete();
$model = new TestSoftDelete;
$model->save();

$file = UploadedFile::fake()->image('foo.jpg');
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/HasMediaTransformationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
it('perform media transformations before storing files', function () {
Storage::fake('media');

$model = new TestWithMediaTransformations();
$model = new TestWithMediaTransformations;
$model->save();

$file = $this->getTestFile('images/800x900.jpg');
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/InteractsWithMediaFilesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

expect($media->getDisk()->exists($media->path))->toBe(true);

$temporaryDirectory = (new TemporaryDirectory())
$temporaryDirectory = (new TemporaryDirectory)
->location(storage_path('media-tmp'))
->create();

Expand Down Expand Up @@ -62,7 +62,7 @@

expect($generatedConversion->getDisk()->exists($generatedConversion->path))->toBe(true);

$temporaryDirectory = (new TemporaryDirectory())
$temporaryDirectory = (new TemporaryDirectory)
->location(storage_path('media-tmp'))
->create();

Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/OptimizedImageConversionJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
it('generate a webp file conversion', function () {
Storage::fake('media');

$model = new TestWithMultipleConversions();
$model = new TestWithMultipleConversions;
$model->save();

$file = UploadedFile::fake()->image('foo.jpg');
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/ResponsiveImagesConversionsPresetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Storage::fake('media');

$model = new TestWithResponsiveImages();
$model = new TestWithResponsiveImages;
$model->save();

$orginial = UploadedFile::fake()->image('original.jpg', width: 1920, height: 1920);
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/VideoPosterConversionJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
it('generate a poster conversion from a video', function () {
Storage::fake('media');

$model = new TestWithVideoConversions();
$model = new TestWithVideoConversions;
$model->save();

$file = $this->getTestFile('videos/horizontal.mp4');
Expand All @@ -31,7 +31,7 @@
it('generate a poster with its responsive images from a video', function () {
Storage::fake('media');

$model = new TestWithVideoConversions();
$model = new TestWithVideoConversions;
$model->save();

$file = $this->getTestFile('videos/horizontal.mp4');
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/FileDownloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

it('download a file from an url as a temporary file', function () {

$temporaryDirectory = (new TemporaryDirectory())
$temporaryDirectory = (new TemporaryDirectory)
->location(storage_path('media-tmp'))
->create();

Expand Down

0 comments on commit 6a35c25

Please sign in to comment.