@@ -8,7 +8,7 @@ class Find_Command {
8
8
/**
9
9
* Paths we can probably ignore recursion into.
10
10
*
11
- * @var array
11
+ * @var array<string>
12
12
*/
13
13
private $ ignored_paths = [
14
14
// System directories
@@ -94,21 +94,21 @@ class Find_Command {
94
94
/**
95
95
* Start time for the script.
96
96
*
97
- * @var integer
97
+ * @var float
98
98
*/
99
- private $ start_time = false ;
99
+ private $ start_time ;
100
100
101
101
/**
102
102
* Resolved alias paths
103
103
*
104
- * @var array
104
+ * @var array<string, string>
105
105
*/
106
106
private $ resolved_aliases = [];
107
107
108
108
/**
109
109
* Found WordPress installations.
110
110
*
111
- * @var array
111
+ * @var array<string, array<string, mixed>>
112
112
*/
113
113
private $ found_wp = [];
114
114
@@ -190,7 +190,7 @@ class Find_Command {
190
190
*/
191
191
public function __invoke ( $ args , $ assoc_args ) {
192
192
list ( $ path ) = $ args ;
193
- $ this ->base_path = realpath ( $ path );
193
+ $ this ->base_path = ( string ) realpath ( $ path );
194
194
if ( ! $ this ->base_path ) {
195
195
WP_CLI ::error ( 'Invalid path specified. ' );
196
196
}
@@ -235,7 +235,7 @@ private function recurse_directory( $path ) {
235
235
// Don't recurse directories that probably don't have a WordPress installation.
236
236
if ( ! $ this ->skip_ignored_paths ) {
237
237
// Assume base path doesn't need comparison
238
- $ compared_path = preg_replace ( '#^ ' . preg_quote ( $ this ->base_path , '# ' ) . '# ' , '' , $ path );
238
+ $ compared_path = ( string ) preg_replace ( '#^ ' . preg_quote ( $ this ->base_path , '# ' ) . '# ' , '' , $ path );
239
239
// Ignore all hidden system directories
240
240
$ bits = explode ( '/ ' , trim ( $ compared_path , '/ ' ) );
241
241
$ current_dir = array_pop ( $ bits );
@@ -276,7 +276,7 @@ private function recurse_directory( $path ) {
276
276
try {
277
277
$ transformer = new WPConfigTransformer ( $ config_path );
278
278
foreach ( [ 'db_host ' , 'db_name ' , 'db_user ' ] as $ constant ) {
279
- $ value = $ transformer ->get_value ( 'constant ' , strtoupper ( $ constant ) );
279
+ $ value = ( string ) $ transformer ->get_value ( 'constant ' , strtoupper ( $ constant ) );
280
280
// Clean up strings.
281
281
$ first = substr ( $ value , 0 , 1 );
282
282
$ last = substr ( $ value , -1 );
@@ -309,6 +309,10 @@ private function recurse_directory( $path ) {
309
309
return ;
310
310
}
311
311
$ this ->log ( "Recursing into ' {$ path }' " );
312
+
313
+ /**
314
+ * @var SplFileInfo $file_info
315
+ */
312
316
foreach ( $ iterator as $ file_info ) {
313
317
if ( $ file_info ->isDir () ) {
314
318
++$ this ->current_depth ;
@@ -322,7 +326,7 @@ private function recurse_directory( $path ) {
322
326
* Get the WordPress version for the installation, without executing the file.
323
327
*/
324
328
private static function get_wp_version ( $ path ) {
325
- $ contents = file_get_contents ( $ path );
329
+ $ contents = ( string ) file_get_contents ( $ path );
326
330
preg_match ( '#\$wp_version\s?=\s?[ \'"]([^ \'"]+)[ \'"]# ' , $ contents , $ matches );
327
331
return ! empty ( $ matches [1 ] ) ? $ matches [1 ] : '' ;
328
332
}
@@ -359,7 +363,7 @@ private function log( $message ) {
359
363
/**
360
364
* Format a log timestamp into something human-readable.
361
365
*
362
- * @param integer $s Log time in seconds
366
+ * @param int|float $s Log time in seconds
363
367
* @return string
364
368
*/
365
369
private static function format_log_timestamp ( $ s ) {
0 commit comments