@@ -283,8 +283,13 @@ public function get( $args, $assoc_args ) {
283283 * $ wp user delete $(wp user list --role=contributor --field=ID | head -n 100)
284284 */
285285 public function delete ( $ args , $ assoc_args ) {
286- $ network = Utils \get_flag_value ( $ assoc_args , 'network ' ) && is_multisite ();
286+ $ network = Utils \get_flag_value ( $ assoc_args , 'network ' ) && is_multisite ();
287+
288+ /**
289+ * @var string|null $reassign
290+ */
287291 $ reassign = Utils \get_flag_value ( $ assoc_args , 'reassign ' );
292+ $ reassign = (int ) $ reassign ;
288293
289294 if ( $ network && $ reassign ) {
290295 WP_CLI ::error ( 'Reassigning content to a different user is not supported on multisite. ' );
@@ -982,7 +987,9 @@ public function list_caps( $args, $assoc_args ) {
982987 }
983988 break ;
984989 case 'user ' :
985- // Get the user's capabilities
990+ /**
991+ * @var array<string, int> $user_capabilities
992+ */
986993 $ user_capabilities = get_user_meta ( $ user ->ID , 'wp_capabilities ' , true );
987994
988995 // Loop through each capability and only return the non-inherited ones
@@ -993,7 +1000,9 @@ public function list_caps( $args, $assoc_args ) {
9931000 }
9941001 break ;
9951002 case 'role ' :
996- // Get the user's capabilities
1003+ /**
1004+ * @var array<string, int> $user_capabilities
1005+ */
9971006 $ user_capabilities = get_user_meta ( $ user ->ID , 'wp_capabilities ' , true );
9981007
9991008 // Loop through each capability and only return the inherited ones (including the role name)
@@ -1092,6 +1101,10 @@ public function import_csv( $args, $assoc_args ) {
10921101 $ file_object ->setFlags ( SplFileObject::READ_CSV );
10931102 $ csv_data = [];
10941103 $ indexes = [];
1104+
1105+ /**
1106+ * @var string[] $line
1107+ */
10951108 foreach ( $ file_object as $ line ) {
10961109 if ( empty ( $ line [0 ] ) ) {
10971110 continue ;
@@ -1102,6 +1115,9 @@ public function import_csv( $args, $assoc_args ) {
11021115 continue ;
11031116 }
11041117
1118+ /**
1119+ * @var array<string, string> $data
1120+ */
11051121 $ data = [];
11061122
11071123 foreach ( $ indexes as $ n => $ key ) {
@@ -1114,6 +1130,9 @@ public function import_csv( $args, $assoc_args ) {
11141130 $ csv_data = new CsvIterator ( $ filename );
11151131 }
11161132
1133+ /**
1134+ * @var array{ID: string, role: string, roles: string, user_pass: string, user_registered: string, display_name: string|false, user_login: string, user_email: string} $new_user
1135+ */
11171136 foreach ( $ csv_data as $ new_user ) {
11181137 $ defaults = [
11191138 'role ' => get_option ( 'default_role ' ),
@@ -1281,7 +1300,7 @@ public function import_csv( $args, $assoc_args ) {
12811300 */
12821301 public function reset_password ( $ args , $ assoc_args ) {
12831302 $ porcelain = Utils \get_flag_value ( $ assoc_args , 'porcelain ' );
1284- $ skip_email = Utils \get_flag_value ( $ assoc_args , 'skip-email ' );
1303+ $ skip_email = ( bool ) Utils \get_flag_value ( $ assoc_args , 'skip-email ' );
12851304 $ show_new_pass = Utils \get_flag_value ( $ assoc_args , 'show-password ' );
12861305
12871306 if ( $ skip_email ) {
0 commit comments