Skip to content
Merged

Fix cs #22992

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/browserslist-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
git config --global user.name "${{ github.actor }}"

- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10
uses: github/codeql-action/init@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10
uses: github/codeql-action/analyze@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
2 changes: 1 addition & 1 deletion .github/workflows/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: true

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:
fi

- name: Checkout Yoast Dist repo
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: ${{ env.DIST_ORG }}/${{ github.event.repository.name }}
ref: ${{ env.DIST_DEFAULT_BRANCH }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deprecation-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/finish-coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
# NOTE: The ref value should be different when triggered by pull_request event.
# See: https://github.com/lewagon/wait-on-check-action/issues/25.
- name: "Wait on tests (PR)"
uses: lewagon/wait-on-check-action@3603e826ee561ea102b58accb5ea55a1a7482343 # v1.4.1
uses: lewagon/wait-on-check-action@74049309dfeff245fe8009a0137eacf28136cb3c # v1.5.0
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
Expand All @@ -93,7 +93,7 @@ jobs:

- name: "Wait on tests (push)"
if: github.event_name != 'pull_request'
uses: lewagon/wait-on-check-action@3603e826ee561ea102b58accb5ea55a1a7482343 # v1.4.1
uses: lewagon/wait-on-check-action@74049309dfeff245fe8009a0137eacf28136cb3c # v1.5.0
with:
ref: ${{ github.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate_csv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
# Check out the repository
- name: Check out repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/jstest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand All @@ -169,7 +169,7 @@ jobs:
# Check out the premium config repo ahead of running the tests to prevent issues with permissions.
- name: Checkout premium configuration
if: ${{ steps.checks-run.outputs.should == 'true' && matrix.needs_premium_config == true }}
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: Yoast/YoastSEO.js-premium-configuration
path: packages/yoastseo/premium-configuration
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down Expand Up @@ -198,7 +198,7 @@ jobs:
run: sudo apt-get install -y subversion

- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

Expand Down
14 changes: 7 additions & 7 deletions admin/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function wpseo_save_what( $what ) {
*/
function wpseo_upsert_meta( $post_id, $new_meta_value, $orig_meta_value, $meta_key, $return_key ) {

$post_id = intval( $post_id );
$post_id = (int) $post_id;
$sanitized_new_meta_value = wp_strip_all_tags( $new_meta_value );
$orig_meta_value = wp_strip_all_tags( $orig_meta_value );

Expand All @@ -171,7 +171,7 @@ function wpseo_upsert_meta( $post_id, $new_meta_value, $orig_meta_value, $meta_k
$upsert_results['results'] = sprintf(
/* translators: %s expands to post type. */
__( 'Post has an invalid Content Type: %s.', 'wordpress-seo' ),
$the_post->post_type
$the_post->post_type,
);

return $upsert_results;
Expand All @@ -183,7 +183,7 @@ function wpseo_upsert_meta( $post_id, $new_meta_value, $orig_meta_value, $meta_k
$upsert_results['results'] = sprintf(
/* translators: %s expands to post type name. */
__( 'You can\'t edit %s.', 'wordpress-seo' ),
$post_type_object->label
$post_type_object->label,
);

return $upsert_results;
Expand All @@ -195,7 +195,7 @@ function wpseo_upsert_meta( $post_id, $new_meta_value, $orig_meta_value, $meta_k
$upsert_results['results'] = sprintf(
/* translators: %s expands to the name of a post type (plural). */
__( 'You can\'t edit %s that aren\'t yours.', 'wordpress-seo' ),
$post_type_object->label
$post_type_object->label,
);

return $upsert_results;
Expand Down Expand Up @@ -310,7 +310,7 @@ function ajax_get_keyword_usage_and_post_types() {

wp_die(
// phpcs:ignore WordPress.Security.EscapeOutput -- Reason: WPSEO_Utils::format_json_encode is safe.
WPSEO_Utils::format_json_encode( $return_object )
WPSEO_Utils::format_json_encode( $return_object ),
);
}

Expand Down Expand Up @@ -355,7 +355,7 @@ function ajax_get_term_keyword_usage() {

wp_die(
// phpcs:ignore WordPress.Security.EscapeOutput -- Reason: WPSEO_Utils::format_json_encode is safe.
WPSEO_Utils::format_json_encode( $usage )
WPSEO_Utils::format_json_encode( $usage ),
);
}

Expand Down Expand Up @@ -406,6 +406,6 @@ function ajax_get_keyword_usage() {

wp_die(
// phpcs:ignore WordPress.Security.EscapeOutput -- Reason: WPSEO_Utils::format_json_encode is safe.
WPSEO_Utils::format_json_encode( WPSEO_Meta::keyword_usage( $keyword, $post_id ) )
WPSEO_Utils::format_json_encode( WPSEO_Meta::keyword_usage( $keyword, $post_id ) ),
);
}
2 changes: 1 addition & 1 deletion admin/class-admin-asset-analysis-worker-location.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct( $flat_version = '', $name = 'analysis-worker' ) {
[
'name' => $name,
'src' => $analysis_worker,
]
],
);
}

Expand Down
4 changes: 1 addition & 3 deletions admin/class-admin-asset-dev-server-location.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ final class WPSEO_Admin_Asset_Dev_Server_Location implements WPSEO_Admin_Asset_L
* @param string|null $url Where the dev server is located.
*/
public function __construct( $url = null ) {
if ( $url === null ) {
$url = self::DEFAULT_URL;
}
$url ??= self::DEFAULT_URL;

$this->url = $url;
}
Expand Down
20 changes: 9 additions & 11 deletions admin/class-admin-asset-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ class WPSEO_Admin_Asset_Manager {
* @param string $prefix The prefix for naming assets.
*/
public function __construct( ?WPSEO_Admin_Asset_Location $asset_location = null, $prefix = self::PREFIX ) {
if ( $asset_location === null ) {
$asset_location = self::create_default_location();
}
$asset_location ??= self::create_default_location();

$this->asset_location = $asset_location;
$this->prefix = $prefix;
Expand Down Expand Up @@ -102,7 +100,7 @@ public function register_script( WPSEO_Admin_Asset $script ) {
$url,
$script->get_deps(),
$script->get_version(),
$args
$args,
);

if ( in_array( 'wp-i18n', $script->get_deps(), true ) ) {
Expand All @@ -123,7 +121,7 @@ public function register_style( WPSEO_Admin_Asset $style ) {
$this->get_url( $style, WPSEO_Admin_Asset::TYPE_CSS ),
$style->get_deps(),
$style->get_version(),
$style->get_media()
$style->get_media(),
);
}

Expand Down Expand Up @@ -348,7 +346,7 @@ protected function scripts_to_be_registered() {
'ext_length' => 3,
'additional_deps' => $additional_dependencies,
'header_scripts' => $header_scripts,
]
],
);
$external_scripts = $this->load_generated_asset_file(
[
Expand All @@ -358,7 +356,7 @@ protected function scripts_to_be_registered() {
'base_dir' => 'externals/',
'additional_deps' => $additional_dependencies,
'header_scripts' => $header_scripts,
]
],
);
$language_scripts = $this->load_generated_asset_file(
[
Expand All @@ -368,15 +366,15 @@ protected function scripts_to_be_registered() {
'base_dir' => 'languages/',
'additional_deps' => $additional_dependencies,
'header_scripts' => $header_scripts,
]
],
);
$renamed_scripts = $this->load_renamed_scripts();

$scripts = array_merge(
$plugin_scripts,
$external_scripts,
$language_scripts,
$renamed_scripts
$renamed_scripts,
);

$scripts['installation-success'] = [
Expand Down Expand Up @@ -404,7 +402,7 @@ static function ( $dep ) {
}
return $dep;
},
$scripts['post-edit']['deps']
$scripts['post-edit']['deps'],
),
'in_footer' => ! in_array( 'post-edit-classic', $header_scripts, true ),
'version' => $scripts['post-edit']['version'],
Expand Down Expand Up @@ -477,7 +475,7 @@ protected function load_generated_asset_file( $args ) {
'additional_deps' => [],
'base_dir' => '',
'header_scripts' => [],
]
],
);
$scripts = [];
$assets = require $args['asset_file'];
Expand Down
8 changes: 4 additions & 4 deletions admin/class-admin-editor-specific-replace-vars.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class WPSEO_Admin_Editor_Specific_Replace_Vars {
public function __construct() {
$this->add_for_page_types(
[ 'page', 'post', 'custom_post_type' ],
WPSEO_Custom_Fields::get_custom_fields()
WPSEO_Custom_Fields::get_custom_fields(),
);

$this->add_for_page_types(
[ 'post', 'term-in-custom-taxonomy' ],
WPSEO_Custom_Taxonomies::get_custom_taxonomies()
WPSEO_Custom_Taxonomies::get_custom_taxonomies(),
);
}

Expand All @@ -63,7 +63,7 @@ public function get() {
*/
$replacement_variables = apply_filters(
'wpseo_editor_specific_replace_vars',
$this->replacement_variables
$this->replacement_variables,
);

if ( ! is_array( $replacement_variables ) ) {
Expand All @@ -85,7 +85,7 @@ public function get() {
public function get_generic( $replacement_variables ) {
$shared_variables = array_diff(
$this->extract_names( $replacement_variables ),
$this->get_unique_replacement_variables()
$this->get_unique_replacement_variables(),
);

return array_values( $shared_variables );
Expand Down
4 changes: 2 additions & 2 deletions admin/class-admin-gutenberg-compatibility-notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function add_notification() {
__( '%1$s detected you are using version %2$s of %3$s, please update to the latest version to prevent compatibility issues.', 'wordpress-seo' ),
'Yoast SEO',
$this->compatibility_checker->get_installed_version(),
'Gutenberg'
'Gutenberg',
);

$notification = new Yoast_Notification(
Expand All @@ -97,7 +97,7 @@ protected function add_notification() {
'id' => $this->notification_id,
'type' => $level,
'priority' => 1,
]
],
);

$this->notification_center->add_notification( $notification );
Expand Down
4 changes: 2 additions & 2 deletions admin/class-admin-help-panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function get_button_html() {
return sprintf(
' <button type="button" class="yoast_help yoast-help-button dashicons" id="%1$s-help-toggle" aria-expanded="false" aria-controls="%1$s-help"><span class="yoast-help-icon" aria-hidden="true"></span><span class="screen-reader-text">%2$s</span></button>',
esc_attr( $this->id ),
$this->help_button_text
$this->help_button_text,
);
}

Expand Down Expand Up @@ -98,7 +98,7 @@ public function get_panel_html() {
$wrapper_start,
esc_attr( $this->id ),
$this->help_content,
$wrapper_end
$wrapper_end,
);
}
}
Loading
Loading