feat: drop PHP 8.1 support and add PHP 8.5 support#502
Open
cedricziel wants to merge 41 commits intoopen-telemetry:mainfrom
Open
feat: drop PHP 8.1 support and add PHP 8.5 support#502cedricziel wants to merge 41 commits intoopen-telemetry:mainfrom
cedricziel wants to merge 41 commits intoopen-telemetry:mainfrom
Conversation
- 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
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
0597964 to
8328c19
Compare
- 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
fe51fed to
3231150
Compare
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.
This reverts commit 784963e.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
CI/GitHub Actions
['8.1', '8.2', '8.3', '8.4']to['8.2', '8.3', '8.4', '8.5']Composer Files (39 files)
phpconstraint from^8.1to^8.2in 37 packagesphpconstraint from>=8.1to>=8.2Test Plan
composer validatepasses on all packages