Skip to content

Comments

feat: drop PHP 8.1 support and add PHP 8.5 support#502

Open
cedricziel wants to merge 41 commits intoopen-telemetry:mainfrom
cedricziel:feat/php-8.5-support
Open

feat: drop PHP 8.1 support and add PHP 8.5 support#502
cedricziel wants to merge 41 commits intoopen-telemetry:mainfrom
cedricziel:feat/php-8.5-support

Conversation

@cedricziel
Copy link
Contributor

Summary

  • Drop PHP 8.1 support across all packages
  • Add PHP 8.5 support to CI matrix and all packages

Changes

CI/GitHub Actions

  • Update PHP version matrix from ['8.1', '8.2', '8.3', '8.4'] to ['8.2', '8.3', '8.4', '8.5']
  • Remove PHP 8.1 exclusions (no longer needed since 8.1 is dropped)
  • Update code coverage generation from PHP 8.4 to PHP 8.5

Composer Files (39 files)

  • Update php constraint from ^8.1 to ^8.2 in 37 packages
  • Update MongoDB php constraint from >=8.1 to >=8.2

Test Plan

  • CI passes on PHP 8.2, 8.3, 8.4, and 8.5
  • All package tests pass
  • composer validate passes on all packages

- Update CI matrix from PHP 8.1-8.4 to PHP 8.2-8.5
- Remove PHP 8.1 exclusions from workflow (no longer needed)
- Update code coverage to run on PHP 8.5 (latest)
- Update PHP version constraint from ^8.1 to ^8.2 in 37 composer.json files
- Update MongoDB PHP constraint from >=8.1 to >=8.2
@cedricziel cedricziel requested a review from a team as a code owner January 22, 2026 07:47
Update target_php_version in 7 phan config files to match the new
minimum PHP version requirement.
- Update Makefile example to use PHP 8.2
- Update phpunit.xml.dist phpVersion to 8.2
- Update .php-cs-fixer.php comments to clarify php8.1+ syntax
- Remove unused Psalm suppression for UndefinedInterfaceMethod in
  Sampler/RuleBased
- Remove deprecated TraceAttributes::EXCEPTION_ESCAPED usage in
  Symfony instrumentation
- Fix Yii RequestPropagationGetter to handle empty arrays properly
- Add MissingTemplateParam suppression for Yii test fixtures
Add @extends Controller<\yii\base\Module> annotation to SiteController
test fixture instead of suppressing MissingTemplateParam globally.
- Add missing TraceResponsePropagator import in Symfony test
- Suppress Psalm NoValue error in Yii RequestPropagationGetter
- Remove obsolete PHPStan ignore pattern from Sampler/RuleBased
- Remove Unit81 exclusions from .php-cs-fixer.php files (no longer
  needed with PHP 8.2 minimum)
- Update README example to use PHP 8.2
The tests/Unit81 directory contains first-class callable syntax
(var_dump(...)) which php-cs-fixer has trouble parsing.
Update all packages to allow Psalm 7 beta (^6.4 || ^7.0@beta) which
adds support for PHP 8.5. Psalm 7.0.0-beta14 supports PHP 8.5.
Add rector/rector to manage #[\Override] attributes which are now
required by Psalm 7 for overridden methods.

Run with: composer install && vendor/bin/rector
@cedricziel cedricziel force-pushed the feat/php-8.5-support branch from 0597964 to 8328c19 Compare January 22, 2026 08:39
- Add rector/rector ^2.0 to all packages for PHP 8.2+ code upgrades
- Add rector.php config to each package with withPhpSets(php82: true)
- Add rector, rector-dry-run, and rector-all targets to Makefile
- Add rector dry-run step to CI workflow
- Upgrade phpstan/phpstan from ^1.4 to ^2.1 for Rector compatibility
- Upgrade phpstan/phpstan-phpunit from ^1.0 to ^2.0
- Upgrade phpstan/phpstan-mockery from ^1.1 to ^2.0
- Upgrade jangregor/phpstan-prophecy from ^1.0 to ^2.0
- Add composer cache volume to docker-compose for faster builds
- Apply #[\Override] attributes via rector where applicable
- Add rector.php for OtelBundle and OtelSdkBundle sub-packages
- Add rector to require-dev in both sub-bundle composer.json files
- Add Symfony/src/OtelBundle and Symfony/src/OtelSdkBundle to PACKAGES
- Fix Makefile variable override: allow PROJECT and PHP_VERSION to be
  overridden via environment variables (previously .env always won)
- Add Override attributes to Symfony bundle methods via rector
- Update all rector.php configs to use PHPUnit sets (PHPUNIT_100)
- Change setUp/tearDown from public to protected (PHPUnit 10 compat)
- Add #[\Override] attributes to setUp/tearDown methods
- Fix anonymous class interface implementations with Override
- Apply StaticDataProviderClassMethodRector where needed
- Convert data providers to static methods (PHPUnit 10 requirement)
- Apply readonly class modifier where applicable (PHP 8.2)
- Add vendor skip to Symfony rector config
- Add #[\Override] to Context/Swoole classes (SwooleContextStorage, SwooleContextScope)
- Add #[\Override] to Propagation files (TraceResponsePropagator, HeadersPropagator variants)
- Add #[\Override] to Sampler/RuleBased ComponentProvider classes
- Remove duplicate #[\Override] attributes in test files

These changes are required for Psalm 7 MissingOverrideAttribute checks.
- Remove duplicate Override attributes from 19 test files
- Remove unused 'use Override;' imports from test files
- Fixes PHP 8.3+ syntax errors caused by non-repeatable attribute
Add Override attributes to methods implementing:
- ResourceDetectorInterface (getResource)
- SamplerInterface (shouldSample, getDescription)
- TextMapPropagatorInterface (fields, inject, extract)
- PropagationGetterInterface (keys, get)
- PropagationSetterInterface (set)
- InstrumentationInterface (multiple methods)
- RuleSetInterface (samplingRules, delegate)
Add targets to run psalm and php-cs-fixer across all packages,
similar to the existing rector-all target.
- Add #[\Override] attributes to interface implementations across all packages
  (Aws, OpenTracing, Symfony, Laravel, Psr6, Monolog)
- Remove incorrect #[\Override] from fields() in TraceResponse/ServerTiming
- Update phan/phan constraint from ^5.0 to ^6.0 in 46 composer.json files
  to resolve jsonmapper v5 dependency conflict on PHP 8.5
- Add PhanUndeclaredClassAttribute to suppress_issue_types in 39 Phan configs
  to handle #[\Override] attribute on PHP 8.2
- Fix always-true type assertions in ExtRdKafka, Swoole, Doctrine, Utils/Test
- Fix PDO strict comparison and type errors
- Fix PostgreSql named argument issue in tests
- Remove unnecessary PHPStan ignore comments in Instana exporter
- Fix InvalidOperand errors in Laravel watchers and Monolog benchmark
@cedricziel cedricziel force-pushed the feat/php-8.5-support branch from fe51fed to 3231150 Compare January 23, 2026 17:55
Phan 6.0 depends on cweagans/composer-patches to override the
tolerant-php-parser fork. Add it to allow-plugins in all 46
composer.json files that use phan.

This only affects development dependencies (require-dev), so
consumers of these packages are not impacted.
Phan 6.0 depends on cweagans/composer-patches to override the
tolerant-php-parser fork. Add it to allow-plugins via composer
config in the CI workflow instead of modifying all composer.json files.
The #[\Override] attribute is only available in PHP 8.3+, but Phan
running on PHP 8.2 reports PhanCompatibleOverrideAttribute errors.
Add this to suppress_issue_types alongside PhanUndeclaredClassAttribute.
The composer config commands need to run even when the vendor
directory is restored from cache, otherwise the plugin allowlist
isn't set and composer operations fail.
- Use grpc extension version 1.78.0RC2 for PHP 8.5 compatibility
- Skip Phan on PHP 8.5 due to internal Phan 6.0 bug with TMockObject
PSR-7 getHeader() returns an array, so assertNotNull is always true.
Use assertNotEmpty to properly check that the traceparent header exists.
PSR-7 getHeaderLine() returns a string, so assertNotNull is always true.
Use assertNotEmpty to properly check that the traceparent header has a value.
Psalm and Rector don't support PHP 8.5 yet - their version constraints
only go up to ~8.4.3.
Fix PHP-CS-Fixer braces_position error by using arrow function
instead of anonymous function with empty body.
Fix Phan type mismatch by explicitly annotating the span variable type
before passing to finishMultiSpan(). Phan incorrectly infers the type
when array elements are modified in the same block.
Add TransportInterface<string> template parameter annotation to fix
Phan PhanGenericMissingParameters error.
Add Override attribute to matches() method in AttributeRule, LinkRule,
ParentRule, SpanKindRule, and SpanNameRule to satisfy Psalm's
MissingOverrideAttribute check.
When HeaderCollection::get() is called with $first=true (3rd param),
it always returns string|null, never an array. Remove the unnecessary
type check that PHPStan flagged as always-false.
The interface requires ?string return type but getHeaderLine() never
returns null. Add @phpstan-ignore annotation since we must match the
interface signature.
- Add PhanCompatibleOverrideAttribute to suppress_issue_types
- Remove duplicate @param annotations for $class parameters that
  already have @psalm-param class-string
- Add missing withSets and imports to Psr14/rector.php
- Include main bundle files in OtelBundle and OtelSdkBundle rector paths
Add Override attribute to methods in anonymous classes that implement
interfaces or extend parent classes in SlimInstrumentationTest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant