Skip to content

Multi-Currency: Fix unused parameter phpcs sniffs #8655

Open
@reykjalin

Description

Part of #8436.

Description

Remove the VariableAnalysis.CodeAnalysis.VariableAnalysis exclude from phpcs.xml.dist and fix the issues reported when running npm run lint:php in the following files:

  • includes/multi-currency/FrontendCurrencies.php
  • includes/multi-currency/Analytics.php
  • includes/multi-currency/Compatibility/WooCommerceProductAddOns.php
  • includes/multi-currency/MultiCurrency.php
  • includes/multi-currency/Compatibility/WooCommerceSubscriptions.php
  • includes/multi-currency/Settings.php
  • includes/multi-currency/SettingsOnboardCta.php
  • includes/multi-currency/Compatibility/WooCommerceNameYourPrice.php

Suggested fixes:

  • When a variable is truly unused, such as in filter functions where a parameter isn’t needed, prepend $_unused_ to the variable name. For example $order$_unused_order.
  • If a variable is not necessary, remove it.
  • When a parent class/interface doesn’t use a parameter but child classes do, use an inline // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    focus: multi-currencypriority: lowThe issue/PR is low priority—not many people are affected or there’s a workaround, etc.type: technical debtThis issue/PR represents/solves the technical debt of the project.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions