@@ -8,7 +8,7 @@ class Find_Command {
88 /**
99 * Paths we can probably ignore recursion into.
1010 *
11- * @var array
11+ * @var array<string>
1212 */
1313 private $ ignored_paths = [
1414 // System directories
@@ -94,21 +94,21 @@ class Find_Command {
9494 /**
9595 * Start time for the script.
9696 *
97- * @var integer
97+ * @var float
9898 */
99- private $ start_time = false ;
99+ private $ start_time ;
100100
101101 /**
102102 * Resolved alias paths
103103 *
104- * @var array
104+ * @var array<string, string>
105105 */
106106 private $ resolved_aliases = [];
107107
108108 /**
109109 * Found WordPress installations.
110110 *
111- * @var array
111+ * @var array<string, array<string, mixed>>
112112 */
113113 private $ found_wp = [];
114114
@@ -190,7 +190,7 @@ class Find_Command {
190190 */
191191 public function __invoke ( $ args , $ assoc_args ) {
192192 list ( $ path ) = $ args ;
193- $ this ->base_path = realpath ( $ path );
193+ $ this ->base_path = ( string ) realpath ( $ path );
194194 if ( ! $ this ->base_path ) {
195195 WP_CLI ::error ( 'Invalid path specified. ' );
196196 }
@@ -235,7 +235,7 @@ private function recurse_directory( $path ) {
235235 // Don't recurse directories that probably don't have a WordPress installation.
236236 if ( ! $ this ->skip_ignored_paths ) {
237237 // 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 );
239239 // Ignore all hidden system directories
240240 $ bits = explode ( '/ ' , trim ( $ compared_path , '/ ' ) );
241241 $ current_dir = array_pop ( $ bits );
@@ -276,7 +276,7 @@ private function recurse_directory( $path ) {
276276 try {
277277 $ transformer = new WPConfigTransformer ( $ config_path );
278278 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 ) );
280280 // Clean up strings.
281281 $ first = substr ( $ value , 0 , 1 );
282282 $ last = substr ( $ value , -1 );
@@ -309,6 +309,10 @@ private function recurse_directory( $path ) {
309309 return ;
310310 }
311311 $ this ->log ( "Recursing into ' {$ path }' " );
312+
313+ /**
314+ * @var SplFileInfo $file_info
315+ */
312316 foreach ( $ iterator as $ file_info ) {
313317 if ( $ file_info ->isDir () ) {
314318 ++$ this ->current_depth ;
@@ -322,7 +326,7 @@ private function recurse_directory( $path ) {
322326 * Get the WordPress version for the installation, without executing the file.
323327 */
324328 private static function get_wp_version ( $ path ) {
325- $ contents = file_get_contents ( $ path );
329+ $ contents = ( string ) file_get_contents ( $ path );
326330 preg_match ( '#\$wp_version\s?=\s?[ \'"]([^ \'"]+)[ \'"]# ' , $ contents , $ matches );
327331 return ! empty ( $ matches [1 ] ) ? $ matches [1 ] : '' ;
328332 }
@@ -359,7 +363,7 @@ private function log( $message ) {
359363 /**
360364 * Format a log timestamp into something human-readable.
361365 *
362- * @param integer $s Log time in seconds
366+ * @param int|float $s Log time in seconds
363367 * @return string
364368 */
365369 private static function format_log_timestamp ( $ s ) {
0 commit comments