Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/php-syntax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
php: [ '7.3', '7.4', '8.0', '8.1', '8.2' ]
php: [ '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v6

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -49,7 +49,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer dependencies
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
uses: actions/cache@v5
env:
cache-name: cache-composer-dependencies
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v6

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -44,7 +44,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer dependencies
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
uses: actions/cache@v5
env:
cache-name: cache-composer-dependencies
with:
Expand All @@ -55,4 +55,4 @@ jobs:
run: composer install

- name: Run PHPUnit tests
run: composer run lint
run: composer run lint
6 changes: 3 additions & 3 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v6

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -44,7 +44,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer dependencies
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
uses: actions/cache@v5
env:
cache-name: cache-composer-dependencies
with:
Expand All @@ -55,4 +55,4 @@ jobs:
run: composer install

- name: Run PHPUnit tests
run: composer run phpstan
run: composer run phpstan
8 changes: 4 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
php: [ '7.3', '7.4', '8.0', '8.1', '8.2' ]
php: [ '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
include:
- php: '7.3'
os: ubuntu-latest
report: true

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v6

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -53,7 +53,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer dependencies
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
uses: actions/cache@v5
env:
cache-name: cache-composer-dependencies
with:
Expand All @@ -70,4 +70,4 @@ jobs:
if: ${{ matrix.report }}
run: |
vendor/bin/phpunit --verbose --coverage-clover=tmp/coverage/report-xml/php-coverage1.xml
bash <(curl -s https://codecov.io/bash);
bash <(curl -s https://codecov.io/bash);
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"source": "https://github.com/gravitypdf/upload"
},
"require": {
"php": "^7.3 || ~8.0.0 || ~8.1.0 || ~8.2.0",
"php": "^7.3 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"ext-fileinfo": "*"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Upload/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Exception extends RuntimeException
* @param string $message The Exception message
* @param FileInfoInterface|null $fileInfo The related file instance
*/
public function __construct($message, FileInfoInterface $fileInfo = null)
public function __construct($message, ?FileInfoInterface $fileInfo = null)
{
$this->fileInfo = $fileInfo;

Expand Down
13 changes: 8 additions & 5 deletions src/Upload/FileInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class FileInfo extends SplFileInfo implements FileInfoInterface
* @param string $filePathname Absolute path to uploaded file on disk
* @param string|null $newName Desired file name (with extension) of uploaded file
*/
final public function __construct(string $filePathname, string $newName = null)
final public function __construct(string $filePathname, ?string $newName = null)
{
$desiredName = is_null($newName) ? $filePathname : $newName;
$this->setNameWithExtension($desiredName);
Expand All @@ -90,7 +90,7 @@ public static function setFactory(callable $callable): void
static::$factory = $callable;
}

public static function createFromFactory(string $tmpName, string $name = null): FileInfoInterface
public static function createFromFactory(string $tmpName, ?string $name = null): FileInfoInterface
{
if (is_callable(static::$factory)) {
$result = call_user_func(static::$factory, $tmpName, $name);
Expand Down Expand Up @@ -336,11 +336,14 @@ public function getHash(string $algorithm = 'md5'): string
*/
public function getDimensions(): array
{
[$width, $height] = (array)getimagesize($this->getPathname());
$imageSize = getimagesize($this->getPathname());
if (!$imageSize) {
$imageSize = [0,0];
}

return [
'width' => $width ?? 0,
'height' => $height ?? 0,
'width' => $imageSize[0],
'height' => $imageSize[1],
];
}

Expand Down
Loading