From 1558b6abfad8100616acecbb0a20869fc7743148 Mon Sep 17 00:00:00 2001 From: bobstrecansky Date: Wed, 20 May 2026 08:29:22 -0400 Subject: [PATCH] Fix CI: suppress RepeatedField psalm errors, restore PHP 8.1 support Three issues are currently failing PHP QA on main: 1. Psalm reports 32 UndefinedDocblockClass errors against Google\Protobuf\Internal\RepeatedField on every Otlp converter. google/protobuf 4.x deprecated the Internal class in favor of Google\Protobuf\RepeatedField; the legacy name is now a runtime class_alias that Psalm's static parser cannot see. Add an UndefinedDocblockClass suppression alongside the existing UndefinedMethod suppression for the same class. 2. The PHP 8.1 matrix job fails composer install because phpspec/prophecy 1.26 dropped PHP 8.1 in 1.23 and requires phpdocumentor/reflection-docblock ^6, which itself needs prophecy 1.26. Revert both renovate bumps (#1915, #1919) to the prior constraints so the project's declared "php": "^8.1" support holds. 3. With Psalm fixed, PHPStan now runs and reports an undefined method Google\Protobuf\FieldDescriptor::getLabel() in ProtobufSerializer::traverseDescriptor(). That branch is dead code under google/protobuf >= 4.31 (the serializeToJsonString path returns early via PrintOptions), but PHPStan cannot infer that. See #1880, which reverted the prior compile-time fix for the same reason. Suppress the warning scoped to the one file. --- composer.json | 4 ++-- phpstan.neon.dist | 4 ++++ psalm.xml.dist | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 9838d3974..1d818f377 100644 --- a/composer.json +++ b/composer.json @@ -98,8 +98,8 @@ "nyholm/psr7": "^1.4", "open-telemetry/dev-tools": "dev-main", "php-http/mock-client": "^1.5", - "phpdocumentor/reflection-docblock": "^6.0", - "phpspec/prophecy": "1.26.*", + "phpdocumentor/reflection-docblock": "^5.3", + "phpspec/prophecy": "1.22.*", "phpspec/prophecy-phpunit": "^2", "phpstan/phpstan": "^1.10.13", "phpstan/phpstan-mockery": "^1.1", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 1265c4d71..1a20855da 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -57,6 +57,10 @@ parameters: message: "#.*expects Google\\\\Protobuf\\\\RepeatedField.*#" paths: - src/Contrib/Otlp + - + message: "#Call to an undefined method Google\\\\Protobuf\\\\FieldDescriptor::getLabel\\(\\).#" + paths: + - src/Contrib/Otlp/ProtobufSerializer.php - message: "#^Call to (static )?method .* on an unknown class .*#" paths: diff --git a/psalm.xml.dist b/psalm.xml.dist index 0f70e6e0a..cabed693f 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -35,6 +35,11 @@ + + + + +