Skip to content

Commit

Permalink
Update PHPCS and coding standards to the current version. (#1894)
Browse files Browse the repository at this point in the history
* Update PHPCS and coding standards to the current version.

* Exclude UnusedFunctionParameter Warnings

* Fix linting issues
  • Loading branch information
ChrisWiegman authored May 30, 2024
1 parent 2ff9be6 commit 2c581ad
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 29 deletions.
4 changes: 4 additions & 0 deletions plugins/faustwp/.phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@
<property name="blank_line_check" value="true" />
</properties>
</rule>

<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter"/>
</rule>
</ruleset>
6 changes: 3 additions & 3 deletions plugins/faustwp/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"axepress/wp-graphql-stubs": "^1.16",
"szepeviktor/phpstan-wordpress": "^1.3",
"roave/security-advisories": "dev-master",
"squizlabs/php_codesniffer": "^3.5.8",
"wp-coding-standards/wpcs": "^2.2",
"squizlabs/php_codesniffer": "^3.10.1",
"wp-coding-standards/wpcs": "^3.1.0",
"yoast/phpunit-polyfills": "^1.0"
},
"scripts": {
Expand Down Expand Up @@ -66,4 +66,4 @@
"WPE\\FaustWP\\Tests\\Integration\\": "tests/integration/"
}
}
}
}
213 changes: 197 additions & 16 deletions plugins/faustwp/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/faustwp/faustwp.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}

define( 'FAUSTWP_FILE', __FILE__ );
define( 'FAUSTWP_DIR', dirname( __FILE__ ) );
define( 'FAUSTWP_DIR', __DIR__ );
define( 'FAUSTWP_URL', plugin_dir_url( __FILE__ ) );
define( 'FAUSTWP_PATH', plugin_basename( FAUSTWP_FILE ) );
define( 'FAUSTWP_SLUG', dirname( plugin_basename( FAUSTWP_FILE ) ) );
Expand Down
6 changes: 3 additions & 3 deletions plugins/faustwp/includes/replacement/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ function normalize_sitemap_entry( $sitemap_entry ) {
/**
* Check if a string has a file extension.
*
* @param string $string The string to check.
* @param string $file The string to check.
* @return boolean
*/
function has_file_extension( $string ) {
function has_file_extension( $file ) {
$file_extension_pattern = '/\.[a-zA-Z0-9]+$/';

if ( preg_match( $file_extension_pattern, $string ) ) {
if ( preg_match( $file_extension_pattern, $file ) ) {
return true;
} else {
return false; // String does not have a file extension.
Expand Down
12 changes: 6 additions & 6 deletions plugins/faustwp/includes/settings/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ function get_secret_key() {
/**
* Get a Faust setting by name.
*
* @param string $name The setting name.
* @param mixed $default Optional setting value. Default false.
* @param string $name The setting name.
* @param mixed $default_value Optional setting value. Default false.
*
* @return mixed The setting value.
*/
function faustwp_get_setting( $name, $default = false ) {
$value = $default;
function faustwp_get_setting( $name, $default_value = false ) {
$value = $default_value;
$settings = faustwp_get_settings();

if ( isset( $settings[ $name ] ) ) {
Expand All @@ -107,9 +107,9 @@ function faustwp_get_setting( $name, $default = false ) {
*
* @param mixed $value The setting value.
* @param string $name The setting name.
* @param mixed $default Optional setting value.
* @param mixed $default_value Optional setting value.
*/
return apply_filters( 'faustwp_get_setting', $value, $name, $default );
return apply_filters( 'faustwp_get_setting', $value, $name, $default_value );
}

/**
Expand Down

0 comments on commit 2c581ad

Please sign in to comment.