feat: install phpstan and resolving reported errors in PHPStan

This commit is contained in:
amir-ys
2024-11-07 01:41:19 +03:30
parent b7efa6b24a
commit 865d565a91
27 changed files with 1023 additions and 642 deletions
@@ -3,8 +3,8 @@
namespace App\Services\Media\UrlGenerator;
use DateTimeInterface;
use Spatie\MediaLibrary\UrlGenerator\BaseUrlGenerator;
use Spatie\MediaLibrary\Exceptions\UrlCannotBeDetermined;
use Spatie\MediaLibrary\MediaCollections\Exceptions\InvalidUrlGenerator;
use Spatie\MediaLibrary\Support\UrlGenerator\BaseUrlGenerator;
class FtpUrlGenerator extends BaseUrlGenerator
{
@@ -15,7 +15,7 @@ class FtpUrlGenerator extends BaseUrlGenerator
*/
public function getUrl(): string
{
return config( 'media-library.wm-cdn' ) . '/' . $this->getPathRelativeToRoot();
return config('media-library.wm-cdn') . '/' . $this->getPathRelativeToRoot();
}
/**
@@ -23,13 +23,11 @@ class FtpUrlGenerator extends BaseUrlGenerator
* @param array $options
*
* @return string
*
* @throws UrlCannotBeDetermined
* @throws InvalidUrlGenerator
*/
public function getTemporaryUrl( DateTimeInterface $expiration , array $options = [] ): string
public function getTemporaryUrl(DateTimeInterface $expiration, array $options = []): string
{
throw UrlCannotBeDetermined::filesystemDoesNotSupportTemporaryUrls();
return 'done';
throw new InvalidUrlGenerator();
}
/**
@@ -38,7 +36,7 @@ class FtpUrlGenerator extends BaseUrlGenerator
* @return string
*
*/
public function getPath()
public function getPath(): string
{
return $this->getPathRelativeToRoot();
}
@@ -50,6 +48,6 @@ class FtpUrlGenerator extends BaseUrlGenerator
*/
public function getResponsiveImagesDirectoryUrl(): string
{
return config( 'media-library.wm-cdn' ) . '/' . $this->pathGenerator->getPathForResponsiveImages( $this->media );
return config('media-library.wm-cdn') . '/' . $this->pathGenerator->getPathForResponsiveImages($this->media);
}
}