#58063 closed defect (bug) (invalid)
Replace 'else if' with 'elseif' in wp-includes/atomlib.php
Reported by: | wpfy | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 6.3 |
Component: | General | Keywords: | changes-requested close |
Focuses: | coding-standards | Cc: |
Description
The WordPress coding standards recommend using 'elseif' instead of 'else if' for conditionals to ensure consistency in the code syntax. This is because 'else if' is not compatible with the colon syntax for if|elseif blocks.
However, in the WordPress core file wp-includes/atomlib.php, on lines 251, 263, 265, and 305, 'else if' is used for conditionals. To ensure consistency with the WordPress coding standards and improve the readability and maintainability of the code, I propose replacing all instances of 'else if' with 'elseif' on these lines.
This change will ensure that the code follows the recommended syntax and is consistent with the rest of the WordPress core codebase.
I will create a pull request to the WordPress core repository with this change.
Change History (10)
This ticket was mentioned in PR #4293 on WordPress/wordpress-develop by @wpfy.
19 months ago
#1
- Keywords has-patch added; needs-patch removed
#2
@
19 months ago
@wpfy Hello and welcome to trac!
Each WordPress release has a general ticket for coding standards fixes, for the next major release of WordPress (6.3), the ticket is #57839.
You can save a little of your time by referring to that ticket in your pull requests, there's no need to open a ticket for each coding standards fix.
Once you've put together a few pull requests, drop a comment on #57839 to bring them to someone's attention.
#3
@
19 months ago
Hi @peterwilsoncc
Thank you so much for getting back to me and providing this helpful information. I was not aware that there is a general ticket for coding standards fixes for each WordPress release, and I appreciate you letting me know about ticket #57839 for the next major release of WordPress (6.3).
I apologize for any inconvenience caused by my previous ticket submissions, and I will make sure to refer to the general ticket in my future pull requests (Though I don’t know how to do it, if can give a short overview on it, that would be great) to avoid opening unnecessary tickets.
Thank you for taking the time to provide this guidance, and I look forward to contributing to the WordPress community.
#4
follow-up:
↓ 5
@
19 months ago
There's no need to apologize. You don't know what you don't know and no inconvenience was caused :)
To link the ticket to pull requests, you can just include a link to https://core.trac.wordpress.org/ticket/57839 in the pull requests description. Similar to what you've done in this pull request but using the generic ticket number instead.
Thanks for contributing.
#6
@
19 months ago
- Keywords changes-requested added
Hi there!
Thanks for ticket and PR! left feedback on PR. Thanks!
19 months ago
#7
Thanks @akramulhasan, Can you search similar instance in whole folder and correct it so we don't get similar ticket for other files?
Hi, @mukeshpanchal27
Done!
#8
@
19 months ago
- Keywords close added; has-patch removed
The files in /wp-includes/IXR/
are part of the /wp-includes/class-IXR.php
external library. See the license, copyright, etc.
In that terms it seems the (visual, stylistic) WP coding standards do not apply there unless that class is officially forked by WP and moved to a wordpress.org repo. See all the "improper" (according to the coding standards) line breaks before {
there. This does not apply to PHP compatibility fixes, and similar.
The WordPress coding standards recommend using 'elseif' instead of 'else if' for conditionals to ensure consistency in the code syntax. This is because 'else if' is not compatible with the colon syntax for if|elseif blocks.
However, in the WordPress core file wp-includes/atomlib.php, on lines 251, 263, 265, and 305, 'else if' is used for conditionals. To ensure consistency with the WordPress coding standards and improve the readability and maintainability of the code, I propose replacing all instances of 'else if' with 'elseif' on these lines.
This change will ensure that the code follows the recommended syntax and is consistent with the rest of the WordPress core codebase.
I will create a pull request to the WordPress core repository with this change.
Trac ticket: https://core.trac.wordpress.org/ticket/58063