Skip to content

feat: return static on Subscription::create()#453

Merged
Minishlink merged 1 commit into
web-push-libs:masterfrom
bitwise-operators:feature/static-return-on-subscription-create
May 28, 2026
Merged

feat: return static on Subscription::create()#453
Minishlink merged 1 commit into
web-push-libs:masterfrom
bitwise-operators:feature/static-return-on-subscription-create

Conversation

@bitwise-operators
Copy link
Copy Markdown
Contributor

Currently, Subscription::create() returns self, despite the class not being final.

This PR changes the return type to static, so child classes can be created using the method.

I ran into this when I extended the class to add some custom serialization/deserialization to fit within our application.

I added the consistent-constructor annotations to prevent problems with child classes overriding the constructor. Alternatively, the constructor could be made final, but I feel this is preferable, leaving more room to the user while notifying static-analysis tools of the risks.

Copy link
Copy Markdown
Member

@Minishlink Minishlink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Minishlink Minishlink merged commit b8c708c into web-push-libs:master May 28, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants