-
Notifications
You must be signed in to change notification settings - Fork 0
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
tests: fix PHP deprecated notice - Automatic conversion of false to array #11
Conversation
For the screenshot: add a |
Done 👍 ✅ |
59e7bff
to
a6a3877
Compare
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.
I rebased on wpengine#280 to remove unnecessary dependencies.
Last step before you can open your PR on wpengine: generate a changeset:
-
run
npm run changeset
-
The fixes in here are a
patch
, they're not adding new features/enhancements. -
Use conventional commits for the changlog message. In this case we want something along the lines of
tests: fix PHP deprecation notices
.
$settings = get_option( 'graphql_general_settings' ); | ||
if ( ! is_array( $settings ) ) { | ||
$settings = []; | ||
} |
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.
A more succint way for handling all of these:
$settings = get_option( 'graphql_general_settings' ); | |
if ( ! is_array( $settings ) ) { | |
$settings = []; | |
} | |
$settings = get_option( 'graphql_general_settings', [] ); |
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.
LGTM 🚀
@Ta5r go ahead and open a PR for this branch against wpengine:main
, copy over the PR title + description, and then tag me in a comment.
e74c20c
to
27f459f
Compare
Tracking wpengine#283
What
This PR fixes deprecation warnings in several PHPUnit tests caused by accessing an undefined
get_option('graphql_general_settings')
.Important
This PR is based on wpengine#280 and requires it to be merged first
Why
The deprecated warnings were being shown on running the
composer tests
.How
$settings
is an array before updating one of it's values.Screenshot :
Before :
No more deprecation warnings ✅