diff --git a/wp/headless-wp/includes/classes/API.php b/wp/headless-wp/includes/classes/API.php index b2d6c62a5..2b344acca 100644 --- a/wp/headless-wp/includes/classes/API.php +++ b/wp/headless-wp/includes/classes/API.php @@ -52,8 +52,8 @@ public function register_post_type_taxonomy_params(): void { ); foreach ( $post_types as $post_type ) { - add_filter( sprintf('rest_%s_query', $post_type), [ $this, 'modify_rest_params' ], 10, 1 ); - add_filter( sprintf('rest_%s_collection_params', $post_type), [ $this, 'modify_rest_params_schema' ], 10, 2 ); + add_filter( sprintf( 'rest_%s_query', $post_type ), [ $this, 'modify_rest_params' ], 10, 1 ); + add_filter( sprintf( 'rest_%s_collection_params', $post_type ), [ $this, 'modify_rest_params_schema' ], 10, 2 ); } } diff --git a/wp/headless-wp/includes/classes/CacheFlush/CacheFlush.php b/wp/headless-wp/includes/classes/CacheFlush/CacheFlush.php index 0790d2984..a3e5efcdb 100644 --- a/wp/headless-wp/includes/classes/CacheFlush/CacheFlush.php +++ b/wp/headless-wp/includes/classes/CacheFlush/CacheFlush.php @@ -42,11 +42,11 @@ public function register(): void { } /** - * Run the cron job - * - * @param int $post_id The post id - */ - public function run_job( int $post_id ): void { + * Run the cron job + * + * @param int $post_id The post id + */ + public function run_job( int $post_id ): void { $this->revalidate( $post_id ); } diff --git a/wp/headless-wp/includes/classes/Links.php b/wp/headless-wp/includes/classes/Links.php index 27b71f8ec..abe0f2b69 100644 --- a/wp/headless-wp/includes/classes/Links.php +++ b/wp/headless-wp/includes/classes/Links.php @@ -24,17 +24,17 @@ public function register(): void { } /** - * Create Taxonomy Rewrites - * - * /posts/category/category-slug - * /events/category/category-slug - * - * This is to allow taxonomy archive pages to exist that aren't specific to the 'post' post type by default and make more usable across other post types by - * creating default rewrite rules for taxonomy endpoints for post types for the front-end site to resolve to in the format ///. - * - * @param array $rules Rewrite rules. - */ - public function create_taxonomy_rewrites( array $rules ): array { + * Create Taxonomy Rewrites + * + * /posts/category/category-slug + * /events/category/category-slug + * + * This is to allow taxonomy archive pages to exist that aren't specific to the 'post' post type by default and make more usable across other post types by + * creating default rewrite rules for taxonomy endpoints for post types for the front-end site to resolve to in the format ///. + * + * @param array $rules Rewrite rules. + */ + public function create_taxonomy_rewrites( array $rules ): array { // When set_taxonomy_rewrites_disabled true, bypasses these custom endpoint rewrite rules if ( true === apply_filters( __FUNCTION__ . '_disabled', false ) ) { @@ -72,8 +72,8 @@ public function create_taxonomy_rewrites( array $rules ): array { continue; } - $rules[ sprintf('%s/%s/(.+?)/?$', $post_slug, $rewrite_slug) ] = sprintf('index.php?%s=$1&post_type=%s', $rewrite_query_var, $post_type); - $rules[ sprintf('%s/%s/(.+?)/page/?([0-9]{1,})/?$', $post_slug, $rewrite_slug) ] = sprintf('index.php?%s=$1&paged=$2&post_type=%s', $rewrite_query_var, $post_type); + $rules[ sprintf( '%s/%s/(.+?)/?$', $post_slug, $rewrite_slug ) ] = sprintf( 'index.php?%s=$1&post_type=%s', $rewrite_query_var, $post_type ); + $rules[ sprintf( '%s/%s/(.+?)/page/?([0-9]{1,})/?$', $post_slug, $rewrite_slug ) ] = sprintf( 'index.php?%s=$1&paged=$2&post_type=%s', $rewrite_query_var, $post_type ); } } diff --git a/wp/headless-wp/plugin.php b/wp/headless-wp/plugin.php index 4ef772b9a..c97521c04 100644 --- a/wp/headless-wp/plugin.php +++ b/wp/headless-wp/plugin.php @@ -47,10 +47,10 @@ function ( $the_class ): void { $base_dir = __DIR__ . '/includes/classes/'; // Does the class use the namespace prefix? $len = strlen( $prefix ); - if ( strncmp( $prefix, (string) $the_class, $len ) !== 0 ) { + if ( strncmp( $prefix, $the_class, $len ) !== 0 ) { return; } - $relative_class = substr( (string) $the_class, $len ); + $relative_class = substr( $the_class, $len ); $file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php'; // If the file exists, require it. if ( file_exists( $file ) ) { diff --git a/wp/headless-wp/tests/php/includes/TestPreview.php b/wp/headless-wp/tests/php/includes/TestPreview.php index a6331f3f8..0d068b205 100644 --- a/wp/headless-wp/tests/php/includes/TestPreview.php +++ b/wp/headless-wp/tests/php/includes/TestPreview.php @@ -59,9 +59,9 @@ public function test_handle_review(): void { /** - * Tests the preview token generation - */ - public function test_preview_token_generation(): void { + * Tests the preview token generation + */ + public function test_preview_token_generation(): void { $token = PreviewToken::generate( [ 'type' => 'test_token' ] ); $payload = (array) PreviewToken::get_payload_from_token( $token ); @@ -70,9 +70,9 @@ public function test_preview_token_generation(): void { } /** - * Tests getting the token payload - */ - public function test_get_payload_from_token(): void { + * Tests getting the token payload + */ + public function test_get_payload_from_token(): void { $token = PreviewToken::generate( [ 'type' => 'test_token' ] ); $_SERVER['HTTP_AUTHORIZATION'] = 'Bearer ' . $token; @@ -93,9 +93,9 @@ public function test_get_payload_from_token(): void { } /** - * Tests getting the token payload from alternative header - */ - public function test_get_payload_from_token_alternative_header(): void { + * Tests getting the token payload from alternative header + */ + public function test_get_payload_from_token_alternative_header(): void { $token = PreviewToken::generate( [ 'type' => 'test_token' ] ); $_SERVER['HTTP_X_HEADSTARTWP_AUTHORIZATION'] = 'Bearer ' . $token;