Skip to content

Commit 2fc941c

Browse files
committed
Avoid variable abbreviations
1 parent fe2c33b commit 2fc941c

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

src/Comment_Command.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,18 @@ public function generate( $args, $assoc_args ) {
180180
$total = (int) $comment_count->total_comments;
181181
$limit = $total + $assoc_args['count'];
182182

183-
for ( $i = $total; $i < $limit; $i++ ) {
183+
for ( $index = $total; $index < $limit; $index++ ) {
184184
$comment_id = wp_insert_comment(
185185
[
186-
'comment_content' => "Comment {$i}",
186+
'comment_content' => "Comment {$index}",
187187
'comment_post_ID' => $assoc_args['post_id'],
188188
]
189189
);
190190
if ( 'progress' === $format ) {
191191
$notify->tick();
192192
} elseif ( 'ids' === $format ) {
193193
echo $comment_id;
194-
if ( $i < $limit - 1 ) {
194+
if ( $index < $limit - 1 ) {
195195
echo ' ';
196196
}
197197
}

src/Post_Command.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ public function generate( $args, $assoc_args ) {
785785
$current_depth = 1;
786786
$current_parent = 0;
787787

788-
for ( $i = $total; $i < $limit; $i++ ) {
788+
for ( $index = $total; $index < $limit; $index++ ) {
789789

790790
if ( $hierarchical ) {
791791

@@ -804,11 +804,11 @@ public function generate( $args, $assoc_args ) {
804804

805805
$args = [
806806
'post_type' => $post_type,
807-
'post_title' => ! empty( $post_title ) && $i === $total ? $label : "{$label} {$i}",
807+
'post_title' => ! empty( $post_title ) && $index === $total ? $label : "{$label} {$index}",
808808
'post_status' => $post_status,
809809
'post_author' => $post_author,
810810
'post_parent' => $current_parent,
811-
'post_name' => ! empty( $post_title ) ? sanitize_title( $post_title . ( $i === $total ? '' : "-{$i}" ) ) : "post-{$i}",
811+
'post_name' => ! empty( $post_title ) ? sanitize_title( $post_title . ( $index === $total ? '' : "-{$index}" ) ) : "post-{$index}",
812812
'post_date' => $post_date,
813813
'post_date_gmt' => $post_date_gmt,
814814
'post_content' => $post_content,
@@ -821,7 +821,7 @@ public function generate( $args, $assoc_args ) {
821821
$previous_post_id = $post_id;
822822
if ( 'ids' === $format ) {
823823
echo $post_id;
824-
if ( $i < $limit - 1 ) {
824+
if ( $index < $limit - 1 ) {
825825
echo ' ';
826826
}
827827
}

src/Term_Command.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ public function generate( $args, $assoc_args ) {
546546
$suspend_cache_invalidation = wp_suspend_cache_invalidation( true );
547547
$created = [];
548548

549-
for ( $i = $max_id + 1; $i <= $max_id + $count; $i++ ) {
549+
for ( $index = $max_id + 1; $index <= $max_id + $count; $index++ ) {
550550

551551
if ( $hierarchical ) {
552552

@@ -565,10 +565,10 @@ public function generate( $args, $assoc_args ) {
565565

566566
$args = [
567567
'parent' => $current_parent,
568-
'slug' => $slug . "-{$i}",
568+
'slug' => $slug . "-{$index}",
569569
];
570570

571-
$name = "{$label} {$i}";
571+
$name = "{$label} {$index}";
572572
$term = wp_insert_term( $name, $taxonomy, $args );
573573
if ( is_wp_error( $term ) ) {
574574
WP_CLI::warning( $term );
@@ -577,7 +577,7 @@ public function generate( $args, $assoc_args ) {
577577
$previous_term_id = $term['term_id'];
578578
if ( 'ids' === $format ) {
579579
echo $term['term_id'];
580-
if ( $i < $max_id + $count ) {
580+
if ( $index < $max_id + $count ) {
581581
echo ' ';
582582
}
583583
}

src/User_Command.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,9 @@ public function generate( $args, $assoc_args ) {
589589
$notify = Utils\make_progress_bar( 'Generating users', $assoc_args['count'] );
590590
}
591591

592-
for ( $i = $total; $i < $limit; $i++ ) {
593-
$login = "user_{$blog_id}_{$i}";
594-
$name = "User {$i}";
592+
for ( $index = $total; $index < $limit; $index++ ) {
593+
$login = "user_{$blog_id}_{$index}";
594+
$name = "User {$index}";
595595

596596
$user_id = wp_insert_user(
597597
[
@@ -612,7 +612,7 @@ public function generate( $args, $assoc_args ) {
612612
$notify->tick();
613613
} elseif ( 'ids' === $format ) {
614614
echo $user_id;
615-
if ( $i < $limit - 1 ) {
615+
if ( $index < $limit - 1 ) {
616616
echo ' ';
617617
}
618618
}
@@ -953,7 +953,7 @@ public function import_csv( $args, $assoc_args ) {
953953
$csv_data = new CsvIterator( $filename );
954954
}
955955

956-
foreach ( $csv_data as $i => $new_user ) {
956+
foreach ( $csv_data as $new_user ) {
957957
$defaults = [
958958
'role' => get_option( 'default_role' ),
959959
'user_pass' => wp_generate_password(),

src/WP_CLI/CommandWithTerms.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ protected function taxonomy_exists( $taxonomy ) {
313313
protected function prepare_terms( $field, $terms, $taxonomy ) {
314314
if ( 'id' === $field ) {
315315
$new_terms = [];
316-
foreach ( $terms as $i => $term_id ) {
316+
foreach ( $terms as $term_id ) {
317317
$term = get_term_by( 'term_id', $term_id, $taxonomy );
318318
if ( $term ) {
319319
$new_terms[] = $term->slug;

0 commit comments

Comments
 (0)