diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 66f8f9e00..00340ad3c 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -2,9 +2,9 @@ name: PHP QA on: push: - branches: [ main ] + branches: [ main, 1.x, 2.x ] pull_request: - branches: [ main ] + branches: [ main, 1.x, 2.x ] jobs: php: @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['8.1', '8.2', '8.3'] + php-version: ['8.2', '8.3'] experimental: [false] composer_args: [""] include: @@ -154,5 +154,5 @@ jobs: needs: php with: matrix_extension: '["ast, json, grpc"]' - matrix_php_version: '["8.1", "8.2", "8.3"]' + matrix_php_version: '["8.2", "8.3", "8.4"]' install_directory: '~/.test/.packages' diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 7cb8f93ed..e0913f46d 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -2,9 +2,9 @@ name: Shellcheck on: push: - branches: [ main ] + branches: [ main, 1.x, 2.x ] pull_request: - branches: [ main ] + branches: [ main, 1.x, 2.x ] jobs: shellcheck: diff --git a/.github/workflows/split-monorepo.yaml b/.github/workflows/split-monorepo.yaml index 2a1faefa1..fc3679758 100644 --- a/.github/workflows/split-monorepo.yaml +++ b/.github/workflows/split-monorepo.yaml @@ -4,8 +4,8 @@ on: branches: - main - split - release: - types: [published] + - 1.x + - 2.x create: workflow_dispatch: diff --git a/.gitsplit.yml b/.gitsplit.yml index 9f7eb8289..b31fa1d36 100644 --- a/.gitsplit.yml +++ b/.gitsplit.yml @@ -35,3 +35,4 @@ splits: origins: - ^main$ - ^split$ + - ^2.x^ diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 69f0b9019..a19bea56e 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -77,12 +77,12 @@ This does the following things: ### Other PHP versions We aim to support officially supported PHP versions, according to https://www.php.net/supported-versions.php. The -developer image `ghcr.io/open-telemetry/opentelemetry-php/opentelemetry-php-base` is tagged as `8.1`, `8.2` and `8.3` -respectively, with `8.1` being the default. You can execute the test suite against other PHP versions by running the +developer image `ghcr.io/open-telemetry/opentelemetry-php/opentelemetry-php-base` is tagged as `8.2`, `8.3` and `8.4` +respectively, with `8.2` being the default. You can execute the test suite against other PHP versions by running the following command: ```bash -PHP_VERSION=8.1 make all +PHP_VERSION=8.2 make all #or PHP_VERSION=8.3 make all ``` diff --git a/Makefile b/Makefile index ed7685c5c..1f2184851 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include .env -PHP_VERSION ?= 8.1 +PHP_VERSION ?= 8.2 DOCKER_COMPOSE ?= docker compose DC_RUN_PHP = $(DOCKER_COMPOSE) run --rm php diff --git a/composer.json b/composer.json index e127ff8fc..4ba4d1960 100644 --- a/composer.json +++ b/composer.json @@ -101,8 +101,8 @@ "phpstan/phpstan": "^1.10.13", "phpstan/phpstan-mockery": "^1.1", "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^10 || ^11", - "sebastian/exporter": "<= 6.0.1 || >= 6.1.3", + "phpunit/phpunit": "^11", + "sebastian/exporter": "^6.3", "symfony/http-client": "^5.2", "symfony/var-exporter": "^5.4 || ^6.4 || ^7.0", "symfony/yaml": "^5.4 || ^6.4 || ^7.0" diff --git a/docker-compose.yaml b/docker-compose.yaml index fe5b35647..1ece7c7b0 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,6 +1,6 @@ services: php: - image: ghcr.io/open-telemetry/opentelemetry-php/opentelemetry-php-base:${PHP_VERSION:-8.1} + image: ghcr.io/open-telemetry/opentelemetry-php/opentelemetry-php-base:${PHP_VERSION:-8.2} volumes: - ./:/usr/src/myapp user: "${PHP_USER}:root" diff --git a/rector.php b/rector.php index c04b6d53a..81adda945 100644 --- a/rector.php +++ b/rector.php @@ -2,20 +2,18 @@ declare(strict_types=1); -use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector; use Rector\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector; use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector; use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector; use Rector\Config\RectorConfig; -use Rector\Php81\Rector\ClassMethod\NewInInitializerRector; -use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; +use Rector\Php82\Rector\Class_\ReadOnlyClassRector; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; use Rector\ValueObject\PhpVersion; use Rector\Set\ValueObject\SetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->phpVersion(PhpVersion::PHP_81); + $rectorConfig->phpVersion(PhpVersion::PHP_82); $rectorConfig->paths([ __DIR__ . '/src', @@ -23,21 +21,15 @@ ]); $rectorConfig->sets([ - SetList::PHP_81, + SetList::PHP_82, SetList::CODE_QUALITY, PHPUnitSetList::PHPUNIT_100, ]); $rectorConfig->skip([ FlipTypeControlToUseExclusiveTypeRector::class, - NewInInitializerRector::class => [ - __DIR__ . '/src/SDK/Trace/Sampler/ParentBased.php', - ], - ReadOnlyPropertyRector::class => [ - __DIR__ . '/src/SDK/Metrics/Stream/SynchronousMetricStream.php', - __DIR__ . '/tests/Unit/Extension/Propagator', - ], DisallowedEmptyRuleFixerRector::class, ExplicitBoolCompareRector::class, LocallyCalledStaticMethodToNonStaticRector::class, + ReadOnlyClassRector::class, ]); }; diff --git a/src/API/composer.json b/src/API/composer.json index 707c3c034..edb85278f 100644 --- a/src/API/composer.json +++ b/src/API/composer.json @@ -17,10 +17,9 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "open-telemetry/context": "^1.0", - "psr/log": "^1.1|^2.0|^3.0", - "symfony/polyfill-php82": "^1.26" + "psr/log": "^1.1|^2.0|^3.0" }, "conflict": { "open-telemetry/sdk": "<=1.0.8" @@ -35,7 +34,8 @@ }, "extra": { "branch-alias": { - "dev-main": "1.1.x-dev" + "dev-main": "1.1.x-dev", + "dev-2.x": "2.x-dev" }, "spi": { "OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\HookManagerInterface": [ diff --git a/src/Config/SDK/composer.json b/src/Config/SDK/composer.json index ebb5c691d..294736516 100644 --- a/src/Config/SDK/composer.json +++ b/src/Config/SDK/composer.json @@ -17,10 +17,10 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "open-telemetry/context": "^1.0", "open-telemetry/sdk": "^1.0", - "symfony/config": "^5.4 || ^6.4 || ^7.0", + "symfony/config": "^6.4 || ^7.0", "tbachert/spi": "^1.0.1" }, "autoload": { @@ -35,7 +35,8 @@ }, "extra": { "branch-alias": { - "dev-main": "0.1.x-dev" + "dev-main": "0.1.x-dev", + "dev-2.x": "2.x-dev" }, "spi": { "OpenTelemetry\\Config\\SDK\\Configuration\\ComponentProvider": [ diff --git a/src/Context/ZendObserverFiber.php b/src/Context/ZendObserverFiber.php index b700307e3..d991eca8f 100644 --- a/src/Context/ZendObserverFiber.php +++ b/src/Context/ZendObserverFiber.php @@ -14,7 +14,6 @@ use const FILTER_VALIDATE_BOOLEAN; use function filter_var; use function is_string; -use const PHP_VERSION_ID; use const PHP_ZTS; use function sprintf; use function trigger_error; @@ -40,8 +39,8 @@ public static function init(): bool return true; } - if (PHP_ZTS || PHP_VERSION_ID < 80100 || !extension_loaded('ffi')) { - trigger_error('Context: Fiber context switching not supported, requires PHP >= 8.1, an NTS build, and the FFI extension'); + if (PHP_ZTS || !extension_loaded('ffi')) { + trigger_error('Context: Fiber context switching not supported, requires an NTS build, and the FFI extension'); return false; } diff --git a/src/Context/composer.json b/src/Context/composer.json index 2717e8e3b..936e28925 100644 --- a/src/Context/composer.json +++ b/src/Context/composer.json @@ -17,8 +17,7 @@ } ], "require": { - "php": "^8.1", - "symfony/polyfill-php82": "^1.26" + "php": "^8.2" }, "autoload": { "psr-4": { @@ -33,7 +32,8 @@ }, "extra": { "branch-alias": { - "dev-main": "1.0.x-dev" + "dev-main": "1.0.x-dev", + "dev-2.x": "2.x-dev" } } } diff --git a/src/Contrib/Grpc/composer.json b/src/Contrib/Grpc/composer.json index ad5efd0e3..bfc38378c 100644 --- a/src/Contrib/Grpc/composer.json +++ b/src/Contrib/Grpc/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "ext-grpc": "*", "grpc/grpc": "*", "open-telemetry/sdk": "^1.0" @@ -32,7 +32,8 @@ }, "extra": { "branch-alias": { - "dev-main": "1.0.x-dev" + "dev-main": "1.0.x-dev", + "dev-2.x": "2.x-dev" } } } diff --git a/src/Contrib/Otlp/composer.json b/src/Contrib/Otlp/composer.json index 0232953c6..e87ae60f7 100644 --- a/src/Contrib/Otlp/composer.json +++ b/src/Contrib/Otlp/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "php-http/discovery": "^1.14", "open-telemetry/gen-otlp-protobuf": "^1.1", "open-telemetry/api": "^1.0", @@ -35,7 +35,8 @@ }, "extra": { "branch-alias": { - "dev-main": "1.0.x-dev" + "dev-main": "1.0.x-dev", + "dev-2.x": "2.x-dev" } } } diff --git a/src/Contrib/Zipkin/composer.json b/src/Contrib/Zipkin/composer.json index 838d0581c..9d1ab2cb4 100644 --- a/src/Contrib/Zipkin/composer.json +++ b/src/Contrib/Zipkin/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "open-telemetry/api": "^1.0", "open-telemetry/sdk": "^1.0", "php-http/async-client-implementation": "^1.0", @@ -34,7 +34,8 @@ }, "extra": { "branch-alias": { - "dev-main": "1.0.x-dev" + "dev-main": "1.0.x-dev", + "dev-2.x": "2.x-dev" } } } diff --git a/src/Contrib/composer.json b/src/Contrib/composer.json deleted file mode 100644 index deecfba66..000000000 --- a/src/Contrib/composer.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "open-telemetry/sdk-contrib", - "description": "Vendor specific implementations for OpenTelemetry PHP API/SDK.", - "keywords": ["opentelemetry", "otel", "metrics", "tracing", "logging", "apm", "otlp", "zipkin"], - "type": "library", - "license": "Apache-2.0", - "authors": [ - { - "name": "opentelemetry-php contributors", - "homepage": "https://github.com/open-telemetry/opentelemetry-php/graphs/contributors" - } - ], - "require": { - "php": "^8.1", - "ext-json": "*", - "open-telemetry/api": "^1.0", - "open-telemetry/context": "^1.0", - "open-telemetry/gen-otlp-protobuf": "^1.2", - "open-telemetry/sdk": "^1.0", - "open-telemetry/sem-conv": "^1.0", - "php-http/async-client-implementation": "^1.0", - "php-http/discovery": "^1.14", - "psr/http-factory-implementation": "^1.0", - "psr/log": "^1.1|^2.0|^3.0", - "symfony/polyfill-mbstring": "^1.23", - "symfony/polyfill-php82": "^1.26" - }, - "autoload": { - "psr-4": { - "OpenTelemetry\\Contrib\\": "." - }, - "files": [ - "Grpc/_register.php", - "Otlp/_register.php", - "Zipkin/_register.php" - - ] - } -} diff --git a/src/Extension/Propagator/B3/composer.json b/src/Extension/Propagator/B3/composer.json index 240c38dff..4929ddcc1 100644 --- a/src/Extension/Propagator/B3/composer.json +++ b/src/Extension/Propagator/B3/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "open-telemetry/api": "^1.0", "open-telemetry/context": "^1.0" }, @@ -31,7 +31,8 @@ }, "extra": { "branch-alias": { - "dev-main": "1.0.x-dev" + "dev-main": "1.0.x-dev", + "dev-2.x": "2.x-dev" } } } diff --git a/src/Extension/Propagator/CloudTrace/composer.json b/src/Extension/Propagator/CloudTrace/composer.json index 14472620e..578fd2fa5 100644 --- a/src/Extension/Propagator/CloudTrace/composer.json +++ b/src/Extension/Propagator/CloudTrace/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "open-telemetry/api": "^1.0", "open-telemetry/context": "^1.0" }, @@ -31,7 +31,8 @@ }, "extra": { "branch-alias": { - "dev-main": "1.0.x-dev" + "dev-main": "1.0.x-dev", + "dev-2.x": "2.x-dev" } } } diff --git a/src/Extension/Propagator/Jaeger/composer.json b/src/Extension/Propagator/Jaeger/composer.json index 5fd72a785..529b298e6 100644 --- a/src/Extension/Propagator/Jaeger/composer.json +++ b/src/Extension/Propagator/Jaeger/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "open-telemetry/api": "^1.0", "open-telemetry/context": "^1.0" }, @@ -31,7 +31,8 @@ }, "extra": { "branch-alias": { - "dev-main": "1.0.x-dev" + "dev-main": "1.0.x-dev", + "dev-2.x": "2.x-dev" } } } diff --git a/src/SDK/composer.json b/src/SDK/composer.json index 1fe3d71d0..eb961e121 100644 --- a/src/SDK/composer.json +++ b/src/SDK/composer.json @@ -17,10 +17,10 @@ } ], "require": { - "php": "^8.1", + "php": "^8.2", "ext-json": "*", "nyholm/psr7-server": "^1.1", - "open-telemetry/api": "~1.0 || ~1.1", + "open-telemetry/api": "^1.0", "open-telemetry/context": "^1.0", "open-telemetry/sem-conv": "^1.0", "php-http/discovery": "^1.14", @@ -31,7 +31,6 @@ "psr/log": "^1.1|^2.0|^3.0", "ramsey/uuid": "^3.0 || ^4.0", "symfony/polyfill-mbstring": "^1.23", - "symfony/polyfill-php82": "^1.26", "tbachert/spi": "^1.0.1" }, "autoload": { @@ -55,7 +54,8 @@ }, "extra": { "branch-alias": { - "dev-main": "1.0.x-dev" + "dev-main": "1.0.x-dev", + "dev-2.x": "2.x-dev" }, "spi": { "OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\HookManagerInterface": [ diff --git a/tests/Unit/Contrib/UsesHttpClientTrait.php b/tests/Unit/Contrib/UsesHttpClientTrait.php deleted file mode 100644 index 7172ff2d6..000000000 --- a/tests/Unit/Contrib/UsesHttpClientTrait.php +++ /dev/null @@ -1,122 +0,0 @@ -client instanceof ClientInterface - ? $this->client - : $this->client = $this->createMock(ClientInterface::class); - } - - /** - * @return RequestFactoryInterface|MockObject - * @psalm-suppress MismatchingDocblockReturnType - * @psalm-suppress PossiblyInvalidPropertyAssignmentValue - */ - protected function getRequestFactoryInterfaceMock(): RequestFactoryInterface - { - /** @phpstan-ignore-next-line */ - return $this->requestFactory instanceof RequestFactoryInterface - ? $this->requestFactory - : $this->requestFactory = $this->createRequestFactoryInterfaceMock(); - } - - /** - * @return RequestFactoryInterface|MockObject - * @psalm-suppress MismatchingDocblockReturnType - */ - protected function createRequestFactoryInterfaceMock(): RequestFactoryInterface - { - $mock = $this->createMock(RequestFactoryInterface::class); - $mock->method('createRequest') - ->willReturn($this->createRequestInterfaceMock()); - - return $mock; - } - - /** - * @return StreamFactoryInterface|MockObject - * @psalm-suppress MismatchingDocblockReturnType - */ - protected function getStreamFactoryInterfaceMock(): StreamFactoryInterface - { - /** @phpstan-ignore-next-line */ - return $this->streamFactory instanceof StreamFactoryInterface - ? $this->streamFactory - : $this->streamFactory = $this->createMock(StreamFactoryInterface::class); - } - - /** - * @param int $status - * @return RequestInterface|MockObject - * @psalm-suppress MismatchingDocblockReturnType - * @psalm-suppress PossiblyInvalidPropertyAssignmentValue - */ - protected function getRequestInterfaceMock(int $status = 200): RequestInterface - { - /** @phpstan-ignore-next-line */ - return $this->request instanceof RequestInterface - ? $this->request - : $this->request = $this->createRequestInterfaceMock($status); - } - - /** - * @param int $status - * @return RequestInterface|MockObject - * @psalm-suppress MismatchingDocblockReturnType - */ - protected function createRequestInterfaceMock(int $status = 200): RequestInterface - { - $mock = $this->createMock(RequestInterface::class); - foreach ([ - 'withProtocolVersion', - 'withHeader', - 'withAddedHeader', - 'withoutHeader', - 'withBody', - ] as $method) { - $mock->method($method)->willReturn($mock); - } - - return $mock; - } - - /** - * @param int $status - * @return ResponseInterface|MockObject - * @psalm-suppress MismatchingDocblockReturnType - */ - protected function createResponseInterfaceMock(int $status = 200): ResponseInterface - { - $response = $this->createMock(ResponseInterface::class); - $response->method('getStatusCode') - ->willReturn($status); - - return $response; - } -}