Skip to content

fix: remove return type declarations from Base_Gateway abstract methods#779

Merged
superdav42 merged 1 commit intomainfrom
bugfix/base-gateway-return-type-compat
Apr 10, 2026
Merged

fix: remove return type declarations from Base_Gateway abstract methods#779
superdav42 merged 1 commit intomainfrom
bugfix/base-gateway-return-type-compat

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

Summary

  • Removes return type declarations from abstract methods in Base_Gateway that external gateway plugins may override without matching return types
  • PHP fatals when a subclass overrides a method without the return type declared in the parent — removing types from the abstract base restores compatibility
  • Concrete implementations (Base_Stripe_Gateway, Base_PayPal_Gateway) retain their return type declarations

Files Changed

  • inc/gateways/class-base-gateway.php — remove : void and : string from 8 abstract method signatures

Methods Affected

  • set_order()
  • get_payment_url_on_gateway()
  • get_subscription_url_on_gateway()
  • get_customer_url_on_gateway()
  • set_payment()
  • set_membership()
  • set_customer()
  • trigger_payment_processed()

aidevops.sh v3.6.235 plugin for OpenCode v1.3.16 with claude-sonnet-4-6 spent 7m and 19,647 tokens on this as a headless worker.

External gateway plugins that extend Base_Gateway without matching return
type declarations cause a PHP fatal error. Removing return types from the
abstract base class restores compatibility with third-party gateways while
keeping the concrete implementations (Stripe, PayPal) typed.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

Warning

Rate limit exceeded

@superdav42 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 53 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 4 minutes and 53 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ee495664-37a3-4f6a-8ae9-85641e45b5eb

📥 Commits

Reviewing files that changed from the base of the PR and between 39d68e8 and a4a1907.

📒 Files selected for processing (1)
  • inc/gateways/class-base-gateway.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/base-gateway-return-type-compat

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42 superdav42 merged commit aaddd40 into main Apr 10, 2026
11 checks passed
@superdav42
Copy link
Copy Markdown
Collaborator Author

Summary

  • Removes return type declarations from abstract methods in Base_Gateway that external gateway plugins may override without matching return types
  • PHP fatals when a subclass overrides a method without the return type declared in the parent — removing types from the abstract base restores compatibility
  • Concrete implementations (Base_Stripe_Gateway, Base_PayPal_Gateway) retain their return type declarations

Files Changed

  • inc/gateways/class-base-gateway.php — remove : void and : string from 8 abstract method signatures

Methods Affected

  • set_order()
  • get_payment_url_on_gateway()
  • get_subscription_url_on_gateway()
  • get_customer_url_on_gateway()
  • set_payment()
  • set_membership()
  • set_customer()
  • trigger_payment_processed()

aidevops.sh v3.6.235 plugin for OpenCode v1.3.16 with claude-sonnet-4-6 spent 7m and 19,647 tokens on this as a headless worker.


Merged via PR #779 to main.
Merged by deterministic merge pass (pulse-wrapper.sh).

@github-actions
Copy link
Copy Markdown

Performance Test Results

Performance test results for b20a238 are in 🛎️!

Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown.

URL: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 41 37.83 MB 848.50 ms (-35.50 ms / -4% ) 168.00 ms (+16.00 ms / +10% ) 1090.00 ms 2060.00 ms 1967.55 ms 94.30 ms (+7.25 ms / +8% )
1 56 49.02 MB 945.00 ms 141.50 ms (-5.00 ms / -4% ) 1090.50 ms 2088.00 ms 2008.95 ms 80.20 ms (-2.65 ms / -3% )

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.

1 participant