-
Notifications
You must be signed in to change notification settings - Fork 3.4k
5.x Fix methods to be extendable. #18841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The existing format is for the message that was sent, what other keys and data are you putting in those messages? |
|
Yes. |
Ok, I feel like this change is roughly equivalent to replacing a class type with |
|
I am not aware if any syntax. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR relaxes the strict type annotations in the mailer system to improve extensibility for custom transport implementations. The changes address PHPStan compatibility issues when extending mailer classes that need to return additional array keys beyond just 'headers' and 'message'.
- Updates return type annotations from strict array shapes to generic arrays with mixed values
- Removes PHPStan-specific type annotations that were too restrictive for inheritance
- Modifies parameter type hints to match the more flexible return types
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/TestSuite/TestEmailTransport.php | Updates send() method return type from strict array shape to generic array |
| src/Mailer/Mailer.php | Relaxes return types for send(), deliver(), and logDelivery() methods |
| src/Mailer/AbstractTransport.php | Updates abstract send() method return type to allow extensible implementations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
992de60 to
297d115
Compare
|
OK, turns out there is a way to keep it "open" for exendability. |
We cannot declare the returns that strict.
Otherwise, extending classes are impossible to satisfy this when using different
array<string, mixed>return keys, e.g."code" and others specific to API pushing mailers.
so we should not declare concrete keys as only valid ones.