diff --git a/.cs.php b/.cs.php index 2bba5e9..52c4c3e 100644 --- a/.cs.php +++ b/.cs.php @@ -19,7 +19,7 @@ 'array_syntax' => ['syntax' => 'short'], 'cast_spaces' => ['space' => 'none'], 'concat_space' => ['spacing' => 'one'], - 'compact_nullable_typehint' => true, + 'compact_nullable_type_declaration' => true, 'declare_equal_normalize' => ['space' => 'single'], 'general_phpdoc_annotation_remove' => [ 'annotations' => [ @@ -36,7 +36,11 @@ 'phpdoc_order' => true, // psr-5 'phpdoc_no_useless_inheritdoc' => false, 'protected_to_private' => false, - 'yoda_style' => false, + 'yoda_style' => [ + 'equal' => false, + 'identical' => false, + 'less_and_greater' => false + ], 'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'], 'ordered_imports' => [ 'sort_algorithm' => 'alpha', diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a4bf3d5..4c3d3a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: operating-system: [ ubuntu-latest ] - php-versions: [ '8.1', '8.2' ] + php-versions: [ '8.2', '8.3', '8.4', '8.5' ] name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} steps: diff --git a/LICENSE b/LICENSE index bf7a9a3..2013f40 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2023 odan +Copyright (c) 2026 odan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index effe168..17aea74 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Audio format detection library for PHP. ## Requirements -* PHP 8.1+ +* PHP 8.1 - 8.5 ## Installation diff --git a/composer.json b/composer.json index a01c3d2..fa9539e 100644 --- a/composer.json +++ b/composer.json @@ -10,13 +10,13 @@ ], "homepage": "https://github.com/selective-php/audio-type", "require": { - "php": "^7.3 || ^8.0" + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3", - "phpstan/phpstan": "^1", - "phpunit/phpunit": "^10", - "squizlabs/php_codesniffer": "^3" + "phpstan/phpstan": "^2", + "phpunit/phpunit": "^11", + "squizlabs/php_codesniffer": "^4" }, "autoload": { "psr-4": { @@ -33,23 +33,24 @@ }, "scripts": { "cs:check": [ - "@putenv PHP_CS_FIXER_IGNORE_ENV=1", - "php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php --ansi" + "php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php --ansi --allow-unsupported-php-version=yes" ], "cs:fix": [ - "@putenv PHP_CS_FIXER_IGNORE_ENV=1", - "php-cs-fixer fix --config=.cs.php --ansi --verbose" + "php-cs-fixer fix --config=.cs.php --ansi --verbose --allow-unsupported-php-version=yes" ], "sniffer:check": "phpcs --standard=phpcs.xml", "sniffer:fix": "phpcbf --standard=phpcs.xml", "stan": "phpstan analyse -c phpstan.neon --no-progress --ansi", - "test": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always", + "test": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always --display-warnings --display-deprecations", "test:all": [ "@cs:check", "@sniffer:check", "@stan", "@test" ], - "test:coverage": "php -d xdebug.mode=coverage -r \"require 'vendor/bin/phpunit';\" -- --configuration phpunit.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage" + "test:coverage": [ + "@putenv XDEBUG_MODE=coverage", + "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always --display-warnings --display-deprecations --coverage-clover build/coverage/clover.xml --coverage-html build/coverage --coverage-text" + ] } } diff --git a/phpunit.xml b/phpunit.xml index f97af40..9e3bbb2 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,6 @@ diff --git a/src/Detector/FlacDetector.php b/src/Detector/FlacDetector.php index b8553a0..edb24fd 100644 --- a/src/Detector/FlacDetector.php +++ b/src/Detector/FlacDetector.php @@ -24,7 +24,7 @@ public function detect(SplFileObject $file): ?AudioType // Signature bytes $signature = (string)$file->fread(4); - return 'fLaC' === $signature ? new AudioType( + return $signature === 'fLaC' ? new AudioType( AudioFormat::FLAC, AudioMimeType::AUDIO_FLAC ) : null; diff --git a/tests/AudioTypeDetectorTest.php b/tests/AudioTypeDetectorTest.php index 3d2ed83..43576f6 100644 --- a/tests/AudioTypeDetectorTest.php +++ b/tests/AudioTypeDetectorTest.php @@ -2,6 +2,7 @@ namespace Selective\AudioType\Test; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Selective\AudioType\AudioFormat; use Selective\AudioType\AudioMimeType; @@ -34,14 +35,13 @@ private function createDetector(): AudioTypeDetector /** * Test. * - * @dataProvider providerGetAudioTypeFromFile - * * @param string $file The file * @param string $format The expected format * @param string $mime The expected mime type * * @return void */ + #[DataProvider('providerGetAudioTypeFromFile')] public function testGetAudioTypeFromFile(string $file, string $format, string $mime): void { $this->assertFileExists($file);