diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b678aaf --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + timeout-minutes: 20 + + strategy: + fail-fast: false + matrix: + php-version: ['8.3', '8.4'] + + name: Tests (PHP ${{ matrix.php-version }}) + + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + + - name: Set up PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2 + with: + php-version: ${{ matrix.php-version }} + coverage: none + + - name: Install Composer dependencies + run: composer install --no-interaction --prefer-dist + + - name: Run tests + run: composer test diff --git a/.gitignore b/.gitignore index 3412abb..0c73d15 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ vendor .idea coverage +.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2798880..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: php -php: - - 7.1 - - 7.2 -before_script: - - composer self-update - - composer update -script: - - composer test - - vendor/bin/phpunit --coverage-clover=coverage.xml -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index 581fac0..909bafa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,3 @@ # File -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/demvsystems/file/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/demvsystems/file/?branch=master) -[![Build Status](https://travis-ci.org/demvsystems/file.svg?branch=master)](https://travis-ci.org/demvsystems/file) -[![Build Status](https://scrutinizer-ci.com/g/demvsystems/file/badges/build.png?b=master)](https://scrutinizer-ci.com/g/demvsystems/file/build-status/master) -[![codecov](https://codecov.io/gh/demvsystems/file/branch/master/graph/badge.svg)](https://codecov.io/gh/demvsystems/file) +[![CI](https://github.com/demvsystems/file/actions/workflows/ci.yml/badge.svg)](https://github.com/demvsystems/file/actions/workflows/ci.yml) diff --git a/composer.json b/composer.json index bdb3447..000e278 100644 --- a/composer.json +++ b/composer.json @@ -12,9 +12,9 @@ } ], "require": { - "php": ">=7.4", + "php": ">=8.3", "dgame/php-ensurance": "^2.0", - "ralouphie/mimey": "dev-master" + "elephox/mimey": "^4.0" }, "require-dev": { "phpunit/phpunit": "^9", @@ -31,16 +31,9 @@ }, "config": { "platform": { - "php": "7.4.33" + "php": "8.3.0" } }, - "repositories": [ - { - "type": "git", - "url": "git@github.com:demvsystems/mimey.git", - "no-api": true - } - ], "scripts": { "test": [ "phpunit" diff --git a/composer.lock b/composer.lock index 18af8ab..04b5b2f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ba0e66c427279492029cc9dc5c93d6d8", + "content-hash": "d54f33fb819cc7b2ed8fc1270f8fa090", "packages": [ { "name": "dgame/php-ensurance", @@ -125,32 +125,39 @@ "time": "2021-07-04T19:08:58+00:00" }, { - "name": "ralouphie/mimey", - "version": "dev-master", + "name": "elephox/mimey", + "version": "4.0.9", "source": { "type": "git", - "url": "git@github.com:demvsystems/mimey.git", - "reference": "38fd1be84732ab96591437b86a0266c08d457564" + "url": "https://github.com/elephox-dev/mimey.git", + "reference": "c45704c46b4580a0b1e32e7a9ae39a72f24969c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/elephox-dev/mimey/zipball/c45704c46b4580a0b1e32e7a9ae39a72f24969c3", + "reference": "c45704c46b4580a0b1e32e7a9ae39a72f24969c3", + "shasum": "" }, "require": { - "php": ">=7.4" + "jetbrains/phpstorm-attributes": "^1.0", + "php": "^8.1 <9.0" }, "require-dev": { - "php-coveralls/php-coveralls": "^2", - "phpunit/phpunit": "^9" + "phpunit/phpunit": "^10" + }, + "suggest": { + "ext-mbstring": "For non-English (user) input parsing" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { - "Mimey\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Mimey\\Tests\\": "tests/src/" + "Elephox\\Mimey\\": [ + "src/", + "dist/" + ] } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -158,10 +165,59 @@ { "name": "Ralph Khattar", "email": "ralph.khattar@gmail.com" + }, + { + "name": "Ricardo Boss", + "email": "contact@ricardoboss.de" } ], "description": "PHP package for converting file extensions to MIME types and vice versa.", - "time": "2022-11-14T10:53:42+00:00" + "support": { + "issues": "https://github.com/elephox-dev/mimey/issues", + "source": "https://github.com/elephox-dev/mimey/tree/4.0.9" + }, + "time": "2026-05-16T09:21:05+00:00" + }, + { + "name": "jetbrains/phpstorm-attributes", + "version": "1.3", + "source": { + "type": "git", + "url": "https://github.com/JetBrains/phpstorm-attributes", + "reference": "c9afb897cad47b087457f667ec2156dde8aed926" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JetBrains/phpstorm-attributes/zipball/c9afb897cad47b087457f667ec2156dde8aed926", + "reference": "c9afb897cad47b087457f667ec2156dde8aed926", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "JetBrains\\PhpStorm\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "JetBrains", + "homepage": "https://www.jetbrains.com" + } + ], + "description": "PhpStorm specific attributes", + "keywords": [ + "attributes", + "jetbrains", + "phpstorm" + ], + "support": { + "issues": "https://youtrack.jetbrains.com/newIssue?project=WI" + }, + "time": "2026-07-22T11:27:58+00:00" } ], "packages-dev": [ @@ -213,30 +269,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.5.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^11", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.30 || ^5.4" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -263,7 +319,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -279,24 +335,24 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.13.4", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a" + "reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a", - "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae", + "reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.0" }, "conflict": { "doctrine/collections": "<1.6.8", @@ -331,32 +387,31 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" + "source": "https://github.com/myclabs/DeepCopy/tree/1.14.0" }, "funding": [ { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" + "url": "https://github.com/mnapoli", + "type": "github" } ], - "time": "2025-08-01T08:46:24+00:00" + "time": "2026-08-11T10:17:44+00:00" }, { "name": "nikic/php-parser", - "version": "v5.7.0", + "version": "v5.8.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82" + "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82", - "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/044a6a392ff8ad0d61f14370a5fbbd0a0107152f", + "reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f", "shasum": "" }, "require": { - "ext-ctype": "*", "ext-json": "*", "ext-tokenizer": "*", "php": ">=7.4" @@ -395,9 +450,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.8.0" }, - "time": "2025-12-06T11:56:16+00:00" + "time": "2026-07-04T14:30:18+00:00" }, { "name": "phar-io/manifest", @@ -1706,16 +1761,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "4.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "c85be6922b7fd365942b986b9a50397d65407611" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/c85be6922b7fd365942b986b9a50397d65407611", + "reference": "c85be6922b7fd365942b986b9a50397d65407611", "shasum": "" }, "require": { @@ -1757,15 +1812,27 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.7" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" } ], - "time": "2023-02-03T06:07:39+00:00" + "time": "2026-08-11T05:25:24+00:00" }, { "name": "sebastian/resource-operations", @@ -1983,17 +2050,15 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "ralouphie/mimey": 20 - }, + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.4" + "php": ">=8.3" }, "platform-dev": {}, "platform-overrides": { - "php": "7.4.33" + "php": "8.3.0" }, "plugin-api-version": "2.9.0" } diff --git a/src/MimeTypesFactory.php b/src/MimeTypesFactory.php index 85e6333..513cefb 100644 --- a/src/MimeTypesFactory.php +++ b/src/MimeTypesFactory.php @@ -2,8 +2,8 @@ namespace DEMV\File; -use Mimey\MimeMappingBuilder; -use Mimey\MimeTypes; +use Elephox\Mimey\MimeMappingBuilder; +use Elephox\Mimey\MimeTypes; /** * Class MimeExtensions