diff --git a/.github/workflows/php-syntax.yml b/.github/workflows/php-syntax.yml index 3695bd5..119dd4d 100644 --- a/.github/workflows/php-syntax.yml +++ b/.github/workflows/php-syntax.yml @@ -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 @@ -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: diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index ab85593..12b999b 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -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 @@ -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: @@ -55,4 +55,4 @@ jobs: run: composer install - name: Run PHPUnit tests - run: composer run lint \ No newline at end of file + run: composer run lint diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 1ae8774..7fcbdfb 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -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 @@ -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: @@ -55,4 +55,4 @@ jobs: run: composer install - name: Run PHPUnit tests - run: composer run phpstan \ No newline at end of file + run: composer run phpstan diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 2565b20..ebc60a2 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -20,7 +20,7 @@ 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 @@ -28,7 +28,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v6 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -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: @@ -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); \ No newline at end of file + bash <(curl -s https://codecov.io/bash); diff --git a/composer.json b/composer.json index 80f4f88..edc87f9 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/src/Upload/Exception.php b/src/Upload/Exception.php index 5354646..4675384 100644 --- a/src/Upload/Exception.php +++ b/src/Upload/Exception.php @@ -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; diff --git a/src/Upload/FileInfo.php b/src/Upload/FileInfo.php index f2cec4d..dadc7e3 100644 --- a/src/Upload/FileInfo.php +++ b/src/Upload/FileInfo.php @@ -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); @@ -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); @@ -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], ]; }