Skip to content

Commit b628f4d

Browse files
authored
chore(deps): upgrade PHPUnit to ^13 to clear security advisories (#216)
* chore(deps): upgrade PHPUnit to ^13 to clear security advisories Bump phpunit/phpunit from ^11.5 to ^13.0 since all reachable 11.5.x releases are now blocked by Packagist advisories (PKSA-5jz8-6tcw-pbk4, PKSA-z3gr-8qht-p93v). PHPUnit 13 requires PHP 8.4+, so the PHPUnit CI job narrows to 8.4 only. To preserve declared runtime compatibility with PHP 8.2/8.3, PHPStan now analyses against a phpVersion range (min: 80200, max: 80400) — catching both too-new syntax and features removed before 8.4. PHPStan still runs in CI across 8.2/8.3/8.4 as the static replacement for the dropped PHPUnit coverage. PHP-CS-Fixer matrix collapses to PHP 8.2 only (its output is deterministic across runtimes; 8.2 is the lowest supported, matching the tool's own guidance). Also removes redundant @coversDefaultClass doc-comments from three test files; each already carries an equivalent #[CoversClass] attribute. * fix(ci): unblock PHPUnit coverage run and narrow PHPStan matrix PHPUnit 13 rejects #[CoversClass] targets outside the <source> coverage include when --coverage-clover is active. DummyLoggerService and DummyMeterService live in the test application (tests/Functional/Application/src), so the attributes were already incorrect — drop them; these are functional integration tests, not unit coverage tests. Locally masked by XDEBUG_MODE=off in composer run test. Narrow PHPStan CI matrix to PHP 8.4 only. Installing project vendor on 8.2/8.3 now fails because phpunit/phpunit ^13 requires PHP 8.4+. Cross-version static analysis is driven by phpVersion: {min: 80200, max: 80400} in phpstan.neon and is runtime-independent — running PHPStan on three PHP versions was redundant.
1 parent 6a48d3a commit b628f4d

9 files changed

Lines changed: 5 additions & 27 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ jobs:
1717
matrix:
1818
php:
1919
- '8.2'
20-
- '8.3'
21-
- '8.4'
2220
fail-fast: false
2321
steps:
2422
- name: Checkout
@@ -49,8 +47,6 @@ jobs:
4947
strategy:
5048
matrix:
5149
php:
52-
- '8.2'
53-
- '8.3'
5450
- '8.4'
5551
fail-fast: false
5652
steps:
@@ -95,21 +91,13 @@ jobs:
9591
strategy:
9692
matrix:
9793
php:
98-
- '8.2'
99-
- '8.3'
10094
- '8.4'
10195
dependencies:
10296
- 'highest'
10397
include:
10498
- php: '8.4'
10599
dependencies: 'highest'
106100
coverage: true
107-
- php: '8.3'
108-
dependencies: 'highest'
109-
coverage: true
110-
- php: '8.2'
111-
dependencies: 'highest'
112-
coverage: true
113101
fail-fast: false
114102
steps:
115103
- name: Checkout

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"open-telemetry/exporter-otlp": "^1",
6060
"open-telemetry/exporter-zipkin": "^1",
6161
"open-telemetry/transport-grpc": "^1",
62-
"phpunit/phpunit": "^11.5",
62+
"phpunit/phpunit": "^13.0",
6363
"pyrech/composer-changelogs": "^2.2",
6464
"roave/security-advisories": "dev-master",
6565
"symfony/browser-kit": "^7.4",

phpstan.neon

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ includes:
22
- phpstan-baseline.neon
33

44
parameters:
5-
phpVersion: 80200
5+
phpVersion:
6+
min: 80200
7+
max: 80400
68
level: 6
79
paths:
810
- src/

phpunit.xml.dist

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"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/13.0/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
55
executionOrder="depends,defects"
66
beStrictAboutOutputDuringTests="true"

tests/Functional/DummyLoggerServiceTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
use Monolog\Level;
1010
use OpenTelemetry\SDK\Logs\ReadableLogRecord;
1111
use OpenTelemetry\SDK\Trace\StatusData;
12-
use PHPUnit\Framework\Attributes\CoversClass;
1312
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1413
use Zalas\PHPUnit\Globals\Attribute\Env;
1514

1615
#[Env('KERNEL_CLASS', Kernel::class)]
17-
#[CoversClass(DummyLoggerService::class)]
1816
class DummyLoggerServiceTest extends KernelTestCase
1917
{
2018
use LoggingTestCaseTrait;

tests/Functional/DummyMeterServiceTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
use App\Service\DummyMeterService;
77
use OpenTelemetry\SDK\Metrics\Data\HistogramDataPoint;
88
use OpenTelemetry\SDK\Metrics\Data\NumberDataPoint;
9-
use PHPUnit\Framework\Attributes\CoversClass;
109
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1110
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
1211
use Zalas\PHPUnit\Globals\Attribute\Env;
1312

1413
#[Env('KERNEL_CLASS', Kernel::class)]
15-
#[CoversClass(DummyMeterService::class)]
1614
final class DummyMeterServiceTest extends KernelTestCase
1715
{
1816
use MeterTestCaseTrait;

tests/Unit/OpenTelemetry/Exporter/OtlpExporterOptionsTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
use PHPUnit\Framework\TestCase;
1313

1414
/**
15-
* @coversDefaultClass \FriendsOfOpenTelemetry\OpenTelemetryBundle\OpenTelemetry\Exporter\OtlpExporterOptions
16-
*
1715
* @phpstan-import-type ExporterOptions from ExporterOptionsInterface
1816
*/
1917
#[CoversClass(OtlpExporterOptions::class)]

tests/Unit/OpenTelemetry/Trace/SpanProcessor/NoopSpanProcessorFactoryTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
use PHPUnit\Framework\Attributes\CoversClass;
77
use PHPUnit\Framework\TestCase;
88

9-
/**
10-
* @coversDefaultClass \FriendsOfOpenTelemetry\OpenTelemetryBundle\OpenTelemetry\Trace\SpanProcessor\NoopSpanProcessorFactory
11-
*/
129
#[CoversClass(NoopSpanProcessorFactory::class)]
1310
class NoopSpanProcessorFactoryTest extends TestCase
1411
{

tests/Unit/OpenTelemetry/Trace/SpanProcessor/SimpleSpanProcessorFactoryTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
use PHPUnit\Framework\Attributes\CoversClass;
1111
use PHPUnit\Framework\TestCase;
1212

13-
/**
14-
* @coversDefaultClass \FriendsOfOpenTelemetry\OpenTelemetryBundle\OpenTelemetry\Trace\SpanProcessor\SimpleSpanProcessorFactory
15-
*/
1613
#[CoversClass(SimpleSpanProcessorFactory::class)]
1714
class SimpleSpanProcessorFactoryTest extends TestCase
1815
{

0 commit comments

Comments
 (0)