Skip to content

Commit

Permalink
chore: bump deps to meet actual requirements and lint for WPCS 3.0 (#816
Browse files Browse the repository at this point in the history
)

* 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
  • Loading branch information
justlevine authored Nov 30, 2023
1 parent d3b3f93 commit e962366
Show file tree
Hide file tree
Showing 63 changed files with 505 additions and 445 deletions.
6 changes: 3 additions & 3 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
=== WPGraphQL WooCommerce ===
Contributors: kidunot89, ranaaterning, jasonbahl, saleebm
Tags: GraphQL, WooCommerce, WPGraphQL
Requires at least: 5.9
Requires at least: 6.1
Tested up to: 6.2
Requires PHP: 7.2
Requires PHP: 7.3
Requires WooCommerce: 7.9.0
Requires WPGraphQL: 1.14.0+
Requires WPGraphQL: 1.16.0+
Works with WPGraphQL-JWT-Authentication: 0.7.0+
Stable tag: 0.18.3
License: GPL-3
Expand Down
43 changes: 16 additions & 27 deletions access-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ function wc_graphql_price_range( $from, $to ) {
/**
* Converts a camel case formatted string to a underscore formatted string.
*
* @param string $string String to be formatted.
* @param string $str String to be formatted.
* @param boolean $capitalize Capitalize first letter of string.
*
* @return string
*/
function wc_graphql_underscore_to_camel_case( $string, $capitalize = false ) {
$str = str_replace( ' ', '', ucwords( str_replace( '-', ' ', $string ) ) );
function wc_graphql_underscore_to_camel_case( $str, $capitalize = false ) {
$str = str_replace( ' ', '', ucwords( str_replace( '-', ' ', $str ) ) );

if ( ! $capitalize ) {
$str[0] = strtolower( $str[0] );
Expand All @@ -215,14 +215,14 @@ function wc_graphql_underscore_to_camel_case( $string, $capitalize = false ) {
/**
* Converts a camel case formatted string to a underscore formatted string.
*
* @param string $string String to be formatted.
* @param string $str String to be formatted.
*
* @return string
*/
function wc_graphql_camel_case_to_underscore( $string ) {
function wc_graphql_camel_case_to_underscore( $str ) {
preg_match_all(
'!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!',
$string,
$str,
$matches
);

Expand All @@ -240,13 +240,13 @@ function wc_graphql_camel_case_to_underscore( $string ) {
/**
* Get an option value from WooGraphQL settings
*
* @param string $option_name The key of the option to return.
* @param mixed $default The default value the setting should return if no value is set.
* @param string $section_name The settings section name.
* @param string $option_name The key of the option to return.
* @param mixed $default_value The default value the setting should return if no value is set.
* @param string $section_name The settings section name.
*
* @return mixed|string|int|boolean
*/
function woographql_setting( string $option_name, $default = '', $section_name = 'woographql_settings' ) {
function woographql_setting( string $option_name, $default_value = '', $section_name = 'woographql_settings' ) {
$section_fields = get_option( $section_name );

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

/**
* Get the value from the stored data, or return the default
*/
if ( is_array( $default ) ) {
$value = is_array( $section_fields ) && ! empty( $section_fields[ $option_name ] ) ? $section_fields[ $option_name ] : $default;
if ( is_array( $default_value ) ) {
$value = is_array( $section_fields ) && ! empty( $section_fields[ $option_name ] ) ? $section_fields[ $option_name ] : $default_value;
} else {
$value = isset( $section_fields[ $option_name ] ) ? $section_fields[ $option_name ] : $default;
$value = isset( $section_fields[ $option_name ] ) ? $section_fields[ $option_name ] : $default_value;
}

/**
* Filter the value before returning it
*
* @param mixed $value The value of the field
* @param mixed $default The default value if there is no value set
* @param mixed $default_value The default value if there is no value set
* @param string $option_name The name of the option
* @param array $section_fields The setting values within the section
* @param string $section_name The name of the section the setting belongs to
*/
return apply_filters( 'woographql_settings_section_field_value', $value, $default, $option_name, $section_fields, $section_name );
return apply_filters( 'woographql_settings_section_field_value', $value, $default_value, $option_name, $section_fields, $section_name );
}
endif;

Expand Down Expand Up @@ -379,14 +379,3 @@ function woographql_verify_nonce( $nonce, $action = -1 ) {
return false;
}
endif;











8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
}
],
"require": {
"php": ">=7.2",
"php": ">=7.3",
"firebase/php-jwt": "^6.1.0"
},
"require-dev": {
"axepress/wp-graphql-cs": "^1.0.0-beta",
"axepress/wp-graphql-stubs": "^1.14.0",
"php-stubs/woocommerce-stubs": "^7.5.0",
"axepress/wp-graphql-cs": "^2.0.0-beta",
"axepress/wp-graphql-stubs": "~1.16.0",
"php-stubs/woocommerce-stubs": "7.9.0",
"phpstan/extension-installer": "^1.3",
"phpstan/phpdoc-parser": "^1.22.0",
"phpstan/phpstan": "^1.10",
Expand Down
Loading

0 comments on commit e962366

Please sign in to comment.