Skip to content

Commit 0d3c73f

Browse files
Add support for PHP 8.5
1 parent 9fa00ba commit 0d3c73f

File tree

8 files changed

+24
-19
lines changed

8 files changed

+24
-19
lines changed

.cs.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'array_syntax' => ['syntax' => 'short'],
2020
'cast_spaces' => ['space' => 'none'],
2121
'concat_space' => ['spacing' => 'one'],
22-
'compact_nullable_typehint' => true,
22+
'compact_nullable_type_declaration' => true,
2323
'declare_equal_normalize' => ['space' => 'single'],
2424
'general_phpdoc_annotation_remove' => [
2525
'annotations' => [
@@ -36,7 +36,11 @@
3636
'phpdoc_order' => true, // psr-5
3737
'phpdoc_no_useless_inheritdoc' => false,
3838
'protected_to_private' => false,
39-
'yoda_style' => false,
39+
'yoda_style' => [
40+
'equal' => false,
41+
'identical' => false,
42+
'less_and_greater' => false
43+
],
4044
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
4145
'ordered_imports' => [
4246
'sort_algorithm' => 'alpha',

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
operating-system: [ ubuntu-latest ]
11-
php-versions: [ '8.1', '8.2' ]
11+
php-versions: [ '8.2', '8.3', '8.4', '8.5' ]
1212
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
1313

1414
steps:

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2023 odan
3+
Copyright (c) 2026 odan
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Audio format detection library for PHP.
3535

3636
## Requirements
3737

38-
* PHP 8.1+
38+
* PHP 8.1 - 8.5
3939

4040
## Installation
4141

composer.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
],
1111
"homepage": "https://github.com/selective-php/audio-type",
1212
"require": {
13-
"php": "^7.3 || ^8.0"
13+
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0"
1414
},
1515
"require-dev": {
1616
"friendsofphp/php-cs-fixer": "^3",
17-
"phpstan/phpstan": "^1",
18-
"phpunit/phpunit": "^10",
19-
"squizlabs/php_codesniffer": "^3"
17+
"phpstan/phpstan": "^2",
18+
"phpunit/phpunit": "^11",
19+
"squizlabs/php_codesniffer": "^4"
2020
},
2121
"autoload": {
2222
"psr-4": {
@@ -33,23 +33,24 @@
3333
},
3434
"scripts": {
3535
"cs:check": [
36-
"@putenv PHP_CS_FIXER_IGNORE_ENV=1",
37-
"php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php --ansi"
36+
"php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php --ansi --allow-unsupported-php-version=yes"
3837
],
3938
"cs:fix": [
40-
"@putenv PHP_CS_FIXER_IGNORE_ENV=1",
41-
"php-cs-fixer fix --config=.cs.php --ansi --verbose"
39+
"php-cs-fixer fix --config=.cs.php --ansi --verbose --allow-unsupported-php-version=yes"
4240
],
4341
"sniffer:check": "phpcs --standard=phpcs.xml",
4442
"sniffer:fix": "phpcbf --standard=phpcs.xml",
4543
"stan": "phpstan analyse -c phpstan.neon --no-progress --ansi",
46-
"test": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always",
44+
"test": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always --display-warnings --display-deprecations",
4745
"test:all": [
4846
"@cs:check",
4947
"@sniffer:check",
5048
"@stan",
5149
"@test"
5250
],
53-
"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"
51+
"test:coverage": [
52+
"@putenv XDEBUG_MODE=coverage",
53+
"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"
54+
]
5455
}
5556
}

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true"
3-
backupGlobals="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
3+
backupGlobals="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd"
44
cacheDirectory=".phpunit.cache" backupStaticProperties="false">
55
<coverage/>
66
<testsuites>

src/Detector/FlacDetector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function detect(SplFileObject $file): ?AudioType
2424
// Signature bytes
2525
$signature = (string)$file->fread(4);
2626

27-
return 'fLaC' === $signature ? new AudioType(
27+
return $signature === 'fLaC' ? new AudioType(
2828
AudioFormat::FLAC,
2929
AudioMimeType::AUDIO_FLAC
3030
) : null;

tests/AudioTypeDetectorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Selective\AudioType\Test;
44

5+
use PHPUnit\Framework\Attributes\DataProvider;
56
use PHPUnit\Framework\TestCase;
67
use Selective\AudioType\AudioFormat;
78
use Selective\AudioType\AudioMimeType;
@@ -34,14 +35,13 @@ private function createDetector(): AudioTypeDetector
3435
/**
3536
* Test.
3637
*
37-
* @dataProvider providerGetAudioTypeFromFile
38-
*
3938
* @param string $file The file
4039
* @param string $format The expected format
4140
* @param string $mime The expected mime type
4241
*
4342
* @return void
4443
*/
44+
#[DataProvider('providerGetAudioTypeFromFile')]
4545
public function testGetAudioTypeFromFile(string $file, string $format, string $mime): void
4646
{
4747
$this->assertFileExists($file);

0 commit comments

Comments
 (0)