@@ -636,8 +636,6 @@ public function list_( $args, $assoc_args ) {
636636 $ query_args ['post_type ' ] = explode ( ', ' , $ query_args ['post_type ' ] );
637637 }
638638
639- // To be fixed in wp-cli/wp-cli.
640- // @phpstan-ignore property.notFound
641639 if ( 'ids ' === $ formatter ->format ) {
642640 $ query_args ['fields ' ] = 'ids ' ;
643641 $ query = new WP_Query ( $ query_args );
@@ -744,6 +742,9 @@ function ( $post ) {
744742 * Success: Added custom field.
745743 * Success: Added custom field.
746744 * Success: Added custom field.
745+ *
746+ * @param array<string> $args Positional arguments. Unused.
747+ * @param array{count: string, post_type: string, post_status: string, post_title: string, post_author: string, post_date?: string, post_date_gmt?: string, post_content?: string, max_depth: string, format: string} $assoc_args Associative arguments.
747748 */
748749 public function generate ( $ args , $ assoc_args ) {
749750 global $ wpdb ;
@@ -800,7 +801,7 @@ public function generate( $args, $assoc_args ) {
800801 WP_CLI ::error ( 'The parameter `post_content` reads from STDIN. ' );
801802 }
802803
803- $ post_data ['post_content ' ] = file_get_contents ( 'php://stdin ' );
804+ $ post_data ['post_content ' ] = ( string ) file_get_contents ( 'php://stdin ' );
804805 }
805806
806807 // Get the total number of posts.
@@ -821,7 +822,7 @@ public function generate( $args, $assoc_args ) {
821822
822823 $ notify = false ;
823824 if ( 'progress ' === $ format ) {
824- $ notify = Utils \make_progress_bar ( 'Generating posts ' , $ post_data ['count ' ] );
825+ $ notify = Utils \make_progress_bar ( 'Generating posts ' , ( int ) $ post_data ['count ' ] );
825826 }
826827
827828 $ previous_post_id = 0 ;
@@ -851,7 +852,7 @@ public function generate( $args, $assoc_args ) {
851852 ? $ label
852853 : "{$ label } {$ index }" ,
853854 'post_status ' => $ post_data ['post_status ' ],
854- 'post_author ' => $ post_data ['post_author ' ],
855+ 'post_author ' => ( int ) $ post_data ['post_author ' ],
855856 'post_parent ' => $ current_parent ,
856857 'post_name ' => ! empty ( $ post_data ['post_title ' ] )
857858 ? sanitize_title ( $ post_data ['post_title ' ] . ( $ index === $ total ? '' : "- {$ index }" ) )
@@ -875,10 +876,12 @@ public function generate( $args, $assoc_args ) {
875876 }
876877
877878 if ( 'progress ' === $ format ) {
879+ // @phpstan-ignore method.nonObject
878880 $ notify ->tick ();
879881 }
880882 }
881883 if ( 'progress ' === $ format ) {
884+ // @phpstan-ignore method.nonObject
882885 $ notify ->finish ();
883886 }
884887 }
0 commit comments