Opened 8 years ago
Closed 3 years ago
#43755 closed defect (bug) (duplicate)
CS: Fix violations for wp-includes/canonical.php
| Reported by: | jipmoors | Owned by: | netweb |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Canonical | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | coding-standards |
Description
Started working on this at WordCamp London contributor day.
Attachments (2)
Change History (11)
#6
@
8 years ago
- Keywords needs-refresh added
- Milestone 5.1 → 5.2
This is going to need some careful review. A couple of notes from my brief read through:
When moving an assignment out of a conditional block, it should be moved to before the conditional, unless there are significant performance reasons to move it inside.
eg:
if ( is_feed() && ( $id = get_query_var( 'p' ) ) ) { // ... }
would become:
$id = get_query_var( 'p' ); if ( $id && is_feed() ) { // ... }
There's no need to add an empty() call where there wasn't one before.
Similarly, there's no need to add extra type checks. If the value returned by get_permalink() is truth-y, you can assume it's a string.
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Have made some additional changes to make sure
wp_parse_urlis used on all occasions.Also to be able to ignore the
preparestatement sniff, have made sure all parts of the query have been prepared.I can imagine this could be a separate patch or at least be a separate commit, but it was in line of fixing the code sniff.
Have ran all unit tests and did not encounter any problems.