Skip to content

Commit

Permalink
Apply fixes from StyleCI (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmuscnielsen committed Jan 26, 2022
1 parent 9a2fd57 commit 251248c
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 45 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ 8.0,8.1 ]
laravel: [ 8.*,9* ]
dependency-version: [ prefer-lowest, prefer-stable ]
php: [8.0,8.1]
laravel: [8.*,9.*]
dependency-version: [prefer-lowest,prefer-stable]

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"doctrine/dbal": "^3.0",
"mockery/mockery": "^1.5",
"rutorika/sortable": "8.*",
"phpunit/phpunit": "9.*",
"phpunit/phpunit": "9.*"
},
"suggest": {
"illuminate/database": "Required for using extended media library functionality",
Expand Down
8 changes: 5 additions & 3 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function __construct($diskName, $endpoint, $guzzle)
/**
* @param $path
* @return bool
*
* @throws FailedDeletionException
*/
public function delete($path)
Expand All @@ -62,10 +63,11 @@ public function delete($path)
}

/**
* @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile $image
* @param null $path
* @param string $visibility
* @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile $image
* @param null $path
* @param string $visibility
* @return object
*
* @throws FailedUploadException
*/
public function upload($image, $path = null, $visibility = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/GeneratePlaceholders.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function handle()
/**
* If package was upgraded from <= 0.16 it could be missing width, height & size.
*
* @param Image $image
* @param Image $image
*/
protected function maybeUpgrade(Image $image)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Contracts/DimensionCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ interface DimensionCalculator
public function __construct($originalWidth, $originalHeight, $originalSize);

/**
* @param int $width
* @param int $height
* @param int $width
* @param int $height
* @return Collection
*/
public function calculateDimensions($width, $height): Collection;
Expand Down
8 changes: 4 additions & 4 deletions src/FileSizeOptimizedDimensionCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public function __construct($originalWidth, $originalHeight, $originalSize)
}

/**
* @param int $width
* @param int $height
* @param int $width
* @param int $height
* @return Collection
*/
public function calculateDimensions($width, $height): Collection
Expand All @@ -50,8 +50,8 @@ public function calculateDimensions($width, $height): Collection
}

/**
* @param int $predictedFileSize
* @param int $newWidth
* @param int $predictedFileSize
* @param int $newWidth
* @return bool
*/
protected function finishedCalculating(int $predictedFileSize, int $newWidth): bool
Expand Down
2 changes: 1 addition & 1 deletion src/HasDimensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getWidth()

/**
* @param $width
* @param null $height
* @param null $height
* @return $this
*/
public function setDimensions($width, $height = null)
Expand Down
2 changes: 1 addition & 1 deletion src/HasImages.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function images()
}

/**
* @param null $tag
* @param null $tag
* @return Image
*/
public function image($tag = null)
Expand Down
11 changes: 6 additions & 5 deletions src/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public static function boot()
}

/**
* @param File|UploadedFile $file
* @param string | null $path
* @param string | null $visibility
* @param File|UploadedFile $file
* @param string | null $path
* @param string | null $visibility
* @return Image
*/
public static function upload($file, $path = null, $visibility = null)
Expand Down Expand Up @@ -124,7 +124,7 @@ public function placeholder()
}

/**
* @param Image $image
* @param Image $image
* @return Image
*/
public function replaceWith(self $image)
Expand All @@ -141,7 +141,7 @@ public function replaceWith(self $image)

/**
* @param $attachable
* @param null $tag
* @param null $tag
* @return $this
*/
public function reserveFor($attachable, $tag = null)
Expand All @@ -162,6 +162,7 @@ public function getAspectRatioAttribute()

/**
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|string
*
* @throws \Throwable
*/
public function __toString()
Expand Down
14 changes: 8 additions & 6 deletions src/ImageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct($url)
}

/**
* @param ResponsiveImage $image
* @param ResponsiveImage $image
* @return ImageFactory
*/
public static function make(ResponsiveImage $image)
Expand Down Expand Up @@ -85,6 +85,7 @@ public function get()

/**
* @return ResponsiveImageFactory
*
* @throws \Throwable
*/
public function responsive()
Expand All @@ -96,6 +97,7 @@ public function responsive()

/**
* @return string
*
* @throws \Throwable
*/
public function getContents()
Expand All @@ -110,7 +112,7 @@ public function getContents()
// _________________________________________________________________________________________________________________

/**
* @param int $percentage
* @param int $percentage
* @return ImageFactory
*/
public function blur($percentage = 5)
Expand All @@ -121,7 +123,7 @@ public function blur($percentage = 5)
/**
* @param $width
* @param $height
* @param string $mode
* @param string $mode
* @return ImageFactory
*/
public function crop($width, $height, $mode = 'c')
Expand Down Expand Up @@ -213,7 +215,7 @@ public function getDisplayWidth()
}

/**
* @param Closure $transformation
* @param Closure $transformation
* @return $this
*/
protected function transform(Closure $transformation)
Expand All @@ -237,8 +239,8 @@ protected function addExtraOption($value, $options)
}

/**
* @param mixed $value
* @param array $options
* @param mixed $value
* @param array $options
* @return array
*/
protected function setSizingOption($value, $options)
Expand Down
4 changes: 2 additions & 2 deletions src/Jobs/DeleteCloudImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DeleteCloudImage implements ShouldQueue
/**
* Create a new job instance.
*
* @param string $path
* @param string $path
*/
public function __construct($path)
{
Expand All @@ -31,7 +31,7 @@ public function __construct($path)
/**
* Execute the job.
*
* @param Client $client
* @param Client $client
*/
public function handle(Client $client)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Nova/Fields/CloudImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
class CloudImage extends ImageField
{
/**
* @param string $name
* @param string|null $attribute
* @param string $name
* @param string|null $attribute
* @return void
*/
public function __construct($name, $attribute = null)
Expand Down
9 changes: 5 additions & 4 deletions src/ResponsiveImageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ class ResponsiveImageFactory implements Arrayable, JsonSerializable

/**
* ResponsiveImageFactory constructor.
* @param ResponsiveImage $image
* @param ImageFactory|null $factory
*
* @param ResponsiveImage $image
* @param ImageFactory|null $factory
*/
public function __construct(ResponsiveImage $image, ImageFactory $factory = null)
{
Expand Down Expand Up @@ -74,7 +75,7 @@ public function getDimensions()
}

/**
* @param array $attributes
* @param array $attributes
* @return string
*/
public function getHtml(array $attributes = [])
Expand Down Expand Up @@ -165,7 +166,7 @@ protected function usingPlaceholder()
}

/**
* @param array $attributes
* @param array $attributes
* @return string
*/
protected function attributesToString(array $attributes)
Expand Down
3 changes: 2 additions & 1 deletion src/TinyPlaceholder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TinyPlaceholder implements ResponsiveImageVersion
protected $image;

/**
* @param ResponsiveImage $image
* @param ResponsiveImage $image
*/
public function __construct(ResponsiveImage $image)
{
Expand All @@ -34,6 +34,7 @@ public function factory()

/**
* @return string
*
* @throws \Throwable
*/
public function create()
Expand Down
1 change: 1 addition & 0 deletions tests/Fakes/FakeGuzzleClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class FakeGuzzleClient

/**
* FakeGuzzleClient constructor.
*
* @param $status
*/
public function __construct($status = 200)
Expand Down
1 change: 1 addition & 0 deletions tests/Fakes/FakeGuzzleResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class FakeGuzzleResponse

/**
* FakeGuzzleClient constructor.
*
* @param $client
* @param $request
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Fakes/FakeTinyPlaceholder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public function testActualFactory($bool = true)

public function factory()
{
$factory = new class($this->testImageUrl()) extends ImageFactory {
$factory = new class($this->testImageUrl()) extends ImageFactory
{
public static $shouldMock;

public function getContents()
Expand Down
3 changes: 2 additions & 1 deletion tests/Feature/HasMultipleImagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public function it_finds_attachables_for_a_given_model()
/** @test **/
public function it_uses_the_specified_image_class_property_for_the_relationship()
{
$product = new class extends Product {
$product = new class extends Product
{
protected $useImageModel = ProductImage::class;
};

Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/ImageFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected function cloudImage()
}

/**
* @param string $params
* @param string $params
* @return string
*/
protected function url($params = null)
Expand Down
12 changes: 6 additions & 6 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function fakeServices()
}

/**
* @param int $status
* @param int $status
*/
public function failHttpRequest($status = 400)
{
Expand All @@ -79,10 +79,10 @@ public function failHttpRequest($status = 400)
}

/**
* @param string $path
* @param int $width
* @param int $height
* @param int $size
* @param string $path
* @param int $width
* @param int $height
* @param int $size
* @return Image
*/
protected function image($path = null, $width = 1000, $height = 1000, $size = null)
Expand Down Expand Up @@ -115,7 +115,7 @@ protected function area($x, $y)
}

/**
* @param bool $bool
* @param bool $bool
* @return FakeTinyPlaceholder
*/
protected function usePlaceholders($bool = true)
Expand Down

0 comments on commit 251248c

Please sign in to comment.