Skip to content

Commit c4c4710

Browse files
committed
Extract array into properties
1 parent 64a5b1e commit c4c4710

File tree

2 files changed

+42
-32
lines changed

2 files changed

+42
-32
lines changed

utils/maintenance/Contrib_List_Command.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@
55

66
final class Contrib_List_Command {
77

8+
/**
9+
* Packages excluded from contributor list generation.
10+
* @var array
11+
*/
12+
private $excluded_packages = [
13+
'wp-cli/wp-cli-tests',
14+
'wp-cli/regenerate-readme',
15+
'wp-cli/autoload-splitter',
16+
'wp-cli/wp-config-transformer',
17+
'wp-cli/php-cli-tools',
18+
'wp-cli/spyc',
19+
];
20+
821
/**
922
* Lists all contributors to this release.
1023
*
@@ -84,18 +97,7 @@ function ( $a, $b ) {
8497
$package_name = $package['name'];
8598
$version_constraint = str_replace( 'v', '', $package['version'] );
8699
if ( ! preg_match( '#^wp-cli/.+-command$#', $package_name )
87-
&& ! in_array(
88-
$package_name,
89-
[
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-
) ) {
100+
&& ! in_array( $package_name, $this->excluded_packages, true ) ) {
99101
continue;
100102
}
101103
// Closed milestones denote a tagged release

utils/maintenance/Release_Notes_Command.php

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,32 @@
55

66
final class Release_Notes_Command {
77

8+
/**
9+
* Packages excluded from contributor list generation.
10+
* @var array
11+
*/
12+
private $excluded_packages = [
13+
'wp-cli/wp-cli-tests',
14+
'wp-cli/regenerate-readme',
15+
'wp-cli/autoload-splitter',
16+
'wp-cli/wp-config-transformer',
17+
'wp-cli/php-cli-tools',
18+
'wp-cli/spyc',
19+
];
20+
21+
/**
22+
* Higher-level packages that represent the principal project building
23+
* blocks.
24+
*
25+
* @var array
26+
*/
27+
private $higher_level_packages = [
28+
'wp-cli/wp-cli-bundle',
29+
'wp-cli/wp-cli',
30+
'wp-cli/handbook',
31+
'wp-cli/wp-cli.github.com',
32+
];
33+
834
/**
935
* Gets the release notes for one or more milestones of a repository.
1036
*
@@ -68,14 +94,7 @@ public function __invoke( $args, $assoc_args ) {
6894

6995
private function get_bundle_release_notes( $source, $format ) {
7096
// Get the release notes for the current open large project milestones.
71-
foreach (
72-
[
73-
'wp-cli/wp-cli-bundle',
74-
'wp-cli/wp-cli',
75-
'wp-cli/handbook',
76-
'wp-cli/wp-cli.github.com',
77-
] as $repo
78-
) {
97+
foreach ( $this->higher_level_packages as $repo ) {
7998
$milestones = GitHub::get_project_milestones( $repo );
8099
// Cheap way to get the latest milestone
81100
$milestone = array_shift( $milestones );
@@ -143,18 +162,7 @@ function ( $a, $b ) {
143162
$package_name = $package['name'];
144163
$version_constraint = str_replace( 'v', '', $package['version'] );
145164
if ( ! preg_match( '#^wp-cli/.+-command$#', $package_name )
146-
&& ! in_array(
147-
$package_name,
148-
[
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-
) ) {
165+
&& ! in_array( $package_name, $this->excluded_packages, true ) ) {
158166
continue;
159167
}
160168

0 commit comments

Comments
 (0)