-
-
Notifications
You must be signed in to change notification settings - Fork 521
I18nTextDomainFixer: remove unnecessary variable initialization #2513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I18nTextDomainFixer: remove unnecessary variable initialization #2513
Conversation
Initializing the variable here is unnecessary as its value is immediately overridden in the if/else below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
That is a good idea, @dingo-d. If you are not planning to do it yourself, I can try that. Just let me know what you prefer. |
I mean if you're already working on it you can take over, but it's not a problem for me to do as well 😄 |
Sounds like a plan gentlemen ;-) Please do check history though when doing this as some of these things may have been put in place to satisfy a higher PHPStan level than we're currently running at and a commit message may hint at that, if that's the case. |
Just documenting here that I created the PR to remove unused variables detected by PHPStorm: #2514 |
* upstream/develop: (428 commits) Rulesets: update schema URL GH Actions: use the xmllint-validate action runner and enhance checks (WordPress#2522) AbstractFunctionParameterSniff: fix first class callables and function imports (WordPress#2518) DontExtractStandard.xml file creation (WordPress#2456) Add documentation for WordPress.NamingConventions.ValidVariableName (WordPress#2457) Remove unused variables from a few sniffs (WordPress#2514) I18nTextDomainFixer: remove unnecessary variable initialization (WordPress#2513) GH Actions: Bump codecov/codecov-action from 4 to 5 (WordPress#2510) GH Actions: PHP 8.4 has been released CS/QA: remove redundant condition GH Actions: use explicit PHPStan major Various sniffs: simplify skipping the rest of the file GH Actions: always quote variables Release checklist: add new action item AbstractClassRestrictionsSniff: fix insufficient defensive coding (WordPress#2500) ✨ New WordPress.WP.GetMetaSingle sniff (WordPress#2465) Fix typo in AbstractFunctionRestrictionsSniff::is_targetted_token() DocBlock (WordPress#2477) Fix typos (WordPress#2472) Documentation: capitalization consistency fixes (WordPress#2469) [Documentation]: WordPress.DB.PreparedSQL (WordPress#2454) ...
While working on #2512, I noticed an unnecessary variable initialization, so I'm creating this PR to suggest that it be removed. Its value is immediately overridden in an if/else below.
https://github.com/rodrigoprimo/WordPress-Coding-Standards/blob/690f05a51d190586e0bb0426a0f04242224d0723/WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php#L727
https://github.com/rodrigoprimo/WordPress-Coding-Standards/blob/690f05a51d190586e0bb0426a0f04242224d0723/WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php#L749