Refactor code for PHP 8.4 compatibility #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactor code for PHP 8.4 compatibility
Summary
Fixed the main PHP 8.4 compatibility issue by adding explicit nullable type declarations to method parameters that previously used implicit nullable syntax (deprecated in PHP 8.4).
Changes made:
PhpSIP::__construct()to use?string $src_ip = null, ?int $src_port = null, ?int $fr_timer = nullPhpSIP::setContentType()to use?string $content_type = nullPhpSIP::setCallId()to use?string $v = nullValidation completed:
Review & Testing Checklist for Human
Recommended test plan: Run your existing SIP test suite or example scripts against a real SIP server with PHP 8.4 to verify end-to-end functionality.
Diagram
%%{ init : { "theme" : "default" }}%% graph TD Examples["examples/*.php<br/>(message.php, options.php, etc)"]:::context Main["PhpSIP.class.php<br/>(Main SIP library)"]:::major-edit Exception["PhpSIP.Exception.php<br/>(Exception class)"]:::context Examples -->|"require_once"| Main Main -->|"throws"| Exception Main -->|"Updated constructor<br/>and method signatures"| TypeHints["Explicit nullable types<br/>?string, ?int"]:::major-edit subgraph Legend L1["Major Edit"]:::major-edit L2["Minor Edit"]:::minor-edit L3["Context/No Edit"]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes