From b5edb52024dcb0ef407fee2f6cfd29d4fc1ae73b Mon Sep 17 00:00:00 2001 From: Travis Weston Date: Wed, 3 Apr 2024 10:15:50 -0400 Subject: [PATCH] Fix PHPCS issues --- src/assets.php | 36 ++++++++++++++++++------------------ src/meta.php | 4 ++-- wp-pdf-generator.php | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/assets.php b/src/assets.php index 181d04e..76ffbe7 100644 --- a/src/assets.php +++ b/src/assets.php @@ -33,11 +33,11 @@ function action_wp_enqueue_scripts(): void { */ // wp_enqueue_script( - // 'wp-pdf-generator-example-entry', - // get_entry_asset_url( 'example-entry' ), - // get_asset_dependency_array( 'example-entry' ), - // get_asset_version( 'example-entry' ), - // true + // 'wp-pdf-generator-example-entry', + // get_entry_asset_url( 'example-entry' ), + // get_asset_dependency_array( 'example-entry' ), + // get_asset_version( 'example-entry' ), + // true // ); // wp_set_script_translations( 'wp-pdf-generator-example-entry', 'wp-pdf-generator' ); } @@ -57,11 +57,11 @@ function action_admin_enqueue_scripts(): void { */ // wp_enqueue_script( - // 'wp-pdf-generator-admin-handle', - // get_entry_asset_url( 'admin-handle' ), - // get_asset_dependency_array( 'admin-handle' ), - // get_asset_version( 'admin-handle' ), - // true + // 'wp-pdf-generator-admin-handle', + // get_entry_asset_url( 'admin-handle' ), + // get_asset_dependency_array( 'admin-handle' ), + // get_asset_version( 'admin-handle' ), + // true // ); // wp_set_script_translations( 'wp-pdf-generator-admin-handle', 'wp-pdf-generator' ); } @@ -81,11 +81,11 @@ function action_enqueue_block_editor_assets(): void { */ // wp_enqueue_script( - // 'wp-pdf-generator-slotfills', - // get_entry_asset_url( 'slotfills' ), - // get_asset_dependency_array( 'slotfills' ), - // get_asset_version( 'slotfills' ), - // true + // 'wp-pdf-generator-slotfills', + // get_entry_asset_url( 'slotfills' ), + // get_asset_dependency_array( 'slotfills' ), + // get_asset_version( 'slotfills' ), + // true // ); // wp_set_script_translations( 'wp-pdf-generator-slotfills', 'wp-pdf-generator' ); } @@ -96,7 +96,7 @@ function action_enqueue_block_editor_assets(): void { * @param string $path The file path to validate. * @return bool True if the path is valid and the file exists. */ -function validate_path( string $path ) : bool { +function validate_path( string $path ): bool { return 0 === validate_file( $path ) && file_exists( $path ); } @@ -152,7 +152,7 @@ function get_entry_asset_map( string $dir_entry_name ): array { * * @return array The asset's dependency array. */ -function get_asset_dependency_array( string $dir_entry_name ) : array { +function get_asset_dependency_array( string $dir_entry_name ): array { $asset_arr = get_entry_asset_map( $dir_entry_name ); return $asset_arr['dependencies'] ?? []; } @@ -164,7 +164,7 @@ function get_asset_dependency_array( string $dir_entry_name ) : array { * * @return string The asset's version hash. */ -function get_asset_version( string $dir_entry_name ) : string { +function get_asset_version( string $dir_entry_name ): string { $asset_arr = get_entry_asset_map( $dir_entry_name ); return $asset_arr['version'] ?? '1.0'; } diff --git a/src/meta.php b/src/meta.php index edb1f75..1276ea8 100644 --- a/src/meta.php +++ b/src/meta.php @@ -29,12 +29,12 @@ function register_meta_helper( string|array $object_slugs, string $meta_key, array $args = [] -) : bool { +): bool { // Object type must be either post or term. if ( ! in_array( $object_type, [ 'post', 'term' ], true ) ) { throw new \InvalidArgumentException( - __( + esc_html__( 'Object type must be one of "post", "term".', 'wp-pdf-generator' ) diff --git a/wp-pdf-generator.php b/wp-pdf-generator.php index 1ceb0cf..0e2a3be 100644 --- a/wp-pdf-generator.php +++ b/wp-pdf-generator.php @@ -35,7 +35,7 @@ if ( ! class_exists( \Composer\InstalledVersions::class ) ) { \add_action( 'admin_notices', - function() { + function () { ?>