Skip to content

Commit 1545f7d

Browse files
committed
Fix minor issues through phpcbf
1 parent 582bdb9 commit 1545f7d

9 files changed

+179
-142
lines changed

utils/get-package-require-from-composer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
$file = $argv[1];
44
if ( ! file_exists( $file ) ) {
55
echo 'File does not exist.';
6-
exit(1);
6+
exit( 1 );
77
}
88

99
$contents = file_get_contents( $file );
1010
$composer = json_decode( $contents );
1111

1212
if ( empty( $composer ) || ! is_object( $composer ) ) {
1313
echo 'Invalid composer.json for package.';
14-
exit(1);
14+
exit( 1 );
1515
}
1616

1717
if ( empty( $composer->autoload->files ) ) {
1818
echo 'composer.json must specify valid "autoload" => "files"';
19-
exit(1);
19+
exit( 1 );
2020
}
2121

2222
echo implode( PHP_EOL, $composer->autoload->files );
23-
exit(0);
23+
exit( 0 );

utils/maintenance/Contrib_List_Command.php

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,24 @@ final class Contrib_List_Command {
2525
*/
2626
public function __invoke( $_, $assoc_args ) {
2727

28-
$contributors = array();
28+
$contributors = array();
2929
$pull_request_count = 0;
3030

3131
// Get the contributors to the current open large project milestones
32-
foreach( array( 'wp-cli/wp-cli-bundle', 'wp-cli/wp-cli', 'wp-cli/handbook', 'wp-cli/wp-cli.github.com' ) as $repo ) {
32+
foreach ( array( 'wp-cli/wp-cli-bundle', 'wp-cli/wp-cli', 'wp-cli/handbook', 'wp-cli/wp-cli.github.com' ) as $repo ) {
3333
$milestones = GitHub::get_project_milestones( $repo );
3434
// Cheap way to get the latest milestone
3535
$milestone = array_shift( $milestones );
3636
if ( ! $milestone ) {
3737
continue;
3838
}
3939
WP_CLI::log( 'Current open ' . $repo . ' milestone: ' . $milestone->title );
40-
$pull_requests = GitHub::get_project_milestone_pull_requests( $repo, $milestone->number );
40+
$pull_requests = GitHub::get_project_milestone_pull_requests( $repo, $milestone->number );
4141
$repo_contributors = GitHub::parse_contributors_from_pull_requests( $pull_requests );
4242
WP_CLI::log( ' - Contributors: ' . count( $repo_contributors ) );
4343
WP_CLI::log( ' - Pull requests: ' . count( $pull_requests ) );
4444
$pull_request_count += count( $pull_requests );
45-
$contributors = array_merge( $contributors, $repo_contributors );
45+
$contributors = array_merge( $contributors, $repo_contributors );
4646
}
4747

4848
// Identify all command dependencies and their contributors
@@ -53,7 +53,7 @@ public function __invoke( $_, $assoc_args ) {
5353
$milestones = GitHub::get_project_milestones( 'wp-cli/wp-cli', array( 'state' => 'closed' ) );
5454
// Cheap way to get the latest closed milestone
5555
$milestone = array_shift( $milestones );
56-
$tag = is_object( $milestone ) ? "v{$milestone->title}" : 'master';
56+
$tag = is_object( $milestone ) ? "v{$milestone->title}" : 'master';
5757

5858
// TODO: Only needed for switch from v1 to v2.
5959
if ( 'wp-cli/wp-cli' === $bundle ) {
@@ -69,48 +69,58 @@ public function __invoke( $_, $assoc_args ) {
6969
$composer_json = json_decode( $response->body, true );
7070

7171
// TODO: Only need for initial v2.
72-
$composer_json['packages'][] = array( 'name' => 'wp-cli/i18n-command', 'version' => 'v2' );
73-
usort( $composer_json['packages'], function ( $a, $b ) {
74-
return $a['name'] < $b['name'] ? -1 : 1;
75-
} );
72+
$composer_json['packages'][] = array(
73+
'name' => 'wp-cli/i18n-command',
74+
'version' => 'v2',
75+
);
76+
usort(
77+
$composer_json['packages'],
78+
function ( $a, $b ) {
79+
return $a['name'] < $b['name'] ? -1 : 1;
80+
}
81+
);
7682

77-
foreach( $composer_json['packages'] as $package ) {
78-
$package_name = $package['name'];
83+
foreach ( $composer_json['packages'] as $package ) {
84+
$package_name = $package['name'];
7985
$version_constraint = str_replace( 'v', '', $package['version'] );
8086
if ( ! preg_match( '#^wp-cli/.+-command$#', $package_name )
81-
&& ! in_array( $package_name, array(
82-
'wp-cli/wp-cli-tests',
83-
'wp-cli/regenerate-readme',
84-
'wp-cli/autoload-splitter',
85-
'wp-cli/wp-config-transformer',
86-
'wp-cli/php-cli-tools',
87-
'wp-cli/spyc',
88-
), true ) ) {
87+
&& ! in_array(
88+
$package_name,
89+
array(
90+
'wp-cli/wp-cli-tests',
91+
'wp-cli/regenerate-readme',
92+
'wp-cli/autoload-splitter',
93+
'wp-cli/wp-config-transformer',
94+
'wp-cli/php-cli-tools',
95+
'wp-cli/spyc',
96+
),
97+
true
98+
) ) {
8999
continue;
90100
}
91101
// Closed milestones denote a tagged release
92-
$milestones = GitHub::get_project_milestones( $package_name, array( 'state' => 'closed' ) );
93-
$milestone_ids = array();
102+
$milestones = GitHub::get_project_milestones( $package_name, array( 'state' => 'closed' ) );
103+
$milestone_ids = array();
94104
$milestone_titles = array();
95-
foreach( $milestones as $milestone ) {
105+
foreach ( $milestones as $milestone ) {
96106
if ( ! version_compare( $milestone->title, $version_constraint, '>' ) ) {
97107
continue;
98108
}
99-
$milestone_ids[] = $milestone->number;
109+
$milestone_ids[] = $milestone->number;
100110
$milestone_titles[] = $milestone->title;
101111
}
102112
// No shipped releases for this milestone.
103113
if ( empty( $milestone_ids ) ) {
104114
continue;
105115
}
106116
WP_CLI::log( 'Closed ' . $package_name . ' milestone(s): ' . implode( ', ', $milestone_titles ) );
107-
foreach( $milestone_ids as $milestone_id ) {
108-
$pull_requests = GitHub::get_project_milestone_pull_requests( $package_name, $milestone_id );
117+
foreach ( $milestone_ids as $milestone_id ) {
118+
$pull_requests = GitHub::get_project_milestone_pull_requests( $package_name, $milestone_id );
109119
$repo_contributors = GitHub::parse_contributors_from_pull_requests( $pull_requests );
110120
WP_CLI::log( ' - Contributors: ' . count( $repo_contributors ) );
111121
WP_CLI::log( ' - Pull requests: ' . count( $pull_requests ) );
112122
$pull_request_count += count( $pull_requests );
113-
$contributors = array_merge( $contributors, $repo_contributors );
123+
$contributors = array_merge( $contributors, $repo_contributors );
114124
}
115125
}
116126

@@ -121,7 +131,7 @@ public function __invoke( $_, $assoc_args ) {
121131
asort( $contributors, SORT_NATURAL | SORT_FLAG_CASE );
122132
if ( in_array( $assoc_args['format'], array( 'markdown', 'html' ) ) ) {
123133
$contrib_list = '';
124-
foreach( $contributors as $url => $login ) {
134+
foreach ( $contributors as $url => $login ) {
125135
if ( 'markdown' === $assoc_args['format'] ) {
126136
$contrib_list .= '[@' . $login . '](' . $url . '), ';
127137
} elseif ( 'html' === $assoc_args['format'] ) {

utils/maintenance/GitHub.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ public static function remove_label(
109109

110110
$headers['http_verb'] = 'DELETE';
111111

112-
list( $body, $headers ) = self::request( $request_url, $args,
113-
$headers );
112+
list( $body, $headers ) = self::request(
113+
$request_url,
114+
$args,
115+
$headers
116+
);
114117

115118
return $body;
116119
}
@@ -142,8 +145,11 @@ public static function add_label(
142145

143146
$args = array( $label );
144147

145-
list( $body, $headers ) = self::request( $request_url, $args,
146-
$headers );
148+
list( $body, $headers ) = self::request(
149+
$request_url,
150+
$args,
151+
$headers
152+
);
147153

148154
return $body;
149155
}

utils/maintenance/Milestones_after_Command.php renamed to utils/maintenance/Milestones_After_Command.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ function ( $milestone ) use (
4848
);
4949

5050
$milestone_titles = array_map(
51-
function ( $milestone ) { return $milestone->title; },
51+
function ( $milestone ) {
52+
return $milestone->title;
53+
},
5254
$milestones
5355
);
5456

utils/maintenance/Milestones_Since_Command.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ function ( $milestone ) use ( $date ) {
4141
);
4242

4343
$milestone_titles = array_map(
44-
function ( $milestone ) { return $milestone->title; },
44+
function ( $milestone ) {
45+
return $milestone->title;
46+
},
4547
$milestones
4648
);
4749

utils/maintenance/Release_Notes_Command.php

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,19 @@ private function get_bundle_release_notes( $source, $format ) {
111111
$tag = 'v1.5.1';
112112
}
113113

114-
$composer_lock_url = sprintf( 'https://raw.githubusercontent.com/%s/%s/composer.lock',
115-
$bundle, $tag );
114+
$composer_lock_url = sprintf(
115+
'https://raw.githubusercontent.com/%s/%s/composer.lock',
116+
$bundle,
117+
$tag
118+
);
116119
$response = Utils\http_request( 'GET', $composer_lock_url );
117120
if ( 200 !== $response->status_code ) {
118-
WP_CLI::error( sprintf( 'Could not fetch composer.json (HTTP code %d)',
119-
$response->status_code ) );
121+
WP_CLI::error(
122+
sprintf(
123+
'Could not fetch composer.json (HTTP code %d)',
124+
$response->status_code
125+
)
126+
);
120127
}
121128
$composer_json = json_decode( $response->body, true );
122129

@@ -125,22 +132,29 @@ private function get_bundle_release_notes( $source, $format ) {
125132
'name' => 'wp-cli/i18n-command',
126133
'version' => 'v2',
127134
);
128-
usort( $composer_json['packages'], function ( $a, $b ) {
129-
return $a['name'] < $b['name'] ? - 1 : 1;
130-
} );
135+
usort(
136+
$composer_json['packages'],
137+
function ( $a, $b ) {
138+
return $a['name'] < $b['name'] ? - 1 : 1;
139+
}
140+
);
131141

132142
foreach ( $composer_json['packages'] as $package ) {
133143
$package_name = $package['name'];
134144
$version_constraint = str_replace( 'v', '', $package['version'] );
135145
if ( ! preg_match( '#^wp-cli/.+-command$#', $package_name )
136-
&& ! in_array( $package_name, array(
137-
'wp-cli/wp-cli-tests',
138-
'wp-cli/regenerate-readme',
139-
'wp-cli/autoload-splitter',
140-
'wp-cli/wp-config-transformer',
141-
'wp-cli/php-cli-tools',
142-
'wp-cli/spyc',
143-
), true ) ) {
146+
&& ! in_array(
147+
$package_name,
148+
array(
149+
'wp-cli/wp-cli-tests',
150+
'wp-cli/regenerate-readme',
151+
'wp-cli/autoload-splitter',
152+
'wp-cli/wp-config-transformer',
153+
'wp-cli/php-cli-tools',
154+
'wp-cli/spyc',
155+
),
156+
true
157+
) ) {
144158
continue;
145159
}
146160

@@ -152,8 +166,11 @@ private function get_bundle_release_notes( $source, $format ) {
152166
array( 'state' => 'closed' )
153167
);
154168
foreach ( $milestones as $milestone ) {
155-
if ( ! version_compare( $milestone->title, $version_constraint,
156-
'>' ) ) {
169+
if ( ! version_compare(
170+
$milestone->title,
171+
$version_constraint,
172+
'>'
173+
) ) {
157174
continue;
158175
}
159176

utils/maintenance/Replace_Label_Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __invoke( $args, $assoc_args ) {
3434

3535
$delete = WP_CLI\Utils\get_flag_value( $assoc_args, 'delete', false );
3636

37-
foreach( GitHub::get_issues_by_label( $repo, $old_label ) as $issue ) {
37+
foreach ( GitHub::get_issues_by_label( $repo, $old_label ) as $issue ) {
3838
GitHub::remove_label( $repo, $issue->number, $old_label );
3939
GitHub::add_label( $repo, $issue->number, $new_label );
4040
}

utils/make-phar-spec.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
<?php
22

33
return array(
4-
'output' => array(
4+
'output' => array(
55
'runtime' => '=<path>',
6-
'file' => '<path>',
7-
'desc' => 'Path to output file',
6+
'file' => '<path>',
7+
'desc' => 'Path to output file',
88
),
99

10-
'version' => array(
10+
'version' => array(
1111
'runtime' => '=<version>',
12-
'file' => '<version>',
13-
'desc' => 'New package version',
12+
'file' => '<version>',
13+
'desc' => 'New package version',
1414
),
1515

1616
'store-version' => array(
1717
'runtime' => '',
18-
'file' => '<bool>',
18+
'file' => '<bool>',
1919
'default' => false,
20-
'desc' => 'If true the contents of ./VERSION will be set to the value passed to --version',
20+
'desc' => 'If true the contents of ./VERSION will be set to the value passed to --version',
2121
),
2222

23-
'quiet' => array(
23+
'quiet' => array(
2424
'runtime' => '',
25-
'file' => '<bool>',
25+
'file' => '<bool>',
2626
'default' => false,
27-
'desc' => 'Suppress informational messages',
27+
'desc' => 'Suppress informational messages',
2828
),
2929

30-
'build' => array(
30+
'build' => array(
3131
'runtime' => '=<cli>',
32-
'file' => '<cli>',
32+
'file' => '<cli>',
3333
'default' => '',
34-
'desc' => 'Create a minimum test build "cli", that only supports cli commands',
34+
'desc' => 'Create a minimum test build "cli", that only supports cli commands',
3535
),
3636
);
3737

0 commit comments

Comments
 (0)