Skip to content

Commit

Permalink
fix pint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
imahmood committed Nov 20, 2023
1 parent d855fd1 commit eeb445c
Show file tree
Hide file tree
Showing 27 changed files with 16 additions and 31 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
],
"require": {
"php": "^8.1",
"doctrine/dbal": "^3.7",
"jcupitt/vips": "^2.0",
"laravel/framework": "^9.0|^10.0",
"nesbot/carbon": "^2.0"
Expand Down
1 change: 1 addition & 0 deletions config/file-storage.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

return [
'disk' => env('FILE_STORAGE_DISK', 'media'),
Expand Down
7 changes: 7 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"preset": "laravel",
"rules": {
"blank_line_after_opening_tag": false,
"declare_strict_types": true
}
}
1 change: 0 additions & 1 deletion src/Config/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Config;
Expand Down
1 change: 0 additions & 1 deletion src/Config/ConfigurationFactory.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Config;
Expand Down
1 change: 0 additions & 1 deletion src/Contracts/MediaAwareInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Contracts;
Expand Down
1 change: 0 additions & 1 deletion src/Contracts/MediaTypeInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Contracts;
Expand Down
1 change: 0 additions & 1 deletion src/Controllers/DownloadController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Controllers;
Expand Down
1 change: 0 additions & 1 deletion src/Exceptions/FileNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Exceptions;
Expand Down
1 change: 0 additions & 1 deletion src/Exceptions/NotWritableException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Exceptions;
Expand Down
1 change: 0 additions & 1 deletion src/Exceptions/PersistenceFailedException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Exceptions;
Expand Down
1 change: 0 additions & 1 deletion src/Exceptions/UnableToDeleteDirectoryException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Exceptions;
Expand Down
1 change: 0 additions & 1 deletion src/Exceptions/UnableToDeleteFileException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Exceptions;
Expand Down
1 change: 0 additions & 1 deletion src/FileManipulator.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage;
Expand Down
15 changes: 7 additions & 8 deletions src/FileStorage.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage;
Expand Down Expand Up @@ -99,7 +98,7 @@ public function updatePreviewName(Media $media, string $fileName): Media
{
$media->preview = $fileName;

if (!$media->save()) {
if (! $media->save()) {
throw new PersistenceFailedException();
}

Expand All @@ -117,16 +116,16 @@ protected function persistMedia(Media $media, ?UploadedFile $uploadedFile): Medi
$media->preview = null;
}

if (!$media->save()) {
if (! $media->save()) {
throw new PersistenceFailedException();
}

if ($uploadedFile) {
$isUploaded = (bool)$uploadedFile->storeAs($media->dir_relative_path, $media->file_name, [
$isUploaded = (bool) $uploadedFile->storeAs($media->dir_relative_path, $media->file_name, [
'disk' => $this->config->diskName,
]);

if (!$isUploaded) {
if (! $isUploaded) {
throw new PersistenceFailedException();
}

Expand All @@ -150,7 +149,7 @@ protected function persistMedia(Media $media, ?UploadedFile $uploadedFile): Medi
public function delete(Media $media): bool
{
return DB::transaction(function () use ($media) {
if (!$media->delete()) {
if (! $media->delete()) {
return false;
}

Expand All @@ -166,7 +165,7 @@ public function delete(Media $media): bool
protected function deleteDirectory(string $dir): void
{
$isDeleted = Storage::disk($this->config->diskName)->deleteDirectory($dir);
if (!$isDeleted) {
if (! $isDeleted) {
throw new UnableToDeleteDirectoryException(sprintf(
'[FileStorage] Disk: %s, Directory: %s',
$this->config->diskName,
Expand All @@ -181,7 +180,7 @@ protected function deleteDirectory(string $dir): void
protected function deleteFile(array|string $paths): void
{
$isDeleted = Storage::disk($this->config->diskName)->delete($paths);
if (!$isDeleted) {
if (! $isDeleted) {
$paths = is_array($paths) ? implode(', ', $paths) : $paths;

throw new UnableToDeleteFileException(sprintf(
Expand Down
1 change: 0 additions & 1 deletion src/FileStorageServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage;
Expand Down
1 change: 0 additions & 1 deletion src/Jobs/GeneratePreview.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Jobs;
Expand Down
1 change: 0 additions & 1 deletion src/Jobs/OptimizeImage.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Jobs;
Expand Down
1 change: 0 additions & 1 deletion src/MediaAwareTrait.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage;
Expand Down
1 change: 0 additions & 1 deletion src/Models/Media.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Models;
Expand Down
1 change: 0 additions & 1 deletion src/Resources/MediaEntityResource.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Resources;
Expand Down
1 change: 0 additions & 1 deletion src/Resources/PrivateMediaResource.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Resources;
Expand Down
1 change: 0 additions & 1 deletion src/Resources/PublicMediaResource.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Resources;
Expand Down
1 change: 0 additions & 1 deletion tests/FileStorageTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Tests;
Expand Down
1 change: 0 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Tests;
Expand Down
1 change: 0 additions & 1 deletion tests/TestSupport/Enums/TestDocumentType.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Tests\TestSupport\Enums;
Expand Down
1 change: 0 additions & 1 deletion tests/TestSupport/Models/TestUserModel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Imahmood\FileStorage\Tests\TestSupport\Models;
Expand Down

0 comments on commit eeb445c

Please sign in to comment.