Skip to content

Commit

Permalink
Merge pull request #46 from makeabledk/feat/php-8
Browse files Browse the repository at this point in the history
Merge feat/php-8
  • Loading branch information
rasmuscnielsen authored Jan 26, 2022
2 parents 208ed02 + 251248c commit fda4e2c
Show file tree
Hide file tree
Showing 20 changed files with 95 additions and 85 deletions.
65 changes: 33 additions & 32 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
name: Run tests

on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
push:
pull_request:
schedule:
- cron: '0 0 * * *'

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
php: [7.3, 7.4, 8.0]
laravel: [6.*, 7.*, 8.*]
dependency-version: [prefer-lowest, prefer-stable]

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

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [8.0,8.1]
laravel: [8.*,9.*]
dependency-version: [prefer-lowest,prefer-stable]

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

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit
22 changes: 10 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,21 @@
}
},
"require": {
"php": ">=7.3.0|8.*",
"illuminate/container": "6.*|7.*|8.*",
"illuminate/filesystem": "6.*|7.*|8.*",
"illuminate/support": "6.*|7.*|8.*",
"superbalist/laravel-google-cloud-storage": "^1.0|^2.2",
"guzzlehttp/guzzle": "^6.3|^7.0.1"
"php": "^8.0",
"illuminate/container": "^8.80|9.*",
"illuminate/filesystem": "^8.80|9.*",
"illuminate/support": "^8.80|9.*",
"superbalist/laravel-google-cloud-storage": "^2.2",
"guzzlehttp/guzzle": "^7.0"
},
"require-dev": {
"codedungeon/phpunit-result-printer": "^0.30.0",
"laravel/laravel": "6.*|7.*|8.*",
"laravel/laravel": "8.*|9.*",
"intervention/image": "^2.4",
"doctrine/dbal": "^3.0",
"mockery/mockery": "^1.4.2",
"rutorika/sortable": "^4.2|^6.0|^7.0",
"phpunit/phpunit": "8.*|9.*",
"fzaninotto/faker": "^1.4",
"league/flysystem": "^1.0.8"
"mockery/mockery": "^1.5",
"rutorika/sortable": "8.*",
"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
Loading

0 comments on commit fda4e2c

Please sign in to comment.