Skip to content

Commit c0611b0

Browse files
committed
PHPStan fixes
1 parent 698da34 commit c0611b0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Post_Revision_Command.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,20 @@ class Post_Revision_Command {
5656
* Success: Restored revision 123.
5757
*
5858
* @subcommand restore
59+
*
60+
* @param array{0: string} $args Positional arguments.
5961
*/
6062
public function restore( $args ) {
6163
$revision_id = (int) $args[0];
6264

6365
// Get the revision post
6466
$revision = wp_get_post_revision( $revision_id );
6567

68+
/**
69+
* Work around https://core.trac.wordpress.org/ticket/64643.
70+
* @var int $revision_id
71+
*/
72+
6673
if ( ! $revision ) {
6774
WP_CLI::error( "Invalid revision ID {$revision_id}." );
6875
}
@@ -101,6 +108,9 @@ public function restore( $args ) {
101108
* $ wp post revision diff 123
102109
*
103110
* @subcommand diff
111+
*
112+
* @param array{0: string, 1?: string} $args Positional arguments.
113+
* @param array{field?: string} $assoc_args Associative arguments.
104114
*/
105115
public function diff( $args, $assoc_args ) {
106116
$from_id = (int) $args[0];
@@ -109,6 +119,12 @@ public function diff( $args, $assoc_args ) {
109119

110120
// Get the 'from' revision or post
111121
$from_revision = wp_get_post_revision( $from_id );
122+
123+
/**
124+
* Work around https://core.trac.wordpress.org/ticket/64643.
125+
* @var int $from_id
126+
*/
127+
112128
if ( ! $from_revision instanceof \WP_Post ) {
113129
// Try as a regular post
114130
$from_revision = get_post( $from_id );
@@ -121,6 +137,12 @@ public function diff( $args, $assoc_args ) {
121137
$to_revision = null;
122138
if ( $to_id ) {
123139
$to_revision = wp_get_post_revision( $to_id );
140+
141+
/**
142+
* Work around https://core.trac.wordpress.org/ticket/64643.
143+
* @var int $to_id
144+
*/
145+
124146
if ( ! $to_revision instanceof \WP_Post ) {
125147
// Try as a regular post
126148
$to_revision = get_post( $to_id );

0 commit comments

Comments
 (0)