Skip to content

Commit

Permalink
Automatic linting with phpcbf
Browse files Browse the repository at this point in the history
  • Loading branch information
claytoncollie committed Jan 29, 2024
1 parent 48a93f6 commit 4ae5d43
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 16 deletions.
4 changes: 1 addition & 3 deletions wp/headless-wp/includes/classes/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function register_post_type_taxonomy_params() {
add_filter( "rest_{$post_type}_query", array( $this, 'modify_rest_params' ), 10, 2 );
add_filter( "rest_{$post_type}_collection_params", [ $this, 'modify_rest_params_schema' ], 10, 2 );
}

}

/**
Expand Down Expand Up @@ -118,7 +117,7 @@ public function modify_rest_params( $args, $request ) {
if ( isset( $args['tax_query'] ) ) {
$args['tax_query'][0]['field'] = 'slug';
$args['tax_query'] = array_map(
function( $tax_query ) use ( $taxonomy ) {
function ( $tax_query ) use ( $taxonomy ) {
if ( $tax_query['taxonomy'] === $taxonomy->name ) {
$tax_query['field'] = 'slug';
return $tax_query;
Expand All @@ -140,5 +139,4 @@ function( $tax_query ) use ( $taxonomy ) {

return $args;
}

}
2 changes: 0 additions & 2 deletions wp/headless-wp/includes/classes/API/AppEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function register() {
// Clear the cache for this endpoint when posts and options are saved
add_action( 'save_post', [ $this, 'invalidate_cache' ] );
add_action( 'update_option', [ $this, 'maybe_invalidate_cache' ] );

}

/**
Expand Down Expand Up @@ -214,7 +213,6 @@ public function prepare_menus( $menu ) {
}

return $filtered_menu;

}

/**
Expand Down
1 change: 0 additions & 1 deletion wp/headless-wp/includes/classes/Integrations/Gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,4 @@ public function render_block( $html, $block, $block_instance ) {
$block_instance
);
}

}
8 changes: 4 additions & 4 deletions wp/headless-wp/includes/classes/Integrations/YoastSEO.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ public function override_wpseo_stylesheet_url( $stylesheet ) {
* @param array $links Array of links to be shown in sitemap.
* @return array Modified array of links to be shown in sitemap.
*/
public function maybe_override_sitemap_index_links( array $links ) : array {
public function maybe_override_sitemap_index_links( array $links ): array {
if ( ! $this->should_rewrite_urls() ) {
return $links;
}

return array_map(
function( $link ) {
function ( $link ) {
// Bail, if we don't have loc.
if ( empty( $link['loc'] ) ) {
return $link;
Expand All @@ -106,7 +106,7 @@ function( $link ) {
* @param array $link Link for which the url xml markup is rendered.
* @return string Modified XML markup for url for the given link in sitemap.
*/
public function maybe_override_sitemap_url( string $xml, array $link ) : string {
public function maybe_override_sitemap_url( string $xml, array $link ): string {
if ( ! $this->should_rewrite_urls() ) {
return $xml;
}
Expand Down Expand Up @@ -277,7 +277,7 @@ public function override_search_title( $title ) {
public function override_search_canonical( $canonical ) {
if ( $this->get_yoast_search_query_vars() ) {
$search_route = apply_filters( 'tenup_headless_wp_search_route', 'search' );
$canonical = rtrim( $canonical, '/' ) . '/' . $search_route;
$canonical = rtrim( $canonical, '/' ) . '/' . $search_route;
}

return $canonical;
Expand Down
2 changes: 1 addition & 1 deletion wp/headless-wp/includes/classes/Links.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function register() {
public function create_taxonomy_rewrites( $array ) {

// When set_taxonomy_rewrites_disabled true, bypasses these custom endpoint rewrite rules
if ( true === apply_filters( __function__ . '_disabled', false ) ) {
if ( true === apply_filters( __FUNCTION__ . '_disabled', false ) ) {
return $array;
}

Expand Down
5 changes: 2 additions & 3 deletions wp/headless-wp/includes/classes/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function register_settings() {
add_settings_field(
'site_react_url',
esc_html__( 'Headless Frontend URL', 'headless-wp' ),
function() { ?>
function () { ?>
<input
type = "url"
placeholder = "https://"
Expand All @@ -120,7 +120,7 @@ class = "regular-text"
add_settings_field(
'headless_site_locale',
esc_html__( 'Headless Multisite Locale (optional)', 'headless-wp' ),
function() {
function () {
?>
<input
type="text"
Expand Down Expand Up @@ -280,5 +280,4 @@ public function maybe_output_setting_notification() {

printf( '<div class="notice notice-warning"><p>%1$s</p></div>', wp_kses_post( $message ) );
}

}
4 changes: 2 additions & 2 deletions wp/headless-wp/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
require_once HEADLESS_WP_PLUGIN_PATH . 'vendor/autoload.php';
} else {
spl_autoload_register(
function( $class ) {
function ( $class ) {
// Project-specific namespace prefix.
$prefix = 'HeadlessWP\\';
// Base directory for the namespace prefix.
Expand All @@ -66,7 +66,7 @@ function( $class ) {

add_action(
'rest_api_init',
function() {
function () {
PreviewToken::setup();
}
);

0 comments on commit 4ae5d43

Please sign in to comment.