Skip to content

Commit fe51fed

Browse files
committed
fix: resolve PHP 8.5 static analysis errors
- 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
1 parent d9cb7e8 commit fe51fed

File tree

135 files changed

+284
-129
lines changed

Some content is hidden

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

135 files changed

+284
-129
lines changed

.phan/config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
//
4343
// Note that the **only** effect of choosing `'5.6'` is to infer that functions removed in php 7.0 exist.
4444
// (See `backward_compatibility_checks` for additional options)
45-
'target_php_version' => '7.4',
45+
'target_php_version' => '8.2',
4646

4747
// If enabled, missing properties will be created when
4848
// they are first seen. If false, we'll report an
@@ -278,7 +278,7 @@
278278

279279
// Add any issue types (such as `'PhanUndeclaredMethod'`)
280280
// to this deny-list to inhibit them from being reported.
281-
'suppress_issue_types' => [],
281+
'suppress_issue_types' => ['PhanUndeclaredClassAttribute'],
282282

283283
// A regular expression to match files to be excluded
284284
// from parsing and analysis and will not be read at all.

.serena/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/cache

.serena/project.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# list of languages for which language servers are started; choose from:
2+
# al bash clojure cpp csharp
3+
# csharp_omnisharp dart elixir elm erlang
4+
# fortran fsharp go groovy haskell
5+
# java julia kotlin lua markdown
6+
# matlab nix pascal perl php
7+
# powershell python python_jedi r rego
8+
# ruby ruby_solargraph rust scala swift
9+
# terraform toml typescript typescript_vts vue
10+
# yaml zig
11+
# (This list may be outdated. For the current list, see values of Language enum here:
12+
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
13+
# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
14+
# Note:
15+
# - For C, use cpp
16+
# - For JavaScript, use typescript
17+
# - For Free Pascal/Lazarus, use pascal
18+
# Special requirements:
19+
# - csharp: Requires the presence of a .sln file in the project folder.
20+
# - pascal: Requires Free Pascal Compiler (fpc) and optionally Lazarus.
21+
# When using multiple languages, the first language server that supports a given file will be used for that file.
22+
# The first language is the default language and the respective language server will be used as a fallback.
23+
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
24+
languages:
25+
- php
26+
27+
# the encoding used by text files in the project
28+
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
29+
encoding: "utf-8"
30+
31+
# whether to use project's .gitignore files to ignore files
32+
ignore_all_files_in_gitignore: true
33+
34+
# list of additional paths to ignore in all projects
35+
# same syntax as gitignore, so you can use * and **
36+
ignored_paths: []
37+
38+
# whether the project is in read-only mode
39+
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
40+
# Added on 2025-04-18
41+
read_only: false
42+
43+
# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
44+
# Below is the complete list of tools for convenience.
45+
# To make sure you have the latest list of tools, and to view their descriptions,
46+
# execute `uv run scripts/print_tool_overview.py`.
47+
#
48+
# * `activate_project`: Activates a project by name.
49+
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
50+
# * `create_text_file`: Creates/overwrites a file in the project directory.
51+
# * `delete_lines`: Deletes a range of lines within a file.
52+
# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
53+
# * `execute_shell_command`: Executes a shell command.
54+
# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
55+
# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
56+
# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
57+
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
58+
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
59+
# * `initial_instructions`: Gets the initial instructions for the current project.
60+
# Should only be used in settings where the system prompt cannot be set,
61+
# e.g. in clients you have no control over, like Claude Desktop.
62+
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
63+
# * `insert_at_line`: Inserts content at a given line in a file.
64+
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
65+
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
66+
# * `list_memories`: Lists memories in Serena's project-specific memory store.
67+
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
68+
# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
69+
# * `read_file`: Reads a file within the project directory.
70+
# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
71+
# * `remove_project`: Removes a project from the Serena configuration.
72+
# * `replace_lines`: Replaces a range of lines within a file with new content.
73+
# * `replace_symbol_body`: Replaces the full definition of a symbol.
74+
# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
75+
# * `search_for_pattern`: Performs a search for a pattern in the project.
76+
# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
77+
# * `switch_modes`: Activates modes by providing a list of their names
78+
# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
79+
# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
80+
# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
81+
# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
82+
excluded_tools: []
83+
84+
# initial prompt for the project. It will always be given to the LLM upon activating the project
85+
# (contrary to the memories, which are loaded on demand).
86+
initial_prompt: ""
87+
88+
project_name: "opentelemetry-php-contrib-1"
89+
included_optional_tools: []

src/Aws/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"friendsofphp/php-cs-fixer": "^3.0",
3434
"mikey179/vfsstream": "^1.6",
3535
"open-telemetry/dev-tools": "dev-main",
36-
"phan/phan": "^4.1 || ^5",
36+
"phan/phan": "^6.0",
3737
"php-http/mock-client": "*",
3838
"phpstan/phpstan": "^2.1",
3939
"phpstan/phpstan-phpunit": "^2.0",

src/Aws/src/Xray/IdGenerator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public function __construct(?RandomIdGenerator $randomIdGenerator = null)
5252
*
5353
* Example: 60cd399d76b435b5411c66f29b238014
5454
*/
55+
#[\Override]
5556
public function generateTraceId(): string
5657
{
5758
return dechex(time()) . substr($this->randomIdGenerator->generateTraceId(), 0, self::TRACE_ID_RANDOM_HEX_LENGTH);
@@ -61,6 +62,7 @@ public function generateTraceId(): string
6162
* Returns a random 64-bit string in the form of 16
6263
* hexadecimal characters.
6364
*/
65+
#[\Override]
6466
public function generateSpanId(): string
6567
{
6668
return $this->randomIdGenerator->generateSpanId();

src/Aws/tests/Integration/CollectingSpanProcessor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,25 @@ class CollectingSpanProcessor implements SpanProcessorInterface
1414
{
1515
private array $collectedSpans = [];
1616

17+
#[\Override]
1718
public function onStart(ReadWriteSpanInterface $span, ContextInterface $parentContext): void
1819
{
1920
$this->collectedSpans[$span->getContext()->getSpanId()] = $span;
2021
}
2122

23+
#[\Override]
2224
public function onEnd(ReadableSpanInterface $span): void
2325
{
2426
$this->collectedSpans[$span->getContext()->getSpanId()] = $span;
2527
}
2628

29+
#[\Override]
2730
public function forceFlush(?CancellationInterface $cancellation = null): bool
2831
{
2932
return true;
3033
}
3134

35+
#[\Override]
3236
public function shutdown(?CancellationInterface $cancellation = null): bool
3337
{
3438
return true;

src/Context/Swoole/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"require-dev": {
3333
"friendsofphp/php-cs-fixer": "^3",
3434
"nyholm/psr7": "*",
35-
"phan/phan": "^5.0",
35+
"phan/phan": "^6.0",
3636
"php-http/mock-client": "*",
3737
"phpstan/phpstan": "^2.1",
3838
"phpstan/phpstan-phpunit": "^2.0",

src/Context/Swoole/src/SwooleContextHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function switchToActiveCoroutine(): void
4141
public function splitOffChildCoroutines(): void
4242
{
4343
$pcid = Coroutine::getCid();
44-
foreach (method_exists(Coroutine::class, 'list') ? Coroutine::list() : Coroutine::listCoroutines() as $cid) {
44+
foreach (Coroutine::list() as $cid) {
4545
if ($pcid === Coroutine::getPcid($cid) && !$this->isForked($cid)) {
4646
$this->forkCoroutine($cid);
4747
}

src/Exporter/Instana/.phan/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@
278278

279279
// Add any issue types (such as `'PhanUndeclaredMethod'`)
280280
// to this deny-list to inhibit them from being reported.
281-
'suppress_issue_types' => [],
281+
'suppress_issue_types' => ['PhanUndeclaredClassAttribute'],
282282

283283
// A regular expression to match files to be excluded
284284
// from parsing and analysis and will not be read at all.

src/Exporter/Instana/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"require-dev": {
2626
"friendsofphp/php-cs-fixer": "^3",
27-
"phan/phan": "^5.0",
27+
"phan/phan": "^6.0",
2828
"phpstan/phpstan": "^2.1",
2929
"phpstan/phpstan-phpunit": "^2.0",
3030
"psalm/plugin-phpunit": "^0.19.2",

0 commit comments

Comments
 (0)