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
This commit is contained in:
Brett McBride 2025-07-17 11:55:35 +10:00
parent 853f978216
commit a1f2ba09a8
8 changed files with 41 additions and 0 deletions

View File

@ -5,6 +5,7 @@ DOCKER_COMPOSE ?= docker compose
DC_RUN_PHP = $(DOCKER_COMPOSE) run --rm php
.DEFAULT_GOAL : help
.PHONY: deptrac
help: ## Show this help
@printf "\033[33m%s:\033[0m\n" 'Available commands'

View File

@ -14,6 +14,7 @@ deptrac:
- ./src
- ./proto
- ./tests
- ./deptrac/stubs
exclude_files:
- '#.*test.*#'
layers:
@ -109,10 +110,15 @@ deptrac:
collectors:
- type: className
regex: ^Nyholm\\Psr7Server\\*
- name: Stubs
collectors:
- type: directory
value: deptrac/stubs/.*
ruleset:
Context:
- FFI
- Stubs
SemConv: ~
ConfigSDK:
- SymfonyConfig
@ -124,10 +130,12 @@ deptrac:
- Context
- Contrib
- Extension
- Stubs
API:
- Context
- PsrLog
- SPI
- Stubs
SDK:
- +API
- ConfigSDK

View File

@ -0,0 +1,5 @@
<?php
namespace OpenTelemetry\Config\SDK\Configuration;
class ComponentPlugin {}

View File

@ -0,0 +1,5 @@
<?php
namespace OpenTelemetry\Config\SDK\Configuration;
class ComponentProvider {}

View File

@ -0,0 +1,5 @@
<?php
namespace OpenTelemetry\Config\SDK\Configuration;
class ComponentProviderRegistry {}

View File

@ -0,0 +1,5 @@
<?php
namespace OpenTelemetry\Config\SDK\Configuration;
class Context {}

View File

@ -0,0 +1,10 @@
<?php
//stub Override attribute for PHP <8.3
namespace {
if (!class_exists('Override')) {
#[\Attribute(\Attribute::TARGET_METHOD)]
final class Override {}
}
}

2
deptrac/stubs/README.md Normal file
View File

@ -0,0 +1,2 @@
Stubs for deptrac, which represent classes missing from some PHP versions, or classes
that deptrac does not understand.