Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 1 addition & 34 deletions src/Export_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ private function validate_args( $args ) {

foreach ( $args as $key => $value ) {
if ( is_callable( [ $this, 'check_' . $key ] ) ) {
/** @phpstan-ignore argument.type */
$result = call_user_func( [ $this, 'check_' . $key ], $value );
if ( false === $result ) {
Comment on lines 272 to 275
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validate_args() removes the PHPStan suppression but still passes an inline array expression into is_callable()/call_user_func(). PHPStan generally can’t narrow this expression to callable, which can re-trigger argument.type errors. Store the callback into a local variable (or use a dynamic method call via a $method variable) so the is_callable() check can narrow the type before invocation.

Copilot uses AI. Check for mistakes.
$has_errors = true;
Expand All @@ -291,8 +290,6 @@ private function validate_args( $args ) {

/**
* @param string $path
*
* @phpstan-ignore method.unused
*/
private function check_dir( $path ) {
if ( empty( $path ) ) {
Expand All @@ -310,8 +307,6 @@ private function check_dir( $path ) {

/**
* @param string $date
*
* @phpstan-ignore method.unused
*/
private function check_start_date( $date ) {
if ( null === $date ) {
Expand All @@ -329,8 +324,6 @@ private function check_start_date( $date ) {

/**
* @param string $date
*
* @phpstan-ignore method.unused
*/
private function check_end_date( $date ) {
if ( null === $date ) {
Expand All @@ -348,8 +341,6 @@ private function check_end_date( $date ) {

/**
* @param string $post_type
*
* @phpstan-ignore method.unused
*/
private function check_post_type( $post_type ) {
if ( null === $post_type || 'any' === $post_type ) {
Expand Down Expand Up @@ -377,8 +368,6 @@ private function check_post_type( $post_type ) {

/**
* @param string $post_type
*
* @phpstan-ignore method.unused
*/
private function check_post_type__not_in( $post_type ) {
if ( null === $post_type ) {
Expand Down Expand Up @@ -406,8 +395,6 @@ private function check_post_type__not_in( $post_type ) {

/**
* @param string $post__in
*
* @phpstan-ignore method.unused
*/
private function check_post__in( $post__in ) {
if ( null === $post__in ) {
Expand All @@ -427,8 +414,6 @@ private function check_post__in( $post__in ) {

/**
* @param string $start_id
*
* @phpstan-ignore method.unused
*/
private function check_start_id( $start_id ) {
if ( null === $start_id ) {
Expand All @@ -449,8 +434,6 @@ private function check_start_id( $start_id ) {

/**
* @param string $author
*
* @phpstan-ignore method.unused
*/
private function check_author( $author ) {
if ( null === $author ) {
Expand Down Expand Up @@ -486,7 +469,7 @@ private function check_author( $author ) {
}

/**
* @phpstan-ignore method.unused
* @param int|string|null $num
*/
private function check_max_num_posts( $num ) {
if ( null !== $num && ( ! is_numeric( $num ) || $num <= 0 ) ) {
Expand All @@ -501,8 +484,6 @@ private function check_max_num_posts( $num ) {

/**
* @param string $category
*
* @phpstan-ignore method.unused
*/
private function check_category( $category ) {
if ( null === $category ) {
Expand All @@ -524,8 +505,6 @@ private function check_category( $category ) {

/**
* @param string $status
*
* @phpstan-ignore method.unused
*/
private function check_post_status( $status ) {
if ( null === $status ) {
Expand All @@ -549,8 +528,6 @@ private function check_post_status( $status ) {

/**
* @param string|null $skip
*
* @phpstan-ignore method.unused
*/
private function check_skip_comments( $skip ) {
if ( null === $skip ) {
Expand All @@ -567,8 +544,6 @@ private function check_skip_comments( $skip ) {

/**
* @param string|null $skip
*
* @phpstan-ignore method.unused
*/
private function check_skip_authors( $skip ) {
if ( null === $skip ) {
Expand All @@ -585,8 +560,6 @@ private function check_skip_authors( $skip ) {

/**
* @param string|null $skip
*
* @phpstan-ignore method.unused
*/
private function check_skip_terms( $skip ) {
if ( null === $skip ) {
Expand All @@ -603,8 +576,6 @@ private function check_skip_terms( $skip ) {

/**
* @param string $size
*
* @phpstan-ignore method.unused
*/
private function check_max_file_size( $size ) {
if ( ! is_numeric( $size ) ) {
Expand All @@ -619,8 +590,6 @@ private function check_max_file_size( $size ) {

/**
* @param string $once
*
* @phpstan-ignore method.unused
*/
private function check_include_once( $once ) {
if ( null === $once ) {
Expand All @@ -642,8 +611,6 @@ private function check_include_once( $once ) {

/**
* @param string $allow_orphan_terms
*
* @phpstan-ignore method.unused
*/
private function check_allow_orphan_terms( $allow_orphan_terms ) {
if ( null === $allow_orphan_terms ) {
Expand Down
Loading