Skip to content

Commit 2d90974

Browse files
fixing CI complaints (#1666)
* fixing psalm complaints use rector (and psalm) to add Override attributes, and add symfony polyfill to provide Override in earlier php versions * fixing more psalm complaints * more fixes * adding stubs for deptrac there are some things in our code that deptrac doesn't understand or are missing for some php versions. stub them to quieten all those violation warnings * why not cache invalid :( * display tools versions * fix tools cache key * changing cache key * dont complain about unused psalm suppressions * suppress invalid attribute * quieten phpstan php8.5 complaints * revert previous commit...now other php versions complain about an unused ignore :( * revert typecasting in metrics aggregators * Update src/Contrib/Otlp/ProtobufSerializer.php Co-authored-by: Chris Lightfoot-Wild <[email protected]> * remove override stub and use the polyfill from deptrac --------- Co-authored-by: Chris Lightfoot-Wild <[email protected]>
1 parent 2421c64 commit 2d90974

File tree

441 files changed

+1124
-58
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

441 files changed

+1124
-58
lines changed

.github/workflows/php.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,57 +87,71 @@ jobs:
8787
uses: actions/cache@v4
8888
with:
8989
path: vendor
90-
key: ${{ runner.os }}-${{ matrix.php-version }}-php-${{ hashFiles('**/composer.json') }}
90+
key: ${{ runner.os }}-${{ matrix.php-version }}-vendor-${{ hashFiles('composer.json') }}
9191
restore-keys: |
92-
${{ runner.os }}-${{ matrix.php-version }}-php-
92+
${{ runner.os }}-${{ matrix.php-version }}-vendor-
9393
- name: Cache test tools
9494
id: test-tools-cache
9595
uses: actions/cache@v4
9696
with:
9797
path: vendor-bin
98-
key: ${{ runner.os }}-${{ matrix.php-version }}-php-${{ hashFiles('**/composer.json') }}
98+
key: ${{ runner.os }}-${{ matrix.php-version }}-vendor-bin-${{ hashFiles('vendor-bin/*/composer.json') }}
9999
restore-keys: |
100-
${{ runner.os }}-${{ matrix.php-version }}-php-
100+
${{ runner.os }}-${{ matrix.php-version }}-vendor-bin-
101101
102102
- name: Install dependencies
103103
id: composer
104104
if: steps.composer-cache.outputs.cache-hit != 'true'
105-
run: composer install --prefer-dist --no-progress ${{ matrix.composer_args }}
105+
run: |
106+
composer --version
107+
composer install --prefer-dist --no-progress ${{ matrix.composer_args }}
106108
107109
- name: Check Style
108110
id: style
109111
continue-on-error: ${{ matrix.experimental }}
110112
env:
111113
PHP_CS_FIXER_IGNORE_ENV: 1
112-
run: vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --stop-on-violation --using-cache=no -vvv
114+
run: |
115+
vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer --version
116+
vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --stop-on-violation --using-cache=no -vvv
113117
114118
- name: Check Dependencies
115119
id: deps
116120
continue-on-error: ${{ matrix.experimental }}
117-
run: vendor-bin/deptrac/vendor/bin/deptrac --formatter=github-actions --report-uncovered
121+
run: |
122+
vendor-bin/deptrac/vendor/bin/deptrac --version
123+
vendor-bin/deptrac/vendor/bin/deptrac --formatter=github-actions --report-uncovered
118124
119125
- name: Run Phan
120126
id: phan
121127
continue-on-error: ${{ matrix.experimental }}
122128
env:
123129
XDEBUG_MODE: off
124130
PHAN_DISABLE_XDEBUG_WARN: 1
125-
run: vendor-bin/phan/vendor/bin/phan
131+
run: |
132+
vendor-bin/phan/vendor/bin/phan --version
133+
vendor-bin/phan/vendor/bin/phan
126134
127135
- name: Run Psalm
128136
id: psalm
129137
continue-on-error: ${{ matrix.experimental }}
130-
run: vendor-bin/psalm/vendor/bin/psalm --output-format=github
138+
run: |
139+
vendor-bin/psalm/vendor/bin/psalm --version
140+
vendor-bin/psalm/vendor/bin/psalm --output-format=github
131141
132142
- name: Run Phpstan
133143
id: phpstan
134144
continue-on-error: ${{ matrix.experimental }}
135-
run: vendor/bin/phpstan analyse --error-format=github
145+
run: |
146+
vendor/bin/phpstan --version
147+
vendor/bin/phpstan analyse --error-format=github
136148
137149
- name: Run PHPUnit (unit tests)
138150
id: unit
139151
continue-on-error: ${{ matrix.experimental }}
140-
run: php -dzend.assertions=1 vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover --testsuite unit
152+
run: |
153+
vendor/bin/phpunit --version
154+
php -dzend.assertions=1 vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover --testsuite unit
141155
142156
- name: Run PHPUnit (integration tests)
143157
id: integration

.phan/config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286
'PhanAccessPropertyInternal',
287287
'PhanTypeMismatchPropertyReal',
288288
'PhanTemplateTypeNotUsedInFunctionReturn',
289+
'PhanUndeclaredClassAttribute',
289290
],
290291

291292
// A regular expression to match files to be excluded

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ DOCKER_COMPOSE ?= docker compose
55
DC_RUN_PHP = $(DOCKER_COMPOSE) run --rm php
66

77
.DEFAULT_GOAL : help
8+
.PHONY: deptrac
89

910
help: ## Show this help
1011
@printf "\033[33m%s:\033[0m\n" 'Available commands'

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"symfony/config": "^5.4 || ^6.4 || ^7.0",
2121
"symfony/polyfill-mbstring": "^1.23",
2222
"symfony/polyfill-php82": "^1.26",
23+
"symfony/polyfill-php83": "^1.32",
24+
"symfony/polyfill-php84": "^1.32",
2325
"tbachert/spi": "^1.0.1"
2426
},
2527
"config": {
@@ -98,7 +100,7 @@
98100
"open-telemetry/dev-tools": "dev-main",
99101
"php-http/mock-client": "^1.5",
100102
"phpdocumentor/reflection-docblock": "^5.3",
101-
"phpspec/prophecy": "^1.17.0",
103+
"phpspec/prophecy": "^1.22",
102104
"phpspec/prophecy-phpunit": "^2",
103105
"phpstan/phpstan": "^1.10.13",
104106
"phpstan/phpstan-mockery": "^1.1",

deptrac.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ deptrac:
1414
- ./src
1515
- ./proto
1616
- ./tests
17+
- ./deptrac/polyfills
18+
- ./vendor/symfony/polyfill-php83/Resources/stubs
1719
exclude_files:
1820
- '#.*test.*#'
1921
layers:
@@ -109,10 +111,17 @@ deptrac:
109111
collectors:
110112
- type: className
111113
regex: ^Nyholm\\Psr7Server\\*
114+
- name: Polyfills
115+
collectors:
116+
- type: directory
117+
value: deptrac/polyfills/.*
118+
- type: directory
119+
value: vendor/symfony/polyfill-php83
112120

113121
ruleset:
114122
Context:
115123
- FFI
124+
- Polyfills
116125
SemConv: ~
117126
ConfigSDK:
118127
- SymfonyConfig
@@ -124,10 +133,12 @@ deptrac:
124133
- Context
125134
- Contrib
126135
- Extension
136+
- Polyfills
127137
API:
128138
- Context
129139
- PsrLog
130140
- SPI
141+
- Polyfills
131142
SDK:
132143
- +API
133144
- ConfigSDK
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
namespace OpenTelemetry\Config\SDK\Configuration;
4+
5+
class ComponentPlugin {}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
namespace OpenTelemetry\Config\SDK\Configuration;
4+
5+
class ComponentProvider {}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
namespace OpenTelemetry\Config\SDK\Configuration;
4+
5+
class ComponentProviderRegistry {}

deptrac/polyfills/Context.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
namespace OpenTelemetry\Config\SDK\Configuration;
4+
5+
class Context {}

deptrac/polyfills/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Polyfills for deptrac, which represent classes missing from some PHP versions, or classes
2+
that deptrac does not understand.
3+
We also use some symfony polyfills for deptrac, under `vendor/symfony/polyfill-*`.

0 commit comments

Comments
 (0)