Skip to content

Commit e962366

Browse files
authored
chore: bump deps to meet actual requirements and lint for WPCS 3.0 (#816)
* chore: bump min versions to actual and update deps * chore: fix multiple empty lines at EOF * chore: preincrement when standalone (phpcs) * fix: use `printf` instead of `echo sprintf` [phpcs] * chore: avoid lonely `if()` in `else{}` [phpcs] * chore: avoid reserved keywords as param names [phpcs] * chore: remove unused callback params [phpcs] * chore: remove more unused callback params [phpcs] * chore: apply lints to tests * chore: update ruleset for PHPCS 3.0 * texts: restore $last_request_headers
1 parent d3b3f93 commit e962366

File tree

63 files changed

+505
-445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+505
-445
lines changed

README.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
=== WPGraphQL WooCommerce ===
22
Contributors: kidunot89, ranaaterning, jasonbahl, saleebm
33
Tags: GraphQL, WooCommerce, WPGraphQL
4-
Requires at least: 5.9
4+
Requires at least: 6.1
55
Tested up to: 6.2
6-
Requires PHP: 7.2
6+
Requires PHP: 7.3
77
Requires WooCommerce: 7.9.0
8-
Requires WPGraphQL: 1.14.0+
8+
Requires WPGraphQL: 1.16.0+
99
Works with WPGraphQL-JWT-Authentication: 0.7.0+
1010
Stable tag: 0.18.3
1111
License: GPL-3

access-functions.php

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ function wc_graphql_price_range( $from, $to ) {
195195
/**
196196
* Converts a camel case formatted string to a underscore formatted string.
197197
*
198-
* @param string $string String to be formatted.
198+
* @param string $str String to be formatted.
199199
* @param boolean $capitalize Capitalize first letter of string.
200200
*
201201
* @return string
202202
*/
203-
function wc_graphql_underscore_to_camel_case( $string, $capitalize = false ) {
204-
$str = str_replace( ' ', '', ucwords( str_replace( '-', ' ', $string ) ) );
203+
function wc_graphql_underscore_to_camel_case( $str, $capitalize = false ) {
204+
$str = str_replace( ' ', '', ucwords( str_replace( '-', ' ', $str ) ) );
205205

206206
if ( ! $capitalize ) {
207207
$str[0] = strtolower( $str[0] );
@@ -215,14 +215,14 @@ function wc_graphql_underscore_to_camel_case( $string, $capitalize = false ) {
215215
/**
216216
* Converts a camel case formatted string to a underscore formatted string.
217217
*
218-
* @param string $string String to be formatted.
218+
* @param string $str String to be formatted.
219219
*
220220
* @return string
221221
*/
222-
function wc_graphql_camel_case_to_underscore( $string ) {
222+
function wc_graphql_camel_case_to_underscore( $str ) {
223223
preg_match_all(
224224
'!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!',
225-
$string,
225+
$str,
226226
$matches
227227
);
228228

@@ -240,13 +240,13 @@ function wc_graphql_camel_case_to_underscore( $string ) {
240240
/**
241241
* Get an option value from WooGraphQL settings
242242
*
243-
* @param string $option_name The key of the option to return.
244-
* @param mixed $default The default value the setting should return if no value is set.
245-
* @param string $section_name The settings section name.
243+
* @param string $option_name The key of the option to return.
244+
* @param mixed $default_value The default value the setting should return if no value is set.
245+
* @param string $section_name The settings section name.
246246
*
247247
* @return mixed|string|int|boolean
248248
*/
249-
function woographql_setting( string $option_name, $default = '', $section_name = 'woographql_settings' ) {
249+
function woographql_setting( string $option_name, $default_value = '', $section_name = 'woographql_settings' ) {
250250
$section_fields = get_option( $section_name );
251251

252252
/**
@@ -256,27 +256,27 @@ function woographql_setting( string $option_name, $default = '', $section_name =
256256
* @param string $section_name The name of the section
257257
* @param mixed $default The default value for the option being retrieved
258258
*/
259-
$section_fields = apply_filters( 'woographql_settings_section_fields', $section_fields, $section_name, $default );
259+
$section_fields = apply_filters( 'woographql_settings_section_fields', $section_fields, $section_name, $default_value );
260260

261261
/**
262262
* Get the value from the stored data, or return the default
263263
*/
264-
if ( is_array( $default ) ) {
265-
$value = is_array( $section_fields ) && ! empty( $section_fields[ $option_name ] ) ? $section_fields[ $option_name ] : $default;
264+
if ( is_array( $default_value ) ) {
265+
$value = is_array( $section_fields ) && ! empty( $section_fields[ $option_name ] ) ? $section_fields[ $option_name ] : $default_value;
266266
} else {
267-
$value = isset( $section_fields[ $option_name ] ) ? $section_fields[ $option_name ] : $default;
267+
$value = isset( $section_fields[ $option_name ] ) ? $section_fields[ $option_name ] : $default_value;
268268
}
269269

270270
/**
271271
* Filter the value before returning it
272272
*
273273
* @param mixed $value The value of the field
274-
* @param mixed $default The default value if there is no value set
274+
* @param mixed $default_value The default value if there is no value set
275275
* @param string $option_name The name of the option
276276
* @param array $section_fields The setting values within the section
277277
* @param string $section_name The name of the section the setting belongs to
278278
*/
279-
return apply_filters( 'woographql_settings_section_field_value', $value, $default, $option_name, $section_fields, $section_name );
279+
return apply_filters( 'woographql_settings_section_field_value', $value, $default_value, $option_name, $section_fields, $section_name );
280280
}
281281
endif;
282282

@@ -379,14 +379,3 @@ function woographql_verify_nonce( $nonce, $action = -1 ) {
379379
return false;
380380
}
381381
endif;
382-
383-
384-
385-
386-
387-
388-
389-
390-
391-
392-

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
}
2222
],
2323
"require": {
24-
"php": ">=7.2",
24+
"php": ">=7.3",
2525
"firebase/php-jwt": "^6.1.0"
2626
},
2727
"require-dev": {
28-
"axepress/wp-graphql-cs": "^1.0.0-beta",
29-
"axepress/wp-graphql-stubs": "^1.14.0",
30-
"php-stubs/woocommerce-stubs": "^7.5.0",
28+
"axepress/wp-graphql-cs": "^2.0.0-beta",
29+
"axepress/wp-graphql-stubs": "~1.16.0",
30+
"php-stubs/woocommerce-stubs": "7.9.0",
3131
"phpstan/extension-installer": "^1.3",
3232
"phpstan/phpdoc-parser": "^1.22.0",
3333
"phpstan/phpstan": "^1.10",

0 commit comments

Comments
 (0)