Skip to content
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

Add throws tags and better generics #36

Merged
merged 8 commits into from
Feb 26, 2025
Merged

Conversation

defunctl
Copy link
Contributor

@defunctl defunctl commented Feb 24, 2025

Main Changes

Due to the missing throws tags, developers don't actually know that most of these method calls will throw an exception from the stellarwp/db library.

I THINK I got all the places this could happen, but due to the __callStatic in the db library, the IDE doesn't really know.

  • Additionally, this uses generics to type hint where we'd take a static DB class, which lets PHPStan perform some better static analysis and give your IDE autocompletion.
  • Adds WP CLI stubs for PHPStan
  • tests are failing because I believe the config has to be migrated to the new WpBrowser version, for now just install wp-browser versions less than 3.5
  • Updates GitHub action versions to their latest.

@defunctl defunctl added the bug Something isn't working label Feb 24, 2025
@defunctl defunctl self-assigned this Feb 24, 2025
@defunctl defunctl added this to the 1.1.9 milestone Feb 24, 2025
@defunctl defunctl marked this pull request as ready for review February 24, 2025 23:39
Copy link
Member

@dpanta94 dpanta94 left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@lucatume lucatume left a comment

Choose a reason for hiding this comment

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

The changes look great, thank you.

When it comes to testing, the update of wp-browser can be done in another PR.

@defunctl defunctl merged commit 03a57b4 into main Feb 26, 2025
2 checks passed
@defunctl defunctl deleted the bugfix/proper-throws-tags branch February 26, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants